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