Bladeren bron

建设方案退回修改

tags/24080901
CMM 1 jaar geleden
bovenliggende
commit
799154ee38
2 gewijzigde bestanden met toevoegingen van 39 en 15 verwijderingen
  1. +9
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  2. +30
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 9
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Bestand weergeven

@@ -497,16 +497,21 @@ public class ProjectLibManage {
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务
List<String> projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode())
.eq(Project::getIsConstruct, isConstruct)).stream()
.map(Project::getProjectCode).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)

List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList), ProjectApplication::getProjectCode, projectCodeList)
.eq(ProjectApplication::getIsConstruct, isConstruct)
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE));
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds));

//app
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();


+ 30
- 11
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Bestand weergeven

@@ -17,7 +17,11 @@ import cn.hutool.core.util.ObjectUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO;
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService;
import com.ningdatech.pmapi.projectlib.enumeration.*;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO;
import com.ningdatech.pmapi.sys.model.entity.Region;
import com.ningdatech.pmapi.sys.service.IRegionService;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
@@ -140,6 +144,7 @@ public class TodoCenterManage {
private final IRegionService regionService;

private final ITodoService todoService;
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService;

/**
* 待办中心待我处理项目列表查询
@@ -1115,19 +1120,23 @@ public class TodoCenterManage {
//再修改应用信息
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication()
? Boolean.TRUE : Boolean.FALSE;
Long projectDtoId = projectDto.getId();
Project projectInfo = projectService.getById(projectDtoId);
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode));
Integer instType = projectInst.getInstType();

//批量删除
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
List<ProjectApplication> applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));

if(isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())){
//批量添加
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE));
projectApplicationService.removeBatchByIds(applicationList);
List<Long> applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds));

List<ProjectApplicationDTO> applications = projectDto.getApplicationList();
if(isApp && CollUtil.isNotEmpty(applications)){
// 添加应用关联的核心业务
for (ProjectApplicationDTO application : applications) {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
@@ -1139,9 +1148,19 @@ public class TodoCenterManage {
projectApplication.setIsConstruct(Boolean.TRUE);
}
projectApplication.setProjectVersion(project.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(applications);
boolean result = projectApplicationService.save(projectApplication);
// 保存应用关联的核心业务
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList();
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE;
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
projectCoreBusinessIndicators.setApplicationId(application.getId());
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators);
}
}
}
}
return Boolean.TRUE;
}


Laden…
Annuleren
Opslaan