修改beta模块saveToDB接口问题
修改gamma模块saveToDB接口问题 修改beta模块saveToTXT,saveToExcel,saveToHtml问题
This commit is contained in:
parent
7feca0fdef
commit
720e1bf975
|
@ -46,11 +46,6 @@ public class SpectrumAnalysesController {
|
|||
return spectrumAnalysisService.getDBSpectrumList(queryRequest, gardsSampleData, dbName, menuTypes, AllUsers, CollectStopB, AcqStartB, startDate, endDate, request);
|
||||
}
|
||||
|
||||
@GetMapping("getSpectrumFiles")
|
||||
public Result getSpectrumFiles(HttpServletRequest request) {
|
||||
return spectrumAnalysisService.getSpectrumFiles(request);
|
||||
}
|
||||
|
||||
@GetMapping("getFilesBySampleFile")
|
||||
@ApiOperation(value = "根据sampleFile查询出关联的文件信息", notes = "根据sampleFile查询出关联的文件信息")
|
||||
public Result getFilesBySampleFile(String fileName, HttpServletRequest request) {
|
||||
|
@ -59,8 +54,8 @@ public class SpectrumAnalysesController {
|
|||
|
||||
@GetMapping("getDBSpectrumChart")
|
||||
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId) {
|
||||
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId);
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, HttpServletRequest request) {
|
||||
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId, request);
|
||||
}
|
||||
|
||||
@GetMapping("getFileSpectrumChart")
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
Page<GardsSampleDataSpectrum> getDBSpectrumList(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers);
|
||||
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId);
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId, Integer analysisID);
|
||||
|
||||
List<GardsXeResultsSpectrum> getXeDataList(Integer sampleId);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
String getStatus(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
GardsAnalysesSpectrum getAnalysis(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId);
|
||||
GardsAnalysesSpectrum getAnalysis(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<GardsPeaksSpectrum> getPeaks(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
|
@ -78,7 +78,7 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
|
||||
|
||||
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId);
|
||||
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
${dbName}.GARDS_ANALYSES analyses
|
||||
<where>
|
||||
analyses.SAMPLE_ID = #{sampleId}
|
||||
AND analyses.IDANALYSIS = #{analysisID}
|
||||
AND org_sample.SAMPLE_ID=analyses.SAMPLE_ID
|
||||
</where>
|
||||
</select>
|
||||
|
@ -379,6 +380,7 @@
|
|||
FROM
|
||||
${dbName}
|
||||
WHERE SAMPLE_ID = #{sampleId}
|
||||
and ANALYST = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="getPeaks" resultType="org.jeecg.modules.entity.GardsPeaksSpectrum">
|
||||
|
@ -492,7 +494,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getAnalysisID" resultType="java.lang.Integer">
|
||||
SELECT ANALYSIS_DB.IDANALYSIS FROM ${dbName}.GARDS_ANALYSES ANALYSIS_DB WHERE ANALYSIS_DB.SAMPLE_ID = #{sampleId}
|
||||
SELECT ANALYSIS_DB.IDANALYSIS FROM ${dbName}.GARDS_ANALYSES ANALYSIS_DB WHERE ANALYSIS_DB.SAMPLE_ID = #{sampleId} and ANALYST = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="ReadGammaFitChannelEnergy" resultType="org.jeecg.modules.entity.GardsCalibrationPairsSpectrum">
|
||||
|
|
|
@ -213,42 +213,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getSpectrumFiles(HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
String filePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
if (Objects.isNull(ftpClient)){
|
||||
result.error500("ftp连接失败");
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
//切换被动模式
|
||||
ftpClient.enterLocalPassiveMode();
|
||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
//切换工作路径
|
||||
ftpClient.changeWorkingDirectory(filePath);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
result.setSuccess(true);
|
||||
result.setResult(ftpFiles);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (Objects.nonNull(ftpClient)) {
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getFilesBySampleFile(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
@ -333,28 +297,31 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId) {
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||
if (Objects.isNull(sampleId)){
|
||||
result.error500("请选择一条数据");
|
||||
return result;
|
||||
}
|
||||
Integer analysisID = null;
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
Integer idAnalysis = spectrumAnalysisMapper.getAnalysisID("RNAUTO", sampleId);
|
||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNAUTO", idAnalysis, sampleId);
|
||||
userName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID("RNAUTO", sampleId, "RNAUTO");
|
||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNAUTO", analysisID, sampleId);
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
Integer idAnalysis = spectrumAnalysisMapper.getAnalysisID("RNMAN", sampleId);
|
||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNMAN", idAnalysis, sampleId);
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID("RNMAN", sampleId, userName);
|
||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNMAN", analysisID, sampleId);
|
||||
}else {
|
||||
result.error500("数据库类型不存在");
|
||||
return result;
|
||||
}
|
||||
//查询数据库文件信息
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
List<String> filePath = new LinkedList<>();
|
||||
if (Objects.nonNull(dbSpectrumFilePath)) {
|
||||
Map<String, Object> sampleMap = new HashMap<>();
|
||||
|
@ -376,8 +343,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
GardsSampleData gasBg = spectrumAnalysisMapper.findSampleByFilePath(gasBgFilePath);
|
||||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
gasBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, gasBg.getSampleId(), gasBg.getStatus());
|
||||
resultMap.put("gasBg",gasBgMap);
|
||||
if (Objects.nonNull(gasBg)) {
|
||||
gasBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, gasBg.getSampleId(), gasBg.getStatus());
|
||||
resultMap.put("gasBg",gasBgMap);
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
|
||||
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
|
||||
|
@ -385,8 +354,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
GardsSampleData detBg = spectrumAnalysisMapper.findSampleByFilePath(detBgFilePath);
|
||||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
detBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, detBg.getSampleId(), detBg.getStatus());
|
||||
resultMap.put("detBg",detBgMap);
|
||||
if (Objects.nonNull(detBg)) {
|
||||
detBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, detBg.getSampleId(), detBg.getStatus());
|
||||
resultMap.put("detBg",detBgMap);
|
||||
}
|
||||
}
|
||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
|
@ -396,8 +367,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
GardsSampleData qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath);
|
||||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
qcMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, qc.getSampleId(), qc.getStatus());
|
||||
resultMap.put("qc",qcMap);
|
||||
if (Objects.nonNull(qc)) {
|
||||
qcMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, qc.getSampleId(), qc.getStatus());
|
||||
resultMap.put("qc",qcMap);
|
||||
}
|
||||
}
|
||||
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
|
||||
resultMap.put("bProcessed", false);
|
||||
|
@ -467,14 +440,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(pathName);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||
throw new RuntimeException("ftp查询文件内容失败");
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -551,15 +518,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(pathName);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||
result.error500("ftp下对应文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -595,7 +555,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (StringUtils.isBlank(reportPath)){
|
||||
throw new RuntimeException("自动处理程序生成报告不存在!");
|
||||
}
|
||||
String pathName = reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
||||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
|
||||
//连接ftp
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
|
@ -611,16 +571,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
pathName=StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + pathName;
|
||||
ftpClient.changeWorkingDirectory(pathName);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||
throw new RuntimeException("ftp下对应的报告文件不存在");
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
|
@ -665,14 +618,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (StringUtils.isNotBlank(rrrLogInfo.getDbName()) && Objects.nonNull(rrrLogInfo.getSampleId())) {
|
||||
String dbName = rrrLogInfo.getDbName();
|
||||
Integer sampleId = rrrLogInfo.getSampleId();
|
||||
Integer analysisID = null;
|
||||
//GetAnalysisID sample_id
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
if (Objects.nonNull(dbSpectrumFilePath)){
|
||||
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
|
||||
gasFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
|
@ -886,12 +841,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Map<String, List<String>> map = new HashMap<>();
|
||||
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
|
||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||
Integer analysisID = null;
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
}
|
||||
if(StringUtils.isNotBlank(sampleFileName)) {
|
||||
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + sampleFileName;
|
||||
|
@ -955,15 +913,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(pathName);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||
result.error500("ftp下对应的文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -1012,9 +963,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
strBuffer.append(" Acq Real Time: "+acquisition_real_sec+"\n");
|
||||
strBuffer.append(" Acq Live Time: "+acquisition_live_sec+"\n");
|
||||
strBuffer.append("\n");
|
||||
if (Objects.nonNull(inputStream)){
|
||||
inputStream.close();
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(strBuffer.toString());
|
||||
}
|
||||
|
@ -1090,12 +1038,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
|
||||
//判断是否有sampleId和dbName 如果有则说明数据来源DB
|
||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||
Integer analysisID = null;
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
|
||||
gasFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
detFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
|
@ -1239,15 +1190,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
if (StringUtils.isNotBlank(sampleFilePath)){
|
||||
ftpClient.changeWorkingDirectory(sampleFilePath);
|
||||
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
sampleFtpFiles=sampleFtpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||
if (Objects.nonNull(sampleFtpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -1356,15 +1300,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(qcPath);
|
||||
List<FTPFile> qcFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
qcFtpFiles=qcFtpFiles.stream().filter(item -> item.getName().equals(qcFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(qcFtpFiles)){
|
||||
result.error500("ftp下对应的QC文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile qcFtpFile = qcFtpFiles.get(0);
|
||||
if (Objects.nonNull(qcFtpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(qcFtpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(qcFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -1452,6 +1389,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
cacheMap.put("Series", oldScatterSeries);
|
||||
cacheMap.put("fittingPara", fittingParaStr);
|
||||
cacheMap.put("fittingParaToUi", fittingParaToUiStr);
|
||||
cache.put(qcFileName+"-"+userName+"-gamma", cacheMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
}
|
||||
|
@ -1506,15 +1444,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(qcPath);
|
||||
List<FTPFile> qcFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
qcFtpFiles=qcFtpFiles.stream().filter(item -> item.getName().equals(qcFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(qcFtpFiles)){
|
||||
result.error500("ftp下对应的QC文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile qcFtpFile = qcFtpFiles.get(0);
|
||||
if (Objects.nonNull(qcFtpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(qcFtpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(qcFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -1605,6 +1536,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
cacheMap.put("Series", oldScatterSeries);
|
||||
cacheMap.put("fittingPara", fittingParaStr);
|
||||
cacheMap.put("fittingParaToUi", fittingParaToUiStr);
|
||||
cache.put(qcFileName+"-"+userName+"-beta", cacheMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
}
|
||||
|
@ -1655,16 +1587,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(samplePathName);
|
||||
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
sampleFtpFiles = sampleFtpFiles.stream().filter(item-> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||
if (Objects.nonNull(sampleFtpFile)){
|
||||
//获取ftp文件的输入流
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||
//获取ftp文件的输入流
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//ftp文件输入流复制给临时文件
|
||||
|
@ -1809,16 +1734,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(filePath);
|
||||
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
sampleFtpFiles = sampleFtpFiles.stream().filter(item-> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||
if (Objects.nonNull(sampleFtpFile)){
|
||||
//获取ftp文件的输入流
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||
//获取ftp文件的输入流
|
||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//ftp文件输入流复制给临时文件
|
||||
|
@ -2226,6 +2144,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
cacheMap.put("Series", tempPoints);
|
||||
cacheMap.put("fittingPara", fittingParaStr);
|
||||
cacheMap.put("fittingParaToUi", fittingParaToUiStr);
|
||||
cache.put(qcFileName+"-"+userName+"-"+tabName, cacheMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
} else {
|
||||
|
@ -2283,6 +2202,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
cacheMap.put("Series", seriseDataList);
|
||||
cacheMap.put("fittingPara", fittingParaStr);
|
||||
cacheMap.put("fittingParaToUi", fittingParaToUiStr);
|
||||
cache.put(qcFileName+"-"+userName+"-"+tabName, cacheMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
}
|
||||
|
@ -2330,15 +2250,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(qcPathName);
|
||||
List<FTPFile> qcFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
qcFtpFiles=qcFtpFiles.stream().filter(item -> item.getName().equals(qcFileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(qcFtpFiles)){
|
||||
result.error500("ftp下对应的QC文件不存在");
|
||||
return result;
|
||||
}
|
||||
FTPFile qcFtpFile = qcFtpFiles.get(0);
|
||||
if (Objects.nonNull(qcFtpFile)){
|
||||
inputStream = ftpClient.retrieveFileStream(qcFtpFile.getName());
|
||||
inputStream = ftpClient.retrieveFileStream(qcFileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
|
@ -2391,7 +2304,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (CollectionUtils.isNotEmpty(sampleIds)){
|
||||
String dbName = analyseData.getDbNames().get(0);
|
||||
Integer sampleId = sampleIds.get(0);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
if (Objects.nonNull(dbSpectrumFilePath)) {
|
||||
BetaGammaAnalyzeCurrentProcess(analyseData, dbSpectrumFilePath, userName);
|
||||
}
|
||||
|
@ -2401,7 +2315,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
for (int i=0; i<analyseData.getSampleIds().size(); i++) {
|
||||
Integer sampleId = analyseData.getSampleIds().get(i);
|
||||
String dbName = analyseData.getDbNames().get(i);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
m_loadData.put(String.valueOf(sampleId), dbSpectrumFilePath);
|
||||
}
|
||||
BetaGammaAnalyzeAllProcess(m_loadData, analyseData);
|
||||
|
@ -2517,9 +2432,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Override
|
||||
public Result analyseCurrentSpectrum(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//拼接ftp上传临时文件路径
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + JwtUtil.getUserNameByToken(request);
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
//声明一个实体类获取数据库中文件路径
|
||||
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
|
||||
Integer analysisID = null;
|
||||
|
@ -2530,11 +2446,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
} else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
samplePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
|
||||
gasPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
detPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
|
@ -2585,6 +2502,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Override
|
||||
public Result analyseAllSpectrum(List<String> dbNames, List<Integer> sampleIds, List<String> sampleFileNames, List<String> gasFileNames, List<String> detFileNames, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
List<Map<String, Object>> mapList = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(sampleFileNames)) {
|
||||
for (int i=0; i<sampleFileNames.size(); i++) {
|
||||
|
@ -2601,17 +2519,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
} else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
} 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");
|
||||
return result;
|
||||
}
|
||||
//拼接ftp上传临时文件路径
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +JwtUtil.getUserNameByToken(request);
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
|
||||
//判断数据库文件路径是否为空 如果为空 就指向ftp上传文件临时路径
|
||||
String samplePath = path;
|
||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||
|
@ -2700,14 +2619,17 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
// getROILimit(anlyseResultIn);
|
||||
//根据sample文件名称模糊查询sampleId
|
||||
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
Integer analysisID = null;
|
||||
if (anlyseResultIn.getDbName().equals("auto")) {
|
||||
anlyseResultIn.setDbName("RNAUTO");
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(anlyseResultIn.getDbName(), sampleId, "RNAUTO");
|
||||
} else if (anlyseResultIn.getDbName().equals("man")) {
|
||||
anlyseResultIn.setDbName("RNMAN");
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(anlyseResultIn.getDbName(), sampleId, userName);
|
||||
}
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
if (Objects.nonNull(sampleId)) {
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
|
||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
|
||||
}
|
||||
|
@ -2719,7 +2641,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
|
||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr));
|
||||
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2784,7 +2707,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId);
|
||||
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId, userName);
|
||||
Integer idAnalysis = analysis.getIdAnalysis();
|
||||
//获取sample,gas,det三个文件分别对应的beta,gamma数据集合
|
||||
List<GardsCalibrationPairs> calibrationPairsList = getCalibrationPairs(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
|
||||
|
@ -2897,28 +2820,35 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Map<String, Object> betaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-beta");
|
||||
List<SeriseData> betaList = new LinkedList<>();
|
||||
List<String> betaFittingPara = new LinkedList<>();
|
||||
List<String> betaFittingParaToUi = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(betaMap)) {
|
||||
betaList = (List<SeriseData>)betaMap.get("Series");
|
||||
betaFittingPara = (List<String>) betaMap.get("fittingPara");
|
||||
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
|
||||
}
|
||||
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
|
||||
Map<String, Object> gammaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-gamma");
|
||||
List<SeriseData> gammaList = new LinkedList<>();
|
||||
List<String> gammaFittingPara = new LinkedList<>();
|
||||
List<String> gammaFittingParaToUi = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(gammaMap)) {
|
||||
gammaList = (List<SeriseData>)gammaMap.get("Series");
|
||||
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
|
||||
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
Integer analysisID = null;
|
||||
if (anlyseResultIn.getDbName().equals("auto")) {
|
||||
anlyseResultIn.setDbName("RNAUTO");
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(anlyseResultIn.getDbName(), sampleId, "RNAUTO");
|
||||
} else if (anlyseResultIn.getDbName().equals("man")) {
|
||||
anlyseResultIn.setDbName("RNMAN");
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(anlyseResultIn.getDbName(), sampleId, userName);
|
||||
}
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
if (Objects.nonNull(sampleId)) {
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
|
||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
|
||||
}
|
||||
|
@ -2930,7 +2860,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
|
||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr));
|
||||
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2942,7 +2873,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
//处理数据 获取对应的channel/energy值
|
||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
||||
//分析文件内容
|
||||
analyzePHDFile(anlyseResultIn, betaFittingPara, gammaFittingPara);
|
||||
analyzeSavePHDFile(anlyseResultIn, betaFittingPara, gammaFittingPara, betaFittingParaToUi, gammaFittingParaToUi);
|
||||
|
||||
// 返回需要Save的数据
|
||||
return anlyseResultIn;
|
||||
|
@ -3002,6 +2933,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeResultsDtos.add(xeResultsDto);
|
||||
}
|
||||
|
||||
result.put("gammaCalibrationSCE", anlyseResultIn.getGammaCalibrationSCE());
|
||||
result.put("gammaCalibrationSEC", anlyseResultIn.getGammaCalibrationSEC());
|
||||
result.put("gammaCalibrationGCE", anlyseResultIn.getGammaCalibrationGCE());
|
||||
result.put("gammaCalibrationGEC", anlyseResultIn.getGammaCalibrationGEC());
|
||||
result.put("gammaCalibrationDCE", anlyseResultIn.getGammaCalibrationDCE());
|
||||
result.put("gammaCalibrationDEC", anlyseResultIn.getGammaCalibrationDEC());
|
||||
result.put("betaCalibrationSCE", anlyseResultIn.getBetaCalibrationSCE());
|
||||
result.put("betaCalibrationSEC", anlyseResultIn.getBetaCalibrationSEC());
|
||||
result.put("betaCalibrationGCE", anlyseResultIn.getBetaCalibrationGCE());
|
||||
result.put("betaCalibrationGEC", anlyseResultIn.getBetaCalibrationGEC());
|
||||
result.put("betaCalibrationDCE", anlyseResultIn.getBetaCalibrationDCE());
|
||||
result.put("betaCalibrationDEC", anlyseResultIn.getBetaCalibrationDEC());
|
||||
result.put("roiChannelsS", roiChannelsDtosS);
|
||||
result.put("roiChannelsD", roiChannelsDtosD);
|
||||
result.put("roiChannelsG", roiChannelsDtosG);
|
||||
|
@ -3032,8 +2975,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
// 解析文件,生成导出数据
|
||||
Map<String, Object> analyze = shiftSaveData(getSaveData(anlyseResultIn));
|
||||
// 转换能谱结构数据
|
||||
//EnergySpectrumStruct energySpectrumStruct = phdFileUtil.analyzeFileSourceData(null, null);
|
||||
EnergySpectrumStruct energySpectrumStruct = new EnergySpectrumStruct();
|
||||
EnergySpectrumStruct energySpectrumStruct = phdFileUtil.analyzeFileSourceData(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
ESStructDto esStructDto = new ESStructDto();
|
||||
ClassUtil.copyProperties(energySpectrumStruct, esStructDto);
|
||||
analyze.putAll(BeanUtil.beanToMap(esStructDto));
|
||||
|
@ -3047,7 +2989,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
||||
// 解析文件,生成导出数据
|
||||
Map<String, Object> analyze = exportData(anlyseResultIn);
|
||||
|
||||
// 解析生成Html字符串并导出为Html文件
|
||||
String result = parseHtml(analyze);
|
||||
PrintWriter writer = null;
|
||||
|
@ -3086,6 +3027,23 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
List<ROIChannelsDto> roiChannelsDtosG = (List<ROIChannelsDto>) analyze.get("roiChannelsG");
|
||||
List<ROIResultsDto> roiResultsDtos = (List<ROIResultsDto>) analyze.get("roiResults");
|
||||
List<XeResultsDto> xeResultsDtos = (List<XeResultsDto>) analyze.get("xeResults");
|
||||
GardsCalibrationSpectrum gammaCalibrationSCE = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationSCE");
|
||||
GardsCalibrationSpectrum gammaCalibrationSEC = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationSEC");
|
||||
GardsCalibrationSpectrum gammaCalibrationGCE = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationGCE");
|
||||
GardsCalibrationSpectrum gammaCalibrationGEC = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationGEC");
|
||||
GardsCalibrationSpectrum gammaCalibrationDCE = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationDCE");
|
||||
GardsCalibrationSpectrum gammaCalibrationDEC = (GardsCalibrationSpectrum) analyze.get("gammaCalibrationDEC");
|
||||
|
||||
GardsCalibrationSpectrum betaCalibrationSCE = (GardsCalibrationSpectrum) analyze.get("betaCalibrationSCE");
|
||||
GardsCalibrationSpectrum betaCalibrationSEC = (GardsCalibrationSpectrum) analyze.get("betaCalibrationSEC");
|
||||
GardsCalibrationSpectrum betaCalibrationGCE = (GardsCalibrationSpectrum) analyze.get("betaCalibrationGCE");
|
||||
GardsCalibrationSpectrum betaCalibrationGEC = (GardsCalibrationSpectrum) analyze.get("betaCalibrationGEC");
|
||||
GardsCalibrationSpectrum betaCalibrationDCE = (GardsCalibrationSpectrum) analyze.get("betaCalibrationDCE");
|
||||
GardsCalibrationSpectrum betaCalibrationDEC = (GardsCalibrationSpectrum) analyze.get("betaCalibrationDEC");
|
||||
|
||||
analyze.put("sampleNewCalibration", calibrations(gammaCalibrationSCE, gammaCalibrationSEC, betaCalibrationSCE, betaCalibrationSEC));
|
||||
analyze.put("gasNewCalibration", calibrations(gammaCalibrationGCE, gammaCalibrationGEC, betaCalibrationGCE, betaCalibrationGEC));
|
||||
analyze.put("detNewCalibration", calibrations(gammaCalibrationDCE, gammaCalibrationDEC, betaCalibrationDCE, betaCalibrationDEC));
|
||||
analyze.put("sampleRoi", roiChannels(roiChannelsDtosS));
|
||||
analyze.put("detRoi", roiChannels(roiChannelsDtosD));
|
||||
analyze.put("gasRoi", roiChannels(roiChannelsDtosG));
|
||||
|
@ -3099,9 +3057,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
// 正则表达式,匹配${}中的内容
|
||||
String regex = "\\$\\{([^}]+)}";
|
||||
List<String> newLines = new ArrayList<>();
|
||||
List<String> list = ListUtil.toList("sampleRoi", "detRoi", "gasRoi","grossRoi",
|
||||
List<String> list = ListUtil.toList("sampleNewCalibration","sampleRoi", "detNewCalibration", "detRoi", "gasNewCalibration", "gasRoi","grossRoi",
|
||||
"netRoi", "concRoi", "resultSummary");
|
||||
List<String> skip = ListUtil.toList("${sampleRoi}", "${detRoi}", "${gasRoi}",
|
||||
List<String> skip = ListUtil.toList("${sampleNewCalibration}","${sampleRoi}", "${detNewCalibration}", "${detRoi}", "${gasNewCalibration}", "${gasRoi}",
|
||||
"${grossRoi}", "${netRoi}", "${concRoi}", "${resultSummary}");
|
||||
for (String line : lines) {
|
||||
List<String> fieldNames = ReUtil.findAllGroup1(regex, line);
|
||||
|
@ -3138,6 +3096,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> calibrations(GardsCalibrationSpectrum gammaCalibrationCE,GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) {
|
||||
int min = 79;
|
||||
String space = StrUtil.SPACE;
|
||||
List<String> calibrationStrs = new ArrayList<>();
|
||||
String betaCH = " CH(x) = ("+betaCalibrationEC.getCoeff1()+")+("+betaCalibrationEC.getCoeff2()+")*x+("+betaCalibrationEC.getCoeff3()+")x*x";
|
||||
String gammaCH = " CH(x) = ("+gammaCalibrationEC.getCoeff1()+")+("+gammaCalibrationEC.getCoeff2()+")*x+("+gammaCalibrationEC.getCoeff3()+")x*x";
|
||||
String betaE = " E(x) = ("+betaCalibrationCE.getCoeff1()+")+("+betaCalibrationCE.getCoeff2()+")*x+("+betaCalibrationCE.getCoeff3()+")x*x";
|
||||
String gammaE = " E(x) = ("+gammaCalibrationCE.getCoeff1()+")+("+gammaCalibrationCE.getCoeff2()+")*x+("+gammaCalibrationCE.getCoeff3()+")x*x";
|
||||
String calibrationCHStr = StrUtil.padAfter(betaCH, min, space) + StrUtil.padAfter(gammaCH, min, space);
|
||||
String calibrationEStr = StrUtil.padAfter(betaE, min, space) + StrUtil.padAfter(gammaE, min, space);
|
||||
calibrationStrs.add(calibrationCHStr);
|
||||
calibrationStrs.add(calibrationEStr);
|
||||
return calibrationStrs;
|
||||
}
|
||||
|
||||
private List<String> roiChannels(List<ROIChannelsDto> roiChannels){
|
||||
int min = 49;
|
||||
String space = StrUtil.SPACE;
|
||||
|
@ -3323,6 +3296,257 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
}
|
||||
|
||||
public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi) {
|
||||
//根据文件路径 文件名称获取对应的临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
//加载dll工具库
|
||||
System.loadLibrary("ReadPHDFile");
|
||||
//调用动态库解析文件
|
||||
|
||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||
BgAnalyseResult bgAnalyseResult = null;
|
||||
if (anlyseResultIn.isCheckSample() && anlyseResultIn.isCheckGas() && anlyseResultIn.isCheckDet()) {
|
||||
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
|
||||
} else {
|
||||
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
|
||||
}
|
||||
List<GardsXeResults> xeResultsSpectrumList = new LinkedList<>();
|
||||
GardsXeResults xe131m = new GardsXeResults();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(bgAnalyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(bgAnalyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(bgAnalyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(bgAnalyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(anlyseResultIn.getXe131mFlag());
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResults xe133 = new GardsXeResults();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(bgAnalyseResult.Xe133_con);
|
||||
xe133.setConcErr(bgAnalyseResult.Xe133_uncer);
|
||||
xe133.setLc(bgAnalyseResult.LC_Xe133);
|
||||
xe133.setMdc(bgAnalyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(anlyseResultIn.getXe133Flag());
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResults xe133m = new GardsXeResults();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(bgAnalyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(bgAnalyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(bgAnalyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(bgAnalyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(anlyseResultIn.getXe133mFlag());
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResults xe135 = new GardsXeResults();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(bgAnalyseResult.Xe135_con);
|
||||
xe135.setConcErr(bgAnalyseResult.Xe135_uncer);
|
||||
xe135.setLc(bgAnalyseResult.LC_Xe135);
|
||||
xe135.setMdc(bgAnalyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
anlyseResultIn.setXeData(xeResultsSpectrumList);
|
||||
|
||||
if (anlyseResultIn.isBGammaEnergyValidSample()) {
|
||||
GardsCalibrationSpectrum gammaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationSCE.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
|
||||
gammaCalibrationSCE.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
|
||||
gammaCalibrationSCE.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum gammaCalibrationSEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationSEC.setCoeff1(Double.valueOf(gammaFittingParaToUi.get(0)));
|
||||
gammaCalibrationSEC.setCoeff2(Double.valueOf(gammaFittingParaToUi.get(1)));
|
||||
gammaCalibrationSEC.setCoeff3(Double.valueOf(gammaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setGammaCalibrationSCE(gammaCalibrationSCE);
|
||||
anlyseResultIn.setGammaCalibrationSEC(gammaCalibrationSEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum gammaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationSCE.setCoeff1(bgAnalyseResult.s_g_fitting_c_e.get(0));
|
||||
gammaCalibrationSCE.setCoeff2(bgAnalyseResult.s_g_fitting_c_e.get(1));
|
||||
gammaCalibrationSCE.setCoeff3(bgAnalyseResult.s_g_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum gammaCalibrationSEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationSEC.setCoeff1(bgAnalyseResult.s_g_fitting_e_c.get(0));
|
||||
gammaCalibrationSEC.setCoeff2(bgAnalyseResult.s_g_fitting_e_c.get(1));
|
||||
gammaCalibrationSEC.setCoeff3(bgAnalyseResult.s_g_fitting_e_c.get(2));
|
||||
anlyseResultIn.setGammaCalibrationSCE(gammaCalibrationSCE);
|
||||
anlyseResultIn.setGammaCalibrationSEC(gammaCalibrationSEC);
|
||||
}
|
||||
if (anlyseResultIn.isBGammaEnergyValidGas()) {
|
||||
GardsCalibrationSpectrum gammaCalibrationGCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationGCE.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
|
||||
gammaCalibrationGCE.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
|
||||
gammaCalibrationGCE.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum gammaCalibrationGEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationGEC.setCoeff1(Double.valueOf(gammaFittingParaToUi.get(0)));
|
||||
gammaCalibrationGEC.setCoeff2(Double.valueOf(gammaFittingParaToUi.get(1)));
|
||||
gammaCalibrationGEC.setCoeff3(Double.valueOf(gammaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setGammaCalibrationGCE(gammaCalibrationGCE);
|
||||
anlyseResultIn.setGammaCalibrationGEC(gammaCalibrationGEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum gammaCalibrationGCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationGCE.setCoeff1(bgAnalyseResult.g_g_fitting_c_e.get(0));
|
||||
gammaCalibrationGCE.setCoeff2(bgAnalyseResult.g_g_fitting_c_e.get(1));
|
||||
gammaCalibrationGCE.setCoeff3(bgAnalyseResult.g_g_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum gammaCalibrationGEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationGEC.setCoeff1(bgAnalyseResult.g_g_fitting_e_c.get(0));
|
||||
gammaCalibrationGEC.setCoeff2(bgAnalyseResult.g_g_fitting_e_c.get(1));
|
||||
gammaCalibrationGEC.setCoeff3(bgAnalyseResult.g_g_fitting_e_c.get(2));
|
||||
anlyseResultIn.setGammaCalibrationGCE(gammaCalibrationGCE);
|
||||
anlyseResultIn.setGammaCalibrationGEC(gammaCalibrationGEC);
|
||||
}
|
||||
if (anlyseResultIn.isBGammaEnergyValidDet()) {
|
||||
GardsCalibrationSpectrum gammaCalibrationDCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationDCE.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
|
||||
gammaCalibrationDCE.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
|
||||
gammaCalibrationDCE.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum gammaCalibrationDEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationDEC.setCoeff1(Double.valueOf(gammaFittingParaToUi.get(0)));
|
||||
gammaCalibrationDEC.setCoeff2(Double.valueOf(gammaFittingParaToUi.get(1)));
|
||||
gammaCalibrationDEC.setCoeff3(Double.valueOf(gammaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setGammaCalibrationDCE(gammaCalibrationDCE);
|
||||
anlyseResultIn.setGammaCalibrationDEC(gammaCalibrationDEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum gammaCalibrationDCE = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationDCE.setCoeff1(bgAnalyseResult.d_g_fitting_c_e.get(0));
|
||||
gammaCalibrationDCE.setCoeff2(bgAnalyseResult.d_g_fitting_c_e.get(1));
|
||||
gammaCalibrationDCE.setCoeff3(bgAnalyseResult.d_g_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum gammaCalibrationDEC = new GardsCalibrationSpectrum();
|
||||
gammaCalibrationDEC.setCoeff1(bgAnalyseResult.d_g_fitting_e_c.get(0));
|
||||
gammaCalibrationDEC.setCoeff2(bgAnalyseResult.d_g_fitting_e_c.get(1));
|
||||
gammaCalibrationDEC.setCoeff3(bgAnalyseResult.d_g_fitting_e_c.get(2));
|
||||
anlyseResultIn.setGammaCalibrationDCE(gammaCalibrationDCE);
|
||||
anlyseResultIn.setGammaCalibrationDEC(gammaCalibrationDEC);
|
||||
}
|
||||
|
||||
if (anlyseResultIn.isBBetaEnergyValidSample()) {
|
||||
GardsCalibrationSpectrum betaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationSCE.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
|
||||
betaCalibrationSCE.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
|
||||
betaCalibrationSCE.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum betaCalibrationSEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationSEC.setCoeff1(Double.valueOf(betaFittingParaToUi.get(0)));
|
||||
betaCalibrationSEC.setCoeff2(Double.valueOf(betaFittingParaToUi.get(1)));
|
||||
betaCalibrationSEC.setCoeff3(Double.valueOf(betaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setBetaCalibrationSCE(betaCalibrationSCE);
|
||||
anlyseResultIn.setBetaCalibrationSEC(betaCalibrationSEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum betaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationSCE.setCoeff1(bgAnalyseResult.s_b_fitting_c_e.get(0));
|
||||
betaCalibrationSCE.setCoeff2(bgAnalyseResult.s_b_fitting_c_e.get(1));
|
||||
betaCalibrationSCE.setCoeff3(bgAnalyseResult.s_b_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum betaCalibrationSEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationSEC.setCoeff1(bgAnalyseResult.s_b_fitting_e_c.get(0));
|
||||
betaCalibrationSEC.setCoeff2(bgAnalyseResult.s_b_fitting_e_c.get(1));
|
||||
betaCalibrationSEC.setCoeff3(bgAnalyseResult.s_b_fitting_e_c.get(2));
|
||||
anlyseResultIn.setBetaCalibrationSCE(betaCalibrationSCE);
|
||||
anlyseResultIn.setBetaCalibrationSEC(betaCalibrationSEC);
|
||||
}
|
||||
if (anlyseResultIn.isBBetaEnergyValidGas()) {
|
||||
GardsCalibrationSpectrum betaCalibrationGCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationGCE.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
|
||||
betaCalibrationGCE.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
|
||||
betaCalibrationGCE.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum betaCalibrationGEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationGEC.setCoeff1(Double.valueOf(betaFittingParaToUi.get(0)));
|
||||
betaCalibrationGEC.setCoeff2(Double.valueOf(betaFittingParaToUi.get(1)));
|
||||
betaCalibrationGEC.setCoeff3(Double.valueOf(betaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setBetaCalibrationGCE(betaCalibrationGCE);
|
||||
anlyseResultIn.setBetaCalibrationGEC(betaCalibrationGEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum betaCalibrationGCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationGCE.setCoeff1(bgAnalyseResult.g_b_fitting_c_e.get(0));
|
||||
betaCalibrationGCE.setCoeff2(bgAnalyseResult.g_b_fitting_c_e.get(1));
|
||||
betaCalibrationGCE.setCoeff3(bgAnalyseResult.g_b_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum betaCalibrationGEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationGEC.setCoeff1(bgAnalyseResult.g_b_fitting_e_c.get(0));
|
||||
betaCalibrationGEC.setCoeff2(bgAnalyseResult.g_b_fitting_e_c.get(1));
|
||||
betaCalibrationGEC.setCoeff3(bgAnalyseResult.g_b_fitting_e_c.get(2));
|
||||
anlyseResultIn.setBetaCalibrationGCE(betaCalibrationGCE);
|
||||
anlyseResultIn.setBetaCalibrationGEC(betaCalibrationGEC);
|
||||
}
|
||||
if (anlyseResultIn.isBBetaEnergyValidDet()) {
|
||||
GardsCalibrationSpectrum betaCalibrationDCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationDCE.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
|
||||
betaCalibrationDCE.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
|
||||
betaCalibrationDCE.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
|
||||
GardsCalibrationSpectrum betaCalibrationDEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationDEC.setCoeff1(Double.valueOf(betaFittingParaToUi.get(0)));
|
||||
betaCalibrationDEC.setCoeff2(Double.valueOf(betaFittingParaToUi.get(1)));
|
||||
betaCalibrationDEC.setCoeff3(Double.valueOf(betaFittingParaToUi.get(2)));
|
||||
anlyseResultIn.setBetaCalibrationDCE(betaCalibrationDCE);
|
||||
anlyseResultIn.setBetaCalibrationDEC(betaCalibrationDEC);
|
||||
} else {
|
||||
GardsCalibrationSpectrum betaCalibrationDCE = new GardsCalibrationSpectrum();
|
||||
betaCalibrationDCE.setCoeff1(bgAnalyseResult.d_b_fitting_c_e.get(0));
|
||||
betaCalibrationDCE.setCoeff2(bgAnalyseResult.d_b_fitting_c_e.get(1));
|
||||
betaCalibrationDCE.setCoeff3(bgAnalyseResult.d_b_fitting_c_e.get(2));
|
||||
GardsCalibrationSpectrum betaCalibrationDEC = new GardsCalibrationSpectrum();
|
||||
betaCalibrationDEC.setCoeff1(bgAnalyseResult.d_b_fitting_e_c.get(0));
|
||||
betaCalibrationDEC.setCoeff2(bgAnalyseResult.d_b_fitting_e_c.get(1));
|
||||
betaCalibrationDEC.setCoeff3(bgAnalyseResult.d_b_fitting_e_c.get(2));
|
||||
anlyseResultIn.setBetaCalibrationDCE(betaCalibrationDCE);
|
||||
anlyseResultIn.setBetaCalibrationDEC(betaCalibrationDEC);
|
||||
}
|
||||
|
||||
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
|
||||
for (int i=0; i<bgAnalyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||
roiChannels.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
|
||||
roiChannels.setRoi(i+1);
|
||||
roiChannels.setBChanStart(bgAnalyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
roiChannels.setBChanStop(bgAnalyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
roiChannels.setGChanStart(bgAnalyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
roiChannels.setGChanStop(bgAnalyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
roiChannelsSpectrumList.add(roiChannels);
|
||||
}
|
||||
for (int i=0; i<bgAnalyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||
roiChannels.setDataType(DataTypeAbbr.GASBKPHD.getType());
|
||||
roiChannels.setRoi(i+1);
|
||||
roiChannels.setBChanStart(bgAnalyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
roiChannels.setBChanStop(bgAnalyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
roiChannels.setGChanStart(bgAnalyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
roiChannels.setGChanStop(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
roiChannelsSpectrumList.add(roiChannels);
|
||||
}
|
||||
for (int i=0; i<bgAnalyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||
roiChannels.setDataType(DataTypeAbbr.DETBKPHD.getType());
|
||||
roiChannels.setRoi(i+1);
|
||||
roiChannels.setBChanStart(bgAnalyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
roiChannels.setBChanStop(bgAnalyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
roiChannels.setGChanStart(bgAnalyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
roiChannels.setGChanStop(bgAnalyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
roiChannelsSpectrumList.add(roiChannels);
|
||||
}
|
||||
anlyseResultIn.setRoiChannelsSpectrumList(roiChannelsSpectrumList);
|
||||
bgAnalyseResult.LC.add(0, 0.0);
|
||||
bgAnalyseResult.MDC.add(0, 0.0);
|
||||
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
|
||||
for (int i=0; i<bgAnalyseResult.s_roi_cts.size(); i++) {
|
||||
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
|
||||
roiResults.setRoi(i+1);
|
||||
roiResults.setLc(bgAnalyseResult.LC.get(i));
|
||||
roiResults.setSGross(bgAnalyseResult.s_roi_cts.get(i));
|
||||
roiResults.setGGross(bgAnalyseResult.g_roi_cts.get(i));
|
||||
roiResults.setBGross(bgAnalyseResult.d_roi_cts.get(i));
|
||||
roiResults.setSNet(bgAnalyseResult.s_deduct_d_cts.get((i+1)*3));
|
||||
roiResults.setGNet(bgAnalyseResult.g_deduct_d_cts.get((i+1)*3));
|
||||
roiResults.setNet(bgAnalyseResult.ROI_net_coutns.get(i));
|
||||
roiResults.setNetErr(bgAnalyseResult.ROI_net_coutns_err.get(i));
|
||||
roiResults.setConc(bgAnalyseResult.ROI_con_uncer.get(i));
|
||||
roiResults.setConcErr(bgAnalyseResult.ROI_con_uncer_err.get(i));
|
||||
roiResults.setMdc(bgAnalyseResult.MDC.get(i));
|
||||
if(bgAnalyseResult.ROI_con_uncer.get(i)>bgAnalyseResult.MDC.get(i)) {
|
||||
roiResults.setNidFlag(1);
|
||||
} else {
|
||||
roiResults.setNidFlag(0);
|
||||
}
|
||||
roiResultsSpectrumList.add(roiResults);
|
||||
}
|
||||
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
||||
}
|
||||
|
||||
public void analyzePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara) {
|
||||
//根据文件路径 文件名称获取对应的临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
|
@ -3850,6 +4074,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return xeResultsList;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public boolean OriginalDataStore(String filePath, String fileName, String filePathName, String userName) {
|
||||
//根据新的文件路径名称查询数据是否存在
|
||||
GardsSampleData isExist = spectrumAnalysisMapper.findSampleByFile(filePathName);
|
||||
|
@ -3873,18 +4098,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
//切换文件路径
|
||||
ftpClient.changeWorkingDirectory(filePath);
|
||||
//获取路径下所有文件信息
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
if (CollectionUtils.isNotEmpty(ftpFiles)){
|
||||
//根据文件名称 分别获取 sample gas det文件
|
||||
List<FTPFile> files = ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(files)){
|
||||
FTPFile ftpFile = files.get(0);
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
}
|
||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -3893,7 +4111,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(ftpClient)){
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
if (inputStream != null){
|
||||
if (Objects.nonNull(inputStream)){
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user