From fd0edde8ea170122185fc3d53cfc6b2b600cb130 Mon Sep 17 00:00:00 2001 From: Lemon Date: Fri, 22 Sep 2023 15:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E8=BD=AF=E6=9D=B0?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=B9=B3=E5=8F=B0=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/parkplatform/ParkingEnum.java | 37 ++++++++++++++ .../TransactionRecordsRequestHandler.java | 48 +++++++++++++------ .../pile/dto/ruanjie/UseCouponDTO.java | 6 +++ .../ruanjie/service/impl/RJServiceImpl.java | 4 +- 4 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 jsowell-common/src/main/java/com/jsowell/common/enums/parkplatform/ParkingEnum.java diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/parkplatform/ParkingEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/parkplatform/ParkingEnum.java new file mode 100644 index 000000000..ef2727da3 --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/parkplatform/ParkingEnum.java @@ -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; + } +} diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java index 3eac94636..bb841f232 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java @@ -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; } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ruanjie/UseCouponDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ruanjie/UseCouponDTO.java index cb1323aff..7e3acac1a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ruanjie/UseCouponDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ruanjie/UseCouponDTO.java @@ -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 { /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ruanjie/service/impl/RJServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ruanjie/service/impl/RJServiceImpl.java index a50037f54..f463cc2d5 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ruanjie/service/impl/RJServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ruanjie/service/impl/RJServiceImpl.java @@ -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());