From 557366a3ec40402fb3dea1302ab5a90cbb4f1adc Mon Sep 17 00:00:00 2001 From: misworga831 Date: Thu, 3 Aug 2023 15:57:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96elasticsearch=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E8=A7=A3=E5=86=B3I/O=20reactor?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/elasticsearch/config/ElasticsearchConfig.java | 8 +++++++- .../search/serviceimpl/EsGoodsIndexServiceImpl.java | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/framework/src/main/java/cn/lili/elasticsearch/config/ElasticsearchConfig.java b/framework/src/main/java/cn/lili/elasticsearch/config/ElasticsearchConfig.java index 6010a2a4..6f384fd9 100644 --- a/framework/src/main/java/cn/lili/elasticsearch/config/ElasticsearchConfig.java +++ b/framework/src/main/java/cn/lili/elasticsearch/config/ElasticsearchConfig.java @@ -9,6 +9,7 @@ import org.apache.http.client.CredentialsProvider; import org.apache.http.conn.ConnectionKeepAliveStrategy; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; +import org.apache.http.impl.nio.reactor.IOReactorConfig; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestHighLevelClient; @@ -72,7 +73,12 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration { CredentialsProvider credentialsProvider) { httpClientBuilder .setKeepAliveStrategy(getConnectionKeepAliveStrategy()) - .setMaxConnPerRoute(10); + .setMaxConnPerRoute(10) + .setDefaultIOReactorConfig( + IOReactorConfig + .custom() + .setIoThreadCount(Runtime.getRuntime().availableProcessors()) + .build()); if (credentialsProvider != null) { httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); } diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java index 312f9441..a6af95c8 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java @@ -455,8 +455,9 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements this.client.bulkAsync(request, RequestOptions.DEFAULT, new ActionListener() { @Override public void onResponse(BulkResponse bulkItemResponses) { - if (bulkItemResponses.hasFailures()) { - throw new RetryException("批量更新商品索引失败,es内容版本冲突"); + log.info("批量更新商品索引结果:{}", bulkItemResponses.buildFailureMessage()); + if (bulkItemResponses.hasFailures() && bulkItemResponses.getItems().length > 0) { + throw new RetryException("批量更新商品索引失败," + bulkItemResponses.buildFailureMessage()); } } From 1cc692a3c98d44004e8e0209f3fc1fa1108b031c Mon Sep 17 00:00:00 2001 From: misworga831 Date: Thu, 3 Aug 2023 16:13:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E8=80=85=E9=83=A8=E5=88=86=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/event/impl/NoticeMessageExecute.java | 2 +- .../modules/search/serviceimpl/EsGoodsIndexServiceImpl.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java index 3dfc8b1e..f166cd25 100644 --- a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java @@ -58,7 +58,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent, OrderDetailVO orderDetailVO = orderService.queryDetail(orderMessage.getOrderSn()); NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO(); //如果订单状态不为空 - if (orderDetailVO != null) { + if (orderDetailVO != null && orderDetailVO.getOrderItems() != null && !orderDetailVO.getOrderItems().isEmpty()) { Map params = new HashMap<>(2); switch (orderMessage.getNewStatus()) { //如果订单新的状态为已取消 则发送取消订单站内信 diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java index a6af95c8..0e44fd14 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java @@ -455,10 +455,8 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements this.client.bulkAsync(request, RequestOptions.DEFAULT, new ActionListener() { @Override public void onResponse(BulkResponse bulkItemResponses) { + // 判断索引如果不存在的处理 log.info("批量更新商品索引结果:{}", bulkItemResponses.buildFailureMessage()); - if (bulkItemResponses.hasFailures() && bulkItemResponses.getItems().length > 0) { - throw new RetryException("批量更新商品索引失败," + bulkItemResponses.buildFailureMessage()); - } } @Override From d61fc414659d12bf87f184f3b91eaaed143ab660 Mon Sep 17 00:00:00 2001 From: misworga831 Date: Thu, 3 Aug 2023 16:16:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E8=80=85=E9=83=A8=E5=88=86=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/search/serviceimpl/CustomWordsServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java index 405050fa..2b8c9e1c 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java @@ -92,6 +92,7 @@ public class CustomWordsServiceImpl extends ServiceImpl names) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.in(CustomWords::getName, names); @@ -99,6 +100,7 @@ public class CustomWordsServiceImpl extends ServiceImpl customWordsList) { return this.baseMapper.insertBatchSomeColumn(customWordsList); } From 7d8a31c55af44bedfec577babeebf2aadf736496 Mon Sep 17 00:00:00 2001 From: "pikachu1995@126.com" Date: Fri, 4 Aug 2023 18:23:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?APP=E7=AB=AF=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passport/connect/ConnectBuyerWebController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java b/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java index bbe988ea..90bf661f 100644 --- a/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java +++ b/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java @@ -76,8 +76,8 @@ public class ConnectBuyerWebController { } @ApiOperation(value = "APP-unionID登录") - @GetMapping("/app/login") - public ResultMessage unionLogin(ConnectAuthUser authUser, @RequestHeader("uuid") String uuid) { + @PostMapping("/app/login") + public ResultMessage unionLogin(@RequestBody ConnectAuthUser authUser, @RequestHeader("uuid") String uuid) { try { return ResultUtil.data(connectService.unionLoginCallback(authUser, uuid)); } catch (Exception e) {