|
|
|
@ -606,15 +606,31 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { |
|
|
|
|
couponAgent.setSalesCount(couponAgent.getSalesCount() + 1); |
|
|
|
|
highCouponAgentRelMapper.updateByPrimaryKey(couponAgent); |
|
|
|
|
|
|
|
|
|
// 下单请求
|
|
|
|
|
// 第一次,下单请求
|
|
|
|
|
JSONObject rechargeObject = HuiLianTongConfig.recharge(convertCode.getConvertCode(), |
|
|
|
|
1, |
|
|
|
|
coupon.getCouponKey(), |
|
|
|
|
phone); |
|
|
|
|
|
|
|
|
|
System.out.println("第一次下单" + rechargeObject.toJSONString()); |
|
|
|
|
if (!rechargeObject.getString("respCode").equals("0000")) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败"); |
|
|
|
|
} |
|
|
|
|
JSONObject response = HuiLianTongUnionCardConfig.resolveResponse(rechargeObject.getString("data")); |
|
|
|
|
if (response == null || response.getJSONObject("data") == null) { |
|
|
|
|
// 第二次,下单请求
|
|
|
|
|
// 重新生成兑换码
|
|
|
|
|
convertCode.setConvertCode(generateConvertCode(couponAgent.getId())); |
|
|
|
|
rechargeObject = HuiLianTongConfig.recharge(convertCode.getConvertCode(), |
|
|
|
|
1, |
|
|
|
|
coupon.getCouponKey(), |
|
|
|
|
phone); |
|
|
|
|
System.out.println("第二次下单" + rechargeObject.toJSONString()); |
|
|
|
|
response = HuiLianTongUnionCardConfig.resolveResponse(rechargeObject.getString("data")); |
|
|
|
|
if (response == null || response.getJSONObject("data") == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
convertCode.setExt1(response.getJSONObject("data").getString("rechargeOrderId")); |
|
|
|
|
highCouponAgentCodeMapper.updateByPrimaryKey(convertCode); |
|
|
|
|
|
|
|
|
|