|
@@ -1,6 +1,7 @@
|
|
|
package com.citu.module.menduner.system.service.user;
|
|
|
|
|
|
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.lock.annotation.Lock4j;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
@@ -49,9 +50,9 @@ public class UserAccountServiceImpl implements UserAccountService {
|
|
|
|
|
|
@Override
|
|
|
@DSTransactional
|
|
|
- @Lock4j(keys = {"#userId"}, expire = 60000, acquireTimeout = 1000)
|
|
|
+ @Lock4j(keys = {"#userId"}, acquireTimeout = 3000)
|
|
|
public UserAccountDO createUserAccountIfAbsent(Long userId) {
|
|
|
- UserAccountDO accountDO = userAccountMapper.selectByUserId(userId);
|
|
|
+ UserAccountDO accountDO = get(userId);
|
|
|
if (null != accountDO) {
|
|
|
return accountDO;
|
|
|
}
|
|
@@ -71,6 +72,15 @@ public class UserAccountServiceImpl implements UserAccountService {
|
|
|
|
|
|
@Override
|
|
|
public UserAccountDO get() {
|
|
|
- return createUserAccountIfAbsent(LoginUserContext.getUserId());
|
|
|
+ return getSelf().createUserAccountIfAbsent(LoginUserContext.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得自身的代理对象,解决 AOP 生效问题
|
|
|
+ *
|
|
|
+ * @return 自己
|
|
|
+ */
|
|
|
+ private UserAccountServiceImpl getSelf() {
|
|
|
+ return SpringUtil.getBean(getClass());
|
|
|
}
|
|
|
}
|