page,@Param("req") UserListReq userListReq);
+
+ UserListResp detailInfo(String id);
}
\ No newline at end of file
diff --git a/src/main/java/com/huoran/iasf/mapper/UserDeptMapper.java b/src/main/java/com/huoran/iasf/mapper/UserDeptMapper.java
new file mode 100644
index 0000000..b174a1c
--- /dev/null
+++ b/src/main/java/com/huoran/iasf/mapper/UserDeptMapper.java
@@ -0,0 +1,16 @@
+package com.huoran.iasf.mapper;
+
+import com.huoran.iasf.entity.UserDept;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 用户员工部门表 Mapper 接口
+ *
+ *
+ * @author cheney
+ * @since 2022-08-15
+ */
+public interface UserDeptMapper extends BaseMapper {
+
+}
diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysUserMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysUserMapper.xml
new file mode 100644
index 0000000..bbe95ac
--- /dev/null
+++ b/src/main/java/com/huoran/iasf/mapper/xml/SysUserMapper.xml
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/huoran/iasf/mapper/xml/UserDeptMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/UserDeptMapper.xml
new file mode 100644
index 0000000..35fd249
--- /dev/null
+++ b/src/main/java/com/huoran/iasf/mapper/xml/UserDeptMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/main/java/com/huoran/iasf/service/DeptService.java b/src/main/java/com/huoran/iasf/service/DeptService.java
index 7a86e24..cdb80dd 100644
--- a/src/main/java/com/huoran/iasf/service/DeptService.java
+++ b/src/main/java/com/huoran/iasf/service/DeptService.java
@@ -40,8 +40,10 @@ public interface DeptService extends IService {
* 部门树形列表
*
* @param deptId deptId
- * @param disabled 最顶级是否可用
* @return 树形列表
*/
- List deptTreeList(String deptId, Boolean disabled);
+ List deptTreeList(String deptId);
+
+
+ boolean checkDeptRepeat(SysDept sysDept);
}
diff --git a/src/main/java/com/huoran/iasf/service/HttpSessionService.java b/src/main/java/com/huoran/iasf/service/HttpSessionService.java
index cc11be1..def61e7 100644
--- a/src/main/java/com/huoran/iasf/service/HttpSessionService.java
+++ b/src/main/java/com/huoran/iasf/service/HttpSessionService.java
@@ -181,25 +181,25 @@ public class HttpSessionService {
* @param userId userId
*/
public void refreshUerId(String userId) {
-// redisService.delKeys(userTokenPrefix + "*#" + userId);
-
-
-// Set keys = redisService.keys("#" + userId);
-// //如果修改了角色/权限, 那么刷新权限
-// for (String key : keys) {
-// JSONObject redisSession = JSON.parseObject(redisService.get(key));
-//
-// List roleNames = getRolesByUserId(userId);
-// if (!CollectionUtils.isEmpty(roleNames)) {
-// redisSession.put(Constant.ROLES_KEY, roleNames);
-// }
-// Set permissions = getPermissionsByUserId(userId);
-// redisSession.put(Constant.PERMISSIONS_KEY, permissions);
-// Long redisTokenKeyExpire = redisService.getExpire(key);
-// //刷新token绑定的角色权限
-// redisService.setAndExpire(key, redisSession.toJSONString(), redisTokenKeyExpire);
-//
-// }
+ redisService.delKeys(userTokenPrefix + "*#" + userId);
+
+
+ Set keys = redisService.keys("#" + userId);
+ //如果修改了角色/权限, 那么刷新权限
+ for (String key : keys) {
+ JSONObject redisSession = JSON.parseObject(redisService.get(key));
+
+ List roleNames = getRolesByUserId(userId);
+ if (!CollectionUtils.isEmpty(roleNames)) {
+ redisSession.put(Constant.ROLES_KEY, roleNames);
+ }
+ Set permissions = getPermissionsByUserId(userId);
+ redisSession.put(Constant.PERMISSIONS_KEY, permissions);
+ Long redisTokenKeyExpire = redisService.getExpire(key);
+ //刷新token绑定的角色权限
+ redisService.setAndExpire(key, redisSession.toJSONString(), redisTokenKeyExpire);
+
+ }
}
/**
@@ -208,10 +208,10 @@ public class HttpSessionService {
* @param roleId roleId
*/
public void refreshRolePermission(String roleId) {
-// List userIds = userRoleService.getUserIdsByRoleId(roleId);
-// if (!CollectionUtils.isEmpty(userIds)) {
-// userIds.parallelStream().forEach(this::refreshUerId);
-// }
+ List userIds = userRoleService.getUserIdsByRoleId(roleId);
+ if (!CollectionUtils.isEmpty(userIds)) {
+ userIds.parallelStream().forEach(this::refreshUerId);
+ }
}
/**
@@ -220,10 +220,10 @@ public class HttpSessionService {
* @param permissionId permissionId
*/
public void refreshPermission(String permissionId) {
-// List userIds = permissionService.getUserIdsById(permissionId);
-// if (!CollectionUtils.isEmpty(userIds)) {
-// userIds.parallelStream().forEach(this::refreshUerId);
-// }
+ List userIds = permissionService.getUserIdsById(permissionId);
+ if (!CollectionUtils.isEmpty(userIds)) {
+ userIds.parallelStream().forEach(this::refreshUerId);
+ }
}
diff --git a/src/main/java/com/huoran/iasf/service/RedisService.java b/src/main/java/com/huoran/iasf/service/RedisService.java
index fbe002c..73e4b79 100644
--- a/src/main/java/com/huoran/iasf/service/RedisService.java
+++ b/src/main/java/com/huoran/iasf/service/RedisService.java
@@ -31,7 +31,7 @@ public class RedisService {
public Long getExpire(String key) {
if (null == key) {
- throw new BusinessException(BaseResponseCode.DATA_ERROR.getCode(), "key or TomeUnit 不能为空");
+ throw new BusinessException(BaseResponseCode.KEY_OR_TOMEUNIT);
}
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
diff --git a/src/main/java/com/huoran/iasf/service/RoleService.java b/src/main/java/com/huoran/iasf/service/RoleService.java
index 0904c29..c291f7b 100644
--- a/src/main/java/com/huoran/iasf/service/RoleService.java
+++ b/src/main/java/com/huoran/iasf/service/RoleService.java
@@ -28,14 +28,6 @@ public interface RoleService extends IService {
*/
void updateRole(SysRole vo);
- /**
- * 根据id获取角色详情
- *
- * @param id id
- * @return SysRole
- */
- SysRole detailInfo(String id);
-
/**
* 根据id删除
*
@@ -58,4 +50,6 @@ public interface RoleService extends IService {
* @return List
*/
List getRoleNames(String userId);
+
+ boolean checkDeptRepeat(SysRole vo);
}
diff --git a/src/main/java/com/huoran/iasf/service/SysRoleDeptService.java b/src/main/java/com/huoran/iasf/service/SysRoleDeptService.java
deleted file mode 100644
index 07b1f53..0000000
--- a/src/main/java/com/huoran/iasf/service/SysRoleDeptService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.huoran.iasf.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.huoran.iasf.entity.SysRoleDeptEntity;
-
-/**
- * 角色部门
- *
- * @author cheney
- * @email *****@mail.com
- * @date 2020-09-27 17:30:15
- */
-public interface SysRoleDeptService extends IService {
-
-}
-
diff --git a/src/main/java/com/huoran/iasf/service/UserDeptService.java b/src/main/java/com/huoran/iasf/service/UserDeptService.java
new file mode 100644
index 0000000..b25966b
--- /dev/null
+++ b/src/main/java/com/huoran/iasf/service/UserDeptService.java
@@ -0,0 +1,16 @@
+package com.huoran.iasf.service;
+
+import com.huoran.iasf.entity.UserDept;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 用户员工部门表 服务类
+ *
+ *
+ * @author cheney
+ * @since 2022-08-15
+ */
+public interface UserDeptService extends IService {
+
+}
diff --git a/src/main/java/com/huoran/iasf/service/UserService.java b/src/main/java/com/huoran/iasf/service/UserService.java
index 5949061..bdb47ad 100644
--- a/src/main/java/com/huoran/iasf/service/UserService.java
+++ b/src/main/java/com/huoran/iasf/service/UserService.java
@@ -1,10 +1,17 @@
package com.huoran.iasf.service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysUser;
+import com.huoran.iasf.vo.req.UserListReq;
import com.huoran.iasf.vo.resp.LoginRespVO;
+import com.huoran.iasf.vo.resp.UserListResp;
import com.huoran.iasf.vo.resp.UserOwnRoleRespVO;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Map;
/**
* 用户 服务类
@@ -40,10 +47,9 @@ public interface UserService extends IService {
/**
* 分页
*
- * @param vo vo
* @return IPage
*/
- IPage pageInfo(SysUser vo);
+ R pageInfo(UserListReq userListReq);
/**
* 添加用户
@@ -73,4 +79,12 @@ public interface UserService extends IService {
* @param vo vo
*/
void updateUserInfoMy(SysUser vo);
+
+ UserListResp detailInfo(String id);
+
+ R resetPwd(String userId);
+
+ Map importStaff(MultipartFile file);
+
+ void exportFailureRecord(HttpServletResponse response, String exportCode) throws IOException;
}
diff --git a/src/main/java/com/huoran/iasf/service/impl/DeptServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/DeptServiceImpl.java
index 4fc26a3..59de614 100644
--- a/src/main/java/com/huoran/iasf/service/impl/DeptServiceImpl.java
+++ b/src/main/java/com/huoran/iasf/service/impl/DeptServiceImpl.java
@@ -1,21 +1,24 @@
package com.huoran.iasf.service.impl;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.iasf.common.exception.BusinessException;
import com.huoran.iasf.common.exception.code.BaseResponseCode;
import com.huoran.iasf.entity.SysDept;
-import com.huoran.iasf.entity.SysUser;
+import com.huoran.iasf.entity.UserDept;
import com.huoran.iasf.mapper.SysDeptMapper;
import com.huoran.iasf.mapper.SysUserMapper;
+import com.huoran.iasf.mapper.UserDeptMapper;
import com.huoran.iasf.service.DeptService;
import com.huoran.iasf.vo.resp.DeptRespNodeVO;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
@@ -37,6 +40,8 @@ public class DeptServiceImpl extends ServiceImpl impleme
@Resource
private SysDeptMapper sysDeptMapper;
@Resource
+ private UserDeptMapper userDeptMapper;
+ @Resource
private SysUserMapper sysUserMapper;
@Override
@@ -57,6 +62,18 @@ public class DeptServiceImpl extends ServiceImpl impleme
sysDeptMapper.insert(vo);
}
+ @Override
+ public boolean checkDeptRepeat(SysDept sysDept){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("name", sysDept.getName());
+ queryWrapper.eq("pid", sysDept.getPid());
+ if (StrUtil.isNotEmpty(sysDept.getId())) {
+ queryWrapper.last(" and id != " + sysDept.getId());
+ }
+ List sysDepts = baseMapper.selectList(queryWrapper);
+ return sysDepts.size() > 0;
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public void updateDept(SysDept vo) {
@@ -104,7 +121,11 @@ public class DeptServiceImpl extends ServiceImpl impleme
throw new BusinessException(BaseResponseCode.DATA_ERROR);
}
List