@@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { | |||
public static void main(String[] args) { | |||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||
generate("CMM", "test", PATH_CMM, "nd_project_apply_borrow"); | |||
generate("CMM", "test", PATH_CMM, "nd_project_core_business_indicators"); | |||
} | |||
} |
@@ -57,6 +57,8 @@ public interface CommonConst { | |||
Integer VERSION_SIZE = 2; | |||
Integer VERSION_JUDGE = -1; | |||
String COPY = "副本"; | |||
} |
@@ -0,0 +1,71 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.IndicatorConfigManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
/** | |||
* 绩效评价-指标配置 | |||
* @return | |||
* @author CMM | |||
* @since 2023/07/26 16:29 | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价-指标配置") | |||
@RequestMapping("/api/v1/indicator-config") | |||
public class IndicatorConfigController { | |||
private final IndicatorConfigManage indicatorConfigManage; | |||
@GetMapping("/project/index/template/list") | |||
@ApiOperation("项目指标模板列表") | |||
public PageVo<ProjectIndexTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
return indicatorConfigManage.projectList(req); | |||
} | |||
@GetMapping("/project/index/template/detail/{id}") | |||
@ApiOperation("项目指标配置模板详情") | |||
public ProjectIndexTemplateVO projectDetail(@PathVariable Long id) { | |||
return indicatorConfigManage.projectDetail(id); | |||
} | |||
@ApiOperation(value = "项目指标模版启用(禁用)", notes = "项目指标模版启用(禁用)") | |||
@PutMapping("/project/index/{templateId}/active/{state}") | |||
public String enOrDisProjectIndexTemplate(@PathVariable Long templateId, | |||
@PathVariable Boolean state) { | |||
Boolean result = indicatorConfigManage.enOrDisProjectIndexTemplate(templateId, state); | |||
return Boolean.TRUE.equals(result) ? "启用项目指标模版成功":"禁用项目指标模版成功"; | |||
} | |||
@PostMapping("/project/index/template/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
@WebLog("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorConfigManage.projectTemplateSave(dto); | |||
} | |||
@PostMapping("/project/index/template/copy/{id}") | |||
@ApiOperation("项目指标配置模板复制") | |||
@WebLog("项目指标配置模板复制") | |||
public String projectTemplateCopy(@PathVariable Long id) { | |||
return indicatorConfigManage.projectTemplateCopy(id); | |||
} | |||
@PostMapping("/project/index/template/delete/{id}") | |||
@ApiOperation("项目指标配置模板删除") | |||
@WebLog("项目指标配置模板删除") | |||
public String projectTemplateDelete(@PathVariable Long id) { | |||
return indicatorConfigManage.projectTemplateDelete(id); | |||
} | |||
} |
@@ -1,55 +0,0 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.IndicatorTemplateManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* @Classname PerformanceIndicatorTemplateController | |||
* @Description | |||
* @Date 2023/6/25 14:16 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价-指标配置") | |||
@RequestMapping("/api/v1/indicator-template") | |||
public class PerformanceIndicatorTemplateController { | |||
private final IndicatorTemplateManage indicatorTemplateManage; | |||
@GetMapping("/project/list") | |||
@ApiOperation("项目指标配置模板列表") | |||
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
return indicatorTemplateManage.projectList(req); | |||
} | |||
@GetMapping("/project/detail/{id}") | |||
@ApiOperation("项目指标配置模板详情") | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(@PathVariable Long id) { | |||
return indicatorTemplateManage.projectDetail(id); | |||
} | |||
@PostMapping("/project/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
@WebLog("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorTemplateManage.projectTemplateSave(dto); | |||
} | |||
@PostMapping("/project/delete/{id}") | |||
@ApiOperation("项目指标配置模板删除") | |||
@WebLog("项目指标配置模板删除") | |||
public String projectTemplateDelete(@PathVariable Long id) { | |||
return indicatorTemplateManage.projectTemplateDelete(id); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
package com.ningdatech.pmapi.performance.enumration; | |||
import java.util.Objects; | |||
import org.apache.commons.lang3.StringUtils; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
/** | |||
* ConstructTypeEnum | |||
* @return | |||
* @author CMM | |||
* @since 2023/07/26 16:44 | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public enum ConstructTypeEnum { | |||
/** | |||
* 建设类型 | |||
*/ | |||
SOFT(1, "软件"), | |||
HARDWARE(2, "硬件"), | |||
SOFT_HARD(3, "软硬件"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDesc(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (ConstructTypeEnum t : ConstructTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -22,7 +22,7 @@ public enum PerformanceTemplateTypeEnum { | |||
/** | |||
* 模板类型 | |||
*/ | |||
STAGE(0, "阶段"), | |||
//STAGE(0, "阶段"), | |||
FIRST_INDEX(1, "第一指标"), | |||
SECOND_INDEX(2, "第二指标"), | |||
THIRD_INDEX(3, "第三指标"); | |||
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateStageNameEnum; | |||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; | |||
@@ -17,18 +18,21 @@ import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -43,7 +47,7 @@ import java.util.stream.Collectors; | |||
@Slf4j | |||
@Component | |||
@AllArgsConstructor | |||
public class IndicatorTemplateManage { | |||
public class IndicatorConfigManage { | |||
private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; | |||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||
@@ -53,7 +57,7 @@ public class IndicatorTemplateManage { | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
public PageVo<ProjectIndexTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
Page<PerformanceIndicatorProjectTemplate> page = req.page(); | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) | |||
@@ -64,8 +68,8 @@ public class IndicatorTemplateManage { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceIndicatorProjectTemplateVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) | |||
List<ProjectIndexTemplateVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
@@ -76,18 +80,27 @@ public class IndicatorTemplateManage { | |||
* @param id | |||
* @return | |||
*/ | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { | |||
public ProjectIndexTemplateVO projectDetail(Long id) { | |||
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); | |||
if(Objects.isNull(template)){ | |||
return null; | |||
} | |||
PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template, | |||
PerformanceIndicatorProjectTemplateVO.class); | |||
ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, | |||
ProjectIndexTemplateVO.class); | |||
// 获取模版绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); | |||
// 获取模版附加绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||
if(CollUtil.isNotEmpty(templateDetails)){ | |||
vo.setTemplateDetails(buildTemplateDetail(templateDetails)); | |||
} | |||
if (CollUtil.isNotEmpty(additionalTemplateDetails)){ | |||
vo.setAdditionalIndexDetails(buildTemplateDetail(additionalTemplateDetails)); | |||
} | |||
return vo; | |||
} | |||
@@ -96,7 +109,7 @@ public class IndicatorTemplateManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional | |||
@Transactional(rollbackFor = Exception.class) | |||
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); | |||
@@ -112,24 +125,32 @@ public class IndicatorTemplateManage { | |||
template.setUpdateOn(LocalDateTime.now()); | |||
template.setUpdateBy(user.getUsername()); | |||
if(indicatorProjectTemplateService.saveOrUpdate(template)){ | |||
//保存 模板的详情 | |||
//保存 模板指标的详情 | |||
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ | |||
//先删除 | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); | |||
analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); | |||
//校检 3个阶段 总分是不是100 | |||
List<PerformanceIndicatorProjectTemplateDetail> stages = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.STAGE.getCode()) | |||
//校检 所有3级指标(不包括附加指标) 总分是不是100 | |||
List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) | |||
.in(PerformanceIndicatorProjectTemplateDetail::getName, Lists.newArrayList(PerformanceTemplateStageNameEnum.STAGE_1.getDesc(), | |||
PerformanceTemplateStageNameEnum.STAGE_2.getDesc(), PerformanceTemplateStageNameEnum.STAGE_3.getDesc()))); | |||
if(CollUtil.isNotEmpty(stages)){ | |||
int sum = stages.stream().filter(p -> Objects.nonNull(p.getScore())).mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum(); | |||
VUtils.isTrue(sum != 100).throwMessage("总分不是100 操作失败!"); | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); | |||
if(CollUtil.isNotEmpty(indexList)){ | |||
BigDecimal sum = indexList.stream() | |||
.map(PerformanceIndicatorProjectTemplateDetail::getIndexScore) | |||
.filter(Objects::nonNull) | |||
.reduce(BigDecimal.ZERO, BigDecimal::add); | |||
VUtils.isTrue((BigDecimal.valueOf(100)).equals(sum)).throwMessage("总分不是100 操作失败!"); | |||
} | |||
} | |||
// 保存 模版附加指标详情 | |||
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||
analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId()); | |||
} | |||
return "保存成功"; | |||
} | |||
throw new BizException("保存失败!"); | |||
@@ -145,11 +166,24 @@ public class IndicatorTemplateManage { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
analysisTemplateDetailsInner(templateDetails,templateId,null,null); | |||
analysisTemplateDetailsInner(templateDetails,templateId,null); | |||
} | |||
/** | |||
* 解析 项目附加考核指标 | |||
* @param additionalTemplateDetails | |||
* @return | |||
*/ | |||
public void analysisAdditionalTemplateDetails( | |||
List<ProjectTemplateDetailDTO> additionalTemplateDetails,Long templateId) { | |||
if(CollUtil.isEmpty(additionalTemplateDetails)){ | |||
return; | |||
} | |||
analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); | |||
} | |||
public void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails, | |||
Long templateId,Long parentId,Long stageId) { | |||
Long templateId,Long parentId) { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
@@ -162,47 +196,42 @@ public class IndicatorTemplateManage { | |||
templateDetail.setUpdateBy(user.getUsername()); | |||
templateDetail.setUpdateOn(LocalDateTime.now()); | |||
templateDetail.setTemplateId(templateId); | |||
// 一级指标的父ID为null | |||
templateDetail.setParentId(parentId); | |||
//如果是阶段的计算下 总分 | |||
if(!PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
templateDetail.setStageId(stageId); | |||
} | |||
indicatorProjectTemplateDetailService.save(templateDetail); | |||
//如果是阶段的话 阶段Id 就是自己的id | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
templateDetail.setScore(computeTotalScore(templateDetail)); | |||
templateDetail.setStageId(templateDetail.getId()); | |||
indicatorProjectTemplateDetailService.updateById(templateDetail); | |||
stageId = templateDetail.getId(); | |||
} | |||
if(CollUtil.isNotEmpty(detail.getChildren())){ | |||
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId(),stageId); | |||
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); | |||
} | |||
} | |||
} | |||
/** | |||
* 计算 此阶段下的 总分 | |||
* @param templateDetail | |||
* @return | |||
*/ | |||
private Integer computeTotalScore(PerformanceIndicatorProjectTemplateDetail templateDetail) { | |||
Integer total = 0; | |||
if(Objects.isNull(templateDetail) || Objects.isNull(templateDetail.getId())){ | |||
return total; | |||
public void analysisAdditionalTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails, | |||
Long templateId,Long parentId) { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
for(ProjectTemplateDetailDTO detail : templateDetails){ | |||
//计算阶段的 | |||
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); | |||
templateDetail.setCreateBy(user.getUsername()); | |||
templateDetail.setCreateOn(LocalDateTime.now()); | |||
templateDetail.setUpdateBy(user.getUsername()); | |||
templateDetail.setUpdateOn(LocalDateTime.now()); | |||
templateDetail.setTemplateId(templateId); | |||
// 标记为附加指标 | |||
templateDetail.setIsAdditional(Boolean.TRUE); | |||
// 一级指标的父ID为null | |||
templateDetail.setParentId(parentId); | |||
indicatorProjectTemplateDetailService.save(templateDetail); | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
List<PerformanceIndicatorProjectTemplateDetail> thirds = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateDetail.getTemplateId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getStageId, templateDetail.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); | |||
if(CollUtil.isNotEmpty(thirds)){ | |||
total = thirds.stream().mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum(); | |||
if(CollUtil.isNotEmpty(detail.getChildren())){ | |||
analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); | |||
} | |||
} | |||
return total; | |||
} | |||
/** | |||
@@ -213,44 +242,47 @@ public class IndicatorTemplateManage { | |||
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) { | |||
List<ProjectTemplateDetailVO> res = Lists.newArrayList(); | |||
//第一层是 一级的 | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){ | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) { | |||
if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) { | |||
ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> firstList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { | |||
if (Objects.nonNull(templateDetailSecond.getParentId()) && | |||
templateDetailSecond.getParentId().equals(templateDetail.getId())) { | |||
templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) { | |||
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { | |||
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { | |||
if (Objects.nonNull(templateDetailThird.getParentId()) && | |||
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { | |||
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> fourList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { | |||
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { | |||
if (Objects.nonNull(templateDetailFour.getParentId()) && | |||
templateDetailFour.getParentId().equals(templateDetailThird.getId())) { | |||
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); | |||
fourList.add(detailFourVo); | |||
thirdList.add(detailFourVo); | |||
} | |||
} | |||
detailThirdVo.setChildren(fourList); | |||
thirdList.add(detailThirdVo); | |||
detailThirdVo.setChildren(thirdList); | |||
secondList.add(detailThirdVo); | |||
} | |||
} | |||
detailSecondVo.setChildren(thirdList); | |||
secondList.add(detailSecondVo); | |||
detailSecondVo.setChildren(secondList); | |||
firstList.add(detailSecondVo); | |||
} | |||
} | |||
detailVo.setChildren(secondList); | |||
res.add(detailVo); | |||
detailFirstVo.setChildren(firstList); | |||
res.add(detailFirstVo); | |||
} | |||
} | |||
return res; | |||
} | |||
/** | |||
* 删除项目模板 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@@ -258,15 +290,59 @@ public class IndicatorTemplateManage { | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); | |||
VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); | |||
if(CommonEnum.YES.getCode().equals(projectTemplate.getStatus())){ | |||
if (CommonEnum.YES.getCode().equals(projectTemplate.getStatus())) { | |||
throw new BizException("操作失败 该模板 是启用状态!"); | |||
} | |||
if(indicatorProjectTemplateService.removeById(id)){ | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,id)); | |||
if (indicatorProjectTemplateService.removeById(id)) { | |||
indicatorProjectTemplateDetailService | |||
.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); | |||
return "删除成功"; | |||
} | |||
return "操作失败"; | |||
} | |||
public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | |||
if (Boolean.TRUE.equals(active)){ | |||
projectTemplate.setStatus(CommonEnum.YES.getCode()); | |||
}else { | |||
projectTemplate.setStatus(CommonEnum.NO.getCode()); | |||
} | |||
return indicatorProjectTemplateService.updateById(projectTemplate); | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
public String projectTemplateCopy(Long templateId) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | |||
PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate(); | |||
BeanUtils.copyProperties(projectTemplate,newTemplate); | |||
// 复制后,项目模版名称变更为xxx副本,状态为禁用 | |||
newTemplate.setName(projectTemplate.getName() + CommonConst.COPY); | |||
newTemplate.setStatus(CommonEnum.NO.getCode()); | |||
newTemplate.setCreateOn(LocalDateTime.now()); | |||
newTemplate.setCreateBy(user.getUsername()); | |||
newTemplate.setUpdateOn(LocalDateTime.now()); | |||
newTemplate.setUpdateBy(user.getUsername()); | |||
if (indicatorProjectTemplateService.save(newTemplate)) { | |||
// 新增指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> projectTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateId)); | |||
// 逐个新增并保存各指标 | |||
for (PerformanceIndicatorProjectTemplateDetail projectTemplateDetail : projectTemplateDetails) { | |||
PerformanceIndicatorProjectTemplateDetail newProjectTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); | |||
BeanUtils.copyProperties(projectTemplateDetail, newProjectTemplateDetail); | |||
newProjectTemplateDetail.setTemplateId(newTemplate.getId()); | |||
newProjectTemplateDetail.setCreateOn(LocalDateTime.now()); | |||
newProjectTemplateDetail.setCreateBy(user.getUsername()); | |||
newProjectTemplateDetail.setUpdateOn(LocalDateTime.now()); | |||
newProjectTemplateDetail.setUpdateBy(user.getUsername()); | |||
indicatorProjectTemplateDetailService.save(newProjectTemplateDetail); | |||
} | |||
return "模版复制成功"; | |||
} | |||
return "模版复制失败"; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
public interface ProjectCoreBusinessIndicatorsMapper extends BaseMapper<ProjectCoreBusinessIndicators> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.performance.mapper.ProjectCoreBusinessIndicatorsMapper"> | |||
</mapper> |
@@ -34,6 +34,9 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable | |||
@ApiModelProperty("项目类型 ") | |||
private Integer projectType; | |||
@ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") | |||
private Integer constructType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
@@ -42,4 +45,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable | |||
@ApiModelProperty("绩效指标详情") | |||
private List<ProjectTemplateDetailDTO> templateDetails; | |||
@ApiModelProperty("附加绩效指标详情") | |||
private List<ProjectTemplateDetailDTO> additionalIndexDetails; | |||
} |
@@ -0,0 +1,54 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.hibernate.validator.constraints.Range; | |||
import javax.validation.constraints.Size; | |||
/** | |||
* @author CMM | |||
* @since 2023/07/26 15:05 | |||
*/ | |||
@ApiModel(value = "ProjectCoreBusinessDTO对象", description = "") | |||
@Data | |||
public class ProjectCoreBusinessDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("核心业务ID") | |||
private Long id; | |||
@ApiModelProperty("核心业务") | |||
private String coreBusiness; | |||
@ApiModelProperty("业务指标分值") | |||
@Range(min = 0, max = 10, message = "数值范围不正确,数值应大于0小于10") | |||
private BigDecimal score; | |||
@ApiModelProperty("业务指标名称") | |||
@Size(max = 100) | |||
private String businessIndicatorName; | |||
@ApiModelProperty("业务指标描述") | |||
@Size(max = 100) | |||
private String businessIndicatorDescription; | |||
@ApiModelProperty("指标设计依据") | |||
@Size(max = 100) | |||
private String indexDesignBasis; | |||
@ApiModelProperty("指标计算方法") | |||
@Size(max = 100) | |||
private String indexCalculationMethod; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
} |
@@ -3,7 +3,10 @@ package com.ningdatech.pmapi.performance.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.hibernate.validator.constraints.Range; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
/** | |||
@@ -24,23 +27,24 @@ public class ProjectTemplateDetailDTO implements Serializable { | |||
@ApiModelProperty("指标名称") | |||
private String name; | |||
@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标") | |||
@ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") | |||
private Integer type; | |||
@ApiModelProperty("父级指标id") | |||
private Long parentId; | |||
@ApiModelProperty("分数 3级指标才有") | |||
private Integer score; | |||
@ApiModelProperty("指标分值 3级指标才有") | |||
@Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") | |||
private BigDecimal indexScore; | |||
@ApiModelProperty("分数细则 3级指标才有") | |||
private String scoreRubric; | |||
@ApiModelProperty("指标细则 3级指标才有") | |||
private String indexDetail; | |||
@ApiModelProperty("评分pdf") | |||
private String pdf; | |||
@ApiModelProperty("评分细则") | |||
private String gradeDetail; | |||
@ApiModelProperty("阶段id") | |||
private Long stageId; | |||
@ApiModelProperty("佐证材料 描述") | |||
private String supportMaterial; | |||
@ApiModelProperty("子指标") | |||
private List<ProjectTemplateDetailDTO> children; | |||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import liquibase.pro.packaged.I; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
@@ -38,12 +39,15 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { | |||
@ApiModelProperty("丽水 区域code") | |||
private String regionCode; | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("建设类型") | |||
private Integer constructType; | |||
@ApiModelProperty("状态 0关闭 1开启") | |||
private Integer status; | |||
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
/** | |||
@@ -39,21 +40,24 @@ public class PerformanceIndicatorProjectTemplateDetail implements Serializable { | |||
@ApiModelProperty("指标名称") | |||
private String name; | |||
@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标") | |||
@ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") | |||
private Integer type; | |||
@ApiModelProperty("父级指标id") | |||
private Long parentId; | |||
@ApiModelProperty("分数 3级指标才有") | |||
private Integer score; | |||
@ApiModelProperty("指标分值 3级指标才有") | |||
private BigDecimal indexScore; | |||
@ApiModelProperty("分数细则 3级指标才有") | |||
private String scoreRubric; | |||
@ApiModelProperty("指标细则 3级指标才有") | |||
private String indexDetail; | |||
@ApiModelProperty("评分pdf") | |||
private String pdf; | |||
@ApiModelProperty("评分细则") | |||
private String gradeDetail; | |||
@ApiModelProperty("阶段id") | |||
private Long stageId; | |||
@ApiModelProperty("佐证材料描述") | |||
private String supportMaterial; | |||
@ApiModelProperty("是否为附加指标") | |||
private Boolean isAdditional; | |||
} |
@@ -0,0 +1,68 @@ | |||
package com.ningdatech.pmapi.performance.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.hibernate.validator.constraints.Range; | |||
import javax.validation.constraints.Digits; | |||
import javax.validation.constraints.Size; | |||
/** | |||
* <p> | |||
* | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
@TableName("nd_project_core_business_indicators") | |||
@ApiModel(value = "NdProjectCoreBusinessIndicators对象", description = "") | |||
@Data | |||
public class ProjectCoreBusinessIndicators implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键ID") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("核心业务") | |||
private String coreBusiness; | |||
@ApiModelProperty("业务指标分值") | |||
private BigDecimal score; | |||
@ApiModelProperty("业务指标名称") | |||
private String businessIndicatorName; | |||
@ApiModelProperty("业务指标描述") | |||
private String businessIndicatorDescription; | |||
@ApiModelProperty("指标设计依据") | |||
private String indexDesignBasis; | |||
@ApiModelProperty("指标计算方法") | |||
private String indexCalculationMethod; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("关联的应用ID") | |||
private Long applicationId; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -15,8 +16,8 @@ import java.util.List; | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") | |||
public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModel(value = "绩效评价项目指标模板", description = "绩效评价项目指标模板") | |||
public class ProjectIndexTemplateVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -34,11 +35,14 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModelProperty("丽水 区域code") | |||
private String regionCode; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") | |||
private Integer constructType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
@@ -48,4 +52,7 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModelProperty("绩效指标详情") | |||
private List<ProjectTemplateDetailVO> templateDetails; | |||
@ApiModelProperty("附加绩效指标详情") | |||
private List<ProjectTemplateDetailVO> additionalIndexDetails; | |||
} |
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
/** | |||
@@ -25,23 +26,26 @@ public class ProjectTemplateDetailVO implements Serializable { | |||
@ApiModelProperty("指标名称") | |||
private String name; | |||
@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标") | |||
@ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") | |||
private Integer type; | |||
@ApiModelProperty("父级指标id") | |||
private Long parentId; | |||
@ApiModelProperty("分数 3级指标才有") | |||
private Integer score; | |||
@ApiModelProperty("指标分值 3级指标才有") | |||
private BigDecimal indexScore; | |||
@ApiModelProperty("分数细则 3级指标才有") | |||
private String scoreRubric; | |||
@ApiModelProperty("指标细则 3级指标才有") | |||
private String indexDetail; | |||
@ApiModelProperty("评分pdf") | |||
private String pdf; | |||
@ApiModelProperty("评分细则") | |||
private String gradeDetail; | |||
@ApiModelProperty("阶段id") | |||
private Long stageId; | |||
@ApiModelProperty("佐证材料描述") | |||
private String supportMaterial; | |||
@ApiModelProperty("是否为附加指标") | |||
private Boolean isAdditional; | |||
@ApiModelProperty("子指标") | |||
private List<ProjectTemplateDetailVO> children; | |||
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
public interface IProjectCoreBusinessIndicatorsService extends IService<ProjectCoreBusinessIndicators> { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.performance.service.impl; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.performance.mapper.ProjectCoreBusinessIndicatorsMapper; | |||
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
@Service | |||
public class ProjectCoreBusinessIndicatorsServiceImpl extends ServiceImpl<ProjectCoreBusinessIndicatorsMapper, ProjectCoreBusinessIndicators> implements IProjectCoreBusinessIndicatorsService { | |||
} |
@@ -66,7 +66,7 @@ public class ConstructionController { | |||
@ApiOperation(value = "待初验备案的项目列表", notes = "待初验备案的项目列表") | |||
@GetMapping("/pre-ins/project-list") | |||
public PageVo<ProjectLibListItemVO> preProjectlist(@ModelAttribute ProjectListReq req) { | |||
public PageVo<ProjectLibListItemVO> preProjectList(@ModelAttribute ProjectListReq req) { | |||
return constructionManage.preProjectlist(req); | |||
} | |||
@@ -19,12 +19,14 @@ import com.ningdatech.pmapi.common.util.ExcelExportStyle; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ContractSaveDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.PreInsSaveDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.*; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO; | |||
import com.ningdatech.pmapi.projectdeclared.service.IContractService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; | |||
@@ -47,7 +49,6 @@ import org.springframework.stereotype.Component; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.Collections; | |||
@@ -83,6 +84,7 @@ public class ConstructionManage { | |||
/** | |||
* 待采购的-项目列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -91,22 +93,15 @@ public class ConstructionManage { | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.orderByAsc(Project::getTransactionTime); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<Long> projectIds = page.getRecords().stream().map(Project::getId).collect(Collectors.toList()); | |||
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) | |||
.in(Purchase::getProjectId, projectIds)); | |||
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
@@ -124,11 +119,6 @@ public class ConstructionManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
item.setApprovalDate(w.getApprovalDate()); | |||
if(purchaseMap.containsKey(w.getId())){ | |||
Purchase purchase = purchaseMap.get(w.getId()); | |||
item.setTransactionAmount(purchase.getTransactionAmount()); | |||
item.setTransactionTime(purchase.getTransactionTime()); | |||
} | |||
return item; | |||
}); | |||
return PageVo.of(records, total); | |||
@@ -139,15 +129,15 @@ public class ConstructionManage { | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.orderByAsc(Project::getTransactionTime); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(records)){ | |||
if (CollUtil.isNotEmpty(records)) { | |||
List<Long> projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); | |||
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) | |||
@@ -164,7 +154,7 @@ public class ConstructionManage { | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
exportDTO.setApprovedAmount(r.getApprovalAmount()); | |||
exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |||
if(purchaseMap.containsKey(r.getId())){ | |||
if (purchaseMap.containsKey(r.getId())) { | |||
Purchase purchase = purchaseMap.get(r.getId()); | |||
exportDTO.setTransactionAmount(purchase.getTransactionAmount()); | |||
exportDTO.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |||
@@ -174,7 +164,7 @@ public class ConstructionManage { | |||
} | |||
String fileName = "合同备案项目列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
ExcelDownUtil.setFileName(fileName, response); | |||
//数据导出处理函数 | |||
try { | |||
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) | |||
@@ -191,6 +181,7 @@ public class ConstructionManage { | |||
/** | |||
* 获取合同备案详情 | |||
* | |||
* @param projectId | |||
* @return | |||
*/ | |||
@@ -205,22 +196,22 @@ public class ConstructionManage { | |||
.eq(PaymentPlan::getProjectId, projectId) | |||
.orderByAsc(PaymentPlan::getPaymentTime)); | |||
if(CollUtil.isNotEmpty(payments)){ | |||
vo.setPayments(convertPayments(payments,contract.getTotalAmount())); | |||
if (CollUtil.isNotEmpty(payments)) { | |||
vo.setPayments(convertPayments(payments, contract.getTotalAmount())); | |||
} | |||
return vo; | |||
} | |||
private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments,BigDecimal totalAmount) { | |||
if(CollUtil.isEmpty(payments)){ | |||
private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments, BigDecimal totalAmount) { | |||
if (CollUtil.isEmpty(payments)) { | |||
return Collections.emptyList(); | |||
} | |||
return payments.stream().map(p -> { | |||
PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); | |||
vo.setRatio((Objects.isNull(totalAmount)||totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" | |||
vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" | |||
: p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) | |||
.divide(totalAmount,BigDecimal.ROUND_CEILING,BigDecimal.ROUND_CEILING) + "%"); | |||
.divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); | |||
return vo; | |||
}) | |||
.collect(Collectors.toList()); | |||
@@ -228,6 +219,7 @@ public class ConstructionManage { | |||
/** | |||
* 填写合同信息 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@@ -251,21 +243,21 @@ public class ConstructionManage { | |||
.eq(Contract::getProjectId, projectId) | |||
.last(BizConst.LIMIT_1)); | |||
BeanUtil.copyProperties(dto,contractEntity); | |||
if(Objects.isNull(contract)){ | |||
BeanUtil.copyProperties(dto, contractEntity); | |||
if (Objects.isNull(contract)) { | |||
contractEntity.setCreateOn(LocalDateTime.now()); | |||
contractEntity.setCreateBy(employeeCode); | |||
}else{ | |||
} else { | |||
contractEntity.setId(contract.getId()); | |||
} | |||
contractEntity.setProjectId(projectId); | |||
if(contractService.saveOrUpdate(contractEntity)){ | |||
if (contractService.saveOrUpdate(contractEntity)) { | |||
//存 付款计划信心 | |||
if(Objects.nonNull(dto.getPayments())){ | |||
if (Objects.nonNull(dto.getPayments())) { | |||
//先删除 | |||
paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class) | |||
.eq(PaymentPlan::getProjectId,projectId)); | |||
if(CollUtil.isNotEmpty(dto.getPayments())){ | |||
.eq(PaymentPlan::getProjectId, projectId)); | |||
if (CollUtil.isNotEmpty(dto.getPayments())) { | |||
List<PaymentPlan> payments = dto.getPayments().stream().map(d -> { | |||
PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class); | |||
plan.setProjectId(projectId); | |||
@@ -282,15 +274,15 @@ public class ConstructionManage { | |||
} | |||
//判断下 如果和初验都完成了 才进入下一阶段 | |||
if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){ | |||
if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { | |||
//进入到下一状态 | |||
stateMachineUtils.pass(project); | |||
} | |||
project.setUpdateOn(LocalDateTime.now()); | |||
if(Objects.nonNull(dto.getDeliveryTime())){ | |||
if (Objects.nonNull(dto.getDeliveryTime())) { | |||
project.setDeliveryTime(dto.getDeliveryTime()); | |||
} | |||
if(Objects.nonNull(dto.getTotalAmount())){ | |||
if (Objects.nonNull(dto.getTotalAmount())) { | |||
project.setContractAmount(dto.getTotalAmount()); | |||
} | |||
projectService.updateById(project); | |||
@@ -300,6 +292,7 @@ public class ConstructionManage { | |||
/** | |||
* 待初验项目列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -308,9 +301,9 @@ public class ConstructionManage { | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//交货时间 排序 | |||
query.isNotNull(Project::getDeliveryTime); | |||
query.orderByAsc(Project::getDeliveryTime); | |||
@@ -319,13 +312,6 @@ public class ConstructionManage { | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<Long> projectIds = page.getRecords().stream().map(Project::getId).collect(Collectors.toList()); | |||
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) | |||
.in(Purchase::getProjectId, projectIds)); | |||
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
@@ -343,11 +329,6 @@ public class ConstructionManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
item.setApprovalDate(w.getApprovalDate()); | |||
if(purchaseMap.containsKey(w.getId())){ | |||
Purchase purchase = purchaseMap.get(w.getId()); | |||
item.setTransactionAmount(purchase.getTransactionAmount()); | |||
item.setTransactionTime(purchase.getTransactionTime()); | |||
} | |||
item.setDeliveryTime(w.getDeliveryTime()); | |||
item.setContractAmount(w.getContractAmount()); | |||
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); | |||
@@ -361,23 +342,17 @@ public class ConstructionManage { | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//交货时间 排序 | |||
query.isNotNull(Project::getDeliveryTime); | |||
query.orderByAsc(Project::getDeliveryTime); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(records)){ | |||
List<Long> projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); | |||
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) | |||
.in(Purchase::getProjectId, projectIds)); | |||
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); | |||
if (CollUtil.isNotEmpty(records)) { | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
collect = records.stream().map(r -> { | |||
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
@@ -394,7 +369,7 @@ public class ConstructionManage { | |||
} | |||
String fileName = "合同备案项目列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
ExcelDownUtil.setFileName(fileName, response); | |||
//数据导出处理函数 | |||
try { | |||
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) | |||
@@ -402,8 +377,6 @@ public class ConstructionManage { | |||
.registerWriteHandler(ExcelExportStyle.formalStyle()) | |||
.sheet(fileName) | |||
.doWrite(collect); | |||
} catch (IOException e) { | |||
throw new RuntimeException(e); | |||
} catch (Exception e) { | |||
throw new RuntimeException(e); | |||
} | |||
@@ -411,37 +384,35 @@ public class ConstructionManage { | |||
/** | |||
* 查询初验信息 | |||
* | |||
* @param projectId | |||
* @return | |||
*/ | |||
public PreInsVO detailPreInsByProjectId(Long projectId) { | |||
Project project = projectService.getById(projectId); | |||
PreInsVO vo = new PreInsVO(); | |||
vo.setProjectId(projectId); | |||
vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials()); | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
LambdaQueryWrapper<PreInsAcceptancePerson> query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.eq(PreInsAcceptancePerson::getProjectId, projectId) | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||
if(CollUtil.isNotEmpty(acceptancePersons)){ | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
} | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn); | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(query); | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
return vo; | |||
} | |||
private List<PreInsAcceptancePersonVO> convertPersons(List<PreInsAcceptancePerson> acceptancePersons) { | |||
if(CollUtil.isEmpty(acceptancePersons)){ | |||
if (CollUtil.isEmpty(acceptancePersons)) { | |||
return Collections.emptyList(); | |||
} | |||
return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u,PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); | |||
return acceptancePersons.stream() | |||
.map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)) | |||
.collect(Collectors.toList()); | |||
} | |||
/** | |||
* 填写初验信息 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@@ -461,11 +432,11 @@ public class ConstructionManage { | |||
.throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); | |||
//初验人员 | |||
if(Objects.nonNull(dto.getAcceptancePersons())){ | |||
if (Objects.nonNull(dto.getAcceptancePersons())) { | |||
//先删除 | |||
acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.eq(PreInsAcceptancePerson::getProjectId,projectId)); | |||
if(CollUtil.isNotEmpty(dto.getAcceptancePersons())){ | |||
.eq(PreInsAcceptancePerson::getProjectId, projectId)); | |||
if (CollUtil.isNotEmpty(dto.getAcceptancePersons())) { | |||
List<PreInsAcceptancePerson> persons = dto.getAcceptancePersons().stream().map(d -> { | |||
PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class); | |||
person.setProjectId(projectId); | |||
@@ -482,7 +453,7 @@ public class ConstructionManage { | |||
//判断下 如果和初验都完成了 才进入下一阶段 | |||
if(Objects.nonNull(project.getDeliveryTime())){ | |||
if (Objects.nonNull(project.getDeliveryTime())) { | |||
//进入到下一状态 | |||
stateMachineUtils.pass(project); | |||
} | |||
@@ -31,6 +31,9 @@ import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; | |||
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
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.projectdeclared.model.dto.DelayedApplyDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; | |||
@@ -105,14 +108,11 @@ public class ProjectLibManage { | |||
private final INdProjectApplyBorrowService projectApplyBorrowService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IContractService contractService; | |||
private final IPurchaseService purchaseService; | |||
private final IPreInsAcceptancePersonService acceptancePersonService; | |||
private final IPaymentPlanService paymentPlanService; | |||
private final ITodoService todoService; | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
@@ -360,15 +360,20 @@ public class ProjectLibManage { | |||
//保存项目应用 | |||
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()) | |||
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); | |||
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务 | |||
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, project.getProjectCode()) | |||
.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)); | |||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||
Project finalProject = project; | |||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||
List<ProjectApplicationDTO> applicationList = projectDto.getApplicationList(); | |||
for (ProjectApplicationDTO application : applicationList) { | |||
ProjectApplication projectApplication = new ProjectApplication(); | |||
BeanUtils.copyProperties(application, projectApplication); | |||
projectApplication.setId(null); | |||
@@ -378,9 +383,19 @@ public class ProjectLibManage { | |||
projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); | |||
projectApplication.setIsConstruct(Boolean.TRUE); | |||
projectApplication.setProjectVersion(finalProject.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 project; | |||
} catch (Exception e) { | |||
@@ -482,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(); | |||
@@ -1,11 +1,13 @@ | |||
package com.ningdatech.pmapi.projectlib.model.dto; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
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> | |||
@@ -167,4 +169,7 @@ public class ProjectApplicationDTO implements Serializable { | |||
@ApiModelProperty("应用编码") | |||
private String appCode; | |||
@ApiModelProperty("核心业务列表") | |||
private List<ProjectCoreBusinessDTO> coreBusinessList; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.ningdatech.pmapi.projectlib.model.dto; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -298,5 +299,4 @@ public class ProjectDTO implements Serializable { | |||
private String finalAcceptanceMaterials; | |||
private Map<String,Object> dynamicForm; | |||
} |
@@ -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; | |||
} | |||