工作流模块提交
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package com.njcn.user.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
@@ -14,6 +19,7 @@ import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.param.DeptParam;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
@@ -29,6 +35,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -155,6 +162,17 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getDeptListByIds")
|
||||
@ApiOperation("根据部门id集合查询部门信息")
|
||||
@ApiImplicitParam(name = "ids", value = "部门id集合", required = true)
|
||||
public HttpResult<List<Dept>> getDeptListByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getDeptListByIds");
|
||||
List<Dept> users = deptService.list((new LambdaQueryWrapper<Dept>().in(CollUtil.isNotEmpty(ids), Dept::getId, ids)));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否有关联信息
|
||||
*/
|
||||
@@ -187,6 +205,19 @@ public class DeptController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/deptTreeSelector")
|
||||
@ApiOperation("部门信息树")
|
||||
public HttpResult<List<Tree<String>>> deptTreeSelector() {
|
||||
String methodDescribe = getMethodDescribe("deptTreeSelector");
|
||||
List<Tree<String>> result = deptService.orgTreeSelector();
|
||||
//删除返回失败,查不到数据返回空数组,兼容治理项目没有部门直接报错的bug
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/existMonitorDeptTree")
|
||||
@@ -511,6 +542,19 @@ public class DeptController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的部门集合
|
||||
* @author xy
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/orgTreeSelector")
|
||||
@ApiOperation("获取所有单位树")
|
||||
public HttpResult<List<Tree<String>>> orgTreeSelector() {
|
||||
String methodDescribe = getMethodDescribe("orgTreeSelector");
|
||||
List<Tree<String>> result = deptService.orgTreeSelector();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++end*/
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.user.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
@@ -12,6 +14,7 @@ import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.user.pojo.param.DeptParam;
|
||||
import com.njcn.user.pojo.param.RoleParam;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.RoleVO;
|
||||
import com.njcn.user.service.IRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -114,6 +117,16 @@ public class RoleController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getRoleListByIds")
|
||||
@ApiOperation("根据角色id集合查询角色信息")
|
||||
@ApiImplicitParam(name = "ids", value = "角色id集合", required = true)
|
||||
public HttpResult<List<Role>> getRoleListByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getRoleListByIds");
|
||||
List<Role> users = roleService.list((new LambdaQueryWrapper<Role>().in(CollUtil.isNotEmpty(ids), Role::getId, ids)));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询相关联的资源和组件
|
||||
*/
|
||||
@@ -145,5 +158,29 @@ public class RoleController extends BaseController {
|
||||
List<Role> result = roleService.selectRoleDetail(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/allRoleList")
|
||||
@ApiOperation("查询所有角色")
|
||||
public HttpResult<Object> allRoleList() {
|
||||
String methodDescribe = getMethodDescribe("allRoleList");
|
||||
List<Role> result = roleService.allRoleList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/simpleList")
|
||||
@ApiOperation("查询所有角色作为下拉框")
|
||||
public HttpResult<Object> simpleList() {
|
||||
String methodDescribe = getMethodDescribe("simpleList");
|
||||
List<Role> result = roleService.simpleList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.njcn.user.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -26,6 +28,7 @@ import com.njcn.user.pojo.dto.UserDTO;
|
||||
import com.njcn.user.pojo.param.UserInfoParm;
|
||||
import com.njcn.user.pojo.param.UserParam;
|
||||
import com.njcn.user.pojo.param.UserPasswordParam;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.user.service.IUserService;
|
||||
@@ -48,6 +51,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -194,18 +198,19 @@ public class UserController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/uploadImage")
|
||||
@ApiOperation("上传头像")
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage( MultipartFile issuesFile){
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage(MultipartFile issuesFile) {
|
||||
String methodDescribe = getMethodDescribe("uploadImage");
|
||||
String filePath = userService.uploadImage(issuesFile);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,new MinIoUploadResDTO(issuesFile.getOriginalFilename(),filePath), methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new MinIoUploadResDTO(issuesFile.getOriginalFilename(), filePath), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/getUrl")
|
||||
@ApiOperation("获取头像url")
|
||||
public HttpResult<String> getUrl(@RequestParam("headSculpture") String headSculpture){
|
||||
public HttpResult<String> getUrl(@RequestParam("headSculpture") String headSculpture) {
|
||||
String methodDescribe = getMethodDescribe("getUrl");
|
||||
String url = userService.getUrl(headSculpture);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,url, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, url, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,6 +226,16 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/listAllUserByDeptId")
|
||||
@ApiOperation("查询部门下所有状态正常的用户")
|
||||
public HttpResult<List<UserVO>> listAllUserByDeptId(String deptId) {
|
||||
String methodDescribe = getMethodDescribe("listAllUserByDeptId");
|
||||
List<UserVO> list = userService.listAllUserByDeptId(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/exportUser")
|
||||
@ApiOperation("用户数据")
|
||||
@@ -228,19 +243,18 @@ public class UserController extends BaseController {
|
||||
public HttpResult<String> exportUser(@RequestBody @Validated UserParam.UserQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("exportUser");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userService.exportUser(queryParam,methodDescribe), methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userService.exportUser(queryParam, methodDescribe), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.DOWNLOAD)
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@GetMapping("/exportUserExcel")
|
||||
@ApiOperation("导出用户数据")
|
||||
@ApiImplicitParam(name = "filePath", value = "报表路径", required = true)
|
||||
public void exportUserExcel(String filePath, HttpServletResponse response) {
|
||||
PoiUtil.exportFileByAbsolutePath(filePath,response);
|
||||
PoiUtil.exportFileByAbsolutePath(filePath, response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/checkUserList")
|
||||
@ApiOperation("审核用户列表")
|
||||
@@ -337,7 +351,7 @@ public class UserController extends BaseController {
|
||||
//秘钥先删除再添加
|
||||
redisUtil.delete(loginName + ip);
|
||||
// 保存私钥到 redis
|
||||
redisUtil.saveByKeyWithExpire(loginName + ip, privateKey, 5*60L);
|
||||
redisUtil.saveByKeyWithExpire(loginName + ip, privateKey, 5 * 60L);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, publicKey, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -356,6 +370,7 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 密码二次确认
|
||||
*
|
||||
* @param password 确认密码
|
||||
*/
|
||||
@OperateInfo
|
||||
@@ -366,7 +381,7 @@ public class UserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("passwordConfirm");
|
||||
LogUtil.njcnDebug(log, "{},用户输入的密码:{}", methodDescribe, password);
|
||||
boolean result = userService.passwordConfirm(password);
|
||||
if (result){
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
@@ -376,7 +391,7 @@ public class UserController extends BaseController {
|
||||
/**
|
||||
* 首次登录修改密码
|
||||
*
|
||||
* @param userPasswordParam 用户信息
|
||||
* @param userPasswordParam 用户信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/updateFirstPassword")
|
||||
@@ -393,6 +408,7 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 用于激活处于休眠、锁定、密码过期的用户
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @return
|
||||
*/
|
||||
@@ -404,7 +420,7 @@ public class UserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("activateUser");
|
||||
LogUtil.njcnDebug(log, "{},用户输入的id:{}", methodDescribe, id);
|
||||
boolean result = userService.activateUser(id);
|
||||
if (result){
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
@@ -415,13 +431,13 @@ public class UserController extends BaseController {
|
||||
@PostMapping("/userByIdList")
|
||||
@ApiOperation("根据用户id集合查询用户信息")
|
||||
@ApiImplicitParam(name = "ids", value = "用户id集合", required = true)
|
||||
public HttpResult<List<User>> getUserByIdList(@RequestBody List<String> ids) {
|
||||
public HttpResult<List<User>> getUserByIdList(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getUserByIdList");
|
||||
List<User> users = userService.list((new LambdaQueryWrapper<User>()
|
||||
.in(CollUtil.isNotEmpty(ids),User::getId,ids)
|
||||
.in(CollUtil.isNotEmpty(ids), User::getId, ids)
|
||||
.isNotNull(User::getDeptId)
|
||||
.ne(User::getDeptId,"")
|
||||
.ne(User::getState,"0")
|
||||
.ne(User::getDeptId, "")
|
||||
.ne(User::getState, "0")
|
||||
));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
@@ -430,15 +446,24 @@ public class UserController extends BaseController {
|
||||
@PostMapping("/appuserByIdList")
|
||||
@ApiOperation("根据用户id集合查询用户信息")
|
||||
@ApiImplicitParam(name = "ids", value = "用户id集合", required = true)
|
||||
public HttpResult<List<User>> appuserByIdList(@RequestBody List<String> ids) {
|
||||
public HttpResult<List<User>> appuserByIdList(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("appuserByIdList");
|
||||
List<User> users = userService.list((new LambdaQueryWrapper<User>()
|
||||
.in(CollUtil.isNotEmpty(ids),User::getId,ids)
|
||||
|
||||
.in(CollUtil.isNotEmpty(ids), User::getId, ids)
|
||||
));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getUserListByIds")
|
||||
@ApiOperation("根据用户id集合查询用户信息")
|
||||
@ApiImplicitParam(name = "ids", value = "用户id集合", required = true)
|
||||
public HttpResult<List<User>> getUserListByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getUserListByIds");
|
||||
List<User> users = userService.list((new LambdaQueryWrapper<User>().in(CollUtil.isNotEmpty(ids), User::getId, ids)));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getMarketList")
|
||||
@ApiOperation("获取营销用户列表")
|
||||
@@ -452,6 +477,7 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 获取同级部门用户,以及下级部门所有用户
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/7/31
|
||||
*/
|
||||
@@ -468,6 +494,7 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据部门ids查询用户信息
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@@ -478,9 +505,9 @@ public class UserController extends BaseController {
|
||||
public HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId) {
|
||||
String methodDescribe = getMethodDescribe("getUserByDeptIds");
|
||||
List<User> users = userService.list(new LambdaQueryWrapper<User>()
|
||||
.in(User::getDeptId,deptId)
|
||||
.eq(User::getSmsNotice,1)
|
||||
.eq(User::getState,1)
|
||||
.in(User::getDeptId, deptId)
|
||||
.eq(User::getSmsNotice, 1)
|
||||
.eq(User::getState, 1)
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
@@ -492,14 +519,25 @@ public class UserController extends BaseController {
|
||||
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)
|
||||
.in(User::getDeptId, deptId)
|
||||
.eq(User::getState, DataStateEnum.ENABLE.getCode())
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getUserIdByRoleId")
|
||||
@ApiOperation("根据角色id查询用户id")
|
||||
@ApiImplicitParam(name = "roleId", value = "用户角色id", required = true)
|
||||
public HttpResult<List<String>> getUserIdByRoleId(@RequestBody List<String> roleId) {
|
||||
String methodDescribe = getMethodDescribe("getUserInfoByRoleId");
|
||||
List<String> userId = userService.getUserIdByRoleId(roleId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userId, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取同级部门用户,以及下级部门所有用户
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/7/31
|
||||
*/
|
||||
@@ -516,6 +554,7 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据角色类型获取用户 角色类型 type0:超级管理员;1:管理员;2:普通用户' 3:'审核角色',
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/3/29
|
||||
*/
|
||||
@@ -528,5 +567,18 @@ public class UserController extends BaseController {
|
||||
List<User> users = userService.getUserByRoleType(roleType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/simpleList")
|
||||
@ApiOperation("查询所有用户作为下拉框")
|
||||
public HttpResult<Object> simpleList() {
|
||||
String methodDescribe = getMethodDescribe("simpleList");
|
||||
List<User> result = userService.simpleList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.user.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
@@ -247,4 +248,7 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @Date: 2023/12/11 14:50
|
||||
*/
|
||||
List<Dept> getAllDept();
|
||||
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
}
|
||||
|
||||
@@ -93,4 +93,7 @@ public interface IRoleService extends IService<Role> {
|
||||
*/
|
||||
Role getRoleByCode(String code);
|
||||
|
||||
List<Role> allRoleList();
|
||||
|
||||
List<Role> simpleList();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.user.pojo.param.UserInfoParm;
|
||||
import com.njcn.user.pojo.param.UserParam;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.dto.UserDTO;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
@@ -190,4 +191,9 @@ public interface IUserService extends IService<User> {
|
||||
|
||||
List<User> getUserByRoleType(Integer roleType);
|
||||
|
||||
List<UserVO> listAllUserByDeptId(String deptId);
|
||||
|
||||
List<String> getUserIdByRoleId(List<String> roleId);
|
||||
|
||||
List<User> simpleList();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.user.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -65,8 +68,6 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
private final CommLedgerDeptClient commLedgerDeptClient;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Page<DeptVO> listDept(DeptParam.QueryParam queryParam) {
|
||||
QueryWrapper<DeptVO> queryWrapper = new QueryWrapper<>();
|
||||
@@ -82,7 +83,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), "sys_dept.sort");
|
||||
queryWrapper.orderBy(true, true, "sys_dept.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_dept.state", DataStateEnum.DELETED.getCode());
|
||||
@@ -105,7 +106,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
} else {
|
||||
String pids = "," + deptParam.getPid();
|
||||
String pid = this.baseMapper.getIdString(deptParam.getPid());
|
||||
if(StrUtil.isBlank(deptParam.getPid())){
|
||||
if (StrUtil.isBlank(deptParam.getPid())) {
|
||||
throw new BusinessException(UserResponseEnum.DEPT_PID_EXCEPTION);
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}
|
||||
//默认为正常状态
|
||||
dept.setState(DataStateEnum.ENABLE.getCode());
|
||||
if (StrUtil.isBlank(dept.getCode())){
|
||||
if (StrUtil.isBlank(dept.getCode())) {
|
||||
dept.setCode(dept.getId());
|
||||
}
|
||||
return this.save(dept);
|
||||
@@ -129,7 +130,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
Dept deptTem = this.getDeptById(updateParam.getId());
|
||||
|
||||
this.updateById(dept);
|
||||
if(!updateParam.getName().equals(deptTem.getName())){
|
||||
if (!updateParam.getName().equals(deptTem.getName())) {
|
||||
//修改了部门名称需要修改台账信息中的单位部门
|
||||
commLedgerDeptClient.update(dept);
|
||||
}
|
||||
@@ -181,20 +182,20 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<DeptTreeVO> existMonitorDeptTree() {
|
||||
List<Dept> deptTem = commLedgerDeptClient.existMonitorDeptTree().getData();
|
||||
if(CollectionUtil.isEmpty(deptTem)){
|
||||
if (CollectionUtil.isEmpty(deptTem)) {
|
||||
throw new BusinessException("当前没有部门存在监测点");
|
||||
}
|
||||
|
||||
List<String> useMonitorIds = deptTem.stream().map(Dept::getId).collect(Collectors.toList());
|
||||
List<String> resultDeptId = deptTem.stream().map(item->item.getPids().split(",")).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
|
||||
List<String> resultDeptId = deptTem.stream().map(item -> item.getPids().split(",")).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
|
||||
resultDeptId.addAll(useMonitorIds);
|
||||
|
||||
List<Integer> deptType = WebUtil.filterDeptType();
|
||||
String deptIndex = RequestUtil.getDeptIndex();
|
||||
List<DeptTreeVO> deptList = this.baseMapper.getDeptTree(deptIndex, deptType);
|
||||
List<DeptTreeVO> finalDeptList = deptList.stream().filter(item->resultDeptId.contains(item.getId())).collect(Collectors.toList());
|
||||
List<DeptTreeVO> lastList = finalDeptList.stream().peek(item->{
|
||||
if(useMonitorIds.contains(item.getId())){
|
||||
List<DeptTreeVO> finalDeptList = deptList.stream().filter(item -> resultDeptId.contains(item.getId())).collect(Collectors.toList());
|
||||
List<DeptTreeVO> lastList = finalDeptList.stream().peek(item -> {
|
||||
if (useMonitorIds.contains(item.getId())) {
|
||||
item.setLevel(2);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
@@ -225,8 +226,8 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
List<String> areaTreeVO = deptArea();
|
||||
HttpResult<List<AreaTreeDTO>> areaTreeDTOS = areaFeignClient.areaDeptTree(id, type);
|
||||
List<AreaTreeDTO> list = areaTreeDTOS.getData();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (AreaTreeDTO areaTreeVOList : list) {
|
||||
if (areaTreeVO.contains(areaTreeVOList.getId())) {
|
||||
@@ -251,14 +252,14 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
List<AreaTreeDTO> result = new ArrayList<>();
|
||||
List<String> deptBindAreaList = deptArea();
|
||||
List<Area> areaList = areaFeignClient.getPidAreaList(id, type).getData();
|
||||
areaList.forEach(item->{
|
||||
areaList.forEach(item -> {
|
||||
AreaTreeDTO areaTreeDTO = new AreaTreeDTO();
|
||||
areaTreeDTO.setId(item.getId());
|
||||
areaTreeDTO.setPid(item.getPid());
|
||||
if(deptBindAreaList.contains(item.getId())){
|
||||
if (deptBindAreaList.contains(item.getId())) {
|
||||
areaTreeDTO.setName(item.getName() + "(已被绑定)");
|
||||
areaTreeDTO.setIsFalse(1);
|
||||
}else {
|
||||
} else {
|
||||
areaTreeDTO.setName(item.getName());
|
||||
areaTreeDTO.setIsFalse(0);
|
||||
}
|
||||
@@ -340,7 +341,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public Dept getDeptByCode(String deptCode) {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Dept::getCode,deptCode).eq(Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||
lambdaQueryWrapper.eq(Dept::getCode, deptCode).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -406,7 +407,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<String> getDepSonSelfCodetByDeptId(String id) {
|
||||
Dept dept = this.getDeptById(id);
|
||||
if(Objects.isNull(dept)){
|
||||
if (Objects.isNull(dept)) {
|
||||
throw new BusinessException(UserResponseEnum.DEPT_MISSING);
|
||||
}
|
||||
List<String> sonIds = this.baseMapper.getDeptSonSlfeIds(id);
|
||||
@@ -418,11 +419,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
public List<String> getDepSonSelfCodetByCode(String code) {
|
||||
List<String> codes = new ArrayList<>();
|
||||
Dept dept = this.getDeptByCode(code);
|
||||
if(Objects.isNull(dept)){
|
||||
if (Objects.isNull(dept)) {
|
||||
throw new BusinessException(UserResponseEnum.DEPT_MISSING);
|
||||
}
|
||||
List<DeptDTO> deptList = this.baseMapper.getDeptDescendantIndexes(dept.getId(), Stream.of(0,1).collect(Collectors.toList()));
|
||||
if(CollectionUtil.isNotEmpty(deptList)){
|
||||
List<DeptDTO> deptList = this.baseMapper.getDeptDescendantIndexes(dept.getId(), Stream.of(0, 1).collect(Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(deptList)) {
|
||||
codes = deptList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
codes.add(dept.getCode());
|
||||
}
|
||||
@@ -441,10 +442,10 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<Dept> getDirectSonSelf(String deptId) {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.and (Wrapper-> Wrapper.
|
||||
eq (Dept::getPid,deptId).
|
||||
or ().
|
||||
eq(Dept::getId,deptId)).eq (Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
lambdaQueryWrapper.and(Wrapper -> Wrapper.
|
||||
eq(Dept::getPid, deptId).
|
||||
or().
|
||||
eq(Dept::getId, deptId)).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
// lambdaQueryWrapper.eq(Dept::getPid,deptId).eq(Dept::getState, DataStateEnum.ENABLE.getCode()).
|
||||
// or().eq(Dept::getId,deptId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
@@ -453,14 +454,14 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<Dept> getSpecialDeptList() {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Dept::getSpecialType,1).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
lambdaQueryWrapper.eq(Dept::getSpecialType, 1).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dept getRootDept(){
|
||||
public Dept getRootDept() {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Dept::getState,DataStateEnum.ENABLE.getCode()).eq(Dept::getPid,'0');
|
||||
lambdaQueryWrapper.eq(Dept::getState, DataStateEnum.ENABLE.getCode()).eq(Dept::getPid, '0');
|
||||
return this.getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -474,23 +475,23 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
*/
|
||||
@Override
|
||||
public List<DeptDTO> getDepSonDetailByDeptId(String deptId) {
|
||||
List<Dept> result = new ArrayList<> ();
|
||||
List<Dept> result = new ArrayList<>();
|
||||
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq (Dept::getPid, deptId).
|
||||
eq (Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList (lambdaQueryWrapper);
|
||||
if(CollectionUtils.isEmpty (result)){
|
||||
lambdaQueryWrapper.eq(Dept::getPid, deptId).
|
||||
eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
deptLambdaQueryWrapper.eq (Dept::getId, deptId).
|
||||
eq (Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList (deptLambdaQueryWrapper);
|
||||
deptLambdaQueryWrapper.eq(Dept::getId, deptId).
|
||||
eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList(deptLambdaQueryWrapper);
|
||||
}
|
||||
List<DeptDTO> collect = result.stream ( ).map (temp -> {
|
||||
DeptDTO deptDTO = new DeptDTO ( );
|
||||
BeanUtils.copyProperties (temp, deptDTO);
|
||||
List<DeptDTO> collect = result.stream().map(temp -> {
|
||||
DeptDTO deptDTO = new DeptDTO();
|
||||
BeanUtils.copyProperties(temp, deptDTO);
|
||||
return deptDTO;
|
||||
}).collect (Collectors.toList ( ));
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@@ -503,16 +504,26 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
|
||||
@Override
|
||||
public List<Dept> getDeptByCodeList(List<String> list) {
|
||||
return this.lambdaQuery().in(Dept::getCode,list).eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
|
||||
return this.lambdaQuery().in(Dept::getCode, list).eq(Dept::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> getDeptInfoListByIds(List<String> deptIds) {
|
||||
return this.lambdaQuery().in(Dept::getId,deptIds).eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
|
||||
return this.lambdaQuery().in(Dept::getId, deptIds).eq(Dept::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> getAllDept() {
|
||||
return this.lambdaQuery().eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
|
||||
return this.lambdaQuery().eq(Dept::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Tree<String>> orgTreeSelector() {
|
||||
List<Dept> deptList = this.lambdaQuery().eq(Dept::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
List<TreeNode<String>> treeNodeList = deptList.stream().map(dept ->
|
||||
new TreeNode<>(dept.getId(), dept.getPid(), dept.getName(), dept.getSort()))
|
||||
.collect(Collectors.toList());
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -204,6 +204,20 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
return this.lambdaQuery().eq(Role::getCode,code).eq(Role::getState,1).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Role> allRoleList() {
|
||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode());
|
||||
return this.baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Role> simpleList() {
|
||||
LambdaQueryWrapper<Role> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(Role::getId,Role::getName).eq(Role::getState,DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同编码的角色代码
|
||||
*/
|
||||
|
||||
@@ -100,18 +100,18 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
}
|
||||
List<String> roleNames = roleService.getRoleNameByUserId(user.getId());
|
||||
UserSet userSet = userSetService.lambdaQuery().eq(UserSet::getUserId, user.getId()).one();
|
||||
return new UserDTO(user.getId(), user.getLoginName(), user.getName(), user.getPassword(), roleNames, userSet.getSecretKey(), userSet.getStandBy(), user.getDeptId(), user.getType(),user.getHeadSculpture());
|
||||
return new UserDTO(user.getId(), user.getLoginName(), user.getName(), user.getPassword(), roleNames, userSet.getSecretKey(), userSet.getStandBy(), user.getDeptId(), user.getType(), user.getHeadSculpture());
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO loadUserByPhone(String phone) {
|
||||
User user = getUserByPhone(phone,false,null);
|
||||
User user = getUserByPhone(phone, false, null);
|
||||
if (Objects.isNull(user)) {
|
||||
return null;
|
||||
}
|
||||
List<String> roleNames = roleService.getRoleNameByUserId(user.getId());
|
||||
UserSet userSet = userSetService.lambdaQuery().eq(UserSet::getUserId, user.getId()).one();
|
||||
return new UserDTO(user.getId(), user.getLoginName(), user.getName(), user.getPassword(), roleNames, userSet.getSecretKey(), userSet.getStandBy(), user.getDeptId(), user.getType(),user.getHeadSculpture());
|
||||
return new UserDTO(user.getId(), user.getLoginName(), user.getName(), user.getPassword(), roleNames, userSet.getSecretKey(), userSet.getStandBy(), user.getDeptId(), user.getType(), user.getHeadSculpture());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,10 +256,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
return null;
|
||||
}
|
||||
BeanUtil.copyProperties(user, userVO);
|
||||
if (!Objects.isNull(user.getDeptId())){
|
||||
if (!Objects.isNull(user.getDeptId())) {
|
||||
Dept dept = deptService.getDeptById(user.getDeptId());
|
||||
//非自定义部门
|
||||
if (Objects.equals(dept.getType(),0)){
|
||||
if (Objects.equals(dept.getType(), 0)) {
|
||||
String areaId = deptService.getAreaIdByDeptId(user.getDeptId());
|
||||
userVO.setAreaId(areaId);
|
||||
userVO.setAreaName(areaFeignClient.selectIdArea(areaId).getData().getName());
|
||||
@@ -284,13 +284,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
Integer type = user.getType();
|
||||
if (Objects.equals(UserType.SUPER_ADMINISTRATOR, type)) {
|
||||
type = UserType.ADMINISTRATOR;
|
||||
//fixme 存在web用户和App用户,目前先通过管理员的登录名来区分开
|
||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && !Objects.equals(user.getLoginName(),"njcnyw")) {
|
||||
//fixme 存在web用户和App用户,目前先通过管理员的登录名来区分开
|
||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && !Objects.equals(user.getLoginName(), "njcnyw")) {
|
||||
type = UserType.USER;
|
||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && Objects.equals(user.getLoginName(),"njcnyw")) {
|
||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && Objects.equals(user.getLoginName(), "njcnyw")) {
|
||||
type = UserType.APP;
|
||||
}
|
||||
else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) {
|
||||
} else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) {
|
||||
return page;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
@@ -356,7 +355,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
|
||||
@Override
|
||||
public boolean updatePassword(String id, String password) {
|
||||
String secretPassword = userSetService.updatePassword(id, password,true);
|
||||
String secretPassword = userSetService.updatePassword(id, password, true);
|
||||
User user = lambdaQuery().eq(User::getId, id).one();
|
||||
user.setPassword(secretPassword);
|
||||
user.setPwdValidity(LocalDateTime.now());
|
||||
@@ -431,7 +430,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
String fileName = methodDescribe + ".xlsx";
|
||||
String targetDir = generalInfo.getBusinessTempPath() + File.separator + RequestUtil.getUserIndex();
|
||||
File parentDir = new File(targetDir);
|
||||
if(!parentDir.exists()){
|
||||
if (!parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
File excel = new File(targetDir, fileName);
|
||||
@@ -488,14 +487,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
@Override
|
||||
public List<User> getUserListByDeptId(String deptId) {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(Dept::getPids,deptId).select(Dept::getId);
|
||||
lambdaQueryWrapper.like(Dept::getPids, deptId).select(Dept::getId);
|
||||
List<String> deptIds = new ArrayList<>();
|
||||
deptIds.add(deptId);
|
||||
List<Dept> deptList = deptService.list(lambdaQueryWrapper);
|
||||
if(CollectionUtil.isNotEmpty(deptIds)){
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
deptIds.addAll(deptList.stream().map(Dept::getId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return this.list(new LambdaQueryWrapper<User>().in(User::getDeptId,deptIds).select(User::getId,User::getName,User::getLoginName));
|
||||
return this.list(new LambdaQueryWrapper<User>().in(User::getDeptId, deptIds).select(User::getId, User::getName, User::getLoginName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -528,6 +527,42 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
return userRoleMapper.getUserByRoleType(roleType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserVO> listAllUserByDeptId(String deptId) {
|
||||
//查询所有状态正常的用户信息,目前只要id和name
|
||||
LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(deptId)) {
|
||||
lambdaQueryWrapper.eq(User::getDeptId, deptId);
|
||||
}
|
||||
lambdaQueryWrapper.eq(User::getState, DataStateEnum.ENABLE.getCode())
|
||||
.select(User::getName,User::getId);
|
||||
List<User> users = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isEmpty(users)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
return BeanUtil.copyToList(users, UserVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUserIdByRoleId(List<String> roleId) {
|
||||
LambdaQueryWrapper<UserRole> userRoleLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userRoleLambdaQueryWrapper.in(UserRole::getRoleId,roleId);
|
||||
List<UserRole> userRole = userRoleService.list(userRoleLambdaQueryWrapper);
|
||||
if(CollectionUtil.isEmpty(userRole)){
|
||||
return new ArrayList<>();
|
||||
}else{
|
||||
return userRole.stream().map(UserRole::getUserId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> simpleList() {
|
||||
LambdaQueryWrapper<User> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userLambdaQueryWrapper.select(User::getId,User::getName).eq(User::getState,DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectList(userLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据登录名查询用户
|
||||
*
|
||||
@@ -576,8 +611,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
*/
|
||||
private void judgeIp(@NotNull User user, UserStrategy userStrategy) {
|
||||
String ipSection = user.getLimitIpStart() + "-" + user.getLimitIpEnd();
|
||||
log.error("用户实际ip:"+RequestUtil.getRealIp());
|
||||
log.error("用户限制ip:"+ipSection);
|
||||
log.error("用户实际ip:" + RequestUtil.getRealIp());
|
||||
log.error("用户限制ip:" + ipSection);
|
||||
if (RequestUtil.getRealIp().equalsIgnoreCase(LogInfo.UNKNOWN_IP)) {
|
||||
//feign接口可能获取的IP是空的
|
||||
throw new BusinessException(UserResponseEnum.INVALID_IP);
|
||||
|
||||
Reference in New Issue
Block a user