diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/EdFileRelationService.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/EdFileRelationService.java index d1e4594..4c1c6bd 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/EdFileRelationService.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/EdFileRelationService.java @@ -1,12 +1,13 @@ package com.electromagnetic.industry.software.manage.service; +import com.baomidou.mybatisplus.extension.service.IService; import com.electromagnetic.industry.software.common.resp.ElectromagneticResult; import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation; import com.electromagnetic.industry.software.manage.pojo.req.CheckNameUniqueRequest; import com.electromagnetic.industry.software.manage.pojo.resp.FileRelationViewVO; import org.springframework.web.multipart.MultipartFile; -public interface EdFileRelationService { +public interface EdFileRelationService extends IService { /** * 创建文件关系 diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/UserAccessLogService.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/UserAccessLogService.java index 71f12d8..26977a6 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/UserAccessLogService.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/UserAccessLogService.java @@ -1,9 +1,11 @@ package com.electromagnetic.industry.software.manage.service; +import com.baomidou.mybatisplus.extension.service.IService; import com.electromagnetic.industry.software.common.resp.ElectromagneticResult; +import com.electromagnetic.industry.software.manage.pojo.models.UserAccessLog; import com.electromagnetic.industry.software.manage.pojo.req.AccessLogQueryDTO; -public interface UserAccessLogService { +public interface UserAccessLogService extends IService { /** * 分页查询操作记录(审计) diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java index 7d75e52..e322202 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java @@ -79,13 +79,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl queryEdFileInfo(FileInfoQueryDTO pars, int dataOwnCode) { - if (DataOwnEnum.isSysCode(dataOwnCode)) { String parentId = pars.getParentId(); List accessibleTree = permissionService.getAccessibleTree(); @@ -485,29 +480,40 @@ public class EdFileInfoServiceImpl extends ServiceImpl importInfoMap = JSONUtil.toBean(info, Map.class); - updatePrjInfo(importInfoMap, prjDirPath, dataOwnCode); - updateCollectionInfo(importInfoMap); - updateFileTageInfo(importInfoMap); - updateFileRelationInfo(importInfoMap); + updatePrjInfo(prjDirPath, dataOwnCode); + updateCollectionInfo(prjDirPath); + updateFileTageInfo(prjDirPath); + updateFileRelationInfo(prjDirPath); + updateUserAccessLog(prjDirPath); } - private void updateFileRelationInfo(Map importInfoMap) { - + private void updateUserAccessLog(String prjDirPath) { + String path = prjDirPath + File.separator + USER_ACCESS_LOG + ".json"; + List userAccessLogs = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), UserAccessLog.class); + userAccessLogService.saveOrUpdateBatch(userAccessLogs); } - private void updateFileTageInfo(Map importInfoMap) { - + private void updateFileRelationInfo(String prjDirPath) { + String path = prjDirPath + File.separator + ED_TAG_RELATIONS + ".json"; + List relations = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), EdFileRelation.class); + edFileRelationService.saveOrUpdateBatch(relations); } - private void updateCollectionInfo(Map importInfoMap) { - List edFileFavorites = (List) importInfoMap.getOrDefault(ED_FILE_FAVORITE, new ArrayList<>()); - edFileFavoriteMapper.insertOrUpdate(edFileFavorites); + private void updateFileTageInfo(String prjDirPath) { + String path = prjDirPath + File.separator + USER_ACCESS_LOG + ".json"; + List relations = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), FileTagRelation.class); + fileTagRelationService.saveOrUpdateBatch(relations); } - private void updatePrjInfo(Map importInfoMap, String prjDirPath, Integer dataOwnCode) { - List importAllFiles = (List) importInfoMap.getOrDefault(PRJ_INFO, new ArrayList<>()); + private void updateCollectionInfo(String prjDirPath) { + String path = prjDirPath + File.separator + ED_FILE_FAVORITE + ".json"; + List edFileFavorites = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), EdFileFavorite.class); + fileFavoriteService.saveOrUpdateBatch(edFileFavorites); + } + + private void updatePrjInfo(String prjDirPath, Integer dataOwnCode) { + String path = prjDirPath + File.separator + PRJ_INFO + ".json"; + List importAllFiles = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), EdFileInfo.class); // 找出层级文件夹 List prjFolders = importAllFiles.stream().filter(e -> DataOwnEnum.isPrjCode(e.getDataOwn())) .toList(); @@ -781,21 +787,21 @@ public class EdFileInfoServiceImpl extends ServiceImpl exportFileIds, String userDownloadDataDir) { - List userAccessLogs = userAccessLogMapper.selectList(null); + List userAccessLogs = userAccessLogService.getBaseMapper().selectList(null); String json = JSONUtil.toJsonStr(userAccessLogs); String path = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + USER_ACCESS_LOG + ".json"; fileSystemService.writeStringToFile(path, json); } private void exportFileTagInfo(String nowTimeStr, List exportFileIds, String userDownloadDataDir) { - List fileTagRelations = fileTagRelationMapper.selectList(Wrappers.lambdaQuery(FileTagRelation.class).in(FileTagRelation::getFileId, exportFileIds)); + List fileTagRelations = fileTagRelationService.getBaseMapper().selectList(Wrappers.lambdaQuery(FileTagRelation.class).in(FileTagRelation::getFileId, exportFileIds)); String path = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + ED_TAG_RELATIONS + ".json"; String json = JSONUtil.toJsonStr(fileTagRelations); fileSystemService.writeStringToFile(path, json); } private void exportFileRelationInfo(String nowTimeStr, List exportFileIds, String userDownloadDataDir) { - List edFileRelations = edFileRelationMapper.selectList(Wrappers.lambdaQuery(EdFileRelation.class).in(EdFileRelation::getId1, exportFileIds) + List edFileRelations = edFileRelationService.getBaseMapper().selectList(Wrappers.lambdaQuery(EdFileRelation.class).in(EdFileRelation::getId1, exportFileIds) .or() .in(EdFileRelation::getId2, exportFileIds)); String json = JSONUtil.toJsonStr(edFileRelations); @@ -804,7 +810,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl exportFileIds, String userDownloadDataDir) { - List edFileFavorites = edFileFavoriteMapper.selectList(Wrappers.lambdaQuery(EdFileFavorite.class).in(EdFileFavorite::getFileId, exportFileIds)); + List edFileFavorites = fileFavoriteService.getBaseMapper().selectList(Wrappers.lambdaQuery(EdFileFavorite.class).in(EdFileFavorite::getFileId, exportFileIds)); String json = JSONUtil.toJsonStr(edFileFavorites); String path = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + ED_FILE_FAVORITE + ".json"; fileSystemService.writeStringToFile(path, json); diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/UserAccessLogServiceImpl.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/UserAccessLogServiceImpl.java index 9285020..3c5dfc0 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/UserAccessLogServiceImpl.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/UserAccessLogServiceImpl.java @@ -31,7 +31,6 @@ import java.util.stream.Collectors; @Service public class UserAccessLogServiceImpl extends ServiceImpl implements UserAccessLogService { - @Resource private UserMapper userMapper;