update 更改模块名称
This commit is contained in:
+309
@@ -0,0 +1,309 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoDataPage;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "对外报告数据表")
|
||||
@RestController
|
||||
@RequestMapping("/com.jero.modules.extRepo/extRepoData")
|
||||
@Slf4j
|
||||
public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoDataService> {
|
||||
@Autowired
|
||||
private IExtRepoDataService extRepoDataService;
|
||||
|
||||
@Autowired
|
||||
private IExtRepoFolderService extRepoFolderService;
|
||||
|
||||
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param extRepoData
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-分页列表查询")
|
||||
@ApiOperation(value = "对外报告数据表-分页列表查询", notes = "对外报告数据表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(ExtRepoData extRepoData,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
LambdaQueryWrapper<ExtRepoData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<ExtRepoData> page = new Page<>(pageNo, pageSize);
|
||||
// 文件名称模糊查询
|
||||
String fileName = req.getParameter("fileName");
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
fileName = fileName.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getFileName, fileName);
|
||||
}
|
||||
// 上传人模糊查询
|
||||
String createBy = req.getParameter("createBy");
|
||||
if (StringUtils.isNotBlank(createBy)) {
|
||||
createBy = createBy.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getCreateBy, createBy);
|
||||
}
|
||||
// 更新时间查询
|
||||
String createTime = req.getParameter("time");
|
||||
if (StringUtils.isNotBlank(createTime)) {
|
||||
String[] createTimeArr = createTime.split(",");
|
||||
if (createTimeArr.length >= 2) {
|
||||
queryWrapper.between(ExtRepoData::getCreateTime, createTimeArr[0]+" 00:00:00", createTimeArr[1]+" 23:59:59");
|
||||
}
|
||||
}
|
||||
queryWrapper.eq(ExtRepoData::getSupFolder, extRepoData.getSupFolder());
|
||||
queryWrapper.orderBy(true, false, ExtRepoData::getCreateTime);
|
||||
IPage<ExtRepoData> pageList = extRepoDataService.page(page, queryWrapper);
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
HttpSession session = req.getSession();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
|
||||
ExtRepoDataPage res = new ExtRepoDataPage((Boolean)session.getAttribute("haveSuperiorManageAuth"), pageList);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-列表查询")
|
||||
@ApiOperation(value = "对外报告数据表-列表查询", notes = "对外报告数据表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ExtRepoData>> queryList() {
|
||||
List<ExtRepoData> list = extRepoDataService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-添加")
|
||||
@ApiOperation(value = "对外报告数据表-添加", notes = "对外报告数据表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
|
||||
if ((Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
log.info("对外报告数据表收到文件添加请求,开始处理文件:【" + sdf.format(new Date()) + "】");
|
||||
int res = extRepoDataService.add(extRepoData);
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.success("添加成功:" + res + "条数据!");
|
||||
} else {
|
||||
result.success(res + " pieces of data are added successfully!");
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-编辑")
|
||||
@ApiOperation(value = "对外报告数据表-编辑", notes = "对外报告数据表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData erd = extRepoDataService.queryById(extRepoData.getId());
|
||||
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
|
||||
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoData.setSupFolder(erd.getSupFolder());
|
||||
extRepoDataService.editById(extRepoData);
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.success("编辑成功!");
|
||||
} else {
|
||||
result.success("Data update successfully!");
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-通过id删除")
|
||||
@ApiOperation(value = "对外报告数据表-通过id删除", notes = "对外报告数据表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam("id") String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd) {
|
||||
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
|
||||
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoDataService.deleteById(id);
|
||||
MinioUtil.delete(erd.getFileKey());
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("删除失败!");
|
||||
} else {
|
||||
result.error500("Delete failed!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-批量删除")
|
||||
@ApiOperation(value = "对外报告数据表-批量删除", notes = "对外报告数据表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam("ids") String ids,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> idsList = Arrays.asList(ids.split(","));
|
||||
for (String id : idsList) {
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd && !extRepoFolderService.isManager() && !sysUser.getUsername().equals(erd.getCreateBy())) {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String id : idsList) {
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd) {
|
||||
MinioUtil.delete(erd.getFileKey());
|
||||
this.extRepoDataService.deleteById(id);
|
||||
}
|
||||
}
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-通过id查询")
|
||||
@ApiOperation(value = "对外报告数据表-通过id查询", notes = "对外报告数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData extRepoData = extRepoDataService.queryById(id);
|
||||
if (extRepoData == null) {
|
||||
result.success("未找到对应数据!");
|
||||
return result;
|
||||
}
|
||||
return result.OK(extRepoData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param extRepoData
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExtRepoData extRepoData) {
|
||||
return super.exportXls(request, extRepoData, ExtRepoData.class, "对外报告数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ExtRepoData.class);
|
||||
}
|
||||
|
||||
}
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.extRepo.entity.ERFTreeDataVO;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "对外报告文件夹表")
|
||||
@RestController
|
||||
@RequestMapping("/extRepo/extRepoFolder")
|
||||
@Slf4j
|
||||
public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtRepoFolderService> {
|
||||
@Autowired
|
||||
private IExtRepoFolderService extRepoFolderService;
|
||||
|
||||
@Autowired
|
||||
private IExtRepoDataService extRepoDataService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-列表查询")
|
||||
@ApiOperation(value = "对外报告文件夹表-列表查询", notes = "对外报告文件夹表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<ERFTreeDataVO> queryList() {
|
||||
ERFTreeDataVO dataVO = new ERFTreeDataVO();
|
||||
//dataVO.setManager(extRepoFolderService.isManager());
|
||||
dataVO.setList(extRepoFolderService.queryTreeList());
|
||||
return Result.OK(dataVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-添加")
|
||||
@ApiOperation(value = "对外报告文件夹表-添加", notes = "对外报告文件夹表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
|
||||
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
|
||||
//上层是否有权限
|
||||
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
|
||||
if (boo||extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
|
||||
if (!extRepoFolder.isAddSub()) {
|
||||
//增加同级文件夹
|
||||
if (!boo) {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
throw new JeroBootException("无法创建同级文件夹!请联系管理员!");
|
||||
} else {
|
||||
throw new JeroBootException("Unable to create a sibling folder ! Please Contact your administrator !");
|
||||
}
|
||||
}
|
||||
extRepoFolder.setSupFolder(folder.getSupFolder());
|
||||
}
|
||||
extRepoFolderService.add(extRepoFolder);
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.success("添加成功!");
|
||||
} else {
|
||||
result.success("Data added successfully!");
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否允许增加同级文件夹
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "是否允许增加同级文件夹")
|
||||
@ApiOperation(value = "是否允许增加同级文件夹", notes = "是否允许增加同级文件夹")
|
||||
@PostMapping(value = "/isAllowSiblingFolder")
|
||||
public Result<?> isAllowSiblingFolder(@Validated @RequestBody ExtRepoFolder extRepoFolder,
|
||||
HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getId());
|
||||
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
|
||||
//上层是否有权限
|
||||
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
|
||||
if (boo || extRepoFolderService.haveManageAuth(extRepoFolder.getId())) {
|
||||
if (!boo) {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
return result.error500("无法创建同级文件夹!请联系管理员!");
|
||||
} else {
|
||||
return result.error500("Unable to create a sibling folder ! Please Contact your administrator !");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
return result.error500("没有权限!");
|
||||
} else {
|
||||
return result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result.success("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-编辑")
|
||||
@ApiOperation(value = "对外报告文件夹表-编辑", notes = "对外报告文件夹表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getId(),session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoFolderService.editById(extRepoFolder);
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.success("编辑成功!");
|
||||
} else {
|
||||
result.success("Data update successfully!");
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-通过id删除")
|
||||
@ApiOperation(value = "对外报告文件夹表-通过id删除", notes = "对外报告文件夹表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(id,session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
|
||||
if (resList.isEmpty()) {
|
||||
ExtRepoFolder erf = extRepoFolderService.queryById(id);
|
||||
int count = getRootFolderCount();
|
||||
if (erf.getSupFolder().equals("root") && count <= 1) {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("此文件夹不可删除!");
|
||||
} else {
|
||||
result.error500("This folder cannot be deleted!");
|
||||
}
|
||||
} else {
|
||||
List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id);
|
||||
for (ExtRepoData erd : erdList) {
|
||||
extRepoDataService.deleteById(erd.getId());
|
||||
}
|
||||
extRepoFolderService.deleteById(id);
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("请先删除子文件夹!");
|
||||
} else {
|
||||
result.error500("Please delete the subfolder first!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private int getRootFolderCount() {
|
||||
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
|
||||
return extRepoFolderService.count(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-通过id查询")
|
||||
@ApiOperation(value = "对外报告文件夹表-通过id查询", notes = "对外报告文件夹表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
ExtRepoFolder extRepoFolder = extRepoFolderService.queryById(id);
|
||||
if (extRepoFolder == null) {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("未找到对应数据!");
|
||||
} else {
|
||||
result.error500("No Data!");
|
||||
}
|
||||
}
|
||||
return result.OK(extRepoFolder);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对外报告文件夹 树结构实体类
|
||||
*/
|
||||
public class ERFTreeData implements Comparable<ERFTreeData> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 页面显示的名称 对应 folder_name
|
||||
*/
|
||||
private String title;
|
||||
|
||||
private String folderName;
|
||||
|
||||
/**
|
||||
* 文件夹ID 对应 id
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 层级,设定最多4级
|
||||
*/
|
||||
private int level;
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int orderId;
|
||||
|
||||
/**
|
||||
* 查看权限人员
|
||||
*/
|
||||
private String authViewIdsName = "";
|
||||
|
||||
/**
|
||||
* 管理权限人员
|
||||
*/
|
||||
private String authManageIdsName = "";
|
||||
|
||||
/**
|
||||
* 查看权限人员id
|
||||
*/
|
||||
private String authViewIds = "";
|
||||
|
||||
/**
|
||||
* 管理权限人员id
|
||||
*/
|
||||
private String authManageIds = "";
|
||||
|
||||
/**
|
||||
* 是否能点击右键
|
||||
*/
|
||||
private boolean isManager;
|
||||
|
||||
public boolean isManager() {
|
||||
return isManager;
|
||||
}
|
||||
|
||||
public void setManager(boolean manager) {
|
||||
isManager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子文件夹
|
||||
*/
|
||||
private List<ERFTreeData> children = new ArrayList<ERFTreeData>();
|
||||
|
||||
public ERFTreeData() {
|
||||
}
|
||||
|
||||
public ERFTreeData(String title, String key, int level, int orderId) {
|
||||
this.title = title;
|
||||
this.folderName = title;
|
||||
this.key = key;
|
||||
this.level = level;
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<ERFTreeData> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<ERFTreeData> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public int getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(int orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return folderName;
|
||||
}
|
||||
|
||||
public void setFolderName(String folderName) {
|
||||
this.folderName = folderName;
|
||||
}
|
||||
|
||||
public String getAuthViewIdsName() {
|
||||
return authViewIdsName;
|
||||
}
|
||||
|
||||
public void setAuthViewIdsName(String authViewIdsName) {
|
||||
this.authViewIdsName = authViewIdsName;
|
||||
}
|
||||
|
||||
public String getAuthManageIdsName() {
|
||||
return authManageIdsName;
|
||||
}
|
||||
|
||||
public void setAuthManageIdsName(String authManageIdsName) {
|
||||
this.authManageIdsName = authManageIdsName;
|
||||
}
|
||||
|
||||
public String getAuthViewIds() {
|
||||
return authViewIds;
|
||||
}
|
||||
|
||||
public void setAuthViewIds(String authViewIds) {
|
||||
this.authViewIds = authViewIds;
|
||||
}
|
||||
|
||||
public String getAuthManageIds() {
|
||||
return authManageIds;
|
||||
}
|
||||
|
||||
public void setAuthManageIds(String authManageIds) {
|
||||
this.authManageIds = authManageIds;
|
||||
}
|
||||
|
||||
public void sortChildren() {
|
||||
Collections.sort(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull ERFTreeData o) {
|
||||
return this.orderId - o.orderId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ERFTreeDataVO {
|
||||
// boolean isManager;
|
||||
List<ERFTreeData> list;
|
||||
|
||||
public ERFTreeDataVO() {
|
||||
}
|
||||
|
||||
// public boolean isManager() {
|
||||
// return isManager;
|
||||
// }
|
||||
|
||||
// public void setManager(boolean manager) {
|
||||
// isManager = manager;
|
||||
// }
|
||||
|
||||
public List<ERFTreeData> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<ERFTreeData> list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("ext_repo_data")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="ext_repo_data对象", description="对外报告数据表")
|
||||
public class ExtRepoData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文件标识*/
|
||||
@Excel(name = "文件标识", width = 15)
|
||||
@ApiModelProperty(value = "文件标识")
|
||||
private String fileKey;
|
||||
|
||||
/**文件名称*/
|
||||
@Excel(name = "文件名称", width = 15)
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
/**文件说明*/
|
||||
@Excel(name = "文件说明", width = 15)
|
||||
@ApiModelProperty(value = "文件说明")
|
||||
private String fileDescription;
|
||||
|
||||
/**所属文件夹*/
|
||||
@Excel(name = "所属文件夹", width = 15)
|
||||
@ApiModelProperty(value = "所属文件夹")
|
||||
private String supFolder;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
public class ExtRepoDataPage {
|
||||
|
||||
/**
|
||||
* 此页面是否有管理权限
|
||||
*/
|
||||
private boolean auth_manage;
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
private IPage<ExtRepoData> pageList;
|
||||
|
||||
public ExtRepoDataPage() {
|
||||
}
|
||||
|
||||
public ExtRepoDataPage(boolean auth_manage, IPage<ExtRepoData> pageList) {
|
||||
this.auth_manage = auth_manage;
|
||||
this.pageList = pageList;
|
||||
}
|
||||
|
||||
public boolean isAuth_manage() {
|
||||
return auth_manage;
|
||||
}
|
||||
|
||||
public void setAuth_manage(boolean auth_manage) {
|
||||
this.auth_manage = auth_manage;
|
||||
}
|
||||
|
||||
public IPage<ExtRepoData> getPageList() {
|
||||
return pageList;
|
||||
}
|
||||
|
||||
public void setPageList(IPage<ExtRepoData> pageList) {
|
||||
this.pageList = pageList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("ext_repo_folder")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="ext_repo_folder对象", description="对外报告文件夹表")
|
||||
public class ExtRepoFolder implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文件夹名称*/
|
||||
@Excel(name = "文件夹名称", width = 15)
|
||||
@ApiModelProperty(value = "文件夹名称")
|
||||
private String folderName;
|
||||
|
||||
/**文件夹排序*/
|
||||
@Excel(name = "文件夹排序", width = 15)
|
||||
@ApiModelProperty(value = "文件夹排序")
|
||||
private Integer orderId;
|
||||
|
||||
/**所属文件夹*/
|
||||
@Excel(name = "所属文件夹", width = 15)
|
||||
@ApiModelProperty(value = "所属文件夹")
|
||||
private String supFolder;
|
||||
|
||||
/**查看权限人员*/
|
||||
@Excel(name = "查看权限人员", width = 15)
|
||||
@ApiModelProperty(value = "查看权限人员")
|
||||
private String authViewIdsName;
|
||||
|
||||
/**管理权限人员*/
|
||||
@Excel(name = "管理权限人员", width = 15)
|
||||
@ApiModelProperty(value = "管理权限人员")
|
||||
private String authManageIdsName;
|
||||
|
||||
/**查看权限人员id*/
|
||||
@Excel(name = "查看权限人员id", width = 15)
|
||||
@ApiModelProperty(value = "查看权限人员id")
|
||||
private String authViewIds;
|
||||
|
||||
/**管理权限人员id*/
|
||||
@Excel(name = "管理权限人员id", width = 15)
|
||||
@ApiModelProperty(value = "管理权限人员id")
|
||||
private String authManageIds;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
|
||||
@TableField(exist = false)
|
||||
private boolean addSub;
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.jero.modules.extRepo.enums;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum ExtRepoMamagerRoleIdEnum {
|
||||
MANAGER_ID("系统管理员", "Administrator", "admin", "f6817f48af4fb3af11b9e8bf182f618b", 1),
|
||||
ERMANAGER_ID("对外报告管理员", "ExternalReportsManager", "ExternalReportsManager", "1552536424587862017", 2);
|
||||
|
||||
String name;
|
||||
String enName;
|
||||
String value;
|
||||
String id;
|
||||
Integer order;
|
||||
|
||||
ExtRepoMamagerRoleIdEnum(String name, String enName, String value, String id, Integer order) {
|
||||
this.name = name;
|
||||
this.enName = enName;
|
||||
this.value = value;
|
||||
this.id = id;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Integer order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public static List<String> getIdList() {
|
||||
List<String> idList = new ArrayList<>();
|
||||
ExtRepoMamagerRoleIdEnum[] values = values();
|
||||
for (ExtRepoMamagerRoleIdEnum ermriEnum : values) {
|
||||
idList.add(ermriEnum.getId());
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.extRepo.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ExtRepoDataMapper extends BaseMapper<ExtRepoData> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.extRepo.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ExtRepoFolderMapper extends BaseMapper<ExtRepoFolder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.extRepo.mapper.ExtRepoDataMapper">
|
||||
<resultMap id="ExtRepoDataResultMap" type="com.jero.modules.extRepo.entity.ExtRepoData">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="file_key" property="fileKey" />
|
||||
<result column="file_name" property="fileName" />
|
||||
<result column="file_description" property="fileDescription" />
|
||||
<result column="sup_folder" property="supFolder" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.extRepo.mapper.ExtRepoFolderMapper">
|
||||
<resultMap id="ExtRepoFolderResultMap" type="com.jero.modules.extRepo.entity.ExtRepoFolder">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="folder_name" property="folderName" />
|
||||
<result column="order_id" property="orderId" />
|
||||
<result column="sup_folder" property="supFolder" />
|
||||
<result column="auth_view_ids_name" property="authViewIdsName" />
|
||||
<result column="auth_manage_ids_name" property="authManageIdsName" />
|
||||
<result column="auth_view_ids" property="authViewIdsName" />
|
||||
<result column="auth_manage_ids" property="authManageIdsName" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.jero.modules.extRepo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IExtRepoDataService extends IService<ExtRepoData> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
int add(ExtRepoData extRepoData);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
void editById(ExtRepoData extRepoData);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ExtRepoData queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoData> queryList();
|
||||
|
||||
/**
|
||||
* 根据文件夹查询
|
||||
*
|
||||
* @param folserId
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoData> queryByFolder(String folserId);
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.jero.modules.extRepo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.extRepo.entity.ERFTreeData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IExtRepoFolderService extends IService<ExtRepoFolder> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
void add(ExtRepoFolder extRepoFolder);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
void editById(ExtRepoFolder extRepoFolder);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ExtRepoFolder queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoFolder> queryList();
|
||||
|
||||
/**
|
||||
* 查询返回树结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ERFTreeData> queryTreeList();
|
||||
|
||||
|
||||
/**
|
||||
* 是否有管理权限
|
||||
*
|
||||
* @param folderId
|
||||
* @return
|
||||
*/
|
||||
boolean haveManageAuth(String folderId);
|
||||
|
||||
/**
|
||||
* 是否有查看权限
|
||||
*
|
||||
* @param folderId
|
||||
* @return
|
||||
*/
|
||||
boolean haveViewAuth(String folderId);
|
||||
|
||||
/**
|
||||
* 是否管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isManager();
|
||||
|
||||
/**
|
||||
* 查找子文件夹
|
||||
*
|
||||
* @param supFolder
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoFolder> getListBySupFolder(String supFolder);
|
||||
|
||||
/**
|
||||
* 判断上级是否有权限
|
||||
* @param supFolder
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
void haveSuperiorManageAuth(String supFolder, HttpSession session);
|
||||
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.jero.modules.extRepo.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.mapper.ExtRepoDataMapper;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ExtRepoDataServiceImpl extends ServiceImpl<ExtRepoDataMapper, ExtRepoData> implements IExtRepoDataService {
|
||||
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int add(ExtRepoData extRepoData) {
|
||||
//返回成功数量
|
||||
int res = 0;
|
||||
Date now = new Date();
|
||||
// 根据fileKey查找文件
|
||||
String fileIds = extRepoData.getFileKey();
|
||||
if (StringUtils.isNotBlank(fileIds)) {
|
||||
String[] fileIdsArr = fileIds.split(",");
|
||||
for (String fid : fileIdsArr) {
|
||||
OSSFile ossFile = ossFileService.getById(fid);
|
||||
if (ObjectUtil.isNotEmpty(ossFile)) {
|
||||
String fileName = ossFile.getFileName();
|
||||
extRepoData.setFileName(fileName);
|
||||
ExtRepoData erd = extRepoDataCopy(extRepoData, fid, now);
|
||||
save(erd);
|
||||
res++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private ExtRepoData extRepoDataCopy(ExtRepoData extRepoData, String key, Date now) {
|
||||
ExtRepoData res = new ExtRepoData();
|
||||
res.setId(extRepoData.getId());
|
||||
res.setCreateBy(extRepoData.getCreateBy());
|
||||
res.setCreateTime(now);
|
||||
res.setUpdateBy(extRepoData.getUpdateBy());
|
||||
res.setUpdateTime(now);
|
||||
res.setSysOrgCode(extRepoData.getSysOrgCode());
|
||||
res.setFileKey(key);
|
||||
res.setFileName(extRepoData.getFileName());
|
||||
res.setFileDescription(extRepoData.getFileDescription());
|
||||
res.setSupFolder(extRepoData.getSupFolder());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(ExtRepoData extRepoData) {
|
||||
Date now = new Date();
|
||||
extRepoData.setUpdateTime(now);
|
||||
extRepoData.setCreateTime(null);
|
||||
saveOrUpdate(extRepoData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ExtRepoData queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ExtRepoData> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param folderId
|
||||
* @return
|
||||
*/
|
||||
public List<ExtRepoData> queryByFolder(String folderId) {
|
||||
LambdaQueryWrapper<ExtRepoData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ExtRepoData::getSupFolder, folderId);
|
||||
List<ExtRepoData> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+390
@@ -0,0 +1,390 @@
|
||||
package com.jero.modules.extRepo.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.extRepo.entity.ERFTreeData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
import com.jero.modules.extRepo.enums.ExtRepoMamagerRoleIdEnum;
|
||||
import com.jero.modules.extRepo.mapper.ExtRepoFolderMapper;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import com.jero.modules.system.entity.SysUserRole;
|
||||
import com.jero.modules.system.service.ISysUserRoleService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 对外报告文件夹表
|
||||
*/
|
||||
@Service
|
||||
public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, ExtRepoFolder> implements IExtRepoFolderService {
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
/**
|
||||
* 一级文件夹的supFolder统一存root
|
||||
*/
|
||||
private static final String superFolder = "root";
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(ExtRepoFolder extRepoFolder) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(extRepoFolder.getSupFolder())) {
|
||||
//一级文件夹的supFolder统一存root,方便以后查找
|
||||
extRepoFolder.setSupFolder(superFolder);
|
||||
}
|
||||
Date now = new Date();
|
||||
extRepoFolder.setCreateTime(now);
|
||||
extRepoFolder.setUpdateTime(now);
|
||||
extRepoFolder.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
|
||||
extRepoFolder.setAuthManageIds(extRepoFolder.getAuthManageIds());
|
||||
save(extRepoFolder);
|
||||
editOrderId(extRepoFolder);
|
||||
} catch (Exception ex) {
|
||||
log.error("添加对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("添加文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同级文件夹,修改顺序号
|
||||
*/
|
||||
private void editOrderId(ExtRepoFolder extRepoFolder) {
|
||||
List<ExtRepoFolder> list = getListBySupFolder(extRepoFolder.getSupFolder());
|
||||
for (ExtRepoFolder erf : list) {
|
||||
if (erf.getOrderId() >= extRepoFolder.getOrderId() && !erf.getId().equals(extRepoFolder.getId())) {
|
||||
erf.setOrderId(erf.getOrderId() + 1);
|
||||
updateById(erf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExtRepoFolder> getListBySupFolder(String supFolder) {
|
||||
ExtRepoFolder erf = new ExtRepoFolder();
|
||||
erf.setSupFolder(supFolder);
|
||||
QueryWrapper<ExtRepoFolder> queryWrapper = QueryGenerator.initQueryWrapper(erf, new HashMap<>());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(ExtRepoFolder extRepoFolder) {
|
||||
try {
|
||||
//原有的记录
|
||||
ExtRepoFolder erf_orig = queryById(extRepoFolder.getId());
|
||||
Date now = new Date();
|
||||
extRepoFolder.setUpdateTime(now);
|
||||
saveOrUpdate(extRepoFolder);
|
||||
editOrderId(extRepoFolder);
|
||||
editAuth(erf_orig, extRepoFolder);
|
||||
} catch (Exception ex) {
|
||||
log.error("修改对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("修改文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改所有关联文件夹的权限
|
||||
*/
|
||||
private void editAuth(ExtRepoFolder erf_orig, ExtRepoFolder erf_new) {
|
||||
//管理权限
|
||||
Map<String, String> authManage_orig = getAuthMap(erf_orig.getAuthManageIdsName(), erf_orig.getAuthManageIds());
|
||||
Map<String, String> authManage_new = getAuthMap(erf_new.getAuthManageIdsName(), erf_new.getAuthManageIds());
|
||||
//增加管理权限的人
|
||||
Map<String, String> addManageRole = getDefMap(authManage_new, authManage_orig);
|
||||
//删除管理权限的人
|
||||
Map<String, String> delManageRole = getDefMap(authManage_orig, authManage_new);
|
||||
|
||||
//查看权限
|
||||
Map<String, String> authView_orig = getAuthMap(erf_orig.getAuthViewIdsName(), erf_orig.getAuthViewIds());
|
||||
Map<String, String> authView_new = getAuthMap(erf_new.getAuthViewIdsName(), erf_new.getAuthViewIds());
|
||||
//增加查看权限的人
|
||||
Map<String, String> addViewRole = getDefMap(authView_new, authView_orig);
|
||||
//删除查看权限的人
|
||||
Map<String, String> delViewRole = getDefMap(authView_orig, authView_new);
|
||||
|
||||
List<ExtRepoFolder> allSubFolder = getAllSubFolder(erf_orig.getId());
|
||||
//存储变化的对象
|
||||
List<ExtRepoFolder> updateFolder = new ArrayList<>();
|
||||
for (ExtRepoFolder erf : allSubFolder) {
|
||||
boolean isChange = false;
|
||||
Map<String, String> authManage_erf = getAuthMap(erf.getAuthManageIdsName(), erf.getAuthManageIds());
|
||||
Map<String, String> authView_erf = getAuthMap(erf.getAuthViewIdsName(), erf.getAuthViewIds());
|
||||
for (String add : addManageRole.keySet()) {
|
||||
if (!authManage_erf.containsKey(add)) {
|
||||
authManage_erf.put(add, addManageRole.get(add));
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
for (String del : delManageRole.keySet()) {
|
||||
//如果是创建人 不能删除管理权限
|
||||
if (authManage_erf.containsKey(del)) {
|
||||
if (!del.equals(erf_orig.getCreateBy())) {
|
||||
authManage_erf.remove(del);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String add : addViewRole.keySet()) {
|
||||
if (!authView_erf.containsKey(add)) {
|
||||
authView_erf.put(add, addViewRole.get(add));
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
for (String del : delViewRole.keySet()) {
|
||||
if (authView_erf.containsKey(del)) {
|
||||
authView_erf.remove(del);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
erf.setAuthManageIdsName(StringUtils.join(authManage_erf.keySet(), ","));
|
||||
erf.setAuthManageIds(StringUtils.join(authManage_erf.values(), ","));
|
||||
erf.setAuthViewIdsName(StringUtils.join(authView_erf.keySet(), ","));
|
||||
erf.setAuthViewIds(StringUtils.join(authView_erf.values(), ","));
|
||||
if (isChange) {
|
||||
updateFolder.add(erf);
|
||||
}
|
||||
}
|
||||
if (updateFolder.size() > 0) {
|
||||
updateBatchById(updateFolder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到列表新增元素集合
|
||||
*/
|
||||
private Map<String, String> getDefMap(Map<String, String> mapA, Map<String, String> mapB) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
for (String s : mapA.keySet()) {
|
||||
if (StringUtils.isNotBlank(s) && !mapB.containsKey(s)) {
|
||||
res.put(s, mapA.get(s));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<ExtRepoFolder> getAllSubFolder(String folderId) {
|
||||
List<ExtRepoFolder> resList = getListBySupFolder(folderId);
|
||||
List<ExtRepoFolder> subList = new ArrayList<>();
|
||||
for (ExtRepoFolder erf : resList) {
|
||||
subList.addAll(getAllSubFolder(erf.getId()));
|
||||
}
|
||||
resList.addAll(subList);
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
try {
|
||||
removeById(id);
|
||||
} catch (Exception ex) {
|
||||
log.error("删除对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("删除文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@Override
|
||||
public ExtRepoFolder queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
@Override
|
||||
public List<ExtRepoFolder> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
@Override
|
||||
public List<ERFTreeData> queryTreeList() {
|
||||
try {
|
||||
List<ExtRepoFolder> list = queryList();
|
||||
List<ERFTreeData> res = getSubFolder(superFolder, list, 1);
|
||||
Collections.sort(res);
|
||||
return res;
|
||||
} catch (Exception ex) {
|
||||
log.error("查询对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("查询文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找子文件夹,生成树结构
|
||||
*/
|
||||
private List<ERFTreeData> getSubFolder(String supId, List<ExtRepoFolder> list, int level) {
|
||||
List<ERFTreeData> resList = new ArrayList<>();
|
||||
for (ExtRepoFolder erf : list) {
|
||||
if (supId.equals(erf.getSupFolder())) {
|
||||
if (haveViewAuth(erf.getId())) {
|
||||
ERFTreeData date = new ERFTreeData(erf.getFolderName(), erf.getId(), level, erf.getOrderId());
|
||||
boolean parentRightClick = haveManageAuth(erf.getId());
|
||||
if (parentRightClick) {
|
||||
date.setManager(true);
|
||||
}
|
||||
date.setAuthManageIdsName(erf.getAuthManageIdsName());
|
||||
date.setAuthManageIds(erf.getAuthManageIds());
|
||||
date.setAuthViewIdsName(erf.getAuthViewIdsName());
|
||||
date.setAuthViewIds(erf.getAuthViewIds());
|
||||
date.setChildren(subFolderTree(new ArrayList<ERFTreeData>(),date));
|
||||
date.sortChildren();
|
||||
resList.add(date);
|
||||
} else {
|
||||
resList.addAll(getSubFolder(erf.getId(), list, level));
|
||||
}
|
||||
}
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 父文件夹有权限则获取其下全部子文件夹
|
||||
* @param childTree
|
||||
* @param father
|
||||
* @return
|
||||
*/
|
||||
private List<ERFTreeData> subFolderTree(List<ERFTreeData> childTree,ERFTreeData father) {
|
||||
int childLevel = father.getLevel() + 1;
|
||||
List<ExtRepoFolder> listBySupFolder = getListBySupFolder(father.getKey());
|
||||
for (ExtRepoFolder extRepoFolder : listBySupFolder) {
|
||||
ERFTreeData date = new ERFTreeData(extRepoFolder.getFolderName(), extRepoFolder.getId(), childLevel, extRepoFolder.getOrderId());
|
||||
//是否有管理权限
|
||||
boolean childRightClick = haveManageAuth(extRepoFolder.getId());
|
||||
if (father.isManager()||childRightClick) {
|
||||
date.setManager(true);
|
||||
}
|
||||
//如果参数为空则延续父文件夹权限,反之用自己的
|
||||
if (ObjectUtils.isNotEmpty(extRepoFolder.getAuthManageIds()) && ObjectUtils.isNotEmpty(extRepoFolder.getAuthManageIdsName())) {
|
||||
date.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
|
||||
date.setAuthManageIds(extRepoFolder.getAuthManageIds());
|
||||
} else {
|
||||
date.setAuthManageIdsName(father.getAuthManageIdsName());
|
||||
date.setAuthManageIds(father.getAuthManageIds());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(extRepoFolder.getAuthViewIds()) && ObjectUtils.isNotEmpty(extRepoFolder.getAuthViewIdsName())) {
|
||||
date.setAuthViewIdsName(extRepoFolder.getAuthViewIdsName());
|
||||
date.setAuthViewIds(extRepoFolder.getAuthViewIds());
|
||||
} else {
|
||||
date.setAuthViewIdsName(father.getAuthViewIdsName());
|
||||
date.setAuthViewIds(father.getAuthViewIds());
|
||||
}
|
||||
date.setChildren(subFolderTree(new ArrayList<ERFTreeData>(),date));
|
||||
date.sortChildren();
|
||||
childTree.add(date);
|
||||
}
|
||||
return childTree;
|
||||
}
|
||||
|
||||
private List<String> getStringList(String listStr) {
|
||||
List<String> res = new ArrayList<>();
|
||||
if (null != listStr) {
|
||||
res = Arrays.asList(listStr.split(","));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private Map<String, String> getAuthMap(String strKey, String strValue) {
|
||||
Map<String, String> resMap = new HashMap<>();
|
||||
List<String> keyList = getStringList(strKey);
|
||||
List<String> valueList = getStringList(strValue);
|
||||
for (int i = 0; i < keyList.size(); i++) {
|
||||
resMap.put(keyList.get(i), valueList.get(i));
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是文件夹管理员角色
|
||||
*/
|
||||
@Override
|
||||
public boolean isManager() {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录用户
|
||||
// 查询当前登录用户角色
|
||||
List<SysUserRole> userRoles = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, loginUser.getId())); // 查询用户所有角色
|
||||
List<String> userRoleIds; // 用户管理员/对外报告管理员
|
||||
if (CollectionUtil.isNotEmpty(userRoles)) {
|
||||
List<String> roleIdList = ExtRepoMamagerRoleIdEnum.getIdList();
|
||||
List<String> userRoleIdList = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
userRoleIds = roleIdList.stream().filter(userRoleIdList::contains).collect(Collectors.toList());
|
||||
return !CollectionUtil.isEmpty(userRoleIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有管理权限
|
||||
*/
|
||||
@Override
|
||||
public boolean haveManageAuth(String folderId) {
|
||||
boolean res;
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
res = isManager();
|
||||
ExtRepoFolder erf = queryById(folderId);
|
||||
if (null != erf) {
|
||||
res = res || getStringList(erf.getAuthManageIds()).contains(sysUser.getId());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有查看权限
|
||||
*/
|
||||
public boolean haveViewAuth(String folderId) {
|
||||
boolean res;
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
res = isManager();
|
||||
ExtRepoFolder erf = queryById(folderId);
|
||||
if (null != erf) {
|
||||
res = res || getStringList(erf.getAuthManageIds()).contains(sysUser.getId())
|
||||
|| getStringList(erf.getAuthViewIds()).contains(sysUser.getId());
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断上级是否有权限
|
||||
* @param supFolder
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void haveSuperiorManageAuth(String supFolder, HttpSession session) {
|
||||
if (haveManageAuth(supFolder)) {
|
||||
session.setAttribute("haveSuperiorManageAuth", true);
|
||||
} else {
|
||||
ExtRepoFolder extRepoFolder = queryById(supFolder);
|
||||
if (ObjectUtils.isNotEmpty(extRepoFolder)) {
|
||||
haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user