提交代码

dev-discount
胡锐 2 years ago
parent b8d184734f
commit a1244f6bf3
  1. 44
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  2. 14
      hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java
  3. 50
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -78,8 +78,50 @@ public class HighCouponSchedule {
HighCouponCodeOtherExample example = new HighCouponCodeOtherExample(); HighCouponCodeOtherExample example = new HighCouponCodeOtherExample();
example.createCriteria().andStatusEqualTo(20).andTypeEqualTo(1); example.createCriteria().andStatusEqualTo(20).andTypeEqualTo(1);
List<HighCouponCodeOther> otherList = highCouponCodeOtherMapper.selectByExample(example); List<HighCouponCodeOther> otherList = highCouponCodeOtherMapper.selectByExample(example);
// 获取token
String token = huiLianTongConfig.getToken();
for (HighCouponCodeOther couponCodeOther : otherList) { for (HighCouponCodeOther couponCodeOther : otherList) {
JSONObject data = HuiLianTongConfig.getCouState(token, couponCodeOther.getCouNo());
if (data.getString("result").equals("success")) {
if (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 (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);
}
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());
}
}
}
}
}
/* for (HighCouponCodeOther couponCodeOther : otherList) {
JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couponCodeOther.getCouNo()); JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couponCodeOther.getCouNo());
if (jsonObject.getString("respCode").equals("0000")) { if (jsonObject.getString("respCode").equals("0000")) {
@ -121,7 +163,7 @@ public class HighCouponSchedule {
} }
} }
} }*/
} }
} }

@ -58,7 +58,7 @@ public class HuiLianTongConfig {
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl() + "/getHltFuelCoupList", map); return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl() + "/getHltFuelCoupList", map);
} }
/** /* *//**
* 下单购买加油券 * 下单购买加油券
* @param orderNo * @param orderNo
* @param distCouCount * @param distCouCount
@ -66,7 +66,7 @@ public class HuiLianTongConfig {
* @param phone * @param phone
* @return * @return
* @throws Exception * @throws Exception
*/ *//*
public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception { public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
@ -77,12 +77,12 @@ public class HuiLianTongConfig {
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/recharge", map); return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/recharge", map);
} }
/** *//**
* 购买加油券充值订单 * 购买加油券充值订单
* @param couNo 订单号 * @param couNo 订单号
* @return * @return
* @throws Exception * @throws Exception
*/ *//*
public static JSONObject getPayOrderByCouNo(String couNo) throws Exception { public static JSONObject getPayOrderByCouNo(String couNo) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("couNo", couNo); map.put("couNo", couNo);
@ -90,18 +90,18 @@ public class HuiLianTongConfig {
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/getPayOrderByCouNo", map); return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/getPayOrderByCouNo", map);
} }
/** *//**
* 购买加油券充值订单 * 购买加油券充值订单
* @param rechargeOrderId 订单号 * @param rechargeOrderId 订单号
* @return * @return
* @throws Exception * @throws Exception
*/ *//*
public static JSONObject costRechargeOrder(String rechargeOrderId) throws Exception { public static JSONObject costRechargeOrder(String rechargeOrderId) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("rechargeOrderId", rechargeOrderId); map.put("rechargeOrderId", rechargeOrderId);
map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId());
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/costRechargeOrder", map); return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/costRechargeOrder", map);
} }*/
/** /**

@ -207,7 +207,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrderMapper.updateByPrimaryKey(childOrder); highChildOrderMapper.updateByPrimaryKey(childOrder);
} }
if (couponDetail.getCouponSource().equals(4)) { /* if (couponDetail.getCouponSource().equals(4)) {
// 下单请求 // 下单请求
JSONObject jsonObject = HuiLianTongConfig.recharge(highOrder.getOrderNo(), JSONObject jsonObject = HuiLianTongConfig.recharge(highOrder.getOrderNo(),
childOrder.getSaleCount(), childOrder.getSaleCount(),
@ -219,7 +219,7 @@ public class HighOrderServiceImpl implements HighOrderService {
JSONObject response = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); JSONObject response = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
childOrder.setExt2(response.getJSONObject("data").getString("rechargeOrderId")); childOrder.setExt2(response.getJSONObject("data").getString("rechargeOrderId"));
highChildOrderMapper.updateByPrimaryKey(childOrder); highChildOrderMapper.updateByPrimaryKey(childOrder);
} }*/
if (!childOrder.getGiveawayType()) { if (!childOrder.getGiveawayType()) {
// 查看是否需要赠送卡卷 // 查看是否需要赠送卡卷
@ -327,7 +327,49 @@ public class HighOrderServiceImpl implements HighOrderService {
} }
// 贵州高速 // 贵州高速
if (coupon.getCouponSource() == 4) { if (coupon.getCouponSource() == 4) {
Map<String,Object> push = new HashMap<>(); // 获取token
String token = huiLianTongConfig.getToken();
Map<String, Object> push = new HashMap<>();
push.put("token", token);
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone());
push.put("thirdUserId", highUser.getUnionId());
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, highOrder.getOrderNo(), coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId());
if (returnParam != null && returnParam.getString("result").equals("success")) {
JSONArray dataArray = returnParam.getJSONArray("data");
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1);
couponCodeOther.setOrderId(highOrder.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(highOrder.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
/* Map<String,Object> push = new HashMap<>();
push.put("couTypeCode", coupon.getCouponKey()); push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount()); push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone()); push.put("userPhone", highUser.getPhone());
@ -365,7 +407,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon); highUserCouponMapper.insert(highUserCoupon);
} }
} }*/
// 推送记录 // 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); HighGasOrderPush highGasOrderPush = new HighGasOrderPush();

Loading…
Cancel
Save