From aa1e245f0b48b83d0d75783ae04b8d71655bbb59 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 2 Sep 2022 16:27:38 +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 --- .../com/hai/schedule/HighCouponSchedule.java | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index a2d71a6b..d7cb08b9 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -84,41 +84,42 @@ public class HighCouponSchedule { if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (data.getString("respCode").equals("0000") && data.getJSONObject("data").getInteger("state") != 20) { - couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state")); - highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); - - if (couponCodeOther.getCouponAgentCodeId() != null) { - HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); - if (agentCode == null) { - agentCode.setStatus(3); - highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + if (data.getString("respCode").equals("0000")) { + JSONObject responseObject = JSONObject.parseObject(data.getString("data")); + if (responseObject.getInteger("state") != 20) { + couponCodeOther.setStatus(responseObject.getInteger("state")); + highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); + + if (couponCodeOther.getCouponAgentCodeId() != null) { + HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); + if (agentCode == null) { + agentCode.setStatus(3); + highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + } } - } - if (couponCodeOther.getChildOrderId() != null) { - HighUserCouponExample userCouponExample = new HighUserCouponExample(); - userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); - List list = highUserCouponMapper.selectByExample(userCouponExample); - if (list.size() > 0) { - HighUserCoupon userCoupon = list.get(0); - if (data.getJSONObject("data").getInteger("state") == 40) { - userCoupon.setStatus(2); - userCoupon.setConsumeTime(new Date()); - } else { - userCoupon.setStatus(0); + if (couponCodeOther.getChildOrderId() != null) { + HighUserCouponExample userCouponExample = new HighUserCouponExample(); + userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); + List list = highUserCouponMapper.selectByExample(userCouponExample); + if (list.size() > 0) { + HighUserCoupon userCoupon = list.get(0); + if (responseObject.getInteger("state") == 40) { + userCoupon.setStatus(2); + userCoupon.setConsumeTime(new Date()); + } else { + userCoupon.setStatus(0); + } + highUserCouponMapper.updateByPrimaryKey(userCoupon); + } + // 查询订单中的汇联通卡券全部已处理 + HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); + otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); + if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { + highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } - highUserCouponMapper.updateByPrimaryKey(userCoupon); - } - // 查询订单中的汇联通卡券全部已处理 - HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); - otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); - if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { - highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } } - } } }