From ed3b99794831e7ea03fb8072a86d2a3e10f87ccd Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 22 Aug 2022 09:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hai/config/HuiLianTongUnionCardConfig.java | 6 ++++++ .../impl/HighCouponAgentServiceImpl.java | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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);