|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.dao.*;
|
|
|
import com.ims.eval.entity.*;
|
|
|
+import com.ims.eval.entity.dto.response.NeatDTo;
|
|
|
import com.ims.eval.expression.*;
|
|
|
import com.ims.eval.service.IEvaluationScoreCountService;
|
|
|
import com.ims.eval.util.MathCalculatorUtil;
|
|
@@ -12,10 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -67,9 +65,11 @@ public class ScoreCalculationSchedule {
|
|
|
}
|
|
|
for (OrganizationEvaluation organizationEvaluation : organizationEvaluations){
|
|
|
//加载该考评记录下的考评指标明细数据
|
|
|
+ List<String> list = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
+
|
|
|
QueryWrapper<OrganizationEvaluationInfo> qw = new QueryWrapper<>();
|
|
|
if (StringUtils.isNotEmpty(organizationEvaluation.getOrganizationEvaluationRuleId())) {
|
|
|
- qw.lambda().in(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId,organizationEvaluation.getOrganizationEvaluationRuleId());
|
|
|
+ qw.lambda().in(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId,list);
|
|
|
}
|
|
|
List<OrganizationEvaluationInfo> organizationEvaluationInfos= organizationEvaluationInfoMapper.selectList(qw);
|
|
|
if (organizationEvaluationInfos.size() > 0){
|
|
@@ -119,30 +119,60 @@ public class ScoreCalculationSchedule {
|
|
|
String score = null;
|
|
|
//判断可用量化的进行变量替换
|
|
|
if ("是".equals(list.get(0).getIsQuantified())){
|
|
|
- Map<String, Double> doubleMap = list.stream().collect(Collectors.toMap(OrganizationEvaluationInfo::getOptionCode, OrganizationEvaluationInfo::getQuantifiedValue));
|
|
|
+
|
|
|
+ //删除考评指标明细中的包含max或者min的指标项
|
|
|
+ Iterator<OrganizationEvaluationInfo> iterator = list.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ OrganizationEvaluationInfo next = iterator.next();
|
|
|
+ if (next.getOptionCode().contains("MAX")) {
|
|
|
+ iterator.remove();
|
|
|
+ }else if (next.getOptionCode().contains("MIN")){
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<NeatDTo> dToList = new ArrayList<>();
|
|
|
+ list.stream().forEach(r ->{
|
|
|
+ NeatDTo neatDTo = new NeatDTo();
|
|
|
+ neatDTo.setCode(r.getOptionCode());
|
|
|
+ neatDTo.setValue(r.getQuantifiedValue());
|
|
|
+ neatDTo.setLength(r.getOptionCode().length());
|
|
|
+ dToList.add(neatDTo);
|
|
|
+ });
|
|
|
//添加计算指标项的code和值 例如:差值最大值和最小值
|
|
|
OrganizationEvaluation organizationEvaluation = organizationEvaluationMapper.selectById(list.get(0).getOrganizationEvaluationId());
|
|
|
List<CalculateIndicatorItemInfo> calculateIndicatorItemInfos = calculateIndicatorItemInfoMapper.selectList(organizationEvaluation.getOrganizationType(),organizationEvaluation.getCheckCycle(),organizationEvaluation.getYear(),organizationEvaluation.getMonth());
|
|
|
calculateIndicatorItemInfos.stream().forEach(r ->{
|
|
|
- doubleMap.put(r.getOptionCode(),r.getQuantifiedValue());
|
|
|
+ NeatDTo neatDTo = new NeatDTo();
|
|
|
+ neatDTo.setCode(r.getOptionCode());
|
|
|
+ neatDTo.setValue(r.getQuantifiedValue());
|
|
|
+ neatDTo.setLength(r.getOptionCode().length());
|
|
|
+ dToList.add(neatDTo);
|
|
|
});
|
|
|
+ //处理code长度从大到小排序
|
|
|
+ List<NeatDTo> collect = dToList.stream().sorted(Comparator.comparing(NeatDTo::getLength).reversed()).collect(Collectors.toList());
|
|
|
+
|
|
|
//查询得分规则公式
|
|
|
QueryWrapper<IntervalScoringTable> qw = new QueryWrapper<>();
|
|
|
if (StringUtils.isNotEmpty(evaluationScoringRule.getId())) {
|
|
|
qw.lambda().eq(IntervalScoringTable::getRuleId,evaluationScoringRule.getId());
|
|
|
}
|
|
|
List<IntervalScoringTable> intervalScoringTables = intervalScoringTableMapper.selectList(qw);
|
|
|
- for (Map.Entry<String, Double> entry : doubleMap.entrySet()){
|
|
|
- intervalScoringTables.stream().forEach(r ->{
|
|
|
- r.setRange(r.getRange().replaceAll(entry.getKey(), entry.getValue() + ""));
|
|
|
- r.setRegularExpression(r.getRegularExpression().replaceAll(entry.getKey(),entry.getValue() + ""));
|
|
|
- });
|
|
|
+ for (NeatDTo neatDTo : collect){
|
|
|
+ for (IntervalScoringTable r : intervalScoringTables){
|
|
|
+ r.setRange(r.getRange().replaceAll(neatDTo.getCode(), neatDTo.getValue() + ""));
|
|
|
+ r.setRegularExpression(r.getRegularExpression().replaceAll(neatDTo.getCode(),neatDTo.getValue() + ""));
|
|
|
+ }
|
|
|
}
|
|
|
//针对只有一种区间评分
|
|
|
if (intervalScoringTables.size() == 1){
|
|
|
String regularExpression = intervalScoringTables.get(0).getRegularExpression();
|
|
|
+ log.info(evaluationScoringRule.getScoreRuleName()+ "公式为" + regularExpression);
|
|
|
//公式计算得分
|
|
|
score = MathCalculatorUtil.handle(regularExpression.trim());
|
|
|
+ if (!StringUtils.isNotEmpty(score)){
|
|
|
+ score = "0";
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
//针对多区间评分
|