|
@@ -678,14 +678,22 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Long deviceId = deviceSave.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) {
|
|
|
+ //切换算法逻辑处理
|
|
|
+ if (algorithmId != null && !Objects.equals(deviceInfo.getAlgorithmId(), algorithmId)) {
|
|
|
+ //1、删除设备商品
|
|
|
+ GoodsDeviceDto.DelByDeviceId delByDeviceId = new GoodsDeviceDto.DelByDeviceId();
|
|
|
+ delByDeviceId.setDeviceId(deviceId);
|
|
|
+ delByDeviceId.setMercId(delByDeviceId.getMercId());
|
|
|
+ R.feignCheckData(goodsDeviceService.delByDeviceId(delByDeviceId));
|
|
|
+ }
|
|
|
+ if (algorithmId != null && Objects.equals(AlgorithmTypeEnum.CLOUD.getId(), algorithmId)) {
|
|
|
// 云从算法
|
|
|
boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
|
|
|
if (!b) {
|
|
|
// 货柜不存在,新增
|
|
|
cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
|
}
|
|
|
- } else if (algorithmId != null && AlgorithmTypeEnum.TY.getId() == algorithmId) {
|
|
|
+ } else if (algorithmId != null && Objects.equals(AlgorithmTypeEnum.TY.getId(), algorithmId)) {
|
|
|
// 拓元算法
|
|
|
// 查询登记设备
|
|
|
DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|