Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server

This commit is contained in:
lym
2024-04-25 11:09:48 +08:00
13 changed files with 47 additions and 13 deletions
@@ -17,7 +17,7 @@ public class DeptRespDTO {
private Long parentId; private Long parentId;
@Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long leaderUserId; private String leader;
@Schema(description = "部门状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "部门状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; // 参见 CommonStatusEnum 枚举 private Integer status; // 参见 CommonStatusEnum 枚举
@@ -22,7 +22,7 @@ public class DeptRespVO {
private Integer sort; private Integer sort;
@Schema(description = "负责人的用户编号", example = "2048") @Schema(description = "负责人的用户编号", example = "2048")
private Long leaderUserId; private String leader;
@Schema(description = "联系电话", example = "15601691000") @Schema(description = "联系电话", example = "15601691000")
private String phone; private String phone;
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
import com.cf.imes.framework.common.validation.InEnum; import com.cf.imes.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -32,8 +33,9 @@ public class DeptSaveReqVO {
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
private Integer sort; private Integer sort;
@Schema(description = "负责人的用户编号", example = "2048") @Schema(description = "负责人", example = "2048")
private Long leaderUserId; @Length(min = 0, max = 10, message = "负责人不可太长")
private String leader;
@Schema(description = "联系电话", example = "15601691000") @Schema(description = "联系电话", example = "15601691000")
@Size(max = 11, message = "联系电话长度不能超过11个字符") @Size(max = 11, message = "联系电话长度不能超过11个字符")
@@ -75,4 +75,7 @@ public class OrganExportRespVO {
@Schema(description = "是否大型数据库") @Schema(description = "是否大型数据库")
@ExcelProperty("是否大型数据库") @ExcelProperty("是否大型数据库")
private String largeStr; private String largeStr;
@Schema(description = "备注")
private String remark;
} }
@@ -52,4 +52,8 @@ public class OrganRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
} }
@@ -76,4 +76,8 @@ public class OrganSaveReqVO {
@Schema(description = "地址") @Schema(description = "地址")
private String address; private String address;
@Schema(description = "备注")
@Length(min = 0, max = 200, message = "备注不可太长")
private String remark;
} }
@@ -115,11 +115,11 @@ public class PermissionController {
throw new ServiceException(ROLE_ME_ERROR); throw new ServiceException(ROLE_ME_ERROR);
} }
Set<Long> roleIds = listReqVO.stream().flatMap(e -> e.getRoleIds().stream()).collect(Collectors.toSet()); Set<Long> roleIds = listReqVO.stream().flatMap(e -> e.getRoleIds().stream()).collect(Collectors.toSet());
if(!loginUser.getIsSupAdmin()) { /* if(!loginUser.getIsSupAdmin()) {
if(roleIds.contains(ORGAN_ADMIN_ROLE_ID) ) { if(roleIds.contains(ORGAN_ADMIN_ROLE_ID) ) {
throw new ServiceException(11541, "内置角色无权修改"); throw new ServiceException(11541, "内置角色无权修改");
} }
} }*/
permissionService.bathAssignUserRole(listReqVO); permissionService.bathAssignUserRole(listReqVO);
return success(true); return success(true);
} }
@@ -29,11 +29,11 @@ public class UserExportRespVO {
private Long id; private Long id;
@Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "chenfeng") @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "chenfeng")
@ExcelProperty("用户名") @ExcelProperty("用户名")
private String username; private String username;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰") @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("用户") @ExcelProperty("用户")
private String nickname; private String nickname;
@Schema(description = "备注", example = "我是一个用户") @Schema(description = "备注", example = "我是一个用户")
@@ -75,13 +75,13 @@ public class UserExportRespVO {
@DictFormat(DictTypeConstants.COMMON_STATUS) @DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1") /*@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1")
@ExcelProperty("最后登录IP") @ExcelProperty("最后登录IP")
private String loginIp; private String loginIp;
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") @Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
@ExcelProperty("最后登录时间") @ExcelProperty("最后登录时间")
private LocalDateTime loginDate; private LocalDateTime loginDate;*/
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
private LocalDateTime createTime; private LocalDateTime createTime;
@@ -47,7 +47,7 @@ public class DeptDO extends OrganBaseDO {
* *
* 关联 {@link AdminUserDO#getId()} * 关联 {@link AdminUserDO#getId()}
*/ */
private Long leaderUserId; private String leader;
/** /**
* 联系电话 * 联系电话
*/ */
@@ -108,5 +108,8 @@ public class OrganizationDO extends BaseDO {
* 数据源编码 * 数据源编码
*/ */
private String dataSourceCode; private String dataSourceCode;
/**
* 备注
*/
private String remark;
} }
@@ -93,7 +93,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
throw ServiceExceptionUtil.exception(ORGAN_NOT_EXISTS); throw ServiceExceptionUtil.exception(ORGAN_NOT_EXISTS);
} }
// 校验账号是否存在 // 校验账号是否存在
AdminUserDO user = userService.getUserByUsername(username, organ.getId()); AdminUserDO user = userService.getUserByUsernameAndOrganId(username, organ.getId());
if (user == null) { if (user == null) {
createLoginLog(null, username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); createLoginLog(null, username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
@@ -104,6 +104,15 @@ public interface AdminUserService {
*/ */
AdminUserDO getUserByUsername(String username, Long organId); AdminUserDO getUserByUsername(String username, Long organId);
/**
* 通过用户名与组织id查询用户
*
* @param username 用户名
* @return 用户对象信息
*/
AdminUserDO getUserByUsernameAndOrganId(String username, Long organId);
/** /**
* 通过手机号获取用户 * 通过手机号获取用户
* *
@@ -248,6 +248,15 @@ public class AdminUserServiceImpl implements AdminUserService {
return userMapper.selectByUsername(username, organId); return userMapper.selectByUsername(username, organId);
} }
@Override
@OrganIgnore
public AdminUserDO getUserByUsernameAndOrganId(String username, Long organId) {
return userMapper.selectOne(new LambdaQueryWrapperX<AdminUserDO>()
.eq(AdminUserDO::getUsername, username)
.eq(AdminUserDO::getOrganId, organId)
);
}
@Override @Override
public AdminUserDO getUserByMobile(String mobile) { public AdminUserDO getUserByMobile(String mobile) {
return userMapper.selectByMobile(mobile); return userMapper.selectByMobile(mobile);