Explorar el Código

Merge remote-tracking branch 'origin/master'

tags/24080901
WendyYang hace 1 año
padre
commit
b66fd6d621
Se han modificado 6 ficheros con 102 adiciones y 160 borrados
  1. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java
  2. +16
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java
  3. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  4. +78
    -152
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  5. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java

+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java Ver fichero

@@ -32,9 +32,9 @@ public class OperationController {
return operationManage.detail(projectId);
}

@GetMapping("/push-operation")
@ApiOperation("推送实施信息")
@WebLog("推送实施信息")
@PostMapping("/push-operation")
@ApiOperation("填写实施计划")
@WebLog("填写实施计划")
public String pushOperation(@RequestBody OperationDTO operation) {
return operationManage.pushOperation(operation);
}


+ 16
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java Ver fichero

@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.model.dto.OperationDTO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO;
import com.ningdatech.pmapi.projectdeclared.service.IOperationService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
@@ -34,6 +36,8 @@ public class OperationManage {

private final IProjectService projectService;

private final StateMachineUtils stateMachineUtils;

/**
* 获取实施详情
* @param projectId
@@ -45,7 +49,7 @@ public class OperationManage {
.throwMessage("项目不存在!");

Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.eq(Operation::getProjectId, project.getProjectCode())
.eq(Operation::getProjectCode, project.getProjectCode())
.last(BizConst.LIMIT_1));

return BeanUtil.copyProperties(operation,OperationVO.class);
@@ -58,8 +62,13 @@ public class OperationManage {
VUtils.isTrue(Objects.isNull(project))
.throwMessage("项目不存在!");

//首先要判断 项目当前状态 是不是 待开工状态
VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) ||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage()))
.throwMessage("提交失败 该项目不是 待开工或者已立项阶段");

Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.eq(Operation::getProjectId, project.getProjectCode())
.eq(Operation::getProjectCode, project.getProjectCode())
.last(BizConst.LIMIT_1));

Operation entity = BeanUtil.copyProperties(operation, Operation.class);
@@ -72,7 +81,11 @@ public class OperationManage {
entity.setProjectCode(project.getProjectCode());
entity.setUpdateOn(LocalDateTime.now());
entity.setUpdateBy(user.getUsername());
operationService.saveOrUpdate(entity);
if(operationService.saveOrUpdate(entity)){
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}

return entity.getProjectCode();
}


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java Ver fichero

@@ -74,7 +74,8 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//待采购状态
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(),
ProjectStatusEnum.OPERATION.getCode()));
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);


+ 78
- 152
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Ver fichero

@@ -272,30 +272,6 @@ public class ProjectLibManage {
projectService.updateById(project);
}
}

//保存项目应用
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, version));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
}
return project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
@@ -356,49 +332,6 @@ public class ProjectLibManage {
projectService.updateById(project);
}
}

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE));
if (CollUtil.isNotEmpty(applications)) {
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds));
}

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplicationDTO> applicationList = projectDto.getApplicationList();
for (ProjectApplicationDTO application : applicationList) {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setIsConstruct(Boolean.TRUE);
projectApplication.setProjectVersion(finalProject.getVersion());
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 project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
@@ -416,29 +349,7 @@ public class ProjectLibManage {
public Project reSaveProjectNewVersion(ProjectDTO projectDto) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
Project project = newProjectWithVersion(projectDto);

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setProjectVersion(finalProject.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
}
return project;
return newProjectWithVersion(projectDto);
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
throw new BusinessException("项目信息入库错误 :" + e);
@@ -470,6 +381,8 @@ public class ProjectLibManage {
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

saveApplication(projecDto,project,null);

return project;
}

@@ -499,41 +412,14 @@ public class ProjectLibManage {
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//删除当前版本的app 一般情况是没有 保险起见
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
if (CollUtil.isNotEmpty(applications)) {
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();
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setProjectCode(project.getProjectCode());
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setIsConstruct(isConstruct);
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(projecDto,project,isConstruct);
}

return project;
}

public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType) {
public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) {
Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
@@ -564,27 +450,7 @@ public class ProjectLibManage {
.eq(Project::getProjectCode, project.getProjectCode()));

//app
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));

List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setProjectCode(project.getProjectCode());
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(projecDto,project,isConstruct);
}

return project;
@@ -617,17 +483,7 @@ public class ProjectLibManage {
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, oldProject.getId()));
if(CollUtil.isNotEmpty(apps)){
apps = apps.stream().map(app -> {
app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId());
app.setId(null);
return app;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(project,oldProject,null);
}

return project;
@@ -662,6 +518,9 @@ public class ProjectLibManage {
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//APP
saveApplication(project,oldProject,null);
}

return project;
@@ -696,6 +555,8 @@ public class ProjectLibManage {
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

saveApplication(project,oldProject,Boolean.TRUE);
}

return project;
@@ -903,7 +764,8 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct, Boolean.FALSE));
.eq(ProjectApplication::getIsConstruct, Boolean.FALSE)
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
@@ -1209,4 +1071,68 @@ public class ProjectLibManage {
res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req));
return res;
}

private void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));
if(CollUtil.isNotEmpty(apps)){
apps = apps.stream().map(app -> {
app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId());
app.setId(null);
if(Objects.nonNull(isConstruct)){
app.setIsConstruct(isConstruct);
}
return app;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
}

private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) {
//保存项目应用
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;
//删除当前版本的app 一般情况是没有 保险起见
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, version));
if (CollUtil.isNotEmpty(applications)) {
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
}

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
projectDto.getApplicationList().forEach(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
projectApplication.setIsConstruct(isConstruct);

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);
}
}
});
}
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Ver fichero

@@ -1709,6 +1709,8 @@ public class TodoCenterManage {

Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
Map<String, Project> projectInfoMap = projectInstList.stream()
.filter(p -> StringUtils.isNotBlank(p.getInstCode()) &&
!TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode()))
.collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId())));
// 关联项目信息
List<Project> projectList = list.stream()


+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java Ver fichero

@@ -45,7 +45,7 @@ public class IrsTest extends AppTests {
public void test1(){
String method = "GET";
String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" +
"?appCode=A331123467587202307014177";
"?appCode=A331101453557202109017383";
String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c";
String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b";



Cargando…
Cancelar
Guardar