diff --git a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml index 3b6e50656..16243b079 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml +++ b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml @@ -63,11 +63,12 @@ spring: password: root # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 192.168.1.205 # 地址 - port: 6379 # 端口 - database: 1 # 数据库索引 - password: cf@2024 # 密码,建议生产环境开启 + data: + redis: + host: 192.168.1.205 # 地址 + port: 6379 # 端口 + database: 1 # 数据库索引 + password: cf@2024 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml index 1622952fd..0bfbe698a 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml +++ b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml @@ -74,10 +74,11 @@ spring: # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 + data: + redis: + host: 127.0.0.1 # 地址 + port: 6379 # 端口 + database: 0 # 数据库索引 # password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderInputProcessor.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderInputProcessor.java index a4f68636d..73b7c3c65 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderInputProcessor.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderInputProcessor.java @@ -192,8 +192,7 @@ public class OrderInputProcessor { throw new ServiceException(500, "未知异常"); } } catch (IOException | ElasticsearchException e) { - e.printStackTrace(); - log.error(e.getMessage()); + log.error(e.getMessage(), e); throw new RuntimeException(e); } @@ -217,50 +216,38 @@ public class OrderInputProcessor { throw new ServiceException(500, "未知异常"); } } catch (IOException | ElasticsearchException e) { - e.printStackTrace(); - log.error(e.getMessage()); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } /** - * 生产单id查询文档id - */ - public List buildRespByOrderId(Long orderId, String index, Integer size) { - SearchRequest.Builder builder = new SearchRequest.Builder(); - builder.index(index); - builder.size(size); - builder.query(q -> q.term(b -> b.field(FIELD_ORDER_ID).value(orderId))); - - builder.source(s -> s.fetch(false)); - - try { - SearchResponse search = elasticsearchClient.search(builder.build(), Object.class); - List> hits = search.hits().hits(); - if (CollUtil.isNotEmpty(hits)) { - return hits.stream().map(Hit::id).collect(Collectors.toList()); - } - return new ArrayList<>(); - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } - } - - /** - * 生产单Id批量删除 + * 生产单Id删除 */ public void deleteByOrderId(Long orderId, String index) { - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder(); - builder.index(index); - builder.query(q -> q.term(t -> t.field(FIELD_ORDER_ID).value(orderId))); - try { - DeleteByQueryResponse response = elasticsearchClient.deleteByQuery(builder.build()); - log.info("Deleted {} documents with planId {}", response.deleted(), orderId); + // 查文档_id + SearchResponse search = elasticsearchClient.search(s -> s + .index(index) + .size(1) // 只取一条 + .query(q -> q.term(t -> t.field("orderId").value(orderId))) + .source(src -> src.fetch(false)), // 不拉取 _source + Void.class + ); + List> hits = search.hits().hits(); + if (hits.isEmpty()) { + log.warn("No document found for orderId: {}", orderId); + return; + } + + String docId = hits.get(0).id(); + + // 按 _id 删除 + elasticsearchClient.delete(d -> d.index(index).id(docId)); + log.info("Successfully deleted document with orderId={} (docId={})", orderId, docId); } catch (IOException | ElasticsearchException e) { - log.error("Error deleting documents with planId {}: {}", orderId, e.getMessage()); + log.error("Error deleting documents with orderId {}: {}", orderId, e); throw new ServiceException(INTERNAL_SERVER_ERROR); } } @@ -280,7 +267,7 @@ public class OrderInputProcessor { DeleteByQueryResponse response = elasticsearchClient.deleteByQuery(builder.build()); log.info("Deleted {} documents with planId {}", response.deleted(), orderIds); } catch (IOException | ElasticsearchException e) { - log.error("Error deleting documents with planId {}: {}", orderIds, e.getMessage()); + log.error("Error deleting documents with planId {}: {}", orderIds, e); throw new ServiceException(INTERNAL_SERVER_ERROR); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml index 90e572c1d..de550d717 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml @@ -63,11 +63,12 @@ spring: password: root # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 192.168.1.205 # 地址 - port: 6379 # 端口 - database: 1 # 数据库索引 - password: cf@2024 # 密码,建议生产环境开启 + data: + redis: + host: 192.168.1.205 # 地址 + port: 6379 # 端口 + database: 1 # 数据库索引 + password: cf@2024 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml index 930e3938e..39e754563 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml @@ -80,10 +80,11 @@ spring: password: root # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 + data: + redis: + host: 127.0.0.1 # 地址 + port: 6379 # 端口 + database: 0 # 数据库索引 # password: 123456 # 密码,建议生产环境开启 diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml index 971dab8e4..6ac7d81e5 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml @@ -63,11 +63,12 @@ spring: password: root # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 192.168.1.205 # 地址 - port: 6379 # 端口 - database: 1 # 数据库索引 - password: cf@2024 # 密码,建议生产环境开启 + data: + redis: + host: 192.168.1.205 # 地址 + port: 6379 # 端口 + database: 1 # 数据库索引 + password: cf@2024 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml index cc4f28de8..b67341ee9 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml @@ -70,10 +70,11 @@ spring: # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 + data: + redis: + host: 127.0.0.1 # 地址 + port: 6379 # 端口 + database: 0 # 数据库索引 # password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml b/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml index 65f6a70f3..ad76d1854 100644 --- a/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml +++ b/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml @@ -64,11 +64,12 @@ spring: # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 192.168.1.205 # 地址 - port: 6379 # 端口 - database: 1 # 数据库索引 - password: cf@2024 # 密码,建议生产环境开启 + data: + redis: + host: 192.168.1.205 # 地址 + port: 6379 # 端口 + database: 1 # 数据库索引 + password: cf@2024 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml b/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml index 736ace149..8c388ffe4 100644 --- a/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml +++ b/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml @@ -71,11 +71,12 @@ spring: # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 -# password: 123456 # 密码,建议生产环境开启 + data: + redis: + host: 127.0.0.1 # 地址 + port: 6379 # 端口 + database: 0 # 数据库索引 + # password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml index ae7102fbe..3cf012d5f 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml @@ -61,11 +61,12 @@ spring: password: root # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 192.168.1.205 # 地址 - port: 6379 # 端口 - database: 1 # 数据库索引 - password: cf@2024 # 密码,建议生产环境开启 + data: + redis: + host: 192.168.1.205 # 地址 + port: 6379 # 端口 + database: 1 # 数据库索引 + password: cf@2024 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml index 9be09aea1..f19e009c8 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml @@ -68,10 +68,11 @@ spring: # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 + data: + redis: + host: 127.0.0.1 # 地址 + port: 6379 # 端口 + database: 0 # 数据库索引 # password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 ####################