diff --git a/common-api/src/main/resources/application.yml b/common-api/src/main/resources/application.yml index a914b499..f139f9bd 100644 --- a/common-api/src/main/resources/application.yml +++ b/common-api/src/main/resources/application.yml @@ -121,6 +121,7 @@ ignored: - /source/** - /common/common/slider/** - /common/common/sms/** + - /common/common/logo - /druid/** - /swagger-ui.html - /doc.html diff --git a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java index 263cf18f..77a3a66b 100644 --- a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java +++ b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java @@ -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); } } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 70fa8277..0655f583 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -306,13 +306,7 @@ public class GoodsServiceImpl extends ServiceImpl implements LambdaQueryWrapper queryWrapper = this.getQueryWrapperByStoreAuthority(); queryWrapper.in(Goods::getId, goodsIds); List 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 implements LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.in(Goods::getId, goodsIds); List 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 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 implements } + /** + * 更新商品状态 + * + * @param goodsIds 商品ID + * @param goodsStatusEnum 商品状态 + * @param goodsList 商品列表 + */ + private void updateGoodsStatus(List goodsIds, GoodsStatusEnum goodsStatusEnum, List 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索引的信息 * diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java index ccf3e7d8..b271f7c0 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java @@ -542,7 +542,7 @@ public class CartServiceImpl implements CartService { } //构建交易 Trade trade = tradeBuilder.createTrade(tradeDTO); - this.cleanChecked(tradeDTO); + this.cleanChecked(this.readDTO(cartTypeEnum)); return trade; } diff --git a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsAttribute.java b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsAttribute.java index bbfad035..434f3a09 100644 --- a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsAttribute.java +++ b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsAttribute.java @@ -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; diff --git a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java index b4cdf3fd..73f01614 100644 --- a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java +++ b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java @@ -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; /**