|
@ -329,14 +329,8 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void deleteAll(String[] ids) { |
|
|
public void deleteAll(String[] ids) { |
|
|
// WQLObject wo = WQLObject.getWQLObject("acs_device");
|
|
|
|
|
|
// WQLObject storageTab = WQLObject.getWQLObject("acs_storage_cell");
|
|
|
|
|
|
// //路由路线表【acs_route_line】
|
|
|
|
|
|
// WQLObject routeLineTab = WQLObject.getWQLObject("acs_route_line");
|
|
|
|
|
|
// //路由路线表【stage_actor】
|
|
|
|
|
|
// WQLObject stageActorTab = WQLObject.getWQLObject("stage_actor");
|
|
|
|
|
|
for (String device_id : ids) { |
|
|
for (String device_id : ids) { |
|
|
// JSONObject deviceJson = wo.query("device_id = '" + device_id + "'").uniqueResult(0);
|
|
|
|
|
|
Device deviceJson = new LambdaQueryChainWrapper<>(deviceMapper) |
|
|
Device deviceJson = new LambdaQueryChainWrapper<>(deviceMapper) |
|
|
.eq(Device::getDevice_id, device_id) |
|
|
.eq(Device::getDevice_id, device_id) |
|
|
.one(); |
|
|
.one(); |
|
@ -345,7 +339,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i |
|
|
} |
|
|
} |
|
|
String device_code = deviceJson.getDevice_code(); |
|
|
String device_code = deviceJson.getDevice_code(); |
|
|
log.debug("删除设备时候判断路由是否存在,如果存在,则不允许删除设备!"); |
|
|
log.debug("删除设备时候判断路由是否存在,如果存在,则不允许删除设备!"); |
|
|
// JSONObject json = routeLineTab.query("device_code = '" + device_code + "' or next_device_code = '" + device_code + "'").uniqueResult(0);
|
|
|
|
|
|
RouteLine json = new LambdaQueryChainWrapper<>(routeLineMapper) |
|
|
RouteLine json = new LambdaQueryChainWrapper<>(routeLineMapper) |
|
|
.eq(RouteLine::getDevice_code, device_code) |
|
|
.eq(RouteLine::getDevice_code, device_code) |
|
|
.or().eq(RouteLine::getNext_device_code,device_code) |
|
|
.or().eq(RouteLine::getNext_device_code,device_code) |
|
@ -353,25 +346,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i |
|
|
if (json != null) { |
|
|
if (json != null) { |
|
|
throw new BadRequestException("设备:【" + device_code + "】在路由已存在,无法删除!"); |
|
|
throw new BadRequestException("设备:【" + device_code + "】在路由已存在,无法删除!"); |
|
|
} |
|
|
} |
|
|
log.debug("删除舞台里面的设备!"); |
|
|
|
|
|
// Map<String, String> map = new HashMap<>();
|
|
|
|
|
|
// map.put("device_id", "");
|
|
|
|
|
|
// map.put("device_code", "");
|
|
|
|
|
|
// map.put("device_name", "");
|
|
|
|
|
|
// stageActorTab.update(map, "device_code = '" + device_code + "'");
|
|
|
|
|
|
// stageActorMapper.lambdaUpdate().eq(StageActor::getDevice_code,device_code)
|
|
|
|
|
|
// .set(StageActor::getDevice_code,"")
|
|
|
|
|
|
// .set(StageActor::getDevice_name,"")
|
|
|
|
|
|
// .update();
|
|
|
|
|
|
log.debug("根据设备编码查询在缓存里面的舞台数据,并删除掉!"); |
|
|
|
|
|
// JSONArray jsonArr = WQL.getWO("QStage_01").addParam("flag", "1").addParam("device_code", device_code).process().getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
|
|
// List<Stage> stageList = stageMapper.selectByDeviceCode(device_code);
|
|
|
|
|
|
// for (int i = 0; i < stageList.size(); i++) {
|
|
|
|
|
|
// String stage_code = stageList.get(i).getStage_code();
|
|
|
|
|
|
// redisUtils.del("stage:mst:" + stage_code);
|
|
|
|
|
|
// redisUtils.del("stage:dtl:" + stage_code);
|
|
|
|
|
|
// }
|
|
|
|
|
|
log.debug("删除缓存里面的设备!"); |
|
|
log.debug("删除缓存里面的设备!"); |
|
|
Device deviceByCode = deviceAppService.findDeviceByCode(device_code); |
|
|
Device deviceByCode = deviceAppService.findDeviceByCode(device_code); |
|
|
List<Device> allDevice = deviceAppService.findAllDevice(); |
|
|
List<Device> allDevice = deviceAppService.findAllDevice(); |
|
@ -382,29 +356,21 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i |
|
|
iterator.remove(); |
|
|
iterator.remove(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// allDevice.remove(deviceByCode);
|
|
|
|
|
|
|
|
|
|
|
|
log.info("设备删除成功!"); |
|
|
log.info("设备删除成功!"); |
|
|
if (deviceByCode != null) { |
|
|
if (deviceByCode != null) { |
|
|
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) { |
|
|
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) { |
|
|
// storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'");
|
|
|
|
|
|
storageCellMapper.deleteByStorageCode(device_code); |
|
|
storageCellMapper.deleteByStorageCode(device_code); |
|
|
} else { |
|
|
} else { |
|
|
// JSONObject data = storageTab.query("storage_code ='" + device_code + "'").uniqueResult(0);
|
|
|
|
|
|
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper) |
|
|
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper) |
|
|
.eq(StorageCell::getStorage_code, device_code) |
|
|
.eq(StorageCell::getStorage_code, device_code) |
|
|
.one(); |
|
|
.one(); |
|
|
if (storageCell != null) { |
|
|
if (storageCell != null) { |
|
|
// storageTab.delete("storage_code = '" + device_code + "'");
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
map.put("storage_code",device_code); |
|
|
map.put("storage_code",device_code); |
|
|
storageCellMapper.deleteByMap(map); |
|
|
storageCellMapper.deleteByMap(map); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// wo.delete("device_id = '" + device_id + "'");
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
map.put("device_id",device_id); |
|
|
map.put("device_id",device_id); |
|
|
deviceMapper.deleteByMap(map); |
|
|
deviceMapper.deleteByMap(map); |
|
|