Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

zhangcl vor 19 Stunden
Ursprung
Commit
8613cba118

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/config/PmsDataPermissionConfiguration.java

@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyRep
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotsapstock.IotSapStockDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintenance.IotMaintenancePlanDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.device.YfIotDeviceDO;
 import cn.iocoder.yudao.module.supplier.dal.dataobject.product.SupplierDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@@ -55,6 +56,7 @@ public class PmsDataPermissionConfiguration {
             rule.addDeptColumn(IotSapStockDO.class, "dept_id");
             rule.addDeptColumn(IotRhDailyReportDO.class, "dept_id");
             rule.addDeptColumn(IotRdDailyReportDO.class, "dept_id");
+            rule.addDeptColumn(YfIotDeviceDO.class,"dept_id");
             // user
 //            rule.addUserColumn(SupplierDO.class);
             rule.addUserColumn(AdminUserDO.class, "id");

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/TDDeviceMapper.java

@@ -124,7 +124,7 @@ public interface TDDeviceMapper extends BaseMapperX<TDDeviceDO> {
     List<DeviceTdVO> batchGetYesInfo(@Param("queries") List<DeviceTdVO> queries);
 
 
-    @Select("SELECT   _WSTART AS ts, AVG(CAST(log_value AS FLOAT)) as log_value,identity   FROM iot_log.device_${deviceName} " +
+    @Select("SELECT   _WSTART AS ts, AVG(CAST(log_value AS FLOAT)) as log_value   FROM iot_log.device_${deviceName} " +
             "WHERE ts between #{start} and #{end} and identity = #{identifier}  INTERVAL(1m) " )
     @DS("tdengine")
     @TenantIgnore

+ 21 - 19
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/TdCronJob.java

@@ -60,20 +60,22 @@ public class TdCronJob implements JobHandler {
                         device.setLastInlineTime(format);
                     }
                 }
-                if (e.getStatus()==1) {
-//                        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);
-//                        }
+                if (e.getStatus()==1) {//未激活状态
+
+                    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);
+                    }
+
                     Object lat = redisTemplate.opsForHash().get("TSLV:" + device.getDeviceCode(), "lat");
                     if (Objects.nonNull(lat)) {
                         JSONObject jsonObject = JSON.parseObject(lat.toString());
@@ -92,11 +94,11 @@ public class TdCronJob implements JobHandler {
                     }
                 } else {
                         if (StringUtils.isNotBlank(device.getLastInlineTime())) {
-//                            if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
-//                                device.setIfInline(4);
-//                            } else {
+                            if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
+                                device.setIfInline(4);
+                            } else {
                                 device.setIfInline(e.getStatus());
-//                            }
+                            }
                         } else {
                             device.setIfInline(4);
                         }
@@ -109,7 +111,7 @@ public class TdCronJob implements JobHandler {
 
 
     public static void main(String[] args) {
-        String abc = "2025-07-14 20:07:40";
+        String abc = "2026-01-21 10:25:40";
         System.out.println(DateUtils.checkIfFullDayDifference(abc));
     }
 }