|
@@ -3,6 +3,8 @@ package org.eco.als.utils;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.format.FastDateFormat;
|
|
|
import com.ql.util.express.Operator;
|
|
|
+import org.eco.common.core.exception.BusinessException;
|
|
|
+import org.eco.common.core.utils.DateUtils;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -15,13 +17,15 @@ public class CheckVibrationDuration extends Operator {
|
|
|
private static final Map<String, Long> VIBRATION_STATE = new HashMap<>();
|
|
|
|
|
|
@Override
|
|
|
- public Object executeInner(Object[] list) throws Exception {
|
|
|
+ public Object executeInner(Object[] list) {
|
|
|
+ try {
|
|
|
double currentVibration = (Double) list[0];
|
|
|
String symbol = list[1].toString();
|
|
|
double targetVibration = (Double) list[2];
|
|
|
double durationSeconds = (Double) list[3];
|
|
|
- FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
- long firstTimeDefault = DateUtil.parse((String) list[4], format).getTime();
|
|
|
+ String curr = (String) list[4];
|
|
|
+ FastDateFormat format = FastDateFormat.getInstance(DateUtils.checkTimeFormat(curr));
|
|
|
+ long firstTimeDefault = DateUtil.parse(curr, format).getTime();
|
|
|
boolean result = false;
|
|
|
switch (symbol) {
|
|
|
case "=":
|
|
@@ -58,5 +62,8 @@ public class CheckVibrationDuration extends Operator {
|
|
|
long elapsedSeconds = (firstTimeDefault - firstTime) / 1000;
|
|
|
// 返回是否满足持续时间要求
|
|
|
return elapsedSeconds >= durationSeconds;
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|