|
|
|
@ -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<HighUserCoupon> 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<HighUserCoupon> 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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|