|
@@ -49,6 +49,9 @@ public class ScoreCalculationSchedule {
|
|
|
@Autowired
|
|
|
private IEvaluationScoreCountService iEvaluatioinScoreCountService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CalculateIndicatorItemInfoMapper calculateIndicatorItemInfoMapper;
|
|
|
+
|
|
|
/*@Scheduled(cron = "* 10 11 ? * 3")*/
|
|
|
public boolean doTask(){
|
|
|
|
|
@@ -117,6 +120,13 @@ public class ScoreCalculationSchedule {
|
|
|
//判断可用量化的进行变量替换
|
|
|
if ("是".equals(list.get(0).getIsQuantified())){
|
|
|
Map<String, Double> doubleMap = list.stream().collect(Collectors.toMap(OrganizationEvaluationInfo::getOptionCode, OrganizationEvaluationInfo::getQuantifiedValue));
|
|
|
+ //添加计算指标项的code和值 例如:差值最大值和最小值
|
|
|
+ OrganizationEvaluation organizationEvaluation = organizationEvaluationMapper.selectById(list.get(0).getOrganizationEvaluationId());
|
|
|
+ List<CalculateIndicatorItmeInfo> calculateIndicatorItmeInfos = calculateIndicatorItemInfoMapper.selectList(organizationEvaluation.getOrganizationType(),organizationEvaluation.getCheckCycle(),organizationEvaluation.getYear(),organizationEvaluation.getMonth());
|
|
|
+ calculateIndicatorItmeInfos.stream().forEach(r ->{
|
|
|
+ doubleMap.put(r.getOptionCode(),r.getQuantifiedValue());
|
|
|
+ });
|
|
|
+ //查询得分规则公式
|
|
|
QueryWrapper<IntervalScoringTable> qw = new QueryWrapper<>();
|
|
|
if (StringUtils.isNotEmpty(evaluationScoringRule.getId())) {
|
|
|
qw.lambda().eq(IntervalScoringTable::getRuleId,evaluationScoringRule.getId());
|
|
@@ -124,7 +134,6 @@ public class ScoreCalculationSchedule {
|
|
|
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() + ""));
|
|
|
});
|
|
@@ -196,57 +205,55 @@ public class ScoreCalculationSchedule {
|
|
|
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
-
|
|
|
-
|
|
|
- String sc = "max(sc,sd)+maxnum(sc)";
|
|
|
- boolean contains = sc.contains("maxnum");
|
|
|
-
|
|
|
- System.out.println(contains);
|
|
|
-
|
|
|
- String s2 = "if(if(2>0,max(1,2)+20,min(1,3)+10)>11,12,if(2<0,min(5,4)+1,max(1,3)+2))";
|
|
|
-
|
|
|
- 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 ss = "if(max(1,3)<1,1,2)";
|
|
|
- String s9 = "maxmin()";
|
|
|
- ArrayList<Token> tokens = Analyzer.getTokens(s4);
|
|
|
-
|
|
|
- //使用不同编码代替函数
|
|
|
- AlarmExpression alarmExpression = Analyzer.createAlarmExpression(tokens);
|
|
|
- if (alarmExpression.getVarList() != null && alarmExpression.getVarList().size() > 0) {
|
|
|
- List<AlarmExpression> alarmExpressions = alarmExpression.getChildren();
|
|
|
- for (AlarmExpression alarmExpression1 : alarmExpressions){
|
|
|
- if (alarmExpression1.getChildren().size() > 0 && alarmExpression1.getChildren() != null){
|
|
|
- for (AlarmExpression alarmExpression2 : alarmExpression1.getChildren()){
|
|
|
- if (alarmExpression2.getChildren().size() > 0 && alarmExpression2.getChildren() != null){
|
|
|
- List<AlarmExpression> al = alarmExpression2.getChildren();
|
|
|
- for (AlarmExpression alarmExpression3 : al){
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression3.getExpression());
|
|
|
- alarmExpression2.setExpression(alarmExpression2.getExpression().replaceAll(alarmExpression3.getFunCode(), calculator));
|
|
|
- }
|
|
|
- }
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression2.getExpression());
|
|
|
- alarmExpression1.setExpression(alarmExpression1.getExpression().replaceAll(alarmExpression2.getFunCode(), calculator));
|
|
|
- }
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
- alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
- }else {
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
- alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-// Map<String,Object> map = new HashMap<>();
|
|
|
-// Object o = ScriptShell.parseExpr(alarmExpression.getExpression(), map);
|
|
|
-// System.out.println(o);
|
|
|
- //判断表达式返回结果
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression.getExpression());
|
|
|
- System.out.println(calculator);
|
|
|
-
|
|
|
- }
|
|
|
+// public static void main(String[] args) {
|
|
|
+//
|
|
|
+//
|
|
|
+// String sc = "maxnum(1)";
|
|
|
+//
|
|
|
+//
|
|
|
+// String s2 = "if(if(2>0,max(1,2)+20,min(1,3)+10)>11,12,if(2<0,min(5,4)+1,max(1,3)+2))";
|
|
|
+//
|
|
|
+// 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 ss = "if(max(1,3)<1,1,2)";
|
|
|
+// String s9 = "maxmin()";
|
|
|
+// ArrayList<Token> tokens = Analyzer.getTokens(sc);
|
|
|
+//
|
|
|
+// //使用不同编码代替函数
|
|
|
+// AlarmExpression alarmExpression = Analyzer.createAlarmExpression(tokens);
|
|
|
+// if (alarmExpression.getVarList() != null && alarmExpression.getVarList().size() > 0) {
|
|
|
+// List<AlarmExpression> alarmExpressions = alarmExpression.getChildren();
|
|
|
+// for (AlarmExpression alarmExpression1 : alarmExpressions){
|
|
|
+// if (alarmExpression1.getChildren().size() > 0 && alarmExpression1.getChildren() != null){
|
|
|
+// for (AlarmExpression alarmExpression2 : alarmExpression1.getChildren()){
|
|
|
+// if (alarmExpression2.getChildren().size() > 0 && alarmExpression2.getChildren() != null){
|
|
|
+// List<AlarmExpression> al = alarmExpression2.getChildren();
|
|
|
+// for (AlarmExpression alarmExpression3 : al){
|
|
|
+// String calculator = MathCalculatorUtil.calculator(alarmExpression3.getExpression());
|
|
|
+// alarmExpression2.setExpression(alarmExpression2.getExpression().replaceAll(alarmExpression3.getFunCode(), calculator));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// String calculator = MathCalculatorUtil.calculator(alarmExpression2.getExpression());
|
|
|
+// alarmExpression1.setExpression(alarmExpression1.getExpression().replaceAll(alarmExpression2.getFunCode(), calculator));
|
|
|
+// }
|
|
|
+// String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
+// alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
+// }else {
|
|
|
+// String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
+// alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//// Map<String,Object> map = new HashMap<>();
|
|
|
+//// Object o = ScriptShell.parseExpr(alarmExpression.getExpression(), map);
|
|
|
+//// System.out.println(o);
|
|
|
+// //判断表达式返回结果
|
|
|
+// String calculator = MathCalculatorUtil.calculator(alarmExpression.getExpression());
|
|
|
+// System.out.println(calculator);
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
}
|