mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 路通云停道闸系统Service
This commit is contained in:
@@ -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();
|
||||
// 绑定优惠券
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user