暂时存放
This commit is contained in:
parent
60269d0409
commit
e506ef262a
|
|
@ -139,17 +139,19 @@ public class CommonService {
|
||||||
return parentId + FILE_TYPE_ENUM.getOrDefault(fileType, "00") + version + timeStr;
|
return parentId + FILE_TYPE_ENUM.getOrDefault(fileType, "00") + version + timeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EdFileInfo> selectAllAdminFolder(String id, boolean isAdminQuery, List<String> accessableIds) {
|
public List<EdFileInfo> selectAllAdminFolder(String id, List<String> accessibleIds, int dataOwnCode) {
|
||||||
|
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
||||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code)
|
.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code)
|
||||||
.likeRight(EdFileInfo::getFilePath, id);
|
.likeRight(EdFileInfo::getFilePath, id);
|
||||||
if (!isAdminQuery) {
|
if (dataOwnCode == DataOwnEnum.COMMON.code) {
|
||||||
queryWrapper.in(EdFileInfo::getId, accessableIds);
|
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
||||||
|
queryWrapper.in(EdFileInfo::getId, accessibleIds);
|
||||||
|
} else {
|
||||||
|
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return edFileInfoMapper.selectList(queryWrapper);
|
return edFileInfoMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,24 +221,29 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> queryAllPrjInfo(boolean isAdminQuery, List<String> prjIds, int dataOwnCode) {
|
public List<String> queryAllPrjInfo(List<String> prjIds, int dataOwnCode) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId)
|
.select(EdFileInfo::getId)
|
||||||
.eq(EdFileInfo::getDataOwn, dataOwnCode)
|
|
||||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
||||||
if (!isAdminQuery) {
|
|
||||||
|
if (dataOwnCode == DataOwnEnum.COMMON.code) {
|
||||||
|
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
||||||
|
} else if (dataOwnCode == DataOwnEnum.USER_FILE.code) {
|
||||||
|
queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataOwnCode == DataOwnEnum.SYS_PRJ.code || dataOwnCode == DataOwnEnum.USER_PRJ.code) {
|
||||||
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code).in(EdFileInfo::getId, prjIds);
|
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code).in(EdFileInfo::getId, prjIds);
|
||||||
}
|
}
|
||||||
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<String> projectVOS = new ArrayList<>();
|
List<String> projectVOS = new ArrayList<>();
|
||||||
|
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id, isAdminQuery, prjIds);
|
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id, prjIds, dataOwnCode);
|
||||||
if (!isAdminQuery) {
|
if (dataOwnCode == DataOwnEnum.USER_PRJ.code || dataOwnCode == DataOwnEnum.SYS_PRJ.code) {
|
||||||
edFileInfos = edFileInfos.stream().filter(e -> e.getDataStatus().equals(EleDataStatusEnum.PUBLISHED.code)
|
edFileInfos = edFileInfos.stream().filter(e -> e.getDataStatus().equals(EleDataStatusEnum.PUBLISHED.code)
|
||||||
|| e.getDataStatus().equals(EleDataStatusEnum.DELETED.code))
|
|| e.getDataStatus().equals(EleDataStatusEnum.DELETED.code))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
@ -244,7 +251,7 @@ public class CommonService {
|
||||||
edFileInfos = edFileInfos.stream().filter(e -> !e.getDataStatus().equals(EleDataStatusEnum.DELETED.code)).collect(Collectors.toList());
|
edFileInfos = edFileInfos.stream().filter(e -> !e.getDataStatus().equals(EleDataStatusEnum.DELETED.code)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
// 转换为树
|
// 转换为树
|
||||||
if (isAdminQuery) {
|
if (dataOwnCode == DataOwnEnum.USER_PRJ.code || dataOwnCode == DataOwnEnum.SYS_PRJ.code) {
|
||||||
TreeNodeConfig config = new TreeNodeConfig();
|
TreeNodeConfig config = new TreeNodeConfig();
|
||||||
config.setIdKey(EdFileInfo.Fields.id);
|
config.setIdKey(EdFileInfo.Fields.id);
|
||||||
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
||||||
|
|
@ -375,7 +382,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> selectPrjLeafs(int dataOwnCode) {
|
public Set<String> selectPrjLeafs(int dataOwnCode) {
|
||||||
List<String> prjInfo = queryAllPrjInfo(true, null, dataOwnCode);
|
List<String> prjInfo = queryAllPrjInfo( null, dataOwnCode);
|
||||||
Set<String> res = new HashSet<>();
|
Set<String> res = new HashSet<>();
|
||||||
prjInfo.forEach(e -> {
|
prjInfo.forEach(e -> {
|
||||||
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
||||||
|
|
|
||||||
|
|
@ -162,10 +162,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> tree(int dataOwnCode) {
|
public ElectromagneticResult<?> tree(int dataOwnCode) {
|
||||||
List<String> prjIds = permissionService.getAccessibleTree();
|
List<String> prjIds = permissionService.getAccessibleTree();
|
||||||
if (CollUtil.isEmpty(prjIds)) {
|
if (CollUtil.isEmpty(prjIds) && dataOwnCode != DataOwnEnum.USER_FILE.code ) {
|
||||||
return ElectromagneticResultUtil.success(new ArrayList<>());
|
return ElectromagneticResultUtil.success(new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<String> strings = commonService.queryAllPrjInfo(false, prjIds, dataOwnCode);
|
List<String> strings = commonService.queryAllPrjInfo(prjIds, dataOwnCode);
|
||||||
List<FileProjectVO> res = new ArrayList<>();
|
List<FileProjectVO> res = new ArrayList<>();
|
||||||
strings.forEach(e -> {
|
strings.forEach(e -> {
|
||||||
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> queryAllPrjInfo(int dataOwnCode) {
|
public ElectromagneticResult<?> queryAllPrjInfo(int dataOwnCode) {
|
||||||
List<String> res = commonService.queryAllPrjInfo(true, null, dataOwnCode);
|
List<String> res = commonService.queryAllPrjInfo(null, dataOwnCode);
|
||||||
List<ProjectVO> projectVOS = new ArrayList<>();
|
List<ProjectVO> projectVOS = new ArrayList<>();
|
||||||
res.forEach(e -> {
|
res.forEach(e -> {
|
||||||
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
||||||
|
|
@ -355,11 +355,11 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
// 把source工程的层级结构copy到目标工程
|
// 把source工程的层级结构copy到目标工程
|
||||||
// 查找source的全部目录
|
// 查找source的全部目录
|
||||||
List<EdFileInfo> sourceEdFileInfos = commonService.selectAllAdminFolder(sourceId, true, null);
|
List<EdFileInfo> sourceEdFileInfos = commonService.selectAllAdminFolder(sourceId, null, dataOwnCode);
|
||||||
List<String> needSavePaths = new ArrayList<>();
|
List<String> needSavePaths = new ArrayList<>();
|
||||||
// 确定层级最大为prjFolderMaxLength层,现在逐层来处理。
|
// 确定层级最大为prjFolderMaxLength层,现在逐层来处理。
|
||||||
for (int i = 1; i <= prjFolderMaxLength; ++i) {
|
for (int i = 1; i <= prjFolderMaxLength; ++i) {
|
||||||
List<EdFileInfo> targetEdFileInfos = commonService.selectAllAdminFolder(targetId, true, null);
|
List<EdFileInfo> targetEdFileInfos = commonService.selectAllAdminFolder(targetId, null, dataOwnCode);
|
||||||
// 先查找source第i层下有那些子集
|
// 先查找source第i层下有那些子集
|
||||||
final int count = i;
|
final int count = i;
|
||||||
// 取source当前层
|
// 取source当前层
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#required
|
#required
|
||||||
spring.application.name=electromagnetic-data
|
spring.application.name=electromagnetic-data
|
||||||
spring.datasource.typd=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.typd=com.alibaba.druid.pool.DruidDataSource
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/em_data_dev?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
|
spring.datasource.url=jdbc:mysql://139.196.179.195:3306/em_data_dev?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||||
spring.datasource.username=user
|
spring.datasource.username=em_user_dev
|
||||||
spring.datasource.password=123123
|
spring.datasource.password=Szsd#2O25$dev
|
||||||
|
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,22 @@
|
||||||
//import com.electromagnetic.industry.software.manage.Application;
|
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||||
//import com.electromagnetic.industry.software.manage.service.serviceimpl.EdPrjServiceImpl;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
//import org.junit.jupiter.api.Test;
|
import com.electromagnetic.industry.software.manage.Application;
|
||||||
//import org.springframework.boot.test.context.SpringBootTest;
|
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||||
//
|
import org.junit.jupiter.api.Test;
|
||||||
//import javax.annotation.Resource;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
//
|
|
||||||
//@SpringBootTest(classes = Application.class)
|
import javax.annotation.Resource;
|
||||||
//public class Test1 {
|
|
||||||
//
|
@SpringBootTest(classes = Application.class)
|
||||||
// @Resource
|
public class Test1 {
|
||||||
// private EdPrjServiceImpl edPrjService;
|
|
||||||
//
|
@Resource
|
||||||
// @Test
|
private EdFileInfoService edFileInfoService;
|
||||||
// public void testFollow() {
|
|
||||||
// String sourceId = "100101";
|
@Test
|
||||||
// String targetId = "100323";
|
public void testFollow() {
|
||||||
// edPrjService.follow(sourceId, targetId);
|
ElectromagneticResult<?> tree = edFileInfoService.tree(DataOwnEnum.USER_FILE.code);
|
||||||
// }
|
System.out.println("tree = " + tree);
|
||||||
//
|
}
|
||||||
//}
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ public class UserThreadLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUserId() {
|
public static String getUserId() {
|
||||||
return userThread.get().getUserId();
|
|
||||||
|
return "1859514019333836800";
|
||||||
|
// return userThread.get().getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAdminType() {
|
public static String getAdminType() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue