增加访客记录接口,并发插入错误兼容处理
This commit is contained in:
parent
db8930a76e
commit
4cba23c4c9
@ -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())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user