From dae723aa2cf01a5e90e1790b06ea16965bbf8465 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 27 Jul 2023 10:08:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=80=80=E5=9B=9E=E5=92=8C=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8C=B9=E9=85=8D=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ding/controller/DingInfoPullController.java | 32 +++++++++--- .../projectdeclared/model/entity/ProjectDraft.java | 3 ++ .../pmapi/projectlib/manage/ProjectLibManage.java | 24 ++++----- .../model/entity/ProjectApplication.java | 3 ++ .../projectlib/model/vo/ProjectApplicationVO.java | 3 ++ .../pmapi/todocenter/manage/TodoCenterManage.java | 57 ++++++++++++---------- pmapi/src/main/resources/application-pre.yml | 12 ++--- pmapi/src/main/resources/application-prod.yml | 12 ++--- 8 files changed, 89 insertions(+), 57 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index a35c366..94fe0cc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -1,6 +1,9 @@ package com.ningdatech.pmapi.ding.controller; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; import com.ningdatech.irs.service.IRefreshTokenService; +import com.ningdatech.pmapi.common.config.ProvincialProperties; import com.ningdatech.pmapi.common.util.CryptUtils; import com.ningdatech.pmapi.common.util.HttpUtil; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; @@ -12,7 +15,9 @@ import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.bind.annotation.*; @@ -52,6 +57,9 @@ public class DingInfoPullController { private final ZwddIntegrationProperties zwddIntegrationProperties; + @Autowired + private ProvincialProperties provincialProperties; + @GetMapping("/employee") public void employeeBatchGet() { employeeBatchGetTask.batchGetEmployeeTask(); @@ -112,12 +120,12 @@ public class DingInfoPullController { @ApiOperation(value = "省级主管接口测试", notes = "省级主管接口测试") @GetMapping("/test-org") public String testOrg() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); + Long timeStamp = System.currentTimeMillis(); String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; String method = "POST"; String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); - String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); + String sign = CryptUtils.MD5Encode(appKey + secret + timeStamp); HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); RestTemplate restTemplate; if(Objects.nonNull(factory)){ @@ -128,10 +136,10 @@ public class DingInfoPullController { String url = "https://interface.zjzwfw.gov.cn/gateway" + "/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm?" + - "requestTime=" + timestamp + "&sign=" + sign + - "&appKey=" + appKey + "×tamp=" + timestamp + - "&authSignature=" + zwddIntegrationProperties.getAppSecret() + - "&authKey=" + zwddIntegrationProperties.getAppKey(); + "requestTime=" + timeStamp + "&sign=" + sign + + "&appKey=" + appKey + "×tamp=" + timeStamp + + "&authSignature=" + getSha256(timeStamp/1000,provincialProperties.getPushUrl(), HttpMethod.GET.name()) + + "&authKey=" + provincialProperties.getKey(); log.info("url :{}",url); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); log.info(forEntity.getBody()); @@ -158,7 +166,7 @@ public class DingInfoPullController { } String appId = "A330000100000202105005790"; String updateTime = "2023-07-26 00:00:00"; - String capCode = timestamp + updateTime + appId; + String capCode = CryptUtils.MD5Encode(timestamp + updateTime + appId); String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + @@ -169,4 +177,14 @@ public class DingInfoPullController { log.info(forEntity.getBody()); return forEntity.getBody(); } + + private String getSha256(Long timeStamp,String url,String method){ + String secret = provincialProperties.getSecret(); + String key = provincialProperties.getKey(); + String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key; + log.info("加密message :{}",bytesToSign); + String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); + log.info("加密结果 :{}",res); + return res; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java index 4234cd0..1212fec 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java @@ -302,6 +302,9 @@ public class ProjectDraft implements Serializable { @ApiModelProperty("项目申报书") private String projectApplicationForm; + @ApiModelProperty("项目编码") + private String projectCode; + private Long createBy; private Long updateBy; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index e2e46d5..3826cb4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -358,14 +358,9 @@ public class ProjectLibManage { Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 - //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 - List projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, project.getProjectCode()) - .eq(Project::getIsConstruct, Boolean.TRUE)).stream() - .map(Project::getProjectCode).collect(Collectors.toList()); projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList) + .eq(ProjectApplication::getProjectVersion,project.getVersion()) .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { @@ -379,6 +374,7 @@ public class ProjectLibManage { projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); projectApplication.setIsConstruct(Boolean.TRUE); + projectApplication.setProjectVersion(finalProject.getVersion()); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveBatch(applications); @@ -490,7 +486,8 @@ public class ProjectLibManage { projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode,project.getProjectCode()) .in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList) - .eq(ProjectApplication::getIsConstruct,isConstruct)); + .eq(ProjectApplication::getIsConstruct,isConstruct) + .eq(ProjectApplication::getProjectVersion,project.getVersion())); //app List applicationList = projecDto.getApplicationList(); @@ -503,6 +500,7 @@ public class ProjectLibManage { app.setBuildOrgName(project.getBuildOrgName()); app.setBuildOrgCode(project.getBuildOrgCode()); app.setIsConstruct(isConstruct); + app.setProjectVersion(project.getVersion()); return app; }) .collect(Collectors.toList()); @@ -546,9 +544,8 @@ public class ProjectLibManage { //app //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode())); + .eq(ProjectApplication::getProjectCode,project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion,project.getVersion())); List applicationList = projecDto.getApplicationList(); if(CollUtil.isNotEmpty(applicationList)){ @@ -560,6 +557,7 @@ public class ProjectLibManage { app.setProjectCode(project.getProjectCode()); app.setBuildOrgName(project.getBuildOrgName()); app.setBuildOrgCode(project.getBuildOrgCode()); + app.setProjectVersion(project.getVersion()); return app; }) .collect(Collectors.toList()); @@ -685,7 +683,8 @@ public class ProjectLibManage { // 查询应用 List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())); + .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion,projectInfo.getVersion())); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, @@ -774,7 +773,8 @@ public class ProjectLibManage { // 查询应用 List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())); + .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion,projectInfo.getVersion())); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java index 8ccc09a..f7f0a39 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java @@ -182,6 +182,9 @@ public class ProjectApplication implements Serializable { @ApiModelProperty("项目编码") private String projectCode; + @ApiModelProperty("项目版本") + private Integer projectVersion; + @ApiModelProperty("是否为建设方案申报") private Boolean isConstruct; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java index 2e23bb9..1aaa996 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java @@ -174,6 +174,9 @@ public class ProjectApplicationVO implements Serializable { @ApiModelProperty("项目编码") private String projectCode; + @ApiModelProperty("项目版本") + private Integer projectVersion; + private Long createBy; private Long updateBy; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 7505ca2..1d12b4c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -11,6 +11,7 @@ import java.util.stream.Stream; import javax.servlet.http.HttpServletResponse; +import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ObjectUtil; import com.ningdatech.basic.exception.BizException; @@ -1052,7 +1053,7 @@ public class TodoCenterManage { defaultDeclaredProjectManage.checkAmount(projectDto); //修改项目内容 - if(!modifyProject(projectDto)){ + if(!modifyProject(projectDto,projectInfo)){ throw new BusinessException("调整项目失败!"); } @@ -1070,14 +1071,31 @@ public class TodoCenterManage { return dto.getInstanceId(); } - private Boolean modifyProject(ProjectDTO projectDto) { + /** + * 要改成 生成新版本号 + * @param projectDto + * @return + */ + private Boolean modifyProject(ProjectDTO projectDto,Project oldProject) { //先修改项目信息 Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projectDto,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); - if(!projectService.updateById(project)){ - throw new BusinessException("项目调整失败"); - } + projectService.save(project); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest,Boolean.FALSE) + .ne(Project::getId,project.getId()) + .eq(Project::getProjectCode,project.getProjectCode())); + //再修改应用信息 Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() ? Boolean.TRUE : Boolean.FALSE; @@ -1086,26 +1104,12 @@ public class TodoCenterManage { String instCode = projectInfo.getInstCode(); ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); Integer instType = projectInst.getInstType(); - if (InstTypeEnum.UNIT_INNER_AUDIT.getCode().equals(instType) || - InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType) || - InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) { - //批量删除 - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, project.getId())); - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, project.getProjectCode())); - }else { - //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 - //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 - List projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, project.getProjectCode()) - .eq(Project::getIsConstruct, Boolean.TRUE)).stream() - .map(Project::getProjectCode).collect(Collectors.toList()); - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList) - .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); - } + + //批量删除 + projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion,project.getVersion())); + if(isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())){ //批量添加 List applications = projectDto.getApplicationList().stream().map(application -> { @@ -1119,6 +1123,7 @@ public class TodoCenterManage { !InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) { projectApplication.setIsConstruct(Boolean.TRUE); } + projectApplication.setProjectVersion(project.getVersion()); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveBatch(applications); diff --git a/pmapi/src/main/resources/application-pre.yml b/pmapi/src/main/resources/application-pre.yml index 35637c8..13e7d71 100644 --- a/pmapi/src/main/resources/application-pre.yml +++ b/pmapi/src/main/resources/application-pre.yml @@ -193,16 +193,16 @@ yxt: #省局联审 请求信息 provincial: -# host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + key: b5b2096953534a53991be4ea95f8cffa + secret: 1bec9b77134d4962ac466fbe9696b897 +# host: http://223.4.72.75/prometheus-zhejiang_foreign # pushUrl: /api/v1/foreign/importantPro # detailUrl: /api/v1/foreign/importantProView # key: b5b2096953534a53991be4ea95f8cffa # secret: 1bec9b77134d4962ac466fbe9696b897 - host: http://223.4.72.75/prometheus-zhejiang_foreign - pushUrl: /api/v1/foreign/importantPro - detailUrl: /api/v1/foreign/importantProView - key: 7fb48b518c6044a5a44deddd11b445e3 - secret: ced8fff70018413c9516c58f95885624 #天印服务器接口信息 diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 4452a2e..0a2472b 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -193,16 +193,16 @@ yxt: #省局联审 请求信息 provincial: -# host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + key: b5b2096953534a53991be4ea95f8cffa + secret: 1bec9b77134d4962ac466fbe9696b897 +# host: http://223.4.72.75/prometheus-zhejiang_foreign # pushUrl: /api/v1/foreign/importantPro # detailUrl: /api/v1/foreign/importantProView # key: b5b2096953534a53991be4ea95f8cffa # secret: 1bec9b77134d4962ac466fbe9696b897 - host: http://223.4.72.75/prometheus-zhejiang_foreign - pushUrl: /api/v1/foreign/importantPro - detailUrl: /api/v1/foreign/importantProView - key: 7fb48b518c6044a5a44deddd11b445e3 - secret: ced8fff70018413c9516c58f95885624 #天印服务器接口信息 From 0b779387dabedfd746a98cb4633189ac879a1471 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 27 Jul 2023 10:18:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=80=80=E5=9B=9E=E5=92=8C=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8C=B9=E9=85=8D=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/projectlib/manage/ProjectLibManage.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 3826cb4..bf0d4c0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -276,9 +276,8 @@ public class ProjectLibManage { ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode())); + .eq(ProjectApplication::getProjectCode,project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion,project.getVersion())); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; List applications = projectDto.getApplicationList().stream().map(application -> { @@ -289,6 +288,7 @@ public class ProjectLibManage { projectApplication.setProjectCode(finalProject.getProjectCode()); projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); + projectApplication.setProjectVersion(finalProject.getVersion()); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveOrUpdateBatch(applications); @@ -402,9 +402,8 @@ public class ProjectLibManage { ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode())); + .eq(ProjectApplication::getProjectCode,project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion,project.getVersion())); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; List applications = projectDto.getApplicationList().stream().map(application -> { @@ -413,6 +412,7 @@ public class ProjectLibManage { projectApplication.setId(null); projectApplication.setProjectId(finalProject.getId()); projectApplication.setProjectCode(finalProject.getProjectCode()); + projectApplication.setProjectVersion(finalProject.getVersion()); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveOrUpdateBatch(applications); From 6bbc328ee49cd5098002da3c75d9620e1ac9b42f Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 27 Jul 2023 10:37:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=80=80=E5=9B=9E=E5=92=8C=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8C=B9=E9=85=8D=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/manage/TodoCenterManage.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 1d12b4c..bab2441 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1091,6 +1091,22 @@ public class TodoCenterManage { project.setUpdateOn(LocalDateTime.now()); projectService.save(project); + ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class) + .eq(ProjectInst::getProjectId, oldProject.getId()) + .eq(ProjectInst::getInstCode, oldProject.getInstCode())); + + String instCode = oldProject.getInstCode(); + oldInst.setInstCode("EMPTY"); + projectInstService.updateById(oldInst); + + ProjectInst newPi = new ProjectInst(); + newPi.setProjectId(project.getId()); + newPi.setInstType(oldInst.getInstType()); + newPi.setInstCode(instCode); + newPi.setCreatOn(LocalDateTime.now()); + newPi.setUpdateOn(LocalDateTime.now()); + projectInstService.save(newPi); + projectService.update(Wrappers.lambdaUpdate(Project.class) .set(Project::getNewest,Boolean.FALSE) .ne(Project::getId,project.getId()) @@ -1101,7 +1117,6 @@ public class TodoCenterManage { ? Boolean.TRUE : Boolean.FALSE; Long projectDtoId = projectDto.getId(); Project projectInfo = projectService.getById(projectDtoId); - String instCode = projectInfo.getInstCode(); ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); Integer instType = projectInst.getInstType(); From 636063b5939f0a57c88022d7ef95defa78eb75b9 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 27 Jul 2023 10:55:14 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=80=80=E5=9B=9E=E5=92=8C=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8C=B9=E9=85=8D=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index bf0d4c0..239faa4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -275,9 +275,10 @@ public class ProjectLibManage { Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 + Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,project.getVersion())); + .eq(ProjectApplication::getProjectVersion,version)); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; List applications = projectDto.getApplicationList().stream().map(application -> { @@ -288,7 +289,7 @@ public class ProjectLibManage { projectApplication.setProjectCode(finalProject.getProjectCode()); projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); - projectApplication.setProjectVersion(finalProject.getVersion()); + projectApplication.setProjectVersion(version); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveOrUpdateBatch(applications);