From 59c5450e074572a607908986f8dc2e6dbd1151d5 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 23 十月 2024 18:49:22 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 58 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 19 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 afa1ff4..b5458b9 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 @@ -181,7 +181,7 @@ payOrderInfoDto.setTradeNo(byId.getRechargeSerialNumber()); payOrderInfoDto.setPayType(byId.getRechargePaymentType()); payOrderInfoDto.setPayAmount(byId.getPaymentAmount()); - payOrderInfoDto.setPayTime(byId.getPayTime()); + payOrderInfoDto.setPayTime(byId.getCreateTime()); payOrderInfoDto.setRefundAmount(byId.getRefundAmount()); return R.ok(payOrderInfoDto); case 2: @@ -192,7 +192,7 @@ payOrderInfoDto1.setTradeNo(byId1.getSerialNumber()); payOrderInfoDto1.setPayType(byId1.getPaymentType()); payOrderInfoDto1.setPayAmount(byId1.getPaymentAmount()); - payOrderInfoDto1.setPayTime(byId1.getPayTime()); + payOrderInfoDto1.setPayTime(byId1.getCreateTime()); payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount()); return R.ok(payOrderInfoDto1); case 3: @@ -203,7 +203,7 @@ payOrderInfoDto2.setTradeNo(byId2.getSerialNumber()); payOrderInfoDto2.setPayType(byId2.getPaymentType()); payOrderInfoDto2.setPayAmount(byId2.getPaymentAmount()); - payOrderInfoDto2.setPayTime(byId2.getPayTime()); + payOrderInfoDto2.setPayTime(byId2.getCreateTime()); payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount()); return R.ok(payOrderInfoDto2); //todo luo 停车场订单 @@ -248,7 +248,7 @@ @ResponseBody @GetMapping(value = "/pay/order/charging") @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-订单信息"}) - public R refundDetail(Long orderId) { + public R<PayOrderChargingInfo> refundDetail(Long orderId) { PayOrderChargingInfo payOrderChargingInfo = new PayOrderChargingInfo(); TChargingOrder byId = chargingOrderService.getById(orderId); List<Site> data = siteClient.getSiteByIds(Collections.singletonList(byId.getSiteId())).getData(); @@ -261,7 +261,15 @@ List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate()); } - return R.ok(); + payOrderChargingInfo.setTChargingOrder(byId); + + Long count = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).count(); + payOrderChargingInfo.setPeriodCount(count); + List<Long> carid = new ArrayList<>(); + carid.add(byId.getAppUserCarId()); + R<List<TAppUserCar>> carByIds = appUserCarClient.getCarByIds(carid); + payOrderChargingInfo.setCarNum(carByIds.getData().get(0).getLicensePlate()); + return R.ok(payOrderChargingInfo); } @ResponseBody @@ -278,7 +286,11 @@ @PostMapping(value = "/pay/order/refund/list") @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"}) public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) { - return chargingOrderService.getRefundList(chargingRefundDto); + R<PageInfo<TChargingOrderRefund>> refundList = chargingOrderService.getRefundList(chargingRefundDto); + for (TChargingOrderRefund record : refundList.getData().getRecords()) { + record.setUid(record.getId().toString()); + } + return refundList; } @ResponseBody @@ -311,10 +323,10 @@ TChargingOrder byId = chargingOrderService.getById(strategyId); ChargingOrderInfoVO chargingOrderInfoVO = new ChargingOrderInfoVO(); - chargingOrderInfoVO.setCdElectronic(byId.getCurrent()!=null?byId.getCurrent()+"":""); - chargingOrderInfoVO.setCdVoltage(byId.getVoltage()!=null?byId.getVoltage()+"":""); - chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity()+"":""); - chargingOrderInfoVO.setTotalPower(byId.getPower()!=null?byId.getPower()+"":""); + chargingOrderInfoVO.setCdElectronic(byId.getCurrent()!=null?byId.getCurrent().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); + chargingOrderInfoVO.setCdVoltage(byId.getVoltage()!=null?byId.getVoltage().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); + chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); + chargingOrderInfoVO.setTotalPower(byId.getPower()!=null?byId.getPower().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); if (byId.getAppUserCarId()!=null){ List<TAppUserCar> data = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); if (!data.isEmpty()){ @@ -327,16 +339,20 @@ // 时段总服务费 BigDecimal bigDecimal = new BigDecimal("0"); List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); + for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { + if (byId.getVipDiscountAmount()!=null){ + BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) + .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); + tChargingOrderAccountingStrategy.setVipDiscount(multiply); + } bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); - tChargingOrderAccountingStrategy.setVipDiscount( - tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() - .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) - ); - tChargingOrderAccountingStrategy.setCouponDiscount( - tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() - .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) - ); + + if (byId.getCouponDiscountAmount()!=null){ + BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) + .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); + tChargingOrderAccountingStrategy.setCouponDiscount(multiply); + } } chargingOrderInfoVO.setList(list); return AjaxResult.success(chargingOrderInfoVO); @@ -781,19 +797,23 @@ LocalDate end = null; if (statisticsQueryDto.getDayType()==1){ start = LocalDate.now(); + end = LocalDate.now().plusDays(1); }else if (statisticsQueryDto.getDayType()==2){ LocalDate today = LocalDate.now(); // 获取本周一的日期 LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); + start = statisticsQueryDto.getStartTime(); + end = statisticsQueryDto.getEndTime(); System.out.println("本周一是: " + mondayThisWeek); } else if (statisticsQueryDto.getDayType()==3){ // 获取当前日期 LocalDate today = LocalDate.now(); - + start = statisticsQueryDto.getStartTime(); + end = statisticsQueryDto.getEndTime(); // 获取本月1号的日期 YearMonth yearMonth = YearMonth.from(today); // start = yearMonth.atDay(1); -- Gitblit v1.7.1