|
@@ -50,10 +50,7 @@ public class ScoreCalculationSchedule {
|
|
|
@Autowired
|
|
|
private CalculateIndicatorItemInfoMapper calculateIndicatorItemInfoMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IndicatorDictionaryMapper indicatorDictionaryMapper;
|
|
|
|
|
|
- /*@Scheduled(cron = "* 10 11 ? * 3")*/
|
|
|
public boolean doTask(String id){
|
|
|
|
|
|
boolean save = true;
|
|
@@ -104,18 +101,10 @@ public class ScoreCalculationSchedule {
|
|
|
//新建链表用来存储各个子指标得分
|
|
|
List<Double> strings = new ArrayList<>();
|
|
|
//对子指标进行分组
|
|
|
- List<IndicatorDictionary> indicatorDictionaryList = indicatorDictionaryMapper.selectByIndicatorId(indicator.getId());
|
|
|
- Map<String, List<IndicatorDictionary>> map = indicatorDictionaryList.stream().collect(Collectors.groupingBy(IndicatorDictionary::getChildCode));
|
|
|
- for (Map.Entry<String, List<IndicatorDictionary>> stringListEntry : map.entrySet()){
|
|
|
- stringListEntry.getValue().stream().forEach(r ->{
|
|
|
- List<OrganizationEvaluationInfo> organizationEvaluationInfos1 = organizationEvaluationInfoMapper.selectByIndicatorDictionaryId(r.getId());
|
|
|
- try {
|
|
|
- String replace = replace(organizationEvaluationInfos1, evaluationScoringRule,stringListEntry.getKey());
|
|
|
- strings.add(Double.parseDouble(replace));
|
|
|
- } catch (Exception exception) {
|
|
|
- log.info(exception.getMessage());
|
|
|
- }
|
|
|
- });
|
|
|
+ Map<String, List<OrganizationEvaluationInfo>> stringListMap = listEntry.getValue().stream().collect(Collectors.groupingBy(OrganizationEvaluationInfo::getChildCode));
|
|
|
+ for (Map.Entry<String, List<OrganizationEvaluationInfo>> s : stringListMap.entrySet()){
|
|
|
+ String replace = replace(s.getValue(), evaluationScoringRule,s.getKey());
|
|
|
+ strings.add(Double.parseDouble(replace));
|
|
|
}
|
|
|
//各个子指标计算加和得分
|
|
|
calculation = strings.stream().reduce(0.0, (a, b) -> a + b);
|
|
@@ -215,7 +204,7 @@ public class ScoreCalculationSchedule {
|
|
|
} else if(intervalScoringTables.size() > 1){
|
|
|
//针对多个子指标计算
|
|
|
for (IntervalScoringTable intervalScoringTable : intervalScoringTables){
|
|
|
- if (code.equals(intervalScoringTable.getCode())){
|
|
|
+ if (code.equals(intervalScoringTable.getChildCode())){
|
|
|
String regularExpression = intervalScoringTable.getRegularExpression();
|
|
|
log.info(evaluationScoringRule.getScoreRuleName()+ "公式为" + regularExpression);
|
|
|
//公式计算得分
|
|
@@ -286,7 +275,7 @@ public class ScoreCalculationSchedule {
|
|
|
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
+ /*public static void main(String[] args) {
|
|
|
|
|
|
|
|
|
String sv = "round(1.2)";
|
|
@@ -298,8 +287,8 @@ public class ScoreCalculationSchedule {
|
|
|
String s4 = "if(0.01<0,-0.01*2/min(1,0.07)+10,1/1*2/max(4,0.07)+10)";
|
|
|
String s5 = "1+if(if(1<0,-1*2/min(2,1)+10,1*2/max(2,1)+10)>12,12,if(1<0,-1*2/min(2,1)+10,1*2/max(2,1)+10))";
|
|
|
String s3 = "if(abs(99)<=5%,if(abs(99)>=1%,(5%-abs(99))/1%*0.25+5,6),if(abs(99)<=10%,(5%-abs(99))/1%*0.2+5,4))+if(99==0,5,if(99>0,6,4))";
|
|
|
- /*String sd = "max(1,min(1,2))";
|
|
|
- String sc = MathCalculatorUtil.calculator(sd);*/
|
|
|
+ *//*String sd = "max(1,min(1,2))";
|
|
|
+ String sc = MathCalculatorUtil.calculator(sd);*//*
|
|
|
String ss = "if(max(1,3)<1,1,2)";
|
|
|
String s9 = "maxnum(1)";
|
|
|
ArrayList<Token> tokens = Analyzer.getTokens(sc);
|
|
@@ -336,6 +325,6 @@ public class ScoreCalculationSchedule {
|
|
|
String calculator = MathCalculatorUtil.calculator(alarmExpression.getExpression().trim());
|
|
|
System.out.println(calculator);
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|