无关风月
2025-02-13 8236caa8042288fcb9b584c21d6157f713183626
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -21,6 +21,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.dto.ChargingOrderGroup;
import com.ruoyi.common.core.dto.ChargingPercentProvinceDto;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.BasePojo;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.annotation.Logical;
@@ -371,6 +372,8 @@
        if (byId.getAppUserCarId()!=null) {
            List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData();
            payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate());
        }else{
            payOrderChargingInfo.setCarNum(byId.getPlateNum());
        }
        payOrderChargingInfo.setTChargingOrder(byId);
@@ -381,6 +384,8 @@
            carid.add(byId.getAppUserCarId());
            R<List<TAppUserCar>> carByIds = appUserCarClient.getCarByIds(carid);
            payOrderChargingInfo.setCarNum(carByIds.getData().get(0).getLicensePlate());
        }else{
            payOrderChargingInfo.setCarNum(byId.getPlateNum());
        }
        payOrderChargingInfo.setStartTime(byId.getStartTime());
        payOrderChargingInfo.setEndTime(byId.getEndTime());
@@ -529,6 +534,8 @@
                chargingOrderInfoVO.setVehicleModel(data.getVehicleModel());
                chargingOrderInfoVO.setVehicleUse(data.getVehicleUse());
            }
        }else{
            chargingOrderInfoVO.setLicensePlate(byId.getPlateNum());
        }
        // 时段总服务费
        List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
@@ -628,6 +635,27 @@
        List<ChargingOrderGroup> groups = chargingOrderService.chargingOrderGroup(chargingPercentProvinceDto);
        return R.ok(groups);
    }
    /**
     * 根据站点id和时间区间查询订单数据
     * @param chargingPercentProvinceDto
     * @return
     */
    @PostMapping(value = "/getOrderBySiteIdAndTime")
    public R<List<TChargingOrder>> getOrderBySiteIdAndTime(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){
        LocalDate date1 = chargingPercentProvinceDto.getDate1();
        LocalDate date2 = chargingPercentProvinceDto.getDate2();
        String tripartitePlatformName = chargingPercentProvinceDto.getTripartitePlatformName();
        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().in(TChargingOrder::getSiteId, chargingPercentProvinceDto.getSiteIds())
                .between(null != date1 && null != date2, TChargingOrder::getPayTime, date1.atTime(0, 0, 0), date2.atTime(23, 59, 59))
                .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 5)
                .eq(StringUtils.isNotEmpty(tripartitePlatformName), TChargingOrder::getOrderSource, 2)
                .eq(StringUtils.isNotEmpty(tripartitePlatformName), TChargingOrder::getTripartitePlatformName, tripartitePlatformName));
        return R.ok(list);
    }
    /**
     * 根据充电枪id获取正在进行中的订单
@@ -2093,4 +2121,81 @@
        return R.ok(list);
    }
    
    /**
     * 根据车牌号查询指定时间范围内的数据
     * @param plateNum
     * @param startTime
     * @param endTime
     * @return
     */
    @PostMapping("/getCarChargingOrderByPlateNum")
    public R<List<TChargingOrder>> getCarChargingOrderByPlateNum(@RequestParam("plateNum") String plateNum, @RequestParam("startTime") String startTime,
                                                          @RequestParam("endTime") String endTime){
        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getPlateNum, plateNum).eq(TChargingOrder::getDelFlag, 0)
                .in(TChargingOrder::getStatus, Arrays.asList(4, 5)).between(TChargingOrder::getStartTime, startTime, endTime));
        return R.ok(list);
    }
    /**
     * 添加三方平台充电订单数据
     * @return
     */
    @PostMapping("/addTripartitePlatformOrder")
    public R addTripartitePlatformOrder(@RequestBody AddTripartitePlatformOrder query){
        return chargingOrderService.addTripartitePlatformOrder(query);
    }
    /**
     * 根据三方平台订单id获取充电数据
     * @param startChargeSeq
     * @return
     */
    @PostMapping("/getChargingOrderByStartChargeSeq")
    public R<TChargingOrder> getChargingOrderByStartChargeSeq(@RequestParam("startChargeSeq") String startChargeSeq){
        TChargingOrder chargingOrder = chargingOrderService.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getStartChargeSeq, startChargeSeq));
        return R.ok(chargingOrder);
    }
    /**
     * 根据三方平台订单ids获取充电数据
     * @param startChargeSeqs
     * @return
     */
    @PostMapping("/getChargingOrderByStartChargeSeqs")
    public R<List<TChargingOrder>> getChargingOrderByStartChargeSeqs(@RequestParam("startChargeSeqs") List<String> startChargeSeqs){
        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().in(TChargingOrder::getStartChargeSeq, startChargeSeqs));
        return R.ok(list);
    }
    /**
     * 三方平台请求停止充电
     * @param startChargeSeq
     * @return
     */
    @PostMapping("/tripartitePlatformStopCharge")
    public R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq){
        return chargingOrderService.tripartitePlatformStopCharge(startChargeSeq);
    }
    /**
     * 临时接口
     * 获取充电后没有扣除费用的数据
     * @return
     */
    @GetMapping("/getNotPaymentChargingOrder")
    public R getNotPaymentChargingOrder(){
        return chargingOrderService.getNotPaymentChargingOrder();
    }
}