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

Commit 69de7d89 authored by zhangguobing's avatar zhangguobing

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

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