Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
qiaoqinzheng 2023-11-06 14:50:01 +08:00
commit 85ee7e609a
6 changed files with 58 additions and 29 deletions

View File

@ -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;
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; 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.dto.OwnerDto;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.system.entity.GardsSampleDataSystem; import org.jeecg.modules.system.entity.GardsSampleDataSystem;
@ -12,9 +13,9 @@ public interface GardsSampleDataMapper extends BaseMapper<GardsSampleDataSystem>
List<OwnerDto> containSampleId(String filed); List<OwnerDto> containSampleId(String filed);
void delTables(@Param("tableNames") List<String> tableNames, void delTables(@Param("tableName") String tableName,
@Param("sampleId") Integer sampleId); @Param("sampleId") Integer sampleId);
GardsAnalyses getAnalysis(@Param("sampleId") Integer sampleId, AnalysesDto getAnalysis(@Param("owner") String owner,
@Param("owner") String owner); @Param("sampleId") Integer sampleId);
} }

View File

@ -2,9 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.GardsSampleDataMapper"> <mapper namespace="org.jeecg.modules.system.mapper.GardsSampleDataMapper">
<delete id="delTables"> <delete id="delTables">
<foreach collection = "tableNames" item = "tableName" index = "index"> DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId}
DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId};
</foreach>
</delete> </delete>
<select id="containSampleId" resultType="org.jeecg.modules.base.dto.OwnerDto"> <select id="containSampleId" resultType="org.jeecg.modules.base.dto.OwnerDto">
@ -16,13 +14,13 @@
WHERE WHERE
COLUMN_NAME = #{filed} COLUMN_NAME = #{filed}
</select> </select>
<select id="getAnalysis" resultType="org.jeecg.modules.base.entity.rnauto.GardsAnalyses"> <select id="getAnalysis" resultType="org.jeecg.modules.base.dto.AnalysesDto">
SELECT SELECT
BASELINE_PATH AS baselinePath, BASELINE_PATH,
LC_PATH AS lcPath, LC_PATH,
SCAC_PATH AS scacPath, SCAC_PATH,
LOG_PATH AS logPath, LOG_PATH,
REPORT_PAHT AS reportPath REPORT_PAHT
FROM FROM
${owner}.GARDS_ANALYSES ${owner}.GARDS_ANALYSES
WHERE WHERE

View File

