提交代码

dev-discount
胡锐 3 years ago
commit 160d33c6c7
  1. 156
      hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  4. 19
      hai-cweb/src/main/java/com/cweb/config/SysConfig.java
  5. 3
      hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java
  6. 18
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  7. 6
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  8. 53
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  9. 70
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  10. 8
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  11. 2
      hai-cweb/src/main/resources/dev/config.properties
  12. 3
      hai-cweb/src/main/resources/prod/config.properties
  13. 49
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  14. 17
      hai-service/src/main/java/com/hai/config/WxOrderConfig.java
  15. 37
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java
  16. 14
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java
  17. 22
      hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherMapper.java
  18. 14
      hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherSqlProvider.java
  19. 16
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java
  20. 70
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java
  21. 16
      hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java
  22. 60
      hai-service/src/main/java/com/hai/entity/HighCouponCodeOtherExample.java
  23. 2
      hai-service/src/main/java/com/hai/service/HighCouponAgentService.java
  24. 8
      hai-service/src/main/java/com/hai/service/SecConfigService.java
  25. 110
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  26. 12
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  27. 12
      hai-service/src/main/resources/prod/commonConfig.properties

@ -1,27 +1,35 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighUser;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighOpenApiService;
import com.hai.service.HighUserService;
import com.hai.service.SecConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -44,7 +52,13 @@ public class HighOpenApiController {
@Resource
private HighUserService highUserService;
@RequestMapping(value = "/getUserExclusiveDiscount", method = RequestMethod.GET)
@Resource
private SecConfigService secConfigService;
@Resource
private HuiLianTongConfig huiLianTongConfig;
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取专属优惠券")
public ResponseData getUserExclusiveDiscount(@RequestParam(name = "useScope", required = false) Integer useScope,
@ -70,7 +84,137 @@ public class HighOpenApiController {
return ResponseMsgUtil.success(highOpenApiService.getUserCouponsList(map));
} catch (Exception e) {
log.error("HighOrderController --> getUserPreOrderList() error!", e);
log.error("HighOpenApiController --> getGuizhouSinopecList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGuizhouSinopecList",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取贵州中石化电子卡券")
public ResponseData getGuizhouSinopecList(HttpServletRequest request) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
// 查询电子卡券类型
JSONObject corpCouTypes = HuiLianTongConfig.getCorpCouTypes(token);
System.out.println(corpCouTypes.toJSONString());
if (!corpCouTypes.getString("result").equals("success")) {
log.error("HighOpenApiController -> getGuizhouSinopecList() error!","获取电子卡券列表失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败");
}
return ResponseMsgUtil.success(corpCouTypes.getJSONArray("data"));
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/checkCouponStatus",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询电子券状态")
public ResponseData checkCouponStatus(@RequestBody JSONObject object, HttpServletRequest request) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
// 查询电子卡券类型
JSONObject data = HuiLianTongConfig.getCouState(token, object.getString("orderNo"));
if (!data.getString("result").equals("success")) {
log.error("HighOpenApiController -> insertCoupon() error!","查询电子券状态失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询电子券状态失败");
}
return ResponseMsgUtil.success(data.getJSONObject("data"));
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/couJointDist",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "商户派发电子券")
public ResponseData couJointDist(@RequestBody JSONObject object, HttpServletRequest request) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("couJointDist error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
// 商户派发电子券
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, object.getString("orderNo"), object.getString("couTypeCode"), object.getInteger("distCouCount"), object.getString("phone"), object.getString("thirdUserId"));
if (returnParam == null || !returnParam.getString("result").equals("success")) {
log.error("HighOpenApiController -> couJointDist() error!","商户派发电子券失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户派发电子券失败");
}
return ResponseMsgUtil.success(returnParam.getJSONArray("data"));
} catch (Exception e) {
log.error("HighOpenApiController -> couJointDist() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/test",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "测试")
public ResponseData test(HttpServletRequest request) {
try {
String ip = "";
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
}
ip = request.getHeader("x-forwarded-for");
return ResponseMsgUtil.success(ip);
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
return ResponseMsgUtil.exception(e);
}
}

File diff suppressed because one or more lines are too long

@ -608,8 +608,6 @@ public class OutRechargeOrderController {
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
if (order.getStatus() == 2) {
outRechargeOrderService.rechargeOrderToRefund(order.getId());
order.setStatus(5);
outRechargeOrderService.updateOrder(order);
}
}

@ -27,6 +27,9 @@ public class SysConfig {
private String notifyUrl;
private String qzNotifyUrl;
private String wxGzSubAppId;
private String wxGzSubMchId;
// 重庆惠兑电子商务有限公司
private String HDAppId;
@ -149,4 +152,20 @@ public class SysConfig {
public void setHDAppId(String HDAppId) {
this.HDAppId = HDAppId;
}
public String getWxGzSubAppId() {
return wxGzSubAppId;
}
public void setWxGzSubAppId(String wxGzSubAppId) {
this.wxGzSubAppId = wxGzSubAppId;
}
public String getWxGzSubMchId() {
return wxGzSubMchId;
}
public void setWxGzSubMchId(String wxGzSubMchId) {
this.wxGzSubMchId = wxGzSubMchId;
}
}

@ -74,7 +74,8 @@ public class HighCouponAgentController {
if (convertCode.getCouponCodeId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
return ResponseMsgUtil.success(highCouponAgentService.useConvertCode(body.getString("code")));
return ResponseMsgUtil.success(highCouponAgentService.useConvertCode(body.getString("phone"), body.getString("code")));
} catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) {
log.error("HighActivityController -> userLottery() error!", "服务器繁忙");

@ -228,17 +228,19 @@ public class HighOrderController {
childOrder.setGoodsImg(store.getStoreLogo());
// 平台的价格
// childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun"));
// childOrder.setGasPriceVip(priceDetail.getBigDecimal("priceVip"));
childOrder.setExt1(childOrder.getGasPriceVip().toString());
childOrder.setGoodsActualPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP));
// 团油的价格
childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun"));
childOrder.setGasPriceVip(priceDetail.getBigDecimal("priceVip"));
childOrder.setGoodsPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP));
// childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun"));
// childOrder.setGasPriceVip(priceDetail.getBigDecimal("priceVip"));
// childOrder.setGoodsPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP));
childOrder.setGoodsSpecName("默认");
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
// childOrder.setTotalPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
// childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
childOrder.setTotalPrice(childOrder.getGoodsPrice());
}
if (childOrder.getGoodsType() == 7) {
@ -270,7 +272,6 @@ public class HighOrderController {
childOrder.setGoodsActualPrice(discountPackage.getPrice());
childOrder.setGoodsSpecName("默认");
}
// 汇联通充值
if (childOrder.getGoodsType() == 8) {
if (childOrder.getGoodsPrice() == null) {
@ -397,6 +398,11 @@ public class HighOrderController {
}
}
public static void main(String[] args) {
System.out.println(new BigDecimal("10").divide(new BigDecimal("7.20"),10,BigDecimal.ROUND_DOWN)
.multiply(new BigDecimal("6.75")).setScale(2,BigDecimal.ROUND_HALF_UP));
}
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询订单详情")

File diff suppressed because one or more lines are too long

@ -538,59 +538,6 @@ public class OutRechargeOrderController {
}
// @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "订单退款")
// public ResponseData orderToRefund(@RequestParam(name = "orderId", required = false) Long orderId,
// HttpServletRequest request) {
// try {
//
// OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
// if (order == null) {
// log.error("orderToPay error!", "未找到充值订单");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到充值订单");
// }
//
// // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款
// if (order.getStatus() != 2) {
// log.error("orderToPay error!", "无法退款,订单不处于已支付状态");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
// }
//
// Map<String,String> param = new HashMap<>();
// param.put("appid", "wx637bd6f7314daa46");
// param.put("mch_id", "1289663601");
// param.put("sub_mch_id" , "1609882817");
// param.put("nonce_str", WxUtils.makeNonStr());
// param.put("transaction_id", order.getPaySerialNo());
// param.put("out_refund_no", "HFR"+new Date().getTime());
// param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
// param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
// param.put("sign_type", "HMAC-SHA256");
//
// String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
// param.put("sign", signStr);
//
// String resultXmL = doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param));
// OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
// if(orderRefundModel.getResult_code().equals("SUCCESS")) {
// order.setStatus(5);
// order.setRefundTime(new Date());
// order.setOutRefundNo(orderRefundModel.getOut_refund_no());
// order.setRefundId(orderRefundModel.getRefund_id());
// order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
// outRechargeOrderService.updateOrder(order);
// return ResponseMsgUtil.success("退款成功");
// }
// return ResponseMsgUtil.success("退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
//
// } catch (Exception e) {
// log.error("HighOrderController --> getUserOrderList() error!", e);
// return ResponseMsgUtil.exception(e);
// }
// }
@RequestMapping(value = "/wxProfitsharing", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分账")

@ -32,10 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -158,30 +155,6 @@ public class WechatController {
}
}
@RequestMapping(value = "/loginByTel", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序根据手机号登录或注册")
public ResponseData loginByPhone(@RequestParam(value = "loginByTel", required = true) String loginByTel,
HttpServletRequest request, HttpServletResponse response) {
try {
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(loginByTel);
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserInfo", method = RequestMethod.GET)
@ResponseBody
@ -271,25 +244,42 @@ public class WechatController {
}
}
@RequestMapping(value = "/loginByTel1", method = RequestMethod.GET)
@RequestMapping(value = "/loginByTel", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel1(@RequestParam(value = "phone", required = true) String phone,
public ResponseData loginByTel(@RequestBody JSONObject body,
HttpServletRequest request, HttpServletResponse response) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("phone"))
|| StringUtils.isBlank(body.getString("smsCode"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phone);
// 定义个人所有数据
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
HighUser user = highUserService.findByPhone(body.getString("phone"));
return ResponseMsgUtil.success(so);
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+ body.getString("phone"));
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,body.getString("smsCode"))) {
// 定义个人所有数据
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);

@ -191,7 +191,13 @@ public class OrderController {
} else {
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId());//商户号
}
weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId()); //子商户号
if (order.getHighChildOrderList().get(0).getGoodsType() == 8) {
weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxGzSubMchId());//商户号
} else {
weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId());
}
//子商户号
// weChatPayReqInfo.setOpenid(openId);
weChatPayReqInfo.setSub_openid(openId);

