| | |
| | | if (Objects.isNull(param.getDeviceSites()) || StringUtils.isBlank(param.getDeviceSites())) { |
| | | throw new CoolException("初始化失败: 设备作业站点不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getSites()) || StringUtils.isBlank(param.getSites())) { |
| | | if (Objects.isNull(param.getSite()) || StringUtils.isBlank(param.getSite())) { |
| | | throw new CoolException("初始化失败: 作业站点不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getTypeIds()) || param.getTypeIds().isEmpty()) { |
| | | throw new CoolException("初始化失败: 作业类型不能为空!!"); |
| | | } |
| | | List<String> sites = Arrays.asList(StringUtils.split(param.getSites(), ",")); |
| | | if (Objects.isNull(param.getTarget()) || param.getTarget().isEmpty()) { |
| | | throw new CoolException("初始化失败: 目标站点不能为空!!"); |
| | | } |
| | | List<String> sites = Arrays.asList(StringUtils.split(param.getSite(), ",")); |
| | | List<String> dvSites = Arrays.asList(StringUtils.split(param.getDeviceSites(), ",")); |
| | | List<String> targets = Arrays.asList(StringUtils.split(param.getTarget(), ",")); |
| | | List<DeviceSite> deviceSites = new ArrayList<>(); |
| | | for (String site : sites) { |
| | | for (String deviceSite : dvSites) { |
| | | for (Long id : param.getTypeIds()) { |
| | | for (String target : targets) { |
| | | DeviceSite site1 = new DeviceSite(); |
| | | site1.setType(id + "") |
| | | .setSite(site) |
| | | .setDevice(param.getDeviceType()) |
| | | .setDeviceSite(deviceSite) |
| | | .setTarget(target) |
| | | .setDeviceCode(param.getDeviceCode()); |
| | | deviceSites.add(site1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!this.saveBatch(deviceSites)) { |
| | | throw new CoolException("初始化失败: 数据保存失败!!"); |
| | | } |