|
@@ -0,0 +1,38 @@
|
|
|
+package cn.iocoder.yudao.module.pms.job;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotZHBD.DeviceZHBDDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class CarIdJob implements JobHandler {
|
|
|
+ @Autowired
|
|
|
+ private IotOpeationFillMapper zhbdmapper;
|
|
|
+ @Autowired
|
|
|
+ private IotDeviceMapper iotDeviceMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @TenantIgnore
|
|
|
+ public String execute(String param) throws Exception {
|
|
|
+ List<DeviceZHBDDO> zhbdList = zhbdmapper.carList();
|
|
|
+ zhbdList.forEach(zhbd -> {
|
|
|
+ String deviceCode = zhbd.getDeviceCode();
|
|
|
+ List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList("device_code", deviceCode);
|
|
|
+ if (CollUtil.isNotEmpty(iotDeviceDOS)) {
|
|
|
+ iotDeviceDOS.forEach(iotDeviceDO -> {
|
|
|
+ iotDeviceDO.setCarId(Long.valueOf(zhbd.getCarId()));
|
|
|
+ iotDeviceMapper.updateById(iotDeviceDO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+}
|