From 4cba23c4c9560e5f08068f5738b068e8268cf57e Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 9 Mar 2026 16:50:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BF=E5=AE=A2=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=B9=B6=E5=8F=91=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E9=94=99=E8=AF=AF=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UserSupportRelationVisitorAddCmdExe.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserSupportRelationVisitorAddCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserSupportRelationVisitorAddCmdExe.java index d4913289..fb0b1997 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserSupportRelationVisitorAddCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserSupportRelationVisitorAddCmdExe.java @@ -13,6 +13,8 @@ import com.red.circle.other.infra.database.rds.service.user.user.UserInterviewSe import com.red.circle.tool.core.text.StringUtils; import java.util.Objects; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Component; /** @@ -20,6 +22,7 @@ import org.springframework.stereotype.Component; * * @author pengliang on 2023/8/10 */ +@Slf4j @Component @RequiredArgsConstructor public class UserSupportRelationVisitorAddCmdExe { @@ -46,10 +49,15 @@ public class UserSupportRelationVisitorAddCmdExe { return; } - userInterviewService.save(new UserInterview() - .setUserId(cmd.getReqUserId()) - .setInterviewUserId(cmd.getUserId()) - ); + try { + userInterviewService.save(new UserInterview() + .setUserId(cmd.getReqUserId()) + .setInterviewUserId(cmd.getUserId()) + ); + } catch (DuplicateKeyException e) { + log.warn("relation_user_interview duplicate, userId={}, interviewUserId={}, ignored", cmd.getReqUserId(), cmd.getUserId()); + return; + } userRelationsCalculatorGateway.process( new UserRelationsCalculator() .setUserId(cmd.getUserId())