From a99741c7e1d9c618002108c5daf3ded75fad8574 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 26 Jun 2023 15:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrgSelfAppraisalController.java | 15 +- .../PerformanceIndicatorTemplateController.java | 40 +++++ .../manage/IndicatorTemplateManage.java | 89 +++++++++++ .../performance/manage/OrgSelfAppraisalManage.java | 162 +++++++++------------ .../manage/PerformanceAppraisalPlanManage.java | 2 +- .../PerformanceIndicatorProjectTemplateMapper.java | 16 ++ .../PerformanceIndicatorProjectTemplateMapper.xml | 5 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 35 +++++ .../PerformanceIndicatorProjectTemplate.java | 46 ++++++ .../model/req/PerformanceAppraisalListReq.java | 11 +- .../model/vo/PerformanceAppraisalProjectVO.java | 3 + .../vo/PerformanceIndicatorProjectTemplateVO.java | 41 ++++++ ...PerformanceIndicatorProjectTemplateService.java | 16 ++ ...ormanceIndicatorProjectTemplateServiceImpl.java | 21 +++ .../manage/DeclaredProjectManage.java | 2 - .../utils/GenerateProjectCodeUtil.java | 38 +++++ .../projectlib/manage/ProjectCollectionManage.java | 6 +- .../model/dto/ProjectCollectionSaveDTO.java | 6 +- .../projectlib/model/entity/ProjectCollection.java | 2 +- .../projectlib/model/vo/ProjectCollectionVO.java | 2 +- 20 files changed, 451 insertions(+), 107 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java index 7b9b218..d9c16d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java @@ -3,6 +3,7 @@ package com.ningdatech.pmapi.performance.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; 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 io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -29,9 +30,15 @@ public class OrgSelfAppraisalController { return selfAppraisalManage.list(req); } - @GetMapping("/detail/{id}") - @ApiOperation("当前用户的绩效评价计划详情") - public PerformanceAppraisalVO detail(@PathVariable Long id) { - return selfAppraisalManage.detail(id); + @GetMapping("/pending-list/{planId}") + @ApiOperation("当前绩效评价待自评列表") + public PageVo pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return selfAppraisalManage.pendingList(planId,req); + } + + @GetMapping("/appraisaled-list/{planId}") + @ApiOperation("当前绩效评价已自评列表") + public PageVo appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + return selfAppraisalManage.appraisaledList(planId); } } 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 new file mode 100644 index 0000000..95161dc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.performance.controller; + +import com.ningdatech.basic.model.PageVo; +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); + } + + @PostMapping("/project/save") + @ApiOperation("项目指标配置模板保存") + public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { + return indicatorTemplateManage.projectTemplateSave(dto); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java new file mode 100644 index 0000000..7893860 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java @@ -0,0 +1,89 @@ +package com.ningdatech.pmapi.performance.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; +import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname IndicatorTemplateManage + * @Description + * @Date 2023/6/26 14:15 + * @Author PoffyZhang + */ +@Slf4j +@Component +@AllArgsConstructor +public class IndicatorTemplateManage { + private final IPerformanceIndicatorProjectTemplateService indicatorTemplateService; + + /** + * 模板列表 + * @param req + * @return + */ + public PageVo projectList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()); + indicatorTemplateService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 项目指标 模板保存 + * @param dto + * @return + */ + public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); + + if(Objects.nonNull(dto.getId())){ + PerformanceIndicatorProjectTemplate old = indicatorTemplateService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); + template.setId(old.getId()); + }else{ + template.setId(null); + template.setCreateOn(LocalDateTime.now()); + template.setCreateBy(user.getUsername()); + } + + template.setUpdateOn(LocalDateTime.now()); + template.setUpdateBy(user.getUsername()); + if(indicatorTemplateService.saveOrUpdate(template)){ + return "保存成功"; + } + + throw new BizException("保存失败!"); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java index 59c2f3f..35b1c59 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java @@ -3,30 +3,29 @@ package com.ningdatech.pmapi.performance.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.google.common.collect.Maps; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; 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.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -64,116 +63,93 @@ public class OrgSelfAppraisalManage { List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getBuildOrgCode, empPosUnitCode)); - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) - .ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart()) - .le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd()) - .orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page,wrapper); - if(0L == page.getTotal()){ + if(CollUtil.isEmpty(projectLists)){ return PageVo.empty(); } - List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getAppraisalId, paIds)); - - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); - } + .in(PerformanceAppraisalProject::getProjectId, projectIds)); + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); } - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); - } + Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,paIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + if(0L == page.getTotal()){ + return PageVo.empty(); } - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; List res = page.getRecords().stream().map(p -> { PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); - if(finalPapsGroupMap.containsKey(p.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap)); - } - if(finalPaasGroupMap.containsKey(p.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap)); - } return vo; }).collect(Collectors.toList()); return PageVo.of(res,page.getTotal()); } - public PerformanceAppraisalVO detail(Long id) { + public PageVo pendingList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceAppraisal pa = performanceAppraisalService.getById(id); - VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该计划不存在!"); - PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); - //绩效关联的项目 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, id)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); - } - } + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())); - //绩效关联的应用 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); - } + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); } + Set projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - if(finalPapsGroupMap.containsKey(vo.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectIds) + .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(); } - if(finalPaasGroupMap.containsKey(vo.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap)); + + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(plan)); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 已经自评表 + * @param planId + * @return + */ + public PageVo appraisaledList(Long planId) { + + return PageVo.empty(); + } + + /** + * 是否可以自评 + * @param plan + * @return + */ + private Boolean checkCanSelfAppraisal(PerformanceAppraisal plan) { + if(LocalDateTime.now().compareTo(plan.getSelfAppraisalStart()) > 0 && + LocalDateTime.now().compareTo(plan.getSelfAppraisalEnd()) < 0){ + return Boolean.TRUE; } - return vo; + return Boolean.FALSE; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index d6dd8f3..a47a31f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -80,7 +80,7 @@ public class PerformanceAppraisalPlanManage { public PageVo list(PerformanceAppraisalListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) + .like(StringUtils.isNotBlank(req.getPlanName()),PerformanceAppraisal::getName,req.getPlanName()) .ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart()) .le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd()) .orderByDesc(PerformanceAppraisal::getUpdateOn); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java new file mode 100644 index 0000000..5604e52 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml new file mode 100644 index 0000000..eec7ce7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.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 new file mode 100644 index 0000000..25106fb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -0,0 +1,35 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Classname PerformanceIndicatorProjectTemplateSaveDTO + * @Description 绩效评价考核模板 保存 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") +public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} 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 new file mode 100644 index 0000000..dda9e60 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -0,0 +1,46 @@ +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceIndicatorTemplate + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_indicator_project_template") +@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") +public class PerformanceIndicatorProjectTemplate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java index 064add0..5e81877 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java @@ -17,11 +17,20 @@ import java.time.LocalDateTime; public class PerformanceAppraisalListReq extends PagePo { @ApiModelProperty("计划名称") - private String name; + private String planName; @ApiModelProperty("开始时间") private String start; @ApiModelProperty("结束时间") private String end; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("模板名称") + private String templateName; + + @ApiModelProperty("区域code") + private String regionCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java index 57a3828..af24f9a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -48,4 +48,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("预算年度") private Integer projectYear; + + @ApiModelProperty("是否可自评") + private Boolean canSelfAppraisal = Boolean.FALSE; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java new file mode 100644 index 0000000..d8c61f1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceIndicatorTemplateVO + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") +public class PerformanceIndicatorProjectTemplateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java new file mode 100644 index 0000000..2c2b125 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceIndicatorProjectTemplateService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java new file mode 100644 index 0000000..551d24a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateMapper; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; +import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl + implements IPerformanceIndicatorProjectTemplateService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 26e3bf2..497dfa8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -130,8 +130,6 @@ public class DeclaredProjectManage { projectInfo.setId(null); } -// defaultDeclaredProjectManage.startProcess(projectInfo,user,ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); - String regionCode = user.getRegionCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java index b65fa87..93788b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -10,6 +10,8 @@ import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; +import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -31,6 +33,9 @@ public class GenerateProjectCodeUtil { @Autowired private IProjectService projectService; + @Autowired + private IProjectCollectionService projectCollectionService; + public String generateProjectCode(ProjectDTO project){ // 获取所属行政区划代码(6位) String areaCode = project.getAreaCode(); @@ -63,4 +68,37 @@ public class GenerateProjectCodeUtil { // 生成21位的项目编号 return areaCode + year + fixedNumber + fiscalCode + projectIdStr; } + + public String generateProjectCode(ProjectCollection project){ + // 获取所属行政区划代码(6位) + String areaCode = project.getAreaCode(); + // 获取建设年度后两位 + String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS); + // 9-12位固定 + String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; + // 获取公司的财政编码 + CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode()); + + // 从表中查出单位配置的财政编码 + if (Objects.isNull(companyFiscalCode)){ + throw new BizException("申报单位未配置财政编码!"); + } + + String fiscalCode = companyFiscalCode.getFiscalCode(); + // 获取项目编号 + String projectIdStr; + // 获取项目库当前最大项目序号 + List projectList = projectCollectionService.list(Wrappers.lambdaQuery(ProjectCollection.class).orderByDesc(ProjectCollection::getId)); + ProjectCollection maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0); + Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1; + if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ + // 超过999的项目号从1开始 1 + Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; + projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId); + }else { + projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId); + } + // 生成21位的项目编号 + return areaCode + year + fixedNumber + fiscalCode + projectIdStr; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java index e6c3cba..dd94550 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; @@ -40,6 +41,8 @@ public class ProjectCollectionManage { private final RegionCacheHelper regionCacheHelper; + private final GenerateProjectCodeUtil generateProjectCodeUtil; + /** * 项目归集 * @param req @@ -57,7 +60,7 @@ public class ProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrg, req.getBuildOrgName()) .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); //处理 行政区域 if(StringUtils.isNotBlank(req.getRegionCode())){ @@ -106,6 +109,7 @@ public class ProjectCollectionManage { VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); projectCollection.setId(dto.getId()); }else{ + projectCollection.setProjectCode(generateProjectCodeUtil.generateProjectCode(projectCollection)); projectCollection.setCreateBy(user.getUsername()); projectCollection.setCreateOn(LocalDateTime.now()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java index 73e60f5..1b89116 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -58,12 +58,12 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("项目联系人手机号码") private String contactPhone; - @ApiModelProperty("建设单位名称") - private String buildOrgName; - @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode; + @ApiModelProperty("建设单位名称") + private String buildOrg; + @ApiModelProperty("公司编码code") private String buildOrgCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java index 8167f62..1da0bcb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -59,7 +59,7 @@ public class ProjectCollection implements Serializable { private String contactPhone; @ApiModelProperty("建设单位名称") - private String buildOrgName; + private String buildOrg; @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java index e6d7eed..929cfdc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -59,7 +59,7 @@ public class ProjectCollectionVO implements Serializable { private String contactPhone; @ApiModelProperty("建设单位名称") - private String buildOrgName; + private String buildOrg; @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode;