|
@@ -15,6 +15,7 @@ import com.ningdatech.kqapi.security.model.UserInfoDetails; |
|
|
import com.ningdatech.kqapi.user.model.entity.UserAuth; |
|
|
import com.ningdatech.kqapi.user.model.entity.UserAuth; |
|
|
import com.ningdatech.kqapi.user.model.entity.UserInfo; |
|
|
import com.ningdatech.kqapi.user.model.entity.UserInfo; |
|
|
import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; |
|
|
import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; |
|
|
|
|
|
import com.ningdatech.kqapi.user.model.enumerization.RoleEnum; |
|
|
import com.ningdatech.kqapi.user.model.po.ChangeAccountStatusReq; |
|
|
import com.ningdatech.kqapi.user.model.po.ChangeAccountStatusReq; |
|
|
import com.ningdatech.kqapi.user.model.po.ModifyPasswordReq; |
|
|
import com.ningdatech.kqapi.user.model.po.ModifyPasswordReq; |
|
|
import com.ningdatech.kqapi.user.model.po.SaveUserReq; |
|
|
import com.ningdatech.kqapi.user.model.po.SaveUserReq; |
|
@@ -77,10 +78,14 @@ public class UserInfoManage { |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public synchronized void saveUser(SaveUserReq req) { |
|
|
public synchronized void saveUser(SaveUserReq req) { |
|
|
Long userId = req.getUserId(); |
|
|
Long userId = req.getUserId(); |
|
|
UserInfo oldUser = null; |
|
|
|
|
|
|
|
|
UserInfo oldUser; |
|
|
if (userId == null) { |
|
|
if (userId == null) { |
|
|
|
|
|
oldUser = null; |
|
|
BizUtils.password(req.getPassword()); |
|
|
BizUtils.password(req.getPassword()); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if (StrUtil.isNotBlank(req.getPassword())) { |
|
|
|
|
|
BizUtils.password(req.getPassword()); |
|
|
|
|
|
} |
|
|
oldUser = userInfoService.getById(userId); |
|
|
oldUser = userInfoService.getById(userId); |
|
|
} |
|
|
} |
|
|
// 校验 账号是否已经使用 |
|
|
// 校验 账号是否已经使用 |
|
@@ -94,6 +99,9 @@ public class UserInfoManage { |
|
|
entity.setUsername(req.getUserName()); |
|
|
entity.setUsername(req.getUserName()); |
|
|
entity.setAvatarFileId(req.getAvatarFileId()); |
|
|
entity.setAvatarFileId(req.getAvatarFileId()); |
|
|
entity.setAccountStatus(AccountStatus.ENABLE); |
|
|
entity.setAccountStatus(AccountStatus.ENABLE); |
|
|
|
|
|
if (userId == null) { |
|
|
|
|
|
entity.setRole(RoleEnum.USER.name()); |
|
|
|
|
|
} |
|
|
userInfoService.saveOrUpdate(entity); |
|
|
userInfoService.saveOrUpdate(entity); |
|
|
if (userId == null) { |
|
|
if (userId == null) { |
|
|
saveUserAuth(req, entity); |
|
|
saveUserAuth(req, entity); |
|
|