From 674891eba342dccb4042099d63adbe78c2b8b863 Mon Sep 17 00:00:00 2001 From: wanghao Date: Tue, 25 Aug 2026 11:05:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(watch):=20QH=5FWAT=5FUSER=5FDATA=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E5=86=99=E5=85=A5=E5=94=AF=E4=B8=80=E7=BA=A6=E6=9D=9F?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E6=97=B6=E5=BF=BD=E7=95=A5=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit notice接口并发上报同一手表同一天数据时,先删后插存在竞态, 两个线程同时插入触发唯一约束WATCH_USER_DATA_WATCH_NO, 捕获DuplicateKeyException降级为warn日志,数据不丢失 Co-Authored-By: Claude --- .../watch/service/impl/WatchUserDataServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/health-watch/health-watch-biz/src/main/java/com/renkang/watch/service/impl/WatchUserDataServiceImpl.java b/health-watch/health-watch-biz/src/main/java/com/renkang/watch/service/impl/WatchUserDataServiceImpl.java index 3f901da..cb57842 100644 --- a/health-watch/health-watch-biz/src/main/java/com/renkang/watch/service/impl/WatchUserDataServiceImpl.java +++ b/health-watch/health-watch-biz/src/main/java/com/renkang/watch/service/impl/WatchUserDataServiceImpl.java @@ -42,6 +42,7 @@ import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import org.jeecgframework.poi.exception.excel.enums.ExcelExportEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.task.AsyncTaskExecutor; +import org.springframework.dao.DuplicateKeyException; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -208,7 +209,12 @@ public class WatchUserDataServiceImpl extends ServiceImpl