Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
0ff6809d63
@ -121,6 +121,7 @@ ignored:
|
||||
- /source/**
|
||||
- /common/common/slider/**
|
||||
- /common/common/sms/**
|
||||
- /common/common/logo
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
|
@ -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;
|
||||
@ -23,6 +15,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 防重复提交业务
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2022-01-25 09:20
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
@ -38,7 +37,7 @@ public class PreventDuplicateSubmissionsInterceptor {
|
||||
try {
|
||||
Long count = cache.incr(getParams(), preventDuplicateSubmissions.expire());
|
||||
//如果超过1或者设置的参数,则表示重复提交了
|
||||
if (count.intValue() >= preventDuplicateSubmissions.expire()) {
|
||||
if (count.intValue() >= 1) {
|
||||
throw new ServiceException(ResultCode.LIMIT_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -306,13 +306,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
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;
|
||||
}
|
||||
|
||||
@ -362,15 +356,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
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;
|
||||
}
|
||||
|
||||
@ -391,6 +377,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
for (Goods goods : goodsList) {
|
||||
//修改SKU状态
|
||||
goodsSkuService.updateGoodsSkuStatus(goods);
|
||||
cache.remove(CachePrefix.GOODS.getPrefix() + goods.getId());
|
||||
}
|
||||
|
||||
this.deleteEsGoods(goodsIds);
|
||||
@ -479,6 +466,26 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新商品状态
|
||||
*
|
||||
* @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索引的信息
|
||||
*
|
||||
|
@ -542,7 +542,7 @@ public class CartServiceImpl implements CartService {
|
||||
}
|
||||
//构建交易
|
||||
Trade trade = tradeBuilder.createTrade(tradeDTO);
|
||||
this.cleanChecked(tradeDTO);
|
||||
this.cleanChecked(this.readDTO(cartTypeEnum));
|
||||
return trade;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class EsGoodsAttribute implements Serializable {
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
@Field(type = FieldType.Text)
|
||||
@Field(type = FieldType.Text, fielddata = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ public class EsGoodsAttribute implements Serializable {
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
@Field(type = FieldType.Text)
|
||||
@Field(type = FieldType.Text, fielddata = true)
|
||||
private String value;
|
||||
|
||||
|
||||
|
@ -256,9 +256,11 @@ public class EsGoodsIndex implements Serializable {
|
||||
* @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum
|
||||
*/
|
||||
@ApiModelProperty(value = "商品类型", required = true)
|
||||
@Field(type = FieldType.Text)
|
||||
private String goodsType;
|
||||
|
||||
@ApiModelProperty(value = "商品sku基础分数", required = true)
|
||||
@Field(type = FieldType.Integer)
|
||||
private Integer skuSource;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user