| | |
| | | @ResponseBody |
| | | @PostMapping("/orderList") |
| | | @ApiOperation(value = "获取充电订单", tags = {"司机端-获取充电订单"}, notes = "") |
| | | public R<String> chargingPileList(){ |
| | | public R<String> chargingPileList(Integer pageNo, Integer pageSize){ |
| | | List<TChargingGun> chargingGun = chargingGunClient.getAllGun().getData(); |
| | | |
| | | List<ChargeOrder> result = getOrderList(); |
| | | chargingGun = chargingGun.stream().filter(e->StringUtils.hasLength(e.getConnectorID())) |
| | | .collect(Collectors.toList()); |
| | | List<ChargeOrder> result = getOrderList(pageNo, pageSize); |
| | | List<TChargingOrder> orders = new ArrayList<>(); |
| | | |
| | | List<TChargingOrderAccountingStrategy> accountingStrategies = new ArrayList<>(); |
| | |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setOrderType(1); |
| | | chargingOrder.setOrderClassification(1); |
| | | // chargingOrder.setAppUserId(1L); |
| | | // chargingOrder.setAppUserCarId(1L); |
| | | chargingOrder.setAppUserId(1939601394823290882L); |
| | | chargingOrder.setAppUserCarId(2017427572505907202L); |
| | | chargingOrder.setRefundAmount(new BigDecimal(chargeOrder.getTotalMoney())); |
| | | chargingOrder.setRechargeSerialNumber("4200002747202505247686188393"); |
| | | chargingOrder.setCouponDiscountAmount(BigDecimal.ZERO); |
| | |
| | | chargingOrder.setEndTime(DateUtils.stringToLocalDateTime(chargeOrder.getEndTime())); |
| | | chargingOrder.setStatus(5); |
| | | chargingOrder.setEndMode(1); |
| | | chargingOrder.setElectrovalence(new BigDecimal(chargeOrder.getElecMoney())); |
| | | chargingOrder.setElectrovalence(new BigDecimal(chargeOrder.getSeviceMoney()).multiply(new BigDecimal("1.19"))); |
| | | chargingOrder.setServiceCharge(new BigDecimal(chargeOrder.getSeviceMoney())); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(chargeOrder.getElecMoney())); |
| | | chargingOrder.setPaymentAmount(new BigDecimal(chargeOrder.getTotalMoney())); |
| | |
| | | chargingOrder.setOrderAmount(new BigDecimal(chargeOrder.getTotalMoney())); |
| | | chargingOrder.setResidualAmount(BigDecimal.ZERO); |
| | | chargingOrder.setPaymentAmount(new BigDecimal(chargeOrder.getTotalMoney())); |
| | | chargingOrder.setPayTime(LocalDateTime.now()); |
| | | chargingOrder.setPayTime(DateUtils.stringToLocalDateTime(chargeOrder.getStartTime())); |
| | | chargingOrder.setCreateTime(DateUtils.stringToLocalDateTime(chargeOrder.getStartTime())); |
| | | if (!StringUtils.hasLength(chargeOrder.getConnectorID())){ |
| | | continue; |
| | | } |
| | | // 通过枪编号查询枪 |
| | | TChargingGun tChargingGun = chargingGun.stream().filter(e -> e.getConnectorID().equals(chargeOrder.getConnectorID())) |
| | | TChargingGun tChargingGun = chargingGun.stream().filter(e ->chargeOrder.getConnectorID().equals(e.getConnectorID())) |
| | | .findFirst().orElse(null); |
| | | if(Objects.nonNull(tChargingGun)){ |
| | | chargingOrder.setChargingGunId(tChargingGun.getId()); |
| | |
| | | accountingStrategy.setServiceCharge(chargeDetail.getSevicePrice()); |
| | | accountingStrategy.setCostServiceCharge(chargeDetail.getDetailSeviceMoney()); |
| | | accountingStrategy.setChargingCapacity(chargeDetail.getDetailPower()); |
| | | accountingStrategy.setPeriodElectricPrice(chargeDetail.getDetailElecMoney()); |
| | | accountingStrategy.setPeriodElectricPrice(chargeDetail.getDetailSeviceMoney().multiply(new BigDecimal("1.19"))); |
| | | accountingStrategy.setCouponDiscountAmount(BigDecimal.ZERO); |
| | | accountingStrategy.setVipDiscountAmount(BigDecimal.ZERO); |
| | | accountingStrategy.setPeriodServicePrice(chargeDetail.getDetailSeviceMoney()); |
| | |
| | | } |
| | | return result; |
| | | } |
| | | private List<ChargeOrder> getOrderList(){ |
| | | String s = chargePileHttpUtil.getOrderList(1, 199); |
| | | private List<ChargeOrder> getOrderList(Integer pageNo, Integer pageSize){ |
| | | |
| | | String s = chargePileHttpUtil.getOrderList(pageNo, pageSize); |
| | | // 将s字符串转化为json 然后转化为实体类PageInfo |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | com.ruoyi.jianguan.domain.PageInfo pageInfo = JSON.parseObject(jsonObject.toJSONString(), com.ruoyi.jianguan.domain.PageInfo.class); |
| | | List<ChargeOrder> result = new ArrayList<>(); |
| | | int itemSize = pageInfo.getItemSize(); |
| | | int temp = 0; |
| | | if(itemSize>199){ |
| | | // if(itemSize>pageSize){ |
| | | // result.addAll(pageInfo.getChargeOrders()); |
| | | // int i = itemSize / pageNo; |
| | | // for (int j = 2; j < i + 2; j++) { |
| | | // s = chargePileHttpUtil.getOrderList(j, pageSize); |
| | | // // 将s字符串转化为json 然后转化为实体类PageInfo |
| | | // jsonObject = JSONObject.parseObject(s); |
| | | // pageInfo = JSON.parseObject(jsonObject.toJSONString(), com.ruoyi.jianguan.domain.PageInfo.class); |
| | | // result.addAll(pageInfo.getChargeOrders()); |
| | | // if (temp ==20){ |
| | | // break; |
| | | // } |
| | | // temp++; |
| | | // } |
| | | // }else { |
| | | result.addAll(pageInfo.getChargeOrders()); |
| | | int i = itemSize / 199; |
| | | for (int j = 2; j < i + 2; j++) { |
| | | s = chargePileHttpUtil.getOrderList(j, 199); |
| | | // 将s字符串转化为json 然后转化为实体类PageInfo |
| | | jsonObject = JSONObject.parseObject(s); |
| | | pageInfo = JSON.parseObject(jsonObject.toJSONString(), com.ruoyi.jianguan.domain.PageInfo.class); |
| | | result.addAll(pageInfo.getChargeOrders()); |
| | | if (temp==5){ |
| | | break; |
| | | } |
| | | temp++; |
| | | } |
| | | }else { |
| | | result.addAll(pageInfo.getChargeOrders()); |
| | | } |
| | | // } |
| | | return result; |
| | | } |
| | | |