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

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

@@ -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;
}
}