diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysUserService.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysUserService.java index 160d50570..fb1881817 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysUserService.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysUserService.java @@ -311,4 +311,12 @@ public interface ISysUserService extends IService { * @return */ String getUserThirdIdByUserId(List sysUserList, String userId); + + /** + * 根据用户id,获取用户名 + * @param sysUserList + * @param userId + * @return + */ + String getUsernameByUserId(List sysUserList, String userId); } diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysUserServiceImpl.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysUserServiceImpl.java index ef7fd2b2e..4f8cc64cb 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysUserServiceImpl.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysUserServiceImpl.java @@ -782,4 +782,19 @@ public class SysUserServiceImpl extends ServiceImpl impl } return result; } + + @Override + public String getUsernameByUserId(List sysUserList, String userId) { + String result = ""; + if(CollectionUtils.isNotEmpty(sysUserList)){ + result = sysUserList.stream().filter(user -> { + boolean flag = false; + if (org.apache.commons.lang3.StringUtils.equals(userId, user.getId())) { + flag = true; + } + return flag; + }).map(SysUser::getUsername).collect(Collectors.joining(",")); + } + return result; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index 3c130b781..bc470b601 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -220,8 +220,19 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl savePciLogParams = new HashMap<>(); + List editBeforePciList = new ArrayList<>(); + editBeforePciList.add(editBeforePciEo); + List editAfterPciList = new ArrayList<>(); + editAfterPciList.add(projectCertificationInventoryEO); + savePciLogParams.put("editBeforePciList",editBeforePciList); + savePciLogParams.put("editAfterPciList",editAfterPciList); + savePciLogParams.put("operatorType",OperatorTypeEnum.CERTIFICATION_INVENTORY_EDIT.getValue()); + this.saveProjectCertificationInventoryLog(savePciLogParams); - Date now = new Date(); + Date now = new Date(); projectCertificationInventoryEO.setUpdateTime(now); saveOrUpdate(projectCertificationInventoryEO); //设置权限 先删后加 @@ -325,32 +336,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); - for (ProjectCertificationInventoryEO certificationInventoryEO : saveDataList) { - StringBuilder contentCnSb = new StringBuilder(); - contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); - contentCnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" "); - contentCnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" "); - contentCnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" "); - contentCnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"").append(" "); - - StringBuilder contentEnSb = new StringBuilder(); - contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); - contentEnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" "); - contentEnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" "); - contentEnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" "); - contentEnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\""); - - - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCnSb.toString()); - projectCertificationInventoryLogEO.setContentEn(contentEnSb.toString()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); - } - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); + this.saveProjectCertificationInventoryLog(saveDataList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue()); } }catch (Exception ex){ throw new JeroBootException("添加失败!"); @@ -804,6 +790,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); - - String contentCn = "\"" + currentUser.getUsername() + "\"" +"审核退回"; - String contentEn = "\"" + currentUser.getUsername() + "\"" +" review and returned"; - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCn); - projectCertificationInventoryLogEO.setContentEn(contentEn); - projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); } - if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); - } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue()); ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); @@ -1323,24 +1299,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); - for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); - - String contentCn = "\"" + currentUser.getUsername() + "\"" +"审核通过"; - String contentEn = "\"" + currentUser.getUsername() + "\"" +" pass the audit"; - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCn); - projectCertificationInventoryLogEO.setContentEn(contentEn); - projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); } - if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); - } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue()); ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); @@ -1449,36 +1412,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); // 数据更新为结果待审查 for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); - - String contentCn = ""; - String contentEn = ""; - if (StringUtils.equals(projectCertificationInventoryEO.getValueType(), SysCategoryValueTypeEnum.FILE.getValue())) { - String fileName = "N/A"; - if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliveryResult())) { - fileName = this.ossFileService.getFileInfos(projectCertificationInventoryEO.getDeliveryResult()).stream().map(OSSFile::getFileName).distinct().collect(Collectors.joining(",")); - } - contentCn = "\"" + currentUser.getUsername() + "\"" +"提交了附件 " + fileName; - contentEn = "\"" + currentUser.getUsername() + "\"" +" submitted attachment " + fileName; - }else { - String deliveryResult = (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliveryResult()) ? projectCertificationInventoryEO.getDeliveryResult() : "N/A"); - contentCn = "\"" + currentUser.getUsername() + "\"" +"提交了交付结果为" + deliveryResult; - contentEn = "\"" + currentUser.getUsername() + "\"" +" submitted a delivery result of " + deliveryResult; - } - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCn); - projectCertificationInventoryLogEO.setContentEn(contentEn); - projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); } - if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); - } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); @@ -1546,7 +1485,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); List processInfoDetailEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); @@ -1556,20 +1494,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); - for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); - - String contentCn = "\"" + currentUser.getUsername() + "\"" +"退回了任务信息"; - String contentEn = "\"" + currentUser.getUsername() + "\"" +" returned the task information"; - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCn); - projectCertificationInventoryLogEO.setContentEn(contentEn); - projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); } - if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); - } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue()); String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 @@ -1842,22 +1756,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()); + } - String contentCn = "\"" + currentUser.getUsername() + "\"" +"拒绝,流程退回至" + "\"" +studioEngineerUserInfo.get(0).getUsername()+"\""; - String contentEn = "\"" + currentUser.getUsername() + "\"" +" refuses, and the process returns to " + "\"" +studioEngineerUserInfo.get(0).getUsername()+"\""; - ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); - projectCertificationInventoryLogEO.setProjectCertificationInventoryId(projectCertificationInventoryEO.getId()); - projectCertificationInventoryLogEO.setContentCn(contentCn); - projectCertificationInventoryLogEO.setContentEn(contentEn); - projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue()); - projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); - } - if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ - this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); - } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue()); Map standNameAndItemName = this.getStandNameAndItemName(projectCertificationInventoryEOList); String standName = (String) standNameAndItemName.get("standName"); @@ -1959,7 +1862,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl> certifycationInventoryListByDutyPersonMap = projectCertificationInventoryEOList.stream().collect(Collectors.groupingBy(ProjectCertificationInventoryEO::getDutyPerson)); try { - List projectCertificationInventoryLogEOList = new ArrayList<>(); // 给责任人分配待办中心的任务 List processInfoDetailEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { @@ -1970,20 +1872,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 @@ -2122,6 +2015,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().ne(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); List projectCertificationInventoryEOList = this.list(queryWrapper); // 根据结束时间进行排序,获取最近的时间,发消息时使用。 @@ -2144,7 +2038,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl updateWrap = new LambdaUpdateWrapper<>(); updateWrap.set(ProjectCertificationInventoryEO::getDeliveryResult,null); - // 流程重置,清空截止日期, 撤回不清空。 对应禅道问题:67048 if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){ updateWrap.set(ProjectCertificationInventoryEO::getEndTime,null); @@ -2155,6 +2048,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); if(CollectionUtils.isNotEmpty(certificationEngineerList)){ for (String certificationEngineerId : certificationEngineerIdList) { String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId); @@ -3348,4 +3242,389 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pciList,String operateType){ + if(CollectionUtils.isNotEmpty(pciList)){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String projectLibraryId = pciList.get(0).getProjectLibraryId(); + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId); + List studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(Arrays.asList(projectLibraryBase.getStudioEngineer().split(","))); + + List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + String certificationEngineerUserNames = certificationEngineerList.stream().map(SysUser::getUsername).distinct().collect(Collectors.joining(",")); + + List pciLogEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci : pciList) { + StringBuilder contentCnSb = new StringBuilder(); + StringBuilder contentEnSb = new StringBuilder(); + if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); + contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" "); + + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); + contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getSerialNumber()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发布了认证清单"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has published a certification list"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核退回"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" review and returned"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核通过"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" pass the audit"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue())){ + if (StringUtils.equals(pci.getValueType(), SysCategoryValueTypeEnum.FILE.getValue())) { + String fileName = "N/A"; + if (StringUtils.isNotEmpty(pci.getDeliveryResult())) { + fileName = this.ossFileService.getFileInfos(pci.getDeliveryResult()).stream().map(OSSFile::getFileName).distinct().collect(Collectors.joining(",")); + } + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了附件 ").append(fileName); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted attachment ").append(fileName); + }else { + String deliveryResult = (StringUtils.isNotEmpty(pci.getDeliveryResult()) ? pci.getDeliveryResult() : "N/A"); + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了交付结果为").append(deliveryResult); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted a delivery result of ").append(deliveryResult); + } + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("接受了任务信息"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" accepts the task information"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("退回了任务信息"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" returned the task information"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("拒绝,流程退回至") + .append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\""); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" refuses, and the process returns to ") + .append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发起了Pre-Homo流程"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" initiates the Pre-Homo process"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("操作了流程重置功能"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has operated the process reset function"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_WITHDRAW.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("从").append("\"").append(certificationEngineerUserNames).append("\"撤回了流程"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" withdrew the process from \"").append(certificationEngineerUserNames).append("\""); + } + + ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO(); + pciLogEO.setProjectCertificationInventoryId(pci.getId()); + pciLogEO.setContentCn(contentCnSb.toString()); + pciLogEO.setContentEn(contentEnSb.toString()); + pciLogEO.setOperatorType(operateType); + pciLogEOList.add(pciLogEO); + } + + if(CollectionUtils.isNotEmpty(pciLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList); + } + } + } + + /** + * 保存认证清单修改历史(编辑、批量设置专用) + * @param params + */ + public void saveProjectCertificationInventoryLog(Map params){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List editBeforePciList = (List) params.get("editBeforePciList"); + List editAfterPciList = (List) params.get("editAfterPciList"); + String operatorType = (String) params.get("operatorType"); + + if(CollectionUtils.isNotEmpty(editBeforePciList) && CollectionUtils.isNotEmpty(editAfterPciList)){ + List categoryList = this.sysCategoryService.list(); + List sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + + List beforeSdtUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List beforeDutyPersonUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + + List afterSdtUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List afterDutyPersonUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List userIdList = new ArrayList<>(); + userIdList.addAll(beforeSdtUserIdList); + userIdList.addAll(beforeDutyPersonUserIdList); + userIdList.addAll(afterSdtUserIdList); + userIdList.addAll(afterDutyPersonUserIdList); + List userList = this.sysUserService.querySysUserListByIdList(userIdList); + + List beforeDeliverableTemplateIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList()); + List afterDeliverableTemplateIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList()); + List allDeliverableTemplateIdList = new ArrayList<>(); + allDeliverableTemplateIdList.addAll(beforeDeliverableTemplateIdList); + allDeliverableTemplateIdList.addAll(afterDeliverableTemplateIdList); + List allDeliverableTemplateList = this.ossFileService.getFileInfos(allDeliverableTemplateIdList.stream().distinct().collect(Collectors.joining(","))); + + List pciLogEOList = new ArrayList<>(); + + for (ProjectCertificationInventoryEO editAfterPciEo : editAfterPciList) { + List editBeforePciListTemp = editBeforePciList.stream().filter(editBeforePciEo -> { + boolean flag = false; + if (StringUtils.equals(editAfterPciEo.getId(), editBeforePciEo.getId())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(editBeforePciListTemp)){ + boolean savePciLogFlag = false; + ProjectCertificationInventoryEO editBeforePciEo = editBeforePciListTemp.get(0); + + if(ObjectUtils.isNotEmpty(editBeforePciEo)){ + StringBuilder contentCnSb = new StringBuilder(); + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("将"); + StringBuilder contentEnSb = new StringBuilder(); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" changes the "); + + if(!StringUtils.equals(editBeforePciEo.getWvtaId(),editAfterPciEo.getWvtaId())){ + contentCnSb.append("\"").append("WVTA ID").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "空") + .append(","); + + contentEnSb.append("\"").append("WVTA ID").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getCategory(),editAfterPciEo.getCategory())){ + contentCnSb.append("\"").append("类别").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "空") + .append(","); + + contentEnSb.append("\"").append("Category").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getInspectionItem(),editAfterPciEo.getInspectionItem())){ + contentCnSb.append("\"").append("检验项目").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "空") + .append(","); + + contentEnSb.append("\"").append("Inspection Items").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getConfigItem(),editAfterPciEo.getConfigItem())){ + contentCnSb.append("\"").append("配置项").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "空") + .append(","); + + contentEnSb.append("\"").append("Configuration Item").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDutyTerritory(),editAfterPciEo.getDutyTerritory())){ + String beforeDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editBeforePciEo.getDutyTerritory(), + CutEnum.CN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + String beforeDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editBeforePciEo.getDutyTerritory(), + CutEnum.EN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + + String afterDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editAfterPciEo.getDutyTerritory(), + CutEnum.CN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + String afterDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editAfterPciEo.getDutyTerritory(), + CutEnum.EN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + + contentCnSb.append("\"").append("责任领域").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyTerritoryNameCn) ? beforeDutyTerritoryNameCn : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDutyTerritoryNameCn) ? afterDutyTerritoryNameCn : "空") + .append(","); + + contentEnSb.append("\"").append("Responsible Field").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyTerritoryNameEn) ? beforeDutyTerritoryNameEn : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDutyTerritoryNameEn) ? afterDutyTerritoryNameEn : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDeliverableType(),editAfterPciEo.getDeliverableType())){ + String beforeDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(","))); + String beforeDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(","))); + + String afterDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(","))); + String afterDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(","))); + + contentCnSb.append("\"").append("交付物类型").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTypeNameCn) ? beforeDeliverableTypeNameCn : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDeliverableTypeNameCn) ? afterDeliverableTypeNameCn : "空") + .append(","); + + contentEnSb.append("\"").append("Deliverable Type").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTypeNameEn) ? beforeDeliverableTypeNameEn : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDeliverableTypeNameEn) ? afterDeliverableTypeNameEn : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDeliverableTemplate(),editAfterPciEo.getDeliverableTemplate())){ + String[] beforeDeliverableTemplateArr = StringUtils.isNotEmpty(editBeforePciEo.getDeliverableTemplate()) ? editBeforePciEo.getDeliverableTemplate().split(",") : null; + String[] afterDeliverableTemplateArr = StringUtils.isNotEmpty(editAfterPciEo.getDeliverableTemplate()) ? editAfterPciEo.getDeliverableTemplate().split(",") : null; + + String beforeDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> { + boolean flag = false; + if(beforeDeliverableTemplateArr != null){ + for (String beforeDeliverableTemplate : beforeDeliverableTemplateArr) { + if(StringUtils.equals(file.getId(),beforeDeliverableTemplate)){ + flag = true; + } + } + } + return flag; + }).map(OSSFile::getFileName).collect(Collectors.joining(",")); + + String afterDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> { + boolean flag = false; + if(afterDeliverableTemplateArr != null){ + for (String afterDeliverableTemplate : afterDeliverableTemplateArr) { + if(StringUtils.equals(file.getId(),afterDeliverableTemplate)){ + flag = true; + } + } + } + return flag; + }).map(OSSFile::getFileName).collect(Collectors.joining(",")); + + contentCnSb.append("\"").append("交付物模板").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "空") + .append(","); + + contentEnSb.append("\"").append("Deliverable Template").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getSdt(),editAfterPciEo.getSdt())){ + String beforeSdtUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getSdt()); + String afterSdtUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getSdt()); + + contentCnSb.append("\"").append("工程接口人").append("\" ") + .append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "空") + .append(","); + + contentEnSb.append("\"").append("Eng. Interface").append("\" ") + .append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "null") + .append(","); + + savePciLogFlag = true; + } + String beforeEndTimeStr = ""; + if(editBeforePciEo.getEndTime() != null){ + beforeEndTimeStr = DateUtils.formatDate(editBeforePciEo.getEndTime()); + } + String afterEndTimeStr = ""; + if(editAfterPciEo.getEndTime() != null){ + afterEndTimeStr = DateUtils.formatDate(editAfterPciEo.getEndTime()); + } + if(!StringUtils.equals(beforeEndTimeStr,afterEndTimeStr)){ + contentCnSb.append("\"").append("截止日期").append("\" ") + .append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "空") + .append(","); + + contentEnSb.append("\"").append("Due Date").append("\" ") + .append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDutyPerson(),editAfterPciEo.getDutyPerson())){ + String beforeDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getDutyPerson()); + String afterDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getDutyPerson()); + + contentCnSb.append("\"").append("责任人").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "空") + .append(","); + + contentEnSb.append("\"").append("Assignee").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "null") + .append(","); + + savePciLogFlag = true; + } + + if(savePciLogFlag){ + ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO(); + pciLogEO.setProjectCertificationInventoryId(editAfterPciEo.getId()); + pciLogEO.setContentCn(contentCnSb.toString().substring(0,contentCnSb.toString().length()-1)); + pciLogEO.setContentEn(contentEnSb.toString().substring(0,contentEnSb.toString().length()-1)); + pciLogEO.setOperatorType(operatorType); + pciLogEOList.add(pciLogEO); + } + } + } + } + if(CollectionUtils.isNotEmpty(pciLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList); + } + } + } }