master
胡锐 11 months ago
commit 53c4506a17
  1. 5
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  2. 28
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageAgentController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 60
      hai-service/src/main/java/com/hai/config/PetroConfig.java
  5. 2
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentRecord.java
  6. 1
      hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java
  7. 9
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
  8. 2
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
  9. 4
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  10. 22
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  11. 10
      hai-service/src/main/java/com/hai/service/HighDiscountPackageAgentService.java
  12. 13
      hai-service/src/main/java/com/hai/service/impl/ApiIpAddressServiceImpl.java
  13. 4
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  14. 5
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  15. 7
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  16. 104
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageAgentServiceImpl.java
  17. 1
      v1/src/main/java/com/v1/config/AuthConfig.java
  18. 31
      v1/src/main/java/com/v1/controller/business/ApiCouponController.java
  19. 4
      v1/src/main/java/com/v1/controller/orderController.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.PayloService;
import com.hai.config.PetroConfig;
import com.hai.entity.ApiCoupon;
import com.hai.model.ResponseData;
@ -37,6 +38,8 @@ public class ApiCouponController {
@Resource
private ApiCouponService apiCouponService;
@Resource
private PetroConfig petroConfig;
@RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET)
@ -63,7 +66,7 @@ public class ApiCouponController {
PetroConfig.init(type);
JSONObject jsonObject = PetroConfig.synCouponRule();
JSONObject jsonObject = petroConfig.synCouponRule();
if (jsonObject.getString("code").equals("1")) {
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));

