Commit b91156fc authored by maqing's avatar maqing

用户管理-机构权限

parent 7b623153
......@@ -22,5 +22,7 @@ public class ReqUserInfo {
private Long organId;
private Long srvOrganId;
private String organName;
private String srvOrganName;
}
......@@ -25,6 +25,6 @@ public class InitResourceRoleCacheRunner implements CommandLineRunner {
@Override
public void run(String... args) {
resourceService.refreshPermissionRolesCache();
// resourceService.refreshPermissionRolesCache();
}
}
......@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hungraim.ltc.constant.Gender;
import com.hungraim.ltc.pojo.entity.disable.ChFndOrgan;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.system.SystemUser;
import com.hungraim.ltc.pojo.entity.system.SystemUserRole;
import com.hungraim.ltc.pojo.vo.system.ReqUserInfo;
......@@ -16,6 +18,7 @@ import com.hungraim.ltc.system.service.impl.SystemUserServiceImpl;
import com.hungraim.ltc.util.CheckStrength;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
......@@ -172,7 +175,9 @@ public class UserController {
* @return
*/
@PostMapping("/queryUsers")
public Result queryUsers(ReqUserInfo reqUserInfo) {
public Result queryUsers(@RequestHeader("Authorization") String token,ReqUserInfo reqUserInfo) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
long organId = TokenParsingUtil.TokenParsing(token, "organId");
QueryWrapper<SystemUser> systemUserQueryWrapper = new QueryWrapper<>();
if (!StrUtil.isBlankIfStr(reqUserInfo.getName())) {
......@@ -185,7 +190,16 @@ public class UserController {
if (!StrUtil.isBlankIfStr(reqUserInfo.getEnable())) {
systemUserQueryWrapper.and(wrapper -> wrapper.lambda().eq(SystemUser::getUserStatus, reqUserInfo.getEnable()));
}
if (srvOrganId!=0) {
systemUserQueryWrapper.and(wrapper -> wrapper.lambda().eq(SystemUser::getSrvOrganId, srvOrganId));
}
if (organId!=0) {
systemUserQueryWrapper.and(wrapper -> wrapper.lambda().eq(SystemUser::getOrganId, organId));
}
List<SystemUser> users = userInfoService.list(systemUserQueryWrapper);
List<ChFndOrgan> chFndOrganList = userInfoService.fndAllOrgans();
List<ChSrvOrgan> chSrvOrganList = userInfoService.srvOrganLists();
List<ReqUserInfo> resUsers = users.stream().map(user -> {
ReqUserInfo userInfo = new ReqUserInfo();
userInfo.setId(user.getUserId());
......@@ -196,6 +210,12 @@ public class UserController {
userInfo.setGender(Gender.MAN.getCode().equals(user.getGender()) ? Gender.MAN.getDesc() : Gender.WOMAN.getDesc());
userInfo.setOrganId(user.getOrganId());
userInfo.setSrvOrganId(user.getSrvOrganId());
if(userInfo.getOrganId()!=null && userInfo.getOrganId()>0 && userInfo.getSrvOrganId()!=null && !userInfo.getSrvOrganId().equals("0")){
List<ChFndOrgan> collect = chFndOrganList.stream().filter(chFndOrgan -> chFndOrgan.getOrganId().equals(user.getOrganId().toString())).collect(Collectors.toList());
List<ChSrvOrgan> chSrvOrgans = chSrvOrganList.stream().filter(chSrvOrgan -> chSrvOrgan.getSrvOrganId().equals(user.getSrvOrganId().intValue())).collect(Collectors.toList());
userInfo.setOrganName(collect.get(0).getOrganName());
userInfo.setSrvOrganName(chSrvOrgans.get(0).getSrvOrganName());
}
return userInfo;
}).collect(Collectors.toList());
return Result.success(resUsers);
......
......@@ -2,8 +2,13 @@ package com.hungraim.ltc.system.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.disable.ChFndOrgan;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.system.SystemUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 用户
......@@ -12,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SystemUserMapper extends BaseMapper<SystemUser> {
@Select("select ORGAN_ID,ORGAN_NAME from CH_FND_ORGAN")
List<ChFndOrgan> fndAllOrgans();
@Select("select SRV_ORGAN_ID,SRV_ORGAN_NAME from CH_SRV_ORGAN")
List<ChSrvOrgan> srvOrganLists();
}
package com.hungraim.ltc.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.disable.ChFndOrgan;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.system.SystemUser;
import java.util.List;
/**
* @author hubin
*/
public interface ISystemUserService extends IService<SystemUser> {
List<ChFndOrgan> fndAllOrgans();
List<ChSrvOrgan> srvOrganLists();
}
......@@ -2,6 +2,8 @@ package com.hungraim.ltc.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hungraim.ltc.pojo.entity.disable.ChFndOrgan;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.system.SystemUser;
import com.hungraim.ltc.system.dao.SystemUserMapper;
import com.hungraim.ltc.system.dao.SystemUserRoleMapper;
......@@ -9,6 +11,7 @@ import com.hungraim.ltc.system.service.ISystemUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author hubin
......@@ -23,4 +26,13 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
private SystemUserRoleMapper userRoleMapper;
@Override
public List<ChFndOrgan> fndAllOrgans() {
return userMapper.fndAllOrgans();
}
@Override
public List<ChSrvOrgan> srvOrganLists() {
return userMapper.srvOrganLists();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment