新增 软杰停车平台相关逻辑

This commit is contained in:
Lemon
2023-09-22 15:53:56 +08:00
parent 6319856269
commit fd0edde8ea
4 changed files with 80 additions and 15 deletions

View File

@@ -0,0 +1,37 @@
package com.jsowell.common.enums.parkplatform;
/**
* 停车平台Enum
*
* @author Lemon
* @Date 2023/9/22 15:26
*/
public enum ParkingEnum {
LU_TONG_YUN_TING_PLATFORM("1", "路通云停停车平台"),
RUAN_JIE_PLATFORM("2", "软杰停车平台"),
;
private String code;
private String label;
ParkingEnum(String code, String label) {
this.code = code;
this.label = label;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View File

@@ -7,6 +7,7 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.parkplatform.ParkingEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.YKCChargingStopReasonEnum;
@@ -22,6 +23,7 @@ import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.dto.ruanjie.UseCouponDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.service.orderlogic.AbstractOrderLogic;
import com.jsowell.pile.service.orderlogic.OrderLogicFactory;
@@ -29,6 +31,7 @@ import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import com.jsowell.thirdparty.ruanjie.service.RJService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -84,6 +87,9 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
@Autowired
private LTYTService ltytService;
@Autowired
private RJService rjService;
@Autowired
private IThirdPartyParkingConfigService thirdPartyParkingConfigService;
@@ -685,21 +691,35 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
String stationId = orderBasicInfo.getStationId();
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
if (StringUtils.isBlank(stationInfo.getParkingId())) {
return "该订单无需绑定优惠券";
return orderBasicInfo.getOrderCode() + " 该订单无需绑定优惠券";
}
ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(stationInfo.getParkingId()));
if (parkingInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL);
if (StringUtils.equals(ParkingEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
// 路通云停
// 查询密钥等配置
ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(stationInfo.getParkingId()));
if (parkingInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL);
}
BindCouponDTO dto = BindCouponDTO.builder()
.appId(parkingInfo.getAppId())
.merchantId(parkingInfo.getParkingMerchantId())
.couponId(parkingInfo.getCouponId())
.secretKey(parkingInfo.getSecretKey())
.plateNumber(orderBasicInfo.getPlateNumber())
.plateColor(5) // 5-绿牌车
.build();
// 绑定优惠券
return ltytService.bindCoupon(dto);
} else if (StringUtils.equals(ParkingEnum.RUAN_JIE_PLATFORM.getCode(), stationInfo.getParkingId())) {
// 软杰
UseCouponDTO dto = UseCouponDTO.builder()
.fCouponCode(orderBasicInfo.getOrderCode()) // 优惠券编号(使用订单编号)
.fCouponType("2") // 优惠类型 2-时长
.fCouponValue("120") // 优惠券面额 单位:分钟
.fPlateCode(orderBasicInfo.getPlateNumber()) // 车牌号
.build();
return rjService.useCoupon(dto);
}
BindCouponDTO dto = BindCouponDTO.builder()
.appId(parkingInfo.getAppId())
.merchantId(parkingInfo.getParkingMerchantId())
.couponId(parkingInfo.getCouponId())
.secretKey(parkingInfo.getSecretKey())
.plateNumber(orderBasicInfo.getPlateNumber())
.plateColor(5) // 5-绿牌车
.build();
// 绑定优惠券
return ltytService.bindCoupon(dto);
return null;
}
}

View File

@@ -2,7 +2,10 @@ package com.jsowell.pile.dto.ruanjie;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 软杰使用优惠券DTO
@@ -11,6 +14,9 @@ import lombok.Data;
* @Date 2023/9/22 8:42
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UseCouponDTO {
/**

View File

@@ -29,6 +29,8 @@ public class RJServiceImpl implements RJService {
private static final String SECRET_KEY = "ced9ar3ingZ";
private static final String FCUST_NO = "390099";
/**
* 软杰--使用优惠券
* @param dto
@@ -40,7 +42,7 @@ public class RJServiceImpl implements RJService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("fCustID", 0);
jsonObject.put("fCustNo", "390099");
jsonObject.put("fCustNo", FCUST_NO);
jsonObject.put("fBusID", 0);
jsonObject.put("fInTime", 0);
jsonObject.put("fPlateCode", dto.getFPlateCode());