From 0141dc078c9c908bcdda8b60b9ba0e90b058bdf7 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 27 Jul 2023 15:56:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E7=94=B3=E6=8A=A5=E3=80=81=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../pmapi/common/constant/CommonConst.java | 2 + .../controller/IndicatorConfigController.java | 71 +++++ .../PerformanceIndicatorTemplateController.java | 55 ---- .../performance/enumration/ConstructTypeEnum.java | 42 +++ .../enumration/PerformanceTemplateTypeEnum.java | 2 +- .../performance/manage/IndicatorConfigManage.java | 348 +++++++++++++++++++++ .../manage/IndicatorTemplateManage.java | 272 ---------------- .../ProjectCoreBusinessIndicatorsMapper.java | 16 + .../mapper/ProjectCoreBusinessIndicatorsMapper.xml | 5 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 3 + .../model/dto/ProjectCoreBusinessDTO.java | 46 +++ .../model/dto/ProjectTemplateDetailDTO.java | 19 +- .../PerformanceIndicatorProjectTemplate.java | 10 +- .../PerformanceIndicatorProjectTemplateDetail.java | 22 +- .../entity/ProjectCoreBusinessIndicators.java | 73 +++++ .../vo/PerformanceIndicatorProjectTemplateVO.java | 51 --- .../model/vo/ProjectIndexTemplateVO.java | 58 ++++ .../IProjectCoreBusinessIndicatorsService.java | 16 + .../ProjectCoreBusinessIndicatorsServiceImpl.java | 20 ++ .../pmapi/projectlib/manage/ProjectLibManage.java | 41 ++- .../model/dto/ProjectApplicationDTO.java | 5 + .../pmapi/projectlib/model/dto/ProjectDTO.java | 2 +- 23 files changed, 766 insertions(+), 415 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 7d4f1d0..8a455b6 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -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"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java index 238f416..287cb64 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -57,6 +57,8 @@ public interface CommonConst { Integer VERSION_SIZE = 2; Integer VERSION_JUDGE = -1; + String COPY = "副本"; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java new file mode 100644 index 0000000..24bdad3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java @@ -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 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); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java deleted file mode 100644 index 7876d71..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java +++ /dev/null @@ -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 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); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java new file mode 100644 index 0000000..bd5c9ce --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java @@ -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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java index 51f7bfc..879c2e5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java @@ -22,7 +22,7 @@ public enum PerformanceTemplateTypeEnum { /** * 模板类型 */ - STAGE(0, "阶段"), + //STAGE(0, "阶段"), FIRST_INDEX(1, "第一指标"), SECOND_INDEX(2, "第二指标"), THIRD_INDEX(3, "第三指标"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java new file mode 100644 index 0000000..98b32b5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java @@ -0,0 +1,348 @@ +package com.ningdatech.pmapi.performance.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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; +import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; +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.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; +import java.util.stream.Collectors; + +/** + * @Classname IndicatorTemplateManage + * @Description + * @Date 2023/6/26 14:15 + * @Author PoffyZhang + */ +@Slf4j +@Component +@AllArgsConstructor +public class IndicatorConfigManage { + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + + /** + * 模板列表 + * @param req + * @return + */ + public PageVo projectList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()); + indicatorProjectTemplateService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 查询项目模板详情 + * @param id + * @return + */ + public ProjectIndexTemplateVO projectDetail(Long id) { + PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); + if(Objects.isNull(template)){ + return null; + } + ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, + ProjectIndexTemplateVO.class); + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); + // 获取模版附加绩效指标详情 + List 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; + } + + /** + * 项目指标 模板保存 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); + if(Objects.nonNull(dto.getId())){ + PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); + template.setId(old.getId()); + }else{ + template.setId(null); + template.setCreateOn(LocalDateTime.now()); + template.setCreateBy(user.getUsername()); + } + 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 indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) + .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("保存失败!"); + } + + /** + * 解析 项目考核指标 + * @param templateDetails + * @return + */ + public void analysisTemplateDetails( + List templateDetails,Long templateId) { + if(CollUtil.isEmpty(templateDetails)){ + return; + } + analysisTemplateDetailsInner(templateDetails,templateId,null); + } + + /** + * 解析 项目附加考核指标 + * @param additionalTemplateDetails + * @return + */ + public void analysisAdditionalTemplateDetails( + List additionalTemplateDetails,Long templateId) { + if(CollUtil.isEmpty(additionalTemplateDetails)){ + return; + } + analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); + } + + public void analysisTemplateDetailsInner(List 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); + // 一级指标的父ID为null + templateDetail.setParentId(parentId); + + indicatorProjectTemplateDetailService.save(templateDetail); + + if(CollUtil.isNotEmpty(detail.getChildren())){ + analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + } + } + } + + public void analysisAdditionalTemplateDetailsInner(List 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(CollUtil.isNotEmpty(detail.getChildren())){ + analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + } + } + } + + /** + * 装配 模板详情 + * @param templateDetails + * @return + */ + private List buildTemplateDetail(List templateDetails) { + List res = Lists.newArrayList(); + //第一层是 一级的 + for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) { + if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) { + ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class); + List firstList = Lists.newArrayList(); + for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { + if (Objects.nonNull(templateDetailSecond.getParentId()) && + templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) { + ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); + List 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 thirdList = Lists.newArrayList(); + for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { + if (Objects.nonNull(templateDetailFour.getParentId()) && + templateDetailFour.getParentId().equals(templateDetailThird.getId())) { + ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); + thirdList.add(detailFourVo); + } + } + detailThirdVo.setChildren(thirdList); + secondList.add(detailThirdVo); + } + } + detailSecondVo.setChildren(secondList); + firstList.add(detailSecondVo); + } + } + detailFirstVo.setChildren(firstList); + res.add(detailFirstVo); + + } + } + return res; + } + + + /** + * 删除项目模板 + * + * @param id + * @return + */ + public String projectTemplateDelete(Long id) { + PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); + VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); + + if (CommonEnum.YES.getCode().equals(projectTemplate.getStatus())) { + throw new BizException("操作失败 该模板 是启用状态!"); + } + + 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 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 "模版复制失败"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java deleted file mode 100644 index 6fa97a8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -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.enumeration.CommonEnum; -import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateStageNameEnum; -import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; -import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; -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.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 lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname IndicatorTemplateManage - * @Description - * @Date 2023/6/26 14:15 - * @Author PoffyZhang - */ -@Slf4j -@Component -@AllArgsConstructor -public class IndicatorTemplateManage { - private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; - - private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; - - /** - * 模板列表 - * @param req - * @return - */ - public PageVo projectList(PerformanceAppraisalListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()); - indicatorProjectTemplateService.page(page,wrapper); - - if(0L == page.getTotal()){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 查询项目模板详情 - * @param id - * @return - */ - public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { - PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); - if(Objects.isNull(template)){ - return null; - } - PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template, - PerformanceIndicatorProjectTemplateVO.class); - List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); - if(CollUtil.isNotEmpty(templateDetails)){ - vo.setTemplateDetails(buildTemplateDetail(templateDetails)); - } - return vo; - } - - /** - * 项目指标 模板保存 - * @param dto - * @return - */ - @Transactional - public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); - if(Objects.nonNull(dto.getId())){ - PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); - template.setId(old.getId()); - }else{ - template.setId(null); - template.setCreateOn(LocalDateTime.now()); - template.setCreateBy(user.getUsername()); - } - 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 stages = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.STAGE.getCode()) - .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 操作失败!"); - } - } - return "保存成功"; - } - throw new BizException("保存失败!"); - } - - /** - * 解析 项目考核指标 - * @param templateDetails - * @return - */ - public void analysisTemplateDetails( - List templateDetails,Long templateId) { - if(CollUtil.isEmpty(templateDetails)){ - return; - } - analysisTemplateDetailsInner(templateDetails,templateId,null,null); - } - - public void analysisTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId,Long stageId) { - 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.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); - } - } - } - - /** - * 计算 此阶段下的 总分 - * @param templateDetail - * @return - */ - private Integer computeTotalScore(PerformanceIndicatorProjectTemplateDetail templateDetail) { - Integer total = 0; - if(Objects.isNull(templateDetail) || Objects.isNull(templateDetail.getId())){ - return total; - } - - if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ - List 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(); - } - } - return total; - } - - /** - * 装配 模板详情 - * @param templateDetails - * @return - */ - private List buildTemplateDetail(List templateDetails) { - List res = Lists.newArrayList(); - //第一层是 一级的 - for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){ - if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ - ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class); - List secondList = Lists.newArrayList(); - for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { - if (Objects.nonNull(templateDetailSecond.getParentId()) && - templateDetailSecond.getParentId().equals(templateDetail.getId())) { - ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); - List thirdList = Lists.newArrayList(); - for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { - if (Objects.nonNull(templateDetailThird.getParentId()) && - templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { - ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); - List fourList = 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); - } - } - detailThirdVo.setChildren(fourList); - thirdList.add(detailThirdVo); - } - } - detailSecondVo.setChildren(thirdList); - secondList.add(detailSecondVo); - } - } - detailVo.setChildren(secondList); - res.add(detailVo); - } - } - return res; - } - - /** - * 删除项目模板 - * @param id - * @return - */ - public String projectTemplateDelete(Long id) { - PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); - VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); - - if(CommonEnum.YES.getCode().equals(projectTemplate.getStatus())){ - throw new BizException("操作失败 该模板 是启用状态!"); - } - - if(indicatorProjectTemplateService.removeById(id)){ - indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,id)); - return "删除成功"; - } - return "操作失败"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java new file mode 100644 index 0000000..26435b1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +public interface ProjectCoreBusinessIndicatorsMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml new file mode 100644 index 0000000..d200755 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 72cf09d..78c2c8c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -42,4 +42,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("绩效指标详情") private List templateDetails; + + @ApiModelProperty("附加绩效指标详情") + private List additionalIndexDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java new file mode 100644 index 0000000..73331b3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java @@ -0,0 +1,46 @@ +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; + +/** + * @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("业务指标分值") + 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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java index 412db14..b78e7e9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.util.List; /** @@ -24,23 +25,23 @@ 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级指标才有") + 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 children; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java index 98c95d5..1631390 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java index 6890d1e..3e6abcf 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java @@ -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; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java new file mode 100644 index 0000000..963721a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java @@ -0,0 +1,73 @@ +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; + +/** + *

+ * + *

+ * + * @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("业务指标分值") + @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; + + @ApiModelProperty("关联的应用ID") + private Long applicationId; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java deleted file mode 100644 index 6ac7ff2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -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; - -/** - * @Classname PerformanceIndicatorProjectTemplateVO - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") -public class PerformanceIndicatorProjectTemplateVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("模板名称") - private String name; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("项目年度") - private Integer projectYear; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") - private Integer amountRange; - - @ApiModelProperty("状态 0关闭 1开启") - private Integer status; - - @ApiModelProperty("绩效指标详情") - private List templateDetails; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java new file mode 100644 index 0000000..32ec504 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java @@ -0,0 +1,58 @@ +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; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PerformanceIndicatorProjectTemplateVO + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价项目指标模板", description = "绩效评价项目指标模板") +public class ProjectIndexTemplateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") + private Integer constructType; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; + + @ApiModelProperty("状态 0关闭 1开启") + private Integer status; + + @ApiModelProperty("绩效指标详情") + private List templateDetails; + + @ApiModelProperty("附加绩效指标详情") + private List additionalIndexDetails; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java new file mode 100644 index 0000000..082db1b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +public interface IProjectCoreBusinessIndicatorsService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java new file mode 100644 index 0000000..ab8fcae --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +@Service +public class ProjectCoreBusinessIndicatorsServiceImpl extends ServiceImpl implements IProjectCoreBusinessIndicatorsService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 04fb567..9816c39 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -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 projectLibList(ProjectListReq req) { LambdaQueryWrapper 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 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 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 applications = projectDto.getApplicationList().stream().map(application -> { + List 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 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) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java index 0589cc6..035e943 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java @@ -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; /** *

@@ -167,4 +169,7 @@ public class ProjectApplicationDTO implements Serializable { @ApiModelProperty("应用编码") private String appCode; + + @ApiModelProperty("核心业务列表") + private List coreBusinessList; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java index 1943728..fe54901 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java @@ -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 dynamicForm; - } From 8d1a19f9a82fd387546135ee647aa3eb08b037bc Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 27 Jul 2023 16:00:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=90=8C?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E3=80=81=E5=88=9D=E9=AA=8C=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ConstructionController.java | 2 +- .../projectdeclared/manage/ConstructionManage.java | 110 +++++++++------------ 2 files changed, 47 insertions(+), 65 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java index 2410bbf..d40aa66 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java @@ -66,7 +66,7 @@ public class ConstructionController { @ApiOperation(value = "待初验备案的项目列表", notes = "待初验备案的项目列表") @GetMapping("/pre-ins/project-list") - public PageVo preProjectlist(@ModelAttribute ProjectListReq req) { + public PageVo preProjectList(@ModelAttribute ProjectListReq req) { return constructionManage.preProjectlist(req); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java index bcd2442..f765210 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java @@ -83,6 +83,7 @@ public class ConstructionManage { /** * 待采购的-项目列表 + * * @param req * @return */ @@ -91,22 +92,15 @@ public class ConstructionManage { VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper 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 page = projectService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { return PageVo.empty(); } - - List projectIds = page.getRecords().stream().map(Project::getId).collect(Collectors.toList()); - - List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, projectIds)); - Map purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); - List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -124,11 +118,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 +128,15 @@ public class ConstructionManage { VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper 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 records = projectService.list(query); AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ + if (CollUtil.isNotEmpty(records)) { List projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) @@ -164,7 +153,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 +163,7 @@ public class ConstructionManage { } String fileName = "合同备案项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -191,6 +180,7 @@ public class ConstructionManage { /** * 获取合同备案详情 + * * @param projectId * @return */ @@ -205,22 +195,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 convertPayments(List payments,BigDecimal totalAmount) { - if(CollUtil.isEmpty(payments)){ + private List convertPayments(List 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 +218,7 @@ public class ConstructionManage { /** * 填写合同信息 + * * @param dto * @return */ @@ -251,21 +242,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 payments = dto.getPayments().stream().map(d -> { PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class); plan.setProjectId(projectId); @@ -282,15 +273,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 +291,7 @@ public class ConstructionManage { /** * 待初验项目列表 + * * @param req * @return */ @@ -308,9 +300,9 @@ public class ConstructionManage { VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper 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 +311,6 @@ public class ConstructionManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } - - List projectIds = page.getRecords().stream().map(Project::getId).collect(Collectors.toList()); - - List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, projectIds)); - Map purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); - List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -343,11 +328,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,9 +341,9 @@ public class ConstructionManage { VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper 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); @@ -371,7 +351,7 @@ public class ConstructionManage { AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ + if (CollUtil.isNotEmpty(records)) { List projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) @@ -394,7 +374,7 @@ public class ConstructionManage { } String fileName = "合同备案项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -411,6 +391,7 @@ public class ConstructionManage { /** * 查询初验信息 + * * @param projectId * @return */ @@ -425,7 +406,7 @@ public class ConstructionManage { .eq(PreInsAcceptancePerson::getProjectId, projectId) .orderByAsc(PreInsAcceptancePerson::getCreateOn)); - if(CollUtil.isNotEmpty(acceptancePersons)){ + if (CollUtil.isNotEmpty(acceptancePersons)) { vo.setAcceptancePersons(convertPersons(acceptancePersons)); } @@ -433,15 +414,16 @@ public class ConstructionManage { } private List convertPersons(List 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 +443,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 persons = dto.getAcceptancePersons().stream().map(d -> { PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class); person.setProjectId(projectId); @@ -482,7 +464,7 @@ public class ConstructionManage { //判断下 如果和初验都完成了 才进入下一阶段 - if(Objects.nonNull(project.getDeliveryTime())){ + if (Objects.nonNull(project.getDeliveryTime())) { //进入到下一状态 stateMachineUtils.pass(project); } From 799154ee3811862b823e2add89c395eb5e627b18 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 27 Jul 2023 16:17:59 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E9=80=80=E5=9B=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 13 ++++--- .../pmapi/todocenter/manage/TodoCenterManage.java | 41 ++++++++++++++++------ 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 9816c39..f7546b3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -497,16 +497,21 @@ public class ProjectLibManage { .ne(Project::getId, project.getId()) .eq(Project::getProjectCode, project.getProjectCode())); - //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 + //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务 List 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 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 applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); + projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds)); //app List applicationList = projecDto.getApplicationList(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index bab2441..bfc5efb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -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 applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,project.getVersion())); - - if(isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())){ - //批量添加 - List applications = projectDto.getApplicationList().stream().map(application -> { + .eq(ProjectApplication::getProjectVersion, project.getVersion()) + .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); + projectApplicationService.removeBatchByIds(applicationList); + List applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList()); + projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds)); + + List 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 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; } From 49abe350a3ff2394e0d2c324f7bfe4ca024668fa Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 27 Jul 2023 16:35:13 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=90=8C?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E3=80=81=E5=88=9D=E9=AA=8C=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/ConstructionManage.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java index f765210..ad63b24 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java @@ -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; @@ -349,15 +350,9 @@ public class ConstructionManage { query.orderByAsc(Project::getDeliveryTime); List records = projectService.list(query); - AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); if (CollUtil.isNotEmpty(records)) { - List projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); - - List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, projectIds)); - Map purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); - + AtomicInteger serialNumber = new AtomicInteger(0); collect = records.stream().map(r -> { DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); BeanUtils.copyProperties(r, exportDTO); @@ -382,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); } From 4bd321885de61ec7475505b3f4d3491734700a73 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 27 Jul 2023 16:38:25 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=90=8C?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E3=80=81=E5=88=9D=E9=AA=8C=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/ConstructionManage.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java index ad63b24..b3ca651 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java @@ -390,19 +390,14 @@ public class ConstructionManage { */ public PreInsVO detailPreInsByProjectId(Long projectId) { Project project = projectService.getById(projectId); - PreInsVO vo = new PreInsVO(); vo.setProjectId(projectId); vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials()); - - List acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + LambdaQueryWrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) .eq(PreInsAcceptancePerson::getProjectId, projectId) - .orderByAsc(PreInsAcceptancePerson::getCreateOn)); - - if (CollUtil.isNotEmpty(acceptancePersons)) { - vo.setAcceptancePersons(convertPersons(acceptancePersons)); - } - + .orderByAsc(PreInsAcceptancePerson::getCreateOn); + List acceptancePersons = acceptancePersonService.list(query); + vo.setAcceptancePersons(convertPersons(acceptancePersons)); return vo; } @@ -410,8 +405,9 @@ public class ConstructionManage { 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()); } /** From ad546134bdd948031837aebfbaef4e6b65705f26 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 27 Jul 2023 16:59:20 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7-?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...PerformanceIndicatorProjectTemplateSaveDTO.java | 3 +++ .../model/dto/ProjectCoreBusinessDTO.java | 8 ++++++++ .../model/dto/ProjectTemplateDetailDTO.java | 3 +++ .../entity/ProjectCoreBusinessIndicators.java | 5 ----- .../model/vo/ProjectTemplateDetailVO.java | 22 +++++++++++++--------- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 78c2c8c..5cc508e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java index 73331b3..b0c6485 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java @@ -6,6 +6,9 @@ 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 @@ -24,18 +27,23 @@ public class ProjectCoreBusinessDTO implements Serializable { 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") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java index b78e7e9..91caf9c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java @@ -3,6 +3,8 @@ 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; @@ -32,6 +34,7 @@ public class ProjectTemplateDetailDTO implements Serializable { private Long parentId; @ApiModelProperty("指标分值 3级指标才有") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") private BigDecimal indexScore; @ApiModelProperty("指标细则 3级指标才有") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java index 963721a..356d33c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java @@ -38,23 +38,18 @@ public class ProjectCoreBusinessIndicators implements Serializable { 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") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java index bd32eb8..a006b1d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java @@ -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 children;