Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 1 year ago
parent 68332bc444
commit 5028901509
  1. 28
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 2
      hai-order/src/main/java/com/web/controller/OrderController.java
  5. 7
      hai-order/src/main/java/com/web/controller/notify/GroupOrderController.java
  6. 103
      hai-order/src/main/java/com/web/controller/notify/ScNotifyController.java
  7. 119
      hai-service/src/main/java/com/hai/config/ScPetroConfig.java
  8. 28
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  9. 37
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  10. 101
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  11. 1
      hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java

@ -1,9 +1,11 @@
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.utils.ResponseMsgUtil;
import com.hai.entity.ApiBlxCoupon;
import com.hai.config.ScPetroConfig;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
import io.swagger.annotations.Api;
@ -18,7 +20,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/apiCoupon")
@ -30,6 +31,8 @@ public class ApiCouponController {
@Resource
private ApiBlxCouponService apiBlxCouponService;
@RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取比邻星停车券列表")
@ -46,4 +49,25 @@ public class ApiCouponController {
}
}
@RequestMapping(value = "/synCouponRule", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取四川中石油卡券")
public ResponseData synCouponRule() {
try {
JSONObject jsonObject = ScPetroConfig.synCouponRule();
if (jsonObject.getString("code").equals("1")) {
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONArray jsonArray = JSONArray.parseArray(data);
return ResponseMsgUtil.success(jsonArray);
}
return ResponseMsgUtil.success("请求失败");
} catch (Exception e) {
log.error("HighDiscountPackageController --> getDiscountPackageList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -318,7 +318,7 @@ public class HighCouponController {
}
// 中石化
if (coupon.getCouponSource() != null && (coupon.getCouponSource() != 4 && coupon.getCouponSource() != 5 && coupon.getCouponSource() != 6)) {
if (coupon.getCouponSource() != null && (coupon.getCouponSource() != 4 && coupon.getCouponSource() != 5 && coupon.getCouponSource() != 6 && coupon.getCouponSource() != 7)) {
// 根据卡卷查询 销售码库存
if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) == 0) {
log.error("HighCouponController -> upShelfApprove() error!","卡卷库存数量错误");

File diff suppressed because one or more lines are too long

@ -282,7 +282,7 @@ public class OrderController {
public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "paySerialNo", required = false) String paySerialNo,
@RequestParam(name = "payChannelOrderNo", required = false) String payChannelOrderNo
) {
) {
try {
if (StringUtils.isBlank(orderNo) && StringUtils.isBlank(paySerialNo) && StringUtils.isBlank(payChannelOrderNo)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");

@ -63,10 +63,15 @@ public class GroupOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关核销券!");
}
HighOrder highOrder = highOrderService.getOrderById(highGroupCode.getId());
HighOrder highOrder = highOrderService.getOrderById(highGroupCode.getOrderId());
HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo());
if (highGroupCode.getStatus() != 1 || highOrder.getOrderStatus() == 3) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已核销不可再次核销!");
}
highGroupCode.setStatus(2);
highGroupCode.setUpdateTime(new Date());
groupCodeService.updateGroupCode(highGroupCode);

@ -0,0 +1,103 @@
package com.web.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.AESTool;
import com.hai.common.utils.MD5Util;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.CommonSysConst;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighGasOrderPush;
import com.hai.enum_type.OrderPushType;
import com.hai.service.HighCouponCodeOtherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/scNotify")
@Api(value = "四川业务通知")
public class ScNotifyController {
private static final Logger log = LoggerFactory.getLogger(ScNotifyController.class);
@Resource
private HighCouponCodeOtherService couponCodeOtherService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@RequestMapping(value = "/scPetroNotify", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "重庆中石油通知")
public Object scPetroNotify(@RequestBody String paramsStr) {
System.out.println(paramsStr);
log.info("重庆中石油核销通知");
log.info("通知参数:" + paramsStr);
try {
if (StringUtils.isNotBlank(paramsStr)) {
JSONObject sendMessage = JSONObject.parseObject(paramsStr).getJSONObject("sendMessage");
JSONObject body = ChongQingCNPCService.decryptBody(sendMessage.getString("body"));
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type10.getType());
highGasOrderPush.setOrderNo(body.getString("tradeId"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent("核销回调");
highGasOrderPush.setReturnContent(paramsStr);
highGasOrderPushMapper.insert(highGasOrderPush);
couponCodeOtherService.cqCnpcUseNotify(body);
Map<String, Object> param = new HashMap<>();
param.put("status", 1);
param.put("msg", "成功");
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey());
Map<String, Object> returnContent = new HashMap<>();
Map<String, Object> returnPostMessage = new HashMap<>();
Map<String, Object> returnHead = new HashMap<>();
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase());
returnHead.put("requestType", "couponNotice");
returnPostMessage.put("head", returnHead);
returnPostMessage.put("body", verifyCode);
returnContent.put("postMessage", returnPostMessage);
return returnContent;
} else {
Map<String, Object> param = new HashMap<>();
param.put("status", 0);
param.put("msg", "解析参数错误");
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey());
Map<String, Object> returnContent = new HashMap<>();
Map<String, Object> returnPostMessage = new HashMap<>();
Map<String, Object> returnHead = new HashMap<>();
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase());
returnHead.put("requestType", "couponNotice");
returnPostMessage.put("head", returnHead);
returnPostMessage.put("body", verifyCode);
returnContent.put("postMessage", returnPostMessage);
return returnContent;
}
} catch (Exception e) {
log.info("重庆中石油核销通知业务出现异常", e);
return null;
// return ResponseMsgUtil.exception(e);
}
}
}

