Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

user5 2 rokov pred
rodič
commit
5c53c4ed63

+ 17 - 4
src/main/java/com/jeeplus/modules/centerservice/enums/TaskAliasEnum.java

@@ -1,5 +1,8 @@
 package com.jeeplus.modules.centerservice.enums;
 
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * 流程枚举
  */
@@ -30,21 +33,31 @@ public enum TaskAliasEnum {
         return cpaTaskAlias;
     }
 
-    public static TaskAliasEnum getByCcpm(String value) {
+    /**
+     * 根据ccpm流程key查询枚举
+     * @param value
+     * @return
+     */
+    public static TaskAliasEnum getByCcpmContains(String value) {
         TaskAliasEnum result = null;
         for (TaskAliasEnum s : values()) {
-            if (s.getCcpmTaskAlias() == value) {
+            List<String> stringList = Arrays.asList(s.getCcpmTaskAlias().split(","));
+            if (stringList.contains(value)) {
                 result = s;
-                break;
             }
         }
         return result;
     }
 
+    /**
+     * 根据cpa流程key查询枚举
+     * @param value
+     * @return
+     */
     public static TaskAliasEnum getByCpa(String value) {
         TaskAliasEnum result = null;
         for (TaskAliasEnum s : values()) {
-            if (s.getCpaTaskAlias() == value) {
+            if (s.getCpaTaskAlias().equals(value)) {
                 result = s;
                 break;
             }

+ 6 - 4
src/main/java/com/jeeplus/modules/centerservice/service/cpa/reimbursement/ReimbursementRequest.java

@@ -22,11 +22,12 @@ public class ReimbursementRequest {
      * @param id
      * @return
      */
-    public Object getById(String id) {
+    public Object getById(String id, String processDefKey) {
         String token = "";
         Map<String, Object> paramMap = new HashMap<>();
         paramMap.put("id", id);
-        Object res = restTemplateService.getCPA("/reimbursement/info/findById", token, paramMap);
+        paramMap.put("processDefKey", processDefKey);
+        Object res = restTemplateService.getCPA("/transpond/detailDistribute", token, paramMap);
         return res;
     }
 
@@ -37,13 +38,14 @@ public class ReimbursementRequest {
      * @param comment 审核意见
      * @return
      */
-    public Object auditFunc(String id, String flag, String comment) {
+    public Object auditFunc(String id, String flag, String comment, String processDefKey) {
         String token = "";
         Map<String, Object> bodyMap = new HashMap<>();
         bodyMap.put("id", id);
         bodyMap.put("flag", flag);
         bodyMap.put("comment", comment);
-        Object res = restTemplateService.postCPA("/reimbursement/info/auditFunc", token, null, bodyMap);
+        bodyMap.put("processDefKey", processDefKey);
+        Object res = restTemplateService.postCPA("/transpond/auditDistribute", token, null, bodyMap);
         return res;
     }
 

+ 5 - 4
src/main/java/com/jeeplus/modules/centerservice/service/cpa/reimbursement/ReimbursementService.java

@@ -35,13 +35,14 @@ public class ReimbursementService {
      * @return
      * @throws Exception
      */
-    public WorkReimbursement getReimbursementById(String id) throws Exception{
+    public WorkReimbursement getReimbursementById(String id, String processDefKey) throws Exception{
         WorkReimbursement workReimbursement = new WorkReimbursement();
         if (StringUtils.isNotBlank(id)) {
-            Object res = reimbursementRequest.getById(id);
+            Object res = reimbursementRequest.getById(id, processDefKey);
             if(Objects.nonNull(res)) {
                 Map<String,Object> reim = JSONObject.parseObject(JSON.toJSONString(res));
                 workReimbursement = convertReimbursement(reim); // 格式转换
+                workReimbursement.setType(processDefKey);
             }
         }
         return workReimbursement;
@@ -222,9 +223,9 @@ public class ReimbursementService {
      * 报销审核
      * @return
      */
-    public Map<String,Object> auditFunc(String id,String flag,String comment) {
+    public Map<String,Object> auditFunc(String id,String flag,String comment, String processDefKey) {
         Map<String,Object> res = new HashMap<>();
-        Object o = reimbursementRequest.auditFunc(id, flag, comment);
+        Object o = reimbursementRequest.auditFunc(id, flag, comment, processDefKey);
         if (Objects.nonNull(o)) {
             res.putAll(JSONObject.parseObject(JSON.toJSONString(o)));
         }

+ 92 - 8
src/main/java/com/jeeplus/modules/centerservice/utils/ConvertServiceUtil.java

@@ -34,12 +34,16 @@ public class ConvertServiceUtil {
                 resp.add(workProjectNotify);
             } else if ("cpa".equals(workProjectNotify.getBelongProject())) {
                 if (StringUtils.isNotBlank(workProjectNotify.getType())) {
-                    if (StringUtils.isNotBlank(cpa_task) && cpa_task.contains(workProjectNotify.getType())) {
-                        TaskAliasEnum byCpaEnum = TaskAliasEnum.getByCpa(workProjectNotify.getType());
-                        if (Objects.nonNull(byCpaEnum)) {
-                            String[] split = byCpaEnum.getCcpmTaskAlias().split(",");
-                            workProjectNotify.setType(Arrays.asList(split).get(0));
-                            resp.add(workProjectNotify);
+                    if (StringUtils.isNotBlank(cpa_task)) {
+                        String[] split = cpa_task.split(",");
+                        List<String> cpaTaskList = Arrays.asList(split);
+                        if (cpaTaskList.size()>0 && cpaTaskList.contains(workProjectNotify.getType())) {
+                            TaskAliasEnum byCpaEnum = TaskAliasEnum.getByCpa(workProjectNotify.getType());
+                            if (Objects.nonNull(byCpaEnum)) {
+                                String[] splits = byCpaEnum.getCcpmTaskAlias().split(",");
+                                workProjectNotify.setType(Arrays.asList(splits).get(0));
+                                resp.add(workProjectNotify);
+                            }
                         }
                     }
                 }
@@ -49,7 +53,7 @@ public class ConvertServiceUtil {
     }
 
     /**
-     *
+     * 将本系统待办信息字段改为center字段(批量)
      * @param workProjectNotifyList
      * @return
      */
@@ -63,7 +67,7 @@ public class ConvertServiceUtil {
     }
 
     /**
-     * 将本系统待办信息字段改为业务系统字段
+     * 将本系统待办信息字段改为center字段
      * @param workProjectNotify
      * @return
      */
@@ -236,6 +240,10 @@ public class ConvertServiceUtil {
             // 将数据分页
             page.setCount(list.size());
             int startIndex = (int) ((page.getPageNo() - 1) * page.getPageSize());
+            if (startIndex > list.size()) {
+                startIndex = 0;
+                page.setPageNo(1);
+            }
             for (int i = 0; i < page.getPageSize() ; i ++) {
                 if (startIndex == list.size() || Objects.isNull(list.get(startIndex))) {
                     break;
@@ -260,4 +268,80 @@ public class ConvertServiceUtil {
         String format = sdf.format(dt);
         return format;
     }
+
+    /**
+     * 将本系统“已办”信息字段改为center字段(批量)
+     * @param workProjectNotifyList
+     * @return
+     */
+    public static List<Map<String,Object>> copyHisTaskListToCenter(List<WorkProjectNotify> workProjectNotifyList) {
+        List<Map<String, Object>> res = new ArrayList<>();
+        for (WorkProjectNotify workProjectNotify : workProjectNotifyList) {
+            Map<String, Object> stringObjectMap = copyHisTaskToCenter(workProjectNotify);
+            res.add(stringObjectMap);
+        }
+        return res;
+    }
+
+    /**
+     * 将本系统“已办”信息字段改为center字段
+     * @param workProjectNotify
+     * @return
+     */
+    public static Map<String,Object> copyHisTaskToCenter(WorkProjectNotify workProjectNotify) {
+        Map<String, Object> res = new HashMap<>();
+        Map<String, Object> vars = new HashMap<>();
+        if (Objects.nonNull(workProjectNotify)) {
+            // 所属系统
+            if (Objects.nonNull(workProjectNotify.getBelongProject())) {
+                res.put("belongProject", workProjectNotify.getBelongProject());
+            } else {
+                res.put("belongProject", "ccpm");
+            }
+            // 标题
+            if (Objects.nonNull(workProjectNotify.getTitle())){
+                vars.put("title", workProjectNotify.getTitle());
+                res.put("title", workProjectNotify.getTitle());
+            }
+            // 流程名称
+            if (Objects.nonNull(workProjectNotify.getTypeLabel())){
+                res.put("processDefinitionName", workProjectNotify.getTypeLabel());
+            }
+            // 流程类型
+            if (Objects.nonNull(workProjectNotify.getType())){
+                res.put("processDefKey", workProjectNotify.getType());
+            }
+            // 当前环节
+            if (Objects.nonNull(workProjectNotify.getNotifyRole())){
+                res.put("name", workProjectNotify.getNotifyRole());
+            }
+            // 流程发起人
+            if (Objects.nonNull(workProjectNotify.getCreateUserName())){
+                vars.put("userName", workProjectNotify.getCreateUserName());
+            }
+            // 开始时间
+            if (Objects.nonNull(workProjectNotify.getWapCreateDate())){
+                res.put("createTime", workProjectNotify.getWapCreateDate());
+//                task.setCreateTime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).parse(map.get("createDate").toString()));
+            }
+            // 结束时间
+            if (Objects.nonNull(workProjectNotify.getWapEndDate())){
+                res.put("endTime", workProjectNotify.getWapEndDate());
+            }
+            // 流程id
+            if (Objects.nonNull(workProjectNotify.getId())){
+                res.put("executionId", workProjectNotify.getId());
+            }
+            // 数据id
+            if (Objects.nonNull(workProjectNotify.getNotifyId())){
+                res.put("businessId", workProjectNotify.getNotifyId());
+            }
+            // 审批状态
+            if (Objects.nonNull(workProjectNotify.getRemarks())){
+                res.put("status", workProjectNotify.getRemarks());
+            }
+        }
+        res.put("vars", vars);
+        return res;
+    }
 }

+ 1 - 1
src/main/java/com/jeeplus/modules/centerservice/utils/RestTemplateService.java

@@ -60,7 +60,7 @@ public class RestTemplateService {
             }
             String url = getUrl(hostAddress, path, paramMap);
             HttpHeaders httpHeaders = new HttpHeaders();
-            httpHeaders.add("token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2ODI2NjU3MjYsInVzZXJuYW1lIjoi5r2Y5LitIn0.A6ph05Hy6fjGwO4NKCgBIIpbvD0woc1xplW7H9aK0FM");
+            httpHeaders.add("token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2ODMyNTM4NTYsInVzZXJuYW1lIjoi5r2Y5LitIn0.fWlfAzHkyscE-_09kLWvJJLVKHPT1PW64r6wFkVXqcM");
             httpHeaders.add("Accept", MediaType.ALL_VALUE);
             //        httpHeaders.add("cookie", "jeeplus.session.id=0635611b0f5a4401836262c7d23ae98e");
             httpHeaders.setContentType(new MediaType("application", "json", Charset.forName("UTF-8")));

+ 17 - 4
src/main/java/com/jeeplus/modules/centerservice/web/TranspondController.java

@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.act.entity.Act;
 import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.centerservice.enums.TaskAliasEnum;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursement;
+import com.jeeplus.modules.workreimbursement.service.WorkReimbursementService;
 import com.jeeplus.modules.workreimbursement.web.WorkReimbursementController;
 import org.activiti.engine.HistoryService;
 import org.activiti.engine.history.HistoricProcessInstance;
@@ -15,10 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.validation.support.BindingAwareModelMap;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import org.springframework.web.servlet.mvc.support.RedirectAttributesModelMap;
 
@@ -41,6 +40,20 @@ public class TranspondController extends BaseController {
     private ActTaskService actTaskService;
     @Autowired
     private WorkReimbursementController workReimbursementController;
+    @Autowired
+    private WorkReimbursementService workReimbursementService;
+
+    @RequestMapping(value = "getById", method = RequestMethod.GET)
+    @ResponseBody
+    public Object getById(@RequestParam String id, @RequestParam String processDefKey) {
+        TaskAliasEnum taskAliasEnum = TaskAliasEnum.getByCcpmContains(processDefKey);
+        // 报销
+        if (taskAliasEnum.getCcpmTaskAlias().equals(TaskAliasEnum.REIMBURSEMENT.getCcpmTaskAlias())) {
+            WorkReimbursement workReimbursement = workReimbursementService.get(id);
+            return workReimbursement;
+        }
+        return null;
+    }
 
     /**
      * 审核分发操作

+ 1 - 1
src/main/java/com/jeeplus/modules/centerservice/web/cpa/reimbursement/ReimbursementController.java

@@ -33,7 +33,7 @@ public class ReimbursementController {
     public String saveAudit(WorkReimbursement workReimbursement, RedirectAttributes redirectAttributes) {
         Map<String, Object> res = new HashMap<>();
         if (Objects.nonNull(workReimbursement.getAct())) {
-            res = reimbursementService.auditFunc(workReimbursement.getId(), workReimbursement.getAct().getFlag(),workReimbursement.getComment());
+            res = reimbursementService.auditFunc(workReimbursement.getId(), workReimbursement.getAct().getFlag(),workReimbursement.getComment(),workReimbursement.getType());
             if (MapUtils.isEmpty(res)) {
                 addMessage(redirectAttributes, "操作失败");
             }

+ 50 - 28
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java

@@ -633,52 +633,49 @@ public class WorkProjectNotifyController extends BaseController {
 	public List<Map<String, Object>> getList(WorkProjectNotify workProjectNotify, Page<WorkProjectNotify> page) {
 		User user = UserUtils.getUser();
 		workProjectNotify.setUser(user);
-		if (StringUtils.isNotBlank(workProjectNotify.getUserName())) {
-			workProjectNotify.setUserName(workProjectNotify.getUserName());
-		}
-		if (StringUtils.isNotBlank(workProjectNotify.getTitle())) {
-			workProjectNotify.setTitle(workProjectNotify.getTitle());
-		}
-		if (Objects.nonNull(workProjectNotify.getStartDate())) {
-			workProjectNotify.setStartDate(workProjectNotify.getStartDate());
-		}
-		if (Objects.nonNull(workProjectNotify.getEndDate())) {
-			workProjectNotify.setEndDate(workProjectNotify.getEndDate());
-		}
 		workProjectNotify.setCompanyId(UserUtils.getSelectCompany().getId());
 		workProjectNotify.setRemarks("待审批");
 		Page<WorkProjectNotify> workProjectNotifyPage = workProjectNotifyService.findPage(new Page<>(1,-1),workProjectNotify);
-		if(workProjectNotifyPage.getList().size()>0){
-			for (WorkProjectNotify info: workProjectNotifyPage.getList()) {
+		formatNotifyResp(workProjectNotifyPage.getList()); // 格式化待办数据
+		List<Map<String, Object>> maps = new ArrayList<>();
+		if (StringUtils.isNotBlank(workProjectNotify.getBelongProject())&&"ccpm".equals(workProjectNotify.getBelongProject())) {
+			JSON.DEFAULT_GENERATE_FEATURE = SerializerFeature.config(
+					JSON.DEFAULT_GENERATE_FEATURE, SerializerFeature.SkipTransientField, false);
+			maps.addAll((List)JSONArray.parseArray(JSON.toJSONString(workProjectNotifyPage.getList())));
+		} else {
+			maps = ConvertServiceUtil.copyNotifyListToCenter(workProjectNotifyPage.getList());
+		}
+		return maps;
+	}
+
+	/**
+	 * 格式化待办数据
+	 */
+	public void formatNotifyResp(List<WorkProjectNotify> list) {
+		if (list.size() > 0) {
+			for (WorkProjectNotify info: list) {
 				// 获取流程类型
 				String typeLabel = DictUtils.getDictLabel(info.getType(),"project_notify_type","");
 				info.setTypeLabel(typeLabel);
 				// 获取流程提交人
-				User cUser = UserUtils.getByUserId(info.getInitiator());
-				if (Objects.nonNull(cUser)) {
-					info.setCreateUserName(cUser.getName());
+				if (Objects.nonNull(info.getCreateBy())) {
+					User cUser = UserUtils.getByUserId(info.getCreateBy().getId());
+					if (Objects.nonNull(cUser)) {
+						info.setCreateUserName(cUser.getName());
+					}
 				}
 				// 获取流程审核人
 				User audit = UserUtils.getByUserId(info.getAuditor());
 				if (Objects.nonNull(audit)) {
 					info.setAuditUserName(audit.getName());
 				}
+				// 设置所属系统为ccpm
 				info.setBelongProject("ccpm");
 			}
 		}
-		List<Map<String, Object>> maps = new ArrayList<>();
-		if (StringUtils.isNotBlank(workProjectNotify.getBelongProject())&&"ccpm".equals(workProjectNotify.getBelongProject())) {
-			JSON.DEFAULT_GENERATE_FEATURE = SerializerFeature.config(
-					JSON.DEFAULT_GENERATE_FEATURE, SerializerFeature.SkipTransientField, false);
-			maps.addAll((List)JSONArray.parseArray(JSON.toJSONString(workProjectNotifyPage.getList())));
-		} else {
-			maps = ConvertServiceUtil.copyNotifyListToCenter(workProjectNotifyPage.getList());
-		}
-		return maps;
 	}
 
 
-
 	/**
 	 * 已审批待办列表页面
 	 */
@@ -707,6 +704,31 @@ public class WorkProjectNotifyController extends BaseController {
 	}
 
 	/**
+	 * 已审批待办(全部已办数据)
+	 */
+	@RequestMapping(value = {"backlogListReadAll"}, method = RequestMethod.GET)
+	@ResponseBody
+	public List<Map<String, Object>> backlogListReadAll(WorkProjectNotify workProjectNotify) {
+		User user = UserUtils.getUser();
+		workProjectNotify.setCreateBy(user);
+		workProjectNotify.setUser(user);
+		workProjectNotify.setStatus("2");
+		workProjectNotify.setRemarks("待通知");
+		workProjectNotify.setCompanyId(UserUtils.getSelectCompany().getId());
+		Page<WorkProjectNotify> pageList = workProjectNotifyService.findReadPage(new Page<WorkProjectNotify>(1,-1),workProjectNotify);
+		formatNotifyResp(pageList.getList()); // 格式化已办数据
+		List<Map<String, Object>> maps = new ArrayList<>();
+		if (StringUtils.isNotBlank(workProjectNotify.getBelongProject())&&"ccpm".equals(workProjectNotify.getBelongProject())) {
+			JSON.DEFAULT_GENERATE_FEATURE = SerializerFeature.config(
+					JSON.DEFAULT_GENERATE_FEATURE, SerializerFeature.SkipTransientField, false);
+			maps.addAll((List)JSONArray.parseArray(JSON.toJSONString(pageList.getList())));
+		} else {
+			maps = ConvertServiceUtil.copyHisTaskListToCenter(pageList.getList());
+		}
+		return maps;
+	}
+
+	/**
 	 * 已审批待办列表页面
 	 */
 	@RequestMapping(value = {"readShowCount"})
@@ -1248,7 +1270,7 @@ public class WorkProjectNotifyController extends BaseController {
 				if ("cpa".equals(workProjectNotify.getBelongProject())) {
 					if ("13".equals(workProjectNotify.getType())) {
 						model.addAttribute("projectNotifyType", "评估-报销审批");
-						WorkReimbursement workReimbursement = reimbursementService.getReimbursementById(workProjectNotify.getNotifyId());
+						WorkReimbursement workReimbursement = reimbursementService.getReimbursementById(workProjectNotify.getNotifyId(),workProjectNotify.getType());
 						if(StringUtils.isNotBlank(workProjectNotify.getHome())){
 							workReimbursement.setHome(workProjectNotify.getHome());
 						}else{

+ 1 - 0
src/main/webapp/webpage/modules/workreimbursement/workReimbursementAuditCpa.jsp

@@ -91,6 +91,7 @@
 		<form:hidden path="processInstanceId"/>
 <%--		<form:hidden path="act.procDefId"/>--%>
 		<form:hidden id="flag" path="act.flag"/>
+		<form:hidden id="type" path="type"/>
 <%--		<input type="hidden" id="opinion" name="act.comment" value="" maxlength="255">--%>
 		<div class="form-group layui-row first ">
 			<div class="form-group-label"><h2>基础信息</h2></div>