对外报告模块 文件夹管理 报告管理
This commit is contained in:
+207
@@ -0,0 +1,207 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
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.lang.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 java.util.Arrays;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @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) {
|
||||
QueryWrapper<ExtRepoData> queryWrapper = QueryGenerator.initQueryWrapper(extRepoData, req.getParameterMap());
|
||||
Page<ExtRepoData> page = new Page<ExtRepoData>(pageNo, pageSize);
|
||||
// 文件名称模糊查询
|
||||
String fileName = req.getParameter("fileName");
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
queryWrapper.like("fileName", fileName);
|
||||
}
|
||||
|
||||
// 创建人模糊查询
|
||||
String createBy = req.getParameter("createBy");
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
queryWrapper.like("createBy", createBy);
|
||||
}
|
||||
IPage<ExtRepoData> pageList = extRepoDataService.page(page, queryWrapper);
|
||||
log.info("查询当前页:" + pageList.getCurrent());
|
||||
log.info("查询当前页数量:" + pageList.getSize());
|
||||
log.info("查询结果数量:" + pageList.getRecords().size());
|
||||
log.info("数据总数:" + pageList.getTotal());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @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) {
|
||||
if (extRepoFolderService.haveManageAuth(extRepoData.getSupFolder())) {
|
||||
extRepoDataService.add(extRepoData);
|
||||
return Result.OK("添加成功!");
|
||||
} else {
|
||||
return Result.error("没有权限!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-编辑")
|
||||
@ApiOperation(value = "对外报告数据表-编辑", notes = "对外报告数据表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoData extRepoData) {
|
||||
if (extRepoFolderService.haveManageAuth(extRepoData.getSupFolder())) {
|
||||
extRepoDataService.editById(extRepoData);
|
||||
return Result.OK("编辑成功!");
|
||||
} else {
|
||||
return Result.error("没有权限!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-通过id删除")
|
||||
@ApiOperation(value = "对外报告数据表-通过id删除", notes = "对外报告数据表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (extRepoFolderService.haveManageAuth(erd.getSupFolder()) && erd.getCreateBy().equals(sysUser.getUsername())) {
|
||||
extRepoDataService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error("没有权限!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-批量删除")
|
||||
@ApiOperation(value = "对外报告数据表-批量删除", notes = "对外报告数据表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.extRepoDataService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过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) {
|
||||
ExtRepoData extRepoData = extRepoDataService.queryById(id);
|
||||
if (extRepoData == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.extRepo.entity.ERFTreeData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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 java.util.Arrays;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-分页列表查询")
|
||||
@ApiOperation(value="对外报告文件夹表-分页列表查询", notes="对外报告文件夹表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(ExtRepoFolder extRepoFolder,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ExtRepoFolder> queryWrapper = QueryGenerator.initQueryWrapper(extRepoFolder, req.getParameterMap());
|
||||
Page<ExtRepoFolder> page = new Page<ExtRepoFolder>(pageNo, pageSize);
|
||||
IPage<ExtRepoFolder> pageList = extRepoFolderService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-列表查询")
|
||||
@ApiOperation(value="对外报告文件夹表-列表查询", notes="对外报告文件夹表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ERFTreeData>> queryList() {
|
||||
List<ERFTreeData> list = extRepoFolderService.queryTreeList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-添加")
|
||||
@ApiOperation(value="对外报告文件夹表-添加", notes="对外报告文件夹表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
||||
extRepoFolderService.add(extRepoFolder);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-编辑")
|
||||
@ApiOperation(value="对外报告文件夹表-编辑", notes="对外报告文件夹表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
||||
extRepoFolderService.editById(extRepoFolder);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-通过id删除")
|
||||
@ApiOperation(value="对外报告文件夹表-通过id删除", notes="对外报告文件夹表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
extRepoFolderService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-批量删除")
|
||||
@ApiOperation(value="对外报告文件夹表-批量删除", notes="对外报告文件夹表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.extRepoFolderService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过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) {
|
||||
ExtRepoFolder extRepoFolder = extRepoFolderService.queryById(id);
|
||||
if(extRepoFolder==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(extRepoFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param extRepoFolder
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExtRepoFolder extRepoFolder) {
|
||||
return super.exportXls(request, extRepoFolder, ExtRepoFolder.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, ExtRepoFolder.class);
|
||||
}
|
||||
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 文件夹ID 对应 id
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 层级,设定最多4级
|
||||
*/
|
||||
private int level;
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int orderId;
|
||||
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private boolean display = false;
|
||||
|
||||
/**
|
||||
* 子文件夹
|
||||
*/
|
||||
private List<ERFTreeData> children = new ArrayList<ERFTreeData>();
|
||||
|
||||
public ERFTreeData() {
|
||||
}
|
||||
|
||||
public ERFTreeData(String title, String key, int level,int orderId) {
|
||||
this.title = 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 boolean isDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(boolean display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ERFTreeData{" +
|
||||
"title='" + title + '\'' +
|
||||
", key='" + key + '\'' +
|
||||
", level=" + level +
|
||||
", orderId=" + orderId +
|
||||
", display=" + display +
|
||||
", children=" + children +
|
||||
'}';
|
||||
}
|
||||
|
||||
public void sortChildren() {
|
||||
Collections.sort(children);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull ERFTreeData o) {
|
||||
return this.orderId - o.orderId;
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.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 java.lang.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 java.lang.String sysOrgCode;
|
||||
|
||||
/**文件标识*/
|
||||
@Excel(name = "文件标识", width = 15)
|
||||
@ApiModelProperty(value = "文件标识")
|
||||
private java.lang.String fileKey;
|
||||
|
||||
/**文件名称*/
|
||||
@Excel(name = "文件名称", width = 15)
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private java.lang.String fileName;
|
||||
|
||||
/**文件说明*/
|
||||
@Excel(name = "文件说明", width = 15)
|
||||
@ApiModelProperty(value = "文件说明")
|
||||
private java.lang.String fileDescription;
|
||||
|
||||
/**所属文件夹*/
|
||||
@Excel(name = "所属文件夹", width = 15)
|
||||
@ApiModelProperty(value = "所属文件夹")
|
||||
private java.lang.String supFolder;
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.jero.modules.extRepo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @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 java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.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 java.lang.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 java.lang.String sysOrgCode;
|
||||
|
||||
/**文件夹名称*/
|
||||
@Excel(name = "文件夹名称", width = 15)
|
||||
@ApiModelProperty(value = "文件夹名称")
|
||||
private java.lang.String folderName;
|
||||
|
||||
/**文件夹排序*/
|
||||
@Excel(name = "文件夹排序", width = 15)
|
||||
@ApiModelProperty(value = "文件夹排序")
|
||||
private java.lang.Integer orderId;
|
||||
|
||||
/**所属文件夹*/
|
||||
@Excel(name = "所属文件夹", width = 15)
|
||||
@ApiModelProperty(value = "所属文件夹")
|
||||
private java.lang.String supFolder;
|
||||
|
||||
/**查看权限人员*/
|
||||
@Excel(name = "查看权限人员", width = 15)
|
||||
@ApiModelProperty(value = "查看权限人员")
|
||||
private java.lang.String authView;
|
||||
|
||||
/**管理权限人员*/
|
||||
@Excel(name = "管理权限人员", width = 15)
|
||||
@ApiModelProperty(value = "管理权限人员")
|
||||
private java.lang.String authManage;
|
||||
|
||||
public List<String> getAuthManageList(){
|
||||
return Arrays.asList(authManage.split(","));
|
||||
}
|
||||
|
||||
public List<String> getAuthViewList(){
|
||||
return Arrays.asList(authView.split(","));
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -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> {
|
||||
|
||||
}
|
||||
+14
@@ -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> {
|
||||
|
||||
}
|
||||
+16
@@ -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>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?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" property="authView" />
|
||||
<result column="auth_manage" property="authManage" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
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
|
||||
*/
|
||||
void 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();
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
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 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);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ExtRepoFolder queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoFolder> queryList();
|
||||
|
||||
/**
|
||||
* 查询返回树结构
|
||||
* @return
|
||||
*/
|
||||
List<ERFTreeData> queryTreeList();
|
||||
|
||||
|
||||
/**
|
||||
* 是否有管理权限
|
||||
* @param folderId
|
||||
* @return
|
||||
*/
|
||||
boolean haveManageAuth(String folderId);
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package com.jero.modules.extRepo.service.impl;
|
||||
|
||||
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 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 {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(ExtRepoData extRepoData) {
|
||||
Date now = new Date();
|
||||
extRepoData.setCreateTime(now);
|
||||
extRepoData.setUpdateTime(now);
|
||||
save(extRepoData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(ExtRepoData extRepoData) {
|
||||
Date now = new Date();
|
||||
extRepoData.setUpdateTime(now);
|
||||
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();
|
||||
}
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
package com.jero.modules.extRepo.service.impl;
|
||||
|
||||
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.mapper.ExtRepoFolderMapper;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, ExtRepoFolder> implements IExtRepoFolderService {
|
||||
|
||||
/**
|
||||
* 一级文件夹的supFolder统一存root
|
||||
*/
|
||||
private static String superFolder = "root";
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(ExtRepoFolder extRepoFolder) {
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//创建文件夹的时候把创建人加入管理权限
|
||||
extRepoFolder.setAuthManage(extRepoFolder.getAuthManage() + "," + sysUser.getUsername());
|
||||
if (StringUtils.isEmpty(extRepoFolder.getSupFolder())) {
|
||||
//一级文件夹的supFolder统一存root,方便以后查找
|
||||
extRepoFolder.setSupFolder(superFolder);
|
||||
}
|
||||
Date now = new Date();
|
||||
extRepoFolder.setCreateTime(now);
|
||||
extRepoFolder.setUpdateTime(now);
|
||||
save(extRepoFolder);
|
||||
editOrderId(extRepoFolder);
|
||||
} catch (Exception ex) {
|
||||
log.error("添加对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("添加文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同级文件夹,修改顺序号
|
||||
*
|
||||
* @param extRepoFolder
|
||||
*/
|
||||
private void editOrderId(ExtRepoFolder extRepoFolder) throws Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<ExtRepoFolder> getListBySupFolder(String supFolder){
|
||||
ExtRepoFolder erf = new ExtRepoFolder();
|
||||
erf.setSupFolder(supFolder);
|
||||
QueryWrapper<ExtRepoFolder> queryWrapper = QueryGenerator.initQueryWrapper(erf, new HashMap<>());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@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) throws Exception {
|
||||
List<String> authManage_orig = erf_orig.getAuthManageList();
|
||||
List<String> authManage_new = erf_new.getAuthManageList();
|
||||
//增加管理权限的人
|
||||
List<String> addManageRole = getDefList(authManage_new, authManage_orig);
|
||||
//删除管理权限的人
|
||||
List<String> delManageRole = getDefList(authManage_orig, authManage_new);
|
||||
|
||||
List<String> authView_orig = erf_orig.getAuthViewList();
|
||||
List<String> authView_new = erf_new.getAuthViewList();
|
||||
//增加查看权限的人
|
||||
List<String> addViewRole = getDefList(authView_new, authView_orig);
|
||||
//删除查看权限的人
|
||||
List<String> delViewRole = getDefList(authView_orig, authView_new);
|
||||
|
||||
List<ExtRepoFolder> allSubFolder = getAllSubFolder(erf_orig.getId());
|
||||
//存储变化的对象
|
||||
List<ExtRepoFolder> updateFolder = new ArrayList<ExtRepoFolder>();
|
||||
for (ExtRepoFolder erf : allSubFolder) {
|
||||
boolean isChange = false;
|
||||
List<String> authManage_erf = erf.getAuthManageList();
|
||||
List<String> authView_erf = erf.getAuthViewList();
|
||||
for (String add : addManageRole) {
|
||||
if (!authManage_erf.contains(add)) {
|
||||
authManage_erf.add(add);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
for (String del : delManageRole) {
|
||||
if (authManage_erf.contains(del)) {
|
||||
authManage_erf.remove(del);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
for (String add : addViewRole) {
|
||||
if (!authView_erf.contains(add)) {
|
||||
authView_erf.add(add);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
for (String del : delViewRole) {
|
||||
if (authView_erf.contains(del)) {
|
||||
authView_erf.remove(del);
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
erf.setAuthManage(StringUtils.join(authManage_erf, ","));
|
||||
erf.setAuthView(StringUtils.join(authView_erf, ","));
|
||||
if (isChange) {
|
||||
updateFolder.add(erf);
|
||||
}
|
||||
}
|
||||
if (updateFolder.size() > 0) {
|
||||
updateBatchById(updateFolder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到列表新增元素集合
|
||||
*
|
||||
* @param listA
|
||||
* @param listB
|
||||
* @return
|
||||
*/
|
||||
private List<String> getDefList(List<String> listA, List<String> listB) {
|
||||
List<String> res = new ArrayList<String>();
|
||||
for (String s : listA) {
|
||||
if (StringUtils.isNotBlank(s) && !listB.contains(s)) {
|
||||
res.add(s);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<ExtRepoFolder> getAllSubFolder(String folderId) {
|
||||
List<ExtRepoFolder> resList = getListBySupFolder(folderId);
|
||||
List<ExtRepoFolder> subList = new ArrayList<ExtRepoFolder>();
|
||||
for (ExtRepoFolder erf : resList) {
|
||||
subList.addAll(getAllSubFolder(erf.getId()));
|
||||
}
|
||||
resList.addAll(subList);
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
try {
|
||||
List<ExtRepoFolder> resList = getListBySupFolder(id);
|
||||
if (resList.isEmpty()) {
|
||||
removeById(id);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("删除对外报告文件夹失败:" + ex.getMessage());
|
||||
throw new JeroBootException("删除文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ExtRepoFolder queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ExtRepoFolder> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@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("查询文件夹失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找子文件夹,生成树结构
|
||||
*
|
||||
* @param supId
|
||||
* @param list
|
||||
* @param level 前端需要知道当前文件夹在哪一层
|
||||
* @return
|
||||
*/
|
||||
private List<ERFTreeData> getSubFolder(String supId, List<ExtRepoFolder> list, int level) throws Exception {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<ERFTreeData> resList = new ArrayList<ERFTreeData>();
|
||||
for (ExtRepoFolder erf : list) {
|
||||
if (supId.equals(erf.getSupFolder())) {
|
||||
ERFTreeData date = new ERFTreeData(erf.getFolderName(), erf.getId(), level, erf.getOrderId());
|
||||
//检查有没有权限查看
|
||||
date.setDisplay(erf.getAuthManageList().contains(sysUser.getUsername()) || erf.getAuthViewList().contains(sysUser.getUsername()));
|
||||
int childLevel = date.getLevel() + 1;
|
||||
date.setChildren(getSubFolder(erf.getId(), list, childLevel));
|
||||
date.sortChildren();
|
||||
resList.add(date);
|
||||
}
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有管理权限
|
||||
* @param folderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean haveManageAuth(String folderId) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
ExtRepoFolder erf = queryById(folderId);
|
||||
return erf.getAuthManageList().contains(sysUser.getUsername());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user