Переглянути джерело

cpa查看ccpm已办信息及历史

lizhenhao 2 роки тому
батько
коміт
b189a471ed

+ 78 - 2
src/main/java/com/jeeplus/modules/centerservice/utils/ConvertServiceUtil.java

@@ -53,7 +53,7 @@ public class ConvertServiceUtil {
     }
 
     /**
-     *
+     * 将本系统待办信息字段改为center字段(批量)
      * @param workProjectNotifyList
      * @return
      */
@@ -67,7 +67,7 @@ public class ConvertServiceUtil {
     }
 
     /**
-     * 将本系统待办信息字段改为业务系统字段
+     * 将本系统待办信息字段改为center字段
      * @param workProjectNotify
      * @return
      */
@@ -268,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;
+    }
 }

+ 49 - 27
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"})