From 24c0ec0ef3e224bcbac755d82a713f1b963e914b Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 18 Feb 2025 13:59:22 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=E8=B7=AF=E9=80=9A=E4=BA=91?= =?UTF-8?q?=E5=81=9C=E9=81=93=E9=97=B8=E7=B3=BB=E7=BB=9FService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/common/CommonService.java | 11 +------- .../parking/service/impl/LTYTServiceImpl.java | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index 63cad9432..fc70a6ffc 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -655,18 +655,9 @@ public class CommonService { } if (StringUtils.equals(ParkingPlatformEnum.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-绿牌车 .orderBasicInfo(orderBasicInfo) .build(); // 绑定优惠券 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/parking/service/impl/LTYTServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/parking/service/impl/LTYTServiceImpl.java index ca7842c34..d0ac414ba 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/parking/service/impl/LTYTServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/parking/service/impl/LTYTServiceImpl.java @@ -5,15 +5,19 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.core.redis.RedisCache; +import com.jsowell.common.enums.parkplatform.ParkingPlatformEnum; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.sign.MD5Util; import com.jsowell.pile.domain.CarCouponRecord; import com.jsowell.pile.domain.OrderBasicInfo; +import com.jsowell.pile.domain.ThirdpartyParkingConfig; import com.jsowell.pile.dto.lutongyunting.BindCouponDTO; import com.jsowell.pile.dto.lutongyunting.GetTokenDTO; import com.jsowell.pile.service.CarCouponRecordService; +import com.jsowell.pile.service.ThirdPartyParkingConfigService; import com.jsowell.thirdparty.parking.service.LTYTService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,6 +44,9 @@ public class LTYTServiceImpl implements LTYTService { @Autowired private CarCouponRecordService carCouponRecordService; + @Autowired + private ThirdPartyParkingConfigService thirdPartyParkingConfigService; + // private static final String APP_ID = "I2qa3hdr116100dc"; // I2qa3hdr116100dc I2qa3jfnd96f267c // private static final String SECRET_KEY = "2qa3hdr13754a8e"; // 2qa3hdr13754a8e 2qa3jfndb37926d @@ -99,11 +106,16 @@ public class LTYTServiceImpl implements LTYTService { */ @Override public String bindCoupon(BindCouponDTO dto) throws UnsupportedEncodingException { + // 查询密钥等配置 + ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(ParkingPlatformEnum.LU_TONG_YUN_TING_PLATFORM.getCode())); + if (parkingInfo == null) { + throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL); + } OrderBasicInfo orderBasicInfo = dto.getOrderBasicInfo(); // 获取令牌 GetTokenDTO tokenDTO = new GetTokenDTO(); - tokenDTO.setAppId(dto.getAppId()); - tokenDTO.setSecretKey(dto.getSecretKey()); + tokenDTO.setAppId(parkingInfo.getAppId()); + tokenDTO.setSecretKey(parkingInfo.getSecretKey()); String token = getToken(tokenDTO); if (StringUtils.isBlank(token)) { throw new BusinessException("", "路通云停系统 给指定车辆绑定优惠券 方法获取令牌失败"); @@ -112,15 +124,15 @@ public class LTYTServiceImpl implements LTYTService { String url = BASE_URL + "bindCoupon"; JSONObject jsonObject = new JSONObject(); // 公共参数 - jsonObject.put("appId", dto.getAppId()); + jsonObject.put("appId", parkingInfo.getAppId()); jsonObject.put("token", token); jsonObject.put("accTime", DateUtils.dateTimeNow(DateUtils.YYYYMMDDHHMMSS)); jsonObject.put("version", "1.0"); // 业务参数 - jsonObject.put("merchantId", dto.getMerchantId()); - jsonObject.put("couponId", dto.getCouponId()); + jsonObject.put("merchantId", parkingInfo.getParkingMerchantId()); + jsonObject.put("couponId", parkingInfo.getCouponId()); jsonObject.put("plateNumber", dto.getPlateNumber()); - jsonObject.put("plateColor", dto.getPlateColor()); + jsonObject.put("plateColor", 5); // 5-绿牌车 String encodeData = URLEncoder.encode(JSON.toJSONString(jsonObject), "UTF-8"); jsonObject.put("data", encodeData); @@ -138,7 +150,9 @@ public class LTYTServiceImpl implements LTYTService { carCouponRecord.setReturnMsg(msg); carCouponRecord.setPlateNumber(dto.getPlateNumber()); carCouponRecord.setStationId(Long.parseLong(orderBasicInfo.getStationId())); + carCouponRecordService.insertCarCouponRecord(carCouponRecord); + return msg; }