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/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index 0e3b3da..cc37265 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.ding.controller; import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.MD5; import com.google.common.collect.Maps; import com.ningdatech.irs.service.IRefreshTokenService; import com.ningdatech.pmapi.common.util.CryptUtils; @@ -109,14 +110,14 @@ public class DingInfoPullController { @ApiOperation(value = "测试项目归并", notes = "测试项目归并") @GetMapping("/test-guibing") - public String testGuibing() throws NoSuchAlgorithmException { + public String testGuibing() { long timestamp = System.currentTimeMillis(); String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; String method = "POST"; String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); log.info("secret :{}",secret); - String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); + String sign = MD5.create().digestHex(appKey + secret + timestamp); HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); RestTemplate restTemplate; if(Objects.nonNull(factory)){ @@ -126,7 +127,7 @@ public class DingInfoPullController { } String appId = "A330000100000202105005790"; String updateTime = "2023-07-26 00:00:00"; - String capCode = CryptUtils.MD5Encode(timestamp + updateTime + appId); + String capCode = MD5.create().digestHex(timestamp + updateTime + appId); String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + @@ -137,4 +138,33 @@ public class DingInfoPullController { log.info(forEntity.getBody()); return forEntity.getBody(); } + + @ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") + @GetMapping("/test-push-project") + public String testPushProject() { + long timestamp = System.currentTimeMillis(); + String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String method = "POST"; + String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); + log.info("secret :{}",secret); + String sign = MD5.create().digestHex(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + String appId = "A330000100000202105005790"; + String updateTime = "2023-07-26 00:00:00"; + String capCode = MD5.create().digestHex(timestamp + updateTime + appId); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" + + "requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + appKey + "&baseProjPrincipal=abc&baseProjSetYear=abc&baseProjId=abc&baseManDeprt=abc&baseProjBasis=abc&baseLowestLevel=abc&ProjPrincipalCall=abc&baseConstructionType=abc&baseProjType=abc&baseProjContacts=abc&isEffective=abc&baseConsDeprtDing=abc&baseProjSetProg=abc&baseProjContactsCall=abc&baseProjName=abc&baseProjConsClass=abc&capCode=abc&baseManDeprtDing=abc&baseProvManDeprtDing=abc&baseBasisEstablish=abc&baseAreaCode=abc&capTime=abc&baseAreaName=abc"; + log.info("url :{}",url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java index 3e7bb31..8ead81d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java @@ -56,7 +56,10 @@ public class GovBusinessStripManage { public List getProvincialGovBusinessStripList(String businessStripName) { if(Objects.nonNull(canSearch) && canSearch){ - return joinReviewProvincialBureauService.searchGovUnits(); + List vos = joinReviewProvincialBureauService.searchGovUnits(); + return vos.stream() + .filter(b -> StringUtils.isBlank(businessStripName) || b.getBusinessStripName().contains(businessStripName)) + .collect(Collectors.toList()); } List strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class) 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/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java similarity index 51% rename from pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java rename to pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java index 6fa97a8..98b32b5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java @@ -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 projectList(PerformanceAppraisalListReq req) { + public PageVo projectList(PerformanceAppraisalListReq req) { Page page = req.page(); LambdaQueryWrapper 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 res = page.getRecords().stream() - .map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) + List 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 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; } @@ -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 stages = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.STAGE.getCode()) + //校检 所有3级指标(不包括附加指标) 总分是不是100 + List 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 additionalTemplateDetails,Long templateId) { + if(CollUtil.isEmpty(additionalTemplateDetails)){ + return; + } + analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); } public void analysisTemplateDetailsInner(List 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 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 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 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) { + 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(templateDetail.getId())) { + templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) { ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); - List thirdList = Lists.newArrayList(); - for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { + 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 fourList = Lists.newArrayList(); - for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { + 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); - 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 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/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/ProjectIndexTemplateVO.java similarity index 73% rename from pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java index 6ac7ff2..32ec504 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java @@ -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 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; - }