From 66e62725717d738452ec203c888dab5cf789abef Mon Sep 17 00:00:00 2001 From: paulGao Date: Wed, 27 Apr 2022 18:15:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84es=E5=95=86=E5=93=81=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E7=BB=93=E6=9E=84=E3=80=82=E8=A7=A3=E5=86=B3=E5=88=9D?= =?UTF-8?q?=E6=AC=A1=E5=90=AF=E5=8A=A8=E6=97=B6=EF=BC=8C=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common-api/src/main/resources/application.yml | 1 + .../cn/lili/modules/search/entity/dos/EsGoodsAttribute.java | 4 ++-- .../java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) 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/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; /** From f4a7d8ea92eca4b3d9493aa684589ae4a49bbc6e Mon Sep 17 00:00:00 2001 From: paulGao Date: Thu, 5 May 2022 11:57:05 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=98=B2=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8F=90=E4=BA=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aop/interceptor/PreventDuplicateSubmissionsInterceptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..cb098b51 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 @@ -38,7 +38,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); } } From 840637c0d07b32e4ec115d20e98a5c227b4a27ee Mon Sep 17 00:00:00 2001 From: paulGao Date: Thu, 5 May 2022 17:58:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=8A=B6=E6=80=81=E6=97=B6=EF=BC=8C=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=BC=93=E5=AD=98=E7=9A=84=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...reventDuplicateSubmissionsInterceptor.java | 15 ++++--- .../goods/serviceimpl/GoodsServiceImpl.java | 39 +++++++++++-------- 2 files changed, 30 insertions(+), 24 deletions(-) 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 cb098b51..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 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索引的信息 * From fd92d93289e29899d31cc4512497281ff53601f1 Mon Sep 17 00:00:00 2001 From: paulGao Date: Fri, 6 May 2022 15:50:20 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=B8=85=E7=A9=BA=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/order/cart/service/CartServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }