Skip to content

Commit

Permalink
!155 修复结算时,清空购物车问题
Browse files Browse the repository at this point in the history
Merge pull request !155 from OceansDeep/feature/pg
  • Loading branch information
OceansDeep authored and gitee-org committed May 6, 2022
2 parents f41f538 + fd92d93 commit 5b9fd13
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package cn.lili.common.aop.interceptor;

/**
* 防重复提交业务
*
* @author Chopper
* @version v1.0
* 2022-01-25 09:20
*/

import cn.lili.cache.Cache;
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.enums.ResultCode;
Expand All @@ -23,6 +15,13 @@

import javax.servlet.http.HttpServletRequest;

/**
* 防重复提交业务
*
* @author Chopper
* @version v1.0
* 2022-01-25 09:20
*/
@Aspect
@Component
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,7 @@ public Boolean updateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum good
LambdaQueryWrapper<Goods> queryWrapper = this.getQueryWrapperByStoreAuthority();
queryWrapper.in(Goods::getId, goodsIds);
List<Goods> goodsList = this.list(queryWrapper);
for (Goods goods : goodsList) {
goodsSkuService.updateGoodsSkuStatus(goods);
}

if (GoodsStatusEnum.DOWN.equals(goodsStatusEnum)) {
this.deleteEsGoods(goodsIds);
}
this.updateGoodsStatus(goodsIds, goodsStatusEnum, goodsList);
return result;
}

Expand Down Expand Up @@ -362,15 +356,7 @@ public Boolean managerUpdateGoodsMarketAble(List<String> goodsIds, GoodsStatusEn
LambdaQueryWrapper<Goods> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Goods::getId, goodsIds);
List<Goods> goodsList = this.list(queryWrapper);
for (Goods goods : goodsList) {
if (GoodsStatusEnum.DOWN.equals(goodsStatusEnum)) {
cache.remove(CachePrefix.GOODS.getPrefix() + goods.getId());
}
goodsSkuService.updateGoodsSkuStatus(goods);
}
if (GoodsStatusEnum.DOWN.equals(goodsStatusEnum)) {
this.deleteEsGoods(goodsIds);
}
this.updateGoodsStatus(goodsIds, goodsStatusEnum, goodsList);
return result;
}

Expand All @@ -391,6 +377,7 @@ public Boolean deleteGoods(List<String> goodsIds) {
for (Goods goods : goodsList) {
//修改SKU状态
goodsSkuService.updateGoodsSkuStatus(goods);
cache.remove(CachePrefix.GOODS.getPrefix() + goods.getId());
}

this.deleteEsGoods(goodsIds);
Expand Down Expand Up @@ -479,6 +466,26 @@ public long countStoreGoodsNum(String storeId) {
}


/**
* 更新商品状态
*
* @param goodsIds 商品ID
* @param goodsStatusEnum 商品状态
* @param goodsList 商品列表
*/
private void updateGoodsStatus(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, List<Goods> goodsList) {
for (Goods goods : goodsList) {
if (GoodsStatusEnum.DOWN.equals(goodsStatusEnum)) {
cache.remove(CachePrefix.GOODS.getPrefix() + goods.getId());
}
goodsSkuService.updateGoodsSkuStatus(goods);
}

if (GoodsStatusEnum.DOWN.equals(goodsStatusEnum)) {
this.deleteEsGoods(goodsIds);
}
}

/**
* 发送删除es索引的信息
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public Trade createTrade(TradeParams tradeParams) {
}
//构建交易
Trade trade = tradeBuilder.createTrade(tradeDTO);
this.cleanChecked(tradeDTO);
this.cleanChecked(this.readDTO(cartTypeEnum));
return trade;
}

Expand Down

0 comments on commit 5b9fd13

Please sign in to comment.