Commit bdc1a9f19e7fbc3104dc40b2fc055f3bddad17b4
1 parent
c469c2f0
设备和场地
Showing
4 changed files
with
78 additions
and
7 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| @@ -234,7 +234,9 @@ public class KeyBoxController extends BaseController { | @@ -234,7 +234,9 @@ public class KeyBoxController extends BaseController { | ||
| 234 | entity.setDevice(dto.getDevice()); | 234 | entity.setDevice(dto.getDevice()); |
| 235 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); | 235 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); |
| 236 | 236 | ||
| 237 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings); | 237 | + NewDriver driver = newDriverService.getOne(dto.getDriverCode()); |
| 238 | + | ||
| 239 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings,driver); | ||
| 238 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT); | 240 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT); |
| 239 | if (Objects.isNull(responseResult)) { | 241 | if (Objects.isNull(responseResult)) { |
| 240 | return ResponseResult.error(); | 242 | return ResponseResult.error(); |
| @@ -254,7 +256,9 @@ public class KeyBoxController extends BaseController { | @@ -254,7 +256,9 @@ public class KeyBoxController extends BaseController { | ||
| 254 | entity.setDevice(dto.getDevice()); | 256 | entity.setDevice(dto.getDevice()); |
| 255 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); | 257 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); |
| 256 | 258 | ||
| 257 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings); | 259 | + NewDriver driver = newDriverService.getOne(dto.getDriverCode()); |
| 260 | + | ||
| 261 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings,driver); | ||
| 258 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); | 262 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); |
| 259 | if (Objects.isNull(responseResult)) { | 263 | if (Objects.isNull(responseResult)) { |
| 260 | return ResponseResult.error(); | 264 | return ResponseResult.error(); |
| @@ -554,7 +558,7 @@ public class KeyBoxController extends BaseController { | @@ -554,7 +558,7 @@ public class KeyBoxController extends BaseController { | ||
| 554 | return vo; | 558 | return vo; |
| 555 | } | 559 | } |
| 556 | 560 | ||
| 557 | - private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings) { | 561 | + private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings,NewDriver driver) { |
| 558 | if (CollectionUtils.isEmpty(dto.getKeyItem())) { | 562 | if (CollectionUtils.isEmpty(dto.getKeyItem())) { |
| 559 | return Collections.emptyList(); | 563 | return Collections.emptyList(); |
| 560 | } | 564 | } |
| @@ -573,6 +577,9 @@ public class KeyBoxController extends BaseController { | @@ -573,6 +577,9 @@ public class KeyBoxController extends BaseController { | ||
| 573 | } | 577 | } |
| 574 | } | 578 | } |
| 575 | 579 | ||
| 580 | + location.setCreateBy(Convert.toLong(driver.getId())); | ||
| 581 | + location.setCreateTime(new Date()); | ||
| 582 | + | ||
| 576 | return location; | 583 | return location; |
| 577 | }).filter(obj -> Objects.nonNull(obj.getKeyInfoId())).collect(Collectors.toList()); | 584 | }).filter(obj -> Objects.nonNull(obj.getKeyInfoId())).collect(Collectors.toList()); |
| 578 | } | 585 | } |
Bsth-admin/src/main/java/com/ruoyi/service/driver/NewDriverService.java
| @@ -48,6 +48,8 @@ public interface NewDriverService extends IService<NewDriver> { | @@ -48,6 +48,8 @@ public interface NewDriverService extends IService<NewDriver> { | ||
| 48 | */ | 48 | */ |
| 49 | NewDriver getOne(NewDriver entity); | 49 | NewDriver getOne(NewDriver entity); |
| 50 | 50 | ||
| 51 | + NewDriver getOne(String jobCode); | ||
| 52 | + | ||
| 51 | Integer countId(NewDriver entity); | 53 | Integer countId(NewDriver entity); |
| 52 | 54 | ||
| 53 | /** | 55 | /** |
Bsth-admin/src/main/java/com/ruoyi/service/impl/driver/NewDriverServiceImpl.java
| @@ -139,6 +139,13 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | @@ -139,6 +139,13 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | ||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | @Override | 141 | @Override |
| 142 | + public NewDriver getOne(String jobCode) { | ||
| 143 | + LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(); | ||
| 144 | + wrapper.eq(NewDriver::getJobCode,jobCode); | ||
| 145 | + return getOne(wrapper); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + @Override | ||
| 142 | public Integer countId(NewDriver entity) { | 149 | public Integer countId(NewDriver entity) { |
| 143 | LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(entity); | 150 | LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(entity); |
| 144 | wrapper.select(NewDriver::getJobCode); | 151 | wrapper.select(NewDriver::getJobCode); |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| 1 | package com.ruoyi.service.impl.key.location; | 1 | package com.ruoyi.service.impl.key.location; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.convert.Convert; | ||
| 3 | import com.alibaba.fastjson2.JSON; | 4 | import com.alibaba.fastjson2.JSON; |
| 5 | +import com.alibaba.fastjson2.JSONArray; | ||
| 6 | +import com.alibaba.fastjson2.JSONObject; | ||
| 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 8 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 6 | import com.baomidou.mybatisplus.core.metadata.IPage; | 9 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| @@ -11,6 +14,7 @@ import com.ruoyi.common.TipEnum; | @@ -11,6 +14,7 @@ import com.ruoyi.common.TipEnum; | ||
| 11 | import com.ruoyi.common.core.domain.ResponseResult; | 14 | import com.ruoyi.common.core.domain.ResponseResult; |
| 12 | import com.ruoyi.domain.OrderEntity; | 15 | import com.ruoyi.domain.OrderEntity; |
| 13 | import com.ruoyi.domain.caiinfo.CarInfo; | 16 | import com.ruoyi.domain.caiinfo.CarInfo; |
| 17 | +import com.ruoyi.domain.equipment.heartbeat.LingangEquipmentHeartbeat; | ||
| 14 | import com.ruoyi.domain.key.info.KeyInfo; | 18 | import com.ruoyi.domain.key.info.KeyInfo; |
| 15 | import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | 19 | import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; |
| 16 | import com.ruoyi.domain.scheduling.LinggangScheduling; | 20 | import com.ruoyi.domain.scheduling.LinggangScheduling; |
| @@ -19,6 +23,7 @@ import com.ruoyi.equipment.domain.Equipment; | @@ -19,6 +23,7 @@ import com.ruoyi.equipment.domain.Equipment; | ||
| 19 | import com.ruoyi.equipment.service.IEquipmentService; | 23 | import com.ruoyi.equipment.service.IEquipmentService; |
| 20 | import com.ruoyi.mapper.key.location.LinggangKeyWorkLocationMapper; | 24 | import com.ruoyi.mapper.key.location.LinggangKeyWorkLocationMapper; |
| 21 | import com.ruoyi.service.carinfo.CarInfoService; | 25 | import com.ruoyi.service.carinfo.CarInfoService; |
| 26 | +import com.ruoyi.service.equipment.heartbeat.LingangEquipmentHeartbeatService; | ||
| 22 | import com.ruoyi.service.key.info.KeyInfoService; | 27 | import com.ruoyi.service.key.info.KeyInfoService; |
| 23 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | 28 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| 24 | import com.ruoyi.service.scheduling.LinggangSchedulingService; | 29 | import com.ruoyi.service.scheduling.LinggangSchedulingService; |
| @@ -57,6 +62,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -57,6 +62,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 57 | private IEquipmentService equipmentService; | 62 | private IEquipmentService equipmentService; |
| 58 | @Autowired | 63 | @Autowired |
| 59 | private CarInfoService carInfoService; | 64 | private CarInfoService carInfoService; |
| 65 | + @Autowired | ||
| 66 | + private LingangEquipmentHeartbeatService equipmentHeartbeatService; | ||
| 60 | 67 | ||
| 61 | private static final String TAKE_KEY_MSG = "设备号:{0},钥匙编号:{1},在{2}的状态已经是:{3},无需在操作"; | 68 | private static final String TAKE_KEY_MSG = "设备号:{0},钥匙编号:{1},在{2}的状态已经是:{3},无需在操作"; |
| 62 | private static final String TAKE_KEY_SUCESS = "设备号:{0},钥匙编号:{1},在{2}的状已经更新成功"; | 69 | private static final String TAKE_KEY_SUCESS = "设备号:{0},钥匙编号:{1},在{2}的状已经更新成功"; |
| @@ -104,7 +111,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -104,7 +111,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 104 | @Override | 111 | @Override |
| 105 | public List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity) { | 112 | public List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity) { |
| 106 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); | 113 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); |
| 107 | - switchTime(entity,wrapper); | 114 | + switchTime(entity, wrapper); |
| 108 | return list(wrapper); | 115 | return list(wrapper); |
| 109 | } | 116 | } |
| 110 | 117 | ||
| @@ -187,7 +194,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -187,7 +194,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 187 | public Integer countId(LinggangKeyWorkLocation entity) { | 194 | public Integer countId(LinggangKeyWorkLocation entity) { |
| 188 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); | 195 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); |
| 189 | wrapper.select(LinggangKeyWorkLocation::getId); | 196 | wrapper.select(LinggangKeyWorkLocation::getId); |
| 190 | - switchTime(entity,wrapper); | 197 | + switchTime(entity, wrapper); |
| 191 | return count(wrapper); | 198 | return count(wrapper); |
| 192 | } | 199 | } |
| 193 | 200 | ||
| @@ -284,7 +291,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -284,7 +291,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 284 | 291 | ||
| 285 | public boolean update(LinggangKeyWorkLocation location) { | 292 | public boolean update(LinggangKeyWorkLocation location) { |
| 286 | LambdaUpdateWrapper<LinggangKeyWorkLocation> wrapper = new LambdaUpdateWrapper<>(); | 293 | LambdaUpdateWrapper<LinggangKeyWorkLocation> wrapper = new LambdaUpdateWrapper<>(); |
| 287 | - wrapper.set(LinggangKeyWorkLocation::getEventType, location.getEventType()).set(LinggangKeyWorkLocation::getUpdateTime, new Date()).set(LinggangKeyWorkLocation::getType,location.getType()); | 294 | + wrapper.set(LinggangKeyWorkLocation::getEventType, location.getEventType()).set(LinggangKeyWorkLocation::getUpdateTime, new Date()).set(LinggangKeyWorkLocation::getType, location.getType()); |
| 288 | wrapper.eq(LinggangKeyWorkLocation::getId, location.getId()).ne(LinggangKeyWorkLocation::getType, location.getType()); | 295 | wrapper.eq(LinggangKeyWorkLocation::getId, location.getId()).ne(LinggangKeyWorkLocation::getType, location.getType()); |
| 289 | 296 | ||
| 290 | return update(wrapper); | 297 | return update(wrapper); |
| @@ -586,7 +593,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -586,7 +593,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 586 | continue; | 593 | continue; |
| 587 | } | 594 | } |
| 588 | if (Objects.isNull(equipment.getLatticeNumberSet())) { | 595 | if (Objects.isNull(equipment.getLatticeNumberSet())) { |
| 589 | - equipment.setLatticeNumberSet(new HashSet<>(equipment.getLatticeNumber())); | 596 | + equipment.setLatticeNumberSet(combationLattice(equipment)); |
| 590 | } | 597 | } |
| 591 | 598 | ||
| 592 | number = RandomUtils.nextInt(1, equipment.getLatticeNumber()); | 599 | number = RandomUtils.nextInt(1, equipment.getLatticeNumber()); |
| @@ -644,6 +651,54 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -644,6 +651,54 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 644 | return schedulings; | 651 | return schedulings; |
| 645 | } | 652 | } |
| 646 | 653 | ||
| 654 | + private Set<Integer> combationLattice(Equipment equipment) { | ||
| 655 | + if (Objects.isNull(equipment)) { | ||
| 656 | + return null; | ||
| 657 | + } | ||
| 658 | + if (CollectionUtils.isNotEmpty(equipment.getLatticeNumberSet())) { | ||
| 659 | + return equipment.getLatticeNumberSet(); | ||
| 660 | + } | ||
| 661 | + | ||
| 662 | + Set<Integer> latticeNumber = new HashSet<>(); | ||
| 663 | + | ||
| 664 | + LingangEquipmentHeartbeat heartbeat = new LingangEquipmentHeartbeat(); | ||
| 665 | + heartbeat.setDevice(equipment.getDeviceId()); | ||
| 666 | + IPage<LingangEquipmentHeartbeat> heartbeatIPage = equipmentHeartbeatService.pageList(new Page<>(1, 1), heartbeat, new OrderEntity()); | ||
| 667 | + if (Objects.nonNull(heartbeatIPage) && CollectionUtils.isNotEmpty(heartbeatIPage.getRecords())) { | ||
| 668 | + heartbeatIPage.getRecords().stream().forEach(hb -> { | ||
| 669 | + if (StringUtils.isNotEmpty(hb.getExkeys())) { | ||
| 670 | + JSONArray jsonArray = JSONArray.parseArray(hb.getExkeys()); | ||
| 671 | + if (CollectionUtils.isNotEmpty(jsonArray)) { | ||
| 672 | + jsonArray.stream().forEach(object -> { | ||
| 673 | + if (object instanceof JSONObject) { | ||
| 674 | + JSONObject jo = (JSONObject) object; | ||
| 675 | + Object value = jo.get("key"); | ||
| 676 | + if (Objects.nonNull(value)) { | ||
| 677 | + latticeNumber.add(Convert.toInt(value)); | ||
| 678 | + } | ||
| 679 | + } | ||
| 680 | + }); | ||
| 681 | + } | ||
| 682 | + | ||
| 683 | + } | ||
| 684 | + }); | ||
| 685 | + } | ||
| 686 | + | ||
| 687 | + LinggangKeyWorkLocation location = new LinggangKeyWorkLocation(); | ||
| 688 | + location.setDevice(equipment.getDeviceId()); | ||
| 689 | + location.setType(2); | ||
| 690 | + | ||
| 691 | + | ||
| 692 | + List<LinggangKeyWorkLocation> locations = list(location); | ||
| 693 | + if (CollectionUtils.isNotEmpty(locations)) { | ||
| 694 | + locations.stream().forEach(l -> { | ||
| 695 | + latticeNumber.add(Convert.toInt(l.getCabinetNo())); | ||
| 696 | + }); | ||
| 697 | + } | ||
| 698 | + | ||
| 699 | + return latticeNumber; | ||
| 700 | + } | ||
| 701 | + | ||
| 647 | private List<LinggangVenueInfo> queryVenueInfo(List<LinggangScheduling> schedulings) { | 702 | private List<LinggangVenueInfo> queryVenueInfo(List<LinggangScheduling> schedulings) { |
| 648 | Set<String> zdzCode = schedulings.stream().map(LinggangScheduling::getZdzcode).collect(Collectors.toSet()); | 703 | Set<String> zdzCode = schedulings.stream().map(LinggangScheduling::getZdzcode).collect(Collectors.toSet()); |
| 649 | List<LinggangVenueInfo> venueInfos = venueInfoService.listOfCodes(zdzCode); | 704 | List<LinggangVenueInfo> venueInfos = venueInfoService.listOfCodes(zdzCode); |