@@ -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<PerformanceAppraisalProjectVO> pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { | |||
return selfAppraisalManage.pendingList(planId,req); | |||
} | |||
@GetMapping("/appraisaled-list/{planId}") | |||
@ApiOperation("当前绩效评价已自评列表") | |||
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { | |||
return selfAppraisalManage.appraisaledList(planId); | |||
} | |||
} |
@@ -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<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
return indicatorTemplateManage.projectList(req); | |||
} | |||
@PostMapping("/project/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorTemplateManage.projectTemplateSave(dto); | |||
} | |||
} |
@@ -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<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) { | |||
Page<PerformanceIndicatorProjectTemplate> page = req.page(); | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> 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<PerformanceIndicatorProjectTemplateVO> 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("保存失败!"); | |||
} | |||
} |
@@ -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<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getBuildOrgCode, empPosUnitCode)); | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> 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<Long> paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); | |||
List<Long> projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.in(PerformanceAppraisalProject::getAppraisalId, paIds)); | |||
Map<String,Project> projectMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paps)){ | |||
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); | |||
List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); | |||
List<Project> 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<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.in(PerformanceAppraisalApplication::getAppraisalId, paIds)); | |||
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paas)){ | |||
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); | |||
List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); | |||
List<ProjectApplication> 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<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.in(PerformanceAppraisal::getId,paIds) | |||
.orderByDesc(PerformanceAppraisal::getUpdateOn); | |||
performanceAppraisalService.page(page,wrapper); | |||
if(0L == page.getTotal()){ | |||
return PageVo.empty(); | |||
} | |||
Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap; | |||
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap; | |||
Map<String,Project> finalProjectMap = projectMap; | |||
Map<Long,ProjectApplication> finalApplicationMap = applicationMap; | |||
List<PerformanceAppraisalVO> 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<PerformanceAppraisalProjectVO> 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<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, id)); | |||
Map<String,Project> projectMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paps)){ | |||
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); | |||
List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); | |||
List<Project> 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<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.eq(PerformanceAppraisalApplication::getAppraisalId, id)); | |||
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paas)){ | |||
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); | |||
List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); | |||
List<ProjectApplication> 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<String> projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap; | |||
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap; | |||
Map<String,Project> finalProjectMap = projectMap; | |||
Map<Long,ProjectApplication> finalApplicationMap = applicationMap; | |||
if(finalPapsGroupMap.containsKey(vo.getId())){ | |||
vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); | |||
Page<Project> page = req.page(); | |||
LambdaQueryWrapper<Project> 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<PerformanceAppraisalProjectVO> 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<PerformanceAppraisalProjectVO> 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; | |||
} | |||
} |
@@ -80,7 +80,7 @@ public class PerformanceAppraisalPlanManage { | |||
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) { | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> 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); | |||
@@ -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; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper<PerformanceIndicatorProjectTemplate> { | |||
} |
@@ -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.PerformanceIndicatorProjectTemplateMapper"> | |||
</mapper> |
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -48,4 +48,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("是否可自评") | |||
private Boolean canSelfAppraisal = Boolean.FALSE; | |||
} |
@@ -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; | |||
} |
@@ -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; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceIndicatorProjectTemplateService extends IService<PerformanceIndicatorProjectTemplate> { | |||
} |
@@ -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; | |||
/** | |||
* <p> | |||
* 绩效评价 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl<PerformanceIndicatorProjectTemplateMapper, PerformanceIndicatorProjectTemplate> | |||
implements IPerformanceIndicatorProjectTemplateService { | |||
} |
@@ -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) | |||
@@ -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<ProjectCollection> 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; | |||
} | |||
} |
@@ -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<ProjectCollection> 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()); | |||
} | |||
@@ -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; | |||
@@ -59,7 +59,7 @@ public class ProjectCollection implements Serializable { | |||
private String contactPhone; | |||
@ApiModelProperty("建设单位名称") | |||
private String buildOrgName; | |||
private String buildOrg; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@@ -59,7 +59,7 @@ public class ProjectCollectionVO implements Serializable { | |||
private String contactPhone; | |||
@ApiModelProperty("建设单位名称") | |||
private String buildOrgName; | |||
private String buildOrg; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||