瀏覽代碼

运行记录优化1

yuanchao 2 天之前
父節點
當前提交
ac423d1b9d

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotopeationfill/IotOpeationFillOrderDO.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill;
 
 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.KeySequence;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;

+ 56 - 21
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/IotOperationPlanJob.java

@@ -75,28 +75,7 @@ public class IotOperationPlanJob implements JobHandler {
         List<IotOperationPlanDO> planList = planMapper.getPlanList();
 
         if(planList.size()>0){
-            List<Long> planIds= planList.stream().map(IotOperationPlanDO::getId).collect(Collectors.toList());
-            //2、根据计划获取设备ID
-            List<IotOperationPlanDevDO> devList = planDevMapper.devIdList(planIds);
-            List<Long> devIdList= devList.stream().map(IotOperationPlanDevDO::getId).collect(Collectors.toList());
-            //3、根据设备ID生成主表数据
-            List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
-            List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
-
-            for (IotOpeationFillDO pd:pdList) {
-
-                IotOpeationFillOrderDO fillDO = new IotOpeationFillOrderDO();
-
-                fillDO.setOrderName(pd.getOrgName()+"/"+LocalDate.now()+"运行记录填报");
-                fillDO.setDeptId(pd.getDeptId());
-                fillDO.setOrderStatus(0);
-                fillDO.setCreateTime(LocalDateTime.now());
-                fillDO.setUserName(pd.getUserName());
-                fillDO.setUserId(pd.getUserId());
-                fillDO.setMobile(pd.getMobile());
-                orderList.add(fillDO);
 
-            }
 
 
             for (IotOperationPlanDO planDO:planList) {
@@ -107,6 +86,34 @@ public class IotOperationPlanJob implements JobHandler {
                                 planDO.getBeginCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
                                         .toInstant()                    // 转为 Instant(时间戳)
                         );
+
+
+                        List<Long> planIds= new ArrayList<>();
+                        planIds.add(planDO.getId());
+                        //2、根据计划获取设备ID
+                        List<IotOperationPlanDevDO> devList = planDevMapper.devIdList(planIds);
+                        List<Long> devIdList= devList.stream().map(IotOperationPlanDevDO::getId).collect(Collectors.toList());
+                        //3、根据设备ID生成主表数据
+                        List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
+                        List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
+
+                        for (IotOpeationFillDO pd:pdList) {
+
+                            IotOpeationFillOrderDO fillDO = new IotOpeationFillOrderDO();
+
+                            fillDO.setOrderName(pd.getOrgName()+"/"+LocalDate.now()+"运行记录填报");
+                            fillDO.setDeptId(pd.getDeptId());
+                            fillDO.setOrderStatus(0);
+                            fillDO.setCreateTime(LocalDateTime.now());
+                            fillDO.setUserName(pd.getUserName());
+                            fillDO.setUserId(pd.getUserId());
+                            fillDO.setMobile(pd.getMobile());
+                            orderList.add(fillDO);
+
+                        }
+
+
+
                         deal(planDO, date,devIdList,orderList);
                     }
                 } else {
@@ -114,6 +121,32 @@ public class IotOperationPlanJob implements JobHandler {
                             planDO.getLastCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
                                     .toInstant()                    // 转为 Instant(时间戳)
                     );
+
+                    List<Long> planIds= new ArrayList<>();
+                    planIds.add(planDO.getId());
+                    //2、根据计划获取设备ID
+                    List<IotOperationPlanDevDO> devList = planDevMapper.devIdList(planIds);
+                    List<Long> devIdList= devList.stream().map(IotOperationPlanDevDO::getId).collect(Collectors.toList());
+                    //3、根据设备ID生成主表数据
+                    List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
+                    List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
+
+                    for (IotOpeationFillDO pd:pdList) {
+
+                        IotOpeationFillOrderDO fillDO = new IotOpeationFillOrderDO();
+
+                        fillDO.setOrderName(pd.getOrgName()+"/"+LocalDate.now()+"运行记录填报");
+                        fillDO.setDeptId(pd.getDeptId());
+                        fillDO.setOrderStatus(0);
+                        fillDO.setCreateTime(LocalDateTime.now());
+                        fillDO.setUserName(pd.getUserName());
+                        fillDO.setUserId(pd.getUserId());
+                        fillDO.setMobile(pd.getMobile());
+                        orderList.add(fillDO);
+
+                    }
+
+
                     deal(planDO, lastdate,devIdList,orderList);
                 }
             }
@@ -167,6 +200,8 @@ public class IotOperationPlanJob implements JobHandler {
                 .filter(obj -> idList.contains(obj.getUserId()))
                 .collect(Collectors.toList());
 
+
+
         iotOpeationFillOrderMapper.insertBatch(orderList1);