@@ -24,6 +24,8 @@ public interface RegionConst { | |||
* 丽水行政区划编码 | |||
*/ | |||
String RC_LS = "331100"; | |||
//遂昌县 | |||
String RC_SC = "331123"; | |||
/** | |||
* 中国行政区划编码 | |||
@@ -1,6 +1,7 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.IndicatorTemplateManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
@@ -32,8 +33,15 @@ public class PerformanceIndicatorTemplateController { | |||
return indicatorTemplateManage.projectList(req); | |||
} | |||
@GetMapping("/project/detail/{id}") | |||
@ApiOperation("项目指标配置模板详情") | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(@PathVariable Long id) { | |||
return indicatorTemplateManage.projectDetail(id); | |||
} | |||
@PostMapping("/project/save") | |||
@ApiOperation("项目指标配置模板保存") | |||
@WebLog("项目指标配置模板保存") | |||
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { | |||
return indicatorTemplateManage.projectTemplateSave(dto); | |||
} | |||
@@ -0,0 +1,44 @@ | |||
package com.ningdatech.pmapi.performance.enumration; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Objects; | |||
/** | |||
* <p> | |||
* PerformanceTemplateTypeEnum | |||
* </p> | |||
* | |||
* @author Poffy | |||
* @since 16:56 2023/6/27 | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public enum PerformanceTemplateTypeEnum { | |||
/** | |||
* 模板类型 | |||
*/ | |||
STAGE(0, "阶段"), | |||
FIRST_INDEX(1, "第一指标"), | |||
SECOND_INDEX(2, "第二指标"), | |||
THIRD_INDEX(3, "第三指标"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDesc(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (PerformanceTemplateTypeEnum t : PerformanceTemplateTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -1,16 +1,23 @@ | |||
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.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; | |||
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
@@ -20,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
@@ -36,6 +44,8 @@ import java.util.stream.Collectors; | |||
public class IndicatorTemplateManage { | |||
private final IPerformanceIndicatorProjectTemplateService indicatorTemplateService; | |||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||
/** | |||
* 模板列表 | |||
* @param req | |||
@@ -60,6 +70,26 @@ public class IndicatorTemplateManage { | |||
} | |||
/** | |||
* 查询项目模板详情 | |||
* @param id | |||
* @return | |||
*/ | |||
public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { | |||
PerformanceIndicatorProjectTemplate template = indicatorTemplateService.getById(id); | |||
if(Objects.isNull(template)){ | |||
return null; | |||
} | |||
PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template, | |||
PerformanceIndicatorProjectTemplateVO.class); | |||
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); | |||
if(CollUtil.isNotEmpty(templateDetails)){ | |||
vo.setTemplateDetails(buildTemplateDetail(templateDetails)); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* 项目指标 模板保存 | |||
* @param dto | |||
* @return | |||
@@ -67,7 +97,6 @@ public class IndicatorTemplateManage { | |||
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("该模板不存在!"); | |||
@@ -77,14 +106,100 @@ public class IndicatorTemplateManage { | |||
template.setCreateOn(LocalDateTime.now()); | |||
template.setCreateBy(user.getUsername()); | |||
} | |||
template.setUpdateOn(LocalDateTime.now()); | |||
template.setUpdateBy(user.getUsername()); | |||
if(indicatorTemplateService.saveOrUpdate(template)){ | |||
//保存 模板的详情 | |||
return "保存成功"; | |||
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ | |||
//先删除 | |||
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); | |||
analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); | |||
} | |||
return "保存成功"; | |||
} | |||
throw new BizException("保存失败!"); | |||
} | |||
/** | |||
* 解析 项目考核指标 | |||
* @param templateDetails | |||
* @return | |||
*/ | |||
private void analysisTemplateDetails( | |||
List<ProjectTemplateDetailDTO> templateDetails,Long templateId) { | |||
List<PerformanceIndicatorProjectTemplateDetail> details = Lists.newArrayList(); | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
analysisTemplateDetailsInner(templateDetails,templateId,null); | |||
} | |||
private void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails, | |||
Long templateId,Long parentId) { | |||
if(CollUtil.isEmpty(templateDetails)){ | |||
return; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
for(ProjectTemplateDetailDTO detail : templateDetails){ | |||
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); | |||
templateDetail.setCreateBy(user.getUsername()); | |||
templateDetail.setCreateOn(LocalDateTime.now()); | |||
templateDetail.setUpdateBy(user.getUsername()); | |||
templateDetail.setUpdateOn(LocalDateTime.now()); | |||
templateDetail.setTemplateId(templateId); | |||
templateDetail.setParentId(parentId); | |||
indicatorProjectTemplateDetailService.save(templateDetail); | |||
if(CollUtil.isNotEmpty(detail.getChildren())){ | |||
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); | |||
} | |||
} | |||
} | |||
/** | |||
* 装配 模板详情 | |||
* @param templateDetails | |||
* @return | |||
*/ | |||
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) { | |||
List<ProjectTemplateDetailVO> res = Lists.newArrayList(); | |||
//第一层是 一级的 | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){ | |||
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ | |||
ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { | |||
if (Objects.nonNull(templateDetailSecond.getParentId()) && | |||
templateDetailSecond.getParentId().equals(templateDetail.getId())) { | |||
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { | |||
if (Objects.nonNull(templateDetailThird.getParentId()) && | |||
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { | |||
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); | |||
List<ProjectTemplateDetailVO> fourList = Lists.newArrayList(); | |||
for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { | |||
if (Objects.nonNull(templateDetailFour.getParentId()) && | |||
templateDetailFour.getParentId().equals(templateDetailThird.getId())) { | |||
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); | |||
fourList.add(detailFourVo); | |||
} | |||
} | |||
detailThirdVo.setChildren(fourList); | |||
thirdList.add(detailThirdVo); | |||
} | |||
} | |||
detailSecondVo.setChildren(thirdList); | |||
secondList.add(detailSecondVo); | |||
} | |||
} | |||
detailVo.setChildren(secondList); | |||
res.add(detailVo); | |||
} | |||
} | |||
return res; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper<PerformanceIndicatorProjectTemplateDetail> { | |||
} |
@@ -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.PerformanceIndicatorProjectTemplateDetailMapper"> | |||
</mapper> |
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceIndicatorProjectTemplateSaveDTO | |||
@@ -30,9 +31,12 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型 ") | |||
private Integer projectType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
@ApiModelProperty("绩效指标详情") | |||
private ProjectTemplateDetailDTO templateDetail; | |||
private List<ProjectTemplateDetailDTO> templateDetails; | |||
} |
@@ -9,6 +9,7 @@ import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceIndicatorProjectTemplateDetail | |||
@@ -41,5 +42,5 @@ public class ProjectTemplateDetailDTO implements Serializable { | |||
private String scoreRubric; | |||
@ApiModelProperty("子指标") | |||
private ProjectTemplateDetailDTO children; | |||
private List<ProjectTemplateDetailDTO> children; | |||
} |
@@ -41,6 +41,9 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
} |
@@ -6,9 +6,10 @@ import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceIndicatorTemplateVO | |||
* @Classname PerformanceIndicatorProjectTemplateVO | |||
* @Description 绩效评价考核项目指标模板 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
@@ -36,6 +37,12 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") | |||
private Integer amountRange; | |||
@ApiModelProperty("绩效指标详情") | |||
private List<ProjectTemplateDetailVO> templateDetails; | |||
} |
@@ -0,0 +1,42 @@ | |||
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.util.List; | |||
/** | |||
* @Classname PerformanceIndicatorProjectTemplateDetail | |||
* @Description 绩效评价考核项目指标模板 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树") | |||
public class ProjectTemplateDetailVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("关联模板ID") | |||
private Long templateId; | |||
@ApiModelProperty("指标名称") | |||
private String name; | |||
@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标") | |||
private Integer type; | |||
@ApiModelProperty("父级指标id") | |||
private Long parentId; | |||
@ApiModelProperty("分数 3级指标才有") | |||
private Integer score; | |||
@ApiModelProperty("分数细则 3级指标才有") | |||
private String scoreRubric; | |||
@ApiModelProperty("子指标") | |||
private List<ProjectTemplateDetailVO> children; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceIndicatorProjectTemplateDetailService extends IService<PerformanceIndicatorProjectTemplateDetail> { | |||
} |
@@ -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.PerformanceIndicatorProjectTemplateDetailMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 绩效评价详情 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl<PerformanceIndicatorProjectTemplateDetailMapper, PerformanceIndicatorProjectTemplateDetail> | |||
implements IPerformanceIndicatorProjectTemplateDetailService { | |||
} |
@@ -12,6 +12,7 @@ import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
@@ -191,15 +192,28 @@ public class PurchaseManage { | |||
purchaseEntity.setId(purchase.getId()); | |||
} | |||
purchaseEntity.setProjectId(projectId); | |||
purchaseService.saveOrUpdate(purchaseEntity); | |||
//进入到下一状态 | |||
stateMachineUtils.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setTransactionAmount(dto.getTransactionAmount()); | |||
project.setTransactionTime(dto.getTransactionTime()); | |||
projectService.updateById(project); | |||
if(purchaseService.saveOrUpdate(purchaseEntity)){ | |||
//如果 需要推送项目和应用管理的话 只有遂昌县才有 | |||
// String areaCode = project.getAreaCode(); | |||
// String appCode = dto.getAppCode(); | |||
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){ | |||
// try{ | |||
// | |||
// }catch (Exception e){ | |||
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage()); | |||
// } | |||
// } | |||
//进入到下一状态 | |||
stateMachineUtils.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setTransactionAmount(dto.getTransactionAmount()); | |||
project.setTransactionTime(dto.getTransactionTime()); | |||
projectService.updateById(project); | |||
return "填写成功"; | |||
} | |||
return "填写成功"; | |||
return "保存失败"; | |||
} | |||
} |
@@ -56,4 +56,6 @@ public class PurchaseSaveDTO { | |||
@ApiModelProperty("中标通知书") | |||
private String acceptanceLetter; | |||
@ApiModelProperty("应用编码") | |||
private String appCode; | |||
} |