@@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { | |||
public static void main(String[] args) { | |||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||
generate("CMM", "test", PATH_CMM, "nd_project_apply_borrow"); | |||
generate("CMM", "test", PATH_CMM, "nd_project_core_business_indicators"); | |||
} | |||
} |
@@ -57,6 +57,8 @@ public interface CommonConst { | |||
Integer VERSION_SIZE = 2; | |||
Integer VERSION_JUDGE = -1; | |||
String COPY = "副本"; | |||
} |
@@ -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<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info(forEntity.getBody()); | |||
return forEntity.getBody(); | |||
} | |||
} |
@@ -56,7 +56,10 @@ public class GovBusinessStripManage { | |||
public List<ProvincialGovBusinessStripVO> getProvincialGovBusinessStripList(String businessStripName) { | |||
if(Objects.nonNull(canSearch) && canSearch){ | |||
return joinReviewProvincialBureauService.searchGovUnits(); | |||
List<ProvincialGovBusinessStripVO> vos = joinReviewProvincialBureauService.searchGovUnits(); | |||
return vos.stream() | |||
.filter(b -> StringUtils.isBlank(businessStripName) || b.getBusinessStripName().contains(businessStripName)) | |||
.collect(Collectors.toList()); | |||
} | |||
List<ProvincialGovBusinessStrip> strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class) | |||
@@ -0,0 +1,71 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.IndicatorConfigManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
/** | |||
* 绩效评价-指标配置 | |||
* @return | |||
* @author CMM | |||
* @since 2023/07/26 16:29 | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价-指标配置") | |||
@RequestMapping("/api/v1/indicator-config") | |||
public class IndicatorConfigController { | |||
private final IndicatorConfigManage indicatorConfigManage; | |||
@GetMapping("/project/index/template/list") | |||
@ApiOperation("项目指标模板列表") | |||
public PageVo<ProjectIndexTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
return indicatorConfigManage.projectList(req); | |||
} | |||
@GetMapping("/project/index/template/detail/{id}") | |||
@ApiOperation("项目指标配置模板详情") | |||
public ProjectIndexTemplateVO projectDetail(@PathVariable Long id) { | |||
return indicatorConfigManage.projectDetail(id); | |||
} | |||
@ApiOperation(value = "项目指标模版启用(禁用)", notes = "项目指标模版启用(禁用)") | |||
@PutMapping("/project/index/{templateId}/active/{state}") | |||
public String enOrDisProjectIndexTemplate(@PathVariable Long templateId, | |||
@PathVariable Boolean state) { | |||
Boolean result = indicatorConfigManage.enOrDisProjectIndexTemplate(templateId, state); | |||
return Boolean.TRUE.equals(result) ? "启用项目指标模版成功":"禁用项目指标模版成功"; | |||
} | |||
@PostMapping("/project/index/template/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
@WebLog("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorConfigManage.projectTemplateSave(dto); | |||
} | |||
@PostMapping("/project/index/template/copy/{id}") | |||
@ApiOperation("项目指标配置模板复制") | |||
@WebLog("项目指标配置模板复制") | |||
public String projectTemplateCopy(@PathVariable Long id) { | |||
return indicatorConfigManage.projectTemplateCopy(id); | |||
} | |||
@PostMapping("/project/index/template/delete/{id}") | |||
@ApiOperation("项目指标配置模板删除") | |||
@WebLog("项目指标配置模板删除") | |||
public String projectTemplateDelete(@PathVariable Long id) { | |||
return indicatorConfigManage.projectTemplateDelete(id); | |||
} | |||
} |
@@ -1,55 +0,0 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.IndicatorTemplateManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* @Classname PerformanceIndicatorTemplateController | |||
* @Description | |||
* @Date 2023/6/25 14:16 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价-指标配置") | |||
@RequestMapping("/api/v1/indicator-template") | |||
public class PerformanceIndicatorTemplateController { | |||
private final IndicatorTemplateManage indicatorTemplateManage; | |||
@GetMapping("/project/list") | |||
@ApiOperation("项目指标配置模板列表") | |||
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
return indicatorTemplateManage.projectList(req); | |||
} | |||
@GetMapping("/project/detail/{id}") | |||
@ApiOperation("项目指标配置模板详情") | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(@PathVariable Long id) { | |||
return indicatorTemplateManage.projectDetail(id); | |||
} | |||
@PostMapping("/project/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
@WebLog("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorTemplateManage.projectTemplateSave(dto); | |||
} | |||
@PostMapping("/project/delete/{id}") | |||
@ApiOperation("项目指标配置模板删除") | |||
@WebLog("项目指标配置模板删除") | |||
public String projectTemplateDelete(@PathVariable Long id) { | |||
return indicatorTemplateManage.projectTemplateDelete(id); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
package com.ningdatech.pmapi.performance.enumration; | |||
import java.util.Objects; | |||
import org.apache.commons.lang3.StringUtils; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
/** | |||
* ConstructTypeEnum | |||
* @return | |||
* @author CMM | |||
* @since 2023/07/26 16:44 | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public enum ConstructTypeEnum { | |||
/** | |||
* 建设类型 | |||
*/ | |||
SOFT(1, "软件"), | |||
HARDWARE(2, "硬件"), | |||
SOFT_HARD(3, "软硬件"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDesc(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (ConstructTypeEnum t : ConstructTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -22,7 +22,7 @@ public enum PerformanceTemplateTypeEnum { | |||
/** | |||
* 模板类型 | |||
*/ | |||
STAGE(0, "阶段"), | |||
//STAGE(0, "阶段"), | |||
FIRST_INDEX(1, "第一指标"), | |||
SECOND_INDEX(2, "第二指标"), | |||
THIRD_INDEX(3, "第三指标"); | |||
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateStageNameEnum; | |||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; | |||
@@ -17,18 +18,21 @@ import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -43,7 +47,7 @@ import java.util.stream.Collectors; | |||
@Slf4j | |||
@Component | |||
@AllArgsConstructor | |||
public class IndicatorTemplateManage { | |||
public class IndicatorConfigManage { | |||
private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; | |||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||
@@ -53,7 +57,7 @@ public class IndicatorTemplateManage { | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
public PageVo<ProjectIndexTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
Page<PerformanceIndicatorProjectTemplate> page = req.page(); | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) | |||
@@ -64,8 +68,8 @@ public class IndicatorTemplateManage { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceIndicatorProjectTemplateVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) | |||
List<ProjectIndexTemplateVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
@@ -76,18 +80,27 @@ public class IndicatorTemplateManage { | |||
* @param id | |||
* @return | |||
*/ | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { | |||
public ProjectIndexTemplateVO projectDetail(Long id) { | |||
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); | |||
if(Objects.isNull(template)){ | |||
return null; | |||
} | |||
PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template, | |||
PerformanceIndicatorProjectTemplateVO.class); | |||
ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, | |||
ProjectIndexTemplateVO.class); | |||
// 获取模版绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); | |||
// 获取模版附加绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||
if(CollUtil.isNotEmpty(templateDetails)){ | |||
vo.setTemplateDetails(buildTemplateDetail(templateDetails)); | |||
} | |||
if (CollUtil.isNotEmpty(additionalTemplateDetails)){ | |||
vo.setAdditionalIndexDetails(buildTemplateDetail(additionalTemplateDetails)); | |||
} | |||
return vo; | |||
} | |||
@@ -96,7 +109,7 @@ public class IndicatorTemplateManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional | |||
@Transactional(rollbackFor = Exception.class) | |||
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); | |||
@@ -112,24 +125,32 @@ public class IndicatorTemplateManage { | |||
template.setUpdateOn(LocalDateTime.now()); | |||
template.setUpdateBy(user.getUsername()); | |||
if(indicatorProjectTemplateService.saveOrUpdate(template)){ | |||
//保存 模板的详情 | |||
//保存 模板指标的详情 | |||
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ | |||
//先删除 | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); | |||
analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); | |||
//校检 3个阶段 总分是不是100 | |||
List<PerformanceIndicatorProjectTemplateDetail> stages = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.STAGE.getCode()) | |||
//校检 所有3级指标(不包括附加指标) 总分是不是100 | |||
List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) | |||
.in(PerformanceIndicatorProjectTemplateDetail::getName, Lists.newArrayList(PerformanceTemplateStageNameEnum.STAGE_1.getDesc(), | |||
PerformanceTemplateStageNameEnum.STAGE_2.getDesc(), PerformanceTemplateStageNameEnum.STAGE_3.getDesc()))); | |||
if(CollUtil.isNotEmpty(stages)){ | |||
int sum = stages.stream().filter(p -> Objects.nonNull(p.getScore())).mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum(); | |||
VUtils.isTrue(sum != 100).throwMessage("总分不是100 操作失败!"); | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); | |||
if(CollUtil.isNotEmpty(indexList)){ | |||
BigDecimal sum = indexList.stream() | |||
.map(PerformanceIndicatorProjectTemplateDetail::getIndexScore) | |||
.filter(Objects::nonNull) | |||
.reduce(BigDecimal.ZERO, BigDecimal::add); | |||
VUtils.isTrue((BigDecimal.valueOf(100)).equals(sum)).throwMessage("总分不是100 操作失败!"); | |||
} | |||
} | |||
// 保存 模版附加指标详情 | |||
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||
analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId()); | |||
} | |||
return "保存成功"; | |||
} | |||
throw new BizException("保存失败!"); | |||
@@ -145,11 +166,24 @@ public class IndicatorTemplateManage { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
analysisTemplateDetailsInner(templateDetails,templateId,null,null); | |||
analysisTemplateDetailsInner(templateDetails,templateId,null); | |||
} | |||
/** | |||
* 解析 项目附加考核指标 | |||
* @param additionalTemplateDetails | |||
* @return | |||
*/ | |||
public void analysisAdditionalTemplateDetails( | |||
List<ProjectTemplateDetailDTO> additionalTemplateDetails,Long templateId) { | |||
if(CollUtil.isEmpty(additionalTemplateDetails)){ | |||
return; | |||
} | |||
analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); | |||
} | |||
public void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails, | |||
Long templateId,Long parentId,Long stageId) { | |||
Long templateId,Long parentId) { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
@@ -162,47 +196,42 @@ public class IndicatorTemplateManage { | |||
templateDetail.setUpdateBy(user.getUsername()); | |||
templateDetail.setUpdateOn(LocalDateTime.now()); | |||
templateDetail.setTemplateId(templateId); | |||
// 一级指标的父ID为null | |||
templateDetail.setParentId(parentId); | |||
//如果是阶段的计算下 总分 | |||
if(!PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
templateDetail.setStageId(stageId); | |||
} | |||
indicatorProjectTemplateDetailService.save(templateDetail); | |||
//如果是阶段的话 阶段Id 就是自己的id | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
templateDetail.setScore(computeTotalScore(templateDetail)); | |||
templateDetail.setStageId(templateDetail.getId()); | |||
indicatorProjectTemplateDetailService.updateById(templateDetail); | |||
stageId = templateDetail.getId(); | |||
} | |||
if(CollUtil.isNotEmpty(detail.getChildren())){ | |||
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId(),stageId); | |||
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); | |||
} | |||
} | |||
} | |||
/** | |||
* 计算 此阶段下的 总分 | |||
* @param templateDetail | |||
* @return | |||
*/ | |||
private Integer computeTotalScore(PerformanceIndicatorProjectTemplateDetail templateDetail) { | |||
Integer total = 0; | |||
if(Objects.isNull(templateDetail) || Objects.isNull(templateDetail.getId())){ | |||
return total; | |||
public void analysisAdditionalTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails, | |||
Long templateId,Long parentId) { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
for(ProjectTemplateDetailDTO detail : templateDetails){ | |||
//计算阶段的 | |||
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); | |||
templateDetail.setCreateBy(user.getUsername()); | |||
templateDetail.setCreateOn(LocalDateTime.now()); | |||
templateDetail.setUpdateBy(user.getUsername()); | |||
templateDetail.setUpdateOn(LocalDateTime.now()); | |||
templateDetail.setTemplateId(templateId); | |||
// 标记为附加指标 | |||
templateDetail.setIsAdditional(Boolean.TRUE); | |||
// 一级指标的父ID为null | |||
templateDetail.setParentId(parentId); | |||
indicatorProjectTemplateDetailService.save(templateDetail); | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
List<PerformanceIndicatorProjectTemplateDetail> thirds = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateDetail.getTemplateId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getStageId, templateDetail.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); | |||
if(CollUtil.isNotEmpty(thirds)){ | |||
total = thirds.stream().mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum(); | |||
if(CollUtil.isNotEmpty(detail.getChildren())){ | |||
analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); | |||
} | |||
} | |||
return total; | |||
} | |||
/** | |||
@@ -213,44 +242,47 @@ public class IndicatorTemplateManage { | |||
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) { | |||
List<ProjectTemplateDetailVO> res = Lists.newArrayList(); | |||
//第一层是 一级的 | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){ | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) { | |||
if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) { | |||
ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> firstList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { | |||
if (Objects.nonNull(templateDetailSecond.getParentId()) && | |||
templateDetailSecond.getParentId().equals(templateDetail.getId())) { | |||
templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) { | |||
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { | |||
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { | |||
if (Objects.nonNull(templateDetailThird.getParentId()) && | |||
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { | |||
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> fourList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { | |||
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList(); | |||
for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { | |||
if (Objects.nonNull(templateDetailFour.getParentId()) && | |||
templateDetailFour.getParentId().equals(templateDetailThird.getId())) { | |||
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); | |||
fourList.add(detailFourVo); | |||
thirdList.add(detailFourVo); | |||
} | |||
} | |||
detailThirdVo.setChildren(fourList); | |||
thirdList.add(detailThirdVo); | |||
detailThirdVo.setChildren(thirdList); | |||
secondList.add(detailThirdVo); | |||
} | |||
} | |||
detailSecondVo.setChildren(thirdList); | |||
secondList.add(detailSecondVo); | |||
detailSecondVo.setChildren(secondList); | |||
firstList.add(detailSecondVo); | |||
} | |||
} | |||
detailVo.setChildren(secondList); | |||
res.add(detailVo); | |||
detailFirstVo.setChildren(firstList); | |||
res.add(detailFirstVo); | |||
} | |||
} | |||
return res; | |||
} | |||
/** | |||
* 删除项目模板 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@@ -258,15 +290,59 @@ public class IndicatorTemplateManage { | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); | |||
VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); | |||
if(CommonEnum.YES.getCode().equals(projectTemplate.getStatus())){ | |||
if (CommonEnum.YES.getCode().equals(projectTemplate.getStatus())) { | |||
throw new BizException("操作失败 该模板 是启用状态!"); | |||
} | |||
if(indicatorProjectTemplateService.removeById(id)){ | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,id)); | |||
if (indicatorProjectTemplateService.removeById(id)) { | |||
indicatorProjectTemplateDetailService | |||
.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); | |||
return "删除成功"; | |||
} | |||
return "操作失败"; | |||
} | |||
public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | |||
if (Boolean.TRUE.equals(active)){ | |||
projectTemplate.setStatus(CommonEnum.YES.getCode()); | |||
}else { | |||
projectTemplate.setStatus(CommonEnum.NO.getCode()); | |||
} | |||
return indicatorProjectTemplateService.updateById(projectTemplate); | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
public String projectTemplateCopy(Long templateId) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | |||
PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate(); | |||
BeanUtils.copyProperties(projectTemplate,newTemplate); | |||
// 复制后,项目模版名称变更为xxx副本,状态为禁用 | |||
newTemplate.setName(projectTemplate.getName() + CommonConst.COPY); | |||
newTemplate.setStatus(CommonEnum.NO.getCode()); | |||
newTemplate.setCreateOn(LocalDateTime.now()); | |||
newTemplate.setCreateBy(user.getUsername()); | |||
newTemplate.setUpdateOn(LocalDateTime.now()); | |||
newTemplate.setUpdateBy(user.getUsername()); | |||
if (indicatorProjectTemplateService.save(newTemplate)) { | |||
// 新增指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> projectTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateId)); | |||
// 逐个新增并保存各指标 | |||
for (PerformanceIndicatorProjectTemplateDetail projectTemplateDetail : projectTemplateDetails) { | |||
PerformanceIndicatorProjectTemplateDetail newProjectTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); | |||
BeanUtils.copyProperties(projectTemplateDetail, newProjectTemplateDetail); | |||
newProjectTemplateDetail.setTemplateId(newTemplate.getId()); | |||
newProjectTemplateDetail.setCreateOn(LocalDateTime.now()); | |||
newProjectTemplateDetail.setCreateBy(user.getUsername()); | |||
newProjectTemplateDetail.setUpdateOn(LocalDateTime.now()); | |||
newProjectTemplateDetail.setUpdateBy(user.getUsername()); | |||
indicatorProjectTemplateDetailService.save(newProjectTemplateDetail); | |||
} | |||
return "模版复制成功"; | |||
} | |||
return "模版复制失败"; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
public interface ProjectCoreBusinessIndicatorsMapper extends BaseMapper<ProjectCoreBusinessIndicators> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.performance.mapper.ProjectCoreBusinessIndicatorsMapper"> | |||
</mapper> |
@@ -42,4 +42,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable | |||
@ApiModelProperty("绩效指标详情") | |||
private List<ProjectTemplateDetailDTO> templateDetails; | |||
@ApiModelProperty("附加绩效指标详情") | |||
private List<ProjectTemplateDetailDTO> additionalIndexDetails; | |||
} |
@@ -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; | |||
} |
@@ -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<ProjectTemplateDetailDTO> children; | |||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import liquibase.pro.packaged.I; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
@@ -38,12 +39,15 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { | |||
@ApiModelProperty("丽水 区域code") | |||
private String regionCode; | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("建设类型") | |||
private Integer constructType; | |||
@ApiModelProperty("状态 0关闭 1开启") | |||
private Integer status; | |||
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
/** | |||
@@ -39,21 +40,24 @@ public class PerformanceIndicatorProjectTemplateDetail implements Serializable { | |||
@ApiModelProperty("指标名称") | |||
private String name; | |||
@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标") | |||
@ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") | |||
private Integer type; | |||
@ApiModelProperty("父级指标id") | |||
private Long parentId; | |||
@ApiModelProperty("分数 3级指标才有") | |||
private Integer score; | |||
@ApiModelProperty("指标分值 3级指标才有") | |||
private BigDecimal indexScore; | |||
@ApiModelProperty("分数细则 3级指标才有") | |||
private String scoreRubric; | |||
@ApiModelProperty("指标细则 3级指标才有") | |||
private String indexDetail; | |||
@ApiModelProperty("评分pdf") | |||
private String pdf; | |||
@ApiModelProperty("评分细则") | |||
private String gradeDetail; | |||
@ApiModelProperty("阶段id") | |||
private Long stageId; | |||
@ApiModelProperty("佐证材料描述") | |||
private String supportMaterial; | |||
@ApiModelProperty("是否为附加指标") | |||
private Boolean isAdditional; | |||
} |
@@ -0,0 +1,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; | |||
/** | |||
* <p> | |||
* | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
@TableName("nd_project_core_business_indicators") | |||
@ApiModel(value = "NdProjectCoreBusinessIndicators对象", description = "") | |||
@Data | |||
public class ProjectCoreBusinessIndicators implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键ID") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("核心业务") | |||
private String coreBusiness; | |||
@ApiModelProperty("业务指标分值") | |||
@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; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -15,8 +16,8 @@ import java.util.List; | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") | |||
public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModel(value = "绩效评价项目指标模板", description = "绩效评价项目指标模板") | |||
public class ProjectIndexTemplateVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -34,11 +35,14 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModelProperty("丽水 区域code") | |||
private String regionCode; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") | |||
private Integer constructType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
@@ -48,4 +52,7 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModelProperty("绩效指标详情") | |||
private List<ProjectTemplateDetailVO> templateDetails; | |||
@ApiModelProperty("附加绩效指标详情") | |||
private List<ProjectTemplateDetailVO> additionalIndexDetails; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
public interface IProjectCoreBusinessIndicatorsService extends IService<ProjectCoreBusinessIndicators> { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.performance.service.impl; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.performance.mapper.ProjectCoreBusinessIndicatorsMapper; | |||
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-07-26 | |||
*/ | |||
@Service | |||
public class ProjectCoreBusinessIndicatorsServiceImpl extends ServiceImpl<ProjectCoreBusinessIndicatorsMapper, ProjectCoreBusinessIndicators> implements IProjectCoreBusinessIndicatorsService { | |||
} |
@@ -31,6 +31,9 @@ import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; | |||
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; | |||
@@ -105,14 +108,11 @@ public class ProjectLibManage { | |||
private final INdProjectApplyBorrowService projectApplyBorrowService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IContractService contractService; | |||
private final IPurchaseService purchaseService; | |||
private final IPreInsAcceptancePersonService acceptancePersonService; | |||
private final IPaymentPlanService paymentPlanService; | |||
private final ITodoService todoService; | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
@@ -360,15 +360,20 @@ public class ProjectLibManage { | |||
//保存项目应用 | |||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||
? Boolean.TRUE : Boolean.FALSE; | |||
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 | |||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, project.getProjectCode()) | |||
.eq(ProjectApplication::getProjectVersion, project.getVersion()) | |||
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); | |||
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务 | |||
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, project.getProjectCode()) | |||
.eq(ProjectApplication::getProjectVersion, project.getVersion()) | |||
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); | |||
projectApplicationService.removeBatchByIds(applications); | |||
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); | |||
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds)); | |||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||
Project finalProject = project; | |||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||
List<ProjectApplicationDTO> applicationList = projectDto.getApplicationList(); | |||
for (ProjectApplicationDTO application : applicationList) { | |||
ProjectApplication projectApplication = new ProjectApplication(); | |||
BeanUtils.copyProperties(application, projectApplication); | |||
projectApplication.setId(null); | |||
@@ -378,9 +383,19 @@ public class ProjectLibManage { | |||
projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); | |||
projectApplication.setIsConstruct(Boolean.TRUE); | |||
projectApplication.setProjectVersion(finalProject.getVersion()); | |||
return projectApplication; | |||
}).collect(Collectors.toList()); | |||
projectApplicationService.saveBatch(applications); | |||
boolean result = projectApplicationService.save(projectApplication); | |||
// 保存应用关联的核心业务 | |||
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList(); | |||
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; | |||
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ | |||
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { | |||
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); | |||
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); | |||
projectCoreBusinessIndicators.setApplicationId(application.getId()); | |||
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); | |||
} | |||
} | |||
} | |||
} | |||
return project; | |||
} catch (Exception e) { | |||
@@ -1,11 +1,13 @@ | |||
package com.ningdatech.pmapi.projectlib.model.dto; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
@@ -167,4 +169,7 @@ public class ProjectApplicationDTO implements Serializable { | |||
@ApiModelProperty("应用编码") | |||
private String appCode; | |||
@ApiModelProperty("核心业务列表") | |||
private List<ProjectCoreBusinessDTO> coreBusinessList; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.ningdatech.pmapi.projectlib.model.dto; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -298,5 +299,4 @@ public class ProjectDTO implements Serializable { | |||
private String finalAcceptanceMaterials; | |||
private Map<String,Object> dynamicForm; | |||
} |