1.用户模块添加对外接口
This commit is contained in:
@@ -81,7 +81,7 @@ public interface DeptFeignClient {
|
|||||||
HttpResult<Dept> getDeptByCode(@RequestParam("deptCode") String deptCode);
|
HttpResult<Dept> getDeptByCode(@RequestParam("deptCode") String deptCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取所有子部门ids
|
* 根据部门id获取所有子部门ids包含自身
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getDepSonIdtByDeptId")
|
@GetMapping("/getDepSonIdtByDeptId")
|
||||||
HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId);
|
HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId);
|
||||||
|
|||||||
@@ -69,12 +69,21 @@ public interface UserFeignClient {
|
|||||||
HttpResult<List<User>> appuserByIdList(@RequestBody List<String> ids);
|
HttpResult<List<User>> appuserByIdList(@RequestBody List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ids查询用户信息
|
* 根据部门ids查询接收短信通知的用户信息
|
||||||
* @param deptId
|
* @param deptId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/getUserByDeptIds")
|
@PostMapping("/getUserByDeptIds")
|
||||||
HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId);
|
HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ids查询用户信息
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getUserInfoByDeptIds")
|
||||||
|
HttpResult<List<User>> getUserInfoByDeptIds(@RequestBody List<String> deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色Code集合查询用户信息
|
* 根据角色Code集合查询用户信息
|
||||||
* @param roleCode
|
* @param roleCode
|
||||||
@@ -85,4 +94,5 @@ public interface UserFeignClient {
|
|||||||
|
|
||||||
@GetMapping("/getUserById")
|
@GetMapping("/getUserById")
|
||||||
HttpResult<UserVO> getUserById(@RequestParam("id") String id);
|
HttpResult<UserVO> getUserById(@RequestParam("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,12 @@ public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeign
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<User>> getUserByDeptIds(List<String> deptId) {
|
public HttpResult<List<User>> getUserByDeptIds(List<String> deptId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据部门ids查询接收短信通知的用户信息",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<User>> getUserInfoByDeptIds(List<String> deptId) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","根据部门ids查询用户信息",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据部门ids查询用户信息",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
@@ -91,6 +97,8 @@ public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeign
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据用户id获取用户详情",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据用户id获取用户详情",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ public class DeptController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取所有子部门ids
|
* 根据部门id获取所有子部门ids包含自身
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/7/26
|
* @date 2022/7/26
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.annotation.OperateInfo;
|
|||||||
import com.njcn.common.pojo.constant.LogInfo;
|
import com.njcn.common.pojo.constant.LogInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -472,7 +473,7 @@ public class UserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/getUserByDeptIds")
|
@PostMapping("/getUserByDeptIds")
|
||||||
@ApiOperation("根据部门ids查询用户信息")
|
@ApiOperation("根据部门ids查询接收短信通知的用户信息")
|
||||||
@ApiImplicitParam(name = "deptId", value = "用户部门id", required = true)
|
@ApiImplicitParam(name = "deptId", value = "用户部门id", required = true)
|
||||||
public HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId) {
|
public HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId) {
|
||||||
String methodDescribe = getMethodDescribe("getUserByDeptIds");
|
String methodDescribe = getMethodDescribe("getUserByDeptIds");
|
||||||
@@ -484,6 +485,19 @@ public class UserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@PostMapping("/getUserInfoByDeptIds")
|
||||||
|
@ApiOperation("根据部门ids查询用户信息")
|
||||||
|
@ApiImplicitParam(name = "deptId", value = "用户部门id", required = true)
|
||||||
|
public HttpResult<List<User>> getUserInfoByDeptIds(@RequestBody List<String> deptId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getUserInfoByDeptIds");
|
||||||
|
List<User> users = userService.list(new LambdaQueryWrapper<User>()
|
||||||
|
.in(User::getDeptId,deptId)
|
||||||
|
.eq(User::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取同级部门用户,以及下级部门所有用户
|
* 获取同级部门用户,以及下级部门所有用户
|
||||||
* @author cdf
|
* @author cdf
|
||||||
@@ -498,5 +512,21 @@ public class UserController extends BaseController {
|
|||||||
List<User> users = userService.getUserListByRoleCode(roleCode);
|
List<User> users = userService.getUserListByRoleCode(roleCode);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色类型获取用户 角色类型 type0:超级管理员;1:管理员;2:普通用户' 3:'审核角色',
|
||||||
|
* @author cdf
|
||||||
|
* @date 2024/3/29
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS)
|
||||||
|
@GetMapping("/getUserByRoleType")
|
||||||
|
@ApiOperation("根据角色类型获取用户")
|
||||||
|
@ApiImplicitParam(name = "roleCode", value = "角色类型", required = true)
|
||||||
|
public HttpResult<List<User>> getUserByRoleType(@RequestParam("roleType") Integer roleType) {
|
||||||
|
String methodDescribe = getMethodDescribe("getUserByRoleType");
|
||||||
|
List<User> users = userService.getUserByRoleType(roleType);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,4 +41,6 @@ public interface UserRoleMapper extends BaseMapper<UserRole> {
|
|||||||
*/
|
*/
|
||||||
List<User> selectUserRoleCode(@Param("roleCode")String roleCode);
|
List<User> selectUserRoleCode(@Param("roleCode")String roleCode);
|
||||||
|
|
||||||
|
List<User> getUserByRoleType(@Param("roleType")Integer roleType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,16 @@
|
|||||||
WHERE
|
WHERE
|
||||||
role.`Code` = #{roleCode}
|
role.`Code` = #{roleCode}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getUserByRoleType" resultType="com.njcn.user.pojo.po.User">
|
||||||
|
SELECT
|
||||||
|
DISTINCT
|
||||||
|
usr.*
|
||||||
|
FROM
|
||||||
|
sys_user usr
|
||||||
|
INNER JOIN sys_user_role usrRole ON usrRole.User_Id = usr.Id
|
||||||
|
INNER JOIN sys_role role ON role.Id = usrRole.Role_Id
|
||||||
|
WHERE
|
||||||
|
role.`type` = #{roleType}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -188,4 +188,6 @@ public interface IUserService extends IService<User> {
|
|||||||
|
|
||||||
List<User> getUserListByRoleCode(String roleCode);
|
List<User> getUserListByRoleCode(String roleCode);
|
||||||
|
|
||||||
|
List<User> getUserByRoleType(Integer roleType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取部门详情
|
* 根据部门id获取所有子部门ids包含自身
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDepSonIdtByDeptId(String id) {
|
public List<String> getDepSonIdtByDeptId(String id) {
|
||||||
|
|||||||
@@ -523,6 +523,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
return userRoleMapper.selectUserRoleCode(roleCode);
|
return userRoleMapper.selectUserRoleCode(roleCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<User> getUserByRoleType(Integer roleType) {
|
||||||
|
return userRoleMapper.getUserByRoleType(roleType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据登录名查询用户
|
* 根据登录名查询用户
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user