记得上下班打卡 | git大法好,push需谨慎

Commit 69de7d89 authored by zhangguobing's avatar zhangguobing

~api:券商品业务-券类商品券限购调整;

parent f03d4886
......@@ -195,13 +195,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
//库存回滚
if (surplusGeneral < 0) {
// 这里加的'券类商品实名限购回滚'是因为这里'库存不足'没按异常处理
if (!CollectionUtils.isEmpty(couponSkuIdNoBuyLimitMap)) {// 券类商品实名限购回滚
couponSkuIdNoBuyLimitMap.forEach((couponSkuIdNoBuyLimitKey, numb) -> {
redisUtils.redisUtil.decr(couponSkuIdNoBuyLimitKey, numb);
});
}
return orderUtils.orderException(skuAndPreListAndNumber, platformCodeList, storeCodeList, uid, "库存不足");
return orderUtils.orderException(skuAndPreListAndNumber, platformCodeList, storeCodeList, uid, "库存不足", couponSkuIdNoBuyLimitMap);
// throw new Exception("库存不足");
}
}//GoblinOrderSkuParam
......@@ -223,7 +217,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderSqlParams.add(sqlParam);
}//GoblinOrderStoreParam
if (preParam.getOrderIdList().equals("")) {
return orderUtils.orderException(skuAndPreListAndNumber, platformCodeList, storeCodeList, uid, "参数异常");
return orderUtils.orderException(skuAndPreListAndNumber, platformCodeList, storeCodeList, uid, "参数异常", couponSkuIdNoBuyLimitMap);
// throw new Exception("参数异常");
}
ResponseDto<GoblinPayInnerResultVo> data = payOrder(preParam, orderSqlParams, uid);
......
......@@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import java.math.BigDecimal;
......@@ -526,7 +527,9 @@ public class GoblinOrderUtils {
}
//订单异常处理
public ResponseDto<GoblinPayInnerResultVo> orderException(List<String> skuAndPreListAndNumber, List<String> platformCodeList, List<String> storeCodeList, String uid, String message) {
public ResponseDto<GoblinPayInnerResultVo> orderException(List<String> skuAndPreListAndNumber, List<String> platformCodeList,
List<String> storeCodeList, String uid, String message,
HashMap<String, Integer> couponSkuIdNoBuyLimitMap) {
long time3 = System.currentTimeMillis();
//回顾限购 回滚库存
for (String item : skuAndPreListAndNumber) {
......@@ -554,6 +557,12 @@ public class GoblinOrderUtils {
if (params.size() > 0) {
backStoreCoupon(params);
}
// 这里加的'券类商品实名限购回滚'是因为这里'库存不足'没按异常处理
if (!CollectionUtils.isEmpty(couponSkuIdNoBuyLimitMap)) {// 券类商品实名限购回滚
couponSkuIdNoBuyLimitMap.forEach((couponSkuIdNoBuyLimitKey, numb) -> {
redisUtils.redisUtil.decr(couponSkuIdNoBuyLimitKey, numb);
});
}
log.info("回滚逻辑 " + (System.currentTimeMillis() - time3) + "ms");
if (message == null && !message.equals("")) {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment