停车平台

This commit is contained in:
Guoqs
2025-02-11 11:54:24 +08:00
parent 9fa4695f7d
commit 2e57525ade
25 changed files with 632 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
@@ -31,6 +32,7 @@ import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants; import com.jsowell.common.constant.Constants;
import com.jsowell.common.constant.RabbitConstants; import com.jsowell.common.constant.RabbitConstants;
import com.jsowell.common.core.domain.entity.SysDictData; import com.jsowell.common.core.domain.entity.SysDictData;
import com.jsowell.common.core.domain.parking.ParkingCommonParam;
import com.jsowell.common.core.domain.ykc.LoginRequestData; import com.jsowell.common.core.domain.ykc.LoginRequestData;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData; import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
@@ -44,6 +46,7 @@ import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
import com.jsowell.common.util.http.HttpUtils; import com.jsowell.common.util.http.HttpUtils;
import com.jsowell.common.util.id.IdUtils; import com.jsowell.common.util.id.IdUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker; import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.common.util.id.UUID;
import com.jsowell.common.util.ip.AddressUtils; import com.jsowell.common.util.ip.AddressUtils;
import com.jsowell.netty.handler.yunkuaichong.HeartbeatRequestHandler; import com.jsowell.netty.handler.yunkuaichong.HeartbeatRequestHandler;
import com.jsowell.netty.handler.yunkuaichong.TransactionRecordsRequestHandler; import com.jsowell.netty.handler.yunkuaichong.TransactionRecordsRequestHandler;
@@ -294,8 +297,30 @@ public class SpringBootTestController {
} }
@Test @Test
public void test() { public void getCarInfoTest() {
System.out.println(YKCUtils.getNewLogicStationIdList()); String parkId = "10102";
String plateNumber = "粤GHT4TR";
String URL = "http://test-gateway.qcyuns.com/park-data-api/data/centre/api/v1";
String secretKey = "K9OGNA7CIY8N5GXD8HF3WVDMEZNFKL3F";
Map<String, String> data = Maps.newHashMap();
data.put("ParkId", parkId);
data.put("PlateNumber", plateNumber);
ParkingCommonParam param = new ParkingCommonParam();
param.setService("CarInfo");
param.setVersion("01");
param.setMsgId(UUID.randomUUID().toString());
param.setOrgId("BTTEST01");
param.setData(data);
// 生成sign
ParkingUtil.generateAndSetSign(param, secretKey);
// 发送请求
String result = HttpUtil.post(URL, JSON.toJSONString(param));
System.out.println(result);
} }
@Test @Test

View File

