|
@@ -1,6 +1,5 @@
|
|
|
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.extension.plugins.pagination.Page;
|
|
|
import com.ims.common.utils.DoubleUtils;
|
|
@@ -10,7 +9,6 @@ import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.entity.*;
|
|
|
import com.ims.eval.dao.EvaluateReportMapper;
|
|
|
import com.ims.eval.entity.dto.response.EvaluateReportInfoResDTO;
|
|
|
-import com.ims.eval.entity.dto.response.EvaluateRuleInfoResDTO;
|
|
|
import com.ims.eval.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -203,7 +202,9 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
//各板块明细存储
|
|
|
List<EvaluateReportInfo> evaluateRuleInfoList = new ArrayList<>();
|
|
|
|
|
|
-
|
|
|
+ //首页数据
|
|
|
+ List<EvaluationPortal> portalList = new ArrayList<>();
|
|
|
+ List<EvaluationPortalAttach> portalAttachList = new ArrayList<>();
|
|
|
|
|
|
for (OrganizationEvaluationRule rule : ruleList) {
|
|
|
|
|
@@ -249,6 +250,10 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
Double totalProfit = 0.00;//累加收入
|
|
|
Double spMultiply = 0.00;//收入
|
|
|
Double scjyScore = 0.0;//分数
|
|
|
+
|
|
|
+ String heighStandard = "";//高于基准分指标
|
|
|
+ String lowStandard ="";//低于基准分指标
|
|
|
+
|
|
|
if (null != brands && brands.size() > 0) {
|
|
|
MultipleBrand mb = brands.get(0);
|
|
|
//累加收入
|
|
@@ -256,6 +261,14 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
//累加收入和分数的积
|
|
|
|
|
|
List<EvaluationScoreCount> scoreCount1 = evaluationScoreCountService.getEvaluationScoreCountList(organizationEvaluationId, rule.getId(), null, Arrays.asList("SCJY".split(",")),bi.getId());
|
|
|
+
|
|
|
+ heighStandard = scoreCount1.stream().filter(s->s.getStandard().equals("1")).map(EvaluationScoreCount::getRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+ lowStandard = scoreCount1.stream().filter(s->s.getStandard().equals("-1")).map(EvaluationScoreCount::getRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //等分
|
|
|
double score1 = scoreCount1.stream().mapToDouble(EvaluationScoreCount::getScore).sum();
|
|
|
spMultiply = spMultiply + (mb.getProfit() * score1);
|
|
|
|
|
@@ -273,6 +286,27 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ //首页季度考评排行数据对象
|
|
|
+ EvaluationPortal portal = new EvaluationPortal();
|
|
|
+ portal.setId(StringUtils.getUUID());
|
|
|
+ portal.setBinSection(bi.getSectionCode());
|
|
|
+ portal.setCompany(rule.getOrganizationShortName());
|
|
|
+ portal.setGrade("0");
|
|
|
+ portal.setBaseScore("NDKP".equals(rule.getEvaluationCycle()) ?150:100);
|
|
|
+ portal.setYear(evaluation.getYear());
|
|
|
+ portal.setSeason(evaluation.getMonth());//季度和月份用同一个字段;不同维度存储数据
|
|
|
+ portal.setMemo1(rule.getOrganizationId());//组织编码
|
|
|
+ portal.setCreateTime(new Date());
|
|
|
+
|
|
|
+
|
|
|
+ // 首页季度考评排行悬浮信息数据对象
|
|
|
+ EvaluationPortalAttach portalAttach = new EvaluationPortalAttach();
|
|
|
+ portalAttach.setId(StringUtils.getUUID());
|
|
|
+ portalAttach.setPortalId(portal.getId());
|
|
|
+
|
|
|
+
|
|
|
+ //报告详情数据对象
|
|
|
EvaluateReportInfo reportInfo = new EvaluateReportInfo();
|
|
|
reportInfo.setEvaluateReportId(evaluateReport.getId());
|
|
|
reportInfo.setOrganizationId(rule.getOrganizationId());
|
|
@@ -280,11 +314,19 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
|
|
|
//生产经营得分
|
|
|
if(scjyScore>0){
|
|
|
- reportInfo.setScjyScore(DoubleUtils.keepPrecision(scjyScore, 2));
|
|
|
+ reportInfo.setScjyScore(DoubleUtils.keepPrecision(scjyScore, 2));//保存到考评报告
|
|
|
+ portal.setScore(DoubleUtils.keepPrecision(scjyScore, 2));//保存到首页排行
|
|
|
}else {
|
|
|
+ //保存到考评报告
|
|
|
List<EvaluationScoreCount> scjyScoreCount = evaluationScoreCountService.getEvaluationScoreCountList(organizationEvaluationId, rule.getId(), null, Arrays.asList("SCJY".split(",")),bi.getId());
|
|
|
scjyScore = scjyScoreCount.stream().mapToDouble(EvaluationScoreCount::getScore).sum();
|
|
|
reportInfo.setScjyScore(DoubleUtils.keepPrecision(scjyScore, 2));
|
|
|
+
|
|
|
+ //基准风
|
|
|
+ heighStandard = scjyScoreCount.stream().filter(s->s.getStandard().equals("1")).map(EvaluationScoreCount::getRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+ lowStandard = scjyScoreCount.stream().filter(s->s.getStandard().equals("-1")).map(EvaluationScoreCount::getRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+ portal.setScore(DoubleUtils.keepPrecision(scjyScore, 2));//保存到首页排行
|
|
|
}
|
|
|
|
|
|
//前期得分
|
|
@@ -299,6 +341,71 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
|
|
|
|
|
|
List<EvaluationScoreCount> addSubScoreCount = evaluationScoreCountService.getEvaluationScoreCountList(organizationEvaluationId, rule.getId(), null, Arrays.asList("ZDZX,GLSX".split(",")),"");
|
|
|
+
|
|
|
+ //重点专项
|
|
|
+ List<EvaluationScoreCount> zdzxScoreCount = addSubScoreCount.stream().filter(a->a.getBinStage().equals(CacheContext.bseCodeObject.get("ZDZX").getId())).collect(Collectors.toList());
|
|
|
+ //重点专项-加分
|
|
|
+ Double zdzxJfScore = zdzxScoreCount.stream().mapToDouble(EvaluationScoreCount::getJfScore).sum();
|
|
|
+ String zdzxJfRemark = zdzxScoreCount.stream().map(EvaluationScoreCount::getJfRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+ //重点专项-减分
|
|
|
+ Double zdzxkfScore = zdzxScoreCount.stream().mapToDouble(EvaluationScoreCount::getJfScore).sum();
|
|
|
+ String zdzxKfRemark = zdzxScoreCount.stream().map(EvaluationScoreCount::getKfRemark).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+
|
|
|
+ //管理事项
|
|
|
+ List<EvaluationScoreCount> glsxScoreCount = addSubScoreCount.stream().filter(a -> a.getBinStage().equals(CacheContext.bseCodeObject.get("GLSX").getId())).collect(Collectors.toList());
|
|
|
+ //管理事项-加分
|
|
|
+ Double glsxjfScore = glsxScoreCount.stream().mapToDouble(EvaluationScoreCount::getJfScore).sum();
|
|
|
+ String glsxJfRemark = glsxScoreCount.stream().map(EvaluationScoreCount::getJfRemark).filter(Objects::nonNull).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+ //管理事项-减分
|
|
|
+ Double glsxkfScore = glsxScoreCount.stream().mapToDouble(EvaluationScoreCount::getKfScore).sum();
|
|
|
+ String glsxKfRemark = glsxScoreCount.stream().map(EvaluationScoreCount::getKfRemark).filter(Objects::nonNull).collect(Collectors.joining(System.lineSeparator()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //重点专项-加分事项
|
|
|
+ if(zdzxJfScore>0){
|
|
|
+ portal.setMatterHeigh(1);
|
|
|
+ portalAttach.setMatterHeighNote(zdzxJfRemark);
|
|
|
+ }
|
|
|
+ //重点专项-扣分事项
|
|
|
+ if(zdzxkfScore<0){
|
|
|
+ portal.setMatterLow(-1);
|
|
|
+ portalAttach.setMatterHeighNote(zdzxKfRemark);
|
|
|
+ }
|
|
|
+
|
|
|
+ //管理事项-加分事项
|
|
|
+ if(glsxjfScore>0){
|
|
|
+ portal.setManageHeigh(1);
|
|
|
+ portalAttach.setManageHeightNote(glsxJfRemark);
|
|
|
+ }
|
|
|
+ //管理事项-扣分事项
|
|
|
+ if(glsxkfScore<0){
|
|
|
+ portal.setManageLow(-1);
|
|
|
+ portalAttach.setManageLowNote(glsxKfRemark);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //指标-高于基准分
|
|
|
+ if(StringUtils.isNotEmpty(heighStandard)){
|
|
|
+ portal.setStandardHeigh(1);
|
|
|
+ portalAttach.setStandardHeighNote(heighStandard);
|
|
|
+ }
|
|
|
+
|
|
|
+ //指标-低于基准分 lowStandard
|
|
|
+ if(StringUtils.isNotEmpty(lowStandard)){
|
|
|
+ portal.setStandardLow(-1);
|
|
|
+ portalAttach.setStandardLowNote(lowStandard);
|
|
|
+ }
|
|
|
+
|
|
|
+ //只有季度考评生成该记录
|
|
|
+ if("JDKP".equals(rule.getEvaluationCycle())){
|
|
|
+ portalList.add(portal);
|
|
|
+ portalAttachList.add(portalAttach);
|
|
|
+ }
|
|
|
+
|
|
|
Double addSubScore = addSubScoreCount.stream().mapToDouble(EvaluationScoreCount::getScore).sum();
|
|
|
//加分项
|
|
|
double addScore = addSubScoreCount.stream().filter(a->a.getScore()>0).collect(Collectors.toList()).stream().mapToDouble(EvaluationScoreCount::getScore).sum();
|
|
@@ -354,6 +461,21 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
|
|
|
throw new CustomException("综合考核评分汇总明细存储失败");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(null !=portalList && portalList.size()>0){
|
|
|
+
|
|
|
+ Map<String, EvaluationPortalAttach> portalAttachMap = portalAttachList.stream()
|
|
|
+ .collect(Collectors.toMap(EvaluationPortalAttach::getPortalId, Function.identity()));
|
|
|
+ for (EvaluationPortal po : portalList) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ evaluationPortalService.saveSeasonPerformanceRanking(po,portalAttachMap.get(po.getId()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return true;
|
|
|
}
|