Commit 82b2daaf4f3fedf36c9c6dbffcd9d0a3b11203b5

Authored by liujun001
1 parent a529dd89

优化导入数据

Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
@@ -195,22 +195,17 @@ public class KeyBoxController extends BaseController { @@ -195,22 +195,17 @@ public class KeyBoxController extends BaseController {
195 scheduling.setCzCode(venueInfo.getParkCode()); 195 scheduling.setCzCode(venueInfo.getParkCode());
196 scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime())); 196 scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime()));
197 scheduling.setType(1); 197 scheduling.setType(1);
  198 + scheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(scheduling.getStartScheduleDate(),1));
198 199
199 List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling); 200 List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling);
200 Set<String> jobCodes = null; 201 Set<String> jobCodes = null;
201 Set<String> nbbms = null; 202 Set<String> nbbms = null;
202 - Set<String> nbbms1 = null; 203 +
203 if (CollectionUtils.isNotEmpty(schedulings)) { 204 if (CollectionUtils.isNotEmpty(schedulings)) {
204 jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet()); 205 jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet());
205 nbbms = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); 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 List<NewDriver> drivers = queryDrive(jobCodes); 209 List<NewDriver> drivers = queryDrive(jobCodes);
215 if (CollectionUtils.isEmpty(drivers)) { 210 if (CollectionUtils.isEmpty(drivers)) {
216 logger.info("根据DTO的数据无法查询司机信息:[{}]", dto); 211 logger.info("根据DTO的数据无法查询司机信息:[{}]", dto);
@@ -220,12 +215,9 @@ public class KeyBoxController extends BaseController { @@ -220,12 +215,9 @@ public class KeyBoxController extends BaseController {
220 logger.info("根据DTO的数据无法查询车辆信息:[{}]", dto); 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 return ResponseResult.success(vo); 221 return ResponseResult.success(vo);
230 } catch (ParseException e) { 222 } catch (ParseException e) {
231 logger.error("钥匙柜基础信息同步异常:[{}]", dto, e); 223 logger.error("钥匙柜基础信息同步异常:[{}]", dto, e);
@@ -399,7 +391,7 @@ public class KeyBoxController extends BaseController { @@ -399,7 +391,7 @@ public class KeyBoxController extends BaseController {
399 List<KeyInfo> keyInfos = tempKeyInfos; 391 List<KeyInfo> keyInfos = tempKeyInfos;
400 int keyInfoSize = CollectionUtils.size(keyInfos); 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 TakeKeyPlanVo vo = convert(s); 395 TakeKeyPlanVo vo = convert(s);
404 if(keyInfoSize > 0){ 396 if(keyInfoSize > 0){
405 Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getId(),s.getKeyInfoId())).findFirst(); 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,7 +445,7 @@ public class KeyBoxController extends BaseController {
453 if (CollectionUtils.isEmpty(locations)) { 445 if (CollectionUtils.isEmpty(locations)) {
454 return ResponseResult.success(); 446 return ResponseResult.success();
455 } 447 }
456 - Date date = DateUtil.shortDate(new Date()); 448 + Date date = DateUtil.shortDate(new Date());
457 location.setType(255); 449 location.setType(255);
458 location.setStartScheduleDate(DateUtil.shortDate(new Date())); 450 location.setStartScheduleDate(DateUtil.shortDate(new Date()));
459 int errorCount = linggangKeyWorkLocationService.countId(location); 451 int errorCount = linggangKeyWorkLocationService.countId(location);
@@ -652,7 +644,7 @@ public class KeyBoxController extends BaseController { @@ -652,7 +644,7 @@ public class KeyBoxController extends BaseController {
652 644
653 private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings, 645 private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings,
654 List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment, 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 BasicSyncVo vo = new BasicSyncVo(); 648 BasicSyncVo vo = new BasicSyncVo();
657 649
658 vo.setDevice(equipment.getDeviceId()); 650 vo.setDevice(equipment.getDeviceId());
@@ -721,10 +713,10 @@ public class KeyBoxController extends BaseController { @@ -721,10 +713,10 @@ public class KeyBoxController extends BaseController {
721 }); 713 });
722 } 714 }
723 vo.setDriverWork(driverWork); 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 Objects.equals(s.getZdzcode(), venueInfo.getParkCode())).map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); 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 vo.setYardVehicles(plateNums); 720 vo.setYardVehicles(plateNums);
729 721
730 } 722 }
@@ -763,7 +755,7 @@ public class KeyBoxController extends BaseController { @@ -763,7 +755,7 @@ public class KeyBoxController extends BaseController {
763 } 755 }
764 } 756 }
765 if(Objects.nonNull(keyInfos)){ 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 if (optional.isPresent()) { 759 if (optional.isPresent()) {
768 location.setKeyInfoId(optional.get().getId()); 760 location.setKeyInfoId(optional.get().getId());
769 }else{ 761 }else{