Compare commits
No commits in common. "db9d27d30d65f330445538ecc4fd2860d42fa553" and "926aa9fe10dd4900fe5612e1b39f0cf30ffae7ea" have entirely different histories.
db9d27d30d
...
926aa9fe10
|
@ -698,22 +698,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
GardsSampleData gasSampleData = sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(),
|
||||
DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType());
|
||||
|
||||
if(StringUtils.isEmpty(sampleFilePath)
|
||||
&& (Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName()))
|
||||
&& (Objects.isNull(detSampleData) || StringUtils.isEmpty(detSampleData.getInputFileName()))){
|
||||
result.error500("gas and det file is no exist or is error..");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 如果找不到sample、det、gas谱文件数据则解析失败修改记录状态
|
||||
if(StringUtils.isEmpty(sampleFilePath) || Objects.isNull(gasSampleData)
|
||||
|| StringUtils.isEmpty(gasSampleData.getInputFileName())){
|
||||
result.error500("gas file is no exist or is error..");
|
||||
return result;
|
||||
}
|
||||
if(StringUtils.isEmpty(sampleFilePath) || Objects.isNull(detSampleData)
|
||||
|| StringUtils.isEmpty(detSampleData.getInputFileName())){
|
||||
result.error500("det file is no exist or is error..");
|
||||
|| StringUtils.isEmpty(detSampleData.getInputFileName())
|
||||
|| Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName())){
|
||||
result.error500("gas or det file is no exist or is error..");
|
||||
return result;
|
||||
}
|
||||
String gasFilePath = gasSampleData.getInputFileName();
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.modules.system.service.impl;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
@ -39,7 +38,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -114,9 +112,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
TransactionDefinition txDef = new DefaultTransactionDefinition();
|
||||
final TransactionStatus txStatus = transactionManager.getTransaction(txDef);
|
||||
try {
|
||||
String rootPath = pathProperties.getRootPath();
|
||||
String savePath = rootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
|
||||
String logPath = rootPath + pathProperties.getLogPath() + StrUtil.SLASH;
|
||||
String ftpRootPath = ftpUtil.getFtpRootPath();
|
||||
String savePath = ftpRootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
|
||||
String logPath = ftpRootPath + pathProperties.getLogPath() + StrUtil.SLASH;
|
||||
/* 删除数据库数据 */
|
||||
// 过滤掉多余的表
|
||||
String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN";
|
||||
|
@ -140,7 +138,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
// 删除表数据
|
||||
if (CollUtil.isNotEmpty(allTables))
|
||||
delTables(allTables, sampleId);
|
||||
// baseMapper.delBatch(allTables, sampleId);
|
||||
// baseMapper.delBatch(allTables, sampleId);
|
||||
}
|
||||
else {
|
||||
if (rnAuto){
|
||||
|
@ -154,7 +152,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
// 删除表数据
|
||||
if (CollUtil.isNotEmpty(autoTables))
|
||||
delTables(autoTables, sampleId);
|
||||
// baseMapper.delBatch(autoTables, sampleId);
|
||||
// baseMapper.delBatch(autoTables, sampleId);
|
||||
}
|
||||
if (rnMan){
|
||||
// 收集人工交互库所有表名
|
||||
|
@ -167,27 +165,23 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
// 删除表数据
|
||||
if (CollUtil.isNotEmpty(manTables))
|
||||
delTables(manTables, sampleId);
|
||||
// baseMapper.delBatch(manTables, sampleId);
|
||||
// baseMapper.delBatch(manTables, sampleId);
|
||||
}
|
||||
}
|
||||
transactionManager.commit(txStatus);
|
||||
needDel = needDel.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(needDel))
|
||||
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
|
||||
// 删除本地文件
|
||||
List<String> fails = new ArrayList<>();
|
||||
for (String path : needDel) {
|
||||
log.info("删除能谱文件:{}", path);
|
||||
File file = new File(path);
|
||||
if (file.isDirectory()) {
|
||||
fails.add(path);
|
||||
continue;
|
||||
// 删除FTP文件
|
||||
List<String> failList = new ArrayList<>();
|
||||
for (String path:needDel) {
|
||||
boolean success = ftpUtil.removeFiles(path);
|
||||
if (!success) {
|
||||
failList.add(path);
|
||||
}
|
||||
boolean success = FileUtil.del(path);
|
||||
if (!success) fails.add(path);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(fails))
|
||||
return Result.error("Data clearing is complete, but file clearing fails!", fails);
|
||||
if (CollUtil.isNotEmpty(failList))
|
||||
return Result.error("Data clearing is complete, but file clearing fails!", failList);
|
||||
return Result.OK("Data and file cleanup complete!");
|
||||
}catch (Exception e){
|
||||
transactionManager.rollback(txStatus);
|
||||
|
|
Loading…
Reference in New Issue
Block a user