@ -11,6 +11,8 @@ wxMchId=1289663601
wxSubAppId=wx8d49e2f83025229d
wxSubMchId=1609882817
wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder
wxGzSubAppId=wxa075e8509802f826
wxGzSubMchId=1619676214
# ????????????
HDAppId = 1614670195

@ -11,6 +11,9 @@ wxMchId=1289663601
wxSubAppId=wx8d49e2f83025229d
wxSubMchId=1609882817
wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder
wxGzSubAppId=wxa075e8509802f826
wxGzSubMchId=1619676214
notifyUrl=https://hsg.dctpay.com/crest/wechatpay/notify

@ -6,6 +6,7 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.HighCouponAgentCodeMapper;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
@ -39,6 +40,9 @@ public class HighCouponSchedule {
@Resource
private HighCouponCodeOtherMapper highCouponCodeOtherMapper;
@Resource
private HighCouponAgentCodeMapper highCouponAgentCodeMapper;
@Resource
private HighOrderService highOrderService;
@ -70,7 +74,6 @@ public class HighCouponSchedule {
**/
@Scheduled(cron="0 0/10 * * * ?") //每10分钟执行一次
public void handleCouponStatus() throws Exception {
HighCouponCodeOtherExample example = new HighCouponCodeOtherExample();
example.createCriteria().andStatusEqualTo(20).andTypeEqualTo(1);
List<HighCouponCodeOther> otherList = highCouponCodeOtherMapper.selectByExample(example);
@ -85,26 +88,36 @@ public class HighCouponSchedule {
couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state"));
highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther);
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.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());
}
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());
}
}
}

