|
@@ -0,0 +1,75 @@
|
|
|
+package cn.iocoder.yudao.module.pms.job;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.SpringApplication;
|
|
|
+import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
+import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.security.PermitAll;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author yc
|
|
|
+ * @version 1.0
|
|
|
+ * @className IotOperationFillTask
|
|
|
+ * @date 2025/5/11 10:26
|
|
|
+ * @description
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class IotOperationFillJob implements JobHandler {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IotOpeationFillMapper iotOpeationFillMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @TenantJob
|
|
|
+ public String execute(String param) throws Exception {
|
|
|
+ System.out.println("***********创建运行记录填报工单开始执行*********8");
|
|
|
+ List<IotOpeationFillDO> orderList = new ArrayList<>();
|
|
|
+ Long[] deptArray = {157L,158L,163L};
|
|
|
+ for (Long a:deptArray) {
|
|
|
+ IotOpeationFillDO fillDO = new IotOpeationFillDO();
|
|
|
+ fillDO.setDeptId(a);
|
|
|
+ if(a==157L){
|
|
|
+ fillDO.setOrderName("瑞恒兴域运行记录填报");
|
|
|
+ }else if(a==158L){
|
|
|
+ fillDO.setOrderName("瑞鹰国际运行记录填报");
|
|
|
+ }else{
|
|
|
+ fillDO.setOrderName("四川瑞都运行记录填报");
|
|
|
+ }
|
|
|
+ fillDO.setOrderType("计划生成");
|
|
|
+ fillDO.setOrderStatus(0);
|
|
|
+ fillDO.setCreateTime(LocalDateTime.now());
|
|
|
+ orderList.add(fillDO);
|
|
|
+ }
|
|
|
+ iotOpeationFillMapper.insertFillOrder(orderList);
|
|
|
+ System.out.println("***********创建运行记录填报工单执行结束*********8");
|
|
|
+
|
|
|
+ System.out.println("*****************插入运行记录设备表***********************");
|
|
|
+ IotOpeationFillPageReqVO vo = new IotOpeationFillPageReqVO();
|
|
|
+ List<IotOpeationFillDO> fillList = iotOpeationFillMapper.fillList(vo);
|
|
|
+ if(fillList.size()==0){
|
|
|
+ List<IotOpeationFillDO> deviceList = iotOpeationFillMapper.getFillDevices();
|
|
|
+ for (IotOpeationFillDO re:deviceList) {
|
|
|
+ re.setDeviceId(re.getId());
|
|
|
+ }
|
|
|
+ iotOpeationFillMapper.insertFill(deviceList);
|
|
|
+ }
|
|
|
+ System.out.println("*****************插入运行记录设备表完成***********************");
|
|
|
+ return "创建成功";
|
|
|
+ }
|
|
|
+
|
|
|
+}
|