提交代码

dev-discount
胡锐 2 years ago
parent 61866bfaf4
commit 25b765b60e
  1. 13
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 13
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  3. 29
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -19,6 +19,7 @@ import com.hai.common.utils.DateUtil;
import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.MemberValidateUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.ApproveType; import com.hai.enum_type.ApproveType;
import com.hai.model.HighCouponHandselModel; import com.hai.model.HighCouponHandselModel;
@ -711,19 +712,17 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
} }
// 获取token
String token = huiLianTongConfig.getToken();
// 查询电子卡券类型 // 查询电子卡券类型
JSONObject corpCouTypes = HuiLianTongConfig.getCorpCouTypes(token); JSONObject corpCouTypes = HuiLianTongConfig.getHltFuelCoupList();
System.out.println(corpCouTypes.toJSONString()); if (!corpCouTypes.getString("respCode").equals("0000")) {
if (!corpCouTypes.getString("result").equals("success")) {
log.error("HighCouponController -> insertCoupon() error!","获取电子卡券列表失败"); log.error("HighCouponController -> insertCoupon() error!","获取电子卡券列表失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败");
} }
// 参数解密
JSONObject resolveResponseData = HuiLianTongUnionCardConfig.resolveResponse(corpCouTypes.getString("data"));
HighCoupon coupon; HighCoupon coupon;
JSONArray dataArray = corpCouTypes.getJSONArray("data"); JSONArray dataArray = resolveResponseData.getJSONArray("data");
if (dataArray != null && dataArray.size() > 0) { if (dataArray != null && dataArray.size() > 0) {
for (Object object : dataArray) { for (Object object : dataArray) {
JSONObject dataObject = (JSONObject)object; JSONObject dataObject = (JSONObject)object;

@ -6,6 +6,7 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.dao.HighCouponAgentCodeMapper; import com.hai.dao.HighCouponAgentCodeMapper;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighUserCouponMapper; import com.hai.dao.HighUserCouponMapper;
@ -78,13 +79,13 @@ public class HighCouponSchedule {
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()); JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couponCodeOther.getCouNo());
if (data.getString("result").equals("success")) {
if (data.getJSONObject("data").getInteger("state") != 20) { 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")); couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state"));
highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther);

@ -207,6 +207,20 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrderMapper.updateByPrimaryKey(childOrder); highChildOrderMapper.updateByPrimaryKey(childOrder);
} }
if (couponDetail.getCouponSource().equals(4)) {
// 下单请求
JSONObject jsonObject = HuiLianTongConfig.recharge(highOrder.getOrderNo(),
childOrder.getSaleCount(),
couponDetail.getCouponKey(),
highOrder.getMemPhone());
if (!jsonObject.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败");
}
JSONObject response = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
childOrder.setExt2(response.getJSONObject("data").getString("rechargeOrderId"));
highChildOrderMapper.updateByPrimaryKey(childOrder);
}
if (!childOrder.getGiveawayType()) { if (!childOrder.getGiveawayType()) {
// 查看是否需要赠送卡卷 // 查看是否需要赠送卡卷
List<HighCouponHandselModel> handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId()); List<HighCouponHandselModel> handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId());
@ -313,20 +327,18 @@ public class HighOrderServiceImpl implements HighOrderService {
} }
// 贵州高速 // 贵州高速
if (coupon.getCouponSource() == 4) { if (coupon.getCouponSource() == 4) {
// 获取token
String token = huiLianTongConfig.getToken();
Map<String,Object> push = new HashMap<>(); Map<String,Object> push = new HashMap<>();
push.put("token", token);
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());
push.put("thirdUserId", highUser.getUnionId()); push.put("thirdUserId", highUser.getUnionId());
// 推送给高速 // 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, highOrder.getOrderNo(), coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId()); JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2());
if (returnParam != null && returnParam.getString("result").equals("success")) { if (returnParam != null && returnParam.getString("respCode").equals("0000")) {
JSONArray dataArray = returnParam.getJSONArray("data"); // 解密
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
for (Object data : dataArray) { for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data; JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
@ -354,12 +366,13 @@ public class HighOrderServiceImpl implements HighOrderService {
highUserCouponMapper.insert(highUserCoupon); highUserCouponMapper.insert(highUserCoupon);
} }
} }
// 推送记录 // 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType()); highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(highOrder.getOrderNo()); highGasOrderPush.setOrderNo(highOrder.getOrderNo());
highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result")); highGasOrderPush.setCode(returnParam.getString("respCode"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push)); highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString()); highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush); highGasOrderPushMapper.insert(highGasOrderPush);

Loading…
Cancel
Save