提交20241230

This commit is contained in:
Mrking 2024-12-30 19:59:08 +08:00
parent 7695075607
commit cc27de49b7
5 changed files with 15 additions and 1 deletions

View File

@ -83,7 +83,7 @@ public class CustomerServiceImpl implements CustomerService {
//新增用户账号
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
userSaveReqVO.setUsername(createReqVO.getEmail());
userSaveReqVO.setEmail(createReqVO.getEmail());
userSaveReqVO.setNickname(createReqVO.getName());
userSaveReqVO.setMobile(createReqVO.getPhone());
userSaveReqVO.setPassword(userInitPassword);

View File

@ -39,6 +39,8 @@ public interface ErrorCodeConstants {
ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "手机号已经存在");
ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "邮箱已经存在");
ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在");
ErrorCode USER_ADMIN_DELETE = new ErrorCode(1_002_003_003, "不允许删除系统内置用户");
ErrorCode USER_CURUSER_DELETE = new ErrorCode(1_002_003_003, "不允许删除当前登录用户");
ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "导入用户数据不能为空!");
ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "用户密码校验失败");
ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用");

View File

@ -1,5 +1,8 @@
package cn.hangtag.module.system.controller.admin.user;
import cn.hangtag.framework.security.core.LoginUser;
import cn.hangtag.framework.security.core.util.SecurityFrameworkUtils;
import cn.hangtag.module.system.enums.ErrorCodeConstants;
import cn.hutool.core.collection.CollUtil;
import cn.hangtag.framework.apilog.core.annotation.ApiAccessLog;
import cn.hangtag.framework.common.enums.CommonStatusEnum;
@ -32,6 +35,7 @@ import java.util.List;
import java.util.Map;
import static cn.hangtag.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.hangtag.framework.common.pojo.CommonResult.error;
import static cn.hangtag.framework.common.pojo.CommonResult.success;
import static cn.hangtag.framework.common.util.collection.CollectionUtils.convertList;
@ -67,6 +71,10 @@ public class UserController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:user:delete')")
public CommonResult<Boolean> deleteUser(@RequestParam("id") Long id) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if(loginUser.getId()==id){
return error(ErrorCodeConstants.USER_CURUSER_DELETE);
}
userService.deleteUser(id);
return success(true);
}

View File

@ -255,6 +255,9 @@ public class AdminUserServiceImpl implements AdminUserService {
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_DELETE_SUB_TYPE, bizNo = "{{#id}}",
success = SYSTEM_USER_DELETE_SUCCESS)
public void deleteUser(Long id) {
if(id==1L){
throw exception(USER_ADMIN_DELETE);
}
// 1. 校验用户存在
AdminUserDO user = validateUserExists(id);

View File

@ -105,6 +105,7 @@
align="center"
prop="nickname"
:show-overflow-tooltip="true"
width="120"
/>
<el-table-column
label="分类"