@@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | ||||
generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_indicator"); | |||||
generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_score_info"); | |||||
} | } | ||||
} | } |
@@ -2,14 +2,18 @@ package com.ningdatech.pmapi.performance.controller; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; | import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; | ||||
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; | |||||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | ||||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | ||||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | ||||
import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import javax.validation.Valid; | |||||
/** | /** | ||||
* @Classname OrgSelfAppraisalController | * @Classname OrgSelfAppraisalController | ||||
* @Description | * @Description | ||||
@@ -39,6 +43,19 @@ public class OrgSelfAppraisalController { | |||||
@GetMapping("/appraisaled-list/{planId}") | @GetMapping("/appraisaled-list/{planId}") | ||||
@ApiOperation("当前绩效评价已自评列表") | @ApiOperation("当前绩效评价已自评列表") | ||||
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { | public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { | ||||
return selfAppraisalManage.appraisaledList(planId); | |||||
return selfAppraisalManage.appraisaledList(planId,req); | |||||
} | |||||
@GetMapping("/get-appraisal-template-detail/{projectCode}") | |||||
@ApiOperation("获取自评模版详情") | |||||
public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(@PathVariable String projectCode){ | |||||
return selfAppraisalManage.getAppraisalTemplateDetail(projectCode); | |||||
} | } | ||||
@PostMapping("/submit-self-appraisal") | |||||
@ApiOperation("提交自评") | |||||
public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ | |||||
return selfAppraisalManage.submitSelfAppraisal(param); | |||||
} | |||||
} | } |
@@ -34,7 +34,7 @@ public class PerformanceAppraisalConveter { | |||||
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | ||||
vo.setIsReAppraisal(p.getIsReAppraisal()); | vo.setIsReAppraisal(p.getIsReAppraisal()); | ||||
vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); | vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); | ||||
vo.setId(p.getProjectId()); | |||||
vo.setProjectId(p.getProjectId()); | |||||
if(map.containsKey(p.getProjectCode())){ | if(map.containsKey(p.getProjectCode())){ | ||||
Project project = map.get(p.getProjectCode()); | Project project = map.get(p.getProjectCode()); | ||||
vo.setProjectCode(project.getProjectCode()); | vo.setProjectCode(project.getProjectCode()); | ||||
@@ -9,10 +9,12 @@ import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.StrPool; | |||||
import com.ningdatech.pmapi.common.constant.CommonConst; | import com.ningdatech.pmapi.common.constant.CommonConst; | ||||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | import com.ningdatech.pmapi.common.enumeration.CommonEnum; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; | import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; | ||||
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; | |||||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; | import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; | ||||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; | import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; | ||||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | ||||
@@ -60,6 +62,7 @@ public class IndicatorConfigManage { | |||||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | ||||
private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; | private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; | ||||
private final IPerformanceAppraisalAppIndicatorService appIndicatorService; | private final IPerformanceAppraisalAppIndicatorService appIndicatorService; | ||||
private final TemplateDetailBuildHelper templateDetailBuildHelper; | |||||
/** | /** | ||||
* 模板列表 | * 模板列表 | ||||
@@ -105,11 +108,13 @@ public class IndicatorConfigManage { | |||||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) | .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) | ||||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | ||||
if(CollUtil.isNotEmpty(templateDetails)){ | if(CollUtil.isNotEmpty(templateDetails)){ | ||||
vo.setTemplateDetails(buildTemplateDetail(templateDetails)); | |||||
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails); | |||||
vo.setTemplateDetails(templateDetailVos); | |||||
} | } | ||||
if (CollUtil.isNotEmpty(additionalTemplateDetails)){ | if (CollUtil.isNotEmpty(additionalTemplateDetails)){ | ||||
vo.setAdditionalIndexDetails(buildTemplateDetail(additionalTemplateDetails)); | |||||
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails); | |||||
vo.setAdditionalIndexDetails(additionalTemplateDetailVos); | |||||
} | } | ||||
return vo; | return vo; | ||||
} | } | ||||
@@ -123,6 +128,13 @@ public class IndicatorConfigManage { | |||||
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { | public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { | ||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | UserInfoDetails user = LoginUserUtil.loginUserDetail(); | ||||
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); | PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); | ||||
List<Long> projectTagIds = dto.getProjectTagIds(); | |||||
List<String> tagIdList = projectTagIds.stream().map(String::valueOf).collect(Collectors.toList()); | |||||
template.setProjectTagIds(String.join(StrPool.COMMA, tagIdList)); | |||||
if (Objects.isNull(dto.getStatus())){ | |||||
// 默认模版禁用 | |||||
template.setStatus(0); | |||||
} | |||||
if(Objects.nonNull(dto.getId())){ | if(Objects.nonNull(dto.getId())){ | ||||
PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); | PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); | ||||
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); | VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); | ||||
@@ -316,6 +328,16 @@ public class IndicatorConfigManage { | |||||
public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { | public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { | ||||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); | ||||
if (Boolean.TRUE.equals(active)){ | if (Boolean.TRUE.equals(active)){ | ||||
// 根据创建模板时选择的项目类型、预算年度、项目金额、项目标签 | |||||
// 判断模板是否可以启用(同一套组合只能启用一套模板) | |||||
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getOne(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectTemplate.getProjectType()) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear()) | |||||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange()) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds())); | |||||
if (Objects.nonNull(template)){ | |||||
throw new BizException("相同配置的模板已存在,当前模板无法启用!"); | |||||
} | |||||
projectTemplate.setStatus(CommonEnum.YES.getCode()); | projectTemplate.setStatus(CommonEnum.YES.getCode()); | ||||
}else { | }else { | ||||
projectTemplate.setStatus(CommonEnum.NO.getCode()); | projectTemplate.setStatus(CommonEnum.NO.getCode()); | ||||
@@ -8,14 +8,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||||
import com.ningdatech.basic.util.StrPool; | |||||
import com.ningdatech.pmapi.performance.constant.BizConst; | |||||
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; | |||||
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; | |||||
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; | |||||
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; | |||||
import com.ningdatech.pmapi.performance.model.entity.*; | |||||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | ||||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | |||||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | |||||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService; | |||||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; | |||||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; | |||||
import com.ningdatech.pmapi.performance.model.vo.*; | |||||
import com.ningdatech.pmapi.performance.service.*; | |||||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
@@ -30,7 +34,9 @@ import lombok.AllArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
@@ -47,16 +53,14 @@ import java.util.stream.Collectors; | |||||
public class OrgSelfAppraisalManage { | public class OrgSelfAppraisalManage { | ||||
private final IPerformanceAppraisalService performanceAppraisalService; | private final IPerformanceAppraisalService performanceAppraisalService; | ||||
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; | private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; | ||||
private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService applicationService; | |||||
private final IRoleService roleService; | private final IRoleService roleService; | ||||
private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; | |||||
private final TemplateDetailBuildHelper templateDetailBuildHelper; | |||||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||||
private final IProjectTagService projectTagService; | |||||
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; | |||||
/** | /** | ||||
* 绩效列表 | * 绩效列表 | ||||
* @param req | * @param req | ||||
@@ -121,7 +125,8 @@ public class OrgSelfAppraisalManage { | |||||
// 获取评价计划内已添加的待评价项目信息 | // 获取评价计划内已添加的待评价项目信息 | ||||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | ||||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())); | |||||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||||
.filter(p -> Objects.isNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); | |||||
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | ||||
if(CollUtil.isEmpty(paps)){ | if(CollUtil.isEmpty(paps)){ | ||||
@@ -146,11 +151,11 @@ public class OrgSelfAppraisalManage { | |||||
.map(p -> { | .map(p -> { | ||||
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | ||||
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | ||||
BeanUtil.copyProperties(appraisalProject,vo); | |||||
vo.setProjectId(appraisalProject.getProjectId()); | |||||
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); | vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); | ||||
vo.setIsReAppraisal(appraisalProject.getIsReAppraisal()); | |||||
vo.setSelfAppraisalStart(appraisalProject.getSelfAppraisalStart()); | |||||
vo.setSelfAppraisalEnd(appraisalProject.getSelfAppraisalEnd()); | |||||
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); | vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); | ||||
vo.setAppraisalId(planId); | |||||
return vo; | return vo; | ||||
}) | }) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -160,12 +165,54 @@ public class OrgSelfAppraisalManage { | |||||
/** | /** | ||||
* 已经自评表 | * 已经自评表 | ||||
* | |||||
* @param planId | * @param planId | ||||
* @param req | |||||
* @return | * @return | ||||
*/ | */ | ||||
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(Long planId) { | |||||
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(Long planId, PerformanceAppraisalListReq req) { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
PerformanceAppraisal plan = performanceAppraisalService.getById(planId); | |||||
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); | |||||
// 获取评价计划内已添加的已评价项目信息 | |||||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||||
.filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); | |||||
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||||
if(CollUtil.isEmpty(paps)){ | |||||
return PageVo.empty(); | |||||
} | |||||
return PageVo.empty(); | |||||
// 获取本单位在当前评价计划内的项目 | |||||
Set<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||||
Page<Project> page = req.page(); | |||||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||||
.in(Project::getProjectCode, projectCodes) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||||
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); | |||||
projectService.page(page,wrapper); | |||||
if(0L == page.getTotal()){ | |||||
return PageVo.empty(); | |||||
} | |||||
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream() | |||||
.map(p -> { | |||||
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | |||||
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | |||||
BeanUtil.copyProperties(appraisalProject,vo); | |||||
vo.setProjectId(appraisalProject.getProjectId()); | |||||
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); | |||||
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); | |||||
vo.setAppraisalId(planId); | |||||
return vo; | |||||
}) | |||||
.collect(Collectors.toList()); | |||||
return PageVo.of(res,page.getTotal()); | |||||
} | } | ||||
/** | /** | ||||
@@ -174,10 +221,143 @@ public class OrgSelfAppraisalManage { | |||||
* @return | * @return | ||||
*/ | */ | ||||
private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { | private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { | ||||
// 在自评时间段内,且是首次自评(打分时间为空) | |||||
if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && | if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && | ||||
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0){ | |||||
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0 && | |||||
Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())){ | |||||
return Boolean.TRUE; | return Boolean.TRUE; | ||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(String projectCode) { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
String regionCode = user.getRegionCode(); | |||||
ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO(); | |||||
// 根据项目编码获取最新版本的项目信息 | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||||
// 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 | |||||
Integer projectType = project.getProjectType(); | |||||
Integer projectYear = project.getProjectYear(); | |||||
BigDecimal approvalAmount = project.getApprovalAmount(); | |||||
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); | |||||
// 根据项目code获取项目标签ID列表 | |||||
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||||
.map(ProjectTag::getTagId).collect(Collectors.toList()); | |||||
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||||
List<String> strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); | |||||
String projectTagIds = String.join(StrPool.COMMA, strIdList); | |||||
Integer amountRange = null; | |||||
if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) < 0){ | |||||
amountRange = BizConst.AMOUNT_RANGE_ONE; | |||||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) >= 0 && | |||||
approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) < 0) { | |||||
amountRange = BizConst.AMOUNT_RANGE_TWO; | |||||
}else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) >= 0){ | |||||
amountRange = BizConst.AMOUNT_RANGE_THREE; | |||||
} | |||||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||||
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) | |||||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) | |||||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) | |||||
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); | |||||
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getOne(wrapper); | |||||
if (Objects.isNull(projectTemplate)){ | |||||
throw new BizException("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||||
} | |||||
// 装配项目指标详情及分数信息 | |||||
// 获取模版绩效指标详情 | |||||
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); | |||||
// 获取模版附加绩效指标详情 | |||||
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) | |||||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||||
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails); | |||||
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails); | |||||
vo.setProjectName(project.getProjectName()); | |||||
vo.setBuildOrgName(project.getBuildOrgName()); | |||||
vo.setProjectStatus(project.getStatus()); | |||||
vo.setProjectYear(projectYear); | |||||
vo.setApprovalAmount(approvalAmount); | |||||
vo.setTemplateDetails(templateDetailVos); | |||||
vo.setAdditionalIndexDetails(additionalTemplateDetailVos); | |||||
return vo; | |||||
} | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public String submitSelfAppraisal(ProjectAppraisalDTO param) { | |||||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||||
String employeeCode = userDetail.getEmployeeCode(); | |||||
String username = userDetail.getUsername(); | |||||
Long appraisalId = param.getAppraisalId(); | |||||
Long appraisalProjectId = param.getAppraisalProjectId(); | |||||
List<ProjectAppraisalInfoDTO> appraisalInfoList = param.getAppraisalInfoList(); | |||||
// 判断该项目是否还存在于计划或分组中 | |||||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||||
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) | |||||
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); | |||||
if (Objects.isNull(appraisalProject)){ | |||||
throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); | |||||
} | |||||
// 根据项目模板详情ID保存自评得分、打分时间 | |||||
if (CollUtil.isEmpty(appraisalInfoList)){ | |||||
throw new BizException("填写所有自评得分后才能提交!"); | |||||
} | |||||
List<Long> ids = appraisalInfoList.stream() | |||||
.map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId) | |||||
.collect(Collectors.toList()); | |||||
// 查出项目模版详情信息 | |||||
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||||
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); | |||||
if (CollUtil.isEmpty(detailList)){ | |||||
throw new BizException("评价指标不存在!"); | |||||
} | |||||
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); | |||||
List<PerformanceAppraisalScoreInfo> scoreInfos = appraisalInfoList.stream().map(a -> { | |||||
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); | |||||
BigDecimal score = a.getScore(); | |||||
BigDecimal indexScore = templateDetail.getIndexScore(); | |||||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ | |||||
throw new BizException("自评得分必须大于等于0且小于等于指标分值!"); | |||||
} | |||||
// 保存自评分数信息 | |||||
PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo(); | |||||
scoreInfo.setAppraisalBasis(a.getAppraisalBasis()); | |||||
scoreInfo.setAppraisalScore(a.getScore()); | |||||
scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix()); | |||||
scoreInfo.setAppraisalType(AppraisalTypeEnum.SELF_APPRAISAL.getCode()); | |||||
scoreInfo.setTemplateDetailId(templateDetail.getId()); | |||||
scoreInfo.setTemplateId(templateDetail.getTemplateId()); | |||||
scoreInfo.setAppraisalEmployeeCode(employeeCode); | |||||
scoreInfo.setAppraisalEmployeeName(username); | |||||
scoreInfo.setCreateOn(LocalDateTime.now()); | |||||
scoreInfo.setCreateBy(username); | |||||
return scoreInfo; | |||||
}).collect(Collectors.toList()); | |||||
if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ | |||||
// 计算自评总分并保存 | |||||
BigDecimal selfAppraisalTotalScore = appraisalInfoList.stream() | |||||
.map(ProjectAppraisalInfoDTO::getScore) | |||||
.filter(Objects::nonNull) | |||||
.reduce(BigDecimal.ZERO, BigDecimal::add); | |||||
appraisalProject.setSelfAppraisalTotalScore(selfAppraisalTotalScore); | |||||
appraisalProject.setSelfAppraisalScoreTime(LocalDateTime.now()); | |||||
appraisalProject.setUpdateOn(LocalDateTime.now()); | |||||
appraisalProject.setUpdateBy(username); | |||||
performanceAppraisalProjectService.updateById(appraisalProject); | |||||
return "提交成功"; | |||||
} | |||||
return "提交失败"; | |||||
} | |||||
} | } |
@@ -706,7 +706,7 @@ public class PerformanceAppraisalPlanManage { | |||||
vo.setProjectName(project.getProjectName()); | vo.setProjectName(project.getProjectName()); | ||||
vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType())); | vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType())); | ||||
vo.setProjectType(project.getProjectType()); | vo.setProjectType(project.getProjectType()); | ||||
vo.setId(project.getId()); | |||||
vo.setProjectId(project.getId()); | |||||
vo.setProjectCode(projectCode); | vo.setProjectCode(projectCode); | ||||
vo.setProjectYear(project.getProjectYear()); | vo.setProjectYear(project.getProjectYear()); | ||||
vo.setDeclareAmount(project.getDeclareAmount()); | vo.setDeclareAmount(project.getDeclareAmount()); | ||||
@@ -48,4 +48,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable | |||||
@ApiModelProperty("附加绩效指标详情") | @ApiModelProperty("附加绩效指标详情") | ||||
private List<ProjectTemplateDetailDTO> additionalIndexDetails; | private List<ProjectTemplateDetailDTO> additionalIndexDetails; | ||||
@ApiModelProperty("项目标签信息") | |||||
private List<Long> projectTagIds; | |||||
} | } |
@@ -43,7 +43,7 @@ public class PerformanceAppraisalProject implements Serializable { | |||||
@ApiModelProperty("项目编码") | @ApiModelProperty("项目编码") | ||||
private String projectCode; | private String projectCode; | ||||
@ApiModelProperty("是否核查") | |||||
@ApiModelProperty("是否复评") | |||||
private Boolean isReAppraisal; | private Boolean isReAppraisal; | ||||
@ApiModelProperty("自评开始时间") | @ApiModelProperty("自评开始时间") | ||||
@@ -53,8 +53,27 @@ public class PerformanceAppraisalProject implements Serializable { | |||||
private LocalDateTime selfAppraisalEnd; | private LocalDateTime selfAppraisalEnd; | ||||
@ApiModelProperty("自评总分") | @ApiModelProperty("自评总分") | ||||
private BigDecimal selfAppraisalScore; | |||||
private BigDecimal selfAppraisalTotalScore; | |||||
@ApiModelProperty("自评打分时间") | |||||
private LocalDateTime selfAppraisalScoreTime; | |||||
@ApiModelProperty("复评总分") | |||||
private BigDecimal reAppraisalTotalScore; | |||||
@ApiModelProperty("复评打分时间") | |||||
private LocalDateTime reAppraisalScoreTime; | |||||
@ApiModelProperty("核查总分") | |||||
private BigDecimal verifyTotalScore; | |||||
@ApiModelProperty("核查打分时间") | |||||
private LocalDateTime verifyScoreTime; | |||||
@ApiModelProperty("项目是否需要整改") | |||||
private Boolean isRectify; | |||||
@ApiModelProperty("整改意见") | |||||
private String rectifyOpinion; | |||||
@ApiModelProperty("打分时间") | |||||
private LocalDateTime scoreTime; | |||||
} | } |
@@ -10,6 +10,7 @@ import lombok.Data; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | |||||
/** | /** | ||||
* @Classname PerformanceIndicatorTemplate | * @Classname PerformanceIndicatorTemplate | ||||
@@ -53,4 +54,7 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { | |||||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | ||||
private Integer amountRange; | private Integer amountRange; | ||||
@ApiModelProperty("项目标签信息") | |||||
private String projectTagIds; | |||||
} | } |
@@ -1,7 +1,6 @@ | |||||
package com.ningdatech.pmapi.performance.model.vo; | package com.ningdatech.pmapi.performance.model.vo; | ||||
import com.alibaba.fastjson.annotation.JSONField; | import com.alibaba.fastjson.annotation.JSONField; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -9,7 +8,6 @@ import lombok.Data; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | |||||
/** | /** | ||||
* @Classname PerformanceAppraisalProjectVO | * @Classname PerformanceAppraisalProjectVO | ||||
@@ -24,7 +22,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@ApiModelProperty("项目ID") | @ApiModelProperty("项目ID") | ||||
private Long id; | |||||
private Long projectId; | |||||
@ApiModelProperty("项目编码") | @ApiModelProperty("项目编码") | ||||
private String projectCode; | private String projectCode; | ||||
@@ -60,11 +58,33 @@ public class PerformanceAppraisalProjectVO implements Serializable { | |||||
private LocalDateTime selfAppraisalEnd; | private LocalDateTime selfAppraisalEnd; | ||||
@ApiModelProperty("自评总分") | @ApiModelProperty("自评总分") | ||||
private BigDecimal selfAppraisalScore; | |||||
private BigDecimal selfAppraisalTotalScore; | |||||
@ApiModelProperty("打分时间") | |||||
@ApiModelProperty("自评打分时间") | |||||
@JSONField(format = "yyyy-MM-dd HH:mm") | @JSONField(format = "yyyy-MM-dd HH:mm") | ||||
private LocalDateTime scoreTime; | |||||
private LocalDateTime selfAppraisalScoreTime; | |||||
@ApiModelProperty("复评总分") | |||||
private BigDecimal reAppraisalTotalScore; | |||||
@ApiModelProperty("复评打分时间") | |||||
@JSONField(format = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime reAppraisalScoreTime; | |||||
@ApiModelProperty("核查总分") | |||||
private BigDecimal verifyTotalScore; | |||||
@ApiModelProperty("核查打分时间") | |||||
@JSONField(format = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime verifyScoreTime; | |||||
@ApiModelProperty("项目是否需要整改") | |||||
private Boolean isRectify; | |||||
@ApiModelProperty("整改意见") | |||||
private String rectifyOpinion; | |||||
@ApiModelProperty("评价计划ID") | |||||
private Long appraisalId; | |||||
} | } |
@@ -1,5 +1,6 @@ | |||||
package com.ningdatech.pmapi.performance.model.vo; | package com.ningdatech.pmapi.performance.model.vo; | ||||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -7,6 +8,7 @@ import lombok.Data; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
/** | /** | ||||
* @Classname PerformanceIndicatorProjectTemplateDetail | * @Classname PerformanceIndicatorProjectTemplateDetail | ||||
@@ -20,6 +22,9 @@ public class ProjectTemplateDetailVO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@ApiModelProperty("id") | |||||
private Long id; | |||||
@ApiModelProperty("关联模板ID") | @ApiModelProperty("关联模板ID") | ||||
private Long templateId; | private Long templateId; | ||||
@@ -52,4 +57,14 @@ public class ProjectTemplateDetailVO implements Serializable { | |||||
@ApiModelProperty("子指标") | @ApiModelProperty("子指标") | ||||
private List<ProjectTemplateDetailVO> children; | private List<ProjectTemplateDetailVO> children; | ||||
@ApiModelProperty("自评分数信息") | |||||
private List<PerformanceAppraisalScoreInfo> selfAppraisalScoreInfo; | |||||
@ApiModelProperty("复评分数信息") | |||||
private Map<String, List<PerformanceAppraisalScoreInfo>> reAppraisalScoreInfo; | |||||
@ApiModelProperty("核查分数信息") | |||||
private Map<String, List<PerformanceAppraisalScoreInfo>> verifyScoreInfo; | |||||
} | } |