|
@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.TDDeviceMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.TDDeviceMapper;
|
|
import cn.iocoder.yudao.module.pms.service.yanfan.YfDeviceService;
|
|
import cn.iocoder.yudao.module.pms.service.yanfan.YfDeviceService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -55,26 +56,40 @@ public class TdCronJob implements JobHandler {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (e.getStatus()==1) {
|
|
if (e.getStatus()==1) {
|
|
-// if (Objects.nonNull(device.getLastInlineTime())) {
|
|
|
|
- try {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(device.getLastInlineTime())) {
|
|
|
|
+ try {
|
|
|
|
+ if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
|
|
|
|
+ device.setIfInline(4);
|
|
|
|
+ } else {
|
|
|
|
+ device.setIfInline(3);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ throw new RuntimeException(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ device.setIfInline(4);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ if (StringUtils.isNotBlank(device.getLastInlineTime())) {
|
|
if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
|
|
if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
|
|
device.setIfInline(4);
|
|
device.setIfInline(4);
|
|
} else {
|
|
} else {
|
|
- device.setIfInline(3);
|
|
|
|
|
|
+ device.setIfInline(e.getStatus());
|
|
}
|
|
}
|
|
- } catch (Exception ex) {
|
|
|
|
- throw new RuntimeException(ex);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ device.setIfInline(4);
|
|
}
|
|
}
|
|
-// } else {
|
|
|
|
-// device.setIfInline(5);
|
|
|
|
-// }
|
|
|
|
-// device.setIfInline(5);
|
|
|
|
- } else {
|
|
|
|
- device.setIfInline(e.getStatus());
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
iotDeviceMapper.updateBatch(devices);
|
|
iotDeviceMapper.updateBatch(devices);
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ String abc = "2025-07-14 20:07:40";
|
|
|
|
+ System.out.println(DateUtils.checkIfFullDayDifference(abc));
|
|
|
|
+ }
|
|
}
|
|
}
|