From e6182a8b8d08760f42bbb001d1fa0066f8049c0c Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Tue, 14 Mar 2023 11:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B8=85=E5=8D=95-=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E6=8E=92=E5=BA=8F=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8E=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=E3=80=82=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-boot/db/蔚来标准sql/dev_2nd_period.sql | 1 + ...ectCertificationInventoryEOController.java | 1 + .../ProjectCertificationInventoryLogEO.java | 9 + .../project/enums/OperatorTypeEnum.java | 3 + ...ectCertificationInventoryLogEOService.java | 6 + ...ctCertificationInventoryEOServiceImpl.java | 201 +++++++++++++++++- ...ertificationInventoryLogEOServiceImpl.java | 7 + 7 files changed, 227 insertions(+), 1 deletion(-) diff --git a/jero-boot/db/蔚来标准sql/dev_2nd_period.sql b/jero-boot/db/蔚来标准sql/dev_2nd_period.sql index 33d5d12a0..3e845fa80 100644 --- a/jero-boot/db/蔚来标准sql/dev_2nd_period.sql +++ b/jero-boot/db/蔚来标准sql/dev_2nd_period.sql @@ -350,6 +350,7 @@ CREATE TABLE `project_certification_inventory_log` ( `sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门', `content_cn` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容-中文', `content_en` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容-英文', + `operator_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作类型', `project_certification_inventory_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '认证清单数据id', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目库-认证清单-修改历史表' ROW_FORMAT = Dynamic; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java index 441b76e83..ab88110b2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java @@ -59,6 +59,7 @@ public class ProjectCertificationInventoryEOController extends JeroController queryWrapper = QueryGenerator.initQueryWrapper(projectCertificationInventoryEO, req.getParameterMap()); + queryWrapper.orderByDesc("create_time"); Page page = new Page(pageNo, pageSize); IPage pageList = this.projectCertificationInventoryEOService.queryPage(queryWrapper,page,projectCertificationInventoryEO,cut); return Result.OK(cut,pageList); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryLogEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryLogEO.java index ef28dc904..5908294bc 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryLogEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryLogEO.java @@ -72,6 +72,11 @@ public class ProjectCertificationInventoryLogEO implements Serializable { @ApiModelProperty(value = "操作内容-英文") private java.lang.String contentEn; + /**操作类型*/ + @Excel(name = "操作类型", width = 15) + @ApiModelProperty(value = "操作类型") + private String operatorType; + /**认证清单数据id*/ @Excel(name = "认证清单数据id", width = 15) @ApiModelProperty(value = "认证清单数据id") @@ -83,4 +88,8 @@ public class ProjectCertificationInventoryLogEO implements Serializable { /**操作内容回显**/ @TableField(exist = false) private String content; + + /**操作类型名称**/ + @TableField(exist = false) + private String operatorTypeName; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java index 0dfbf1750..49b977190 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java @@ -55,6 +55,9 @@ public enum OperatorTypeEnum { CERTIFICATION_INVENTORY_SDT_EXPEDITING("认证清单-接口人催办","certificationInventorySdtExpediting"), CERTIFICATION_INVENTORY_STUDIO_WITHDRAW("认证清单-studio撤回","certificationInventoryStudioWithdraw"), CERTIFICATION_INVENTORY_STUDIO_RESET("认证清单-studio重置流程","certificationInventoryStudioReset"), + CERTIFICATION_INVENTORY_EDIT("认证清单-编辑","certificationInventoryEdit"), + CERTIFICATION_INVENTORY_ADD("认证清单-添加","certificationInventoryAdd"), + CERTIFICATION_INVENTORY_CALL("认证清单-调取","certificationInventoryCall"), ; String name; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryLogEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryLogEOService.java index 750630d9a..f1183f035 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryLogEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryLogEOService.java @@ -73,4 +73,10 @@ public interface IProjectCertificationInventoryLogEOService extends IService datas, String cut); + + /** + * 根据认证清单idList删除历史数据 + * @param projectCertificationInventoryIdList + */ + void deleteByProjectCertificationInventoryIdList(List projectCertificationInventoryIdList); } 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 20e024375..82d53df68 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 @@ -139,11 +139,173 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl editBeforeList = new ArrayList<>(); + ProjectCertificationInventoryEO editBefore = this.queryById(projectCertificationInventoryEO.getId()); + editBeforeList.add(editBefore); + List editAfterList = new ArrayList<>(); + editAfterList.add(projectCertificationInventoryEO); + this.setEditProjectCertificationInventoryLogEO(editBeforeList,editAfterList); + + Date now = new Date(); projectCertificationInventoryEO.setUpdateTime(now); saveOrUpdate(projectCertificationInventoryEO); } + /** + * 对比编辑前后 认证清单信息,设置修改历史日志 + * @param editBeforeList 编辑前 + * @param editAfterList 编辑后 + */ + public void setEditProjectCertificationInventoryLogEO(List editBeforeList,List editAfterList){ + if(CollectionUtils.isNotEmpty(editBeforeList) && CollectionUtils.isNotEmpty(editAfterList)){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List projectCertificationInventoryLogEOList = new ArrayList<>(); + + for (ProjectCertificationInventoryEO editAfter : editAfterList) { + ProjectCertificationInventoryEO editBeforeById = editBeforeList.stream().filter(editBefore -> { + boolean flag = false; + if (StringUtils.equals(editBefore.getId(), editAfter.getId())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()).get(0); + + if(!ObjectUtils.isEmpty(editBeforeById)){ + StringBuilder contentCnSb = new StringBuilder(); + StringBuilder contentEnSb = new StringBuilder(); + + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("将"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" changes "); + + boolean saveFlag = false; + + if(!StringUtils.equals(editBeforeById.getSerialNumber(),editAfter.getSerialNumber())){ + contentCnSb.append("\"").append("法规编号").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getSerialNumber()).append(" 修改为 ").append(editAfter.getSerialNumber()).append(","); + + contentEnSb.append("\"").append("Regulation No").append("\""); + contentEnSb.append(editBeforeById.getSerialNumber()).append(" to ").append(editAfter.getSerialNumber()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getWvtaId(),editAfter.getWvtaId())){ + contentCnSb.append("\"").append("WVTA ID").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getWvtaId()).append(" 修改为 ").append(editAfter.getWvtaId()).append(","); + + contentEnSb.append("\"").append("WVTA ID").append("\""); + contentEnSb.append(editBeforeById.getWvtaId()).append(" to ").append(editAfter.getWvtaId()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getCategory(),editAfter.getCategory())){ + contentCnSb.append("\"").append("类别").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getCategory()).append(" 修改为 ").append(editAfter.getCategory()).append(","); + + contentEnSb.append("\"").append("Category").append("\""); + contentEnSb.append(editBeforeById.getCategory()).append(" to ").append(editAfter.getCategory()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getInspectionItem(),editAfter.getInspectionItem())){ + contentCnSb.append("\"").append("检验项目").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getInspectionItem()).append(" 修改为 ").append(editAfter.getInspectionItem()).append(","); + + contentEnSb.append("\"").append("Inspection Items").append("\""); + contentEnSb.append(editBeforeById.getInspectionItem()).append(" to ").append(editAfter.getInspectionItem()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getConfigItem(),editAfter.getConfigItem())){ + contentCnSb.append("\"").append("配置项").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getConfigItem()).append(" 修改为 ").append(editAfter.getConfigItem()).append(","); + + contentEnSb.append("\"").append("Configuration Item").append("\""); + contentEnSb.append(editBeforeById.getConfigItem()).append(" to ").append(editAfter.getConfigItem()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getDutyTerritory(),editAfter.getDutyTerritory())){ + contentCnSb.append("\"").append("责任领域").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getDutyTerritory()).append(" 修改为 ").append(editAfter.getDutyTerritory()).append(","); + + contentEnSb.append("\"").append("Responsible Field").append("\""); + contentEnSb.append(editBeforeById.getDutyTerritory()).append(" to ").append(editAfter.getDutyTerritory()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getDeliverableType(),editAfter.getDeliverableType())){ + contentCnSb.append("\"").append("交付物类型").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getDeliverableType()).append(" 修改为 ").append(editAfter.getDeliverableType()).append(","); + + contentEnSb.append("\"").append("Deliverable Type").append("\""); + contentEnSb.append(editBeforeById.getDeliverableType()).append(" to ").append(editAfter.getDeliverableType()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getDeliverableTemplate(),editAfter.getDeliverableTemplate())){ + contentCnSb.append("\"").append("交付物模板").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getDeliverableTemplate()).append(" 修改为 ").append(editAfter.getDeliverableTemplate()).append(","); + + contentEnSb.append("\"").append("Deliverable Template").append("\""); + contentEnSb.append(editBeforeById.getDeliverableTemplate()).append(" to ").append(editAfter.getDeliverableTemplate()).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getSdt(),editAfter.getSdt())){ + contentCnSb.append("\"").append("工程接口人").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getSdt()).append(" 修改为 ").append(editAfter.getSdt()).append(","); + + contentEnSb.append("\"").append("Eng. Interface").append("\""); + contentEnSb.append(editBeforeById.getSdt()).append(" to ").append(editAfter.getSdt()).append(","); + saveFlag = true; + } + String editBeforeEndTime = DateUtils.formatDate(editBeforeById.getEndTime()); + String editAfterEndTime = DateUtils.formatDate(editAfter.getEndTime()); + if(!StringUtils.equals(editBeforeEndTime,editAfterEndTime)){ + contentCnSb.append("\"").append("截止时间").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeEndTime).append(" 修改为 ").append(editAfterEndTime).append(","); + + contentEnSb.append("\"").append("Due Date").append("\""); + contentEnSb.append(editBeforeEndTime).append(" to ").append(editAfterEndTime).append(","); + saveFlag = true; + } + if(!StringUtils.equals(editBeforeById.getDutyPerson(),editAfter.getDutyPerson())){ + contentCnSb.append("\"").append("责任人").append("\""); + contentCnSb.append("由 "); + contentCnSb.append(editBeforeById.getDutyPerson()).append(" 修改为 ").append(editAfter.getDutyPerson()).append(","); + + contentEnSb.append("\"").append("Assignee").append("\""); + contentEnSb.append(editBeforeById.getDutyPerson()).append(" to ").append(editAfter.getDutyPerson()).append(","); + saveFlag = true; + } + + String contentCn = ""; + if(StringUtils.isNotEmpty(contentCnSb.toString())){ + contentCn = contentCnSb.toString().substring(0,contentCnSb.toString().length()-1); + } + String contentEn = ""; + if(StringUtils.isNotEmpty(contentEnSb.toString())){ + contentEn = contentEnSb.toString().substring(0,contentEnSb.toString().length()-1); + } + + if(saveFlag){ + ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); + projectCertificationInventoryLogEO.setProjectCertificationInventoryId(editAfter.getId()); + projectCertificationInventoryLogEO.setContentCn(contentCn); + projectCertificationInventoryLogEO.setContentEn(contentEn); + projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_EDIT.getValue()); + projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); + } + } + } + if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); + } + } + } + /** * 通过id删除 * @@ -157,6 +319,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl detailRemoveWrap = new QueryWrapper<>(); detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,id); this.processInfoDetailEOService.remove(detailRemoveWrap); + + this.projectCertificationInventoryLogEOService.deleteByProjectCertificationInventoryIdList(Arrays.asList(id.split(","))); } /** @@ -176,6 +340,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl authDummyInventoryInfoEOList = this.authDummyInventoryInfoEOService.list(authDummyInfoQueryWrap); if(CollectionUtils.isNotEmpty(authDummyInventoryInfoEOList)){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List projectCertificationInventoryEOList = new ArrayList<>(); for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : authDummyInventoryInfoEOList) { ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = new ProjectCertificationInventoryEO(); @@ -1852,9 +2021,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO certificationInventoryEO : projectCertificationInventoryEOList) { + 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()); + projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL.getValue()); + projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); + } + this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); } return Result.OK("调取成功!"); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryLogEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryLogEOServiceImpl.java index 3ff2f34b6..4894c21b2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryLogEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryLogEOServiceImpl.java @@ -115,4 +115,11 @@ public class ProjectCertificationInventoryLogEOServiceImpl extends ServiceImpl

projectCertificationInventoryIdList) { + QueryWrapper removeWrap = new QueryWrapper<>(); + removeWrap.lambda().in(ProjectCertificationInventoryLogEO::getProjectCertificationInventoryId,projectCertificationInventoryIdList); + this.remove(removeWrap); + } }