@ -211,7 +211,6 @@ public class HighDiscountPackageAgentController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(object.getInteger("discountPackageId"));
HighAgent agent = highAgentService.findByAgentMsgId(object.getLong("agentId"));
@ -238,5 +237,32 @@ public class HighDiscountPackageAgentController {
}
}
@RequestMapping(value = "/recoveryDiscountPackage", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "回收优惠券包")
public ResponseData recoveryDiscountPackage(@RequestBody JSONObject object) {
try {
if (object.getLong("agentId") == null ||
object.getInteger("discountPackageId") == null ||
object.getInteger("num") == null) {
log.error("discountPackageAgent -> recoveryDiscountPackage() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (object.getInteger("num") < 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确数量!");
}
discountPackageAgentService.recoveryDiscountPackage(object);
return ResponseMsgUtil.success("回收成功");
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -1,12 +1,19 @@
package com.hai.config;
import cn.jiguang.common.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.enum_type.TripartiteReqLogReqType;
import com.hai.enum_type.TripartiteReqLogType;
import com.hai.service.BsTripartiteReqLogService;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
@ -31,6 +38,12 @@ public class PetroConfig {
private final static String charset = "UTF-8";
@Resource
private BsTripartiteReqLogService reqLogService;
private static Logger log = LoggerFactory.getLogger(HuiLianTongUnionCardConfig.class);
public static void init(Integer type) {
if (type == 1) {
@ -54,7 +67,7 @@ public class PetroConfig {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject synCouponRule() throws Exception{
public JSONObject synCouponRule() throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
@ -75,8 +88,19 @@ public class PetroConfig {
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
JSONObject object = HttpsUtils.doPost(reqUrl + "syn-coupon-rule/v1", req , new HashMap<>());
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "syn-coupon-rule/v1",
req.toString(),
object.toString()
);
// 请求接口
return HttpsUtils.doPost(reqUrl + "syn-coupon-rule/v1", req , new HashMap<>());
return object;
}
@ -90,7 +114,7 @@ public class PetroConfig {
* @Param orderNo
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCoupon(String code , String phone , String orderNo) throws Exception{
public JSONObject getCoupon(String code , String phone , String orderNo) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
@ -114,8 +138,17 @@ public class PetroConfig {
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
JSONObject object = HttpsUtils.doPost(reqUrl + "get-coupon", req , new HashMap<>());
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "get-coupon",
req.toString(),
object.toString()
);
// 请求接口
return HttpsUtils.doPost(reqUrl + "get-coupon", req , new HashMap<>());
return object;
}
/**
@ -126,7 +159,7 @@ public class PetroConfig {
* @Param ticketNum
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject couponDetail(String ticketNum) throws Exception{
public JSONObject couponDetail(String ticketNum) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
@ -148,8 +181,23 @@ public class PetroConfig {
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
log.info("============请求任务Start=============");
log.info("购买加油券充值订单-请求参数: " + JSON.toJSONString(req));
// 请求接口
return HttpsUtils.doPost(reqUrl + "couponDetail", req , new HashMap<>());
JSONObject object = HttpsUtils.doPost(reqUrl + "couponDetail", req , new HashMap<>());
log.info("购买加油券充值订单-回调参数: " + JSON.toJSONString(object));
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "get-coupon",
req.toString(),
object.toString()
);
return object;
}
/**

@ -19,7 +19,7 @@ public class HighDiscountPackageAgentRecord implements Serializable {
private Long id;
/**
* 类型1分发 2分配
* 类型1分发 2分配 3:回收
*/
private Integer type;

@ -12,6 +12,7 @@ public enum TripartiteReqLogType {
type6(6, "千猪星巴克"),
type7(7, "千猪话费"),
type8(8, "金猪加油"),
type18(18, "中石油"),
;
private Integer type;

@ -490,7 +490,12 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
// 查询api商户
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
ApiCoupon apiCoupon = apiCouponService.findCoupon(dataObject.getString("code"));
ApiCoupon apiCoupon = apiCouponService.findCoupon(dataObject.getString("couponCode"));
if (apiCoupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前卡券已停用!");
}
// 查询折扣比例
Map<String, Object> mapProduct = new HashMap<>();
@ -518,7 +523,7 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
ApiOrder apiOrder = new ApiOrder();
apiOrder.setCreateTime(new Date());
apiOrder.setTitle(apiMerchants.getMerchantName() + "|" + OrderProductType.PRODUCT_TYPE18.getName() + "|扣款" + price);
apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice()));
apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice()/100));
apiOrder.setCostPrice(price);
apiOrder.setOrderPrice(price);
apiOrder.setMchId(object.getString("merchId"));

@ -67,7 +67,6 @@ public class ApiOrderServiceImpl implements ApiOrderService {
// 获取下单内容
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
CreateOrderModel createOrderModel = new CreateOrderModel();
createOrderModel.setChildOrderList(new ArrayList<>());
@ -281,6 +280,7 @@ public class ApiOrderServiceImpl implements ApiOrderService {
createOrderChildModel.setSaleCount(1);
createOrderChildModel.setIsTyAgent(false);
createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
createOrderChildModel.setPrice(apiOrder.getCostPrice());
// 组装订单
createOrderModel.getChildOrderList().add(createOrderChildModel);

@ -1280,11 +1280,11 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setMemName(order.getMemName());
childOrder.setMemPhone(order.getMemPhone());
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE12.getNumber());
childOrder.setGoodsType(OrderChildGoodsType.TYPE18.getNumber());
childOrder.setGoodsId(apiCoupon.getId());
childOrder.setGoodsName(apiCoupon.getName());
childOrder.setGoodsSpecName(apiCoupon.getCode());
childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice()));
childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice()/100));
childOrder.setGoodsActualPrice(createOrderChildModel.getPrice());
childOrder.setSaleCount(createOrderChildModel.getSaleCount());
childOrder.setGiveawayType(false);

@ -135,6 +135,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
@Resource
private ApiCouponService apiCouponService;
@Resource
private PetroConfig petroConfig;
@Override
public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard, Map<String,Object> other) {
@ -259,12 +262,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
blxOrderHandle(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE14.getNumber())) {
oilCardHandle(childOrder.getGoodsSpecName(), order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE14.getNumber())) {
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE15.getNumber())) {
levelUp(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) {
group(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE15.getNumber())) {
oilCardHandle(childOrder.getGoodsSpecName(), order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE18.getNumber())) {
petroCoupon(order , childOrder);
}
@ -701,7 +702,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
}
// 发放卡券
JSONObject jsonObject = PetroConfig.getCoupon(apiCoupon.getCode() , order.getMemPhone() , order.getOrderNo());
JSONObject jsonObject = petroConfig.getCoupon(apiCoupon.getCode() , order.getMemPhone() , order.getOrderNo());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
@ -712,14 +713,11 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
if (object.getInteger("code") == 1) {
order.setOrderStatus(OrderStatus.STATUS3.getNumber());
order.setFinishTime(new Date());
order.getHighChildOrderList().get(0).setExt5(object.getString("request_code"));
order.getHighChildOrderList().get(0).setExt6(ticketListObject.getString("ticket_num"));
orderService.updateOrderData(order);
}
order.setOrderStatus(OrderStatus.STATUS3.getNumber());
order.setFinishTime(new Date());
order.getHighChildOrderList().get(0).setExt5(object.getString("request_code"));
order.getHighChildOrderList().get(0).setExt6(ticketListObject.getString("ticket_num"));
orderService.updateOrderData(order);
}

@ -149,4 +149,14 @@ public interface HighDiscountPackageAgentService {
*/
List<HighDiscountPackageAgentCode> getDiscountPackageAgentCodeList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name recoveryDiscountPackage
* @Description // 回收优惠券包
* @Date 16:24 2024/1/2
* @Param object
* @return void
*/
void recoveryDiscountPackage(JSONObject object);
}

