|
@@ -1,18 +1,22 @@
|
|
package com.ims.eval.service.impl;
|
|
package com.ims.eval.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.ims.common.utils.DoubleUtils;
|
|
|
|
+import com.ims.common.utils.StringUtils;
|
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
import com.ims.eval.config.CustomException;
|
|
import com.ims.eval.config.CustomException;
|
|
-import com.ims.eval.entity.EvaluateReport;
|
|
|
|
|
|
+import com.ims.eval.entity.*;
|
|
import com.ims.eval.dao.EvaluateReportMapper;
|
|
import com.ims.eval.dao.EvaluateReportMapper;
|
|
-import com.ims.eval.entity.Indicator;
|
|
|
|
-import com.ims.eval.entity.OrganizationEvaluation;
|
|
|
|
-import com.ims.eval.service.IEvaluateReportService;
|
|
|
|
|
|
+import com.ims.eval.service.*;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
-import com.ims.eval.service.IOrganizationEvaluationRuleService;
|
|
|
|
-import com.ims.eval.service.IOrganizationEvaluationService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -32,27 +36,132 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
|
|
private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IEvaluateRuleService evaluateRuleService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IEvaluationScoreCountService evaluationScoreCountService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IEvaluateReportInfoService evaluateReportInfoService;
|
|
|
|
+
|
|
|
|
+
|
|
//考评结果报告
|
|
//考评结果报告
|
|
//按照业务类型生成
|
|
//按照业务类型生成
|
|
//业务阶综合展示
|
|
//业务阶综合展示
|
|
|
|
|
|
|
|
+ @Transactional
|
|
@Override
|
|
@Override
|
|
- public boolean generateEvaluateReport(String organizationEvaluationId) {
|
|
|
|
|
|
+ public boolean generateEvaluateReport(String organizationEvaluationId,boolean backroll) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ EvaluateReport evaluateReport = new EvaluateReport();
|
|
OrganizationEvaluation evaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
OrganizationEvaluation evaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
if (null == evaluation) {
|
|
if (null == evaluation) {
|
|
throw new CustomException("没有此靠考评");
|
|
throw new CustomException("没有此靠考评");
|
|
}
|
|
}
|
|
|
|
|
|
//获取到对应组织考评规则
|
|
//获取到对应组织考评规则
|
|
- String evaluationRuleIds = evaluation.getOrganizationEvaluationRuleId();
|
|
|
|
- if (null == evaluationRuleIds || evaluationRuleIds.length() <= 0) {
|
|
|
|
|
|
+ String evaluationRuleId = evaluation.getOrganizationEvaluationRuleId();
|
|
|
|
+ if (null == evaluationRuleId || evaluationRuleId.length() <= 0) {
|
|
throw new CustomException("组织考评id为空");
|
|
throw new CustomException("组织考评id为空");
|
|
}
|
|
}
|
|
|
|
|
|
- //
|
|
|
|
-// organizationEvaluationRuleService.listByIds();
|
|
|
|
|
|
+ //获取单位配置规则
|
|
|
|
+ List<String> evaluationRuleIds = Arrays.asList(evaluationRuleId.split(","));
|
|
|
|
+ List<OrganizationEvaluationRule> evaluationRuleList = organizationEvaluationRuleService.listByIds(evaluationRuleIds);
|
|
|
|
|
|
- return false;
|
|
|
|
|
|
+ //按业务吧板块分类
|
|
|
|
+ Map<String, List<OrganizationEvaluationRule>> binSectionmap = evaluationRuleList.stream().collect(Collectors.groupingBy(OrganizationEvaluationRule::getBinSection));
|
|
|
|
+ for(Map.Entry<String, List<OrganizationEvaluationRule>> rulemap :binSectionmap.entrySet()){
|
|
|
|
+ //各板块明细存储
|
|
|
|
+ List<EvaluateReportInfo> evaluateRuleInfoList = new ArrayList<>();
|
|
|
|
+ //遍历各单位考评规则
|
|
|
|
+ for(OrganizationEvaluationRule rule :rulemap.getValue()){
|
|
|
|
+
|
|
|
|
+ StringBuilder reportName = new StringBuilder();
|
|
|
|
+ if ("NDKP".equals(evaluation.getCheckCycle())) {
|
|
|
|
+ reportName.append("年度");
|
|
|
|
+ }
|
|
|
|
+ if ("JDKP".equals(evaluation.getCheckCycle())) {
|
|
|
|
+ reportName.append("季度");
|
|
|
|
+ }
|
|
|
|
+ if ("YDKP".equals(evaluation.getCheckCycle())) {
|
|
|
|
+ reportName.append("月度");
|
|
|
|
+ }
|
|
|
|
+ reportName.append(CacheContext.bsnIdObject.get(rule.getBinSection()).getSectionName());
|
|
|
|
+ if ("DWKP".equals(evaluation.getOrganizationType())) {
|
|
|
|
+ reportName.append("单位");
|
|
|
|
+ }
|
|
|
|
+ if ("BNMKP".equals(evaluation.getOrganizationType())) {
|
|
|
|
+ reportName.append("部门");
|
|
|
|
+ }
|
|
|
|
+ reportName.append("综合考核评分汇总表");
|
|
|
|
+
|
|
|
|
+ evaluateReport.setEvaluateReportName(reportName.toString());
|
|
|
|
+ evaluateReport.setOrganizationEvaluationId(evaluation.getId());
|
|
|
|
+ evaluateReport.setBinSection(rulemap.getKey());
|
|
|
|
+ evaluateReport.setOrganizationType(evaluation.getOrganizationType());
|
|
|
|
+ evaluateReport.setCheckCycle(evaluation.getCheckCycle());
|
|
|
|
+ evaluateReport.setYear(evaluation.getYear());
|
|
|
|
+ evaluateReport.setMonth(evaluation.getMonth());
|
|
|
|
+ evaluateReport.setCreateTime(new Date());
|
|
|
|
+ evaluateReport.setCreateBy("");//人员
|
|
|
|
+
|
|
|
|
+ List<EvaluateReport> oriReports = list(evaluation.getId(),rulemap.getKey());
|
|
|
|
+ if(oriReports.size()>0 && !backroll){
|
|
|
|
+ throw new CustomException("综合考核评分汇总已生成");
|
|
|
|
+ } else {
|
|
|
|
+ for (EvaluateReport r : oriReports) {
|
|
|
|
+ boolean b = super.removeById(r.getId());
|
|
|
|
+ if (!b) {
|
|
|
|
+ throw new CustomException("综合考核评分汇总重算失败");
|
|
|
|
+ }
|
|
|
|
+ List<EvaluateReportInfo> infolist = evaluateReportInfoService.listByReportId(r.getId());
|
|
|
|
+ if (null != infolist && infolist.size() > 0) {
|
|
|
|
+ List<String> infolistIds = infolist.stream().map(EvaluateReportInfo::getId).collect(Collectors.toList());
|
|
|
|
+ b = evaluateReportInfoService.removeByIds(infolistIds);
|
|
|
|
+ if (!b) {
|
|
|
|
+ throw new CustomException("综合考核评分汇总重算失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ boolean b = super.saveOrUpdate(evaluateReport);
|
|
|
|
+
|
|
|
|
+ if(!b){
|
|
|
|
+ throw new CustomException("综合考核评分汇总表存储失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取考评股则
|
|
|
|
+ List<String> evaluateRuleIdList = Arrays.asList(rule.getEvaluateRuleId().split(","));
|
|
|
|
+ rule.getId();//单位考评规则
|
|
|
|
+ List<EvaluateRule> evaluateRuleList = evaluateRuleService.listByIds(evaluateRuleIdList);
|
|
|
|
+ for(EvaluateRule rule1 : evaluateRuleList){
|
|
|
|
+ List<EvaluationScoreCount> scoreCount = evaluationScoreCountService.getListByEvaluationRuleId(organizationEvaluationId,rule.getId(),rule1.getBinStage());
|
|
|
|
+ double scor = scoreCount.stream().mapToDouble(EvaluationScoreCount::getScore).sum();
|
|
|
|
+ EvaluateReportInfo reportInfo = new EvaluateReportInfo();
|
|
|
|
+ reportInfo.setEvaluateReportId(evaluateReport.getId());
|
|
|
|
+ reportInfo.setOrganizationId(rule.getOrganizationId());
|
|
|
|
+ reportInfo.setOrganizationName(rule.getOrganizationName());
|
|
|
|
+ reportInfo.setBinStage(rule1.getBinStage());
|
|
|
|
+ reportInfo.setScore(DoubleUtils.keepPrecision(scor,2));
|
|
|
|
+ reportInfo.setDiscountScore(1.0);
|
|
|
|
+ evaluateRuleInfoList.add(reportInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(EvaluateReportInfo info:evaluateRuleInfoList){
|
|
|
|
+ boolean b = evaluateReportInfoService.saveOrUpdate(info);
|
|
|
|
+ if(!b){
|
|
|
|
+ throw new CustomException("综合考核评分汇总明细存储失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -70,4 +179,17 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
|
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<EvaluateReport> list(String organizationEvaluationId, String binSection) {
|
|
|
|
+ QueryWrapper<EvaluateReport> qw = new QueryWrapper<>();
|
|
|
|
+ if (StringUtils.isNotEmpty(organizationEvaluationId)) {
|
|
|
|
+ qw.lambda().eq(EvaluateReport::getOrganizationEvaluationId,organizationEvaluationId);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(binSection)) {
|
|
|
|
+ qw.lambda().eq(EvaluateReport::getBinSection,binSection);
|
|
|
|
+ }
|
|
|
|
+ List<EvaluateReport> list = baseMapper.selectList(qw);
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
}
|
|
}
|