feat:database info

This commit is contained in:
nieziyan 2023-11-01 21:13:39 +08:00
parent cbd4df77f8
commit e22730fbe3
11 changed files with 270 additions and 462 deletions

View File

@ -307,6 +307,9 @@ public class FTPUtil {
return true;
}
/*
* 将源FTP路径的文件保存为指定路径的临时文件
* */
public File downloadFile(String fromPath, String toPath) {
FTPClient ftpClient = null;
InputStream inputStream = null;
@ -339,6 +342,9 @@ public class FTPUtil {
}
}
/*
* 将源FTP路径的文件转换为文件流
* */
public InputStream downloadFileStream(String fromPath) {
FTPClient ftpClient = null;
try {

View File

@ -69,4 +69,11 @@ public class SysDatabaseController {
public Result<?> dbNames(@RequestParam String dbType){
return Result.OK(sysDatabaseService.dbNames(dbType));
}
@GetMapping("dbInfo")
@ApiOperation(value = "数据库表详情信息",notes = "数据库表详情信息")
public Result<?> dbInfo(@RequestParam String dbType,
@RequestParam String dataBase) {
return Result.OK(sysDatabaseService.dbInfo(dbType, dataBase));
}
}

View File

@ -1,6 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.dto.DBInfo;
import org.jeecg.modules.base.dto.DatabaseDto;
import org.jeecg.modules.base.entity.postgre.SysDatabase;
import org.jeecg.modules.entity.AlarmHistory;
@ -19,4 +21,8 @@ public interface SysDatabaseMapper extends BaseMapper<SysDatabase> {
List<String> dbNamesMY();
List<String> dbNamesOR();
List<DBInfo> dbInfoOR(@Param("owner") String dataBase);
List<DBInfo> dbIndexOR(@Param("owner") String dataBase);
}

View File

@ -59,4 +59,29 @@
<select id="dbNamesOR" resultType="java.lang.String">
SELECT username FROM all_users;
</select>
<select id="dbInfoOR" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT
a.table_name AS tableName,
a.num_rows AS numRow,
ROUND((d.bytes / (1024 * 1024)), 2) AS dataSize,
ROUND((d.bytes / (1024 * 1024)), 2) AS indexSize,
ROUND((d.bytes / d.max_size) * 100, 3) AS used
FROM
all_tables a
LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'TABLE'
WHERE
a.owner = #{owner}
ORDER BY a.table_name
</select>
<select id="dbIndexOR" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT
a.table_name AS tableName,
ROUND((d.bytes / (1024 * 1024)), 2) AS indexSize
FROM
all_tables a
LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'INDEX'
WHERE
a.owner = #{owner}
ORDER BY a.table_name
</select>
</mapper>

View File

@ -207,9 +207,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
List<DBInfo> dbInfos = new ArrayList<>();
switch (dbType){
case DataBaseConstant.DB_TYPE_ORACLE:
DSSwitcher.switchToOracle();
DSSwitcher.clear();
dbInfos = dbInfoOR(dataBase);
break;
case DataBaseConstant.DB_TYPE_POSTGRESQL:
@ -223,4 +221,16 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
return dbInfos;
}
private List<DBInfo> dbInfoOR(String dataBase){
DSSwitcher.switchToOracle();
List<DBInfo> dbInfos = baseMapper.dbInfoOR(dataBase);
Map<String, Double> indexSize = baseMapper.dbIndexOR(dataBase).stream()
.collect(Collectors.toMap(DBInfo::getTableName, DBInfo::getIndexSize));
for (DBInfo dbInfo : dbInfos) {
String tableName = dbInfo.getTableName();
dbInfo.setIndexSize(indexSize.get(tableName));
}
DSSwitcher.clear();
return dbInfos;
}
}

View File

@ -1,5 +1,6 @@
package org.jeecg.common.util;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@ -241,140 +242,49 @@ public class GammaFileUtil extends AbstractLogOrReport {
//文件名称需要加上自动处理的前缀以及修改不同的文件后缀名
String subFileName = fileName.substring(0, fileName.lastIndexOf(StringPool.DOT));
if(StringUtils.isNotBlank(subFileName)){
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp connection failed";
}
InputStream inputStream = null;
File file = null;
File lcFile = null;
File scacFile = null;
InputStream inputStreamBase = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
ftpClient.changeWorkingDirectory(pathName);
String lcFileName = "RNAUTO_"+subFileName + ".lc";
inputStream = ftpClient.retrieveFileStream(lcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
List<String> readLines = FileUtils.readLines(file, "UTF-8");
//得到行数据处理后的数据结果
List<Double> vData = ReadLcScacInfo(readLines);
//将数据结果赋值给 phdFile的vLc
phd.setVLc(vData);
// 删除临时文件
//file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)) {
ftpClient.disconnect();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
if(StringUtils.isNotBlank(subFileName)){
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp connection failed";
}
InputStream inputStream = null;
File file = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
ftpClient.changeWorkingDirectory(pathName);
String fromPathLc = pathName + StringPool.SLASH + lcFileName;
lcFile = ftpUtil.downloadFile(fromPathLc, "betaGamma");
List<String> readLinesLc = FileUtils.readLines(lcFile, "UTF-8");
//得到行数据处理后的数据结果
List<Double> vDataLc = ReadLcScacInfo(readLinesLc);
//将数据结果赋值给 phdFile的vLc
phd.setVLc(vDataLc);
String scacFileName = "RNAUTO_"+subFileName + ".scac";
inputStream = ftpClient.retrieveFileStream(scacFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
List<String> readLines = FileUtils.readLines(file, "UTF-8");
//得到行数据处理后的数据结果
List<Double> vData = ReadLcScacInfo(readLines);
//将数据结果赋值给 phdFile的vScac
phd.setVScac(vData);
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)) {
ftpClient.disconnect();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
if(StringUtils.isNotBlank(subFileName)){
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp connection failed";
}
InputStream inputStream = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
ftpClient.changeWorkingDirectory(pathName);
String fromPathScac = pathName + StringPool.SLASH + scacFileName;
scacFile = ftpUtil.downloadFile(fromPathScac, "betaGamma");
List<String> readLinesScac = FileUtils.readLines(scacFile, "UTF-8");
//得到行数据处理后的数据结果
List<Double> vDataScac = ReadLcScacInfo(readLinesScac);
//将数据结果赋值给 phdFile的vLc
phd.setVScac(vDataScac);
String baselineFileName = "RNAUTO_"+subFileName + ".baseline";
//获取ftp的文件流数据
inputStream = ftpClient.retrieveFileStream(baselineFileName);
if (Objects.nonNull(inputStream)){
//调用处理BaseCtrl的方法
ReadBaseCtrlInfo(phd, inputStream);
//将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
phd.setVBase(phd.getBaseCtrls().getBaseline());
}
} catch (IOException e) {
throw new RuntimeException(e);
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
// 调用处理BaseCtrl的方法
ReadBaseCtrlInfo(phd, inputStreamBase);
// 将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
phd.setVBase(phd.getBaseCtrls().getBaseline());
}catch (IOException e){
e.printStackTrace();
} finally {
try {
if (Objects.nonNull(ftpClient)) {
ftpClient.disconnect();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (ObjectUtil.isNotNull(inputStreamBase))
inputStreamBase.close();
if (ObjectUtil.isNotNull(lcFile))
lcFile.delete();
if (ObjectUtil.isNotNull(scacFile))
scacFile.delete();
} catch (IOException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
}
@ -4042,59 +3952,23 @@ public class GammaFileUtil extends AbstractLogOrReport {
public List<Long> loadCompareData(String compareFileName, String userName, long m_nCount, Result result) {
List<Long> m_vecCompare = new LinkedList<>();
String compareFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp connection failed");
String compareFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = compareFilePath + StringPool.SLASH + compareFileName;
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
//读取文件信息
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//判断当前用来进行比较的文件的#g_Spectrum数量是否与原文件的大小一致
if (struct.num_g_channel != m_nCount) {
result.error500("We can't compare two Spectrum files if their number of Counts are different!");
return m_vecCompare;
}
InputStream inputStream = null;
File file = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
ftpClient.changeWorkingDirectory(compareFilePath);
inputStream = ftpClient.retrieveFileStream(compareFileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//判断当前用来进行比较的文件的#g_Spectrum数量是否与原文件的大小一致
if (struct.num_g_channel != m_nCount) {
result.error500("We can't compare two Spectrum files if their number of Counts are different!");
return m_vecCompare;
}
m_vecCompare = struct.g_counts;
if (struct.g_begin_channel == 0) {
m_vecCompare.add(0L);
m_vecCompare.remove(0);
}
}
}catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)){
ftpClient.disconnect();
}
if (Objects.nonNull(inputStream)){
inputStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
m_vecCompare = struct.g_counts;
if (struct.g_begin_channel == 0) {
m_vecCompare.add(0L);
m_vecCompare.remove(0);
}
if (ObjectUtil.isNotNull(file))
file.delete();
return m_vecCompare;
}
@ -4168,41 +4042,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
public File analyzeFile(String path, String fileName) {
path = path.replace("\\", "/");
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
InputStream inputStream = null;
File file = null;
try {
//被动模式
ftpClient.enterLocalPassiveMode();
//设置文件类型--二进制文件
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
//
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
//切换文件路径
ftpClient.changeWorkingDirectory(path);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)){
ftpClient.disconnect();
}
if (Objects.nonNull(inputStream)){
inputStream.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return file;
String fromPath = path + StringPool.SLASH + fileName;
return ftpUtil.downloadFile(fromPath, "betaGamma");
}
public String makeUpSpectrum(PHDFile phd) {

View File

@ -1,5 +1,6 @@
package org.jeecg.common.util;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@ -262,52 +263,19 @@ public class PHDFileUtil extends AbstractLogOrReport {
public List<String> readLine(String filePath) {
String parameterFilePath = filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1);
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
//判断ftp是否连接成功
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp connection failed!");
}
InputStream iStream= null;
File file = null;
List<String> allLines = new ArrayList<>();
try {
//被动模式
ftpClient.enterLocalPassiveMode();
//设置文件类型--二进制文件
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
//
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
//在当前工作路径下读取文件
ftpClient.changeWorkingDirectory(parameterFilePath);
//读取ftp文件的输入流
iStream=ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(iStream)) {
//声明一个临时文件
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(iStream, file);
List<String> allLines = FileUtils.readLines(file, ftpUtil.getEncoding());
return allLines;
}
} catch (IOException e) {
throw new RuntimeException(e);
file = ftpUtil.downloadFile(filePath, "betaGamma");
return FileUtils.readLines(file, ftpUtil.getEncoding());
}catch (IOException e){
e.printStackTrace();
return allLines;
} finally {
try {
if (Objects.nonNull(ftpClient)){
ftpClient.disconnect();
}
if (Objects.nonNull(iStream)){
iStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
if (ObjectUtil.isNotNull(file))
file.delete();
}
return Collections.emptyList();
}
public void getLightColor(Map<String, Object> sampleMap, Map<String, Object> gasBgMap, Map<String, Object> detBgMap, Map<String, Object> qcMap) {
@ -451,138 +419,83 @@ public class PHDFileUtil extends AbstractLogOrReport {
public Map<String, String> getFileData(String filePath, String sampleFileName) {
Map<String, String> map = new HashMap<>();
//连接ftp 获取ftp文件数据
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
return map;
}
InputStream inputStream = null;
File file = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
//切换工作路径
ftpClient.changeWorkingDirectory(filePath);
//解析sampleFile
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载sampleFile内容
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//获取所需要的数据
String dataType = struct.data_type;
String systemType = struct.system_type;
String spectrumQuantity = struct.spectrum_quantity;
double acquisitionLiveTime = struct.acquisition_live_time;
String measurementId = struct.measurement_id;
String gasBkMeasurementId = struct.gas_bk_measurement_id;
String detectorBkMeasurementId = struct.detector_bk_measurement_id;
//格式化文件名称
String fileSuffix = nameStandUtil.GetSuffix(dataType, spectrumQuantity, String.valueOf(acquisitionLiveTime));
String measurementName = nameStandUtil.GetFileNameFromDateTime(measurementId, fileSuffix);
String gasFileName = nameStandUtil.GetFileNameFromDateTime(gasBkMeasurementId, "_G.PHD");
String detaFileName = nameStandUtil.GetFileNameFromDateTime(detectorBkMeasurementId, "_D.PHD");
map.put("sampleFileName", measurementName);
map.put("gasFileName", gasFileName);
map.put("detaFileName", detaFileName);
map.put("sampleSystemType", systemType);
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (ftpClient!=null){
ftpClient.disconnect();
}
if (inputStream!=null){
inputStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
String fromPath = filePath + StringPool.SLASH + sampleFileName;
file = ftpUtil.downloadFile(fromPath, "betaGamma");
//加载sampleFile内容
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//获取所需要的数据
String dataType = struct.data_type;
String systemType = struct.system_type;
String spectrumQuantity = struct.spectrum_quantity;
double acquisitionLiveTime = struct.acquisition_live_time;
String measurementId = struct.measurement_id;
String gasBkMeasurementId = struct.gas_bk_measurement_id;
String detectorBkMeasurementId = struct.detector_bk_measurement_id;
//格式化文件名称
String fileSuffix = nameStandUtil.GetSuffix(dataType, spectrumQuantity, String.valueOf(acquisitionLiveTime));
String measurementName = nameStandUtil.GetFileNameFromDateTime(measurementId, fileSuffix);
String gasFileName = nameStandUtil.GetFileNameFromDateTime(gasBkMeasurementId, "_G.PHD");
String detaFileName = nameStandUtil.GetFileNameFromDateTime(detectorBkMeasurementId, "_D.PHD");
map.put("sampleFileName", measurementName);
map.put("gasFileName", gasFileName);
map.put("detaFileName", detaFileName);
map.put("sampleSystemType", systemType);
return map;
}catch (Exception e){
e.printStackTrace();
return map;
}finally {
if (ObjectUtil.isNotNull(file))
file.delete();
}
return map;
}
public String NameStandardBy(String filePath, String fileName) {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
InputStream inputStream = null;
File file = null;
StringBuffer path = new StringBuffer();
File file = null;
try {
//被动模式
ftpClient.enterLocalPassiveMode();
//设置文件类型--二进制文件
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
//
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
//切换文件路径
ftpClient.changeWorkingDirectory(filePath);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
String systemType = sourceData.system_type;
String dataType = sourceData.data_type;
if(systemType.contains("B")) {
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Sauna");
} else if(systemType.contains("G")) {
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Spalax");
}
if(dataType.contains("SAMPLEPHD")) {
path.append(StringPool.SLASH+"Samplephd");
} else if(dataType.contains("DETBKPHD")) {
path.append(StringPool.SLASH+"Detbkphd");
} else if(dataType.contains("GASBKPHD")) {
path.append(StringPool.SLASH+"Gasbkphd");
} else if(dataType.contains("QCPHD")) {
path.append(StringPool.SLASH+"Qcphd");
}
int pos = fileName.indexOf('-');
if(-1 == pos) {
String fromPath = ftpUtil.getFtpRootPath() + filePath +
StringPool.SLASH + fileName;
file = ftpUtil.downloadFile(fromPath, "betaGamma");
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
String systemType = sourceData.system_type;
String dataType = sourceData.data_type;
if(systemType.contains("B")) {
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Sauna");
} else if(systemType.contains("G")) {
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Spalax");
}
if(dataType.contains("SAMPLEPHD")) {
path.append(StringPool.SLASH+"Samplephd");
} else if(dataType.contains("DETBKPHD")) {
path.append(StringPool.SLASH+"Detbkphd");
} else if(dataType.contains("GASBKPHD")) {
path.append(StringPool.SLASH+"Gasbkphd");
} else if(dataType.contains("QCPHD")) {
path.append(StringPool.SLASH+"Qcphd");
}
int pos = fileName.indexOf('-');
if(-1 == pos) {
} else if(fileName.length() >= pos+7) {
path.append(StringPool.SLASH+fileName.substring(pos+1,pos+5));
path.append(StringPool.SLASH+fileName.substring(pos+5,pos+7));
}
path.append(StringPool.SLASH+fileName);
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)){
ftpClient.disconnect();
}
if (inputStream != null){
inputStream.close();
}
if (Objects.nonNull(file)) {
file.delete();
}
} catch (IOException e) {
throw new RuntimeException(e);
} else if(fileName.length() >= pos+7) {
path.append(StringPool.SLASH+fileName.substring(pos+1,pos+5));
path.append(StringPool.SLASH+fileName.substring(pos+5,pos+7));
}
path.append(StringPool.SLASH+fileName);
return path.toString();
}catch (Exception e){
e.printStackTrace();
return path.toString();
}finally {
if (ObjectUtil.isNotNull(file))
file.delete();
}
return path.toString();
}
public List<String> FileNameByStandardForm(String filePath, String sampleFileName) {

View File

@ -203,7 +203,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
Map<String, NuclideLines> nuclideLinesMap = GetNuclideLines(nuclides);
// 解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(phd);
@ -3517,7 +3517,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (StringUtils.isBlank(reportPath)) {
throw new RuntimeException("The automatic handler generated report does not exist");
}
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
// 连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -3567,7 +3567,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
public void exportARR(Integer sampleId, HttpServletResponse response) {
// 获取自动处理生成的报告地址
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
// 连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -4105,7 +4105,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (StringUtils.isBlank(logPath)) {
throw new RuntimeException("The log generated by the automatic processor does not exist");
}
String pathName = StringPool.SLASH + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
String fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
// 连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();

View File

@ -282,7 +282,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
List<Map<String, Object>> resultList = new LinkedList<>();
String userName = JwtUtil.getUserNameByToken(request);
String filePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String sampleRx = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.PHD";
Pattern regexPattern = Pattern.compile(sampleRx);
String sampleRx1 = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.\\d+\\.PHD";
@ -403,7 +403,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
filePath.add(sampleFilePath);
GardsSampleData sample = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
sampleMap = this.fenxi(pathName, fileName, sample.getSampleId(), sample.getStatus());
resultMap.put("sample",sampleMap);
@ -412,7 +412,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
filePath.add(gasBgFilePath);
GardsSampleData gasBg = spectrumAnalysisMapper.findSampleByFilePath(gasBgFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(gasBg)) {
gasBgMap = this.fenxi(pathName, fileName, gasBg.getSampleId(), gasBg.getStatus());
@ -423,7 +423,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
filePath.add(detBgFilePath);
GardsSampleData detBg = spectrumAnalysisMapper.findSampleByFilePath(detBgFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(detBg)) {
detBgMap = this.fenxi(pathName, fileName, detBg.getSampleId(), detBg.getStatus());
@ -436,7 +436,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
dbSpectrumFilePath.setQcFilePath(dbQcFilePath);
filePath.add(dbQcFilePath);
GardsSampleData qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(qc)) {
qcMap = this.fenxi(pathName, fileName, qc.getSampleId(), qc.getStatus());
@ -499,7 +499,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
Map<String, Object> resultMap = new HashMap<>();
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
List<Boundary> sampleBoundary = new LinkedList<>();
@ -655,11 +655,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
//根据请求体获取当前登录用户名
String userName = JwtUtil.getUserNameByToken(request);
//上传路径
String pathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//判断sampleId是否为空 如果不为空 则当前操作数据来源是数据库 文件路径从数据库中查询
if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId);
if (Objects.nonNull(commentData)){
if (!commentData.getAnalyst().equals(userName)){
@ -727,7 +727,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (StringUtils.isBlank(reportPath)){
throw new RuntimeException("The automatic handler generated report does not exist");
}
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -777,7 +777,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
public Result viewRRR(RRRLogInfo rrrLogInfo, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
GardsCalibrationSpectrum gammaCalibrationParamS = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamD = new GardsCalibrationSpectrum();
@ -802,9 +802,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
if (Objects.nonNull(dbSpectrumFilePath)){
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
}
} else {
sampleFilePath = path;
@ -1306,34 +1306,34 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
}
if(StringUtils.isNotBlank(sampleFileName)) {
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + sampleFileName;
String sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + sampleFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())) {
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath();
sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath();
}
List<String> lines = phdFileUtil.readLine(sampleFilePath);
map.put("sample", lines);
}
if(StringUtils.isNotBlank(gasFileName)) {
String gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + gasFileName;
String gasBgFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + gasFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath();
gasBgFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath();
}
List<String> lines = phdFileUtil.readLine(gasBgFilePath);
map.put("gasBg", lines);
}
if(StringUtils.isNotBlank(detFileName)) {
String detBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + detFileName;
String detBgFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + detFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
detBgFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath();
detBgFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath();
}
List<String> lines = phdFileUtil.readLine(detBgFilePath);
map.put("detBg", lines);
}
if (StringUtils.isNotBlank(qcFileName)) {
String dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + qcFileName;
String dbQcFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + qcFileName;
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
dbQcFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
}
List<String> lines = phdFileUtil.readLine(dbQcFilePath);
map.put("qc", lines);
@ -1347,10 +1347,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
public Result viewSampleInformation(Integer sampleId, String sampleFileName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
String pathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
if (StringUtils.isNotBlank(sampleFileName)){
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -1507,15 +1507,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
}
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
//查询数据库中结果的Xe数据
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
xeDataList = xeDataList.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_133.getType())).collect(Collectors.toList());
gardsXeResults = xeDataList.get(0);
} else {//如果没有数据来源就是File
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
sampleFilePath = path;
gasFilePath = path;
detFilePath = path;
@ -1632,7 +1632,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
RlrDataValues rlrDataValues = new RlrDataValues();
String userName = JwtUtil.getUserNameByToken(request);
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -1653,11 +1653,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
if (Objects.nonNull(sampleId)) {
sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
//查询数据库中结果的Xe数据
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
} else {
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
sampleTmp = phdFileUtil.analyzeFile(path, sampleFileName);
gasTmp = phdFileUtil.analyzeFile(path, gasFileName);
detTmp = phdFileUtil.analyzeFile(path, detFileName);
@ -1764,14 +1764,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
String qcPath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//如果sampleId不为空
if (Objects.nonNull(sampleId)) {
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
}
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -1911,13 +1911,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
String qcPath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)) {
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
}
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -2058,10 +2058,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
String samplePathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String samplePathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)){
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
samplePathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
samplePathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -2188,7 +2188,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
String sampleFilePath = "";
String detFilePath = "";
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
Integer analysisID = null;
if (extInfo.getDbName().equalsIgnoreCase("auto")){
@ -2200,8 +2200,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
if (Objects.nonNull(dbSpectrumFilePath)) {
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
}
} else {
sampleFilePath = path;
@ -2467,11 +2467,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
String filePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//判断sampleId是否存在
if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -2985,13 +2985,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
String qcPathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcPathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)) {
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPathName=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcPathName=ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
}
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -3086,7 +3086,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcFilePath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, sampleFilePath, gasFilePath, detFilePath, qcFilePath, userName);
map.put("xeData", analyseResult);
@ -3096,7 +3096,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
result.setResult(map);
}
} else {
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, path, path, path, path, userName);
map.put("XeData", analyseResult);
map.put("bProcessed", true);
@ -3136,7 +3136,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcFilePath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcFilePath=ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath);
@ -3144,10 +3144,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
m_loadData.put("qcFilePath", qcFilePath);
}
} else {
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String gasFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String detFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String gasFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath);
m_loadData.put("detFilePath", detFilePath);
@ -3621,7 +3621,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//拼接ftp上传临时文件路径
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//声明一个实体类获取数据库中文件路径
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
Integer analysisID = null;
@ -3644,14 +3644,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
}
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
samplePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
samplePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcPath=ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
} else if ( (Objects.isNull(sampleId) && StringUtils.isNotBlank(dbName)) || (Objects.nonNull(sampleId) && StringUtils.isBlank(dbName)) ){
result.error500("Data load From DB need to pass in sampleId and dbName");
@ -3758,7 +3758,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (CollectionUtils.isNotEmpty(sampleFileNames)) {
for (int i=0; i<sampleFileNames.size(); i++) {
//拼接ftp上传临时文件路径
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String samplePath = "";
String gasPath = "";
String detPath = "";
@ -3785,19 +3785,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
samplePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
samplePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
gasPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
detPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
detPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
}
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
qcPath=ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
} else if ( (Objects.isNull(sampleId) && StringUtils.isNotBlank(dbName)) || (Objects.nonNull(sampleId) && StringUtils.isBlank(dbName)) ){
result.error500("Data load From DB need to pass in sampleId and dbName");
@ -3895,7 +3895,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (StringUtils.isBlank(logPath)){
throw new RuntimeException("The log generated by the automatic processor does not exist");
}
String pathName = StringPool.SLASH + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
String fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -4056,27 +4056,27 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(sampleId)) {
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setSampleFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setGasFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setDetFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(qcFilePath)) {
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setQcFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
}
}
}
} else {
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setSampleFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setGasFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setDetFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setQcFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
}
//处理数据 获取对应的channel/energy值
@ -4313,25 +4313,25 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(sampleId)) {
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setSampleFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setGasFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setDetFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
anlyseResultIn.setQcFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
}
}
} else {
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setSampleFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setGasFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setDetFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setQcFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
}
//处理数据 获取对应的channel/energy值
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);

View File

@ -142,7 +142,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
String username = user.getUsername();
String slash = SymbolConstant.SINGLE_SLASH;
String comma = SymbolConstant.COMMA;
String filePath = slash + spectrumPathProperties.getUploadPath() + slash + username;
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + slash + username;
FTPClient ftpClient = null;
List<FileDto> fileDtos = new ArrayList<>();
Page<FileDto> page = new Page<>(pageNo, pageSize);

View File

@ -48,7 +48,7 @@ public class ReadLineUtil {
try {
ftpClient.enterLocalPassiveMode();
String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1);
String parameterFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
String parameterFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
//判断文件路径是否为空
if (StringUtils.isNotBlank(parameterFilePath)){
//在当前工作路径下读取文件
@ -191,7 +191,7 @@ public class ReadLineUtil {
OutputStream outputStream = null;
InputStream inputStream = null;
try {
filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath;
filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath;
// 切换工作目录为 /
ftpClient.changeWorkingDirectory(SymbolConstant.SINGLE_SLASH);