@ -55,12 +55,11 @@ public class ApiIpAddressServiceImpl implements ApiIpAddressService {
@Override
public Boolean validationIpAddressLegal(String mchId, String ipAddress) {
// ApiIpAddressExample example = new ApiIpAddressExample();
// example.createCriteria().andMchIdEqualTo(mchId).andIpAddressLike("%" + ipAddress + "%");
//
// List<ApiIpAddress> list = apiIpAddressMapper.selectByExample(example);
//
// return list.size()>0;
return true;
ApiIpAddressExample example = new ApiIpAddressExample();
example.createCriteria().andMchIdEqualTo(mchId).andIpAddressLike("%" + ipAddress + "%");
List<ApiIpAddress> list = apiIpAddressMapper.selectByExample(example);
return list.size()>0;
}
}

@ -62,7 +62,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
private HighAgentService highAgentService;
@Resource
private HuiLianTongConfig huiLianTongConfig;
private PetroConfig petroConfig;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@ -378,7 +378,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponCodeOther.setType(6);
}
// 发放卡券
JSONObject jsonObject = PetroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");

@ -85,6 +85,9 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
@Resource
private OrderService orderService;
@Resource
private PetroConfig petroConfig;
@Override
public void insertList(List<HighCouponCode> list) throws Exception {
for (HighCouponCode highCouponCode: list) {
@ -534,7 +537,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
}
// 发放卡券
JSONObject jsonObject = PetroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");

@ -82,6 +82,9 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
@Resource
private SecConfigService secConfigService;
@Resource
private PetroConfig petroConfig;
@Override
public void insertCodeList(List<HighDiscountAgentCode> discountAgentCodeList) {
highDiscountAgentCodeMapper.insertListCode(discountAgentCodeList);
@ -313,7 +316,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = PetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
JSONObject preSendCoupon = petroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
if (!preSendCoupon.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "系统维护中");
}
@ -350,7 +353,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = PetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
JSONObject preSendCoupon = petroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
if (!preSendCoupon.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "系统维护中");
}

