调通了层级树查询。
This commit is contained in:
parent
f51f76fa6d
commit
53f61ba8f8
|
|
@ -4,6 +4,7 @@ import com.electromagnetic.industry.software.common.annotations.RequiredPermissi
|
|||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
|
|
@ -12,7 +13,6 @@ import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
|||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileFavoriteService;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
|
@ -29,13 +29,11 @@ public class EdFileInfoController {
|
|||
|
||||
@Resource
|
||||
private EdFileInfoService edFileInfoService;
|
||||
@Resource
|
||||
private EdFileFavoriteService edFileFavoriteService;
|
||||
|
||||
@UserOperation(value = "查看工程树", modelName = UserOperationModuleEnum.DATABASE)
|
||||
@RequestMapping("tree")
|
||||
public ElectromagneticResult<?> tree() {
|
||||
return edFileInfoService.tree(DataOwnEnum.SYS_PRJ.code);
|
||||
return edFileInfoService.tree(PrjQuerySource.PRJ_INTERFACE.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.DATABASE)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.electromagnetic.industry.software.manage.controller;
|
|||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
|
|
@ -48,7 +49,7 @@ public class ProjectController {
|
|||
@UserOperation(value = "查询所有层级", modelName = UserOperationModuleEnum.PRJ_SETTING)
|
||||
@RequestMapping("queryAll")
|
||||
public ElectromagneticResult<?> queryAll() {
|
||||
return edPrjService.queryAllPrjInfo(DataOwnEnum.SYS_PRJ.code);
|
||||
return edPrjService.queryAllPrjInfo(PrjQuerySource.PRJ_INTERFACE.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "添加子集", modelName = UserOperationModuleEnum.PRJ_SETTING)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.electromagnetic.industry.software.manage.controller;
|
|||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
|
|
@ -33,7 +34,7 @@ public class UserEdFileInfoController {
|
|||
@UserOperation(value = "查看工程树", modelName =UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("tree")
|
||||
public ElectromagneticResult<?> tree() {
|
||||
return edFileInfoService.tree(DataOwnEnum.USER_FILE.code);
|
||||
return edFileInfoService.tree(PrjQuerySource.USER_INTERFACE.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "创建文件夹", modelName =UserOperationModuleEnum.USER_PRJ)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.electromagnetic.industry.software.manage.controller;
|
|||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||
|
|
@ -43,7 +44,7 @@ public class UserPrjController {
|
|||
@UserOperation(value = "查询所有层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("queryAll")
|
||||
public ElectromagneticResult<?> queryAll() {
|
||||
return edPrjService.queryAllPrjInfo(DataOwnEnum.USER_PRJ.code);
|
||||
return edPrjService.queryAllPrjInfo(PrjQuerySource.USER_INTERFACE.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "添加子集", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public interface EdFileInfoService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> tree(int dataOwnCode);
|
||||
ElectromagneticResult<?> tree(int querySource);
|
||||
|
||||
/**
|
||||
* 删除目录
|
||||
|
|
|
|||
|
|
@ -204,42 +204,95 @@ public class CommonService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<String> queryAllPrjInfo(List<String> prjIds, int dataOwnCode) {
|
||||
|
||||
public Map<Integer, List<String>> querySysPrjTree(int querySource, List<String> accessibleIds, Object obj) {
|
||||
Map<Integer, List<String>> map = new HashMap<>();
|
||||
try {
|
||||
// 首先查出所有的工程id
|
||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo::getId)
|
||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
||||
|
||||
if (dataOwnCode == DataOwnEnum.SYS_FILE.code) {
|
||||
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
||||
} else if (dataOwnCode == DataOwnEnum.USER_FILE.code) {
|
||||
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
||||
queryWrapper.eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId());
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID);
|
||||
// 如果不是数据库界面查询,此处需要进行权限筛选
|
||||
if (querySource == PrjQuerySource.USER_INTERFACE.value) {
|
||||
queryWrapper.in(EdFileInfo::getId, accessibleIds);
|
||||
}
|
||||
List<String> prjIds = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
|
||||
if (DataOwnEnum.isPrjCode(dataOwnCode)) {
|
||||
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code);
|
||||
if (CollUtil.isNotEmpty(prjIds)) {
|
||||
queryWrapper.in(EdFileInfo::getId, prjIds);
|
||||
}
|
||||
}
|
||||
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
List<String> projectVOS = new ArrayList<>();
|
||||
for (String id : prjIds) {
|
||||
LambdaQueryWrapper<EdFileInfo> prjQueryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
||||
.likeRight(EdFileInfo::getFilePath, id);
|
||||
|
||||
for (String id : ids) {
|
||||
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id, prjIds, dataOwnCode);
|
||||
if (DataOwnEnum.isPrjCode(dataOwnCode)) {
|
||||
edFileInfos = edFileInfos.stream().filter(e -> e.getDataStatus().equals(EleDataStatusEnum.PUBLISHED.code)
|
||||
|| e.getDataStatus().equals(EleDataStatusEnum.DELETED.code))
|
||||
.collect(Collectors.toList());
|
||||
if (querySource == PrjQuerySource.USER_INTERFACE.value) {
|
||||
prjQueryWrapper.and(qr -> qr.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.or()
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code));
|
||||
prjQueryWrapper.in(EdFileInfo::getId, accessibleIds);
|
||||
} else {
|
||||
edFileInfos = edFileInfos.stream().filter(e -> !e.getDataStatus().equals(EleDataStatusEnum.DELETED.code)).collect(Collectors.toList());
|
||||
prjQueryWrapper.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code);
|
||||
}
|
||||
// 转换为树
|
||||
if (DataOwnEnum.isPrjCode(dataOwnCode)) {
|
||||
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(prjQueryWrapper);
|
||||
String jsonTree = createTree(edFileInfos, obj);
|
||||
List<String> list = map.getOrDefault(querySource, new ArrayList<>());
|
||||
list.add(jsonTree);
|
||||
map.put(querySource, list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String info = "查询系统层级信息失败";
|
||||
log.error(info, e);
|
||||
throw new BizException(info);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<Integer, List<String>> queryUserPrjTree(int querySource, Object object) {
|
||||
|
||||
Map<Integer, List<String>> map = new HashMap<>();
|
||||
try {
|
||||
// 首先查出所有的工程id
|
||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo::getId)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId())
|
||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID);
|
||||
List<String> prjIds = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
|
||||
for (String id : prjIds) {
|
||||
LambdaQueryWrapper<EdFileInfo> prjQueryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
||||
.likeRight(EdFileInfo::getFilePath, id);
|
||||
|
||||
if (querySource == PrjQuerySource.USER_INTERFACE.value) {
|
||||
prjQueryWrapper.and(qr -> qr.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.or()
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code));
|
||||
} else {
|
||||
prjQueryWrapper.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code);
|
||||
}
|
||||
|
||||
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(prjQueryWrapper);
|
||||
String jsonTree = createTree(edFileInfos, object);
|
||||
List<String> list = map.getOrDefault(querySource, new ArrayList<>());
|
||||
list.add(jsonTree);
|
||||
map.put(querySource, list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String info = "查询用户层级信息失败";
|
||||
log.error(info, e);
|
||||
throw new BizException(info);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static String createTree(List<EdFileInfo> edFileInfos, Object object) {
|
||||
|
||||
TreeNodeConfig config = new TreeNodeConfig();
|
||||
if (object instanceof ProjectVO) {
|
||||
// 转换为树
|
||||
config.setIdKey(EdFileInfo.Fields.id);
|
||||
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
||||
config.setWeightKey(EdFileInfo.Fields.sort);
|
||||
|
|
@ -251,32 +304,24 @@ public class CommonService {
|
|||
treeNode.putExtra(ProjectVO.Fields.title, obj.getFileName());
|
||||
treeNode.putExtra(ProjectVO.Fields.dataStatus, obj.getDataStatus());
|
||||
}));
|
||||
String jsonStr = JSONUtil.toJsonStr(trees);
|
||||
projectVOS.add(jsonStr);
|
||||
} else {
|
||||
TreeNodeConfig config = new TreeNodeConfig();
|
||||
return JSONUtil.toJsonStr(trees);
|
||||
}
|
||||
|
||||
config.setIdKey(FileProjectVO.Fields.categoryId);
|
||||
config.setParentIdKey(FileProjectVO.Fields.parentId);
|
||||
config.setWeightKey(FileProjectVO.Fields.sort);
|
||||
List<Tree<String>> trees = TreeUtil.build(edFileInfos, PRJ_PARENT_ID, config, ((obj, treeNode) -> {
|
||||
List<Tree<String>> fileTrees = TreeUtil.build(edFileInfos, PRJ_PARENT_ID, config, ((obj, treeNode) -> {
|
||||
treeNode.putExtra(FileProjectVO.Fields.categoryId, obj.getId());
|
||||
treeNode.putExtra(FileProjectVO.Fields.parentId, obj.getParentId());
|
||||
treeNode.putExtra(FileProjectVO.Fields.sort, obj.getSort());
|
||||
treeNode.putExtra(FileProjectVO.Fields.categoryName, obj.getFileName());
|
||||
treeNode.putExtra(FileProjectVO.Fields.dataStatus, obj.getDataStatus());
|
||||
}));
|
||||
String jsonStr = JSONUtil.toJsonStr(trees);
|
||||
projectVOS.add(jsonStr);
|
||||
}
|
||||
}
|
||||
return projectVOS;
|
||||
} catch (Exception e) {
|
||||
String info = "查询项目失败";
|
||||
log.error(info, e);
|
||||
throw new BizException(info);
|
||||
}
|
||||
return JSONUtil.toJsonStr(fileTrees);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ElectromagneticResult<?> deleteFolder(String id, int dataOwnCode) {
|
||||
// 如果文件夹下存在文件(包括文件夹和已经逻辑删除的文件),则不允许删除。后面管理员选择会有物理删除文件夹和文件的功能,此时MySQL和文件系统则会进行物理删除该文件。
|
||||
EdFileInfo srcFileInfo = edFileInfoMapper.selectById(id);
|
||||
|
|
@ -300,12 +345,12 @@ public class CommonService {
|
|||
edFileInfoMapper.update(new EdFileInfo(), Wrappers.<EdFileInfo>lambdaUpdate()
|
||||
.like(EdFileInfo::getFilePath, id)
|
||||
.set(EdFileInfo::getSort, -1)
|
||||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code));
|
||||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code));
|
||||
// 层级文件夹重排序
|
||||
List<EdFileInfo> edFileInfos1 = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo::getId, EdFileInfo::getSort)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||
.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.eq(EdFileInfo::getParentId, parentId)
|
||||
.orderByAsc(EdFileInfo::getSort));
|
||||
|
||||
|
|
@ -361,18 +406,21 @@ public class CommonService {
|
|||
}
|
||||
|
||||
public Set<String> selectPrjLeafs(int dataOwnCode) {
|
||||
List<String> prjInfo = queryAllPrjInfo( null, dataOwnCode);
|
||||
|
||||
List<String> prjInfo = (dataOwnCode == DataOwnEnum.SYS_FILE.code) ?
|
||||
querySysPrjTree(PrjQuerySource.USER_INTERFACE.value, null, new FileProjectVO()).get(PrjQuerySource.USER_INTERFACE.value):
|
||||
queryUserPrjTree(PrjQuerySource.USER_INTERFACE.value, new FileProjectVO()).get(PrjQuerySource.USER_INTERFACE.value);
|
||||
Set<String> res = new HashSet<>();
|
||||
prjInfo.forEach(e -> {
|
||||
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
||||
Set<String> leafIds = getLeafNodes(projectVO).stream().map(ProjectVO::getId).collect(Collectors.toSet());
|
||||
FileProjectVO projectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
||||
Set<String> leafIds = getLeafNodes(projectVO).stream().map(FileProjectVO::getCategoryId).collect(Collectors.toSet());
|
||||
res.addAll(leafIds);
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
private static List<ProjectVO> getLeafNodes(ProjectVO root) {
|
||||
List<ProjectVO> leafNodes = new ArrayList<>();
|
||||
private static List<FileProjectVO> getLeafNodes(FileProjectVO root) {
|
||||
List<FileProjectVO> leafNodes = new ArrayList<>();
|
||||
if (root == null) {
|
||||
return leafNodes;
|
||||
}
|
||||
|
|
@ -380,11 +428,11 @@ public class CommonService {
|
|||
return leafNodes;
|
||||
}
|
||||
|
||||
private static void findLeafNodes(ProjectVO node, List<ProjectVO> leafNodes) {
|
||||
private static void findLeafNodes(FileProjectVO node, List<FileProjectVO> leafNodes) {
|
||||
if (node.getChildren().isEmpty()) {
|
||||
leafNodes.add(node);
|
||||
} else {
|
||||
for (ProjectVO child : node.getChildren()) {
|
||||
for (FileProjectVO child : node.getChildren()) {
|
||||
findLeafNodes(child, leafNodes);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
|
||||
.eq(ObjUtil.equals(pars.getDataStatus(), EleDataStatusEnum.NOT_PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||
.eq(ObjUtil.equals(pars.getDataStatus(), EleDataStatusEnum.PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||
.eq(ObjUtil.equals(pars.getDataStatus(), EleDataStatusEnum.OCCUPY.code), EdFileInfo::getDataStatus, EleDataStatusEnum.OCCUPY.code)
|
||||
// .eq(ObjUtil.equals(pars.getDataStatus(), EleDataStatusEnum.OCCUPY.code), EdFileInfo::getDataStatus, EleDataStatusEnum.OCCUPY.code)
|
||||
|
||||
.eq(StrUtil.isNotEmpty(pars.getFileType()), EdFileInfo::getFileType, pars.getFileType())
|
||||
.orderByAsc(ObjUtil.equals(pars.getCreatedTime(), 0), EdFileInfo::getCreatedTime)
|
||||
|
|
@ -185,24 +185,31 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ElectromagneticResult<?> tree(int dataOwnCode) {
|
||||
public ElectromagneticResult<?> tree(int querySource) {
|
||||
|
||||
List<String> prjIds;
|
||||
List<String> accessibleIds;
|
||||
|
||||
if (dataOwnCode != DataOwnEnum.USER_FILE.code) {
|
||||
prjIds = permissionService.getAccessibleTree();
|
||||
if (CollUtil.isEmpty(prjIds) && dataOwnCode != DataOwnEnum.USER_FILE.code ) {
|
||||
if (querySource == PrjQuerySource.PRJ_INTERFACE.value) {
|
||||
accessibleIds = permissionService.getAccessibleTree();
|
||||
if (CollUtil.isEmpty(accessibleIds)) {
|
||||
return ElectromagneticResultUtil.success(new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
prjIds = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
accessibleIds = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code)
|
||||
.eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId())
|
||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<String> strings = commonService.queryAllPrjInfo(prjIds, dataOwnCode);
|
||||
Map<Integer, List<String>> map = (querySource == PrjQuerySource.PRJ_INTERFACE.value) ?
|
||||
commonService.querySysPrjTree(querySource, accessibleIds, new FileProjectVO()) :
|
||||
commonService.queryUserPrjTree(querySource, new FileProjectVO());
|
||||
log.info("#################################################");
|
||||
log.info("map is {}", JSONUtil.toJsonStr(map));
|
||||
log.info("accessible ids is {}", accessibleIds);
|
||||
log.info("#################################################");
|
||||
List<String> strings = map.getOrDefault(querySource, new ArrayList<>());
|
||||
List<FileProjectVO> res = new ArrayList<>();
|
||||
strings.forEach(e -> {
|
||||
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
||||
|
|
@ -211,6 +218,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
res.sort(Comparator.comparing(FileProjectVO::getSort));
|
||||
UserThreadLocal.setSuccessInfo("", "", "查询项目层级结构成功");
|
||||
return ElectromagneticResultUtil.success(res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -229,8 +229,13 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ElectromagneticResult<?> queryAllPrjInfo(int dataOwnCode) {
|
||||
List<String> res = commonService.queryAllPrjInfo(null, dataOwnCode);
|
||||
public ElectromagneticResult<?> queryAllPrjInfo(int querySource) {
|
||||
|
||||
Map<Integer, List<String>> map = (querySource == PrjQuerySource.PRJ_INTERFACE.value) ?
|
||||
commonService.querySysPrjTree(querySource, null, new ProjectVO()) :
|
||||
commonService.queryUserPrjTree(querySource, new ProjectVO());
|
||||
|
||||
List<String> res = map.getOrDefault(querySource, new ArrayList<>());
|
||||
List<ProjectVO> projectVOS = new ArrayList<>();
|
||||
res.forEach(e -> {
|
||||
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
||||
|
|
@ -282,7 +287,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
// 将已经处于删除状态设置成逻辑删除
|
||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo::getId, EdFileInfo::getFilePath)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||
List<String> paths = this.baseMapper.selectList(queryWrapper).stream().map(EdFileInfo::getFilePath).collect(Collectors.toList());
|
||||
List<String> fileSysPaths = new ArrayList<>();
|
||||
|
|
@ -292,7 +297,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
});
|
||||
|
||||
this.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId));
|
||||
// 其余置为发布状态
|
||||
|
|
@ -462,7 +467,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
.and(qr -> qr
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||
.or()
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)));
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)));
|
||||
Set<String> unpublishFiles = new HashSet<>();
|
||||
for (EdFileInfo edFileInfo : edFileInfos) {
|
||||
String filePath = edFileInfo.getFilePath();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.electromagnetic.industry.software.common.enums.*;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
|
|
@ -189,7 +188,7 @@ public class PermissionServiceImpl implements PermissionService {
|
|||
|
||||
// 获取当前项目所有已逻辑删除的节点,删除其权限
|
||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||
List<String> deletedIds = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.electromagnetic.industry.software.common.enums.*;
|
||||
import com.electromagnetic.industry.software.common.util.EleLog;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
|
||||
|
|
@ -376,7 +375,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|||
.eq(EdFileInfo::getDataOwn, dataOwnCode)
|
||||
.and(wrapper -> wrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||
.or()
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)));
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.WAIT_DELETED.code)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ public enum DataOwnEnum {
|
|||
REPO_FILE(3, "库文件"),
|
||||
REPO_PRJ(5, "库工程");
|
||||
|
||||
public int code;
|
||||
public String desc;
|
||||
public final int code;
|
||||
public final String desc;
|
||||
|
||||
|
||||
public static boolean isPrjCode(int code) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public enum EleDataStatusEnum {
|
|||
NOT_PUBLISHED(0, "未发布"),
|
||||
PUBLISHED(1, "已发布"),
|
||||
OCCUPY(2, "占用"),
|
||||
DELETED(3, "待删除");
|
||||
WAIT_DELETED(3, "待删除");
|
||||
|
||||
public final int code;
|
||||
public final String desc;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.electromagnetic.industry.software.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum PrjQuerySource {
|
||||
|
||||
PRJ_INTERFACE(0),
|
||||
USER_INTERFACE(1);
|
||||
|
||||
public final int value;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue