mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-25 17:49:49 +08:00
深圳停车平台
This commit is contained in:
@@ -16,10 +16,7 @@ import com.jsowell.common.enums.ykc.StartModeEnum;
|
|||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.*;
|
||||||
import com.jsowell.pile.domain.PileBasicInfo;
|
|
||||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
|
||||||
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
|
||||||
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
||||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||||
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
|
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
|
||||||
@@ -96,6 +93,9 @@ public class CommonService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ZDLService zdlService;
|
private ZDLService zdlService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarCouponRecordService carCouponRecordService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private NRService nrService;
|
private NRService nrService;
|
||||||
|
|
||||||
@@ -685,11 +685,11 @@ public class CommonService {
|
|||||||
* @param orderBasicInfo
|
* @param orderBasicInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String bindParkingCoupon(RealTimeMonitorData realTimeMonitorData, OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException {
|
public void bindParkingCoupon(RealTimeMonitorData realTimeMonitorData, OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException {
|
||||||
// 判断该订单的站点是否有停车优惠
|
// 判断该订单的站点是否有停车优惠
|
||||||
ChargeParkingDiscountVO chargeParkingDiscount = getChargeParkingDiscount(orderBasicInfo.getStationId());
|
ChargeParkingDiscountVO chargeParkingDiscount = getChargeParkingDiscount(orderBasicInfo.getStationId());
|
||||||
if (chargeParkingDiscount == null) {
|
if (chargeParkingDiscount == null) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
// 是否满足发券条件
|
// 是否满足发券条件
|
||||||
String sumChargingTime = realTimeMonitorData.getSumChargingTime(); // 充电时长
|
String sumChargingTime = realTimeMonitorData.getSumChargingTime(); // 充电时长
|
||||||
@@ -710,16 +710,19 @@ public class CommonService {
|
|||||||
}
|
}
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
// 不满足发券条件
|
// 不满足发券条件
|
||||||
return orderBasicInfo.getOrderCode() + " 该订单不满足发券条件";
|
log.info(orderBasicInfo.getOrderCode() + " 该订单不满足发券条件");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// 是否已经发券
|
// 是否已经发券
|
||||||
String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderBasicInfo.getOrderCode();
|
String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderBasicInfo.getOrderCode();
|
||||||
Object cacheObject = redisCache.getCacheObject(redisKey);
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||||
if (cacheObject != null) {
|
if (cacheObject != null) {
|
||||||
return orderBasicInfo.getOrderCode() + " 该订单已经发券";
|
log.info(orderBasicInfo.getOrderCode() + " 该订单已经发券");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// 绑定停车券
|
// 绑定停车券
|
||||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(orderBasicInfo.getStationId());
|
PileStationVO stationInfo = pileStationInfoService.getStationInfo(orderBasicInfo.getStationId());
|
||||||
|
boolean discountFlag = false;
|
||||||
if (StringUtils.equals(ParkingPlatformEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
if (StringUtils.equals(ParkingPlatformEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
||||||
// 路通云停
|
// 路通云停
|
||||||
// 查询密钥等配置
|
// 查询密钥等配置
|
||||||
@@ -737,16 +740,11 @@ public class CommonService {
|
|||||||
.orderBasicInfo(orderBasicInfo)
|
.orderBasicInfo(orderBasicInfo)
|
||||||
.build();
|
.build();
|
||||||
// 绑定优惠券
|
// 绑定优惠券
|
||||||
return ltytService.bindCoupon(dto);
|
String s = ltytService.bindCoupon(dto);
|
||||||
} else if (StringUtils.equals(ParkingPlatformEnum.RUAN_JIE_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
// 如果s为ok, discountFlag为true
|
||||||
// 软杰
|
if (StringUtils.equals(s, "ok")) {
|
||||||
UseCouponDTO dto = UseCouponDTO.builder()
|
discountFlag = true;
|
||||||
.fCouponCode(orderBasicInfo.getOrderCode()) // 优惠券编号(使用订单编号)
|
}
|
||||||
.fCouponType("2") // 优惠类型 2-时长
|
|
||||||
.fCouponValue("120") // 优惠券面额 单位:分钟
|
|
||||||
.fPlateCode(orderBasicInfo.getPlateNumber()) // 车牌号
|
|
||||||
.build();
|
|
||||||
return rjService.useCoupon(dto);
|
|
||||||
} else if (StringUtils.equals(ParkingPlatformEnum.SHEN_ZHEN_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
} else if (StringUtils.equals(ParkingPlatformEnum.SHEN_ZHEN_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
||||||
// 深圳道闸
|
// 深圳道闸
|
||||||
QcyunParkCouponDTO dto = QcyunParkCouponDTO.builder()
|
QcyunParkCouponDTO dto = QcyunParkCouponDTO.builder()
|
||||||
@@ -755,9 +753,22 @@ public class CommonService {
|
|||||||
.stationName(stationInfo.getStationName())
|
.stationName(stationInfo.getStationName())
|
||||||
.parkId(stationInfo.getParkingId())
|
.parkId(stationInfo.getParkingId())
|
||||||
.build();
|
.build();
|
||||||
qcyunsService.issuanceOfParkingTickets(dto);
|
discountFlag = qcyunsService.issuanceOfParkingTickets(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (discountFlag) {
|
||||||
|
log.info("订单号:{}, 车牌号:{}, 发券成功", orderBasicInfo.getOrderCode(), orderBasicInfo.getPlateNumber());
|
||||||
|
//发券成功保存到redis
|
||||||
|
redisCache.setCacheObject(redisKey, Boolean.TRUE, 24, TimeUnit.HOURS);
|
||||||
|
// 将下发优惠券信息存入表
|
||||||
|
CarCouponRecord carCouponRecord = new CarCouponRecord();
|
||||||
|
carCouponRecord.setOrderCode(orderBasicInfo.getOrderCode());
|
||||||
|
carCouponRecord.setReturnCode("200");
|
||||||
|
carCouponRecord.setReturnMsg("ok");
|
||||||
|
carCouponRecord.setPlateNumber(orderBasicInfo.getPlateNumber());
|
||||||
|
carCouponRecord.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
||||||
|
carCouponRecordService.insertCarCouponRecord(carCouponRecord);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ public interface QcyunsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发放停车券
|
* 发放停车券
|
||||||
* @return
|
* dto中只需要传入车牌号, 其他参数取配置文件中的参数
|
||||||
|
* 现在只有一家车场, parkId在配置文件中, 以后多家车场改为数据库配置
|
||||||
|
* @return true: 发放成功, false: 失败
|
||||||
*/
|
*/
|
||||||
String issuanceOfParkingTickets(QcyunParkCouponDTO dto);
|
boolean issuanceOfParkingTickets(QcyunParkCouponDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,9 +138,7 @@ public class LTYTServiceImpl implements LTYTService {
|
|||||||
carCouponRecord.setReturnMsg(msg);
|
carCouponRecord.setReturnMsg(msg);
|
||||||
carCouponRecord.setPlateNumber(dto.getPlateNumber());
|
carCouponRecord.setPlateNumber(dto.getPlateNumber());
|
||||||
carCouponRecord.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
carCouponRecord.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
||||||
|
|
||||||
carCouponRecordService.insertCarCouponRecord(carCouponRecord);
|
carCouponRecordService.insertCarCouponRecord(carCouponRecord);
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,24 +45,23 @@ public class QcyunsServiceImpl implements QcyunsService {
|
|||||||
* 现在只有一家车场, parkId在配置文件中, 以后多家车场改为数据库配置
|
* 现在只有一家车场, parkId在配置文件中, 以后多家车场改为数据库配置
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String issuanceOfParkingTickets(QcyunParkCouponDTO dto) {
|
public boolean issuanceOfParkingTickets(QcyunParkCouponDTO dto) {
|
||||||
dto.setParkId(parkId);
|
dto.setParkId(parkId);
|
||||||
// 1. 查询车辆信息
|
// 1. 查询车辆信息
|
||||||
String carInfo = getCarInfo(dto);
|
String carInfo = getCarInfo(dto);
|
||||||
if (StringUtils.isBlank(carInfo)) {
|
if (StringUtils.isBlank(carInfo)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
// carInfo转为json, 提取carInfo
|
// carInfo转为json, 提取carInfo
|
||||||
JSONObject jsonObject = JSON.parseObject(carInfo);
|
JSONObject jsonObject = JSON.parseObject(carInfo);
|
||||||
TempCarInfo tempCarInfo = JSON.parseObject(jsonObject.getString("carInfo"), TempCarInfo.class);
|
TempCarInfo tempCarInfo = JSON.parseObject(jsonObject.getString("carInfo"), TempCarInfo.class);
|
||||||
if (tempCarInfo == null) {
|
if (tempCarInfo == null) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
dto.setParkingSerial(String.valueOf(tempCarInfo.getRecordId()));
|
dto.setParkingSerial(String.valueOf(tempCarInfo.getRecordId()));
|
||||||
// 2. 创建停车券
|
// 2. 创建停车券
|
||||||
boolean discountCoupon = createDiscountCoupon(dto);
|
boolean discountCoupon = createDiscountCoupon(dto);
|
||||||
|
return discountCoupon;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user