@ -31,6 +31,14 @@ public class ScPetroConfig {
private final static String charset = "UTF-8";
/**
* @Author Sum1Dream
* @Name synCouponRule
* @Description // 获取券列表
* @Date 11:17 2023/11/17
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject synCouponRule() throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
@ -56,6 +64,113 @@ public class ScPetroConfig {
return HttpsUtils.doPost(reqUrl + "syn-coupon-rule/v1", req , new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name getCoupon
* @Description // 获取券code
* @Date 11:19 2023/11/17
* @Param code
* @Param phone
* @Param orderNo
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCoupon(String code , String phone , String orderNo) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("request_code" , code);
billBizContent.put("user_code" , phone);
billBizContent.put("out_trade_no" , orderNo);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
return HttpsUtils.doPost(reqUrl + "get-coupon", req , new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name couponDetail
* @Description // 获取静态码
* @Date 11:20 2023/11/17
* @Param ticketNum
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject couponDetail(String ticketNum) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("ticket_num" , ticketNum);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
return HttpsUtils.doPost(reqUrl + "couponDetail", req , new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name cancelCoupon
* @Description // 作废下单
* @Date 11:21 2023/11/17
* @Param ticketNum
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject cancelCoupon(String ticketNum) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("ticket_num" , ticketNum);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
return HttpsUtils.doPost(reqUrl + "cancelCoupon", req , new HashMap<>());
}
/**
* @param params 签名params null和""不参与签名
* @param key 密钥
@ -128,9 +243,9 @@ public class ScPetroConfig {
* @Param key
* @return java.lang.String
*/
public static String decrypt(final String content, final String key) {
public static String decrypt(final String content) {
try {
byte[] raw = key.getBytes("UTF-8");
byte[] raw = ScPetroAesKey.getBytes("UTF-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(2, skeySpec);

@ -13,6 +13,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.ScPetroConfig;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
@ -361,6 +362,33 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
}
} else if (coupon.getCouponSource().equals(7)) {
if (StringUtils.isBlank(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请填写客户手机号");
}
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号格式错误");
}
// 发放卡券
JSONObject jsonObject = ScPetroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(5);
couponCodeOther.setCouponAgentCodeId(couponAgentCodeId);
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(object.getString("ticket_num"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
couponCodeOtherService.insertCouponCodeOther(couponCodeOther);
}
Map<String, Object> map = new HashMap<>();

@ -11,6 +11,7 @@ import com.hai.common.utils.IDGenerator;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.ScPetroConfig;
import com.hai.dao.HighChildOrderMapper;
import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighCouponCodeMapperExt;
@ -22,6 +23,7 @@ import com.hai.openApi.config.BlxConfig;
import com.hai.openApi.service.ApiBlxCouponService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderStatus;
import com.hai.order.utils.OrderUtil;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -525,6 +527,41 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , object.getString("msg"));
}
}
} else if (coupon.getCouponSource().equals(7)) {
// 发放卡券
JSONObject jsonObject = ScPetroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(5);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(childOrder.getId());
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(object.getString("ticket_num"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
couponCodeOtherService.insertCouponCodeOther(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(childOrder.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo());
highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate());
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponService.insertUserCoupon(highUserCoupon);
} else {
// 查询子订单的兑换码
HighCouponCode code = getCodeByChildOrderNo(childOrder.getChildOrderNo());

@ -8,6 +8,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.ScPetroConfig;
import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountAgentCodeMapper;
@ -257,45 +258,83 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
if (couponRelList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置卡券");
}
List<HighDiscountCouponRel> couponList = couponRelList.stream().filter(o -> o.getHighCoupon().getCouponSource().equals(5)).collect(Collectors.toList());
if (couponList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置重庆中石油卡券");
}
// 重庆中石油业务状态
SecConfig cqCnpcStatus = secConfigService.findByCodeType("CQ_CNPC_STATUS_" + couponList.get(0).getHighCoupon().getCouponKey());
if (cqCnpcStatus != null && StringUtils.isNotBlank(cqCnpcStatus.getCodeValue())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, cqCnpcStatus.getCodeValue());
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(couponList.get(0).getHighCoupon().getCouponKey(), tradeId, 1, userModel.getHighUser().getPhone());
if (!preSendCoupon.getInteger("status").equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取优惠券失败,请稍后重试");
}
// 给用户发码
JSONObject response = ChongQingCNPCService.sendCNPCTicket(
couponList.get(0).getHighCoupon().getCouponKey(),
tradeId,
1,
userModel.getHighUser().getPhone());
JSONObject couponDetail = response.getJSONObject("ticketDetail");
JSONArray codeList = response.getJSONArray("codeList");
for (Object data : codeList) {
if (discount.getUsingRange() == 8) {
List<HighDiscountCouponRel> couponList = couponRelList.stream().filter(o -> o.getHighCoupon().getCouponSource().equals(5)).collect(Collectors.toList());
if (couponList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置重庆中石油卡券");
}
// 重庆中石油业务状态
SecConfig cqCnpcStatus = secConfigService.findByCodeType("CQ_CNPC_STATUS_" + couponList.get(0).getHighCoupon().getCouponKey());
if (cqCnpcStatus != null && StringUtils.isNotBlank(cqCnpcStatus.getCodeValue())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, cqCnpcStatus.getCodeValue());
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(couponList.get(0).getHighCoupon().getCouponKey(), tradeId, 1, userModel.getHighUser().getPhone());
if (!preSendCoupon.getInteger("status").equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取优惠券失败,请稍后重试");
}
// 给用户发码
JSONObject response = ChongQingCNPCService.sendCNPCTicket(
couponList.get(0).getHighCoupon().getCouponKey(),
tradeId,
1,
userModel.getHighUser().getPhone());
JSONObject couponDetail = response.getJSONObject("ticketDetail");
JSONArray codeList = response.getJSONArray("codeList");
for (Object data : codeList) {
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(3);
couponCodeOther.setDiscountAgentCodeId(discountAgentCode.getId());
couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode"));
couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data)));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
}
discountAgentCode.setExt2(tradeId);
updateCode(discountAgentCode);
} else if (discount.getUsingRange() == 11) {
List<HighDiscountCouponRel> couponList = couponRelList.stream().filter(o -> o.getHighCoupon().getCouponSource().equals(7)).collect(Collectors.toList());
if (couponList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置四川中石油卡券");
}
// 四川中石油业务状态
SecConfig ScStatus = secConfigService.findByCodeType("SC_PRINTER_STATUS_" + couponList.get(0).getHighCoupon().getCouponKey());
if (ScStatus != null && StringUtils.isNotBlank(ScStatus.getCodeValue())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ScStatus.getCodeValue());
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = ScPetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
if (!preSendCoupon.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前优惠券不可购买");
}
String data = ScPetroConfig.decrypt(preSendCoupon.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(3);
couponCodeOther.setDiscountAgentCodeId(discountAgentCode.getId());
couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode"));
couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data)));
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(object.getString("ticket_num"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
discountAgentCode.setExt2(tradeId);
updateCode(discountAgentCode);
}
discountAgentCode.setExt2(tradeId);
updateCode(discountAgentCode);
}
} else {
// 加锁失败,重试

@ -174,6 +174,7 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
}
@Override
public HighMerchantStore getMerStoreDetailByKey(String storeKey) {
HighMerchantStoreExample example = new HighMerchantStoreExample();
example.createCriteria().andStoreKeyEqualTo(storeKey);

Loading…
Cancel
Save