From 6ef350b05b2164c264306bf4c4502dd157e6c1f7 Mon Sep 17 00:00:00 2001 From: nieziyan Date: Mon, 6 Nov 2023 14:41:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Abugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/modules/base/dto/AnalysesDto.java | 17 ++++++++ .../system/mapper/GardsSampleDataMapper.java | 7 ++-- .../mapper/xml/GardsSampleDataMapper.xml | 16 ++++--- .../service/IGardsSampleDataService.java | 4 ++ .../impl/GardsSampleDataServiceImpl.java | 42 +++++++++++-------- .../src/main/resources/application.yml | 1 + 6 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/AnalysesDto.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/AnalysesDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/AnalysesDto.java new file mode 100644 index 00000000..7e6ba90d --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/AnalysesDto.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; + +@Data +public class AnalysesDto { + + private String baselinePath; + + private String lcPath; + + private String scacPath; + + private String logPath; + + private String reportPath; +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java index 329628fa..b29ac9b8 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java @@ -2,6 +2,7 @@ package org.jeecg.modules.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.dto.AnalysesDto; import org.jeecg.modules.base.dto.OwnerDto; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; @@ -12,9 +13,9 @@ public interface GardsSampleDataMapper extends BaseMapper List containSampleId(String filed); - void delTables(@Param("tableNames") List tableNames, + void delTables(@Param("tableName") String tableName, @Param("sampleId") Integer sampleId); - GardsAnalyses getAnalysis(@Param("sampleId") Integer sampleId, - @Param("owner") String owner); + AnalysesDto getAnalysis(@Param("owner") String owner, + @Param("sampleId") Integer sampleId); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml index b35248fd..a6ac7161 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml @@ -2,9 +2,7 @@ - - DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId}; - + DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId} - SELECT - BASELINE_PATH AS baselinePath, - LC_PATH AS lcPath, - SCAC_PATH AS scacPath, - LOG_PATH AS logPath, - REPORT_PAHT AS reportPath + BASELINE_PATH, + LC_PATH, + SCAC_PATH, + LOG_PATH, + REPORT_PAHT FROM ${owner}.GARDS_ANALYSES WHERE diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java index bc445d48..5d3530f1 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java @@ -7,6 +7,8 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; +import java.util.List; + public interface IGardsSampleDataService extends IService { /** @@ -25,4 +27,6 @@ public interface IGardsSampleDataService extends IService Result deleteById(Integer sampleId, boolean sampleData, boolean rnAuto, boolean rnMan); GardsSampleDataSystem getOne(Integer sampleId); + + void delTables(List tableNames, Integer sampleId); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java index bca30914..2e677395 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java @@ -18,6 +18,7 @@ import org.jeecg.common.constant.enums.FileTypeEnum; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.util.FTPUtil; import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.base.dto.AnalysesDto; import org.jeecg.modules.base.dto.OwnerDto; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; @@ -111,13 +112,13 @@ public class GardsSampleDataServiceImpl extends ServiceImpl allTables = ownerDtos.stream() .map(owner -> owner.getOwner() + DOT + owner.getTableName()) .collect(Collectors.toList()); - // 删除表数据 - if (CollUtil.isNotEmpty(allTables)) - baseMapper.delTables(allTables, sampleId); // 收集待删除文件路径 needDel.add(samplePath(savePath, sampleId)); // 原始谱文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 + // 删除表数据 + if (CollUtil.isNotEmpty(allTables)) + delTables(allTables, sampleId); } else { if (rnAuto){ @@ -126,11 +127,11 @@ public class GardsSampleDataServiceImpl extends ServiceImpl StrUtil.equals(owner.getOwner(), RNAUTO)) .map(owner -> owner.getOwner() + DOT + owner.getTableName()) .collect(Collectors.toList()); - // 删除表数据 - if (CollUtil.isNotEmpty(autoTables)) - baseMapper.delTables(autoTables, sampleId); // 收集待删除文件路径 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 + // 删除表数据 + if (CollUtil.isNotEmpty(autoTables)) + delTables(autoTables, sampleId); } if (rnMan){ // 收集人工交互库所有表名 @@ -138,11 +139,11 @@ public class GardsSampleDataServiceImpl extends ServiceImpl StrUtil.equals(owner.getOwner(), RNMAN)) .map(owner -> owner.getOwner() + DOT + owner.getTableName()) .collect(Collectors.toList()); - // 删除表数据 - if (CollUtil.isNotEmpty(manTables)) - baseMapper.delTables(manTables, sampleId); // 收集待删除文件路径 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 + // 删除表数据 + if (CollUtil.isNotEmpty(manTables)) + delTables(manTables, sampleId); } } transactionManager.commit(txStatus); @@ -169,6 +170,13 @@ public class GardsSampleDataServiceImpl extends ServiceImpl tableNames, Integer sampleId) { + for (String tableName : tableNames) { + baseMapper.delTables(tableName, sampleId); + } + } + private String samplePath(String savePath, Integer sampleId){ GardsSampleDataSystem sampleData = getOne(sampleId); String inputFileName = sampleData.getInputFileName(); @@ -180,21 +188,21 @@ public class GardsSampleDataServiceImpl extends ServiceImpl manOrAutoPath(String savePath, String logPath, Integer sampleId, String owner){ List fileList = new ArrayList<>(); - GardsAnalyses analysisMan = baseMapper.getAnalysis(sampleId, owner); - if (ObjectUtil.isNull(analysisMan)) + AnalysesDto AnalysesDto = baseMapper.getAnalysis(owner, sampleId); + if (ObjectUtil.isNull(AnalysesDto)) return fileList; - String baselinePath = analysisMan.getBaselinePath(); + String baselinePath = AnalysesDto.getBaselinePath(); if (StrUtil.isNotBlank(baselinePath)) fileList.add(savePath + baselinePath); - String lcPath = analysisMan.getLcPath(); + String lcPath = AnalysesDto.getLcPath(); if (StrUtil.isNotBlank(lcPath)) fileList.add(savePath + lcPath); - String scacPath = analysisMan.getScacPath(); + String scacPath = AnalysesDto.getScacPath(); if (StrUtil.isNotBlank(scacPath)) fileList.add(savePath + scacPath); - if (StrUtil.isNotBlank(analysisMan.getLogPath())) - fileList.add(logPath + analysisMan.getLogPath()); - String reportPath = analysisMan.getReportPath(); + if (StrUtil.isNotBlank(AnalysesDto.getLogPath())) + fileList.add(logPath + AnalysesDto.getLogPath()); + String reportPath = AnalysesDto.getReportPath(); if (StrUtil.isNotBlank(reportPath)) fileList.add(savePath + reportPath + FileTypeEnum.txt.getType()); return fileList; diff --git a/jeecg-server-cloud/armd-system-cloud-start/src/main/resources/application.yml b/jeecg-server-cloud/armd-system-cloud-start/src/main/resources/application.yml index 05439a60..2bd4c646 100644 --- a/jeecg-server-cloud/armd-system-cloud-start/src/main/resources/application.yml +++ b/jeecg-server-cloud/armd-system-cloud-start/src/main/resources/application.yml @@ -16,3 +16,4 @@ spring: import: - optional:nacos:armd.yaml - optional:nacos:armd-@profile.name@.yaml + - optional:nacos:armd-analysis-@profile.name@.yaml