|
@@ -29,8 +29,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.transaction.support.TransactionSynchronization;
|
|
|
-import org.springframework.transaction.support.TransactionSynchronizationManager;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
@@ -125,26 +123,35 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|
|
}
|
|
|
memberUserMapper.insert(user);
|
|
|
|
|
|
- // 注册事务同步适配器
|
|
|
- registerTransactionSynchronization(user.getId(), linkId);
|
|
|
+ // 如果注册的时候关系链创建失败则需要返回让用户重新注册
|
|
|
+ try {
|
|
|
+ sharePathProducer.sendSharePathCreatMessage(linkId, user.getId());
|
|
|
+ if (linkId != null) {
|
|
|
+ shareLinkRegisterProducer.sendShareLinkRegisterMessage(linkId, user.getId());
|
|
|
+ }
|
|
|
+ memberUserProducer.sendUserCreateMessage(user.getId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw exception(RELOAD_REGISTER);
|
|
|
+ }
|
|
|
|
|
|
return user;
|
|
|
}
|
|
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void registerTransactionSynchronization(Long userId, Long linkId) {
|
|
|
- // 发送 消息:用户创建
|
|
|
- TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
- @Override
|
|
|
- public void afterCommit() {
|
|
|
- sharePathProducer.sendSharePathCreatMessage(linkId, userId);
|
|
|
- if (linkId != null) {
|
|
|
- shareLinkRegisterProducer.sendShareLinkRegisterMessage(linkId, userId);
|
|
|
- }
|
|
|
- memberUserProducer.sendUserCreateMessage(userId);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ //现在这个不用了
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// public void registerTransactionSynchronization(Long userId, Long linkId) {
|
|
|
+// // 发送 消息:用户创建
|
|
|
+// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
+// @Override
|
|
|
+// public void afterCommit() {
|
|
|
+// sharePathProducer.sendSharePathCreatMessage(linkId, userId);
|
|
|
+// if (linkId != null) {
|
|
|
+// shareLinkRegisterProducer.sendShareLinkRegisterMessage(linkId, userId);
|
|
|
+// }
|
|
|
+// memberUserProducer.sendUserCreateMessage(userId);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
|
public void updateUserLogin(Long id, String loginIp) {
|