|
@@ -141,23 +141,26 @@ public class ScoreCalculationSchedule {
|
|
|
* */
|
|
|
public Boolean handle(String range) {
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
-
|
|
|
- //将区间表达式拆分
|
|
|
- ArrayList<Token> tokens = Analyzer.getTokens(range);
|
|
|
- //使用不同编码代替函数
|
|
|
- AlarmExpression alarmExpression = Analyzer.createAlarmExpression(tokens);
|
|
|
- List<AlarmExpression> children = alarmExpression.getChildren();
|
|
|
- for (AlarmExpression alarmExpression1 : children){
|
|
|
- String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
- alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
- }
|
|
|
-
|
|
|
- //判断表达式返回结果
|
|
|
- Boolean o = (Boolean) ScriptShell.parseExpr(alarmExpression.getExpression(), map);
|
|
|
+ Boolean o = true;
|
|
|
+ try {
|
|
|
+ //将区间表达式拆分
|
|
|
+ ArrayList<Token> tokens = Analyzer.getTokens(range);
|
|
|
+ //使用不同编码代替函数
|
|
|
+ AlarmExpression alarmExpression = Analyzer.createAlarmExpression(tokens);
|
|
|
+ List<AlarmExpression> children = alarmExpression.getChildren();
|
|
|
+ for (AlarmExpression alarmExpression1 : children){
|
|
|
+ String calculator = MathCalculatorUtil.calculator(alarmExpression1.getExpression());
|
|
|
+ alarmExpression.setExpression(alarmExpression.getExpression().replaceAll(alarmExpression1.getFunCode(), calculator));
|
|
|
+ }
|
|
|
|
|
|
+ //判断表达式返回结果
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ o = (Boolean) ScriptShell.parseExpr(alarmExpression.getExpression(), map);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
return o;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|