Pu Zhibing
2024-10-23 c97b518d5fbb570817ca835e96c1b8aa49b099e1
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -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,20 @@
            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);
        if (byId.getAppUserCarId()!=null) {
            List<Long> carid = new ArrayList<>();
            carid.add(byId.getAppUserCarId());
            R<List<TAppUserCar>> carByIds = appUserCarClient.getCarByIds(carid);
            payOrderChargingInfo.setCarNum(carByIds.getData().get(0).getLicensePlate());
        }
        payOrderChargingInfo.setStartTime(byId.getStartTime());
        payOrderChargingInfo.setEndTime(byId.getEndTime());
        payOrderChargingInfo.setTimeCount(payOrderChargingInfo.calculateDuration());
        return R.ok(payOrderChargingInfo);
    }
    @ResponseBody
@@ -315,10 +328,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()){
@@ -331,16 +344,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);
@@ -785,7 +802,7 @@
        LocalDate end = null;
        if (statisticsQueryDto.getDayType()==1){
            start = LocalDate.now();
            end = LocalDate.now();
            end = LocalDate.now().plusDays(1);
        }else if (statisticsQueryDto.getDayType()==2){
            LocalDate today = LocalDate.now();