@ -7,6 +7,8 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.system.entity.GardsSampleDataSystem; import org.jeecg.modules.system.entity.GardsSampleDataSystem;
import java.util.List;
public interface IGardsSampleDataService extends IService<GardsSampleDataSystem> { public interface IGardsSampleDataService extends IService<GardsSampleDataSystem> {
/** /**
@ -25,4 +27,6 @@ public interface IGardsSampleDataService extends IService<GardsSampleDataSystem>
Result<?> deleteById(Integer sampleId, boolean sampleData, boolean rnAuto, boolean rnMan); Result<?> deleteById(Integer sampleId, boolean sampleData, boolean rnAuto, boolean rnMan);
GardsSampleDataSystem getOne(Integer sampleId); GardsSampleDataSystem getOne(Integer sampleId);
void delTables(List<String> tableNames, Integer sampleId);
} }

View File

@ -18,6 +18,7 @@ import org.jeecg.common.constant.enums.FileTypeEnum;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.FTPUtil; import org.jeecg.common.util.FTPUtil;
import org.jeecg.common.util.RedisUtil; 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.dto.OwnerDto;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.system.entity.GardsSampleDataSystem; import org.jeecg.modules.system.entity.GardsSampleDataSystem;
@ -111,13 +112,13 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
List<String> allTables = ownerDtos.stream() List<String> allTables = ownerDtos.stream()
.map(owner -> owner.getOwner() + DOT + owner.getTableName()) .map(owner -> owner.getOwner() + DOT + owner.getTableName())
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除表数据
if (CollUtil.isNotEmpty(allTables))
baseMapper.delTables(allTables, sampleId);
// 收集待删除文件路径 // 收集待删除文件路径
needDel.add(samplePath(savePath, sampleId)); // 原始谱文件 needDel.add(samplePath(savePath, sampleId)); // 原始谱文件
needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件
needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件
// 删除表数据
if (CollUtil.isNotEmpty(allTables))
delTables(allTables, sampleId);
} }
else { else {
if (rnAuto){ if (rnAuto){
@ -126,11 +127,11 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
.filter(owner -> StrUtil.equals(owner.getOwner(), RNAUTO)) .filter(owner -> StrUtil.equals(owner.getOwner(), RNAUTO))
.map(owner -> owner.getOwner() + DOT + owner.getTableName()) .map(owner -> owner.getOwner() + DOT + owner.getTableName())
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除表数据
if (CollUtil.isNotEmpty(autoTables))
baseMapper.delTables(autoTables, sampleId);
// 收集待删除文件路径 // 收集待删除文件路径
needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件
// 删除表数据
if (CollUtil.isNotEmpty(autoTables))
delTables(autoTables, sampleId);
} }
if (rnMan){ if (rnMan){
// 收集人工交互库所有表名 // 收集人工交互库所有表名
@ -138,11 +139,11 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
.filter(owner -> StrUtil.equals(owner.getOwner(), RNMAN)) .filter(owner -> StrUtil.equals(owner.getOwner(), RNMAN))
.map(owner -> owner.getOwner() + DOT + owner.getTableName()) .map(owner -> owner.getOwner() + DOT + owner.getTableName())
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除表数据
if (CollUtil.isNotEmpty(manTables))
baseMapper.delTables(manTables, sampleId);
// 收集待删除文件路径 // 收集待删除文件路径
needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件
// 删除表数据
if (CollUtil.isNotEmpty(manTables))
delTables(manTables, sampleId);
} }
} }
transactionManager.commit(txStatus); transactionManager.commit(txStatus);
@ -169,6 +170,13 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
.orElse(new GardsSampleDataSystem()); .orElse(new GardsSampleDataSystem());
} }
@Override
public void delTables(List<String> tableNames, Integer sampleId) {
for (String tableName : tableNames) {
baseMapper.delTables(tableName, sampleId);
}
}
private String samplePath(String savePath, Integer sampleId){ private String samplePath(String savePath, Integer sampleId){
GardsSampleDataSystem sampleData = getOne(sampleId); GardsSampleDataSystem sampleData = getOne(sampleId);
String inputFileName = sampleData.getInputFileName(); String inputFileName = sampleData.getInputFileName();
@ -180,21 +188,21 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
private List<String> manOrAutoPath(String savePath, String logPath, private List<String> manOrAutoPath(String savePath, String logPath,
Integer sampleId, String owner){ Integer sampleId, String owner){
List<String> fileList = new ArrayList<>(); List<String> fileList = new ArrayList<>();
GardsAnalyses analysisMan = baseMapper.getAnalysis(sampleId, owner); AnalysesDto AnalysesDto = baseMapper.getAnalysis(owner, sampleId);
if (ObjectUtil.isNull(analysisMan)) if (ObjectUtil.isNull(AnalysesDto))
return fileList; return fileList;
String baselinePath = analysisMan.getBaselinePath(); String baselinePath = AnalysesDto.getBaselinePath();
if (StrUtil.isNotBlank(baselinePath)) if (StrUtil.isNotBlank(baselinePath))
fileList.add(savePath + baselinePath); fileList.add(savePath + baselinePath);
String lcPath = analysisMan.getLcPath(); String lcPath = AnalysesDto.getLcPath();
if (StrUtil.isNotBlank(lcPath)) if (StrUtil.isNotBlank(lcPath))
fileList.add(savePath + lcPath); fileList.add(savePath + lcPath);
String scacPath = analysisMan.getScacPath(); String scacPath = AnalysesDto.getScacPath();
if (StrUtil.isNotBlank(scacPath)) if (StrUtil.isNotBlank(scacPath))
fileList.add(savePath + scacPath); fileList.add(savePath + scacPath);
if (StrUtil.isNotBlank(analysisMan.getLogPath())) if (StrUtil.isNotBlank(AnalysesDto.getLogPath()))
fileList.add(logPath + analysisMan.getLogPath()); fileList.add(logPath + AnalysesDto.getLogPath());
String reportPath = analysisMan.getReportPath(); String reportPath = AnalysesDto.getReportPath();
if (StrUtil.isNotBlank(reportPath)) if (StrUtil.isNotBlank(reportPath))
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType()); fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
return fileList; return fileList;

View File

@ -16,3 +16,4 @@ spring:
import: import:
- optional:nacos:armd.yaml - optional:nacos:armd.yaml
- optional:nacos:armd-@profile.name@.yaml - optional:nacos:armd-@profile.name@.yaml
- optional:nacos:armd-analysis-@profile.name@.yaml