|
@@ -86,7 +86,7 @@ public class AlarmConditionServiceImpl extends ServiceImpl<AlarmConditionMapper,
|
|
|
tempFormula.append(formula.getValue());
|
|
|
infoCodesSet.add(formula.getValue());
|
|
|
} else {
|
|
|
- tempFormula.append(formula.getLabel());
|
|
|
+ tempFormula.append(replace(formula.getLabel()));
|
|
|
}
|
|
|
displayFormula.append(formula.getLabel());
|
|
|
}
|
|
@@ -96,7 +96,7 @@ public class AlarmConditionServiceImpl extends ServiceImpl<AlarmConditionMapper,
|
|
|
notNullString.append(calculateMethodDTO.getMonitorIndicatorId()).append("!=NaN").append(" && ");
|
|
|
calculateString.append("(")
|
|
|
.append(calculateMethodDTO.getMonitorIndicatorId())
|
|
|
- .append(calculateMethodDTO.getOperator())
|
|
|
+ .append(replace(calculateMethodDTO.getOperator()))
|
|
|
.append(calculateMethodDTO.getTempFormula()).append(")")
|
|
|
.append(" && ");
|
|
|
}
|
|
@@ -119,6 +119,13 @@ public class AlarmConditionServiceImpl extends ServiceImpl<AlarmConditionMapper,
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ public String replace(String operator) {
|
|
|
+ operator = operator.replace("=", "==")
|
|
|
+ .replace("≥", ">=")
|
|
|
+ .replace("≤", "<=");
|
|
|
+ return operator;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void updateById(Map<String, Object> conditionMap, UpdateAlarmConditionDTO condition) {
|
|
|
AlarmCondition alarmCondition = new AlarmCondition();
|
|
@@ -325,14 +332,14 @@ public class AlarmConditionServiceImpl extends ServiceImpl<AlarmConditionMapper,
|
|
|
displayFormula.append(formula.getLabel());
|
|
|
}
|
|
|
}
|
|
|
- if(isNumeric(displayFormula.toString())){
|
|
|
- if(formulas.size()==1){
|
|
|
+ if (isNumeric(displayFormula.toString())) {
|
|
|
+ if (formulas.size() == 1) {
|
|
|
return ResultHelper.success();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return ResultHelper.failure(ResponseCode.C0134.getCode(), "公式不合法");
|
|
|
}
|
|
|
}
|
|
|
- if(!"".equals(infoCodes)){
|
|
|
+ if (!"".equals(infoCodes)) {
|
|
|
MonitorIndicator indicator = monitorIndicatorService.queryMonitorIndicatorDetail(infoCodes);
|
|
|
String monitorUnit = monitorIndicator.getUnit();
|
|
|
String unit = indicator.getUnit();
|