From 4fce0df8ed3145910b15e0eaa4346ffc032875f5 Mon Sep 17 00:00:00 2001 From: cst61 Date: Thu, 7 May 2026 09:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B3=E5=9B=A0=E4=B8=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=9E=E6=8E=A5=E9=97=AE=E9=A2=98=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=8F=92=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../CustomerManagementController.java | 8 +++++- .../impl/LbDailyUserTradeServiceImpl.java | 26 ++++++++++++++----- src/main/resources/application.yml | 16 ++++++------ 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 9e83459..d7a094d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.cst AIDriverEEBackend - 1.260502.1-SNAPSHOT + 1.260504.1-SNAPSHOT Langchain4j-rj Langchain4j-rj20250803 diff --git a/src/main/java/com/rj/controller/CustomerManagementController.java b/src/main/java/com/rj/controller/CustomerManagementController.java index 4a36628..3f2f6a8 100644 --- a/src/main/java/com/rj/controller/CustomerManagementController.java +++ b/src/main/java/com/rj/controller/CustomerManagementController.java @@ -248,7 +248,10 @@ public class CustomerManagementController { @Parameter(description = "所属人姓名(模糊查询)")@RequestParam(required = false) String salesName, @Parameter(description = "所属人电话")@RequestParam(required = false) String salesPhone, @Parameter(description = "联系方式(模糊查询)") - @RequestParam(required = false) String contact) { + @RequestParam(required = false) String contact, + @Parameter(description = "联系方式(模糊查询)") + @RequestParam(required = false) String stage + ) { Map result = new HashMap<>(); try { Page page = new Page<>(current, size); @@ -264,6 +267,9 @@ public class CustomerManagementController { if (contact != null && !contact.trim().isEmpty()) { queryWrapper.like(CustomerManagement::getContact, contact); } + if (stage != null && !stage.trim().isEmpty()) { + queryWrapper.eq(CustomerManagement::getStage, stage); + } // 按创建时间倒序排列 queryWrapper.orderByDesc(CustomerManagement::getUpdateTime); diff --git a/src/main/java/com/rj/service/impl/LbDailyUserTradeServiceImpl.java b/src/main/java/com/rj/service/impl/LbDailyUserTradeServiceImpl.java index ba7de6c..87c61cd 100644 --- a/src/main/java/com/rj/service/impl/LbDailyUserTradeServiceImpl.java +++ b/src/main/java/com/rj/service/impl/LbDailyUserTradeServiceImpl.java @@ -51,6 +51,12 @@ import java.util.regex.Pattern; public class LbDailyUserTradeServiceImpl extends ServiceImpl implements ILbDailyUserTradeService { private static final Logger log = LoggerFactory.getLogger(LbDailyUserTradeServiceImpl.class); private static final BigDecimal SERVICE_RATE = new BigDecimal("0.01"); + /** + * MyBatis-Plus {@code saveBatch(list)} uses one SqlSession for the whole list and only closes after commit. + * Large imports can exceed Hikari {@code leakDetectionThreshold} (borrow time), producing false leak warnings. + * Chunking yields shorter per-connection holds and matches pool-friendly batch sizing. + */ + private static final int EXCEL_IMPORT_SAVE_CHUNK_SIZE = 1000; @Autowired private ILbDailyUserTradeReportService lbDailyUserTradeReportService; @@ -263,12 +269,20 @@ public class LbDailyUserTradeServiceImpl extends ServiceImpl chunk = importList.subList(from, to); + if (!this.saveBatch(chunk)) { + log.error("导入数据保存失败,fileName={}, importCount={}, failedChunk=[{}, {})", + originalFilename, total, from, to); + result.put("success", false); + result.put("message", "导入失败,数据库保存异常(批次失败,可能已写入部分数据)"); + result.put("importCount", from); + result.put("skipCount", skippedRows.size()); + result.put("skippedRows", skippedRows); + return result; + } } log.info("导入成功,fileName={}, importCount={}, skipCount={}", diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2949f19..ca5cf98 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -98,17 +98,17 @@ spring: pool: size: 8 thread-name-prefix: app-scheduling- - data: - redis: - port: 6389 - host: 124.221.59.58 - password: qwe123 - database: 0 +# data: +# redis: +# port: 6389 +# host: 124.221.59.58 +# password: qwe123 +# database: 0 datasource: driver-class-name: com.mysql.cj.jdbc.Driver # tcpKeepAlive:TCP 层定期发保活包,降低 NAT/防火墙 idle 断连(常见约 15 分钟)概率 -# url: jdbc:mysql://124.221.59.58:3309/ai_smart_ee?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&tcpKeepAlive=true&socketTimeout=60000&connectTimeout=30000&autoReconnect=true&failOverReadOnly=false&maxReconnects=3&initialTimeout=2 - url: jdbc:mysql://192.168.1.44:3309/ai_smart_ee?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&tcpKeepAlive=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=3&initialTimeout=2&connectTimeout=30000&socketTimeout=60000 + url: jdbc:mysql://101.35.52.237:13319/ai_smart_ee?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&tcpKeepAlive=true&socketTimeout=60000&connectTimeout=30000&autoReconnect=true&failOverReadOnly=false&maxReconnects=3&initialTimeout=2 +# url: jdbc:mysql://192.168.1.44:3309/ai_smart_ee?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&tcpKeepAlive=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=3&initialTimeout=2&connectTimeout=30000&socketTimeout=60000 username: root password: cstcom.123! # password: ChangAndb.123!