Explorar el Código

算法切换为云从算法之后,判断货柜是否存在

谭斌 hace 1 año
padre
commit
724ff70369

+ 11 - 1
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -273,7 +273,17 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         DeviceInfo deviceInfo = copy(DeviceInfo.class, update)
                 .setUpdateTime(LocalDateTime.now());
         updateById(deviceInfo);
-        DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(update.getDeviceId()).setIsSysinfo(true)));
+        Long deviceId = deviceInfo.getDeviceId();
+        DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(deviceId).setIsSysinfo(true)));
+        Long algorithmId = update.getAlgorithmId();
+        if (algorithmId != null && AlgorithmTypeEnum.CLOUD.getId() == algorithmId) {
+            //云从算法
+            boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
+            if (!b) {
+                //货柜不存在,新增
+                cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
+            }
+        }
         Integer deviceType = device.getDeviceType();
         if (ObjectUtil.equals(DeviceTypeEnum.TYPE5.getCode(), deviceType)) {
             DeviceUpdateDTO deviceUpdateDTO = new DeviceUpdateDTO();