@ -7,15 +7,21 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.config.CommonSysConst;
import com.hai.dao.HighDiscountPackageAgentCodeMapper;
import com.hai.dao.HighDiscountPackageAgentRecordMapper;
import com.hai.dao.HighDiscountPackageAgentRelMapper;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.UserInfoModel;
import com.hai.service.HighAgentService;
import com.hai.service.HighDiscountPackageActualService;
import com.hai.service.HighDiscountPackageAgentService;
import com.hai.service.HighDiscountPackageService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -43,10 +49,18 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighAgentService highAgentService;
@Resource
private RedisUtil redisUtil;
@Autowired
private UserCenter userCenter;
@Override
public void insertDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel) {
discountPackageAgentRelMapper.insert(discountPackageAgentRel);
@ -272,4 +286,94 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
return discountPackageAgentCodeMapper.selectByExample(example);
}
@Override
@Transactional(propagation= Propagation.REQUIRED)
public void recoveryDiscountPackage(JSONObject object) {
// 用户信息
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
// 查询代理商
HighAgent agent = highAgentService.findByAgentMsgId(object.getLong("agentId"));
// 查询优惠券包
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(object.getInteger("discountPackageId"));
// 判断代理商状态是否正常
if (agent.getStatus() != 1) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前代理商不支持回收库存!");
}
// 查询代理商与优惠券包的关联关系
Map<String , Object> map = new HashMap<>();
map.put("agentId" , object.getLong("agentId"));
map.put("discountPackageId" , object.getLong("discountPackageId"));
map.put("type" , 1);
// 判断是否库存足够回收
HighDiscountPackageAgentRel discountPackageAgentRel = discountPackageAgentService.getDetailRelByMap(map);
if (discountPackageAgentRel != null && discountPackageAgentRel.getStockCount() < object.getInteger("num") ) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存数量不足");
}
// 录入回收记录
HighDiscountPackageAgentRecord discountPackageAgentRecord = new HighDiscountPackageAgentRecord();
discountPackageAgentRecord.setAgentId(object.getLong("agentId"));
discountPackageAgentRecord.setAgentName(agent.getAgentName());
discountPackageAgentRecord.setDiscountPackageId(object.getLong("discountPackageId"));
discountPackageAgentRecord.setDiscountPackageTitle(discountPackage.getTitle());
discountPackageAgentRecord.setCreateTime(new Date());
discountPackageAgentRecord.setUpdateTime(new Date());
discountPackageAgentRecord.setStatus(1);
discountPackageAgentRecord.setType(3);
discountPackageAgentRecord.setOpId(userInfoModel.getSecUser().getId());
discountPackageAgentRecord.setOpName(userInfoModel.getSecUser().getLoginName());
discountPackageAgentRecord.setCount(object.getInteger("num"));
discountPackageAgentRecord.setAfterCount(discountPackageAgentRel.getStockCount());
discountPackageAgentRecord.setFrontCount(discountPackageAgentRel.getStockCount() - object.getInteger("num"));
discountPackageAgentRecord.setExt1("代理商id:" + object.getLong("agentId") + "-优惠券包名称" + discountPackage.getTitle() + "-回收数量" + object.getInteger("num"));
discountPackageAgentService.insertDiscountPackageAgentRecord(discountPackageAgentRecord);
// 回收库存
discountPackageAgentRel.setStockCount(discountPackageAgentRel.getStockCount()-object.getInteger("num"));
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRel);
if (agent.getParentId() == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前代理商不支持回收库存!");
}
// 查询上级代理商
Map<String , Object> mapParent = new HashMap<>();
mapParent.put("agentId" , agent.getParentId());
mapParent.put("discountPackageId" , object.getLong("discountPackageId"));
mapParent.put("type" , 1);
HighDiscountPackageAgentRel discountPackageAgentRelParent = discountPackageAgentService.getDetailRelByMap(mapParent);
if (discountPackageAgentRelParent == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "未查询到相关信息!");
}
// 录入回收记录
HighDiscountPackageAgentRecord discountPackageAgentRecordParent = new HighDiscountPackageAgentRecord();
discountPackageAgentRecordParent.setAgentId(object.getLong("agentId"));
discountPackageAgentRecordParent.setAgentName(agent.getAgentName());
discountPackageAgentRecordParent.setDiscountPackageId(object.getLong("discountPackageId"));
discountPackageAgentRecordParent.setDiscountPackageTitle(discountPackage.getTitle());
discountPackageAgentRecordParent.setCreateTime(new Date());
discountPackageAgentRecordParent.setUpdateTime(new Date());
discountPackageAgentRecordParent.setStatus(1);
discountPackageAgentRecordParent.setType(3);
discountPackageAgentRecordParent.setOpId(userInfoModel.getSecUser().getId());
discountPackageAgentRecordParent.setOpName(userInfoModel.getSecUser().getLoginName());
discountPackageAgentRecordParent.setCount(object.getInteger("num"));
discountPackageAgentRecordParent.setAfterCount(discountPackageAgentRelParent.getStockCount());
discountPackageAgentRecordParent.setFrontCount(discountPackageAgentRelParent.getStockCount() + object.getInteger("num"));
discountPackageAgentRecordParent.setExt1("代理商id:" + object.getLong("agentId") + "-优惠券包名称" + discountPackage.getTitle() + "-回收数量" + object.getInteger("num"));
discountPackageAgentService.insertDiscountPackageAgentRecord(discountPackageAgentRecordParent);
// 上级回收库存
discountPackageAgentRelParent.setStockCount(discountPackageAgentRelParent.getStockCount()+object.getInteger("num"));
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRelParent);
}
}

@ -100,6 +100,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/fileUpload/*")
.excludePathPatterns("/orderRebate/*")
.excludePathPatterns("/refuelOnline/*")
.excludePathPatterns("/apiCoupon/*")
;
}

@ -6,15 +6,14 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.PetroConfig;
import com.hai.entity.ApiCoupon;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiOrder;
import com.hai.entity.*;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiCouponService;
import com.hai.openApi.service.ApiOrderService;
import com.hai.order.type.OrderProductType;
import com.hai.service.ApiIpAddressService;
import com.hai.service.ApiMerchantsService;
import com.hai.service.HighOrderService;
import com.hai.service.SecConfigService;
import com.v1.config.ToolConfig;
import io.swagger.annotations.Api;
@ -55,6 +54,14 @@ public class ApiCouponController {
@Resource
private ApiOrderService apiOrderService;
@Resource
private PetroConfig petroConfig;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/getCouponList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取卡券列表")
@ -176,12 +183,26 @@ public class ApiCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null);
JSONObject jsonObject = PetroConfig.couponDetail(apiOrder.getExt3());
HighOrder highOrder = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo());
HighChildOrder childOrder = highOrder.getHighChildOrderList().get(0);
// 派发停车券
ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName());
if (apiCoupon.getType().equals(1)) {
PetroConfig.init(1);
} else {
PetroConfig.init(2);
}
JSONObject jsonObject = petroConfig.couponDetail(apiOrder.getExt3());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前订单未查询到!");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));

@ -378,6 +378,10 @@ public class orderController {
ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null);
if (apiOrder == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未找到相关订单信息!");
}
HighOrder order = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo());

Loading…
Cancel
Save