Commit 82b2daaf4f3fedf36c9c6dbffcd9d0a3b11203b5
1 parent
a529dd89
优化导入数据
Showing
1 changed file
with
11 additions
and
19 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| ... | ... | @@ -195,22 +195,17 @@ public class KeyBoxController extends BaseController { |
| 195 | 195 | scheduling.setCzCode(venueInfo.getParkCode()); |
| 196 | 196 | scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime())); |
| 197 | 197 | scheduling.setType(1); |
| 198 | + scheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(scheduling.getStartScheduleDate(),1)); | |
| 198 | 199 | |
| 199 | 200 | List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling); |
| 200 | 201 | Set<String> jobCodes = null; |
| 201 | 202 | Set<String> nbbms = null; |
| 202 | - Set<String> nbbms1 = null; | |
| 203 | + | |
| 203 | 204 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 204 | 205 | jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet()); |
| 205 | 206 | nbbms = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); |
| 206 | 207 | } |
| 207 | 208 | |
| 208 | - scheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(scheduling.getStartScheduleDate(),1)); | |
| 209 | - List<LinggangScheduling> schedulings1 = schedulingService.listByCZ(scheduling); | |
| 210 | - if (CollectionUtils.isNotEmpty(schedulings1)) { | |
| 211 | - nbbms1 = schedulings1.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); | |
| 212 | - } | |
| 213 | - | |
| 214 | 209 | List<NewDriver> drivers = queryDrive(jobCodes); |
| 215 | 210 | if (CollectionUtils.isEmpty(drivers)) { |
| 216 | 211 | logger.info("根据DTO的数据无法查询司机信息:[{}]", dto); |
| ... | ... | @@ -220,12 +215,9 @@ public class KeyBoxController extends BaseController { |
| 220 | 215 | logger.info("根据DTO的数据无法查询车辆信息:[{}]", dto); |
| 221 | 216 | } |
| 222 | 217 | |
| 223 | - List<CarInfo> carInfos1 = queryCarInfo(nbbms1); | |
| 224 | - if (CollectionUtils.isEmpty(carInfos)) { | |
| 225 | - logger.info("根据DTO的数据无法查询车辆信息(carInfos1):[{}]", dto); | |
| 226 | - } | |
| 227 | 218 | |
| 228 | - BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment, venueInfo, equipmentList, schedulings1, carInfos1); | |
| 219 | + | |
| 220 | + BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment, venueInfo, equipmentList); | |
| 229 | 221 | return ResponseResult.success(vo); |
| 230 | 222 | } catch (ParseException e) { |
| 231 | 223 | logger.error("钥匙柜基础信息同步异常:[{}]", dto, e); |
| ... | ... | @@ -399,7 +391,7 @@ public class KeyBoxController extends BaseController { |
| 399 | 391 | List<KeyInfo> keyInfos = tempKeyInfos; |
| 400 | 392 | int keyInfoSize = CollectionUtils.size(keyInfos); |
| 401 | 393 | |
| 402 | - List<TakeKeyPlanVo> vos = schedulings.stream().map(s->{ | |
| 394 | + List<TakeKeyPlanVo> vos = schedulings.stream().map(s->{ | |
| 403 | 395 | TakeKeyPlanVo vo = convert(s); |
| 404 | 396 | if(keyInfoSize > 0){ |
| 405 | 397 | Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getId(),s.getKeyInfoId())).findFirst(); |
| ... | ... | @@ -453,7 +445,7 @@ public class KeyBoxController extends BaseController { |
| 453 | 445 | if (CollectionUtils.isEmpty(locations)) { |
| 454 | 446 | return ResponseResult.success(); |
| 455 | 447 | } |
| 456 | - Date date = DateUtil.shortDate(new Date()); | |
| 448 | + Date date = DateUtil.shortDate(new Date()); | |
| 457 | 449 | location.setType(255); |
| 458 | 450 | location.setStartScheduleDate(DateUtil.shortDate(new Date())); |
| 459 | 451 | int errorCount = linggangKeyWorkLocationService.countId(location); |
| ... | ... | @@ -652,7 +644,7 @@ public class KeyBoxController extends BaseController { |
| 652 | 644 | |
| 653 | 645 | private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings, |
| 654 | 646 | List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment, |
| 655 | - LinggangVenueInfo venueInfo, List<Equipment> equipmentList, List<LinggangScheduling> schedulings1, List<CarInfo> carInfos1) { | |
| 647 | + LinggangVenueInfo venueInfo, List<Equipment> equipmentList) { | |
| 656 | 648 | BasicSyncVo vo = new BasicSyncVo(); |
| 657 | 649 | |
| 658 | 650 | vo.setDevice(equipment.getDeviceId()); |
| ... | ... | @@ -721,10 +713,10 @@ public class KeyBoxController extends BaseController { |
| 721 | 713 | }); |
| 722 | 714 | } |
| 723 | 715 | vo.setDriverWork(driverWork); |
| 724 | - if (CollectionUtils.isNotEmpty(schedulings1) && CollectionUtils.isNotEmpty(carInfos1)) { | |
| 725 | - Set<String> nbbms = schedulings1.stream().filter(s -> Objects.equals(s.getQdzcode(), venueInfo.getParkCode()) || | |
| 716 | + if (CollectionUtils.isNotEmpty(schedulings) && CollectionUtils.isNotEmpty(carInfos)) { | |
| 717 | + Set<String> nbbms = schedulings.stream().filter(s -> Objects.equals(s.getQdzcode(), venueInfo.getParkCode()) || | |
| 726 | 718 | Objects.equals(s.getZdzcode(), venueInfo.getParkCode())).map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); |
| 727 | - List<String> plateNums = carInfos1.stream().filter(c -> nbbms.contains(c.getNbbm())).map(CarInfo::getPlateNum).collect(Collectors.toList()); | |
| 719 | + List<String> plateNums = carInfos.stream().filter(c -> nbbms.contains(c.getNbbm())).map(CarInfo::getPlateNum).collect(Collectors.toList()); | |
| 728 | 720 | vo.setYardVehicles(plateNums); |
| 729 | 721 | |
| 730 | 722 | } |
| ... | ... | @@ -763,7 +755,7 @@ public class KeyBoxController extends BaseController { |
| 763 | 755 | } |
| 764 | 756 | } |
| 765 | 757 | if(Objects.nonNull(keyInfos)){ |
| 766 | - Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getKeyCode(),item.getKeyCode())).findFirst(); | |
| 758 | + Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getKeyCode(),item.getKeyCode())).findFirst(); | |
| 767 | 759 | if (optional.isPresent()) { |
| 768 | 760 | location.setKeyInfoId(optional.get().getId()); |
| 769 | 761 | }else{ | ... | ... |