reformat code
This commit is contained in:
parent
56a49fb271
commit
98d8b621b3
|
|
@ -1,7 +1,6 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.models;
|
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.github.mymonstercat.Model;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("user_access_log")
|
@TableName("user_access_log")
|
||||||
public class UserAccessLog extends BaseModel{
|
public class UserAccessLog extends BaseModel {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -528,9 +528,12 @@ public class CommonService {
|
||||||
|
|
||||||
DataOwnEnum obj = DataOwnEnum.getEnumByCode(dataOwnCode);
|
DataOwnEnum obj = DataOwnEnum.getEnumByCode(dataOwnCode);
|
||||||
switch (Objects.requireNonNull(obj)) {
|
switch (Objects.requireNonNull(obj)) {
|
||||||
case USER_FILE, USER_PRJ -> prjInfo = queryUserPrjTree(PrjQuerySource.USER_DB.value, new FileProjectVO()).getOrDefault(PrjQuerySource.USER_DB.value, new ArrayList<>());
|
case USER_FILE, USER_PRJ ->
|
||||||
case SYS_FILE, SYS_PRJ -> prjInfo = querySysPrjTree(PrjQuerySource.SYS_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.SYS_DB.value, new ArrayList<>());
|
prjInfo = queryUserPrjTree(PrjQuerySource.USER_DB.value, new FileProjectVO()).getOrDefault(PrjQuerySource.USER_DB.value, new ArrayList<>());
|
||||||
case REPO_PRJ, REPO_FILE -> prjInfo = queryRepoPrjTree(PrjQuerySource.REPO_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.REPO_DB.value, new ArrayList<>());
|
case SYS_FILE, SYS_PRJ ->
|
||||||
|
prjInfo = querySysPrjTree(PrjQuerySource.SYS_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.SYS_DB.value, new ArrayList<>());
|
||||||
|
case REPO_PRJ, REPO_FILE ->
|
||||||
|
prjInfo = queryRepoPrjTree(PrjQuerySource.REPO_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.REPO_DB.value, new ArrayList<>());
|
||||||
default -> ElectromagneticResultUtil.fail("-1", "参数错误");
|
default -> ElectromagneticResultUtil.fail("-1", "参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,26 +64,20 @@ import static com.electromagnetic.industry.software.common.enums.FileRepeatEnum.
|
||||||
@Service
|
@Service
|
||||||
public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdFileInfoService {
|
public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdFileInfoService {
|
||||||
|
|
||||||
|
private static final Map<String, List<String>> FILE_DB_ID_NAME = new ConcurrentHashMap<>();
|
||||||
private final EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
private final EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileSystemService fileSystemService;
|
private FileSystemService fileSystemService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserMapper userMapper;
|
private UserMapper userMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ElePropertyConfig elePropertyConfig;
|
private ElePropertyConfig elePropertyConfig;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EdFileFavoriteService fileFavoriteService;
|
private EdFileFavoriteService fileFavoriteService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileTagRelationService fileTagRelationService;
|
private FileTagRelationService fileTagRelationService;
|
||||||
@Resource
|
@Resource
|
||||||
|
|
@ -93,8 +87,6 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Resource
|
@Resource
|
||||||
private EdFileFavoriteMapper edFileFavoriteMapper;
|
private EdFileFavoriteMapper edFileFavoriteMapper;
|
||||||
|
|
||||||
private static final Map<String, List<String>> FILE_DB_ID_NAME = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文件列表
|
* 查询文件列表
|
||||||
*
|
*
|
||||||
|
|
@ -510,12 +502,12 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCollectionInfo(Map<String, Object> importInfoMap) {
|
private void updateCollectionInfo(Map<String, Object> importInfoMap) {
|
||||||
List<EdFileFavorite> edFileFavorites = (List<EdFileFavorite>)importInfoMap.getOrDefault(ED_FILE_FAVORITE, new ArrayList<>());
|
List<EdFileFavorite> edFileFavorites = (List<EdFileFavorite>) importInfoMap.getOrDefault(ED_FILE_FAVORITE, new ArrayList<>());
|
||||||
edFileFavoriteMapper.insertOrUpdate(edFileFavorites);
|
edFileFavoriteMapper.insertOrUpdate(edFileFavorites);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePrjInfo(Map<String, Object> importInfoMap, String prjDirPath, Integer dataOwnCode) {
|
private void updatePrjInfo(Map<String, Object> importInfoMap, String prjDirPath, Integer dataOwnCode) {
|
||||||
List<EdFileInfo> importAllFiles = (List<EdFileInfo>)importInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
List<EdFileInfo> importAllFiles = (List<EdFileInfo>) importInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
||||||
// 找出层级文件夹
|
// 找出层级文件夹
|
||||||
List<EdFileInfo> prjFolders = importAllFiles.stream().filter(e -> DataOwnEnum.isPrjCode(e.getDataOwn()))
|
List<EdFileInfo> prjFolders = importAllFiles.stream().filter(e -> DataOwnEnum.isPrjCode(e.getDataOwn()))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
@ -697,7 +689,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update2FileSystem(Set<EdFileInfo> needMove2FileSystemFiles, String prjDirPath, int dataOwnCode) {
|
private void update2FileSystem(Set<EdFileInfo> needMove2FileSystemFiles, String prjDirPath, int dataOwnCode) {
|
||||||
Map<String, EdFileInfo> maps = needMove2FileSystemFiles.stream().collect(Collectors.toMap(EdFileInfo::getId, e -> e));
|
Map<String, EdFileInfo> maps = needMove2FileSystemFiles.stream().collect(Collectors.toMap(EdFileInfo::getId, e -> e));
|
||||||
List<EdFileInfo> files = needMove2FileSystemFiles.stream().filter(e -> e.getDataType().equals(EleDataTypeEnum.FILE.code)).toList();
|
List<EdFileInfo> files = needMove2FileSystemFiles.stream().filter(e -> e.getDataType().equals(EleDataTypeEnum.FILE.code)).toList();
|
||||||
|
|
@ -830,14 +822,14 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportFileTagInfo(Map<String, Object> exportInfoMap) {
|
private void exportFileTagInfo(Map<String, Object> exportInfoMap) {
|
||||||
List<EdFileInfo> fileInfos = (List<EdFileInfo>)exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
List<EdFileInfo> fileInfos = (List<EdFileInfo>) exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
||||||
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
||||||
List<FileTagRelation> fileTagRelations = fileTagRelationMapper.selectList(Wrappers.lambdaQuery(FileTagRelation.class).in(FileTagRelation::getFileId, accessibleFileIds));
|
List<FileTagRelation> fileTagRelations = fileTagRelationMapper.selectList(Wrappers.lambdaQuery(FileTagRelation.class).in(FileTagRelation::getFileId, accessibleFileIds));
|
||||||
exportInfoMap.put(ED_TAG_RELATIONS, fileTagRelations);
|
exportInfoMap.put(ED_TAG_RELATIONS, fileTagRelations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportFileRelationInfo(Map<String, Object> exportInfoMap) {
|
private void exportFileRelationInfo(Map<String, Object> exportInfoMap) {
|
||||||
List<EdFileInfo> fileInfos = (List<EdFileInfo>)exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
List<EdFileInfo> fileInfos = (List<EdFileInfo>) exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
||||||
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
||||||
List<EdFileRelation> edFileRelations = edFileRelationMapper.selectList(Wrappers.lambdaQuery(EdFileRelation.class).in(EdFileRelation::getId1, accessibleFileIds)
|
List<EdFileRelation> edFileRelations = edFileRelationMapper.selectList(Wrappers.lambdaQuery(EdFileRelation.class).in(EdFileRelation::getId1, accessibleFileIds)
|
||||||
.or()
|
.or()
|
||||||
|
|
@ -846,10 +838,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportCollectionInfo(Map<String, Object> exportInfoMap) {
|
private void exportCollectionInfo(Map<String, Object> exportInfoMap) {
|
||||||
List<EdFileInfo> fileInfos = (List<EdFileInfo>)exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
List<EdFileInfo> fileInfos = (List<EdFileInfo>) exportInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>());
|
||||||
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
List<String> accessibleFileIds = fileInfos.stream().map(EdFileInfo::getId).toList();
|
||||||
List<EdFileFavorite> edFileFavorites = edFileFavoriteMapper.selectList(Wrappers.lambdaQuery(EdFileFavorite.class).in(EdFileFavorite::getFileId, accessibleFileIds));
|
List<EdFileFavorite> edFileFavorites = edFileFavoriteMapper.selectList(Wrappers.lambdaQuery(EdFileFavorite.class).in(EdFileFavorite::getFileId, accessibleFileIds));
|
||||||
exportInfoMap.put(ED_FILE_FAVORITE, edFileFavorites);
|
exportInfoMap.put(ED_FILE_FAVORITE, edFileFavorites);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportPrjInfo(Map<String, Object> exportInfoMap, int dataOwnCode, String dataIdArr, String userDownloadDataDir) throws IOException {
|
private void exportPrjInfo(Map<String, Object> exportInfoMap, int dataOwnCode, String dataIdArr, String userDownloadDataDir) throws IOException {
|
||||||
|
|
@ -894,7 +886,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
exportInfoMap.put(PRJ_INFO, resFiles);
|
exportInfoMap.put(PRJ_INFO, resFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public ResponseEntity<InputStreamResource> batchExport1(String dataIdArr, HttpServletResponse response, int dataOwnCode) throws IOException {
|
// public ResponseEntity<InputStreamResource> batchExport1(String dataIdArr, HttpServletResponse response, int dataOwnCode) throws IOException {
|
||||||
// String userDownloadDataDir = elePropertyConfig.getDownloadDataDir(dataOwnCode) + File.separator + UserThreadLocal.getUserId();
|
// String userDownloadDataDir = elePropertyConfig.getDownloadDataDir(dataOwnCode) + File.separator + UserThreadLocal.getUserId();
|
||||||
|
|
|
||||||
|
|
@ -153,11 +153,11 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
.eq(EdFileInfo::getId, prjId));
|
.eq(EdFileInfo::getId, prjId));
|
||||||
String oldPrjName = fileInfo.getFileName();
|
String oldPrjName = fileInfo.getFileName();
|
||||||
try {
|
try {
|
||||||
|
Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {},{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName));
|
||||||
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getFileName, newPrjName));
|
.eq(EdFileInfo::getFileName, newPrjName));
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {},{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName));
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
String info = StrFormatter.format("{} 项目已经存在,{} 修改失败。", newPrjName, oldPrjName);
|
String info = StrFormatter.format("{} 项目已经存在,{} 修改失败。", newPrjName, oldPrjName);
|
||||||
log.info(info);
|
log.info(info);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue