Browse Source

上传 专家参数 只传实例ID

master
PoffyZhang 1 year ago
parent
commit
dd6ce00c58
3 changed files with 20 additions and 21 deletions
  1. +4
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  2. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java
  3. +13
    -5
      pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java

+ 4
- 13
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -342,23 +342,14 @@ public class ConstructionPlanManage {
* @param dto * @param dto
*/ */
public void constructionSuggestions(ContructionSuggestionsDTO dto) { public void constructionSuggestions(ContructionSuggestionsDTO dto) {
String nodeId = dto.getNodeId();
List<HistoricActivityInstance> 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()); Project project = projectService.getProjectByCode(dto.getProjectCode());
if(Objects.isNull(project)){ if(Objects.isNull(project)){
throw new BizException("该项目不存在!"); throw new BizException("该项目不存在!");
} }
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, processInstanceId)
.eq(ProjectInst::getInstCode, instanceId)
.eq(ProjectInst::getProjectId,project.getId()) .eq(ProjectInst::getProjectId,project.getId())
.last(BizConst.LIMIT_1)); .last(BizConst.LIMIT_1));
if(Objects.isNull(projectInst)){ if(Objects.isNull(projectInst)){
@@ -372,12 +363,12 @@ public class ConstructionPlanManage {
ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto,ProjectConstructionSuggestions.class); ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto,ProjectConstructionSuggestions.class);
ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class)
.eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode())
.eq(ProjectConstructionSuggestions::getInstanceId, processInstanceId)
.eq(ProjectConstructionSuggestions::getInstanceId, instanceId)
.last(BizConst.LIMIT_1)); .last(BizConst.LIMIT_1));
if(Objects.nonNull(pcs)){ if(Objects.nonNull(pcs)){
saveEntity.setId(pcs.getId()); saveEntity.setId(pcs.getId());
} }
saveEntity.setInstanceId(processInstanceId);
saveEntity.setInstanceId(instanceId);
constrctionSuggestionsService.saveOrUpdate(saveEntity); constrctionSuggestionsService.saveOrUpdate(saveEntity);
} }




+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java View File

@@ -19,9 +19,9 @@ public class ContructionSuggestionsDTO {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


@ApiModelProperty("nodeId")
@NotNull(message = "nodeId不能为空")
private String nodeId;
@ApiModelProperty("实例ID")
@NotNull(message = "实例ID不能为空")
private String instanceId;


@ApiModelProperty("项目编号") @ApiModelProperty("项目编号")
@NotNull(message = "项目编号不能为空") @NotNull(message = "项目编号不能为空")


+ 13
- 5
pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java View File

@@ -108,9 +108,8 @@ public class ProjectRemoveTest extends AppTests {
private WflowCcTasksService ccTasksService; private WflowCcTasksService ccTasksService;


@Test @Test
@Transactional
public void test(){ public void test(){
List<String> projectCodes = Lists.newArrayList("33110000020230100008","33111800020230200007");
List<String> projectCodes = Lists.newArrayList("33112600020230100005","33112600020230100004","33112600020230100003","33112600020230100002","33112300020240100004","33112300020240100002","33112300020240100003","33112300020230100006","33112300020240100001","33112300020230100005","33112300020230100004","33112300020230100003","33112300020230100002","33112300020230100001");


for(String projectCode : projectCodes){ for(String projectCode : projectCodes){
//项目 //项目
@@ -128,8 +127,16 @@ public class ProjectRemoveTest extends AppTests {
.in(ProjectInst::getProjectId, projectIds)); .in(ProjectInst::getProjectId, projectIds));
for(ProjectInst projectInst : projectInsts){ 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) ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode()));
@@ -173,7 +180,8 @@ public class ProjectRemoveTest extends AppTests {
.eq(PersonSafetyInfo::getProjectCode,projectCode)); .eq(PersonSafetyInfo::getProjectCode,projectCode));


//12.最后删除项目 //12.最后删除项目
projectService.removeByIds(projectIds);
projectService.remove(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));
} }
} }




Loading…
Cancel
Save