无关风月
2024-10-17 e2d42fa94683f14349a1a8b68c5cfbd3da938385
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
6个文件已修改
52 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/vo/SwitchwayGateReq.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java 4 ●●●● 补丁 | 查看 | 原始文档 | 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 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/vo/SwitchwayGateReq.java
@@ -16,4 +16,12 @@
     * 通道编号
     */
    private String channel;
    /**
     * appkey
     */
    private String appkey;
    /**
     * secretkey
     */
    private String secretkey;
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java
@@ -1,7 +1,9 @@
package com.ruoyi.chargingPile.controller;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TVehicleRamp;
import com.ruoyi.chargingPile.service.TParkingLotService;
import com.ruoyi.chargingPile.service.TVehicleRampService;
import com.ruoyi.common.core.utils.CodeGenerateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -37,6 +39,9 @@
    
    @Resource
    private SwitchwayGateClient switchwayGateClient;
    @Resource
    private TParkingLotService parkingLotService;
    
    
    
@@ -105,9 +110,13 @@
    @ApiOperation(tags = {"后台-车道"},value = "开关闸车道")
    @PostMapping(value = "/openOrDown")
    public AjaxResult<String> openOrDown(@RequestBody TVehicleRamp dto) {
        TVehicleRamp vehicleRamp = vehicleRampService.getById(dto.getId());
        TParkingLot parkingLot = parkingLotService.getById(vehicleRamp.getParkingLotId());
        SwitchwayGateReq req = new SwitchwayGateReq();
        req.setAction(dto.getAction());
        req.setChannel(dto.getCarportNum());
        req.setAction(vehicleRamp.getAction());
        req.setChannel(vehicleRamp.getCarportNum());
        req.setAppkey(parkingLot.getAppKey());
        req.setSecretkey(parkingLot.getSecretKey());
        Boolean data = switchwayGateClient.gateService(req).getData();
        return data ? AjaxResult.success() : AjaxResult.error("操作失败");
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java
@@ -34,7 +34,7 @@
    @ResponseBody
    @PostMapping("/getCoupon")
    public BaseResponse<GetCouponResp> getCoupon(@RequestBody GetCouponReq req){
        log.info("停车获取优惠券请求参数:{}" + JSON.toJSONString(req));
        log.warn("停车获取优惠券请求参数:{}" + JSON.toJSONString(req));
        GetCouponResp coupon = couponService.getCoupon(req);
        return BaseResponse.ok(coupon);
    }
@@ -48,7 +48,7 @@
    @ResponseBody
    @PostMapping("/usedCoupon")
    public BaseResponse usedCoupon(@RequestBody UsedCoupon req){
        log.info("停车使用优惠券请求参数:{}" + JSON.toJSONString(req));
        log.warn("停车使用优惠券请求参数:{}" + 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.info("云停车入场请求参数:{}" + JSON.toJSONString(order));
        log.warn("云停车入场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.cloudParkingInOrder(order);
        return BaseResponse.ok();
    }
@@ -41,7 +41,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingOutOrder")
    public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){
        log.info("云停车出场请求参数:{}" + JSON.toJSONString(order));
        log.warn("云停车出场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.cloudParkingOutOrder(order);
        return BaseResponse.ok();
    }
@@ -54,7 +54,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingSpace")
    public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){
        log.info("云停车实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        log.warn("云停车实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        parkingOrderService.cloudParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
@@ -68,7 +68,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingInOrder")
    public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){
        log.info("线下停车场入场请求参数:{}" + JSON.toJSONString(order));
        log.warn("线下停车场入场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.offlineParkingInOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -85,7 +85,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingOutOrder")
    public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){
        log.info("线下停车场出场请求参数:{}" + JSON.toJSONString(order));
        log.warn("线下停车场出场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.offlineParkingOutOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -102,7 +102,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingSpace")
    public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){
        log.info("线下停车场实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        log.warn("线下停车场实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        parkingOrderService.offlineParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/CouponService.java
@@ -70,9 +70,8 @@
        GetCouponResp resp = new GetCouponResp();
        resp.setRecordId(data.getId());
        resp.setCarNumber(carNumber);
        // todo 需要第三方提供数据
        resp.setSysOrgId("");
        resp.setPosName("");
        resp.setSysOrgId("MXCD7QjHapTJGZ8TZZz3");
        resp.setPosName("明星电力");
        resp.setLssuer("admin");
        resp.setType(4);
        Parameter parameter = new Parameter();
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
@@ -18,10 +18,6 @@
    private final String url = "http://8.137.103.127/universal";
    
    private final String appkey = "886621e841fc44c1ad63a823d";
    private final String secretkey = "7d87c2c36bea4749b30f38f4d";
    
    /**
     * 开关道闸
@@ -30,17 +26,17 @@
     */
    public Boolean gateService(SwitchwayGateReq req){
        SwitchwayGate switchwayGate = new SwitchwayGate()
                .setAppkey(appkey)
                .setAppkey(req.getAppkey())
                .setAction(req.getAction())
                .setChannel(req.getChannel())
                .setTimestamp(System.currentTimeMillis() + "")
                .build(secretkey);
                .build(req.getSecretkey());
        String body = JSON.toJSONString(switchwayGate);
        String result = HttpUtil.post(url + "/gateService", body);
        JSONObject jsonObject = JSON.parseObject(result);
        Boolean success = jsonObject.getBoolean("success");
        if(!success){
            log.error("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result);
            log.warn("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result);
        }
        return success;
    }