feat:自建台站view log

This commit is contained in:
nieziyan 2024-08-06 18:23:21 +08:00
parent 4ddf2f2b46
commit 979f24a10c
6 changed files with 90 additions and 10 deletions

View File

@ -2700,7 +2700,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
if (middleData.sample_Type.equals(SystemType.PARTICULATE.getType())) { if (middleData.sample_Type.equals(SystemType.PARTICULATE.getType())) {
strBuffer.append(" (Particulates Version) "); strBuffer.append(" (Particulates Version) ");
} else if (middleData.sample_Type.equals(SystemType.GAMMA.getType())) { } else if (StrUtil.equalsAny(middleData.sample_Type, SystemType.GAMMA.getType(), SystemType.SELFSTATION.getType())) {
strBuffer.append(" (Noble Gas Version) "); strBuffer.append(" (Noble Gas Version) ");
} }
//换行 //换行

View File

@ -414,4 +414,16 @@ public class SelfStationController {
public Result<?> viewRRR(@RequestBody RRRLogInfo rrrLogInfo, HttpServletRequest request) { public Result<?> viewRRR(@RequestBody RRRLogInfo rrrLogInfo, HttpServletRequest request) {
return selfStationService.viewRRR(rrrLogInfo, request); return selfStationService.viewRRR(rrrLogInfo, request);
} }
@GetMapping("viewAutomaticAnalysisLog")
@ApiOperation(value = "查看Automatic Analysis Log页面数据", notes = "查看Automatic Analysis Log页面数据")
public Result<?> viewAutomaticAnalysisLog(Integer sampleId) {
return selfStationService.viewAutomaticAnalysisLog(sampleId);
}
@GetMapping("viewBGLogViewer")
@ApiOperation(value = "查看BG Log Viewer数据", notes = "查看BG Log Viewer数据")
public Result<?> viewBGLogViewer(String sampleFileName, HttpServletRequest request) {
return selfStationService.viewBGLogViewer(sampleFileName, request);
}
} }

View File

@ -42,6 +42,8 @@ public interface SpectrumAnalysisMapper {
GardsAnalyses viewARRSelf(@Param(value = "sampleId") Integer sampleId); GardsAnalyses viewARRSelf(@Param(value = "sampleId") Integer sampleId);
GardsAnalyses viewLogSelf(@Param(value = "sampleId") Integer sampleId);
String viewRRR(@Param(value = "sampleId") Integer sampleId); String viewRRR(@Param(value = "sampleId") Integer sampleId);
GardsSampleDataSpectrum getSampleData(@Param(value = "sampleId") Integer sampleId); GardsSampleDataSpectrum getSampleData(@Param(value = "sampleId") Integer sampleId);

View File

@ -234,6 +234,10 @@
SELECT IDANALYSIS, REPORT_PAHT AS reportPath FROM RNAUTO.GARDS_ANALYSES where SAMPLE_ID = #{sampleId} SELECT IDANALYSIS, REPORT_PAHT AS reportPath FROM RNAUTO.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
</select> </select>
<select id="viewLogSelf" resultType="org.jeecg.modules.base.entity.rnauto.GardsAnalyses">
SELECT IDANALYSIS, LOG_PATH AS logPath FROM RNAUTO.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
</select>
<select id="viewRRR" resultType="java.lang.String"> <select id="viewRRR" resultType="java.lang.String">
SELECT REPORT_PAHT FROM RNMAN.GARDS_ANALYSES where SAMPLE_ID = #{sampleId} SELECT REPORT_PAHT FROM RNMAN.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
</select> </select>

View File

@ -136,4 +136,8 @@ public interface ISelfStationService {
Result<?> viewARR(Integer sampleId, HttpServletResponse response); Result<?> viewARR(Integer sampleId, HttpServletResponse response);
Result<?> viewRRR(RRRLogInfo rrrLogInfo, HttpServletRequest request); Result<?> viewRRR(RRRLogInfo rrrLogInfo, HttpServletRequest request);
Result<?> viewAutomaticAnalysisLog(Integer sampleId);
Result<?> viewBGLogViewer(String sampleFileName, HttpServletRequest request);
} }

View File

