瀏覽代碼

上传 专家参数 只传实例ID

master
PoffyZhang 1 年之前
父節點
當前提交
dd6ce00c58
共有 3 個檔案被更改,包括 20 行新增21 行删除
  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 查看文件

@@ -342,23 +342,14 @@ public class ConstructionPlanManage {
* @param 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());
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);
}



+ 3
- 3
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 = "项目编号不能为空")


+ 13
- 5
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<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){
//项目
@@ -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));
}
}



Loading…
取消
儲存