检测文件权限相关更新
This commit is contained in:
parent
b5aa15ec02
commit
b906a00f1a
@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
|
|||||||
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
|
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
|
||||||
import cn.iocoder.yudao.module.inspection.vo.AssignAuthorityVo;
|
import cn.iocoder.yudao.module.inspection.vo.AssignAuthorityVo;
|
||||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.permission.PermissionServiceImpl;
|
||||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||||
import cn.iocoder.yudao.util.ExcelUtil;
|
import cn.iocoder.yudao.util.ExcelUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +38,7 @@ public class InspectionFileController extends BaseController {
|
|||||||
private AppInspectionPartnerService partnerService;
|
private AppInspectionPartnerService partnerService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RoleService roleService;
|
private PermissionServiceImpl roleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询inspectionFile列表
|
* 查询inspectionFile列表
|
||||||
@ -49,6 +52,7 @@ public class InspectionFileController extends BaseController {
|
|||||||
|
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询inspectionFile列表权限
|
* 查询inspectionFile列表权限
|
||||||
*/
|
*/
|
||||||
@ -59,7 +63,14 @@ public class InspectionFileController extends BaseController {
|
|||||||
//判断当前登录人是否是租户管理员 tenant_admin
|
//判断当前登录人是否是租户管理员 tenant_admin
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
// 判断当前登录人是否是租户管理员 tenant_admin
|
// 判断当前登录人是否是租户管理员 tenant_admin
|
||||||
|
List<UserRoleDTO> userRoleDTOS = roleService.userRoleDTOList(Collections.singletonList(loginUser.getId()));
|
||||||
|
if (CollUtil.isNotEmpty(userRoleDTOS)) {
|
||||||
|
for (UserRoleDTO userRoleDTO : userRoleDTOS) {
|
||||||
|
if ("tenant_admin".equals(userRoleDTO.getRoleCode())) {
|
||||||
|
return success(inspectionFileService.selectInspectionFileList(inspectionFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<InspectionFile> list = inspectionFileService.selectInspectionFileListByPermissio(inspectionFile, getLoginUser().getId());
|
List<InspectionFile> list = inspectionFileService.selectInspectionFileListByPermissio(inspectionFile, getLoginUser().getId());
|
||||||
|
|
||||||
@ -160,14 +171,12 @@ public class InspectionFileController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/assignAuthority")
|
@PostMapping("/assignAuthority")
|
||||||
public CommonResult assignAuthority(@RequestBody AssignAuthorityVo assignAuthorityVo) {
|
public CommonResult assignAuthority(@RequestBody AssignAuthorityVo assignAuthorityVo) {
|
||||||
// if (CollUtil.isEmpty(assignAuthorityVo.getUserIds())) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
return success(inspectionFileService.assignAuthority(assignAuthorityVo.getUserIds(), assignAuthorityVo.getFileId()));
|
return success(inspectionFileService.assignAuthority(assignAuthorityVo.getUserIds(), assignAuthorityVo.getFileId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据文件id获取有权限的用户id
|
* 根据文件id获取有权限的用户id
|
||||||
|
*
|
||||||
* @param fileId
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -200,6 +200,8 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
|||||||
LambdaQueryWrapper<InspectionFile> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InspectionFile> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (ObjectUtil.isNotEmpty(inspectionFile.getFatherId())) {
|
if (ObjectUtil.isNotEmpty(inspectionFile.getFatherId())) {
|
||||||
queryWrapper.eq(InspectionFile::getFatherId, inspectionFile.getFatherId());
|
queryWrapper.eq(InspectionFile::getFatherId, inspectionFile.getFatherId());
|
||||||
|
}else {
|
||||||
|
queryWrapper.isNull(InspectionFile::getFatherId);
|
||||||
}
|
}
|
||||||
queryWrapper.orderByAsc(InspectionFile::getType);
|
queryWrapper.orderByAsc(InspectionFile::getType);
|
||||||
queryWrapper.orderByDesc(InspectionFile::getCreateTime);
|
queryWrapper.orderByDesc(InspectionFile::getCreateTime);
|
||||||
@ -321,7 +323,12 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 去重操作,优化查询时已经进行了判断,可以删除重复文件
|
// 去重操作,优化查询时已经进行了判断,可以删除重复文件
|
||||||
return resultFiles.stream().distinct().collect(Collectors.toList());
|
List<InspectionFile> collect = resultFiles.stream().distinct().collect(Collectors.toList());
|
||||||
|
if (ObjectUtil.isNotEmpty(inspectionFile.getFileName())) {
|
||||||
|
//模糊匹配对应名称
|
||||||
|
collect = collect.stream().filter(file -> file.getFileName().contains(inspectionFile.getFileName())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取文件夹内的所有文件(包括子文件夹的内容)
|
// 获取文件夹内的所有文件(包括子文件夹的内容)
|
||||||
|
Loading…
Reference in New Issue
Block a user