@ -80,6 +80,23 @@ public class WxOrderConfig {
return XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
}
public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee, String subMchId , BigDecimal refundFee) throws Exception {
Map<String,String> param = new HashMap<>();
param.put("appid", "wx637bd6f7314daa46");
param.put("mch_id", "1289663601");
param.put("sub_mch_id" , subMchId);
param.put("nonce_str", WxUtils.makeNonStr());
param.put("transaction_id", paySerialNo);
param.put("out_refund_no", "HFR"+new Date().getTime());
param.put("total_fee", String.valueOf(totalFee.multiply(new BigDecimal("100")).intValue()));
param.put("refund_fee", String.valueOf(refundFee.multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256");
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr);
String resultXmL = doSSLRequest(param.get("mch_id"), "https://api.mch.weixin.qq.com/secapi/pay/refund", WxUtils.mapToXml(param));
return XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
}
private static String doSSLRequest(String mchId, String url, String data) throws Exception {
//双向证书的认证

@ -41,22 +41,22 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Insert({
"insert into high_coupon_agent_code (`type`, coupon_agent_id, ",
"coupon_id, agent_id, ",
"coupon_agent_record_id, convert_code, ",
"coupon_code_id, coupon_code, ",
"qr_code, `status`, ",
"remark, create_time, ",
"sales_time, operator_id, ",
"operator_name, ext_1, ",
"ext_2, ext_3)",
"coupon_agent_record_id, convert_user_phone, ",
"convert_code, coupon_code_id, ",
"coupon_code, qr_code, ",
"`status`, remark, ",
"create_time, sales_time, ",
"operator_id, operator_name, ",
"ext_1, ext_2, ext_3)",
"values (#{type,jdbcType=INTEGER}, #{couponAgentId,jdbcType=BIGINT}, ",
"#{couponId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{couponAgentRecordId,jdbcType=BIGINT}, #{convertCode,jdbcType=VARCHAR}, ",
"#{couponCodeId,jdbcType=BIGINT}, #{couponCode,jdbcType=VARCHAR}, ",
"#{qrCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{salesTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{couponAgentRecordId,jdbcType=BIGINT}, #{convertUserPhone,jdbcType=VARCHAR}, ",
"#{convertCode,jdbcType=VARCHAR}, #{couponCodeId,jdbcType=BIGINT}, ",
"#{couponCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{salesTime,jdbcType=TIMESTAMP}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponAgentCode record);
@ -73,6 +73,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
@Result(column="convert_user_phone", property="convertUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@ -91,9 +92,9 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Select({
"select",
"id, `type`, coupon_agent_id, coupon_id, agent_id, coupon_agent_record_id, convert_code, ",
"coupon_code_id, coupon_code, qr_code, `status`, remark, create_time, sales_time, ",
"operator_id, operator_name, ext_1, ext_2, ext_3",
"id, `type`, coupon_agent_id, coupon_id, agent_id, coupon_agent_record_id, convert_user_phone, ",
"convert_code, coupon_code_id, coupon_code, qr_code, `status`, remark, create_time, ",
"sales_time, operator_id, operator_name, ext_1, ext_2, ext_3",
"from high_coupon_agent_code",
"where id = #{id,jdbcType=BIGINT}"
})
@ -104,6 +105,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
@Result(column="convert_user_phone", property="convertUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@ -136,6 +138,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
"coupon_id = #{couponId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT},",
"convert_user_phone = #{convertUserPhone,jdbcType=VARCHAR},",
"convert_code = #{convertCode,jdbcType=VARCHAR},",
"coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
"coupon_code = #{couponCode,jdbcType=VARCHAR},",

@ -48,6 +48,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.VALUES("coupon_agent_record_id", "#{couponAgentRecordId,jdbcType=BIGINT}");
}
if (record.getConvertUserPhone() != null) {
sql.VALUES("convert_user_phone", "#{convertUserPhone,jdbcType=VARCHAR}");
}
if (record.getConvertCode() != null) {
sql.VALUES("convert_code", "#{convertCode,jdbcType=VARCHAR}");
}
@ -115,6 +119,7 @@ public class HighCouponAgentCodeSqlProvider {
sql.SELECT("coupon_id");
sql.SELECT("agent_id");
sql.SELECT("coupon_agent_record_id");
sql.SELECT("convert_user_phone");
sql.SELECT("convert_code");
sql.SELECT("coupon_code_id");
sql.SELECT("coupon_code");
@ -169,6 +174,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}");
}
if (record.getConvertUserPhone() != null) {
sql.SET("convert_user_phone = #{record.convertUserPhone,jdbcType=VARCHAR}");
}
if (record.getConvertCode() != null) {
sql.SET("convert_code = #{record.convertCode,jdbcType=VARCHAR}");
}
@ -235,6 +244,7 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}");
sql.SET("convert_user_phone = #{record.convertUserPhone,jdbcType=VARCHAR}");
sql.SET("convert_code = #{record.convertCode,jdbcType=VARCHAR}");
sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}");
sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}");
@ -278,6 +288,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT}");
}
if (record.getConvertUserPhone() != null) {
sql.SET("convert_user_phone = #{convertUserPhone,jdbcType=VARCHAR}");
}
if (record.getConvertCode() != null) {
sql.SET("convert_code = #{convertCode,jdbcType=VARCHAR}");
}

