From f59eb5471f505029297389f5cd3abc41814c2e3d Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 31 Oct 2022 10:42:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=8F=AA=E5=87=BA=E6=9C=AC=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusController.java | 31 +++++++++++++++++++ .../service/impl/ResourceServiceImpl.java | 17 ++++++++++ .../resources/mapper/resource/ResourceDao.xml | 11 +++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index 83ab710e..c2f3c9c5 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -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.service.ResourceService; 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.enums.SuperAdminEnum; import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; @@ -475,6 +478,13 @@ public class CensusController { @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), }) public Result selectCensusResourceTable(@RequestParam Map 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)); } @@ -489,6 +499,13 @@ public class CensusController { @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), }) public void exportSelectCensusResourceTable(@RequestParam Map 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 resultList = (ArrayList) resourceDao.selectCensusResourceTable(params); List> date = resultList.stream().map(index -> { List data = new ArrayList<>(); @@ -542,6 +559,13 @@ public class CensusController { @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), }) public Result selectCensusApplyTable(@RequestParam Map 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)); } @@ -556,6 +580,13 @@ public class CensusController { @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), }) public void exportSelectCensusApplyTable(@RequestParam Map 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 resultList = (ArrayList) resourceDao.selectCensusApplyTable(params); List> date = resultList.stream().map(index -> { List data = new ArrayList<>(); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 53468243..73feb0f3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -45,10 +45,13 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.resourceScore.dao.ResourceScoreDao; 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.SysRegionDao; +import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysUserDTO; 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.SysUserService; import lombok.SneakyThrows; @@ -2075,6 +2078,13 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); Map>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); @@ -2251,6 +2261,13 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params); Map>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 70976a8b..d7ba8f93 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1763,7 +1763,8 @@ END ) AS "type" 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, sys_dept sd, sys_user su, @@ -1775,7 +1776,7 @@ AND taa.user_id = su.id AND su.dept_id = sd.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 tdr.type = '业务组件') @@ -1922,6 +1923,9 @@ AND tdr.type = #{type} + + AND sd.district = #{region} + AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} @@ -1975,6 +1979,9 @@ AND tdr.type = #{type} + + AND sd.district = #{region} + AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}