diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index 6809bf10..6d25dce9 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -296,6 +296,12 @@ public class HuiLianTongUnionCardConfig { return request("fuelCoupons/syncPayOrder", map); } + public static void main(String[] args) { + String data = "Gbkl57c3fEBg+E3HfPuQ55SDLVyAf2Ys3VN1cifAfXIoT1gnbFR0NaiH/z1OIZZiuqlFwDLLu6mt\\nuTcVJuO1hhr5QW09U1uIfz1mQwCBwvx4/PKxXQ7rR7/rnbvnsMxRupCMjc1vBdq902CiXq8RZVEq\\n8LrnkFZ9R+9IokVEc5nGG7XvKCmikEH80xtkvw0EwuPl1mEGp92uUbpxTahhwy5M9SAnIBZIjN5D\\nxi3F4tZ0kOhiuNNTO/CECE9sWZfO".replace("\\n", ""); + String decodeData = DesUtil.decode("F8E91A3C", data, Charset.forName("UTF-8")); + JSONObject.parseObject(decodeData); + + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 88749f0b..37e49106 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -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);