From 5d5420da3c11a5f0658c53bc21af376ce55a912d Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Mon, 13 Mar 2023 16:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B8=85=E5=8D=95-=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E4=BA=A4=E4=BB=98=E7=89=A9=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ectCertificationInventoryEOController.java | 7 ++ ...rojectCertificationInventoryEOService.java | 7 ++ ...ctCertificationInventoryEOServiceImpl.java | 82 ++++++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-) 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 c39f416d7..441b76e83 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 @@ -262,4 +262,11 @@ public class ProjectCertificationInventoryEOController extends JeroController callAdd(@RequestBody JSONObject json) { return this.projectCertificationInventoryEOService.callAdd(json); } + + @AutoLog(value = "项目库-认证清单表-引用交付物") + @ApiOperation(value="项目库-认证清单表-引用交付物", notes="项目库-认证清单表-引用交付物") + @PostMapping(value = "/citeDeliverable") + public Result citeDeliverable(@RequestBody JSONObject json) { + return this.projectCertificationInventoryEOService.citeDeliverable(json); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java index 3ceb6750f..0017c61ac 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java @@ -184,4 +184,11 @@ public interface IProjectCertificationInventoryEOService extends IService callAdd(JSONObject json); + + /** + * 引用交付物 + * @param json + * @return + */ + Result citeDeliverable(JSONObject json); } 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 0cec4e40b..5a278e5fd 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 @@ -18,9 +18,11 @@ import com.jero.modules.authDummy.service.IAuthDummyInventoryInfoEOService; import com.jero.modules.feishu.enums.TemplateInfoEnum2; import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.project.entity.ProjectCertificationInventoryLogEO; import com.jero.modules.project.entity.ProjectLibraryBase; import com.jero.modules.project.entity.ProjectRelatedPersonnel; import com.jero.modules.project.enums.*; +import com.jero.modules.project.service.IProjectCertificationInventoryLogEOService; import com.jero.modules.project.service.IProjectRelatedPersonnelService; import com.jero.modules.system.enums.ProjectRoleEnum; import com.jero.modules.project.mapper.ProjectCertificationInventoryEOMapper; @@ -106,6 +108,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl ids) { QueryWrapper queryWrap = new QueryWrapper<>(); - queryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,ids); + queryWrap.lambda().in(ProjectCertificationInventoryEO::getId,ids); List list = this.list(queryWrap); removeByIds(ids); @@ -218,6 +222,32 @@ 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()); + projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); + } + this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); } }catch (Exception ex){ throw new JeroBootException("添加失败!"); @@ -1819,7 +1849,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl citeDeliverable(JSONObject json) { + String projectCertificationInventoryIds = json.getString("projectCertificationInventoryIds"); + if(StringUtils.isEmpty(projectCertificationInventoryIds)){ + throw new JeroBootException("请选择需要引用的认证清单数据!"); + } + String projectLibraryId = json.getString("projectLibraryId"); + + String citeProjectLibraryId = json.getString("citeProjectLibraryId"); + if(StringUtils.isEmpty(citeProjectLibraryId)){ + throw new JeroBootException("请选择引用的项目!"); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,projectCertificationInventoryIds.split(",")); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + QueryWrapper citeQueryWrapper = new QueryWrapper<>(); + citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,citeProjectLibraryId); + citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + List citeProjectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isNotEmpty(citeProjectCertificationInventoryEOList)){ + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + for (ProjectCertificationInventoryEO citeProjectCertificationInventoryEO : citeProjectCertificationInventoryEOList) { + // 匹配数据 类别、检验项目、配置项、标准编号、交付物类型完全一致,并且数据的状态为 审查完成 + boolean flag = ( + StringUtils.equals(projectCertificationInventoryEO.getCategory(),citeProjectCertificationInventoryEO.getCategory()) + && StringUtils.equals(projectCertificationInventoryEO.getInspectionItem(),citeProjectCertificationInventoryEO.getInspectionItem()) + && StringUtils.equals(projectCertificationInventoryEO.getConfigItem(),citeProjectCertificationInventoryEO.getConfigItem()) + && StringUtils.equals(projectCertificationInventoryEO.getSerialNumber(),citeProjectCertificationInventoryEO.getSerialNumber()) + && StringUtils.equals(projectCertificationInventoryEO.getDeliverableType(),citeProjectCertificationInventoryEO.getDeliverableType()) + ); + if(flag){ + projectCertificationInventoryEO.setDeliveryResult(citeProjectCertificationInventoryEO.getDeliveryResult()); + break; + } + } + } + + this.updateBatchById(projectCertificationInventoryEOList); + } + } + + return Result.OK("引用交付物成功!"); + } }