bug59974
This commit is contained in:
+15
-7
@@ -13,10 +13,12 @@ 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;
|
||||
|
||||
|
||||
@@ -47,7 +49,7 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
||||
@GetMapping(value = "/list")
|
||||
public Result<ERFTreeDataVO> queryList() {
|
||||
ERFTreeDataVO dataVO = new ERFTreeDataVO();
|
||||
dataVO.setManager(extRepoFolderService.isManager());
|
||||
dataVO.setManager(true);
|
||||
dataVO.setList(extRepoFolderService.queryTreeList());
|
||||
return Result.OK(dataVO);
|
||||
}
|
||||
@@ -61,9 +63,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
||||
@AutoLog(value = "对外报告文件夹表-添加")
|
||||
@ApiOperation(value = "对外报告文件夹表-添加", notes = "对外报告文件夹表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
if (extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
if (!extRepoFolder.isAddSub()) {
|
||||
//增加同级文件夹
|
||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
|
||||
@@ -94,9 +98,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
||||
@AutoLog(value = "对外报告文件夹表-编辑")
|
||||
@ApiOperation(value = "对外报告文件夹表-编辑", notes = "对外报告文件夹表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
if (extRepoFolderService.haveManageAuth(extRepoFolder.getId())) {
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoFolderService.editById(extRepoFolder);
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.success("编辑成功!");
|
||||
@@ -123,9 +129,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
||||
@ApiOperation(value = "对外报告文件夹表-通过id删除", notes = "对外报告文件夹表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
if (extRepoFolderService.haveManageAuth(id)) {
|
||||
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);
|
||||
|
||||
+10
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -91,4 +92,13 @@ public interface IExtRepoFolderService extends IService<ExtRepoFolder> {
|
||||
* @return
|
||||
*/
|
||||
List<ExtRepoFolder> getListBySupFolder(String supFolder);
|
||||
|
||||
/**
|
||||
* 判断上级是否有权限
|
||||
* @param supFolder
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
void haveSuperiorManageAuth(String supFolder, HttpSession session);
|
||||
|
||||
}
|
||||
|
||||
+45
-1
@@ -14,10 +14,12 @@ 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.lang.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;
|
||||
|
||||
@@ -246,7 +248,7 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
||||
date.setAuthManageIds(erf.getAuthManageIds());
|
||||
date.setAuthViewIdsName(erf.getAuthViewIdsName());
|
||||
date.setAuthViewIds(erf.getAuthViewIds());
|
||||
date.setChildren(getSubFolder(erf.getId(), list, childLevel));
|
||||
date.setChildren(subFolderTree(erf.getId(),new ArrayList<ERFTreeData>(),childLevel));
|
||||
date.sortChildren();
|
||||
resList.add(date);
|
||||
} else {
|
||||
@@ -257,6 +259,28 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 父文件夹有权限则获取其下全部子文件夹
|
||||
* @param folder
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
private List<ERFTreeData> subFolderTree(String folder,List<ERFTreeData> childTree,int level) {
|
||||
int childLevel = level + 1;
|
||||
List<ExtRepoFolder> listBySupFolder = getListBySupFolder(folder);
|
||||
for (ExtRepoFolder extRepoFolder : listBySupFolder) {
|
||||
ERFTreeData date = new ERFTreeData(extRepoFolder.getFolderName(), extRepoFolder.getId(), childLevel, extRepoFolder.getOrderId());
|
||||
date.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
|
||||
date.setAuthManageIds(extRepoFolder.getAuthManageIds());
|
||||
date.setAuthViewIdsName(extRepoFolder.getAuthViewIdsName());
|
||||
date.setAuthViewIds(extRepoFolder.getAuthViewIds());
|
||||
date.setChildren(subFolderTree(extRepoFolder.getId(), new ArrayList<ERFTreeData>(),childLevel));
|
||||
date.sortChildren();
|
||||
childTree.add(date);
|
||||
}
|
||||
return childTree;
|
||||
}
|
||||
|
||||
private List<String> getStringList(String listStr) {
|
||||
List<String> res = new ArrayList<>();
|
||||
if (null != listStr) {
|
||||
@@ -324,4 +348,24 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断上级是否有权限
|
||||
* @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