| | |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.ruoyi.chargingPile.api.feignClient.*; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByChargingPileIdsVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | } |
| | | return baseResult; |
| | | } |
| | | public BaseResult requestCheckJianGuan(Boolean tokenCheck, BaseRequest baseRequest, HttpServletRequest request){ |
| | | Operator operator = new Operator(); |
| | | BaseResult baseResult = new BaseResult(); |
| | | baseResult.setRet(0); |
| | | baseResult.setMsg("成功"); |
| | | baseResult.setOperatorID(baseRequest.getOperatorID()); |
| | | operator.setOperatorId(baseRequest.getOperatorID()); |
| | | Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | baseResult.setTimeStamp(mapKey); |
| | | baseResult.setSeq("0001"); |
| | | //校验token和签名 |
| | | String operatorID = baseRequest.getOperatorID(); |
| | | String sig = baseRequest.getSig(); |
| | | Long timeStamp = baseRequest.getTimeStamp(); |
| | | String data = baseRequest.getData(); |
| | | String seq = baseRequest.getSeq(); |
| | | baseResult.setOperator(operator); |
| | | if(StringUtils.isEmpty(operatorID) || StringUtils.isEmpty(sig) || StringUtils.isEmpty(data) || StringUtils.isEmpty(seq) || null == timeStamp){ |
| | | baseResult.setRet(4003); |
| | | baseResult.setMsg("参数异常"); |
| | | return baseResult; |
| | | } |
| | | return baseResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | List<Integer> siteIds = sites.stream().map(Site::getId).collect(Collectors.toList()); |
| | | List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | List<Integer> collect1 = tChargingPiles.stream().map(TChargingPile::getId).collect(Collectors.toList()); |
| | | List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(collect1).getData(); |
| | | GetChargingGunByChargingPileIdsVo vo = new GetChargingGunByChargingPileIdsVo(); |
| | | vo.setChargingPileIds(collect1); |
| | | List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(vo).getData(); |
| | | String serviceTel = systemConfigurationClient.getServerPhone().getData(); |
| | | List<StationInfo> StationInfos = new ArrayList<>(); |
| | | for (Site datum : sites) { |
| | |
| | | List<Integer> siteIds = data.stream().map(Site::getId).collect(Collectors.toList()); |
| | | List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | List<Integer> collect1 = tChargingPiles.stream().map(TChargingPile::getId).collect(Collectors.toList()); |
| | | List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(collect1).getData(); |
| | | GetChargingGunByChargingPileIdsVo vo = new GetChargingGunByChargingPileIdsVo(); |
| | | vo.setChargingPileIds(collect1); |
| | | List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(vo).getData(); |
| | | |
| | | QueryStationStatusResult result = new QueryStationStatusResult(); |
| | | result.setTotal(data.size()); |
| | |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | queryEquipChargeStatusResult.setElecMoney(totalElectricity); |
| | | queryEquipChargeStatusResult.setSeviceMoney(serviceCharge); |
| | | queryEquipChargeStatusResult.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | queryEquipChargeStatusResult.setTotalMoney(totalMoney); |
| | | }else if(null != chargingOrder.getRechargeAmount() && null != chargingOrder.getResidualAmount()){ |
| | | queryEquipChargeStatusResult.setElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | queryEquipChargeStatusResult.setSeviceMoney(BigDecimal.ZERO); |
| | |
| | | |
| | | List<TChargingOrderAccountingStrategy> data = chargingOrderAccountingStrategyClient.getChargingOrderAccountingStrategyByOrderId(chargingOrder.getId()).getData(); |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge); |
| | | notificationChargeOrderInfo.setTotalMoney(totalMoney); |
| | | }else{ |
| | | notificationChargeOrderInfo.setTotalElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(BigDecimal.ZERO); |
| | |
| | | List<TChargingPile> chargingPiles = chargingPileClient.getChargingPileBySiteIds(stationIDList).getData(); |
| | | if(!CollectionUtils.isEmpty(chargingPiles)){ |
| | | List<Integer> pileIds = chargingPiles.stream().map(TChargingPile::getId).collect(Collectors.toList()); |
| | | List<TChargingGun> chargingGuns = chargingGunClient.getChargingGunByChargingPileIds(pileIds).getData(); |
| | | GetChargingGunByChargingPileIdsVo vo = new GetChargingGunByChargingPileIdsVo(); |
| | | vo.setChargingPileIds(pileIds); |
| | | List<TChargingGun> chargingGuns = chargingGunClient.getChargingGunByChargingPileIds(vo).getData(); |
| | | if(!CollectionUtils.isEmpty(chargingGuns)){ |
| | | for (Integer stationID : stationIDList) { |
| | | StationStatusInfo stationStatusInfo = new StationStatusInfo(); |