| | |
| | | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) { |
| | | List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId); |
| | | LambdaQueryWrapper<TChargingGun> wrapper = new LambdaQueryWrapper<>(); |
| | | if(Objects.nonNull(type)){ |
| | | wrapper.eq(TChargingGun::getChargeMode, type); |
| | | } |
| | | wrapper.eq(TChargingGun::getSiteId, siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); |
| | | for (TChargingGun chargingGun : chargingGunList) { |
| | | if(chargingGun.getStatus().equals(4)){ |
| | | // 查询正在充电的单子的实时记录 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if(null != uploadRealTimeMonitoringData){ |
| | | chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); |
| | | }else{ |
| | | chargingGun.setSoc(0); |
| | | Set<Integer> collect = chargingGuns.stream().map(TChargingGun::getChargingPileId).collect(Collectors.toSet()); |
| | | List<TChargingPileVO> chargingPileVOS = new ArrayList<>(); |
| | | if(collect.size() > 0){ |
| | | List<TChargingPile> tChargingPiles = this.baseMapper.selectBatchIds(collect); |
| | | for (TChargingPile tChargingPile : tChargingPiles) { |
| | | TChargingPileVO vo = new TChargingPileVO(); |
| | | List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(tChargingPile.getId())).collect(Collectors.toList()); |
| | | for (TChargingGun chargingGun : chargingGunList) { |
| | | if(chargingGun.getStatus().equals(4)){ |
| | | // 查询正在充电的单子的实时记录 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if(null != uploadRealTimeMonitoringData){ |
| | | chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); |
| | | }else{ |
| | | chargingGun.setSoc(0); |
| | | } |
| | | }else { |
| | | chargingGun.setSoc(100); |
| | | } |
| | | }else { |
| | | } |
| | | if(chargingGun.getStatus().equals(5)){ |
| | | chargingGun.setSoc(100); |
| | | } |
| | | } |
| | | if(chargingGun.getStatus().equals(5)){ |
| | | chargingGun.setSoc(100); |
| | | } |
| | | vo.setChargingGunList(chargingGunList); |
| | | vo.setId(tChargingPile.getId()); |
| | | vo.setCode(tChargingPile.getCode()); |
| | | vo.setName(tChargingPile.getName()); |
| | | vo.setNumber(tChargingPile.getNumber()); |
| | | chargingPileVOS.add(vo); |
| | | |
| | | } |
| | | item.setChargingGunList(chargingGunList); |
| | | }); |
| | | } |
| | | return chargingPileVOS; |
| | | } |
| | | |