luodangjia
2024-08-31 2e43d137c7832e149f3df4145aa7fcca2153ef9c
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -1,4 +1,6 @@
package com.ruoyi.order.controller;
import com.google.common.collect.Lists;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalDate;
@@ -35,6 +37,7 @@
import com.ruoyi.order.api.model.*;
import com.ruoyi.order.api.query.ChargingOrderQuery;
import com.ruoyi.order.api.query.TChargingCountQuery;
import com.ruoyi.order.api.vo.ChargingOrderInfoVO;
import com.ruoyi.order.api.vo.ChargingOrderVO;
import com.ruoyi.order.api.vo.TCharingOrderVO;
import com.ruoyi.order.dto.GetMyChargingOrderList;
@@ -65,6 +68,7 @@
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
@@ -87,20 +91,18 @@
    private TokenService tokenService;
    @Autowired
    private TOrderEvaluateService orderEvaluateService;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private RedisService redisService;
    @Resource
    private AliPaymentClient aliPaymentClient;
    @Resource
    private TShoppingOrderService shoppingOrderService;
    @Autowired
    private AppUserClient appUserClient;
    @Resource
    private TVipOrderService vipOrderService;
@@ -124,9 +126,10 @@
    @Resource
    private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
    @Resource
    private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
    @ResponseBody
    @PostMapping(value = "/pay/order/list")
@@ -186,11 +189,12 @@
//                    payOrderInfoDto3.setRefundAmount(new BigDecimal("0"));
        }
            }
        return R.ok();
    }
    @ResponseBody
    @GetMapping(value = "/pay/order/refund/detail")
    @ApiOperation(value = "退款信息", tags = {"管理后台-支付订单-订单信息"})
@@ -223,8 +227,10 @@
        payOrderChargingInfo.setChargingName(data1.getName());
        TChargingGun data2 = chargingGunClient.getChargingGunById(byId.getChargingGunId()).getData();
        payOrderChargingInfo.setGunName(data2.getName());
        List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData();
        payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate());
        if (byId.getAppUserCarId()!=null) {
            List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData();
            payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate());
        }
        return R.ok();
    }
@@ -237,6 +243,7 @@
    }
    @ResponseBody
    @PostMapping(value = "/pay/order/refund/list")
    @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-退款订单"})
@@ -244,6 +251,9 @@
        return chargingOrderService.getRefundList(chargingRefundDto);
    }
    @ResponseBody
@@ -259,9 +269,19 @@
    @ResponseBody
    @PostMapping(value = "/chargingOrderInfo")
    @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"})
    public AjaxResult<TCharingOrderVO> chargingOrderInfo(String orderId) {
        return AjaxResult.success();
    public AjaxResult<ChargingOrderInfoVO> chargingOrderInfo(String 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);
        return AjaxResult.success(chargingOrderInfoVO);
    }
    @ResponseBody
@@ -272,9 +292,9 @@
        orderEvaluateService.addOrderEvaluate(dto);
        return AjaxResult.success();
    }
    /**
     * 查询用户最近一次充电记录使用的车辆
     *
     * @param
     * @return
     */
@@ -283,11 +303,11 @@
        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>()
                .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserId())
                .isNotNull(TChargingOrder::getAppUserCarId));
        if (!list.isEmpty()) {
        if (!list.isEmpty()){
            // 最近使用的车辆id
            Long size = list.get(0).getAppUserCarId();
            return R.ok(size);
        } else {
        }else{
            return R.ok(-1L);
        }
    }
@@ -305,7 +325,6 @@
                .between(TChargingOrder::getStartTime, req.getStartTime(), req.getEndTime())).size();
        return R.ok(size);
    }
    //用户订单数量
    @PostMapping(value = "/useOrderCount")
    public R<Long> useOrderCount(@RequestParam("userId") Long userId) {
@@ -313,7 +332,6 @@
        return R.ok(count);
    }
    //订单详情
    @PostMapping(value = "/detail")
    public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) {
@@ -345,8 +363,10 @@
                .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3));
        return R.ok(one);
    }
    @ResponseBody
    @GetMapping(value = "/getMyChargingOrderList")
    @ApiOperation(value = "获取充电记录列表", tags = {"小程序-充电记录"})
@@ -354,8 +374,8 @@
        Map<String, Object> orderList = chargingOrderService.getMyChargingOrderList(query);
        return AjaxResult.success(orderList);
    }
    @ResponseBody
    @GetMapping(value = "/getMyChargingOrderInfo")
    @ApiOperation(value = "获取充电记订单明细", tags = {"小程序-充电记录"})
@@ -363,8 +383,9 @@
        MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo(id);
        return AjaxResult.success(myChargingOrderInfo);
    }
    @ResponseBody
    @GetMapping(value = "/getNoInvoicedOrder")
    @ApiOperation(value = "获取未开票的订单数据", tags = {"小程序-充电发票"})
@@ -372,15 +393,16 @@
        List<MyChargingOrderList> list = chargingOrderService.getNoInvoicedOrder(query);
        return AjaxResult.success(list);
    }
    @ResponseBody
    @PostMapping(value = "/paymentChargingOrder")
    @ApiOperation(value = "支付充电充值费用", tags = {"小程序-扫一扫"})
    public AjaxResult paymentChargingOrder(@RequestBody AddChargingOrder addChargingOrder) {
        return chargingOrderService.paymentChargingOrder(addChargingOrder);
    }
    /**
     * 充电充值支付回调
     * @param request
@@ -435,8 +457,9 @@
        Object cacheObject = redisService.getCacheObject(key);
        return AjaxResult.success(cacheObject);
    }
    @ResponseBody
    @GetMapping(value = "/getChargingDetails/{id}")
    @ApiOperation(value = "获取充电中页面数据", tags = {"小程序-扫一扫"})