| | |
| | | } |
| | | } |
| | | // loc |
| | | List<String> newMapLocList = new ArrayList<>(); |
| | | List<String> newLocList = new ArrayList<>(); |
| | | for (MapItem item : param.getItemList()) { |
| | | int row = Integer.parseInt(String.valueOf(item.getProperty().get("row"))); |
| | | int bay = Integer.parseInt(String.valueOf(item.getProperty().get("bay"))); |
| | | String locNo = Utils.getLocNo(row, bay, param.getFloor()); |
| | | newMapLocList.add(locNo); |
| | | newLocList.add(locNo); |
| | | } |
| | | |
| | | List<String> existLocList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getLev, param.getFloor())) |
| | | .stream().map(Loc::getLocNo).collect(Collectors.toList()); |
| | | |
| | | // todo |
| | | |
| | | locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLev, param.getFloor())); |
| | | for (MapItem item : param.getItemList()) { |
| | | List<String> locListToSave = newLocList.stream().filter(locNo -> !existLocList.contains(locNo)).collect(Collectors.toList()); |
| | | |
| | | List<String> locListToRemove = existLocList.stream().filter(locNo -> !newLocList.contains(locNo)).collect(Collectors.toList()); |
| | | |
| | | List<String> locListInBoth = newLocList.stream().filter(existLocList::contains).collect(Collectors.toList()); |
| | | |
| | | for (String locNo : locListToSave) { |
| | | Loc loc = new Loc(); |
| | | loc.setRow(Integer.parseInt(String.valueOf(item.getProperty().get("row")))); |
| | | loc.setBay(Integer.parseInt(String.valueOf(item.getProperty().get("bay")))); |
| | | loc.setLev(param.getFloor()); |
| | | String locNo = Utils.getLocNo(loc.getRow(), loc.getBay(), loc.getLev()); |
| | | loc.setLocNo(locNo); |
| | | loc.setName(locNo); |
| | | |
| | | loc.setRow(Utils.getRow(locNo)); |
| | | loc.setBay(Utils.getBay(locNo)); |
| | | loc.setLev(Utils.getLev(locNo)); |
| | | loc.setLocSts(LocStsType.O.val()); |
| | | |
| | | loc.setCreateBy(userId); |
| | | loc.setCreateTime(now); |
| | | loc.setUpdateBy(userId); |
| | |
| | | throw new CoolException("服务器内部错误"); |
| | | } |
| | | } |
| | | |
| | | for (String locNo : locListToRemove) { |
| | | if (!locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo))) { |
| | | throw new CoolException("服务器内部错误"); |
| | | } |
| | | } |
| | | |
| | | for (String locNo : locListInBoth) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |