|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.pms.job;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.DeviceVO;
|
|
@@ -18,6 +19,7 @@ import java.sql.Timestamp;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Component
|
|
|
@Slf4j
|
|
@@ -41,11 +43,6 @@ public class TdCronJob implements JobHandler {
|
|
|
for (IotDeviceDO device : devices) {
|
|
|
String deviceCode = device.getDeviceCode();
|
|
|
allDevice.stream().filter(e -> e.getSerialNumber().equals(deviceCode)).findFirst().ifPresent(e -> {
|
|
|
- if (e.getStatus()==1) {
|
|
|
- device.setIfInline(5);
|
|
|
- } else {
|
|
|
- device.setIfInline(e.getStatus());
|
|
|
- }
|
|
|
device.setYfDeviceId(e.getDeviceId());
|
|
|
Integer i = deviceMapper.tableIfExist(e.getSerialNumber().toLowerCase());
|
|
|
if (i==1) {
|
|
@@ -57,6 +54,24 @@ public class TdCronJob implements JobHandler {
|
|
|
device.setLastInlineTime(format);
|
|
|
}
|
|
|
}
|
|
|
+ if (e.getStatus()==1) {
|
|
|
+// if (Objects.nonNull(device.getLastInlineTime())) {
|
|
|
+ try {
|
|
|
+ if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
|
|
|
+ device.setIfInline(4);
|
|
|
+ } else {
|
|
|
+ device.setIfInline(3);
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ throw new RuntimeException(ex);
|
|
|
+ }
|
|
|
+// } else {
|
|
|
+// device.setIfInline(5);
|
|
|
+// }
|
|
|
+// device.setIfInline(5);
|
|
|
+ } else {
|
|
|
+ device.setIfInline(e.getStatus());
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
iotDeviceMapper.updateBatch(devices);
|