|
@@ -1,4 +1,4 @@
|
|
|
-package com.css.simulation.resource.server.application;
|
|
|
+package com.css.simulation.resource.server.application.service;
|
|
|
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.constants.LogConstants;
|
|
@@ -16,7 +16,7 @@ import com.css.simulation.resource.server.infrastructure.common.utils.AuthUtil;
|
|
|
import com.css.simulation.resource.server.infrastructure.common.utils.PageUtil;
|
|
|
import com.css.simulation.resource.server.infrastructure.common.utils.PoUtil;
|
|
|
import com.css.simulation.resource.server.infrastructure.common.configuration.sms.SmsConfiguration;
|
|
|
-import com.css.simulation.resource.server.infrastructure.mysql.mapper.UserMapper;
|
|
|
+import com.css.simulation.resource.server.infrastructure.mysql.mapper.SystemUserMapper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.springframework.kafka.core.KafkaTemplate;
|
|
@@ -32,7 +32,7 @@ import java.util.Map;
|
|
|
public class UserService {
|
|
|
|
|
|
@Resource
|
|
|
- UserMapper userMapper;
|
|
|
+ SystemUserMapper systemUserMapper;
|
|
|
@Resource
|
|
|
OauthParameter oauthParameter;
|
|
|
@Resource
|
|
@@ -48,7 +48,7 @@ public class UserService {
|
|
|
|
|
|
public UserVO getCurrentUserInfo() {
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
- UserVO userVO = userMapper.getUserInfo(userId);
|
|
|
+ UserVO userVO = systemUserMapper.getUserInfo(userId);
|
|
|
//字典翻译
|
|
|
Map<String, Map<String, String>> dictMaps = dictService.getDictMapsByTypes(DictConstants.USE_TYPE + "," + DictConstants.ROLE_CODE);
|
|
|
userVO.setUseTypeName(dictMaps.get(DictConstants.USE_TYPE).get(userVO.getUseType()));
|
|
@@ -61,13 +61,13 @@ public class UserService {
|
|
|
List<UserVO> list;
|
|
|
String currentUserRoleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
if (DictConstants.ROLE_CODE_SYSADMIN.equals(currentUserRoleCode)) {//超级管理员
|
|
|
- list = userMapper.getUserPageLista(pageParam);
|
|
|
+ list = systemUserMapper.getUserPageLista(pageParam);
|
|
|
} else if (DictConstants.ROLE_CODE_ADMIN.equals(currentUserRoleCode)) {//子管理员
|
|
|
- list = userMapper.getUserPageListb(pageParam);
|
|
|
+ list = systemUserMapper.getUserPageListb(pageParam);
|
|
|
} else if (DictConstants.ROLE_CODE_UESR.equals(currentUserRoleCode)) {//普通用户
|
|
|
//只查询自己创建的子账户
|
|
|
pageParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
- list = userMapper.getUserPageListc(pageParam);
|
|
|
+ list = systemUserMapper.getUserPageListc(pageParam);
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
@@ -101,7 +101,7 @@ public class UserService {
|
|
|
int num = parameter.getNumCreateUser(); // 最大用户数
|
|
|
int subUserNum = 0;
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
- List<UserPO> subUsers = userMapper.getSubUser(userId);
|
|
|
+ List<UserPO> subUsers = systemUserMapper.getSubUser(userId);
|
|
|
if (ObjectUtil.isNotNull(subUsers)) {
|
|
|
subUserNum = subUsers.size();
|
|
|
}
|
|
@@ -117,7 +117,7 @@ public class UserService {
|
|
|
return null;
|
|
|
}
|
|
|
//重名校验
|
|
|
- List<UserPO> list = userMapper.checkUsername(userPO);
|
|
|
+ List<UserPO> list = systemUserMapper.checkUsername(userPO);
|
|
|
if (ObjectUtil.isNotNull(list)) {
|
|
|
userPO.setId("checkUsername");
|
|
|
return userPO;
|
|
@@ -129,7 +129,7 @@ public class UserService {
|
|
|
// 初始密码
|
|
|
userPO.setPassword(EncryptUtil.getLowerMD5(oauthParameter.getSimulationDefaultPassword()));
|
|
|
userPO.setVisible("1");
|
|
|
- userMapper.insert(userPO);
|
|
|
+ systemUserMapper.insert(userPO);
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_INSERT, userPO);
|
|
|
|
|
|
|
|
@@ -145,7 +145,7 @@ public class UserService {
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
- userMapper.update(userPO);
|
|
|
+ systemUserMapper.update(userPO);
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_UPDATE, userPO);
|
|
|
}
|
|
|
// 密码清空
|
|
@@ -157,7 +157,7 @@ public class UserService {
|
|
|
public void saveDefaultPassword(UserPO userPO) {
|
|
|
userPO.setPassword(EncryptUtil.getLowerMD5(oauthParameter.getSimulationDefaultPassword()));
|
|
|
PoUtil.initUpdatePo(userPO);
|
|
|
- userMapper.saveDefaultPassword(userPO);
|
|
|
+ systemUserMapper.saveDefaultPassword(userPO);
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_RESET, userPO);
|
|
|
|
|
|
// 发送短信
|
|
@@ -175,19 +175,19 @@ public class UserService {
|
|
|
|
|
|
public void saveVisible(UserPO userPO) {
|
|
|
PoUtil.initUpdatePo(userPO);
|
|
|
- userMapper.saveVisible(userPO);
|
|
|
+ systemUserMapper.saveVisible(userPO);
|
|
|
if ("1".equals(userPO.getVisible())) {
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_START, userPO);
|
|
|
} else { // 停用
|
|
|
- UserVO userInfo = userMapper.getUserInfo(userPO.getId());
|
|
|
+ UserVO userInfo = systemUserMapper.getUserInfo(userPO.getId());
|
|
|
String roleCode = userInfo.getRoleCode();
|
|
|
if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) { // 停用普通用户时-停用子账户
|
|
|
- List<UserPO> subUsers = userMapper.getSubUser(userPO.getId());
|
|
|
+ List<UserPO> subUsers = systemUserMapper.getSubUser(userPO.getId());
|
|
|
if (ObjectUtil.isNotNull(subUsers)) {
|
|
|
subUsers.forEach(po -> {
|
|
|
PoUtil.initUpdatePo(po);
|
|
|
po.setVisible("0");
|
|
|
- userMapper.saveVisible(po);
|
|
|
+ systemUserMapper.saveVisible(po);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -199,13 +199,13 @@ public class UserService {
|
|
|
|
|
|
public void savePhone(UserPO userPO) {
|
|
|
PoUtil.initUpdatePo(userPO);
|
|
|
- userMapper.savePhone(userPO);
|
|
|
+ systemUserMapper.savePhone(userPO);
|
|
|
}
|
|
|
|
|
|
public UserPO savePassword(UserVO userVO) throws NoSuchAlgorithmException {
|
|
|
//确认原密码是否正确
|
|
|
userVO.setPassword(EncryptUtil.getLowerMD5(userVO.getPassword()));
|
|
|
- List<UserVO> list = userMapper.checkPassword(userVO);
|
|
|
+ List<UserVO> list = systemUserMapper.checkPassword(userVO);
|
|
|
if (ObjectUtil.isNull(list)) {
|
|
|
return null;
|
|
|
}
|
|
@@ -214,7 +214,7 @@ public class UserService {
|
|
|
userPO.setId(userVO.getId());
|
|
|
userPO.setPassword(EncryptUtil.getLowerMD5(userVO.getNewPassword()));
|
|
|
PoUtil.initUpdatePo(userPO);
|
|
|
- userMapper.savePassword(userPO);
|
|
|
+ systemUserMapper.savePassword(userPO);
|
|
|
return userPO;
|
|
|
}
|
|
|
}
|