From dd6ce00c58c2e5573a07cf52e8cd85aed348b6d8 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 19 Oct 2023 15:36:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=20=E4=B8=93=E5=AE=B6?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20=E5=8F=AA=E4=BC=A0=E5=AE=9E=E4=BE=8BID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/ConstructionPlanManage.java | 17 ++++------------- .../model/dto/ContructionSuggestionsDTO.java | 6 +++--- .../pmapi/projectCollection/ProjectRemoveTest.java | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index 5226228..1f364e0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -342,23 +342,14 @@ public class ConstructionPlanManage { * @param dto */ public void constructionSuggestions(ContructionSuggestionsDTO dto) { - String nodeId = dto.getNodeId(); - List hai = historyService.createHistoricActivityInstanceQuery() - .activityId(nodeId) - .orderByHistoricActivityInstanceStartTime() - .asc().list(); - if(CollUtil.isEmpty(hai)){ - throw new BizException("该节点的流程不存在!"); - } - //实例ID - String processInstanceId = hai.get(0).getProcessInstanceId(); + String instanceId = dto.getInstanceId(); Project project = projectService.getProjectByCode(dto.getProjectCode()); if(Objects.isNull(project)){ throw new BizException("该项目不存在!"); } ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, processInstanceId) + .eq(ProjectInst::getInstCode, instanceId) .eq(ProjectInst::getProjectId,project.getId()) .last(BizConst.LIMIT_1)); if(Objects.isNull(projectInst)){ @@ -372,12 +363,12 @@ public class ConstructionPlanManage { ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto,ProjectConstructionSuggestions.class); ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) - .eq(ProjectConstructionSuggestions::getInstanceId, processInstanceId) + .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) .last(BizConst.LIMIT_1)); if(Objects.nonNull(pcs)){ saveEntity.setId(pcs.getId()); } - saveEntity.setInstanceId(processInstanceId); + saveEntity.setInstanceId(instanceId); constrctionSuggestionsService.saveOrUpdate(saveEntity); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java index 6fd30b3..1612224 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java @@ -19,9 +19,9 @@ public class ContructionSuggestionsDTO { private static final long serialVersionUID = 1L; - @ApiModelProperty("nodeId") - @NotNull(message = "nodeId不能为空") - private String nodeId; + @ApiModelProperty("实例ID") + @NotNull(message = "实例ID不能为空") + private String instanceId; @ApiModelProperty("项目编号") @NotNull(message = "项目编号不能为空") diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java index fe194e2..41b48ff 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java @@ -108,9 +108,8 @@ public class ProjectRemoveTest extends AppTests { private WflowCcTasksService ccTasksService; @Test - @Transactional public void test(){ - List projectCodes = Lists.newArrayList("33110000020230100008","33111800020230200007"); + List projectCodes = Lists.newArrayList("33112600020230100005","33112600020230100004","33112600020230100003","33112600020230100002","33112300020240100004","33112300020240100002","33112300020240100003","33112300020230100006","33112300020240100001","33112300020230100005","33112300020230100004","33112300020230100003","33112300020230100002","33112300020230100001"); for(String projectCode : projectCodes){ //项目 @@ -128,8 +127,16 @@ public class ProjectRemoveTest extends AppTests { .in(ProjectInst::getProjectId, projectIds)); for(ProjectInst projectInst : projectInsts){ //实例 - runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); - historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); + try{ + runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); + }catch (Exception e){ + + } + try{ + historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); + }catch (Exception e){ + + } //抄送 ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); @@ -173,7 +180,8 @@ public class ProjectRemoveTest extends AppTests { .eq(PersonSafetyInfo::getProjectCode,projectCode)); //12.最后删除项目 - projectService.removeByIds(projectIds); + projectService.remove(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); } }