From cbcd3bde70de4d881a87803edcbe1cb27943f2df Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Mon, 18 Sep 2023 13:44:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BB=B6-=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ctCertificationInventoryEOServiceImpl.java | 212 +++++++++++++----- 1 file changed, 162 insertions(+), 50 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java index 1209fcfab..0ca6f884a 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java @@ -2459,11 +2459,8 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); - // 给认证工程师分配待办中心的任务 - String certificationEngineer = projectLibraryBase.getCertificationEngineer(); - if(StringUtils.isEmpty(certificationEngineer)){ - throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); - } + String lawsEngineer = projectLibraryBase.getCreateBy(); + SysUser userByName = sysUserService.getUserByName(lawsEngineer); // 根据项目库id查询当前项目认证清单数据,获取数据状态为 结果待审查的 截止时间 最早的一个时间 Date endTime = null; @@ -2487,11 +2484,10 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI } List processInfoDetailEOList = new ArrayList<>(); - List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); - // 给认证工程师分配任务 - for (String userId : certificationEngineerList) { + // 给法规工程师分配任务 + if(ObjectUtils.isNotEmpty(userByName)){ ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); - processInfoDetailEO.setUserId(userId); + processInfoDetailEO.setUserId(userByName.getId()); processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey()); processInfoDetailEO.setCreateTime(new Date()); processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); @@ -2505,13 +2501,9 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult()); - } - this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); - List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); - try { this.updateBatchById(projectCertificationInventoryEOList); @@ -2528,16 +2520,20 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); this.processInfoDetailEOService.update(detailUpdateWrap); - // 给认证工程师分配待办中心的任务 认证工程师审查 + // 给法规工程师分配待办中心的任务 认证工程师审查 this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey()); + + List sysUserList = new ArrayList<>(); + sysUserList.add(userByName); this.sendMessageByTemplateId( projectCertificationInventoryEOList, TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(), - certificationEngineerList, - certificationEngineers, + Arrays.asList(userByName.getId().split(",")), + sysUserList, endTime, CertificationFlowNodeEnum.TASK_REVIEW.getKey() ); + }catch (Exception ex){ ex.printStackTrace(); log.error("责任人-提交任务失败:" + ex.getMessage()); @@ -2546,6 +2542,119 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI return Result.OK("提交任务成功!"); } +// private Result dutyPersonSubmitTask(JSONObject json) { +// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// +// String ids = json.getString("ids"); +// if(StringUtils.isEmpty(ids)){ +// throw new JeroBootException("至少选择一条数据进行操作!"); +// } +// List idList = Arrays.asList(ids.split(",")); +// +// List flowStatusList = new ArrayList<>(); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); +// +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); +// List projectCertificationInventoryEOList = this.list(queryWrapper); +// this.disposeData(projectCertificationInventoryEOList,CutEnum.CN.getValue()); +// +// if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ +// throw new JeroBootException("至少选择一条数据流程状态为'结果待提交 或 审查退回'的数据!"); +// } +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// +// ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); +// +// // 给认证工程师分配待办中心的任务 +// String certificationEngineer = projectLibraryBase.getCertificationEngineer(); +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } +// +// // 根据项目库id查询当前项目认证清单数据,获取数据状态为 结果待审查的 截止时间 最早的一个时间 +// Date endTime = null; +// QueryWrapper pciQueryWrap = new QueryWrapper<>(); +// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId()); +// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); +// pciQueryWrap.lambda().isNotNull(ProjectCertificationInventoryEO::getEndTime); +// List pciEoList = this.list(pciQueryWrap); +// if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ +// List endTimeList = new ArrayList<>(); +// // 本次提交之前数据库里面存在的截止时间 +// List oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); +// endTimeList.addAll(oldEndTimeList); +// // 当前要提交的数据截止时间 +// List newEndTimeList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); +// endTimeList.addAll(newEndTimeList); +// +// endTimeList = endTimeList.stream().distinct().collect(Collectors.toList()); +// Collections.sort(endTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 +// endTime = endTimeList.get(0); +// } +// +// List processInfoDetailEOList = new ArrayList<>(); +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); +// // 给认证工程师分配任务 +// for (String userId : certificationEngineerList) { +// ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); +// processInfoDetailEO.setUserId(userId); +// processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey()); +// processInfoDetailEO.setCreateTime(new Date()); +// processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); +// processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); +// processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); +// processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); +// processInfoDetailEO.setEndTime(endTime); +// processInfoDetailEOList.add(processInfoDetailEO); +// } +// // 数据更新为结果待审查 +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { +// projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); +// processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult()); +// +// } +// +// this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); +// +// List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); +// +// try { +// this.updateBatchById(projectCertificationInventoryEOList); +// +// List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); +// +// // 将当前责任人的待办任务转为已办 +// LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRTJRW.getKey()); +// detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); +// detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); +// this.processInfoDetailEOService.update(detailUpdateWrap); +// +// // 给认证工程师分配待办中心的任务 认证工程师审查 +// this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey()); +// this.sendMessageByTemplateId( +// projectCertificationInventoryEOList, +// TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(), +// certificationEngineerList, +// certificationEngineers, +// endTime, +// CertificationFlowNodeEnum.TASK_REVIEW.getKey() +// ); +// }catch (Exception ex){ +// ex.printStackTrace(); +// log.error("责任人-提交任务失败:" + ex.getMessage()); +// throw new JeroBootException("提交任务失败!"); +// } +// +// return Result.OK("提交任务成功!"); +// } /** * 责任人接受任务 @@ -2575,9 +2684,9 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); String certificationEngineer = projectLibraryBase.getCertificationEngineer(); - if(StringUtils.isEmpty(certificationEngineer)){ - throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); - } +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } List processInfoDetailEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { @@ -2627,38 +2736,38 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI this.updateBatchById(projectCertificationInventoryEOList); - List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); - List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); +// List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); try { - for (String userId : certificationEngineerList) { - String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); - - if(StringUtils.isNotEmpty(thirdId)){ - // 根据结束时间进行排序,获取最近的时间,发消息时使用。 - this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); - Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); - - JSONObject larkMesJson = new JSONObject(); - larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.getValue()); - larkMesJson.put("userIds",thirdId); - - Map templateVariableMap = new HashMap<>(); - templateVariableMap.put("projectNameCn",PRN_CN); - templateVariableMap.put("projectNameEn",PRN_EN); - templateVariableMap.put("standName",standName); - templateVariableMap.put("itemName",itemName); - templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); - templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); - templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); - templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); - templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); - templateVariableMap.put("operateUserName",currentUser.getUsername()); - - - larkMesJson.put("templateVariableMap",templateVariableMap); - this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); - } - } +// for (String userId : certificationEngineerList) { +// String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); +// +// if(StringUtils.isNotEmpty(thirdId)){ +// // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); +// +// JSONObject larkMesJson = new JSONObject(); +// larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.getValue()); +// larkMesJson.put("userIds",thirdId); +// +// Map templateVariableMap = new HashMap<>(); +// templateVariableMap.put("projectNameCn",PRN_CN); +// templateVariableMap.put("projectNameEn",PRN_EN); +// templateVariableMap.put("standName",standName); +// templateVariableMap.put("itemName",itemName); +// templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); +// templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); +// templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); +// templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); +// templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); +// templateVariableMap.put("operateUserName",currentUser.getUsername()); +// +// +// larkMesJson.put("templateVariableMap",templateVariableMap); +// this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); +// } +// } } catch (Exception e) { log.error("飞书消息推送失败"); } @@ -3012,6 +3121,9 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue()); + String projectLibraryId = json.getString("projectLibraryId"); + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + this.addProcessInfoEO(processInfoEO,projectLibraryId); this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRJSRW.getKey()); // 认证工程师发起任务,将数据的状态更新为 任务待确认。