@ -39,15 +39,17 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_coupon_code_other (`type`, order_id, ",
"child_order_id, cou_type_code, ",
"cou_no, `status`, active_time, ",
"insert into high_coupon_code_other (`type`, coupon_agent_code_id, ",
"order_id, child_order_id, ",
"cou_type_code, cou_no, ",
"`status`, active_time, ",
"valid_start_date, valid_end_date, ",
"create_time, ext_1, ",
"ext_2, ext_3)",
"values (#{type,jdbcType=INTEGER}, #{orderId,jdbcType=BIGINT}, ",
"#{childOrderId,jdbcType=BIGINT}, #{couTypeCode,jdbcType=VARCHAR}, ",
"#{couNo,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{activeTime,jdbcType=TIMESTAMP}, ",
"values (#{type,jdbcType=INTEGER}, #{couponAgentCodeId,jdbcType=BIGINT}, ",
"#{orderId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ",
"#{couTypeCode,jdbcType=VARCHAR}, #{couNo,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{activeTime,jdbcType=TIMESTAMP}, ",
"#{validStartDate,jdbcType=TIMESTAMP}, #{validEndDate,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
@ -63,6 +65,7 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_agent_code_id", property="couponAgentCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="cou_type_code", property="couTypeCode", jdbcType=JdbcType.VARCHAR),
@ -80,14 +83,16 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt
@Select({
"select",
"id, `type`, order_id, child_order_id, cou_type_code, cou_no, `status`, active_time, ",
"valid_start_date, valid_end_date, create_time, ext_1, ext_2, ext_3",
"id, `type`, coupon_agent_code_id, order_id, child_order_id, cou_type_code, cou_no, ",
"`status`, active_time, valid_start_date, valid_end_date, create_time, ext_1, ",
"ext_2, ext_3",
"from high_coupon_code_other",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_agent_code_id", property="couponAgentCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="cou_type_code", property="couTypeCode", jdbcType=JdbcType.VARCHAR),
@ -115,6 +120,7 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt
@Update({
"update high_coupon_code_other",
"set `type` = #{type,jdbcType=INTEGER},",
"coupon_agent_code_id = #{couponAgentCodeId,jdbcType=BIGINT},",
"order_id = #{orderId,jdbcType=BIGINT},",
"child_order_id = #{childOrderId,jdbcType=BIGINT},",
"cou_type_code = #{couTypeCode,jdbcType=VARCHAR},",

@ -32,6 +32,10 @@ public class HighCouponCodeOtherSqlProvider {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getCouponAgentCodeId() != null) {
sql.VALUES("coupon_agent_code_id", "#{couponAgentCodeId,jdbcType=BIGINT}");
}
if (record.getOrderId() != null) {
sql.VALUES("order_id", "#{orderId,jdbcType=BIGINT}");
}
@ -91,6 +95,7 @@ public class HighCouponCodeOtherSqlProvider {
sql.SELECT("id");
}
sql.SELECT("`type`");
sql.SELECT("coupon_agent_code_id");
sql.SELECT("order_id");
sql.SELECT("child_order_id");
sql.SELECT("cou_type_code");
@ -128,6 +133,10 @@ public class HighCouponCodeOtherSqlProvider {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getCouponAgentCodeId() != null) {
sql.SET("coupon_agent_code_id = #{record.couponAgentCodeId,jdbcType=BIGINT}");
}
if (record.getOrderId() != null) {
sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}");
}
@ -186,6 +195,7 @@ public class HighCouponCodeOtherSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("coupon_agent_code_id = #{record.couponAgentCodeId,jdbcType=BIGINT}");
sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}");
sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}");
sql.SET("cou_type_code = #{record.couTypeCode,jdbcType=VARCHAR}");
@ -212,6 +222,10 @@ public class HighCouponCodeOtherSqlProvider {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getCouponAgentCodeId() != null) {
sql.SET("coupon_agent_code_id = #{couponAgentCodeId,jdbcType=BIGINT}");
}
if (record.getOrderId() != null) {
sql.SET("order_id = #{orderId,jdbcType=BIGINT}");
}

