|
|
|
@ -121,12 +121,27 @@ public class DeviceDataAlarmServiceImpl implements DeviceDataAlarmService { |
|
|
|
data.setElapsedTime(currentTs - data.getUploadTimestamp()); |
|
|
|
data.setElapsedTimeStr(commonOpt.formatElapsedTime(data.getElapsedTime(), languageType)); |
|
|
|
} |
|
|
|
data.setInAlarm(isInAlarm(data.getHandleStatus(), data.getRetainAlert()) ? 1 : 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean isInAlarm(Integer handleStatus, Integer retainAlert) { |
|
|
|
if (handleStatus == null) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// (handle_status != 3 AND handle_status != 4)
|
|
|
|
if (handleStatus != 3 && handleStatus != 4) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
// (handle_status = 4 AND retain_alert = 1)
|
|
|
|
return handleStatus == 4 && Integer.valueOf(1).equals(retainAlert); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public SimpleDataResponse handleAlarm(HandleAlarmParams handleAlarmParams, Long userId, Long companyId, Integer languageType) { |
|
|
|
|