reformat code

This commit is contained in:
chenxudong 2025-04-15 17:44:00 +08:00
parent 56a49fb271
commit 98d8b621b3
5 changed files with 19 additions and 25 deletions

View File

@ -1,7 +1,6 @@
package com.electromagnetic.industry.software.manage.pojo.models;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.mymonstercat.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

View File

@ -11,7 +11,7 @@ import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("user_access_log")
public class UserAccessLog extends BaseModel{
public class UserAccessLog extends BaseModel {
private String id;

View File

@ -528,9 +528,12 @@ public class CommonService {
DataOwnEnum obj = DataOwnEnum.getEnumByCode(dataOwnCode);
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 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<>());
case USER_FILE, USER_PRJ ->
prjInfo = queryUserPrjTree(PrjQuerySource.USER_DB.value, new FileProjectVO()).getOrDefault(PrjQuerySource.USER_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", "参数错误");
}

View File

@ -64,26 +64,20 @@ import static com.electromagnetic.industry.software.common.enums.FileRepeatEnum.
@Service
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);
@Resource
private CommonService commonService;
@Resource
private FileSystemService fileSystemService;
@Resource
private PermissionService permissionService;
@Resource
private UserMapper userMapper;
@Resource
private ElePropertyConfig elePropertyConfig;
@Resource
private EdFileFavoriteService fileFavoriteService;
@Resource
private FileTagRelationService fileTagRelationService;
@Resource
@ -93,8 +87,6 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
@Resource
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) {
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);
}
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()))
.toList();
@ -830,14 +822,14 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
}
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<FileTagRelation> fileTagRelations = fileTagRelationMapper.selectList(Wrappers.lambdaQuery(FileTagRelation.class).in(FileTagRelation::getFileId, accessibleFileIds));
exportInfoMap.put(ED_TAG_RELATIONS, fileTagRelations);
}
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<EdFileRelation> edFileRelations = edFileRelationMapper.selectList(Wrappers.lambdaQuery(EdFileRelation.class).in(EdFileRelation::getId1, accessibleFileIds)
.or()
@ -846,7 +838,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
}
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<EdFileFavorite> edFileFavorites = edFileFavoriteMapper.selectList(Wrappers.lambdaQuery(EdFileFavorite.class).in(EdFileFavorite::getFileId, accessibleFileIds));
exportInfoMap.put(ED_FILE_FAVORITE, edFileFavorites);

View File

@ -153,11 +153,11 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
.eq(EdFileInfo::getId, prjId));
String oldPrjName = fileInfo.getFileName();
try {
Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {}{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName));
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
.eq(EdFileInfo::getFileName, newPrjName));
Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {}{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName));
if (count > 0) {
String info = StrFormatter.format("{} 项目已经存在,{} 修改失败。", newPrjName, oldPrjName);
log.info(info);