@ -45,6 +45,11 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
*/
private Long couponAgentRecordId;
/**
* 兑换人手机号
*/
private String convertUserPhone;
/**
* 兑换码
*/
@ -151,6 +156,14 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
this.couponAgentRecordId = couponAgentRecordId;
}
public String getConvertUserPhone() {
return convertUserPhone;
}
public void setConvertUserPhone(String convertUserPhone) {
this.convertUserPhone = convertUserPhone;
}
public String getConvertCode() {
return convertCode;
}
@ -273,6 +286,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
&& (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getCouponAgentRecordId() == null ? other.getCouponAgentRecordId() == null : this.getCouponAgentRecordId().equals(other.getCouponAgentRecordId()))
&& (this.getConvertUserPhone() == null ? other.getConvertUserPhone() == null : this.getConvertUserPhone().equals(other.getConvertUserPhone()))
&& (this.getConvertCode() == null ? other.getConvertCode() == null : this.getConvertCode().equals(other.getConvertCode()))
&& (this.getCouponCodeId() == null ? other.getCouponCodeId() == null : this.getCouponCodeId().equals(other.getCouponCodeId()))
&& (this.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode()))
@ -298,6 +312,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getCouponAgentRecordId() == null) ? 0 : getCouponAgentRecordId().hashCode());
result = prime * result + ((getConvertUserPhone() == null) ? 0 : getConvertUserPhone().hashCode());
result = prime * result + ((getConvertCode() == null) ? 0 : getConvertCode().hashCode());
result = prime * result + ((getCouponCodeId() == null) ? 0 : getCouponCodeId().hashCode());
result = prime * result + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode());
@ -326,6 +341,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
sb.append(", couponId=").append(couponId);
sb.append(", agentId=").append(agentId);
sb.append(", couponAgentRecordId=").append(couponAgentRecordId);
sb.append(", convertUserPhone=").append(convertUserPhone);
sb.append(", convertCode=").append(convertCode);
sb.append(", couponCodeId=").append(couponCodeId);
sb.append(", couponCode=").append(couponCode);

@ -485,6 +485,76 @@ public class HighCouponAgentCodeExample {
return (Criteria) this;
}
public Criteria andConvertUserPhoneIsNull() {
addCriterion("convert_user_phone is null");
return (Criteria) this;
}
public Criteria andConvertUserPhoneIsNotNull() {
addCriterion("convert_user_phone is not null");
return (Criteria) this;
}
public Criteria andConvertUserPhoneEqualTo(String value) {
addCriterion("convert_user_phone =", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneNotEqualTo(String value) {
addCriterion("convert_user_phone <>", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneGreaterThan(String value) {
addCriterion("convert_user_phone >", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneGreaterThanOrEqualTo(String value) {
addCriterion("convert_user_phone >=", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneLessThan(String value) {
addCriterion("convert_user_phone <", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneLessThanOrEqualTo(String value) {
addCriterion("convert_user_phone <=", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneLike(String value) {
addCriterion("convert_user_phone like", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneNotLike(String value) {
addCriterion("convert_user_phone not like", value, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneIn(List<String> values) {
addCriterion("convert_user_phone in", values, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneNotIn(List<String> values) {
addCriterion("convert_user_phone not in", values, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneBetween(String value1, String value2) {
addCriterion("convert_user_phone between", value1, value2, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertUserPhoneNotBetween(String value1, String value2) {
addCriterion("convert_user_phone not between", value1, value2, "convertUserPhone");
return (Criteria) this;
}
public Criteria andConvertCodeIsNull() {
addCriterion("convert_code is null");
return (Criteria) this;

@ -23,6 +23,11 @@ public class HighCouponCodeOther implements Serializable {
*/
private Integer type;
/**
* 代理商卡券销售码id
*/
private Long couponAgentCodeId;
/**
* 订单id
*/
@ -92,6 +97,14 @@ public class HighCouponCodeOther implements Serializable {
this.type = type;
}
public Long getCouponAgentCodeId() {
return couponAgentCodeId;
}
public void setCouponAgentCodeId(Long couponAgentCodeId) {
this.couponAgentCodeId = couponAgentCodeId;
}
public Long getOrderId() {
return orderId;
}
@ -202,6 +215,7 @@ public class HighCouponCodeOther implements Serializable {
HighCouponCodeOther other = (HighCouponCodeOther) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCouponAgentCodeId() == null ? other.getCouponAgentCodeId() == null : this.getCouponAgentCodeId().equals(other.getCouponAgentCodeId()))
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
&& (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId()))
&& (this.getCouTypeCode() == null ? other.getCouTypeCode() == null : this.getCouTypeCode().equals(other.getCouTypeCode()))
@ -222,6 +236,7 @@ public class HighCouponCodeOther implements Serializable {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCouponAgentCodeId() == null) ? 0 : getCouponAgentCodeId().hashCode());
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode());
result = prime * result + ((getCouTypeCode() == null) ? 0 : getCouTypeCode().hashCode());
@ -245,6 +260,7 @@ public class HighCouponCodeOther implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", couponAgentCodeId=").append(couponAgentCodeId);
sb.append(", orderId=").append(orderId);
sb.append(", childOrderId=").append(childOrderId);
sb.append(", couTypeCode=").append(couTypeCode);

@ -245,6 +245,66 @@ public class HighCouponCodeOtherExample {
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdIsNull() {
addCriterion("coupon_agent_code_id is null");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdIsNotNull() {
addCriterion("coupon_agent_code_id is not null");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdEqualTo(Long value) {
addCriterion("coupon_agent_code_id =", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdNotEqualTo(Long value) {
addCriterion("coupon_agent_code_id <>", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdGreaterThan(Long value) {
addCriterion("coupon_agent_code_id >", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdGreaterThanOrEqualTo(Long value) {
addCriterion("coupon_agent_code_id >=", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdLessThan(Long value) {
addCriterion("coupon_agent_code_id <", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdLessThanOrEqualTo(Long value) {
addCriterion("coupon_agent_code_id <=", value, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdIn(List<Long> values) {
addCriterion("coupon_agent_code_id in", values, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdNotIn(List<Long> values) {
addCriterion("coupon_agent_code_id not in", values, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdBetween(Long value1, Long value2) {
addCriterion("coupon_agent_code_id between", value1, value2, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andCouponAgentCodeIdNotBetween(Long value1, Long value2) {
addCriterion("coupon_agent_code_id not between", value1, value2, "couponAgentCodeId");
return (Criteria) this;
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;

@ -125,6 +125,6 @@ public interface HighCouponAgentService {
* @param code
* @return
*/
Map<String, Object> useConvertCode(String code);
Map<String, Object> useConvertCode(String phone, String code) throws Exception;
}

@ -38,6 +38,14 @@ public interface SecConfigService {
**/
SecConfig findByCodeType(String codeType);
/**
* @Author Sum1Dream
* @name isConfig.java
* @Description // 查询值
* @Date 3:53 下午 2022/3/14
* @Param [java.lang.String, java.lang.String]
* @return java.lang.Boolean
*/
Boolean isConfig(String codeType , String codeValue);
}

@ -1,5 +1,7 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hai.common.GenerateCode;
import com.hai.common.exception.ErrorCode;
@ -7,10 +9,10 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.dao.HighCouponAgentCodeMapper;
import com.hai.dao.HighCouponAgentRecordMapper;
import com.hai.dao.HighCouponAgentRelMapper;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
import com.hai.model.AgentSalesModel;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
@ -55,6 +57,15 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
@Resource
private HighAgentService highAgentService;
@Resource
private HuiLianTongConfig huiLianTongConfig;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private HighCouponCodeOtherMapper highCouponCodeOtherMapper;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) {
@ -411,7 +422,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,isolation= Isolation.SERIALIZABLE)
public Map<String, Object> useConvertCode(String code) {
public Map<String, Object> useConvertCode(String phone, String code) throws Exception {
// 查询兑换码
HighCouponAgentCode convertCode = getConvertCode(code);
if (convertCode == null) {
@ -423,21 +434,85 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
if (convertCode.getCouponCodeId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
// 查询未销售的卡券
List<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(convertCode.getCouponId());
if (codeList.size() == 0) {
// 查询卡券
HighCoupon coupon = highCouponService.getCouponById(convertCode.getCouponId());
if (coupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的卡券");
}
if (!coupon.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用兑换码");
}
HighCouponCode couponCode = codeList.get(0);
couponCode.setIsAssignAgent(true);
couponCode.setAgentId(convertCode.getAgentId());
couponCode.setReceiveTime(new Date());
couponCode.setStatus(2);
highCouponCodeService.updateCouponCode(couponCode);
convertCode.setCouponCodeId(couponCode.getId());
convertCode.setCouponCode(couponCode.getSalesCode());
convertCode.setQrCode(couponCode.getExt1());
// 卡券来源:1.中石化 2.消费券 3.其他 4:贵州中石化
if (coupon.getCouponSource().equals(4)) {
if (StringUtils.isBlank(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "需要填写手机手机号");
}
convertCode.setConvertUserPhone(phone);
convertCode.setCouponCode(System.currentTimeMillis()+"");
// 获取token
String token = huiLianTongConfig.getToken();
Map<String,Object> push = new HashMap<>();
push.put("token", token);
push.put("orderNo", coupon.getCouponKey());
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", 1);
push.put("userPhone", phone);
push.put("thirdUserId", phone);
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(token,
MapUtils.getString(push, "orderNo"),
MapUtils.getString(push, "couTypeCode"),
MapUtils.getInteger(push, "distCouCount"),
MapUtils.getString(push, "userPhone"),
MapUtils.getString(push, "userPhone")
);
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.setCouponAgentCodeId(convertCode.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
}
}
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(convertCode.getCouponCode());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
} else {
// 查询未销售的卡券
List<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(convertCode.getCouponId());
if (codeList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用兑换码");
}
HighCouponCode couponCode = codeList.get(0);
couponCode.setIsAssignAgent(true);
couponCode.setAgentId(convertCode.getAgentId());
couponCode.setReceiveTime(new Date());
couponCode.setStatus(2);
highCouponCodeService.updateCouponCode(couponCode);
convertCode.setCouponCodeId(couponCode.getId());
convertCode.setCouponCode(couponCode.getSalesCode());
convertCode.setQrCode(couponCode.getExt1());
}
convertCode.setStatus(3);
highCouponAgentCodeMapper.updateByPrimaryKey(convertCode);
@ -447,5 +522,6 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
map.put("couponCode", highCouponCodeService.getCouponCodeById(convertCode.getCouponCodeId()));
map.put("couponAgentCode", convertCode);
return map;
}
}

@ -1,8 +1,12 @@
tuanYouUrl=https://hcs.czb365.com
tuanYouAppKey=210091174083104
tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45
tuanYouDieselAccount=9hp52qgg4400
tuanYouGasolineAccount=9hp52qf04400
# tuanYouAppKey=210091174083104
# tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45
# tuanYouDieselAccount=9hp52qgg4400
# tuanYouGasolineAccount=9hp52qf04400
tuanYouAppKey=232373843366592
tuanYouAppSecret=b07cca748a3b83e27e4821d2a8423d91
tuanYouDieselAccount=c2qitcag4400
tuanYouGasolineAccount=c2qitc984400
qinzhuUrl=https://live.qianzhu8.com
qinzhuHtmlUrl=https://qz.dctpay.com

@ -1,8 +1,12 @@
tuanYouUrl=https://hcs.czb365.com
tuanYouAppKey=210091174083104
tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45
tuanYouDieselAccount=9hp52qgg4400
tuanYouGasolineAccount=9hp52qf04400
# tuanYouAppKey=210091174083104
# tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45
# tuanYouDieselAccount=9hp52qgg4400
# tuanYouGasolineAccount=9hp52qf04400
tuanYouAppKey=232373843366592
tuanYouAppSecret=b07cca748a3b83e27e4821d2a8423d91
tuanYouDieselAccount=c2qitcag4400
tuanYouGasolineAccount=c2qitc984400
qinzhuUrl=https://live.qianzhu8.com
qinzhuHtmlUrl=https://qz.dctpay.com

Loading…
Cancel
Save