Pu Zhibing
2024-11-05 63f7a9310dd1649b7ae2bc680a37ac73536be64c
合并代码
6个文件已修改
49 ■■■■ 已修改文件
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/CouponService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java
@@ -34,8 +34,9 @@
    @ResponseBody
    @PostMapping("/getCoupon")
    public BaseResponse<GetCouponResp> getCoupon(GetCouponReq req){
        log.warn("停车获取优惠券请求参数:{}", JSON.toJSONString(req));
        log.info("停车获取优惠券请求参数:{}", JSON.toJSONString(req));
        GetCouponResp coupon = couponService.getCoupon(req);
        log.info("停车获取优惠券结果:{}", JSON.toJSONString(coupon));
        return BaseResponse.ok(coupon);
    }
    
@@ -48,7 +49,7 @@
    @ResponseBody
    @PostMapping("/usedCoupon")
    public BaseResponse usedCoupon(UsedCoupon req){
        log.warn("停车使用优惠券请求参数:{}", JSON.toJSONString(req));
        log.info("停车使用优惠券请求参数:{}", JSON.toJSONString(req));
        couponService.usedCoupon(req);
        return BaseResponse.ok();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java
@@ -28,7 +28,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingInOrder")
    public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){
        log.warn("云停车入场请求参数:{}", JSON.toJSONString(order));
        log.info("云停车入场请求参数:{}", JSON.toJSONString(order));
        parkingOrderService.cloudParkingInOrder(order);
        return BaseResponse.ok();
    }
@@ -41,7 +41,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingOutOrder")
    public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){
        log.warn("云停车出场请求参数:{}", JSON.toJSONString(order));
        log.info("云停车出场请求参数:{}", JSON.toJSONString(order));
        parkingOrderService.cloudParkingOutOrder(order);
        return BaseResponse.ok();
    }
@@ -54,7 +54,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingSpace")
    public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){
        log.warn("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace));
        log.info("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace));
        parkingOrderService.cloudParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
@@ -67,7 +67,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingInOrder")
    public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){
        log.warn("线下停车场入场请求参数:{}", JSON.toJSONString(order));
        log.info("线下停车场入场请求参数:{}", JSON.toJSONString(order));
        parkingOrderService.offlineParkingInOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -84,7 +84,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingOutOrder")
    public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){
        log.warn("线下停车场出场请求参数:{}", JSON.toJSONString(order));
        log.info("线下停车场出场请求参数:{}", JSON.toJSONString(order));
        parkingOrderService.offlineParkingOutOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -101,7 +101,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingSpace")
    public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){
        log.warn("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace));
        log.info("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace));
        parkingOrderService.offlineParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/CouponService.java
@@ -85,10 +85,6 @@
        }else{
            resp.setCouponName("充电停车时长优惠");
            parameter.setTime(parkingLot.getChargeFreeDuration());
            data.setFreeDuration(parkingLot.getNonChargeFreeDuration());
            data.setChargingOrderId(tChargingOrder.getId());
            data.setAppUserId(tChargingOrder.getAppUserId());
            parkingRecordClient.updateParkingRecord(data);
        }
        resp.setParameter(parameter);
        return resp;
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java
@@ -1,6 +1,8 @@
package com.ruoyi.integration.barrierGate.server;
import com.ruoyi.account.api.feignClient.AppUserCarClient;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.account.api.model.TAppUserCar;
import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient;
import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient;
@@ -19,6 +21,7 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
@@ -41,6 +44,9 @@
    
    @Resource
    private ChargingOrderClient chargingOrderClient;
    @Resource
    private AppUserClient appUserClient;
    
    
    
@@ -79,6 +85,7 @@
        query.setLicensePlate(order.getPlate());
        query.setStatus(1);
        TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData();
        TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData();
        LocalDateTime parse = LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ISO_DATE_TIME);
        parse = parse.plusHours(8);
        parkingRecord.setOutParkingTime(parse);
@@ -98,8 +105,25 @@
                TChargingOrder chargingOrder = data.get(0);
                parkingRecord.setAppUserId(chargingOrder.getAppUserId());
                parkingRecord.setChargingOrderId(chargingOrder.getId());
                TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData();
                parkingRecord.setPhone(appUser.getPhone());
                parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration());
                //超时占位费
                long out = parkingRecord.getOutParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond();
                long in = parkingRecord.getInParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond();
                long m = (out - in) / 60;
                parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO);
            }else{
                parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration());
                //超时占位费
                long out = parkingRecord.getOutParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond();
                long in = parkingRecord.getInParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond();
                long m = (out - in) / 60;
                parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO);
            }
        }
        parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment()));
        parkingRecordClient.updateParkingRecord(parkingRecord);
    }
    
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
@@ -36,7 +36,7 @@
        JSONObject jsonObject = JSON.parseObject(result);
        Boolean success = jsonObject.getBoolean("success");
        if(!success){
            log.warn("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result);
            log.info("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result);
        }
        return success;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -524,7 +524,7 @@
        if(2 == addChargingOrder.getPaymentType()){
            AliPaymentReq req = new AliPaymentReq();
            req.setOutTradeNo(chargingOrder.getCode());
            req.setTotalAmount(chargingOrder.getPaymentAmount().toString());
            req.setTotalAmount(addChargingOrder.getPaymentAmount().toString());
            req.setSubject("充电充值");
            req.setBuyerOpenId(appUser.getAliOpenid());
            req.setBody("充电充值");