This commit is contained in:
wangliwen 2022-12-16 11:46:31 +08:00
parent f9d893c8e7
commit 94260ff02d
2 changed files with 34 additions and 1 deletions

View File

@ -122,7 +122,8 @@ public class ResourceController {
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "delFlag", value = "创建者用户id", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "delFlag", value = "创建者用户id", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "资源所属部门id", paramType = "query", dataType = "String") @ApiImplicitParam(name = "deptId", value = "资源所属部门id", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "是否过滤只出用户区域内部门", paramType = "query", dataType = "String")
}) })
public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<ResourceDTO> page = resourceService.page(params); PageData<ResourceDTO> page = resourceService.page(params);

View File

@ -56,10 +56,12 @@ 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.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO;
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.enums.SuperAdminEnum;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysRoleService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import okhttp3.*; import okhttp3.*;
@ -167,6 +169,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Value("${big_date.name}") @Value("${big_date.name}")
private String bigDataDeptName; private String bigDataDeptName;
@Value("${big_date.assignee_role_name}")
private String roleName0; // 具备审批的角色名称(普通)
@Value("${big_date.assignee_district_role_name}")
private String roleName1; // 具备审批的角色名称区县
@Value("${big_date.assignee_city_role_name}")
private String roleName2; // 具备审批的角色名称(市区)
@Value("${big_date.assignee_meet_role_id}")
private String defaultAssigneeRoleId; // 会客厅审核人角色
@Autowired @Autowired
private ResourceDao resourceDao; private ResourceDao resourceDao;
@ -255,6 +268,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired @Autowired
private TDemandDataDao tDemandDataDao; private TDemandDataDao tDemandDataDao;
@Autowired
private SysRoleService sysRoleService;
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate(); private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
private static final String getAllsql = "SELECT " + private static final String getAllsql = "SELECT " +
@ -499,6 +515,22 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceDTO.setCreator(SecurityUser.getUser().getId()); resourceDTO.setCreator(SecurityUser.getUser().getId());
Integer pageNum = jsonObject.getInteger("pageNum"); Integer pageNum = jsonObject.getInteger("pageNum");
Integer pageSize = jsonObject.getInteger("pageSize"); Integer pageSize = jsonObject.getInteger("pageSize");
// 2022.12.16 后台过滤只出所属区域资源
Boolean region = jsonObject.containsKey("region") ? jsonObject.getBooleanValue("region") : false; // 是否需要过滤只出用户所属区域资源
if (region) {
UserDetail user = SecurityUser.getUser(); // 当前用户
if (SuperAdminEnum.YES.value() != user.getSuperAdmin()) { // 非超级管理员
Optional<SysUserDTO> userDTOOptional = Optional.ofNullable(sysUserService.get(user.getId()));
SysRoleDTO roleDTO0 = sysRoleService.getByName(roleName0);
SysRoleDTO roleDTO1 = sysRoleService.getByName(roleName1);
SysRoleDTO roleDTO2 = sysRoleService.getByName(roleName2);
userDTOOptional.ifPresent(userDto -> {
if (userDto.getDeptId() != null) {
SysDeptEntity sysDeptEntity = sysDeptDao.getById(userDto.getDeptId());
}
});
}
}
Boolean nonChinese = jsonObject.containsKey("nonChinese") ? jsonObject.getBoolean("nonChinese") : Boolean.FALSE; // 不传默认为中文走全文索引 Boolean nonChinese = jsonObject.containsKey("nonChinese") ? jsonObject.getBoolean("nonChinese") : Boolean.FALSE; // 不传默认为中文走全文索引
//默认按上架时间降序排列 //默认按上架时间降序排列
String orderField; String orderField;