区域管理员只出本区域

This commit is contained in:
wangliwen 2022-10-31 10:42:07 +08:00
parent 1d70c445e6
commit f59eb5471f
3 changed files with 57 additions and 2 deletions

View File

@ -16,7 +16,10 @@ import io.renren.modules.resource.excel.census.config.CustomCellWriteHeightConfi
import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig; import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.service.ResourceBrowseService; import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -475,6 +478,13 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusResourceTable(@RequestParam Map<String, Object> params) { public Result selectCensusResourceTable(@RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
return new Result().ok(resourceService.selectCensusResourceTable(params)); return new Result().ok(resourceService.selectCensusResourceTable(params));
} }
@ -489,6 +499,13 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public void exportSelectCensusResourceTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException { public void exportSelectCensusResourceTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusResourceTable(params); ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusResourceTable(params);
List<List<Object>> date = resultList.stream().map(index -> { List<List<Object>> date = resultList.stream().map(index -> {
List<Object> data = new ArrayList<>(); List<Object> data = new ArrayList<>();
@ -542,6 +559,13 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusApplyTable(@RequestParam Map<String, Object> params) { public Result selectCensusApplyTable(@RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
return new Result().ok(resourceService.selectCensusApplyTable(params)); return new Result().ok(resourceService.selectCensusApplyTable(params));
} }
@ -556,6 +580,13 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public void exportSelectCensusApplyTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException { public void exportSelectCensusApplyTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusApplyTable(params); ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusApplyTable(params);
List<List<Object>> date = resultList.stream().map(index -> { List<List<Object>> date = resultList.stream().map(index -> {
List<Object> data = new ArrayList<>(); List<Object> data = new ArrayList<>();

View File

@ -45,10 +45,13 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao; import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dao.SysDeptDao; import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dao.SysRegionDao; import io.renren.modules.sys.dao.SysRegionDao;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.entity.SysDeptEntity; import io.renren.modules.sys.entity.SysDeptEntity;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -2075,6 +2078,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectApplyDeptDetailTypeCountList(Map params) { public Object selectApplyDeptDetailTypeCountList(Map params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查 if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
@ -2251,6 +2261,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectDeptDetailTypeCountList(Map params) { public Object selectDeptDetailTypeCountList(Map params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
} else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) {
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));

View File

@ -1763,7 +1763,8 @@
END END
) AS "type" ) AS "type"
FROM FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.dept_id, d.del_flag FROM tb_data_resource d LEFT JOIN (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.dept_id, d.del_flag FROM tb_data_resource d
LEFT JOIN
tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr, tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr,
sys_dept sd, sys_dept sd,
sys_user su, sys_user su,
@ -1775,7 +1776,7 @@
AND taa.user_id = su.id AND taa.user_id = su.id
AND su.dept_id = sd.id AND su.dept_id = sd.id
AND taa.resource_id = tdr.id AND taa.resource_id = tdr.id
AND dept.id = tdr.dept_id AND dept.id = tdr.dept_id
AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR
tdr.type = '业务组件') tdr.type = '业务组件')
<if test="approveStatus != null and approveStatus != ''"> <if test="approveStatus != null and approveStatus != ''">
@ -1922,6 +1923,9 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND tdr.type = #{type} AND tdr.type = #{type}
</if> </if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if> </if>
@ -1975,6 +1979,9 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND tdr.type = #{type} AND tdr.type = #{type}
</if> </if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if> </if>