From 0cffe10d0563f7e2c98b4eca1467699244051b07 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期一, 21 十月 2024 13:43:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 73 +++++++++++++++++++++++++++++++----- 1 files changed, 62 insertions(+), 11 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 6f1dfab..7dada05 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -310,17 +310,36 @@ @PostMapping(value = "/chargingOrderInfo") @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"}) public AjaxResult<ChargingOrderInfoVO> chargingOrderInfo(String orderId) { + TChargingOrder byId = chargingOrderService.getById(orderId); ChargingOrderInfoVO chargingOrderInfoVO = new ChargingOrderInfoVO(); - chargingOrderInfoVO.setCdElectronic(""); - chargingOrderInfoVO.setCdVoltage(""); - chargingOrderInfoVO.setSurplus(""); - chargingOrderInfoVO.setTotalPower(""); - chargingOrderInfoVO.setLicensePlate(""); - chargingOrderInfoVO.setVehicleBrand(""); - chargingOrderInfoVO.setVehicleModel(""); - chargingOrderInfoVO.setVehicleUse(""); - List<TChargingOrderAccountingStrategy> tChargingOrderAccountingStrategies = new ArrayList<>(); - chargingOrderInfoVO.setList(tChargingOrderAccountingStrategies); + chargingOrderInfoVO.setCdElectronic(byId.getCurrent()+""); + chargingOrderInfoVO.setCdVoltage(byId.getVoltage()+""); + chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()+""); + chargingOrderInfoVO.setTotalPower(byId.getPower()+""); + if (byId.getAppUserCarId()!=null){ + List<TAppUserCar> data = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); + if (!data.isEmpty()){ + chargingOrderInfoVO.setLicensePlate(data.get(0).getLicensePlate()); + chargingOrderInfoVO.setVehicleBrand(data.get(0).getVehicleBrand()); + chargingOrderInfoVO.setVehicleModel(data.get(0).getVehicleModel()); + chargingOrderInfoVO.setVehicleUse(data.get(0).getVehicleUse()); + } + } + // 时段总服务费 + BigDecimal bigDecimal = new BigDecimal("0"); + List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); + for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { + bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); + tChargingOrderAccountingStrategy.setVipDiscount( + tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() + .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) + ); + tChargingOrderAccountingStrategy.setCouponDiscount( + tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() + .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) + ); + } + chargingOrderInfoVO.setList(list); return AjaxResult.success(chargingOrderInfoVO); } @@ -927,7 +946,39 @@ startDate = startDate.plusDays(1); } - tCharingUserMapVO.setMap(map); + tCharingUserMapVO.setMap(dateRangeStatistics); + + + List<Map<String,Object>> map1 = chargingOrderService.usersByQuery(statisticsQueryDto); + + + + + List<Map<String, Object>> dateRangeStatistics1 = new ArrayList<>(); + + // 遍历日期范围 + while (!startDate.isAfter(endDate)) { + String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Map<String, Object> dailyStats = findMapWithDateValue(map1, formattedDate); + + if (dailyStats != null) { + dateRangeStatistics1.add(dailyStats); + } else { + Map<String, Object> dateMap = new HashMap<>(); + dateMap.put("time", formattedDate); + dateMap.put("counts", 0); + dateRangeStatistics1.add(dateMap); + } + + // 移动到下一天 + startDate = startDate.plusDays(1); + } + + tCharingUserMapVO.setMap1(dateRangeStatistics1); + + + + } //用户标签 -- Gitblit v1.7.1