@@ -13,8 +13,10 @@ public class ParkingUtil {
/** /**
* 计算sign * 计算sign
* @param publicParams 公共参数
* @param businessParams 业务参数
*/ */
public static String generateSign(Map<String, String> publicParams, Map<String, String> businessParams, String secretKey) { private static String generateSign(Map<String, String> publicParams, Map<String, String> businessParams, String secretKey) {
// Step 1: 过滤空值并按照ASCII码排序公共参数 // Step 1: 过滤空值并按照ASCII码排序公共参数
StringBuilder stringA = new StringBuilder(); StringBuilder stringA = new StringBuilder();
publicParams.entrySet().stream() publicParams.entrySet().stream()

View File

@@ -0,0 +1,22 @@
package com.jsowell.thirdparty.parking.common;
/**
* @desc:openApi数据服务service
* @date: 2021-10-31 18:07
*/
public interface ServiceApiCmd {
//获取车辆信息接口
public final static String CarInfo = "CarInfo";
//缴费通知接口
public final static String PayNotify = "PayNotify";
//获取通道列表
public final static String LaneInfoList = "LaneInfoList";
//扫码入场码or出场码
public final static String scanLaneQr = "scanLaneQrCode";
//商圈优惠
public final static String DiscountCreate = "DiscountCreate";
//商圈优惠
public final static String DiscountDestory = "DiscountDestory";
}

View File

@@ -0,0 +1,37 @@
package com.jsowell.thirdparty.parking.common;
import lombok.Getter;
import lombok.Setter;
/**
* @desc: 临时车信息
* @date: 2021-11-01 14:55
*/
@Setter
@Getter
public class TempCarInfo {
//入场时间
String inTime;
//停车时长
String stopTime;
//停车时间戳
String stopTimeSecond;
//需交费
Double amount;
//总应收
Double totalFee;
//已缴费用
Double beforePay;
//已优惠,单位:分钟/元
String discountVal;
//优惠券类型 1.金额(分钟) 2.时间(元)
Integer discountType;
//通道ID 场内支付(为空) 出口扫码支付(必填)
Integer laneId;
//平台进出场ID (平台ID与本地ID不能同时为空)
Integer recordId;
//本地进出场ID (平台ID与本地ID不能同时为空)
Integer localId;
//入场图片
String inPic;
}

View File

@@ -0,0 +1,30 @@
package com.jsowell.thirdparty.parking.common.bean;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:车位详情
*/
@Setter
@Getter
public class CarSeatInfo {
//车位编号
String seatNo;
//计费车型ID
Integer chargeType;
//计费车型name
String chargeName;
//日费用
double dayCharge;
//月费用
double monthCharge;
//季度费用
double quarterCharge;
//半年费用
double halfYearCharge;
//年费用
double yearCharge;
}

View File

@@ -0,0 +1,15 @@
package com.jsowell.thirdparty.parking.common.bean;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class InLaneQrInfo {
String inTime; //入场时间
Integer inLaneId; //入场通道ID
String inLaneName; //入场通道名称
String inPic; //入场图片
}

View File

@@ -0,0 +1,14 @@
package com.jsowell.thirdparty.parking.common.bean;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class LaneInfo{
int laneId;
String laneName;
int laneType;
}

View File

@@ -0,0 +1,35 @@
package com.jsowell.thirdparty.parking.common.bean;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @desc: 月租车信息
* @date: 2021-11-01 14:56
*/
@Setter
@Getter
public class MonthCarInfo {
//车辆标识
Integer carId;
//计费类型
Integer chargeType;
//有效期止
String endDate;
//车位数
Integer spaces;
//电话
String phone;
//地址
String address;
//锁车状态 1-锁车 2-未锁车
Integer lockStatus;
//状态 1-启用 2-未生效 3-暂停
Integer status;
//车位信息 续费规则
List<CarSeatInfo> carSeatInfoList;
}

View File

@@ -0,0 +1,37 @@
package com.jsowell.thirdparty.parking.common.bean;
import lombok.Getter;
import lombok.Setter;
/**
* @desc: 临时车信息
* @date: 2021-11-01 14:55
*/
@Setter
@Getter
public class TempCarInfo {
//入场时间
String inTime;
//停车时长
String stopTime;
//停车时间戳
String stopTimeSecond;
//需交费
Double amount;
//总应收
Double totalFee;
//已缴费用
Double beforePay;
//已优惠,单位:分钟/元
String discountVal;
//优惠券类型 1.金额(分钟) 2.时间(元)
Integer discountType;
//通道ID 场内支付(为空) 出口扫码支付(必填)
Integer laneId;
//平台进出场ID (平台ID与本地ID不能同时为空)
Integer recordId;
//本地进出场ID (平台ID与本地ID不能同时为空)
Integer localId;
//入场图片
String inPic;
}

View File

@@ -0,0 +1,34 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class DataRequest {
// 服务名称
private String service;
// 接口版本
private String version;
// 消息ID
private String msgId;
//机构ID (分配)
private String orgId;
// data
private Object data;
// 请求签名
private String sign;
public DataRequest() {
}
public DataRequest(String service, String version, String msgId, String orgId, Object data, String sign) {
this.service = service;
this.version = version;
this.msgId = msgId;
this.orgId = orgId;
this.data = data;
this.sign = sign;
}
}

View File

@@ -0,0 +1,19 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:获取固定车实体类
* @date: 2021-10-30 15:44
*/
@Setter
@Getter
public class RequestCarInfo {
//车场ID
Integer parkId;
//车牌号
String plate;
}

View File

@@ -0,0 +1,60 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RequestDiscountCreate {
/**
* 停车场编号
*/
private String parkId;
/**
* 停车流水, 标识具体某次停车事件, 需保证该停车场下唯一
*/
private String parkingSerial;
/**
* 忽略停车状态派发时传递
*/
private String plate;
/**
* 优惠券派发流水
*/
private String grantSerial;
/**
* 优惠类型:1金额, 2时长, 3全免, 4不同计价券
*/
private Short type;
/**
* 优惠金额
* 当type=1时单位为分;
* 当type=2时单位为分钟;
* 当type=3时暂无定义;
* 当type=4时为停车场计价规则ID
*/
private Integer value;
/**
* 优惠给予原因, 例如:购物满300, 免费停车2小时
*/
private String reason;
/**
* 当前派发优惠的商家名称
*/
private String storeName;
/**
* 当前派发优惠的商家唯一标识
*/
private String storeCode;
/**
* 优惠券减免规则ID, 用于配置减免是减免前面还是减免后面一般一个停车场配置相同
*/
private String couponRule;
/**
* 不同计价券收费规则ID, 用于配置改优惠券后本次停车使用不同计价规则, 一般每种优惠券不同
*/
private String chargeRule;
private String couponName; // 优惠券名称
}

View File

@@ -0,0 +1,17 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class RequestDiscountDestroy {
/**
* 停车场编号
*/
private String parkId;
/**
* 优惠券派发流水
*/
private String grantSerial;
}

View File

@@ -0,0 +1,17 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:获取通道信息实体类
* @date: 2021-11-16 14:50
*/
@Setter
@Getter
public class RequestLaneInfoList {
//车场ID
Integer parkId;
}

View File

@@ -0,0 +1,64 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:固定车续费实体类
* @date: 2021-10-30 15:46
*/
@Setter
@Getter
public class RequestPayNotify {
//停车场ID
Integer parkId;
//车牌号(可空-临时车无牌车支付时)
String plate;
//外部订单号
String outTradeNo;
//金额
Double amount;
// 支付类型 0-现金1-电子支付
Integer payType;
//车型1-按临时车计费 2-按固定车计费 3-储值车计费)
Integer carType;
//月租车主键ID
Integer carId;
//计费车类型 0-代表临时车 ,其他-对应(登记车型表)
Integer chargeType;
//通道id 不为null时通道扫码支付
Integer laneId;
//平台进出场ID (平台ID与本地ID不能同时为空)
Integer recordId;
//本地进出场ID (平台ID与本地ID不能同时为空)
Integer localId;
//[月租] 月租车截止日期 (carType!=2 为空)
String endDate;
//[月租] 月租车充值月数 (carType!=2 为空)
Integer number;
//支付方式 1-微信 2-支付宝 用于获取用户openID或者userId
Integer sourceType;
//公众号 openId
String openId;
//支付详情
String payRemark;
public RequestPayNotify() {
}
public RequestPayNotify(Integer parkId, Integer carType, Integer chargeType, String plate, Double amount, Integer laneId, Integer recordId, Integer localId, String endDate, Integer number, Integer sourceType, String openId, String payRemark) {
this.parkId = parkId;
this.carType = carType;
this.chargeType = chargeType;
this.plate = plate;
this.amount = amount;
this.laneId = laneId;
this.recordId = recordId;
this.localId = localId;
this.endDate = endDate;
this.number = number;
this.sourceType = sourceType;
this.openId = openId;
this.payRemark = payRemark;
}
}

View File

@@ -0,0 +1,20 @@
package com.jsowell.thirdparty.parking.request;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:请求参数,车主扫码通道二维码入场or出场(支持无牌车)
* @auther: wb
* @date: 2021-12-02 10:53
*/
@Setter
@Getter
public class RequestScanLaneQr {
Integer parkId; //车场ID
Integer laneId; //通道ID
Integer laneType; //通道Type 1-入 2-出
String noPlate; //无牌车
}

View File

@@ -0,0 +1,22 @@
package com.jsowell.thirdparty.parking.response;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class DataResponse {
public int retCode; //状态码 0-正常 其他-异常
public String retMsg; //状态码处理描述, 如:返回错误信息
public Object retData; //返回内容
public DataResponse() {}
public DataResponse(int retCode, String retMsg) {
this.retCode = retCode;
this.retMsg = retMsg;
}
}

View File

@@ -0,0 +1,25 @@
package com.jsowell.thirdparty.parking.response;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:获取固定车实体类
* @date: 2021-10-30 15:44
*/
@Setter
@Getter
public class ResponseCarInfo {
//车场ID
Integer parkId;
//车场名称
String parkName;
//车牌号
String plate;
//车型1-按临时车计费 2-按固定车计费 3-储值车计费)
Integer carType;
//车辆信息 根据车型显示不同内容
Object carInfo;
}

View File

@@ -0,0 +1,4 @@
package com.jsowell.thirdparty.parking.response;
public class ResponseDiscountCreate {
}

View File

@@ -0,0 +1,4 @@
package com.jsowell.thirdparty.parking.response;
public class ResponseDiscountDestroy {
}

View File

@@ -0,0 +1,21 @@
package com.jsowell.thirdparty.parking.response;
import com.pay.api.bean.LaneInfo;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @desc:续费通知接口
* @date: 2021-10-30 15:46
*/
@Setter
@Getter
public class ResponseLaneInfoList {
int parkId;
String parkName;
List<LaneInfo> laneList; //通道List
}

View File

@@ -0,0 +1,16 @@
package com.jsowell.thirdparty.parking.response;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:续费通知接口
* @date: 2021-10-30 15:46
*/
@Setter
@Getter
public class ResponsePayNotify {
}

View File

@@ -0,0 +1,20 @@
package com.jsowell.thirdparty.parking.response;
import lombok.Getter;
import lombok.Setter;
/**
* @desc:响应参数,车主扫码通道二维码入场or出场(支持无牌车)
* @date: 2021-11-16 14:50
*/
@Setter
@Getter
public class ResponseScanLaneQr {
Integer parkId; //车场ID
Integer laneId; //通道ID
Integer laneType; //通道类型
String plate; //车牌号
Object inQrResponse; //入场响应
Object outQrResponse; //出场响应
}

View File

@@ -0,0 +1,12 @@
package com.jsowell.thirdparty.parking.service;
/**
* 后亭慢充道闸service
*/
public interface QcyunsService {
/**
* 获取车辆信息接口
* 根据车牌号获取车辆信息(临时车,月租车,储值车)
*/
String getCarInfo(String parkId, String plateNumber);
}

View File

@@ -0,0 +1,57 @@
package com.jsowell.thirdparty.parking.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Maps;
import com.jsowell.common.core.domain.parking.ParkingCommonParam;
import com.jsowell.common.util.ParkingUtil;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.id.UUID;
import com.jsowell.thirdparty.parking.service.QcyunsService;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
*
*/
@Service
public class QcyunsServiceImpl implements QcyunsService {
final static String URL = "http://test-gateway.qcyuns.com/park-data-api/data/centre/api/v1";
final static String secretKey = "K9OGNA7CIY8N5GXD8HF3WVDMEZNFKL3F";
/**
* 获取车辆信息接口
* 根据车牌号获取车辆信息(临时车,月租车,储值车)
*
* @param parkId 车场ID
* @param plateNumber 车牌号
*/
@Override
public String getCarInfo(String parkId, String plateNumber) {
if (StringUtils.isBlank(parkId)) {
parkId = "11609";
}
Map<String, String> data = Maps.newHashMap();
data.put("ParkId", parkId);
data.put("PlateNumber", plateNumber);
ParkingCommonParam param = new ParkingCommonParam();
param.setService("CarInfo");
param.setVersion("01");
param.setMsgId(UUID.randomUUID().toString());
param.setOrgId("BTTEST01");
param.setData(data);
String secretKey = "";
// 生成sign
ParkingUtil.generateAndSetSign(param, secretKey);
// 发送请求
String result = HttpUtil.post(URL, JSON.toJSONString(param));
System.out.println(result);
return null;
}
}