瀏覽代碼

Merge branch '20230731_ls2_operation+early_warning+safety_risk+portrait' of http://git.ningdatech.com/liushuai/project-management into dev

master
PoffyZhang 1 年之前
父節點
當前提交
a94cf0a403
共有 4 個檔案被更改,包括 58 行新增11 行删除
  1. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  2. +36
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java
  4. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java 查看文件

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectlib.helper;

import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;

@@ -11,6 +12,9 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;

import cn.hutool.core.collection.CollUtil;

import java.util.List;
import java.util.Map;

/**
* <p>
* ProjectHelper
@@ -65,6 +69,16 @@ public class ProjectHelper {
* @param app
* @return
*/
public static ProjectApplicationVO convertVOWithMap(ProjectApplication app,
Map<Long, List<ProjectCoreBusinessIndicators>> coreBizMap) {
ProjectApplicationVO appVo = new ProjectApplicationVO();
BeanUtils.copyProperties(app, appVo);
if(coreBizMap.containsKey(app.getId())){
List<ProjectCoreBusinessIndicators> projectCoreBusinessIndicators = coreBizMap.get(app.getId());
appVo.setCoreBusinessList(projectCoreBusinessIndicators);
}
return appVo;
}
public static ProjectApplicationVO convertVO(ProjectApplication app) {
ProjectApplicationVO appVo = new ProjectApplicationVO();
BeanUtils.copyProperties(app, appVo);


+ 36
- 10
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java 查看文件

@@ -69,6 +69,7 @@ import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq;
import com.ningdatech.pmapi.todocenter.service.ITodoService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -260,9 +261,16 @@ public class ProjectLibManage {
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());

//核心业务
List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
Map<Long,List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
app -> ProjectHelper.convertVOWithMap(app,coreBizMap))
));

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
@@ -373,9 +381,16 @@ public class ProjectLibManage {
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());

//核心业务
List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
Map<Long,List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
app -> ProjectHelper.convertVOWithMap(app,coreBizMap))
));

//审批信息
@@ -1208,20 +1223,32 @@ public class ProjectLibManage {
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));
if(CollUtil.isNotEmpty(apps)){
apps = apps.stream().map(app -> {
apps.forEach(app -> {
Long oldAppId = app.getId();
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);
projectApplicationService.save(app);

//核心业务
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId));
if(CollUtil.isNotEmpty(cores)){
cores.forEach(c -> {
c.setId(null);
c.setApplicationId(app.getId());
projectCoreBusinessIndicatorsService.save(c);
});
}
});
}
}

private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
@@ -1233,9 +1260,6 @@ public class ProjectLibManage {
.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())) {
@@ -1262,7 +1286,9 @@ public class ProjectLibManage {
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
projectCoreBusinessIndicators.setApplicationId(application.getId());
projectCoreBusinessIndicators.setApplicationId(projectApplication.getId());
projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now());
projectCoreBusinessIndicators.setCreateBy(user.getUsername());
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators);
}
}


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java 查看文件

@@ -187,4 +187,7 @@ public class ProjectApplication implements Serializable {

@ApiModelProperty("是否为建设方案申报")
private Boolean isConstruct;

@ApiModelProperty("应用核心业务")
private Boolean coreBusinessList;
}

+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java 查看文件

@@ -1,11 +1,13 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
@@ -177,8 +179,10 @@ public class ProjectApplicationVO implements Serializable {
@ApiModelProperty("项目版本")
private Integer projectVersion;

@ApiModelProperty("应用核心业务")
private List<ProjectCoreBusinessIndicators> coreBusinessList;

private Long createBy;

private Long updateBy;

}

Loading…
取消
儲存