@ -5208,7 +5208,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
@DS("ora") @DS("ora")
public Result<?> viewARR(Integer sampleId, HttpServletResponse response) { public Result<?> viewARR(Integer sampleId, HttpServletResponse response) {
GardsAnalyses analyses = spectrumAnalysisMapper.viewARRSelf(sampleId); GardsAnalyses analyses = spectrumAnalysisMapper.viewARRSelf(sampleId);
Map<String, List<String>> result = new HashMap<>(); Map<String, String> result = new HashMap<>();
if (ObjectUtil.isNull(analyses)) if (ObjectUtil.isNull(analyses))
return Result.error("The automatic handler generated report does not exist"); return Result.error("The automatic handler generated report does not exist");
Integer idAnalysis = analyses.getIdAnalysis(); Integer idAnalysis = analyses.getIdAnalysis();
@ -5218,14 +5218,14 @@ public class SelfStationServiceImpl implements ISelfStationService {
reportPath = rootPath + saveFilePath + StrUtil.SLASH + reportPath + FileTypeEnum.arr.getType(); reportPath = rootPath + saveFilePath + StrUtil.SLASH + reportPath + FileTypeEnum.arr.getType();
if (!FileUtil.exist(reportPath)) if (!FileUtil.exist(reportPath))
return Result.error("The automatic handler generated report does not exist"); return Result.error("The automatic handler generated report does not exist");
result.put("Beta", FileUtil.readUtf8Lines(reportPath)); result.put("Beta", FileUtil.readUtf8String(reportPath));
List<GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis); List<GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
for (GardsAnalysisRoi analysisRoi : analysisRois) { for (GardsAnalysisRoi analysisRoi : analysisRois) {
Integer roiNum = analysisRoi.getRoiNum(); Integer roiNum = analysisRoi.getRoiNum();
String roiReportPath = analysisRoi.getReportPath(); String roiReportPath = analysisRoi.getReportPath();
roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType(); roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType();
if (!FileUtil.exist(roiReportPath)) continue; if (!FileUtil.exist(roiReportPath)) continue;
result.put("Gamma_ROI_" + roiNum, FileUtil.readUtf8Lines(roiReportPath)); result.put("Gamma_ROI_" + roiNum, FileUtil.readUtf8String(roiReportPath));
} }
return Result.OK(result); return Result.OK(result);
} }
@ -5233,12 +5233,12 @@ public class SelfStationServiceImpl implements ISelfStationService {
@Override @Override
public Result<?> viewRRR(RRRLogInfo rrrLogInfo, HttpServletRequest request) { public Result<?> viewRRR(RRRLogInfo rrrLogInfo, HttpServletRequest request) {
String userName = JwtUtil.getUserNameByToken(request); String userName = JwtUtil.getUserNameByToken(request);
Map<String, List<String>> result = new HashMap<>(); Map<String, String> result = new HashMap<>();
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache(); Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData selfStationData = selfCache.getIfPresent(rrrLogInfo.getSampleFileName() + StringPool.DASH + userName); SelfStationData selfStationData = selfCache.getIfPresent(rrrLogInfo.getSampleFileName() + StringPool.DASH + userName);
if (ObjectUtil.isNull(selfStationData)) if (ObjectUtil.isNull(selfStationData))
return Result.error("Please select the parse file first!"); return Result.error("Please select the parse file first!");
// TODO BetaDataFile赋值后 开注释 // TODO BetaDataFile赋值后 开注释
// 生成Beta 报告内容 // 生成Beta 报告内容
/*BetaDataFile betaDataFile = selfStationData.getBetaDataFile(); /*BetaDataFile betaDataFile = selfStationData.getBetaDataFile();
if (ObjectUtil.isNull(betaDataFile)) if (ObjectUtil.isNull(betaDataFile))
@ -5251,10 +5251,10 @@ public class SelfStationServiceImpl implements ISelfStationService {
PHDFile phd2 = sampleVueData.getROITwoPHDFile(); PHDFile phd2 = sampleVueData.getROITwoPHDFile();
PHDFile phd3 = sampleVueData.getROIThreePHDFile(); PHDFile phd3 = sampleVueData.getROIThreePHDFile();
PHDFile phd4 = sampleVueData.getROIFourPHDFile(); PHDFile phd4 = sampleVueData.getROIFourPHDFile();
List<String> reportContent1 = gammaFileUtil.GetReportContent(phd1, userName, "log"); String reportContent1 = gammaFileUtil.GetReportContent(phd1, userName, false,"log");
List<String> reportContent2 = gammaFileUtil.GetReportContent(phd2, userName, "log"); String reportContent2 = gammaFileUtil.GetReportContent(phd2, userName, false,"log");
List<String> reportContent3 = gammaFileUtil.GetReportContent(phd3, userName, "log"); String reportContent3 = gammaFileUtil.GetReportContent(phd3, userName, false,"log");
List<String> reportContent4 = gammaFileUtil.GetReportContent(phd4, userName, "log"); String reportContent4 = gammaFileUtil.GetReportContent(phd4, userName, false,"log");
result.put("Gamma_ROI_1", reportContent1); result.put("Gamma_ROI_1", reportContent1);
result.put("Gamma_ROI_2", reportContent2); result.put("Gamma_ROI_2", reportContent2);
result.put("Gamma_ROI_3", reportContent3); result.put("Gamma_ROI_3", reportContent3);
@ -5262,6 +5262,64 @@ public class SelfStationServiceImpl implements ISelfStationService {
return Result.OK(result); return Result.OK(result);
} }
@Override
@DS("ora")
public Result<?> viewAutomaticAnalysisLog(Integer sampleId) {
GardsAnalyses analyses = spectrumAnalysisMapper.viewLogSelf(sampleId);
Map<String, String> result = new HashMap<>();
if (ObjectUtil.isNull(analyses))
return Result.error("The log generated by the automatic processor does not exist");
Integer idAnalysis = analyses.getIdAnalysis();
String logPath = analyses.getLogPath();
String rootPath = spectrumPathProperties.getRootPath();
String logPathPrefix = spectrumPathProperties.getLogPath();
logPath = rootPath + logPathPrefix + StrUtil.SLASH + logPath;
if (!FileUtil.exist(logPath))
return Result.error("The log generated by the automatic processor does not exist");
result.put("Beta", FileUtil.readUtf8String(logPath));
List<GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
for (GardsAnalysisRoi analysisRoi : analysisRois) {
Integer roiNum = analysisRoi.getRoiNum();
String roiLogPath = analysisRoi.getLogPath();
roiLogPath = rootPath + logPathPrefix + StrUtil.SLASH + roiLogPath;
if (!FileUtil.exist(roiLogPath)) continue;
result.put("Gamma_ROI_" + roiNum, FileUtil.readUtf8String(roiLogPath));
}
return Result.OK(result);
}
@Override
public Result<?> viewBGLogViewer(String sampleFileName, HttpServletRequest request) {
String userName = JwtUtil.getUserNameByToken(request);
Map<String, String> result = new HashMap<>();
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
if (ObjectUtil.isNull(selfStationData))
return Result.error("Please select the parse file first!");
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
// 生成Beta日志内容
String logFilePath = parameterProperties.getLogFilePath();
String formatDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd");
String replace = StrUtil.replace(sampleFileName, "PHD", "log");
logFilePath = logFilePath + StrUtil.SLASH + formatDate + StrUtil.SLASH + replace;
if (FileUtil.exist(logFilePath))
result.put("Beta", FileUtil.readUtf8String(logFilePath));
// 生成4个Gamma ROI日志内容
PHDFile phd1 = sampleVueData.getROIOnePHDFile();
PHDFile phd2 = sampleVueData.getROITwoPHDFile();
PHDFile phd3 = sampleVueData.getROIThreePHDFile();
PHDFile phd4 = sampleVueData.getROIFourPHDFile();
String logContent1 = gammaFileUtil.GetReportContent(phd1, userName, true, "log");
String logContent2 = gammaFileUtil.GetReportContent(phd2, userName, true, "log");
String logContent3 = gammaFileUtil.GetReportContent(phd3, userName, true, "log");
String logContent4 = gammaFileUtil.GetReportContent(phd4, userName, true, "log");
result.put("Gamma_ROI_1", logContent1);
result.put("Gamma_ROI_2", logContent2);
result.put("Gamma_ROI_3", logContent3);
result.put("Gamma_ROI_4", logContent4);
return Result.OK(result);
}
@Transactional @Transactional
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) { public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
boolean bRet = false; boolean bRet = false;