@@ -1,30 +0,0 @@ | |||||
package com.ningdatech.kqapi.common.enumeration; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/11/23 下午4:32 | |||||
* 系统角色 | |||||
*/ | |||||
@Getter | |||||
@AllArgsConstructor | |||||
public enum RoleEnum { | |||||
engineer("工程师"), | |||||
project_manager("项目经理"), | |||||
project_leader("项目负责人"), | |||||
enterprise_admin("企业管理员"), | |||||
regional_general_manager("地区总经理"), | |||||
driver("驾驶员"), | |||||
super_admin("超级管理员"), | |||||
driver_admin("车管员"); | |||||
private final String displayName; | |||||
public boolean eq(String name) { | |||||
return this.name().equals(name); | |||||
} | |||||
} |
@@ -6,7 +6,7 @@ import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.kqapi.user.manage.UserInfoManage; | import com.ningdatech.kqapi.user.manage.UserInfoManage; | ||||
import com.ningdatech.kqapi.user.model.po.*; | import com.ningdatech.kqapi.user.model.po.*; | ||||
import com.ningdatech.kqapi.user.model.vo.UserBasicInfoVO; | import com.ningdatech.kqapi.user.model.vo.UserBasicInfoVO; | ||||
import com.ningdatech.kqapi.user.model.vo.ResUserListVO; | |||||
import com.ningdatech.kqapi.user.model.vo.UserListVO; | |||||
import com.ningdatech.kqapi.user.model.vo.UserDetailVO; | import com.ningdatech.kqapi.user.model.vo.UserDetailVO; | ||||
import com.ningdatech.kqapi.user.service.IUserInfoService; | import com.ningdatech.kqapi.user.service.IUserInfoService; | ||||
import com.ningdatech.log.annotation.WebLog; | import com.ningdatech.log.annotation.WebLog; | ||||
@@ -65,7 +65,7 @@ public class UserInfoController { | |||||
@PostMapping(value = "/list") | @PostMapping(value = "/list") | ||||
@ApiOperation(value = "用户列表筛选") | @ApiOperation(value = "用户列表筛选") | ||||
@WebLog(value = "用户列表筛选") | @WebLog(value = "用户列表筛选") | ||||
public PageVo<ResUserListVO> listUser(@Valid @RequestBody UserListReq request) { | |||||
public PageVo<UserListVO> listUser(@Valid @RequestBody UserListReq request) { | |||||
return userInfoManage.listUser(request); | return userInfoManage.listUser(request); | ||||
} | } | ||||
@@ -11,8 +11,8 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.kqapi.common.constant.BizConst; | import com.ningdatech.kqapi.common.constant.BizConst; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import com.ningdatech.kqapi.security.constant.AuthTypeEnum; | import com.ningdatech.kqapi.security.constant.AuthTypeEnum; | ||||
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; | ||||
@@ -20,8 +20,8 @@ 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; | ||||
import com.ningdatech.kqapi.user.model.po.UserListReq; | import com.ningdatech.kqapi.user.model.po.UserListReq; | ||||
import com.ningdatech.kqapi.user.model.vo.UserListVO; | |||||
import com.ningdatech.kqapi.user.model.vo.UserBasicInfoVO; | import com.ningdatech.kqapi.user.model.vo.UserBasicInfoVO; | ||||
import com.ningdatech.kqapi.user.model.vo.ResUserListVO; | |||||
import com.ningdatech.kqapi.user.model.vo.UserDetailVO; | import com.ningdatech.kqapi.user.model.vo.UserDetailVO; | ||||
import com.ningdatech.kqapi.user.service.IUserAuthService; | import com.ningdatech.kqapi.user.service.IUserAuthService; | ||||
import com.ningdatech.kqapi.user.service.IUserInfoService; | import com.ningdatech.kqapi.user.service.IUserInfoService; | ||||
@@ -136,33 +136,30 @@ public class UserInfoManage { | |||||
.userName(info.getUsername()) | .userName(info.getUsername()) | ||||
.avatarFileId(info.getAvatarFileId()) | .avatarFileId(info.getAvatarFileId()) | ||||
.phoneNo(info.getMobile()) | .phoneNo(info.getMobile()) | ||||
.role(RoleEnum.valueOf(info.getRole())) | |||||
.accountStatus(info.getAccountStatus()) | .accountStatus(info.getAccountStatus()) | ||||
.build(); | .build(); | ||||
} | } | ||||
public PageVo<ResUserListVO> listUser(UserListReq req) { | |||||
public PageVo<UserListVO> listUser(UserListReq req) { | |||||
// 获取入参 | // 获取入参 | ||||
String realName = req.getRealName(); | String realName = req.getRealName(); | ||||
// 获取区域列表 | // 获取区域列表 | ||||
Wrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class) | Wrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class) | ||||
.like(StrUtil.isNotBlank(realName), UserInfo::getRealName, realName) | .like(StrUtil.isNotBlank(realName), UserInfo::getRealName, realName) | ||||
.eq(StrUtil.isNotBlank(req.getMobile()), UserInfo::getMobile, req.getMobile()) | .eq(StrUtil.isNotBlank(req.getMobile()), UserInfo::getMobile, req.getMobile()) | ||||
.eq(req.getRole() != null, UserInfo::getRole, req.getRole()) | |||||
.orderByDesc(UserInfo::getUpdateOn); | .orderByDesc(UserInfo::getUpdateOn); | ||||
Page<UserInfo> page = userInfoService.page(req.page(), query); | Page<UserInfo> page = userInfoService.page(req.page(), query); | ||||
PageVo<ResUserListVO> pageVo = new PageVo<>(); | |||||
PageVo<UserListVO> pageVo = new PageVo<>(); | |||||
long total = page.getTotal(); | long total = page.getTotal(); | ||||
pageVo.setTotal(total); | pageVo.setTotal(total); | ||||
if (total > 0) { | if (total > 0) { | ||||
Function<UserInfo, ResUserListVO> mapping = r -> { | |||||
ResUserListVO res = new ResUserListVO(); | |||||
Function<UserInfo, UserListVO> mapping = r -> { | |||||
UserListVO res = new UserListVO(); | |||||
res.setUserId(r.getId()); | res.setUserId(r.getId()); | ||||
res.setRealName(r.getRealName()); | res.setRealName(r.getRealName()); | ||||
res.setCreateTime(r.getCreateOn()); | res.setCreateTime(r.getCreateOn()); | ||||
res.setPhoneNo(r.getMobile()); | res.setPhoneNo(r.getMobile()); | ||||
res.setAccountStatus(r.getAccountStatus()); | res.setAccountStatus(r.getAccountStatus()); | ||||
BizUtils.notBlank(r.getRole(), w -> res.setRole(RoleEnum.valueOf(w))); | |||||
return res; | return res; | ||||
}; | }; | ||||
pageVo.setRecords(CollUtils.convert(page.getRecords(), mapping)); | pageVo.setRecords(CollUtils.convert(page.getRecords(), mapping)); | ||||
@@ -171,15 +168,10 @@ public class UserInfoManage { | |||||
} | } | ||||
public UserBasicInfoVO getBasicInfo() { | public UserBasicInfoVO getBasicInfo() { | ||||
Long userId = LoginUserUtil.getUserId(); | |||||
UserInfo userInfo = userInfoService.getById(userId); | |||||
UserInfoDetails details = LoginUserUtil.loginUserDetail(); | |||||
UserBasicInfoVO result = new UserBasicInfoVO(); | UserBasicInfoVO result = new UserBasicInfoVO(); | ||||
result.setUserId(userId); | |||||
result.setRealName(userInfo.getRealName()); | |||||
BizUtils.notBlank(userInfo.getRole(), role -> { | |||||
result.setRole(RoleEnum.valueOf(role)); | |||||
result.setRoleName(result.getRole().getDisplayName()); | |||||
}); | |||||
result.setUserId(details.getUserId()); | |||||
result.setRealName(details.getRealName()); | |||||
return result; | return result; | ||||
} | } | ||||
@@ -1,7 +1,6 @@ | |||||
package com.ningdatech.kqapi.user.model.po; | package com.ningdatech.kqapi.user.model.po; | ||||
import cn.hutool.core.lang.RegexPool; | import cn.hutool.core.lang.RegexPool; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
@@ -41,8 +40,6 @@ public class SaveUserReq { | |||||
@ApiModelProperty("密码") | @ApiModelProperty("密码") | ||||
private String password; | private String password; | ||||
private RoleEnum role; | |||||
@ApiModelProperty("免冠照图片文件id") | @ApiModelProperty("免冠照图片文件id") | ||||
private Long avatarFileId; | private Long avatarFileId; | ||||
@@ -1,7 +1,6 @@ | |||||
package com.ningdatech.kqapi.user.model.po; | package com.ningdatech.kqapi.user.model.po; | ||||
import com.ningdatech.basic.model.PagePo; | import com.ningdatech.basic.model.PagePo; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -23,11 +22,6 @@ public class UserListReq extends PagePo { | |||||
@ApiModelProperty("用户姓名") | @ApiModelProperty("用户姓名") | ||||
private String realName; | private String realName; | ||||
/** | |||||
* {@link RoleEnum} | |||||
*/ | |||||
private RoleEnum role; | |||||
@ApiModelProperty("手机号") | @ApiModelProperty("手机号") | ||||
private String mobile; | private String mobile; | ||||
@@ -1,6 +1,5 @@ | |||||
package com.ningdatech.kqapi.user.model.vo; | package com.ningdatech.kqapi.user.model.vo; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -20,13 +19,10 @@ public class UserBasicInfoVO { | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@ApiModelProperty("角色") | |||||
private RoleEnum role; | |||||
@ApiModelProperty("角色名称") | |||||
private String roleName; | |||||
@ApiModelProperty("用户真实姓名") | @ApiModelProperty("用户真实姓名") | ||||
private String realName; | private String realName; | ||||
@ApiModelProperty("用户手机号") | |||||
private String phoneNo; | |||||
} | } |
@@ -1,6 +1,5 @@ | |||||
package com.ningdatech.kqapi.user.model.vo; | package com.ningdatech.kqapi.user.model.vo; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
@@ -34,9 +33,6 @@ public class UserDetailVO { | |||||
@ApiModelProperty("用户登陆名") | @ApiModelProperty("用户登陆名") | ||||
private String userName; | private String userName; | ||||
@ApiModelProperty("角色") | |||||
private RoleEnum role; | |||||
@ApiModelProperty("免冠照图片文件id") | @ApiModelProperty("免冠照图片文件id") | ||||
private Long avatarFileId; | private Long avatarFileId; | ||||
@@ -1,6 +1,5 @@ | |||||
package com.ningdatech.kqapi.user.model.vo; | package com.ningdatech.kqapi.user.model.vo; | ||||
import com.ningdatech.kqapi.common.enumeration.RoleEnum; | |||||
import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | import com.ningdatech.kqapi.user.model.enumerization.AccountStatus; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
@@ -19,7 +18,7 @@ import java.time.LocalDateTime; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("用户列表筛选VO") | @ApiModel("用户列表筛选VO") | ||||
public class ResUserListVO { | |||||
public class UserListVO { | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@@ -31,8 +30,6 @@ public class ResUserListVO { | |||||
@ApiModelProperty("手机号") | @ApiModelProperty("手机号") | ||||
private String phoneNo; | private String phoneNo; | ||||
private RoleEnum role; | |||||
@ApiModelProperty("创建时间") | @ApiModelProperty("创建时间") | ||||
private LocalDateTime createTime; | private LocalDateTime createTime; | ||||