From 6a9c3c1e16c76c67256c04bc3d990c876c8ef9f9 Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Wed, 16 Apr 2025 17:24:36 +0800 Subject: [PATCH] =?UTF-8?q?Beta=20Detector=20Calibration=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=20=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0acqSta?= =?UTF-8?q?rtTime=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/util/DateUtils.java | 23 + .../impl/SpectrumAnalysisServiceImpl.java | 1502 +++++++++-------- 2 files changed, 776 insertions(+), 749 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java index 25bbb384..1ea769ec 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java @@ -206,6 +206,29 @@ public class DateUtils extends PropertyEditorSupport { return sformat.format(nowDate); } + /** + * 时间字符串格式转换 + * @param date 时间字符串 + * @param sourceFormat 字符串原有格式 + * @param targetFormat 需要转换成的格式 + * @return 字符串 + */ + public static String dateformat(String date,String sourceFormat,String targetFormat) + { + SimpleDateFormat sformat = new SimpleDateFormat(sourceFormat); + Date nowDate = null; + try { + nowDate = sformat.parse(date); + sformat=new SimpleDateFormat(targetFormat); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return sformat.format(nowDate); + } + + + /** * 日期转换为字符串 * diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index ce1c6d5c..e1bf626e 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -135,7 +135,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements private IGardsROIResultsSpectrumService gardsROIResultsSpectrumService; - @Override public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) { if (StringUtils.isNotBlank(dbName) && Objects.nonNull(sampleId)) { @@ -151,7 +150,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //接收返回结果 Map> map = new HashMap<>(); //查询谱对应的台站类型 - if (StringUtils.isBlank(sampleType)){ + if (StringUtils.isBlank(sampleType)) { result.error500("谱类型不能为空"); return result; } @@ -173,15 +172,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List stationCodes = new LinkedList<>(); List detectorCodes = new LinkedList<>(); //查询台站信息接口 - HashMap stationMap = (HashMap)redisUtil.get("stationInfoMap"); + HashMap stationMap = (HashMap) redisUtil.get("stationInfoMap"); //从redis中获取探测器信息 - Map detectorInfoMap = (Map)redisUtil.get("detectorsMap"); + Map detectorInfoMap = (Map) redisUtil.get("detectorsMap"); //获取台站信息 List userStations = new LinkedList<>(); //如果没有勾选AllUsers - if (Objects.nonNull(AllUsers) && !AllUsers){ + if (Objects.nonNull(AllUsers) && !AllUsers) { String userName = JwtUtil.getUserNameByToken(request); - if (StringUtils.isBlank(userName)){ + if (StringUtils.isBlank(userName)) { result.error500("Description Failed to obtain the current login user information!"); return result; } @@ -189,16 +188,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements userStations = userTaskUtil.findUserStation(userName); //判断当前用户在当天是否有排班任务的台站信息 if (CollectionUtils.isNotEmpty(userStations)) { - if (CollectionUtils.isNotEmpty(stationMap)){ - for (Map.Entry entry:stationMap.entrySet()) { - GardsStations value = (GardsStations)entry.getValue(); + if (CollectionUtils.isNotEmpty(stationMap)) { + for (Map.Entry entry : stationMap.entrySet()) { + GardsStations value = (GardsStations) entry.getValue(); if (userStations.contains(entry.getKey()) && StringUtils.isNotBlank(value.getType()) && stationTypes.contains(value.getType())) { stationCodes.add(value.getStationCode()); } } } if (CollectionUtils.isNotEmpty(detectorInfoMap)) { - for (Map.Entry entry:detectorInfoMap.entrySet()) { + for (Map.Entry entry : detectorInfoMap.entrySet()) { if (String.valueOf(entry.getValue()).length() <= 5) { if (stationCodes.contains(String.valueOf(entry.getValue()))) { detectorCodes.add(entry.getValue()); @@ -213,7 +212,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } else { if (CollectionUtils.isNotEmpty(stationMap)) { - for (Map.Entry entry: stationMap.entrySet()) { + for (Map.Entry entry : stationMap.entrySet()) { GardsStations value = (GardsStations) entry.getValue(); if (StringUtils.isNotBlank(value.getType()) && stationTypes.contains(value.getType())) { stationCodes.add(value.getStationCode()); @@ -221,7 +220,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } if (CollectionUtils.isNotEmpty(detectorInfoMap)) { - for (Map.Entry entry: detectorInfoMap.entrySet()) { + for (Map.Entry entry : detectorInfoMap.entrySet()) { if (String.valueOf(entry.getValue()).length() <= 5) { if (stationCodes.contains(String.valueOf(entry.getValue()))) { detectorCodes.add(entry.getValue()); @@ -246,7 +245,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String dbName, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request) { Result result = new Result(); - if (Objects.isNull(startDate)){ + if (Objects.isNull(startDate)) { result.error500("The start time cannot be empty"); return result; } @@ -257,7 +256,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59"; List menuTypeList = Arrays.asList(menuTypes); - if (CollectionUtils.isEmpty(menuTypeList)){ + if (CollectionUtils.isEmpty(menuTypeList)) { result.error500("The spectrum type cannot be empty"); return result; } @@ -266,23 +265,23 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements result.error500("Please add the station type corresponding to the current system type in the data dictionary"); return result; } - if (StringUtils.isBlank(dbName)){ + if (StringUtils.isBlank(dbName)) { result.error500("Please select the database type"); return result; } String tempDBName = dbName; - if (dbName.equalsIgnoreCase("auto")){ + if (dbName.equalsIgnoreCase("auto")) { dbName = "RNAUTO.GARDS_ANALYSES"; - } else if (dbName.equalsIgnoreCase("man")){ + } else if (dbName.equalsIgnoreCase("man")) { dbName = "RNMAN.GARDS_ANALYSES"; } else { result.error500("The database type does not exist"); return result; } List userStations = new LinkedList<>(); - if (Objects.nonNull(AllUsers) && !AllUsers){ + if (Objects.nonNull(AllUsers) && !AllUsers) { String userName = JwtUtil.getUserNameByToken(request); - if (StringUtils.isBlank(userName)){ + if (StringUtils.isBlank(userName)) { result.error500("Description Failed to obtain the current login user information!"); return result; } @@ -291,7 +290,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //声明分页page Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); Page sampleDataPage = spectrumAnalysisMapper.getDBSpectrumListByLeftJoin(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder()); - sampleDataPage.getRecords().stream().forEach(item->{item.setDbName(tempDBName);}); + sampleDataPage.getRecords().stream().forEach(item -> { + item.setDbName(tempDBName); + }); result.setSuccess(true); result.setResult(sampleDataPage); return result; @@ -302,7 +303,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Result result = new Result(); List> resultList = new LinkedList<>(); String userName = JwtUtil.getUserNameByToken(request); - String filePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName; + String filePath = spectrumPathProperties.getRootPath() + 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"; @@ -317,10 +318,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements matchFileNames.add(fileName); } if (CollectionUtils.isNotEmpty(matchFileNames)) { - for (String matchFileName :matchFileNames) { - Map map =new HashMap<>(); + for (String matchFileName : matchFileNames) { + Map map = new HashMap<>(); //判断sample文件名称是否匹配正则表达式 如果满足 则查询出对应的文件信息 - if ( regexPattern.matcher(matchFileName).find() || regexPattern1.matcher(matchFileName).find() || regexPattern2.matcher(matchFileName).find() ){ + if (regexPattern.matcher(matchFileName).find() || regexPattern1.matcher(matchFileName).find() || regexPattern2.matcher(matchFileName).find()) { //查询sampleFile文件内容信息 获取文件内容 获取大致的gas det文件名称 Map fileData = phdFileUtil.getFileData(filePath, matchFileName); if (CollectionUtils.isEmpty(fileData)) { @@ -336,7 +337,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements boolean qcStatus = true; String qcphd = phdFileUtil.GetQCPHD(sampleFileName, fileNames); if (StringUtils.isBlank(qcphd)) { - qcphd = sampleFileName.substring(0, 23)+"_Q.PHD"; + qcphd = sampleFileName.substring(0, 23) + "_Q.PHD"; qcStatus = false; } //匹配gasFile @@ -393,23 +394,23 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Map resultMap = new HashMap<>(); //页面展示结果数组 List xeResultsSpectrumList = new LinkedList<>(); - List gammaCalibrationSpectrumList= new LinkedList<>(); + List gammaCalibrationSpectrumList = new LinkedList<>(); List betaCalibrationSpectrumList = new LinkedList<>(); List roiChannelsSpectrumList = new LinkedList<>(); List roiResultsSpectrumList = new LinkedList<>(); List gammaCalibrationPairsList = new LinkedList<>(); List betaCalibrationPairsList = new LinkedList<>(); //判断sampleId是否为空 - if (Objects.isNull(sampleId)){ + if (Objects.isNull(sampleId)) { result.error500("Please select a piece of data"); return result; } //查询分析id,相关的分析结果 Integer analysisID = null; - if (dbName.equalsIgnoreCase("auto")){ + if (dbName.equalsIgnoreCase("auto")) { dbName = "RNAUTO"; analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO"); - } else if (dbName.equalsIgnoreCase("man")){ + } else if (dbName.equalsIgnoreCase("man")) { dbName = "RNMAN"; analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, analyst); } @@ -435,18 +436,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements sampleFileName = dbSpectrumFilePath.getSampleFilePath().substring(dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH) + 1); } //获取gas相关信息 - GardsSampleData gasBg = null; + GardsSampleData gasBg = null; String gasFileName = ""; if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) { gasBg = spectrumAnalysisMapper.findSampleByFilePath(dbSpectrumFilePath.getGasBgFilePath()); - gasFileName = dbSpectrumFilePath.getGasBgFilePath().substring(dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)+1); + gasFileName = dbSpectrumFilePath.getGasBgFilePath().substring(dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH) + 1); } //获取det相关信息 GardsSampleData detBg = null; String detFileName = ""; if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) { detBg = spectrumAnalysisMapper.findSampleByFilePath(dbSpectrumFilePath.getDetBgFilePath()); - detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1); + detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH) + 1); } //获取qc相关信息 String dbQcFilePath = ""; @@ -457,7 +458,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr); if (StringUtils.isNotBlank(dbQcFilePath)) { qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath); - qcFileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1); + qcFileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH) + 1); } } //从缓存中获取公用变量的数据 @@ -484,7 +485,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setSampleId(String.valueOf(sampleId)); //判断sample信息是否存在 if (Objects.nonNull(sample)) { - betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getSampleFilePath()); + betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath()); betaDataFile.setSampleFileName(sampleFileName); sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName()); if (Objects.nonNull(sampleTmp)) { @@ -516,12 +517,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } sampleMap.put("fileName", betaDataFile.getSampleFileName()); - resultMap.put("sample",sampleMap); + resultMap.put("sample", sampleMap); } } //判断gas信息是否存在 if (Objects.nonNull(gasBg)) { - betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getGasBgFilePath()); + betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath()); betaDataFile.setGasFileName(gasFileName); gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName()); if (Objects.nonNull(gasTmp)) { @@ -553,12 +554,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } gasBgMap.put("fileName", betaDataFile.getGasFileName()); - resultMap.put("gasBg",gasBgMap); + resultMap.put("gasBg", gasBgMap); } } //判断det信息是否存在 if (Objects.nonNull(detBg)) { - betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getDetBgFilePath()); + betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath()); betaDataFile.setDetFileName(detFileName); detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName()); if (Objects.nonNull(detTmp)) { @@ -590,12 +591,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } detBgMap.put("fileName", betaDataFile.getDetFileName()); - resultMap.put("detBg",detBgMap); + resultMap.put("detBg", detBgMap); } } //判断qc信息是否存在 if (Objects.nonNull(qc)) { - betaDataFile.setQcFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbQcFilePath); + betaDataFile.setQcFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath); betaDataFile.setQcFileName(qcFileName); qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName()); if (Objects.nonNull(qcTmp)) { @@ -604,7 +605,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setQcStruct(struct); qcMap = phdFileUtil.getSourceData(struct, qc.getSampleId(), qc.getStatus(), "qc", betaDataFile); qcMap.put("fileName", betaDataFile.getQcFileName()); - resultMap.put("qc",qcMap); + resultMap.put("qc", qcMap); } } //更新缓存数据对应的缓存数据 @@ -620,27 +621,27 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList(); sampleMap = loadData("sample", betaDataFile); sampleMap.put("fileName", betaDataFile.getSampleFileName()); - resultMap.put("sample",sampleMap); + resultMap.put("sample", sampleMap); gasBgMap = loadData("gas", betaDataFile); gasBgMap.put("fileName", betaDataFile.getGasFileName()); - resultMap.put("gasBg",gasBgMap); + resultMap.put("gasBg", gasBgMap); detBgMap = loadData("det", betaDataFile); detBgMap.put("fileName", betaDataFile.getDetFileName()); - resultMap.put("detBg",detBgMap); + resultMap.put("detBg", detBgMap); qcMap = loadData("qc", betaDataFile); qcMap.put("fileName", betaDataFile.getQcFileName()); - resultMap.put("qc",qcMap); + resultMap.put("qc", qcMap); } //分析状态颜色 - phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap); + phdFileUtil.getLightColor(sampleMap, gasBgMap, detBgMap, qcMap); //Xe - if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ - for (GardsXeResultsSpectrum xeData:xeResultsSpectrumList) { + if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { + for (GardsXeResultsSpectrum xeData : xeResultsSpectrumList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); - } else if (0 mdc) { xeData.setColor("green"); @@ -655,7 +656,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("XeData", phdFileUtil.viewXeData(xeResultsSpectrumList)); resultMap.put("bProcessed", betaDataFile.isBProcessed()); resultMap.put("savedAnalysisResult", betaDataFile.isSaveAnalysisResult()); - cache.put(betaDataFile.getSampleFileName()+"-"+userName, betaDataFile); + cache.put(betaDataFile.getSampleFileName() + "-" + userName, betaDataFile); betaCache.setBetaCache(cache); } else { resultMap.clear(); @@ -698,21 +699,21 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements GardsSampleData gasSampleData = sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(), DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType()); - if(StringUtils.isEmpty(sampleFilePath) + if (StringUtils.isEmpty(sampleFilePath) && (Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName())) - && (Objects.isNull(detSampleData) || StringUtils.isEmpty(detSampleData.getInputFileName()))){ + && (Objects.isNull(detSampleData) || StringUtils.isEmpty(detSampleData.getInputFileName()))) { result.error500("gas and det file is no exist or is error.."); return result; } // 如果找不到sample、det、gas谱文件数据则解析失败修改记录状态 - if(StringUtils.isEmpty(sampleFilePath) || Objects.isNull(gasSampleData) - || StringUtils.isEmpty(gasSampleData.getInputFileName())){ + if (StringUtils.isEmpty(sampleFilePath) || Objects.isNull(gasSampleData) + || StringUtils.isEmpty(gasSampleData.getInputFileName())) { result.error500("gas file is no exist or is error.."); return result; } - if(StringUtils.isEmpty(sampleFilePath) || Objects.isNull(detSampleData) - || StringUtils.isEmpty(detSampleData.getInputFileName())){ + if (StringUtils.isEmpty(sampleFilePath) || Objects.isNull(detSampleData) + || StringUtils.isEmpty(detSampleData.getInputFileName())) { result.error500("det file is no exist or is error.."); return result; } @@ -769,16 +770,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } else { sampleMap = loadData("sample", betaDataFile); sampleMap.put("fileName", betaDataFile.getSampleFileName()); - resultMap.put("sample",sampleMap); + resultMap.put("sample", sampleMap); gasBgMap = loadData("gas", betaDataFile); gasBgMap.put("fileName", betaDataFile.getGasFileName()); - resultMap.put("gasBg",gasBgMap); + resultMap.put("gasBg", gasBgMap); detBgMap = loadData("det", betaDataFile); detBgMap.put("fileName", betaDataFile.getDetFileName()); - resultMap.put("detBg",detBgMap); + resultMap.put("detBg", detBgMap); qcMap = loadData("qc", betaDataFile); qcMap.put("fileName", betaDataFile.getQcFileName()); - resultMap.put("qc",qcMap); + resultMap.put("qc", qcMap); } } @@ -817,7 +818,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String gasBgFilePath = path + StringPool.SLASH + gasFileName; String detBgFilePath = path + StringPool.SLASH + detFileName; String dbQcFilePath = path + StringPool.SLASH + qcFileName; - if(StringUtils.isNotBlank(sampleFileName)){ + if (StringUtils.isNotBlank(sampleFileName)) { EnergySpectrumStruct struct = getSourceData(sampleFilePath, "sample", betaDataFile); if (Objects.nonNull(struct)) { betaDataFile.setSampleStruct(struct); @@ -828,7 +829,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("sample", sampleMap); } } - if(StringUtils.isNotBlank(gasFileName)){ + if (StringUtils.isNotBlank(gasFileName)) { EnergySpectrumStruct struct = getSourceData(gasBgFilePath, "gas", betaDataFile); if (Objects.nonNull(struct)) { betaDataFile.setGasStruct(struct); @@ -839,7 +840,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("gasBg", gasBgMap); } } - if(StringUtils.isNotBlank(detFileName)){ + if (StringUtils.isNotBlank(detFileName)) { EnergySpectrumStruct struct = getSourceData(detBgFilePath, "det", betaDataFile); if (Objects.nonNull(struct)) { betaDataFile.setDetStruct(struct); @@ -850,7 +851,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("detBg", detBgMap); } } - if(StringUtils.isNotBlank(qcFileName)){ + if (StringUtils.isNotBlank(qcFileName)) { EnergySpectrumStruct struct = getSourceData(dbQcFilePath, "qc", betaDataFile); if (Objects.nonNull(struct)) { betaDataFile.setQcStruct(struct); @@ -861,30 +862,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("qc", qcMap); } } - } else { + } else { xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList(); sampleMap = loadData("sample", betaDataFile); sampleMap.put("fileName", betaDataFile.getSampleFileName()); - resultMap.put("sample",sampleMap); + resultMap.put("sample", sampleMap); gasBgMap = loadData("gas", betaDataFile); gasBgMap.put("fileName", betaDataFile.getGasFileName()); - resultMap.put("gasBg",gasBgMap); + resultMap.put("gasBg", gasBgMap); detBgMap = loadData("det", betaDataFile); detBgMap.put("fileName", betaDataFile.getDetFileName()); - resultMap.put("detBg",detBgMap); + resultMap.put("detBg", detBgMap); qcMap = loadData("qc", betaDataFile); qcMap.put("fileName", betaDataFile.getQcFileName()); - resultMap.put("qc",qcMap); + resultMap.put("qc", qcMap); } - phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap); + phdFileUtil.getLightColor(sampleMap, gasBgMap, detBgMap, qcMap); //Xe - if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ - for (GardsXeResultsSpectrum xeData:xeResultsSpectrumList) { + if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { + for (GardsXeResultsSpectrum xeData : xeResultsSpectrumList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); - } else if (0 mdc) { xeData.setColor("green"); @@ -897,7 +898,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("XeData", phdFileUtil.viewXeData(xeResultsSpectrumList)); resultMap.put("bProcessed", betaDataFile.isBProcessed()); resultMap.put("savedAnalysisResult", betaDataFile.isSaveAnalysisResult()); - cache.put(betaDataFile.getSampleFileName()+"-"+userName, betaDataFile); + cache.put(betaDataFile.getSampleFileName() + "-" + userName, betaDataFile); betaCache.setBetaCache(cache); result.setSuccess(true); result.setResult(resultMap); @@ -1027,14 +1028,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //判断sampleId是否为空 如果不为空 则当前操作数据来源是数据库 文件路径从数据库中查询 if (Objects.nonNull(sampleId)) { CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId); - if (Objects.nonNull(commentData)){ - if (!commentData.getAnalyst().equals(userName)){ - if (StringUtils.isNotBlank(commentData.getComment())){ + if (Objects.nonNull(commentData)) { + if (!commentData.getAnalyst().equals(userName)) { + if (StringUtils.isNotBlank(commentData.getComment())) { String line = "------------------------------------------------------------"; - String comment = line+"\n[ User "+commentData.getAnalyst()+" Comment ] : \n"+commentData.getComment()+"\n"+line+" \n"; + String comment = line + "\n[ User " + commentData.getAnalyst() + " Comment ] : \n" + commentData.getComment() + "\n" + line + " \n"; commentInfo.setSpectrumOtherCommentInfo(comment); } - }else { + } else { commentInfo.setSpectrumAnalysisCommentInfo(commentData.getComment()); } } @@ -1049,14 +1050,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements public void viewARR(Integer sampleId, HttpServletResponse response) { //获取自动处理生成的报告地址 String reportPath = spectrumAnalysisMapper.viewARR(sampleId); - if (StringUtils.isBlank(reportPath)){ + if (StringUtils.isBlank(reportPath)) { throw new RuntimeException("The automatic handler generated report does not exist!"); } InputStream inputStream = null; ServletOutputStream outputStream = null; try { inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt"); - if (Objects.nonNull(inputStream)){ + if (Objects.nonNull(inputStream)) { outputStream = response.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; @@ -1069,10 +1070,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements throw new RuntimeException(e); } finally { try { - if (ObjectUtil.isNotNull(inputStream)){ + if (ObjectUtil.isNotNull(inputStream)) { inputStream.close(); } - if (ObjectUtil.isNotNull(outputStream)){ + if (ObjectUtil.isNotNull(outputStream)) { outputStream.close(); } } catch (IOException e) { @@ -1112,14 +1113,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //判断 if (betaDataFile.isSaveAnalysisResult()) { //对分析后的内容进行数据获取 - List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); + List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); List roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); List roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); List roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); - List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); - List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); - for (int i=0; i resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); + List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); + for (int i = 0; i < xeResultsSpectrums.size(); i++) { + for (int j = 0; j < rrrLogInfo.getXeResultsSpectrumList().size(); j++) { if (xeResultsSpectrums.get(i).getNuclideName().equalsIgnoreCase(rrrLogInfo.getXeResultsSpectrumList().get(j).getNuclideName())) { xeResultsSpectrums.get(i).setNidFlag(rrrLogInfo.getXeResultsSpectrumList().get(j).getNidFlag()); } @@ -1128,7 +1129,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //#SAMPLE: LIMITS PER ROI GAMMA List gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList(); List gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList(); - for (int i=0; i betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList(); List betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList(); - for (int i=0; i> map = new HashMap<>(); - if(StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) { + if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) { List lines = phdFileUtil.readLine(betaDataFile.getSampleTmpPath()); map.put("sample", lines); } - if(StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) { + if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) { List lines = phdFileUtil.readLine(betaDataFile.getGasTmpPath()); map.put("gasBg", lines); } - if(StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) { + if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) { List lines = phdFileUtil.readLine(betaDataFile.getDetTmpPath()); map.put("detBg", lines); } @@ -1604,7 +1605,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements result.error500("Load basic file information first!"); return result; } - if (StringUtils.isNotBlank(betaDataFile.getSampleFilePathName())){ + if (StringUtils.isNotBlank(betaDataFile.getSampleFilePathName())) { try { EnergySpectrumStruct struct = betaDataFile.getSampleStruct(); String measurementID = struct.measurement_id; @@ -1613,12 +1614,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String sampleRefId = struct.sample_ref_id; String sit_det_code = struct.site_code; String detect_code = struct.detector_code; - String sample_id = Objects.nonNull(sampleId)?sampleId.toString():""; + String sample_id = Objects.nonNull(sampleId) ? sampleId.toString() : ""; Date collectStartDate = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time); Date collectStopDate = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time); String collect_start = DateUtils.formatDate(collectStartDate, "yyyy/MM/dd HH:mm:ss"); String collect_stop = DateUtils.formatDate(collectStopDate, "yyyy/MM/dd HH:mm:ss"); - String collection_time_value = String.format ("%.2f",Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime())/ 1000)); + String collection_time_value = String.format("%.2f", Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime()) / 1000)); String s_volume_of_Xe = String.valueOf(struct.air_volume); String s_xe_stable_volume = String.valueOf(struct.sample_volume_of_Xe); Date acquisitionStartDate = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time); @@ -1628,25 +1629,25 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements StringBuffer strBuffer = new StringBuffer(); strBuffer.append("\n"); strBuffer.append("#FILE INFORMATION\n"); - strBuffer.append(" SampleMeasID: "+measurementID+"\n"); - strBuffer.append(" GASBKMeasID: "+gasBkgdMeasurementID+"\n"); - strBuffer.append(" DETBKMeasID: "+bkgdMeasurementID+"\n"); - strBuffer.append(" SRID: "+sampleRefId+"\n"); + strBuffer.append(" SampleMeasID: " + measurementID + "\n"); + strBuffer.append(" GASBKMeasID: " + gasBkgdMeasurementID + "\n"); + strBuffer.append(" DETBKMeasID: " + bkgdMeasurementID + "\n"); + strBuffer.append(" SRID: " + sampleRefId + "\n"); strBuffer.append("\n"); strBuffer.append("#COLLECTION INFORMATION\n"); - strBuffer.append(" Station CODE: "+sit_det_code+"\n"); - strBuffer.append(" Detector CODE: "+detect_code+"\n"); - strBuffer.append(" Sample ID: "+sample_id+"\n"); - strBuffer.append(" Collection Start: "+collect_start+"\n"); - strBuffer.append(" Collection Stop: "+collect_stop+"\n"); - strBuffer.append(" Collection TIME: "+collection_time_value+"\n"); - strBuffer.append(" Sample Volume[m3]: "+s_volume_of_Xe+"\n"); - strBuffer.append(" Xe Volume[cm3]: "+s_xe_stable_volume+"\n"); + strBuffer.append(" Station CODE: " + sit_det_code + "\n"); + strBuffer.append(" Detector CODE: " + detect_code + "\n"); + strBuffer.append(" Sample ID: " + sample_id + "\n"); + strBuffer.append(" Collection Start: " + collect_start + "\n"); + strBuffer.append(" Collection Stop: " + collect_stop + "\n"); + strBuffer.append(" Collection TIME: " + collection_time_value + "\n"); + strBuffer.append(" Sample Volume[m3]: " + s_volume_of_Xe + "\n"); + strBuffer.append(" Xe Volume[cm3]: " + s_xe_stable_volume + "\n"); strBuffer.append("\n"); strBuffer.append("#ACQUISITION INFORMATION\n"); - strBuffer.append(" Acquisition Start: "+acquisition_start+"\n"); - strBuffer.append(" Acq Real Time: "+acquisition_real_sec+"\n"); - strBuffer.append(" Acq Live Time: "+acquisition_live_sec+"\n"); + strBuffer.append(" Acquisition Start: " + acquisition_start + "\n"); + strBuffer.append(" Acq Real Time: " + acquisition_real_sec + "\n"); + strBuffer.append(" Acq Live Time: " + acquisition_live_sec + "\n"); strBuffer.append("\n"); result.setSuccess(true); result.setResult(strBuffer.toString()); @@ -1669,16 +1670,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements .filter(StrUtil::isNotBlank) .filter(item -> StrUtil.contains(item, colon)) .collect(Collectors.toList()); - Map dataMap = new HashMap<>(); + Map dataMap = new HashMap<>(); for (String s : sampleInfos) { - String[] split = s.split(colon,2);// 只分割为两部分 - String key = StrUtil.removeAll(split[0],space); + String[] split = s.split(colon, 2);// 只分割为两部分 + String key = StrUtil.removeAll(split[0], space); String value = split[1].trim(); - dataMap.put(key,value); + dataMap.put(key, value); } String export = "SampleInformation-Beta.xls"; String template = SampleInfo_B.getName(); - ExportUtil.exportXls(response,template,dataMap,export); + ExportUtil.exportXls(response, template, dataMap, export); } @Override @@ -1726,45 +1727,45 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time); Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time); Double collection_time = Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime()) / 1000); - String collection_time_value = String.format("%.4f",collection_time/3600.0); + String collection_time_value = String.format("%.4f", collection_time / 3600.0); qcResult.setCollectTimeValue(collection_time_value); - if (collectionTimeSections.get(1) < collection_time/3600.0 && collection_time/3600.0 < collectionTimeSections.get(4)){ + if (collectionTimeSections.get(1) < collection_time / 3600.0 && collection_time / 3600.0 < collectionTimeSections.get(4)) { qcResult.setCollectTimeStatus("Pass"); - }else { + } else { qcResult.setCollectTimeStatus("Failed"); } - String acquisition_live_sec = String.format("%.2f",sampleSourceData.acquisition_live_time/3600.0); + String acquisition_live_sec = String.format("%.2f", sampleSourceData.acquisition_live_time / 3600.0); qcResult.setAcquisitionTimeValue(acquisition_live_sec); - if (acquisitionTimeSections.get(1) < sampleSourceData.acquisition_live_time/3600.0 && sampleSourceData.acquisition_live_time/3600.0 < acquisitionTimeSections.get(4)){ + if (acquisitionTimeSections.get(1) < sampleSourceData.acquisition_live_time / 3600.0 && sampleSourceData.acquisition_live_time / 3600.0 < acquisitionTimeSections.get(4)) { qcResult.setAcquisitionTimeStatus("Pass"); - }else { + } else { qcResult.setAcquisitionTimeStatus("Failed"); } String s_xe_stable_volume = String.valueOf(sampleSourceData.sample_volume_of_Xe); qcResult.setXenonVolumeValue(s_xe_stable_volume); - if (xeVolumeSections.get(1) < sampleSourceData.sample_volume_of_Xe){ + if (xeVolumeSections.get(1) < sampleSourceData.sample_volume_of_Xe) { qcResult.setXenonVolumeStatus("Pass"); - }else { + } else { qcResult.setXenonVolumeStatus("Failed"); } // String gasMeasurementID = gasSourceData.measurement_id; - if (gasMeasurementID.equals(sampleSourceData.gas_bk_measurement_id)){ + if (gasMeasurementID.equals(sampleSourceData.gas_bk_measurement_id)) { qcResult.setGasBgValue("Match"); qcResult.setGasBgEvaluationMetrics("Match"); qcResult.setGasBgValueAndStatus(true); - }else { + } else { qcResult.setGasBgValue(""); qcResult.setGasBgEvaluationMetrics(""); qcResult.setGasBgValueAndStatus(false); } // String detMeasurementID = detSourceData.measurement_id; - if (detMeasurementID.equals(sampleSourceData.detector_bk_measurement_id)){ + if (detMeasurementID.equals(sampleSourceData.detector_bk_measurement_id)) { qcResult.setDetBgValue("Match"); qcResult.setDetBgEvaluationMetrics("Match"); qcResult.setDetBgValueAndStatus(true); - }else { + } else { qcResult.setDetBgValue(""); qcResult.setDetBgEvaluationMetrics(""); qcResult.setDetBgValueAndStatus(false); @@ -1773,11 +1774,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } catch (ParseException e) { throw new RuntimeException(e); } - if (Objects.nonNull(gardsXeResults)){ + if (Objects.nonNull(gardsXeResults)) { qcResult.setXe133MDCValue(String.valueOf(gardsXeResults.getMdc())); - if ( 0.001 < gardsXeResults.getMdc() && gardsXeResults.getMdc() < 5.0 ){ + if (0.001 < gardsXeResults.getMdc() && gardsXeResults.getMdc() < 5.0) { qcResult.setXe133MDCStatus("Pass"); - }else { + } else { qcResult.setXe133MDCStatus("Failed"); } } else { @@ -1811,7 +1812,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); String export = "QCResult-Beta.xls"; String template = QcResult_B.getName(); - ExportUtil.exportXls(response,template,dataMap,export); + ExportUtil.exportXls(response, template, dataMap, export); } @Override @@ -1827,17 +1828,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String qcTitle = "%s%-24s%-21s%-10s%-9s"; strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "QC Flags", "Evaluation Metrics", "Value", "Status")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Collection Time (h)", StringUtils.isNotBlank(qcResult.getCollectTimeEvaluationMetrics())?qcResult.getCollectTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getCollectTimeValue())?qcResult.getCollectTimeValue():"", StringUtils.isNotBlank(qcResult.getCollectTimeStatus())?qcResult.getCollectTimeStatus():"Failed")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Collection Time (h)", StringUtils.isNotBlank(qcResult.getCollectTimeEvaluationMetrics()) ? qcResult.getCollectTimeEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getCollectTimeValue()) ? qcResult.getCollectTimeValue() : "", StringUtils.isNotBlank(qcResult.getCollectTimeStatus()) ? qcResult.getCollectTimeStatus() : "Failed")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Acqusition Time (h)", StringUtils.isNotBlank(qcResult.getAcquisitionTimeEvaluationMetrics())?qcResult.getAcquisitionTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeValue())?qcResult.getAcquisitionTimeValue():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeStatus())?qcResult.getAcquisitionTimeStatus():"Failed")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Acqusition Time (h)", StringUtils.isNotBlank(qcResult.getAcquisitionTimeEvaluationMetrics()) ? qcResult.getAcquisitionTimeEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getAcquisitionTimeValue()) ? qcResult.getAcquisitionTimeValue() : "", StringUtils.isNotBlank(qcResult.getAcquisitionTimeStatus()) ? qcResult.getAcquisitionTimeStatus() : "Failed")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Xenon Volume (ml)", StringUtils.isNotBlank(qcResult.getXenonVolumeEvaluationMetrics())?qcResult.getXenonVolumeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXenonVolumeValue())?qcResult.getXenonVolumeValue():"", StringUtils.isNotBlank(qcResult.getXenonVolumeStatus())?qcResult.getXenonVolumeStatus():"Failed")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Xenon Volume (ml)", StringUtils.isNotBlank(qcResult.getXenonVolumeEvaluationMetrics()) ? qcResult.getXenonVolumeEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getXenonVolumeValue()) ? qcResult.getXenonVolumeValue() : "", StringUtils.isNotBlank(qcResult.getXenonVolumeStatus()) ? qcResult.getXenonVolumeStatus() : "Failed")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Gas Bg", StringUtils.isNotBlank(qcResult.getGasBgEvaluationMetrics())?qcResult.getGasBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getGasBgValue())?qcResult.getGasBgValue():"", qcResult.isGasBgValueAndStatus()?"Pass":"Failed")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Gas Bg", StringUtils.isNotBlank(qcResult.getGasBgEvaluationMetrics()) ? qcResult.getGasBgEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getGasBgValue()) ? qcResult.getGasBgValue() : "", qcResult.isGasBgValueAndStatus() ? "Pass" : "Failed")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Det Bg", StringUtils.isNotBlank(qcResult.getDetBgEvaluationMetrics())?qcResult.getDetBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getDetBgValue())?qcResult.getDetBgValue():"", qcResult.isDetBgValueAndStatus()?"Pass":"Failed")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Det Bg", StringUtils.isNotBlank(qcResult.getDetBgEvaluationMetrics()) ? qcResult.getDetBgEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getDetBgValue()) ? qcResult.getDetBgValue() : "", qcResult.isDetBgValueAndStatus() ? "Pass" : "Failed")); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "MDC for Xe133 (mBq/m3)", StringUtils.isNotBlank(qcResult.getXe133MDCEvaluationMetrics())?qcResult.getXe133MDCEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXe133MDCValue())?qcResult.getXe133MDCValue():"None", StringUtils.isNotBlank(qcResult.getXe133MDCStatus())?qcResult.getXe133MDCStatus():"None")); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "MDC for Xe133 (mBq/m3)", StringUtils.isNotBlank(qcResult.getXe133MDCEvaluationMetrics()) ? qcResult.getXe133MDCEvaluationMetrics() : "", StringUtils.isNotBlank(qcResult.getXe133MDCValue()) ? qcResult.getXe133MDCValue() : "None", StringUtils.isNotBlank(qcResult.getXe133MDCStatus()) ? qcResult.getXe133MDCStatus() : "None")); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); OutputStream fos = null; @@ -1888,7 +1889,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements rlrDataValues.setAcq_start_date(struct.acquisition_start_date); rlrDataValues.setAcq_start_time(struct.acquisition_start_time); rlrDataValues.setAcq_live_time(String.valueOf(struct.acquisition_live_time)); - if (CollectionUtils.isNotEmpty(xeDataList)){ + if (CollectionUtils.isNotEmpty(xeDataList)) { List xe131mDataList = xeDataList.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_131m.getType())).collect(Collectors.toList()); GardsXeResultsSpectrum xe131m = xe131mDataList.get(0); rlrDataValues.setXe131m_conc(NumUtil.keepStr(xe131m.getConc(), 5)); @@ -1926,12 +1927,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public void exportRLR(BetaRLR betaRLR, HttpServletResponse response) { if (ObjectUtil.isNull(betaRLR)) return; - Map dataMap = BeanUtil.beanToMap(betaRLR); + Map dataMap = BeanUtil.beanToMap(betaRLR); // 将Null值替换为"",避免空指针异常(或者在模板中进行判断) dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); String export = "RLR-Beta.xls"; String template = RLR_B.getName(); - ExportUtil.exportXls(response, template, dataMap,export); + ExportUtil.exportXls(response, template, dataMap, export); } @Override @@ -1958,7 +1959,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //获取qc的分析结果数据 EnergySpectrumStruct struct = betaDataFile.getQcStruct(); //判断qc文件的解析结果是否为空 - if (Objects.nonNull(struct)){ + if (Objects.nonNull(struct)) { //读取Gamma Detector Calibration所需要的参数 long numGChannel = struct.num_g_channel; List gCentroidChannel = struct.g_centroid_channel; @@ -1968,7 +1969,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); //根据道值和能量的对应关系 存储表单数据 List oldScatterSeries = new LinkedList<>(); - for (int i=0; i fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List fittingParaStr = new LinkedList<>(); - for (Double para:fittingPara) { + for (Double para : fittingPara) { fittingParaStr.add(String.valueOf(para)); } map.put("CToE", fittingParaStr); List channel = new LinkedList<>(); - for (int i=0; i<255; ++i) { + for (int i = 0; i < 255; ++i) { channel.add(Double.valueOf(i)); } //计算出新的道值对应能量值 List energy = EnergySpectrumHandler.GetFileFittingData(channel, fittingPara); //根据道值和能量对应关系 封装折线图数据 List oldLineSeries = new LinkedList<>(); - for (int i=0; i fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); List fittingParaToUiStr = new LinkedList<>(); - for (Double para:fittingParaToUi) { + for (Double para : fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); } map.put("EToC", fittingParaToUiStr); //计算道值对应能量值参数 List gchannels = new ArrayList<>(); List> gammaEnergyList = new LinkedList<>(); - for (int i=0; i gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam); @@ -2018,29 +2019,29 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements map.put("gammaEnergy", gammaEnergyList); //Gamma Spectrum: QC List seriseDataList = new LinkedList<>(); - long min =0; - double max =0; - for ( int i=1; imax){ + if (count > max) { max = count; } } - if (max<10) { - max += max*0.5; - } else if (max<50) { - max += max*0.2; - } else if (max<100) { - max += max*0.1; + if (max < 10) { + max += max * 0.5; + } else if (max < 50) { + max += max * 0.2; + } else if (max < 100) { + max += max * 0.1; } else { - max += max*0.05; + max += max * 0.05; } map.put("min", min); map.put("max", max); @@ -2067,29 +2068,29 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //记录点值数组 List newSeriseDataList = new LinkedList<>(); //遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组 - for (int i=0; i newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); - for (Double para:newFittingPara) { + for (Double para : newFittingPara) { newFittingParaStr.add(String.valueOf(para)); } map.put("newCToE", newFittingParaStr); //填充道值数组的数据 - for (int i=0; i<255; i++) { + for (int i = 0; i < 255; i++) { channels.add(Double.valueOf(i)); } //计算道值的能量 - List energys = EnergySpectrumHandler.GetFileFittingData(channels,newFittingPara); + List energys = EnergySpectrumHandler.GetFileFittingData(channels, newFittingPara); //根据临时点的道值修改对应能量值 //遍历所有道值 - for (int i=0; i< channels.size(); i++) { + for (int i = 0; i < channels.size(); i++) { //获取道值 double newChannel = channels.get(i).doubleValue(); //遍历临时点数据 - for (int j=0; j newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); energyList.add(newEnergy); } //遍历道值添加各道值对应点数据到数组 - for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); - for (Double para:newFittingParaToUi) { + for (Double para : newFittingParaToUi) { newFittingParaToUiStr.add(String.valueOf(para)); } map.put("newEToC", newFittingParaToUiStr); } //计算得到的 - if (betaDataFile.getGammaList().size() <= 0 ) { + if (betaDataFile.getGammaList().size() <= 0) { betaDataFile.setGammaList(oldScatterSeries); } - if (betaDataFile.getGammaFittingPara().size() <= 0 ) { + if (betaDataFile.getGammaFittingPara().size() <= 0) { betaDataFile.setGammaFittingPara(fittingParaStr); } - if (betaDataFile.getGammaFittingParaToUi().size() <= 0 ) { + if (betaDataFile.getGammaFittingParaToUi().size() <= 0) { betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr); } } @@ -2175,7 +2176,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } //判断qc的分析结果是否为空 EnergySpectrumStruct struct = betaDataFile.getQcStruct(); - if (Objects.nonNull(struct)){ + if (Objects.nonNull(struct)) { //Figure of Beta Detector Calibration long numBChannel = struct.num_b_channel; List bChannel = struct.b_channel; @@ -2187,11 +2188,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements long gChannels = struct.g_channels; List hCounts = struct.h_counts; int bRecordCount = struct.b_record_count; + String acqStartTime = String.format("%s %s", struct.acquisition_start_date, struct.acquisition_start_time); + String acqStartTimeFormat = DateUtils.dateformat(acqStartTime, "yyyy/MM/dd HH:mm:ss.S", "yyyy-MM-dd HH:mm:ss"); + map.put("acqStartTime", acqStartTimeFormat); //散点图坐标点关联beta部分相关数据 List> betaEnergyList = new LinkedList<>(); List betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List bchannels = new ArrayList<>(); - for (int i=0; i betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam); @@ -2205,7 +2209,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List gchannels = new ArrayList<>(); List> gammaEnergyList = new LinkedList<>(); - for (int i=0; i gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam); @@ -2215,11 +2219,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } //Beta-Gamma Spectrum: QC 散点图相关数据 List histogramDataList = new LinkedList<>(); - for (int column=0; column0) { + if (count > 0) { HistogramData histogramData = new HistogramData(); histogramData.setB(row); histogramData.setG(column); @@ -2230,7 +2234,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements map.put("histogramData", histogramDataList); //计算Calibration Parameter Of Gamma Detector 拟合线图数据 List oldScatterSeries = new LinkedList<>(); - for (int i=0; i fittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List fittingParaStr = new LinkedList<>(); - for (Double para:fittingPara) { + for (Double para : fittingPara) { fittingParaStr.add(String.valueOf(para)); } map.put("CToE", fittingParaStr); @@ -2293,29 +2297,29 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //记录点值数组 List newSeriseDataList = new LinkedList<>(); //遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组 - for (int i=0; i newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); - for (Double para:newFittingPara) { + for (Double para : newFittingPara) { newFittingParaStr.add(String.valueOf(para)); } map.put("newCToE", newFittingParaStr); //填充道值数组的数据 - for (int i=0; i<255; i++) { + for (int i = 0; i < 255; i++) { channels.add(Double.valueOf(i)); } //计算道值的能量 - List energys = EnergySpectrumHandler.GetFileFittingData(channels,newFittingPara); + List energys = EnergySpectrumHandler.GetFileFittingData(channels, newFittingPara); //根据临时点的道值修改对应能量值 //遍历所有道值 - for (int i=0; i< channels.size(); i++) { + for (int i = 0; i < channels.size(); i++) { //获取道值 double newChannel = channels.get(i).doubleValue(); //遍历临时点数据 - for (int j=0; j newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); energyList.add(newEnergy); } //遍历道值添加各道值对应点数据到数组 - for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); - for (Double para:newFittingParaToUi) { + for (Double para : newFittingParaToUi) { newFittingParaToUiStr.add(String.valueOf(para)); } map.put("newEToC", newFittingParaToUiStr); } - if (betaDataFile.getBetaList().size()<=0) { + if (betaDataFile.getBetaList().size() <= 0) { betaDataFile.setBetaList(oldScatterSeries); } - if (betaDataFile.getBetaFittingPara().size()<=0) { + if (betaDataFile.getBetaFittingPara().size() <= 0) { betaDataFile.setBetaFittingPara(fittingParaStr); } - if (betaDataFile.getBetaFittingParaToUi().size()<=0) { + if (betaDataFile.getBetaFittingParaToUi().size() <= 0) { betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr); } } @@ -2404,7 +2408,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //蓝色线 List gCounts = struct.g_counts; List gammaOriginSeriseData = new LinkedList<>(); - for (int i=0; i< struct.num_g_channel; i++){ + for (int i = 0; i < struct.num_g_channel; i++) { long count = gCounts.get(i); SeriseData temp = new SeriseData(); temp.setX(i); @@ -2415,12 +2419,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List chanelEnergy = new LinkedList<>(); List gCentroidChannel = struct.g_centroid_channel; List gEnergy = struct.g_energy; - List fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel,gEnergy); - for (int i=0; i fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); + for (int i = 0; i < struct.num_g_channel; i++) { List channel = new LinkedList<>(); channel.add(Double.valueOf(i)); List energy = EnergySpectrumHandler.GetFileFittingData(channel, fittingPara); - if(CollectionUtils.isNotEmpty(energy)) { + if (CollectionUtils.isNotEmpty(energy)) { chanelEnergy.add(energy.get(0)); } } @@ -2428,7 +2432,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //绿色线 List gammaProjectedSeriseData = new LinkedList<>(); List gammaProjectedDataValue = this.handleHistogram(struct.h_counts, struct.b_channels, struct.g_channels, "Vertical"); - for (int i=0; i bCounts = struct.b_counts; List betaOriginSeriseData = new LinkedList<>(); - for (int i=0; i< struct.num_b_channel; i++){ + for (int i = 0; i < struct.num_b_channel; i++) { long count = bCounts.get(i); SeriseData temp = new SeriseData(); temp.setX(i); @@ -2450,7 +2454,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements map.put("betaOriginSeriseData", betaOriginSeriseData); List betaProjectedSeriseData = new LinkedList<>(); List betaProjectedDataValue = this.handleHistogram(struct.h_counts, struct.b_channels, struct.g_channels, "Horizontal"); - for (int i=0; i Eb = new LinkedList<>(); List Ny = new LinkedList<>(); List Nx = new LinkedList<>(); - while(index<=51&&EbT>min_e) { - double s_Nb=0.0; - double d_Nb=0.0; - for(int k = index*5;k min_e) { + double s_Nb = 0.0; + double d_Nb = 0.0; + for (int k = index * 5; k < sample_b_spectrum.size() && k < detbgr_b_spectrum.size() && k < 255; k++) { s_Nb += sample_b_spectrum.get(k); d_Nb += detbgr_b_spectrum.get(k); } - double NbR = (s_Nb/sampleRealTime)-(d_Nb/detbgrRealTime); + double NbR = (s_Nb / sampleRealTime) - (d_Nb / detbgrRealTime); double s_Nc = 0.0; double d_Nc = 0.0; - for(int l = index*5;l<=255;l++) { - for(int m=begin;m<=end&&(256*m+l) scatter_serise_data = new LinkedList<>(); - double maxLeft=0.0; - double maxBottom=0.0; - double minLeft=0.0; - for(int i=0;iNx.get(i)) { + if (minLeft > Nx.get(i)) { minLeft = Nx.get(i); } - if(maxLeftNy.get(i)) { + if (minLeft > Ny.get(i)) { minLeft = Ny.get(i); } } - for(int i=0;i extDataList = new LinkedList<>(); - for(int i=0;i Eb = extInfo.getEb(); List Ny = extInfo.getNy(); List Nx = extInfo.getNx(); - int pos=0; + int pos = 0; String fittype = extInfo.getFitType(); - if(fittype.equals("liner")) { - pos=1; - } else if(fittype.equals("poly2")) { - pos=0; - } else if(fittype.equals("poly3")) { + if (fittype.equals("liner")) { + pos = 1; + } else if (fittype.equals("poly2")) { + pos = 0; + } else if (fittype.equals("poly3")) { } - double lamadaXe = Math.log(2)/(extInfo.getHalfLife()*24*60*60); + double lamadaXe = Math.log(2) / (extInfo.getHalfLife() * 24 * 60 * 60); List fittingPara = new LinkedList<>(); - fittingPara = EnergySpectrumHandler.GetFittingPara(Nx,Ny,fittype); - if(CollectionUtils.isEmpty(fittingPara) && pos>fittingPara.size()-1) { + fittingPara = EnergySpectrumHandler.GetFittingPara(Nx, Ny, fittype); + if (CollectionUtils.isEmpty(fittingPara) && pos > fittingPara.size() - 1) { return result; } double acqRealTime = extInfo.getAcqRealTime(); - double Xe_activity = fittingPara.get(pos)*(lamadaXe*acqRealTime)/(1-Math.exp(-lamadaXe*acqRealTime)); + double Xe_activity = fittingPara.get(pos) * (lamadaXe * acqRealTime) / (1 - Math.exp(-lamadaXe * acqRealTime)); List line_serise_data = new LinkedList<>(); - double maxLeft=0.0; - double maxBottom=0.0; - double minLeft=0.0; - for(int i=0;iNx.get(i)) { + if (minLeft > Nx.get(i)) { minLeft = Nx.get(i); } - if(maxLeftNy.get(i)) { + if (minLeft > Ny.get(i)) { minLeft = Ny.get(i); } } String functionFit = ""; - if(fittype.equals("liner")) { + if (fittype.equals("liner")) { SeriseData left = new SeriseData(); List data = new LinkedList<>(); List rData = new LinkedList<>(); @@ -2664,38 +2668,38 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements data.clear(); rData.clear(); - data.add(Nx.get(Nx.size()-1)); - rData = EnergySpectrumHandler.GetFittingData(data,fittype,fittingPara); + data.add(Nx.get(Nx.size() - 1)); + rData = EnergySpectrumHandler.GetFittingData(data, fittype, fittingPara); SeriseData right = new SeriseData(); - right.setX(Nx.get(Nx.size()-1)); + right.setX(Nx.get(Nx.size() - 1)); right.setY(rData.get(0)); line_serise_data.add(left); line_serise_data.add(right); functionFit = "y = a*x + b "; - if (Nx.size()>1) { + if (Nx.size() > 1) { functionFit = String.format("y = %f*x + %f ", fittingPara.get(0), fittingPara.get(1)); } - } else if(fittype.equals("poly2")) { - for(int i=1;i<51;i++) { + } else if (fittype.equals("poly2")) { + for (int i = 1; i < 51; i++) { SeriseData temp = new SeriseData(); List data = new LinkedList<>(); List rData = new LinkedList<>(); - data.add(i*maxBottom/50); - rData = EnergySpectrumHandler.GetFittingData(data,fittype,fittingPara); - temp.setX(i*maxBottom/50); + data.add(i * maxBottom / 50); + rData = EnergySpectrumHandler.GetFittingData(data, fittype, fittingPara); + temp.setX(i * maxBottom / 50); temp.setY(rData.get(0)); line_serise_data.add(temp); } functionFit = "y = a+ b*x + c*x^2 "; - if (Nx.size()>1) { - functionFit = String.format("y = %f+ %f*x + %f*x^2 ",fittingPara.get(0),fittingPara.get(1),fittingPara.get(2)); + if (Nx.size() > 1) { + functionFit = String.format("y = %f+ %f*x + %f*x^2 ", fittingPara.get(0), fittingPara.get(1), fittingPara.get(2)); } - } else if(fittype.equals("poly3")) { + } else if (fittype.equals("poly3")) { functionFit = "y = a+ b*x + c*x^2 +d*x^3 "; } String refTime = ""; String xeAct = ""; - if (Nx.size()>1) { + if (Nx.size() > 1) { refTime = extInfo.getAcqStartTime(); xeAct = String.valueOf(Xe_activity); } @@ -2710,19 +2714,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements private List handleHistogram(List hcounts, long bChannels, long gChannels, String type) { List projected_data_value = new LinkedList<>(); - if (type.equals("Vertical")){ - for (int i=0; i stationMap = (Map)redisUtil.get("stationMap"); - if (CollectionUtils.isEmpty(stationMap)){ + Map stationMap = (Map) redisUtil.get("stationMap"); + if (CollectionUtils.isEmpty(stationMap)) { result.error500("The station cache information is empty!"); return result; } List stationNames = stationMap.values().stream().collect(Collectors.toList()); int index = stationNames.indexOf(stationName); - if (index<0){ + if (index < 0) { result.error500("The station information does not exist!"); return result; } @@ -2784,14 +2788,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Result result = new Result(); Map map = new HashMap<>(); //根据台站id查询台站名称 - Map stationMap = (Map)redisUtil.get("stationMap"); - if (CollectionUtils.isEmpty(stationMap)){ + Map stationMap = (Map) redisUtil.get("stationMap"); + if (CollectionUtils.isEmpty(stationMap)) { result.error500("The station cache information is empty!"); return result; } List stationNames = stationMap.values().stream().collect(Collectors.toList()); int index = stationNames.indexOf(stationName); - if (index<0){ + if (index < 0) { result.error500("The station information does not exist!"); return result; } @@ -2815,37 +2819,37 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public Result statisticsQuery(StatisticsQueryData statisticsQueryData) { Result result = new Result(); - if (Objects.isNull(statisticsQueryData.getStartTime())){ + if (Objects.isNull(statisticsQueryData.getStartTime())) { result.error500("The start time cannot be empty"); return result; } String startDate = DateUtils.formatDate(statisticsQueryData.getStartTime(), "yyyy-MM-dd"); statisticsQueryData.setStartDate(startDate); - if (Objects.isNull(statisticsQueryData.getEndTime())){ + if (Objects.isNull(statisticsQueryData.getEndTime())) { result.error500("The end time cannot be empty"); return result; } String endDate = DateUtils.formatDate(statisticsQueryData.getEndTime(), "yyyy-MM-dd"); statisticsQueryData.setEndDate(endDate); List detectorIdList = new LinkedList<>(); - if (StringUtils.isNotBlank(statisticsQueryData.getDetectorName())){ - if (statisticsQueryData.getDetectorName().equals("All")){ + if (StringUtils.isNotBlank(statisticsQueryData.getDetectorName())) { + if (statisticsQueryData.getDetectorName().equals("All")) { List detectorList = spectrumAnalysisMapper.getDetectorList(statisticsQueryData.getStationId()); detectorIdList = detectorList.stream().map(GardsDetectors::getDetectorId).collect(Collectors.toList()); - }else { + } else { detectorIdList.add(statisticsQueryData.getDetectorId()); } } statisticsQueryData.setDetectorList(detectorIdList); List items = new LinkedList<>(); - if (statisticsQueryData.isMDC()){ + if (statisticsQueryData.isMDC()) { items.add("GXR.MDC"); } - if (statisticsQueryData.isActivity()){ + if (statisticsQueryData.isActivity()) { items.add("GXR.CONC"); } statisticsQueryData.setItems(items); - if (CollectionUtils.isEmpty(statisticsQueryData.getNuclidesList())){ + if (CollectionUtils.isEmpty(statisticsQueryData.getNuclidesList())) { statisticsQueryData.setNuclidesList(new LinkedList<>()); } //根据类型判断查询对应数据 @@ -2853,14 +2857,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Map resultMap = new HashMap<>(); List stcGraphList = new LinkedList<>(); List allDate = new LinkedList<>(); - for (StatisticsData data:statisticsData) { + for (StatisticsData data : statisticsData) { Date collectStart = data.getCollectStart(); String formatDate = DateUtils.formatDate(collectStart, "yyyy-MM-dd HH:mm:ss"); allDate.add(formatDate); } allDate = allDate.stream().distinct().sorted().collect(Collectors.toList()); //判断查询结果是否包含Xe131m的信息 - if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_131m.getType())){ + if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_131m.getType())) { StcGraph stcGraphMDC = new StcGraph(); stcGraphMDC.setM_strGraphName("Xe131m MDC"); stcGraphMDC.setM_GraphPen("#00cafd"); @@ -2873,13 +2877,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements xe131m = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_131m.getType())).collect(Collectors.toList()); } //判断数据是否为空 - if (CollectionUtils.isNotEmpty(xe131m)){ + if (CollectionUtils.isNotEmpty(xe131m)) { //判断是否有勾选MDC数据进行返回 - if (statisticsQueryData.isMDC()){ + if (statisticsQueryData.isMDC()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); //遍历xe11m的数据 - for (StatisticsData data:xe131m) { + for (StatisticsData data : xe131m) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getMdc()); @@ -2887,11 +2891,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } - if (statisticsQueryData.isActivity()){ + if (statisticsQueryData.isActivity()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); //遍历xe131m数据 - for (StatisticsData data:xe131m) { + for (StatisticsData data : xe131m) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getConc()); @@ -2903,7 +2907,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphList.add(stcGraphMDC); stcGraphList.add(stcGraphAct); } - if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_133m.getType())){ + if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_133m.getType())) { StcGraph stcGraphMDC = new StcGraph(); stcGraphMDC.setM_strGraphName("Xe133m MDC"); stcGraphMDC.setM_GraphPen("#119e4f"); @@ -2914,12 +2918,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (CollectionUtils.isNotEmpty(statisticsData)) { xe133m = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_133m.getType())).collect(Collectors.toList()); } - if (CollectionUtils.isNotEmpty(xe133m)){ - if (statisticsQueryData.isMDC()){ + if (CollectionUtils.isNotEmpty(xe133m)) { + if (statisticsQueryData.isMDC()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); //遍历xe133m数据 - for (StatisticsData data:xe133m) { + for (StatisticsData data : xe133m) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getMdc()); @@ -2927,10 +2931,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } - if (statisticsQueryData.isActivity()){ + if (statisticsQueryData.isActivity()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:xe133m) { + for (StatisticsData data : xe133m) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getConc()); @@ -2942,7 +2946,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphList.add(stcGraphMDC); stcGraphList.add(stcGraphAct); } - if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_133.getType())){ + if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_133.getType())) { StcGraph stcGraphMDC = new StcGraph(); stcGraphMDC.setM_strGraphName("Xe133 MDC"); stcGraphMDC.setM_GraphPen("#00cafd"); @@ -2953,11 +2957,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (CollectionUtils.isNotEmpty(statisticsData)) { xe133 = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_133.getType())).collect(Collectors.toList()); } - if (CollectionUtils.isNotEmpty(xe133)){ - if (statisticsQueryData.isMDC()){ + if (CollectionUtils.isNotEmpty(xe133)) { + if (statisticsQueryData.isMDC()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:xe133) { + for (StatisticsData data : xe133) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getMdc()); @@ -2965,10 +2969,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } - if (statisticsQueryData.isActivity()){ + if (statisticsQueryData.isActivity()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:xe133) { + for (StatisticsData data : xe133) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getConc()); @@ -2980,7 +2984,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphList.add(stcGraphMDC); stcGraphList.add(stcGraphAct); } - if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_135.getType())){ + if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_135.getType())) { StcGraph stcGraphMDC = new StcGraph(); stcGraphMDC.setM_strGraphName("Xe135 MDC"); stcGraphMDC.setM_GraphPen("#1775e7"); @@ -2991,11 +2995,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (CollectionUtils.isNotEmpty(statisticsData)) { xe135 = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_135.getType())).collect(Collectors.toList()); } - if (CollectionUtils.isNotEmpty(xe135)){ - if (statisticsQueryData.isMDC()){ + if (CollectionUtils.isNotEmpty(xe135)) { + if (statisticsQueryData.isMDC()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:xe135) { + for (StatisticsData data : xe135) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getMdc()); @@ -3003,10 +3007,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } - if (statisticsQueryData.isActivity()){ + if (statisticsQueryData.isActivity()) { List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:xe135) { + for (StatisticsData data : xe135) { String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); keys.add(formatDate); values.add(data.getConc()); @@ -3028,22 +3032,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public Result statisticsQueryBtn(Integer detectorId, String detectorName, Integer stationId, String statisticsType, Date startTime, Date endTime) { Result result = new Result(); - if (Objects.isNull(startTime)){ + if (Objects.isNull(startTime)) { result.error500("The start time cannot be empty"); return result; } String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd"); - if (Objects.isNull(endTime)){ + if (Objects.isNull(endTime)) { result.error500("The end time cannot be empty"); return result; } String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd"); List detectorIdList = new LinkedList<>(); - if (StringUtils.isNotBlank(detectorName)){ - if (detectorName.equals("All")){ + if (StringUtils.isNotBlank(detectorName)) { + if (detectorName.equals("All")) { List detectorList = spectrumAnalysisMapper.getDetectorList(stationId); detectorIdList = detectorList.stream().map(GardsDetectors::getDetectorId).collect(Collectors.toList()); - }else { + } else { detectorIdList.add(detectorId); } } @@ -3054,7 +3058,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraph.setM_GraphPen("green"); List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:statisticsData) { + for (StatisticsData data : statisticsData) { keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } @@ -3069,7 +3073,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraph.setM_GraphPen("green"); List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:statisticsData) { + for (StatisticsData data : statisticsData) { keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } @@ -3084,7 +3088,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraph.setM_GraphPen("green"); List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:statisticsData) { + for (StatisticsData data : statisticsData) { keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } @@ -3099,7 +3103,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraph.setM_GraphPen("green"); List keys = new LinkedList<>(); List values = new LinkedList<>(); - for (StatisticsData data:statisticsData) { + for (StatisticsData data : statisticsData) { keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } @@ -3148,33 +3152,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if ((CollectionUtils.isNotEmpty(tempPoints) && tempPoints.size() > 2 && Objects.nonNull(count) && tempPoints.size() != count) || (Objects.isNull(paramA) || StringUtils.isBlank(String.valueOf(paramA))) || (Objects.isNull(paramB) || StringUtils.isBlank(String.valueOf(paramB))) - || (Objects.isNull(paramC) || StringUtils.isBlank(String.valueOf(paramC))) ){ + || (Objects.isNull(paramC) || StringUtils.isBlank(String.valueOf(paramC)))) { //遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组 - for (int i=0; i energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara); + List energys = EnergySpectrumHandler.GetFileFittingData(channels, fittingPara); //如果当前fitting按钮没有进行过操作 并且 操作的是gamma探测器相关的 if (tabName.equalsIgnoreCase("gamma") && !fittingBtn) { //根据临时点的道值修改对应能量值 //遍历所有道值 - for (int i=0; i< channels.size(); i++) { + for (int i = 0; i < channels.size(); i++) { //获取道值 double channel = channels.get(i).doubleValue(); //遍历临时点数据 - for (int j=0; j newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); energyList.add(newEnergy); } //遍历道值添加各道值对应点数据到数组 - for (int i=0; i fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); - for (Double para:fittingParaToUi) { + for (Double para : fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); } map.put("EToC", fittingParaToUiStr); @@ -3231,16 +3235,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements fittingParaStr.add(String.valueOf(paramC)); map.put("CToE", fittingParaStr); //遍历点位数组 将横坐标的数据加入到数组中 - for (int i=0; i energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara); - for (Double calEnergy:energys) { + List energys = EnergySpectrumHandler.GetFileFittingData(channels, fittingPara); + for (Double calEnergy : energys) { List newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); energyList.add(newEnergy); } //遍历道值 将道值和新的能量封装到新的点位数组 - for (int i=0; i fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); - for (Double para:fittingParaToUi) { + for (Double para : fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); } map.put("EToC", fittingParaToUiStr); @@ -3312,11 +3316,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return result; } //选择矩形框高度 - Integer flagHeight = channelWidth * (chartHeight/256); + Integer flagHeight = channelWidth * (chartHeight / 256); int value = Double.valueOf(flagHeight / 2).intValue(); //计算得到最高值 int up = gammaChannel - value; - if (up<0){ + if (up < 0) { up = 0; } //计算得到最低值 @@ -3327,9 +3331,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements long bChannels = struct.b_channels; List hCounts = struct.h_counts; List serise_data = new LinkedList<>(); - for ( int i=0; i sampleBoundary = (List) xeMap.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) xeMap.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) xeMap.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) xeMap.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } List xeResultsSpectrumList = (List) xeMap.get("XeData"); - if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ - for (GardsXeResultsSpectrum xeData: xeResultsSpectrumList) { + if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { + for (GardsXeResultsSpectrum xeData : xeResultsSpectrumList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); xeData.setNidFlag(0); - } else if (0 mdc) { @@ -3593,19 +3597,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements xeMap.put("savedAnalysisResult", true); } else { List sampleBoundary = (List) xeMap.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) xeMap.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) xeMap.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) xeMap.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } betaDataFile.setBProcessed(false); @@ -3622,14 +3626,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return xeMap; } - private Map BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName){ + private Map BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName) { //从本地缓存获取beta gamma的数组 Cache cache = betaCache.getBetaCache(); //返回最终结果用的map Map> analyseResultMap = new HashMap<>(); try { //需要操作的数据集合 - for (String sampleFileName: analyseData.getSampleFileNames()){ + for (String sampleFileName : analyseData.getSampleFileNames()) { //使用当前文件名称获取用于获取计算的参数内容 BetaDataFile betaDataFile = cache.getIfPresent(currentFileName + "-" + userName); //获取缓存的计算结果 @@ -3641,7 +3645,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List gammaFittingPara = new LinkedList<>(); List gammaFittingParaToUi = new LinkedList<>(); List> gammaNewEnergyListNow = new LinkedList<>(); - //根据sample文件名称获取当前文件的缓存信息 + //根据sample文件名称获取当前文件的缓存信息 BetaDataFile sampleBetaData = cache.getIfPresent(sampleFileName + "-" + userName); //存储重新分析字段的实体类 SpectrumGroup spectrum_group = new SpectrumGroup(); @@ -3792,30 +3796,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } if (bRet) { List sampleBoundary = (List) xeMap.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { sampleBetaData.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) xeMap.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { sampleBetaData.setGasBoundary(gasBoundary); } List detBoundary = (List) xeMap.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { sampleBetaData.setDetBoundary(detBoundary); } List qcBoundary = (List) xeMap.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { sampleBetaData.setQcBoundary(qcBoundary); } List xeResultsSpectrumList = (List) xeMap.get("XeData"); - if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ - for (GardsXeResultsSpectrum xeData:xeResultsSpectrumList) { + if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { + for (GardsXeResultsSpectrum xeData : xeResultsSpectrumList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); xeData.setNidFlag(0); - } else if (0 mdc) { @@ -3836,19 +3840,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements analyseResultMap.put(sampleFileName, xeMap); } else { List sampleBoundary = (List) xeMap.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { sampleBetaData.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) xeMap.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { sampleBetaData.setGasBoundary(gasBoundary); } List detBoundary = (List) xeMap.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { sampleBetaData.setDetBoundary(detBoundary); } List qcBoundary = (List) xeMap.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { sampleBetaData.setQcBoundary(qcBoundary); } sampleBetaData.setBProcessed(false); @@ -3922,31 +3926,31 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } List sampleBoundary = (List) map.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) map.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) map.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) map.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } if (CollectionUtils.isNotEmpty(map)) { List xeDataList = (List) map.get("XeData"); - if (CollectionUtils.isNotEmpty(xeDataList)){ - for (GardsXeResultsSpectrum xeData:xeDataList) { + if (CollectionUtils.isNotEmpty(xeDataList)) { + for (GardsXeResultsSpectrum xeData : xeDataList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); xeData.setNidFlag(0); - } else if (0 mdc) { @@ -3966,19 +3970,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } else { List sampleBoundary = (List) map.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) map.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) map.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) map.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } map.put("XeData", Collections.EMPTY_LIST); @@ -4006,7 +4010,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Map> mapList = new HashMap<>(); try { if (CollectionUtils.isNotEmpty(sampleFileNames)) { - for (int i=0; i map = new HashMap<>(); @@ -4037,7 +4041,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements gammaFittingParaToUi = betaDataFile.getGammaFittingParaToUi(); BgCalPara = betaDataFile.getBgPara(); } - if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) { + if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) { //调用分析方法 boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map, betaDataFile); //分析qc文件信息并重新计算qc边界值 @@ -4049,30 +4053,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } if (bRet) { List sampleBoundary = (List) map.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) map.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) map.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) map.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } List xeDataList = (List) map.get("XeData"); - if (CollectionUtils.isNotEmpty(xeDataList)){ - for (GardsXeResultsSpectrum xeData:xeDataList) { + if (CollectionUtils.isNotEmpty(xeDataList)) { + for (GardsXeResultsSpectrum xeData : xeDataList) { Double conc = xeData.getConc(); Double mdc = xeData.getMdc(); - if (conc < 0){ + if (conc < 0) { xeData.setColor("red"); xeData.setNidFlag(0); - } else if (0 mdc) { @@ -4092,19 +4096,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements mapList.put(sampleFileName, map); } else { List sampleBoundary = (List) map.get("SampleBoundary"); - if(CollectionUtils.isNotEmpty(sampleBoundary)) { + if (CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) map.get("GasBoundary"); - if(CollectionUtils.isNotEmpty(gasBoundary)) { + if (CollectionUtils.isNotEmpty(gasBoundary)) { betaDataFile.setGasBoundary(gasBoundary); } List detBoundary = (List) map.get("DetBoundary"); - if(CollectionUtils.isNotEmpty(detBoundary)) { + if (CollectionUtils.isNotEmpty(detBoundary)) { betaDataFile.setDetBoundary(detBoundary); } List qcBoundary = (List) map.get("QCBoundary"); - if(CollectionUtils.isNotEmpty(qcBoundary)) { + if (CollectionUtils.isNotEmpty(qcBoundary)) { betaDataFile.setQcBoundary(qcBoundary); } map.put("XeData", Collections.EMPTY_LIST); @@ -4129,14 +4133,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) { String logPath = spectrumAnalysisMapper.findAutomaticLogPath(sampleId); - if (StringUtils.isBlank(logPath)){ + if (StringUtils.isBlank(logPath)) { throw new RuntimeException("The log generated by the automatic processor does not exist!"); } InputStream inputStream = null; ServletOutputStream outputStream = null; try { inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath); - if (Objects.nonNull(inputStream)){ + if (Objects.nonNull(inputStream)) { outputStream = response.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; @@ -4149,10 +4153,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements throw new RuntimeException(e); } finally { try { - if (ObjectUtil.isNotNull(inputStream)){ + if (ObjectUtil.isNotNull(inputStream)) { inputStream.close(); } - if (ObjectUtil.isNotNull(outputStream)){ + if (ObjectUtil.isNotNull(outputStream)) { outputStream.close(); } } catch (IOException e) { @@ -4285,8 +4289,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //判断当前分析员是否有过历史分析当前文件 Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleFilePathName, anlyseResultIn.getUserName()); //如果当前分析员在当天没有排班任务 并且 没有历史分析过当前文件 则不允许进行保存操作 - if ( !bAnalysisResultWriteAuthority && Objects.isNull(isExist) ){ - result.error500("You have no permission to save "+anlyseResultIn.getStationName()+" results to DB!"); + if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) { + result.error500("You have no permission to save " + anlyseResultIn.getStationName() + " results to DB!"); return result; } //处理数据 获取对应的channel/energy值 @@ -4294,22 +4298,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //分析文件内容 analyzePHDFile(anlyseResultIn, betaDataFile); //判断文件是否存储过 如果没有则解析文件并进行存储 - if ( !OriginalDataStore(betaDataFile, "gas", gasFilePathName) ){ + if (!OriginalDataStore(betaDataFile, "gas", gasFilePathName)) { result.error500("gasFile save failed"); return result; } - if ( !OriginalDataStore(betaDataFile, "det", detFilePathName) ){ + if (!OriginalDataStore(betaDataFile, "det", detFilePathName)) { result.error500("detFile save failed"); return result; } if (StringUtils.isNotBlank(anlyseResultIn.getQcFileName())) { - if ( !OriginalDataStore(betaDataFile, "qc", qcFilePathName) ){ + if (!OriginalDataStore(betaDataFile, "qc", qcFilePathName)) { result.error500("qcFile save failed"); return result; } qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName); } - if ( !OriginalDataStore(betaDataFile, "sample", sampleFilePathName) ){ + if (!OriginalDataStore(betaDataFile, "sample", sampleFilePathName)) { result.error500("sampleFile save failed"); return result; } @@ -4317,18 +4321,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements EnergySpectrumStruct sampleStruct = betaDataFile.getSampleStruct(); String dataType = sampleStruct.data_type; String subDirSavePath = ""; - subDirSavePath+=nameStandUtil.GetSysTemSubdir(sampleStruct.system_type); - subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType); + subDirSavePath += nameStandUtil.GetSysTemSubdir(sampleStruct.system_type); + subDirSavePath += nameStandUtil.GetDateTypeSubdir(dataType); String path = nameStandUtil.SetFileDir(subDirSavePath, betaDataFile.getSampleFileName()); Map fileNameMap = nameStandUtil.NameStandard(dataType, sampleStruct.spectrum_quantity, sampleStruct.acquisition_live_time, betaDataFile.getSampleFileName(), sampleStruct.measurement_id); String logName = fileNameMap.get("log"); - String qsLogPath= path+StringPool.SLASH+userName+"_"+logName; + String qsLogPath = path + StringPool.SLASH + userName + "_" + logName; qsLogPath = qsLogPath.replace(StringPool.BACK_SLASH, StringPool.SLASH); String rptName = fileNameMap.get("rpt"); - String qsReportPath="Rrr"+StringPool.SLASH+path+StringPool.SLASH+userName+"_"+rptName; + String qsReportPath = "Rrr" + StringPool.SLASH + path + StringPool.SLASH + userName + "_" + rptName; qsReportPath = qsReportPath.replace(StringPool.BACK_SLASH, StringPool.SLASH); - String analyses_absolute_LogPath=spectrumPathProperties.getLogPath()+StringPool.SLASH+qsLogPath; - String analyses_absolute_ReportPath=spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsReportPath; + String analyses_absolute_LogPath = spectrumPathProperties.getLogPath() + StringPool.SLASH + qsLogPath; + String analyses_absolute_ReportPath = spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qsReportPath; //根据文件名称查询对应的sampleId--- sampleFile gasFile detFile sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName); gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName); @@ -4350,9 +4354,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements gardsAnalyses.setAnalyst(anlyseResultIn.getUserName()); gardsAnalyses.setLogPath(qsLogPath); gardsAnalyses.setReportPath(qsReportPath); - if (Objects.nonNull(isExist)){ + if (Objects.nonNull(isExist)) { spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses); - }else {//如果没有分析过就新增--GARDS_ANALYSES + } else {//如果没有分析过就新增--GARDS_ANALYSES spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses); } betaDataFile.setSampleId(String.valueOf(sampleId)); @@ -4361,12 +4365,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Integer idAnalysis = analysis.getIdAnalysis(); //获取sample,gas,det三个文件分别对应的beta,gamma数据集合 //如果分析过--删除GARDS_CALIBRATION_PAIRS表数据 新增GARDS_CALIBRATION_PAIRS表数据 - if (Objects.nonNull(isExist)){ + if (Objects.nonNull(isExist)) { //根据idAnalysis删除GARDS_CALIBRATION_PAIRS表数据 spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis); //遍历新增GARDS_CALIBRATION_PAIRS表数据 gardsCalibrationPairsSpectrumService.saveGardsCalibrationPairs(anlyseResultIn, sampleId, gasId, detId, idAnalysis); - }else {//如果没有分析过--新增GARDS_CALIBRATION_PAIRS表数据 + } else {//如果没有分析过--新增GARDS_CALIBRATION_PAIRS表数据 //遍历新增GARDS_CALIBRATION_PAIRS表数据 gardsCalibrationPairsSpectrumService.saveGardsCalibrationPairs(anlyseResultIn, sampleId, gasId, detId, idAnalysis); } @@ -4383,17 +4387,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } //gards_roi_channels数据表 //如果分析过数据 - if (Objects.nonNull(isExist)){ + if (Objects.nonNull(isExist)) { //删除gards_roi_channels数据表数据 spectrumAnalysisMapper.deleteROIChannels(idAnalysis); //新增gards_roi_channels数据表数据 gardsROIChannelsSpectrumService.saveGardsROIChannels(anlyseResultIn, sampleId, gasId, detId, idAnalysis); - }else {//没有分析过 + } else {//没有分析过 //新增gards_roi_channels数据表数据 gardsROIChannelsSpectrumService.saveGardsROIChannels(anlyseResultIn, sampleId, gasId, detId, idAnalysis); } //gards_Xe_results数据表 - if(Objects.nonNull(isExist)) { + if (Objects.nonNull(isExist)) { //删除gards_Xe_results数据表数据 spectrumAnalysisMapper.deleteXeResult(idAnalysis); //新增gards_Xe_results数据表数据 @@ -4403,7 +4407,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements gardsXeResultsSpectrumService.saveGardsXeResults(anlyseResultIn, sampleId, idAnalysis); } //gards_roi_results数据表 - if(Objects.nonNull(isExist)) { + if (Objects.nonNull(isExist)) { //删除gards_roi_results数据表数据 spectrumAnalysisMapper.deleteROIResults(idAnalysis); //新增gards_roi_results数据表数据 @@ -4457,26 +4461,26 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (!logPath.exists()) { logPath.mkdirs(); } - File logFile = new File(logFilePath + File.separator +localLogName); + File logFile = new File(logFilePath + File.separator + localLogName); try { //判断日志文件是否存在 如果不存在创建一个空的文件 上传到ftp if (!logFile.exists()) { FileUtil.writeString("", logFile, "UTF-8"); } FileInputStream in = new FileInputStream(logFile); - ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_LogPath, in); + ftpUtil.saveFile(spectrumPathProperties.getRootPath() + analyses_absolute_LogPath, in); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } { String rptContent = phdFileUtil.OutPutRnRpt(betaDataFile); - String rptFileName = analyses_absolute_ReportPath.substring(analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt"; + String rptFileName = analyses_absolute_ReportPath.substring(analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt"; File rptFile = new File(rptFileName); try { FileUtil.writeString(rptContent, rptFile, "UTF-8"); FileInputStream in = new FileInputStream(rptFile); - ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_ReportPath+".txt", in); + ftpUtil.saveFile(spectrumPathProperties.getRootPath() + analyses_absolute_ReportPath + ".txt", in); } catch (FileNotFoundException e) { throw new RuntimeException(e); } finally { @@ -4518,7 +4522,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //根据新的文件路径名称查询数据是否存在 GardsSampleData isExist = spectrumAnalysisMapper.findSampleByFile(filePathName); //如果数据已经存入过数据库 则 修改状态后返回 - if (Objects.nonNull(isExist)){ + if (Objects.nonNull(isExist)) { //如果文件已经存入过数据库则修改状态 spectrumAnalysisMapper.updateAnalysesStatus(filePathName); return true; @@ -4527,7 +4531,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements EnergySpectrumStruct sourceData = null; File file = null; try { - if (Objects.nonNull(betaDataFile)){ + if (Objects.nonNull(betaDataFile)) { if (type.equalsIgnoreCase("sample")) { file = new File(betaDataFile.getSampleTmpPath()); @@ -4547,7 +4551,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //查询台站id Integer stationId = spectrumAnalysisMapper.getStationId(sourceData.site_code); Integer detectorId = spectrumAnalysisMapper.getDetectorId(sourceData.detector_code); - if(Objects.isNull(stationId) || Objects.isNull(detectorId)) { + if (Objects.isNull(stationId) || Objects.isNull(detectorId)) { String error = "get station_id or detect_id error"; return false; } @@ -4558,36 +4562,36 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //存储Gards_Sample_Aux表数据 sampleAuxSpectrumService.saveSampleAux(sourceData, sampleId, readLines); //判断文件是否包含Comment块 新增Gards_Description数据 - if (readLines.contains(SampleFileHeader.COMMENT.getMessage())){ + if (readLines.contains(SampleFileHeader.COMMENT.getMessage())) { sampleDescriptionSpectrumService.saveSampleDescription(sourceData, sampleId); } //判断文件是否包含Certificate块 新增Gards_Sample_Cert数据 - if (readLines.contains(SampleFileHeader.CERTIFICATE.getMessage())){ + if (readLines.contains(SampleFileHeader.CERTIFICATE.getMessage())) { sampleCertSpectrumService.saveSampleCert(sourceData, sampleId); sampleCertLineSpectrumService.saveSampleCertLine(sourceData, sampleId); } //新增Gards_Calibration_Pairs_Orig数据 calibrationPairsOrigSpectrumService.saveGardsCalibrationPairsOrig(sourceData, sampleId, readLines); //判断文件是否包含b-gEfficiency块 新增Gards_Sample_Cert数据 - if (readLines.contains(SampleFileHeader.BGEFFICIENCY.getMessage())){ + if (readLines.contains(SampleFileHeader.BGEFFICIENCY.getMessage())) { bgEfficiencyPairsSpectrumService.saveBgEfficiencyPairs(sourceData, sampleId); } //判断文件是否包含TotalEff块 新增Gards_Sample_Cert数据 - if (readLines.contains(SampleFileHeader.TOTALEFF.getMessage())){ + if (readLines.contains(SampleFileHeader.TOTALEFF.getMessage())) { totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairs(sourceData, sampleId); } //判断文件是否包含Ratios块 新增Gards_Sample_Ratios数据 - if (readLines.contains(SampleFileHeader.RATIOS.getMessage())){ + if (readLines.contains(SampleFileHeader.RATIOS.getMessage())) { sampleRatiosSpectrumService.saveSampleRatios(sourceData, sampleId); } //判断是否包含ROI_Limits块 新增Gards_ROI_Limits数据 - if (readLines.contains(SampleFileHeader.ROILIMITS.getMessage())){ + if (readLines.contains(SampleFileHeader.ROILIMITS.getMessage())) { roiLimitsSpectrumService.saveRoiLimits(sourceData, sampleId); } //新增Gards_Spectrum数据 spectrumService.saveSpectrum(sourceData, sampleId, readLines, filePathName); //判断是否包含Histogram块 新增Gards_Histogram数据 - if (readLines.contains(SampleFileHeader.HISTOGRAM.getMessage())){ + if (readLines.contains(SampleFileHeader.HISTOGRAM.getMessage())) { histogramService.saveHistogram(sourceData, sampleId, filePathName); } } @@ -4601,8 +4605,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List readLines = new LinkedList<>(); try { List allLines = FileUtils.readLines(file, "UTF-8"); - for (String line:allLines) { - if (line.contains("#")){ + for (String line : allLines) { + if (line.contains("#")) { readLines.add(line); } } @@ -4641,22 +4645,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String dataType = struct.data_type; //Collection Start Date CollectionStart = null; - if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){ + if (StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time)) { CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time); } //Collection Stop Date CollectionStop = null; - if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){ + if (StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time)) { CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time); } //Collection Time String CollectionTime = ""; - if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){ - CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000)); + if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) { + CollectionTime = String.format("%.2f", Double.valueOf(CollectionStop.getTime() / 1000 - CollectionStart.getTime() / 1000)); } //Acquisition Start Date AcquisitionStart = null; - if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){ + if (StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time)) { AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time); } //Acq Real Time @@ -4701,20 +4705,20 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements /** * 分析成功数据发送到Redis */ - private void pushToRedis(BetaDataFile betaDataFile, String userName){ + private void pushToRedis(BetaDataFile betaDataFile, String userName) { try { Info info = new Info(); info.setStationId(betaDataFile.getStationId()); info.setSampleId(betaDataFile.getSampleId()); info.setSampleName(betaDataFile.getSampleFileName()); - final Instant instant = DateUtils.parseDate(betaDataFile.getSampleStruct().collection_start_date+ StringPool.SPACE+betaDataFile.getSampleStruct().collection_start_time).toInstant(); + final Instant instant = DateUtils.parseDate(betaDataFile.getSampleStruct().collection_start_date + StringPool.SPACE + betaDataFile.getSampleStruct().collection_start_time).toInstant(); final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); info.setCollectionDate(collectTime); info.setDatasource(DSType.ARMDRRR.getType()); info.setFullOrPrel(betaDataFile.getSampleStruct().spectrum_quantity); info.setBetaOrGamma(SpectrumType.BETA.getType()); - Map nuclides = Maps.newHashMap(); - for (int i=0; i< betaDataFile.getXeDataList().size(); i++) { + Map nuclides = Maps.newHashMap(); + for (int i = 0; i < betaDataFile.getXeDataList().size(); i++) { GardsXeResults xeResults = betaDataFile.getXeDataList().get(i); if (xeResults.getNuclideName().equalsIgnoreCase(XeNuclideName.XE_131m.getType())) { nuclides.put(XeNuclideName.XE_131m.getType(), String.valueOf(xeResults.getConc())); @@ -4735,11 +4739,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } /** - * 获取需要导出的数据 (saveToHtml|saveToTxt|saveToExcel) + * 获取需要导出的数据 (saveToHtml|saveToTxt|saveToExcel) */ - private BgDataAnlyseResultIn getSaveData(BgDataAnlyseResultIn anlyseResultIn){ + private BgDataAnlyseResultIn getSaveData(BgDataAnlyseResultIn anlyseResultIn) { //根据请求体获取用户名 - LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userName = user.getUsername(); //用户名赋值到 分析员 anlyseResultIn.setUserName(userName); @@ -4782,9 +4786,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } /* - * 对数据进行处理,变成真正可直接导出的数据 - * */ - private Map shiftSaveData(BgDataAnlyseResultIn anlyseResultIn){ + * 对数据进行处理,变成真正可直接导出的数据 + * */ + private Map shiftSaveData(BgDataAnlyseResultIn anlyseResultIn) { Map result = new HashMap<>(); List roiChannels = anlyseResultIn.getRoiChannelsSpectrumList(); List roiResults = anlyseResultIn.getRoiResultsSpectrumList(); @@ -4801,8 +4805,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements BeanUtil.copyProperties(roiChannel, roiChannelsDto); roiChannelsDto.shift(); String dataType = roiChannel.getDataType(); - if (StrUtil.isNotBlank(dataType)){ - switch (dataType){ + if (StrUtil.isNotBlank(dataType)) { + switch (dataType) { case "S": roiChannelsDtosS.add(roiChannelsDto); break; @@ -4854,8 +4858,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } /* - * 使用模板引擎解析html模板 - * */ + * 使用模板引擎解析html模板 + * */ private String parseHtml(Map variables) { TemplateEngine templateEngine = new SpringTemplateEngine(); ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver(); @@ -4867,9 +4871,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } /* - * 提取(saveToHtml|saveToTxt|saveToExcel)公共部分 - * */ - private Map exportData(BgDataAnlyseResultIn anlyseResultIn, String userName){ + * 提取(saveToHtml|saveToTxt|saveToExcel)公共部分 + * */ + private Map exportData(BgDataAnlyseResultIn anlyseResultIn, String userName) { // 解析文件,生成导出数据 Map analyze = shiftSaveData(getSaveData(anlyseResultIn)); Cache cache = betaCache.getBetaCache(); @@ -4885,7 +4889,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return analyze; } - private Map exportDataNew(RRRLogInfo rrrLogInfo){ + private Map exportDataNew(RRRLogInfo rrrLogInfo) { LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String username = sysUser.getUsername(); Map result = new HashMap<>(); @@ -4893,7 +4897,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Cache cache = betaCache.getBetaCache(); BetaDataFile betaDataFile = cache.getIfPresent(rrrLogInfo.getSampleFileName() + "-" + username); if (Objects.isNull(betaDataFile)) { - return result; + return result; } GardsCalibrationSpectrum gammaCalibrationParamS = new GardsCalibrationSpectrum(); GardsCalibrationSpectrum gammaCalibrationParamG = new GardsCalibrationSpectrum(); @@ -4913,14 +4917,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //判断 if (betaDataFile.isSaveAnalysisResult()) { //对分析后的内容进行数据获取 - List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); + List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); List roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); List roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); List roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); - List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); - List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); - for (int i=0; i resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); + List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); + for (int i = 0; i < xeResultsSpectrums.size(); i++) { + for (int j = 0; j < rrrLogInfo.getXeResultsSpectrumList().size(); j++) { if (xeResultsSpectrums.get(i).getNuclideName().equalsIgnoreCase(rrrLogInfo.getXeResultsSpectrumList().get(j).getNuclideName())) { xeResultsSpectrums.get(i).setNidFlag(rrrLogInfo.getXeResultsSpectrumList().get(j).getNidFlag()); } @@ -4929,7 +4933,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //#SAMPLE: LIMITS PER ROI GAMMA List gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList(); List gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList(); - for (int i=0; i betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList(); List betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList(); - for (int i=0; i samplOldCalibrations = new ArrayList<>(); Calibration samplOldCalibrationCH = new Calibration(); Calibration samplOldCalibrationE = new Calibration(); // if (betaDataFile.isBBetaEnergyValidSample() || betaDataFile.isBGammaEnergyValidSample()){ - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { - samplOldCalibrationCH.setBeta(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); - } else { - samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { - samplOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); - } else { - samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { - samplOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); - } else { - samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { - samplOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); - }else { - samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); - } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { + samplOldCalibrationCH.setBeta(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { + samplOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { + samplOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { + samplOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } /*} else { samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); @@ -5068,31 +5072,31 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements }*/ samplOldCalibrations.add(samplOldCalibrationCH); samplOldCalibrations.add(samplOldCalibrationE); - result.put("samplOldCalibrations",samplOldCalibrations); + result.put("samplOldCalibrations", samplOldCalibrations); // #SAMPLE New CALIBRATION List samplNewCalibrations = new ArrayList<>(); Calibration samplNewCalibrationCH = new Calibration(); Calibration samplNewCalibrationE = new Calibration(); - samplNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))) - +")x*x"); - samplNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))) - +")x*x"); - samplNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))) - +")x*x"); - samplNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))) - +")x*x"); + samplNewCalibrationCH.setBeta("CH(x) = (" + (Objects.isNull(betaCalibrationParamES.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamES.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamES.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))) + + ")x*x"); + samplNewCalibrationCH.setGamma("CH(x) = (" + (Objects.isNull(gammaCalibrationParamES.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamES.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamES.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))) + + ")x*x"); + samplNewCalibrationE.setBeta("E(x) = (" + (Objects.isNull(betaCalibrationParamS.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamS.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamS.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))) + + ")x*x"); + samplNewCalibrationE.setGamma("E(x) = (" + (Objects.isNull(gammaCalibrationParamS.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamS.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamS.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))) + + ")x*x"); samplNewCalibrations.add(samplNewCalibrationCH); samplNewCalibrations.add(samplNewCalibrationE); - result.put("samplNewCalibrations",samplNewCalibrations); + result.put("samplNewCalibrations", samplNewCalibrations); // #SAMPLE: LIMITS PER ROI List roiChannelsDtosS = new LinkedList<>(); @@ -5102,36 +5106,36 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements roiChannelsDto.shift(); roiChannelsDtosS.add(roiChannelsDto); } - result.put("roiChannelsS",roiChannelsDtosS); + result.put("roiChannelsS", roiChannelsDtosS); /* - * DET - * */ + * DET + * */ // #DET Old CALIBRATION List detOldCalibrations = new ArrayList<>(); Calibration detOldCalibrationCH = new Calibration(); Calibration detOldCalibrationE = new Calibration(); // if (betaDataFile.isBBetaEnergyValidDet() || betaDataFile.isBGammaEnergyValidDet()){ - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { - detOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); - } else { - detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { - detOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); - } else { - detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { - detOldCalibrationE.setBeta(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); - } else { - detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { - detOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); - } else { - detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); - } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { + detOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { + detOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { + detOldCalibrationE.setBeta(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { + detOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } /*} else { detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); @@ -5146,22 +5150,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List detNewCalibrations = new ArrayList<>(); Calibration detNewCalibrationCH = new Calibration(); Calibration detNewCalibrationE = new Calibration(); - detNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))) - +")x*x"); - detNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))) - +")x*x"); - detNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))) - +")x*x"); - detNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))) - +")x*x"); + detNewCalibrationCH.setBeta("CH(x) = (" + (Objects.isNull(betaCalibrationParamED.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamED.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamED.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))) + + ")x*x"); + detNewCalibrationCH.setGamma("CH(x) = (" + (Objects.isNull(gammaCalibrationParamED.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamED.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamED.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))) + + ")x*x"); + detNewCalibrationE.setBeta("E(x) = (" + (Objects.isNull(betaCalibrationParamD.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamD.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamD.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))) + + ")x*x"); + detNewCalibrationE.setGamma("E(x) = (" + (Objects.isNull(gammaCalibrationParamD.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamD.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamD.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))) + + ")x*x"); detNewCalibrations.add(detNewCalibrationCH); detNewCalibrations.add(detNewCalibrationE); result.put("detNewCalibrations", detNewCalibrations); @@ -5174,36 +5178,36 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements roiChannelsDto.shift(); roiChannelsDtosD.add(roiChannelsDto); } - result.put("roiChannelsD",roiChannelsDtosD); + result.put("roiChannelsD", roiChannelsDtosD); /* - * GAS - * */ + * GAS + * */ // #GAS Old CALIBRATION List gasOldCalibrations = new ArrayList<>(); Calibration gasOldCalibrationCH = new Calibration(); Calibration gasOldCalibrationE = new Calibration(); // if (betaDataFile.isBBetaEnergyValidGas() || betaDataFile.isBGammaEnergyValidGas()){ - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { - gasOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); - } else { - gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { - gasOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); - } else { - gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { - gasOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); - } else { - gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); - } - if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { - gasOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); - } else { - gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); - } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) { + gasOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) { + gasOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) { + gasOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) { + gasOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } /*} else { gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); @@ -5212,31 +5216,31 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements }*/ gasOldCalibrations.add(gasOldCalibrationCH); gasOldCalibrations.add(gasOldCalibrationE); - result.put("gasOldCalibrations",gasOldCalibrations); + result.put("gasOldCalibrations", gasOldCalibrations); // #GAS New CALIBRATION List gasNewCalibrations = new ArrayList<>(); Calibration gasNewCalibrationCH = new Calibration(); Calibration gasNewCalibrationE = new Calibration(); - gasNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))) - +")x*x"); - gasNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))) - +")x*x"); - gasNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))) - +")+("+ (Objects.isNull(betaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))) - +")*x+("+ (Objects.isNull(betaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))) - +")x*x"); - gasNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))) - +")+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))) - +")*x+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))) - +")x*x"); + gasNewCalibrationCH.setBeta("CH(x) = (" + (Objects.isNull(betaCalibrationParamEG.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamEG.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamEG.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))) + + ")x*x"); + gasNewCalibrationCH.setGamma("CH(x) = (" + (Objects.isNull(gammaCalibrationParamEG.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamEG.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamEG.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))) + + ")x*x"); + gasNewCalibrationE.setBeta("E(x) = (" + (Objects.isNull(betaCalibrationParamG.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))) + + ")+(" + (Objects.isNull(betaCalibrationParamG.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))) + + ")*x+(" + (Objects.isNull(betaCalibrationParamG.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))) + + ")x*x"); + gasNewCalibrationE.setGamma("E(x) = (" + (Objects.isNull(gammaCalibrationParamG.getCoeff1()) ? "?1" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))) + + ")+(" + (Objects.isNull(gammaCalibrationParamG.getCoeff2()) ? "?2" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))) + + ")*x+(" + (Objects.isNull(gammaCalibrationParamG.getCoeff3()) ? "?3" : NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))) + + ")x*x"); gasNewCalibrations.add(gasNewCalibrationCH); gasNewCalibrations.add(gasNewCalibrationE); - result.put("gasNewCalibrations",gasNewCalibrations); + result.put("gasNewCalibrations", gasNewCalibrations); // #GAS: LIMITS PER ROI List roiChannelsDtosG = new LinkedList<>(); @@ -5246,16 +5250,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements roiChannelsDto.shift(); roiChannelsDtosG.add(roiChannelsDto); } - result.put("roiChannelsG",roiChannelsDtosG); + result.put("roiChannelsG", roiChannelsDtosG); /* - * GardsROIResultsSpectrum - * */ + * GardsROIResultsSpectrum + * */ // #GROSS COUNTS PER ROI // #NET COUNTS AND LC PER ROI // #CONCENTRATION AND LC PER ROI List roiResults = new ArrayList<>(); - for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums) { + for (GardsROIResultsSpectrum resultsSpectrum : resultsSpectrums) { ROIResultsStrDto roiResultsStrDto = new ROIResultsStrDto(); roiResultsStrDto.setRoi(resultsSpectrum.getRoi()); roiResultsStrDto.setSGross(resultsSpectrum.getSGross()); @@ -5264,14 +5268,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements roiResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc()))); roiResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))); if (betaDataFile.isBProcessed()) { - roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); - roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))); + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc())) + " +/- " + NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet())) + " +/- " + NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))); if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); } - }else { - roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); - roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))); + } else { + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr())) + " +/- " + NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet())) + " +/- " + NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))); if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); } @@ -5281,14 +5285,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements result.put("roiResults", roiResults); /* - * GardsXeResultsSpectrum - * */ + * GardsXeResultsSpectrum + * */ // #RESULT SUMMARY List xeResults = new ArrayList<>(); for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrums) { XeResultsStrDto xeResultsStrDto = new XeResultsStrDto(); xeResultsStrDto.setNuclideName(xeResultsSpectrum.getNuclideName()); - xeResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr()))); + xeResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc())) + " +/- " + NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr()))); xeResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc()))); xeResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc()))); xeResultsStrDto.setNidFlag(xeResultsSpectrum.getNidFlag()); @@ -5310,10 +5314,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements // 解析生成Html字符串并导出为Html文件 String result = parseHtml(analyze); PrintWriter writer = null; - try{ + try { String export = "saveToHtml.html"; String sampleFileName = rrrLogInfo.getSampleFileName(); - if (StrUtil.isNotBlank(sampleFileName)){ + if (StrUtil.isNotBlank(sampleFileName)) { if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".html"); } @@ -5321,7 +5325,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements writer.write(result); } catch (IOException e) { e.printStackTrace(); - }finally { + } finally { if (ObjectUtil.isNotNull(writer)) writer.close(); } @@ -5336,7 +5340,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); String export = "SaveToExcel.xls"; String sampleFileName = rrrLogInfo.getSampleFileName(); - if (StrUtil.isNotBlank(sampleFileName)){ + if (StrUtil.isNotBlank(sampleFileName)) { if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".xls"); } @@ -5390,21 +5394,21 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements // 正则表达式,匹配${}中的内容 String regex = "\\$\\{([^}]+)}"; List newLines = new ArrayList<>(); - List list = ListUtil.toList("sampleNewCalibration","sampleRoi", "detNewCalibration", "detRoi", "gasNewCalibration", "gasRoi","grossRoi", + List list = ListUtil.toList("sampleNewCalibration", "sampleRoi", "detNewCalibration", "detRoi", "gasNewCalibration", "gasRoi", "grossRoi", "netRoi", "concRoi", "resultSummary"); - List skip = ListUtil.toList("${sampleNewCalibration}","${sampleRoi}", "${detNewCalibration}", "${detRoi}", "${gasNewCalibration}", "${gasRoi}", + List skip = ListUtil.toList("${sampleNewCalibration}", "${sampleRoi}", "${detNewCalibration}", "${detRoi}", "${gasNewCalibration}", "${gasRoi}", "${grossRoi}", "${netRoi}", "${concRoi}", "${resultSummary}"); for (String line : lines) { List fieldNames = ReUtil.findAllGroup1(regex, line); - if (CollUtil.isEmpty(fieldNames)){ + if (CollUtil.isEmpty(fieldNames)) { newLines.add(line); continue; } for (String fieldName : fieldNames) { Object value = analyze.get(fieldName); - if (CollUtil.contains(list, fieldName)){ - newLines.addAll((List)value); - }else { + if (CollUtil.contains(list, fieldName)) { + newLines.addAll((List) value); + } else { String search = "${" + fieldName + "}"; String replacement = StrUtil.toString(value); replacement = StrUtil.isBlank(replacement) ? "null" : replacement; @@ -5416,7 +5420,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } String export = "SaveToTxt.txt"; String sampleFileName = anlyseResultIn.getSampleFileName(); - if (StrUtil.isNotBlank(sampleFileName)){ + if (StrUtil.isNotBlank(sampleFileName)) { if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".txt"); } @@ -5426,7 +5430,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } catch (IOException e) { e.printStackTrace(); - }finally { + } finally { if (ObjectUtil.isNotNull(writer)) writer.close(); } @@ -5434,14 +5438,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements @Override public void saveToTxt(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) { - String result = (String)viewRRR(rrrLogInfo, request).getResult(); + String result = (String) viewRRR(rrrLogInfo, request).getResult(); if (StrUtil.isBlank(result)) return; List lines = ListUtil.toList(StrUtil.split(result, "\n")); PrintWriter writer = null; - try{ + try { String export = "SaveToTxt.txt"; String sampleFileName = rrrLogInfo.getSampleFileName(); - if (StrUtil.isNotBlank(sampleFileName)){ + if (StrUtil.isNotBlank(sampleFileName)) { if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".txt"); } @@ -5451,19 +5455,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } catch (IOException e) { e.printStackTrace(); - }finally { + } finally { if (ObjectUtil.isNotNull(writer)) writer.close(); } } - private List calibrations(GardsCalibrationSpectrum gammaCalibrationCE,GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) { + private List calibrations(GardsCalibrationSpectrum gammaCalibrationCE, GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) { int min = 79; String space = StrUtil.SPACE; List 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 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); @@ -5471,7 +5475,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return calibrationStrs; } - private List roiChannels(List roiChannels){ + private List roiChannels(List roiChannels) { int min = 49; String space = StrUtil.SPACE; List channelStrs = new ArrayList<>(); @@ -5490,7 +5494,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return channelStrs; } - private Map roiResults(List roiResults){ + private Map roiResults(List roiResults) { int min1 = 49; int min2 = 22; String space = StrUtil.SPACE; @@ -5498,7 +5502,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List netStrs = new ArrayList<>(); List concStrs = new ArrayList<>(); Map roiResultsStr = new HashMap<>(); - if (CollUtil.isEmpty(roiResults)){ + if (CollUtil.isEmpty(roiResults)) { roiResultsStr.put("grossRoi", grossStrs); roiResultsStr.put("netRoi", netStrs); roiResultsStr.put("concRoi", concStrs); @@ -5534,7 +5538,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return roiResultsStr; } - private List xeResults(List xeResults){ + private List xeResults(List xeResults) { int min1 = 49; int min2 = 22; String space = StrUtil.SPACE; @@ -5567,10 +5571,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements //如果勾选了Energy Calibration页面下sample Data if (StringUtils.isNotBlank(sampleTmp)) { //判断是否进行了重新分析操作 - if(Objects.nonNull(bgPara) && bgPara.bApplyNewCalicSample) { + if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicSample) { EnergySpectrumStruct sourceData = betaDataFile.getSampleStruct(); //如果gamma的能量分析页面 没有勾选sample 并且gamma数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBGammaEnergyValidSample() && CollectionUtils.isEmpty(gammaList)){ + if (!anlyseResultIn.isBGammaEnergyValidSample() && CollectionUtils.isEmpty(gammaList)) { anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_sample(sourceData.g_energy); } else { @@ -5580,7 +5584,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements anlyseResultIn.setG_energy_sample(energys); } //如果beta的能量分析页面 没有勾选sample 并且beta数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBBetaEnergyValidSample() && CollectionUtils.isEmpty(betaList)){ + if (!anlyseResultIn.isBBetaEnergyValidSample() && CollectionUtils.isEmpty(betaList)) { anlyseResultIn.setB_channel_sample(sourceData.b_channel); anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy); } else { @@ -5601,7 +5605,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicGasBg) { EnergySpectrumStruct sourceData = betaDataFile.getGasStruct(); //如果gamma的能量分析页面 没有勾选gas 并且gamma数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBGammaEnergyValidGas() && CollectionUtils.isEmpty(gammaList)){ + if (!anlyseResultIn.isBGammaEnergyValidGas() && CollectionUtils.isEmpty(gammaList)) { anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_gas(sourceData.g_energy); } else { @@ -5611,7 +5615,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements anlyseResultIn.setG_energy_gas(energys); } //如果beta的能量分析页面 没有勾选gas 并且beta数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBBetaEnergyValidGas() && CollectionUtils.isEmpty(betaList)){ + if (!anlyseResultIn.isBBetaEnergyValidGas() && CollectionUtils.isEmpty(betaList)) { anlyseResultIn.setB_channel_gas(sourceData.b_channel); anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy); } else { @@ -5632,7 +5636,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicDetBg) { EnergySpectrumStruct sourceData = betaDataFile.getDetStruct(); //如果gamma的能量分析页面 没有勾选det 并且gamma数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBGammaEnergyValidDet() && CollectionUtils.isEmpty(gammaList)){ + if (!anlyseResultIn.isBGammaEnergyValidDet() && CollectionUtils.isEmpty(gammaList)) { anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_det(sourceData.g_energy); } else { @@ -5642,7 +5646,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements anlyseResultIn.setG_energy_det(energys); } //如果beta的能量分析页面 没有勾选det 并且beta数组是空的 存储文件中的数据 - if (!anlyseResultIn.isBBetaEnergyValidDet() && CollectionUtils.isEmpty(betaList)){ + if (!anlyseResultIn.isBBetaEnergyValidDet() && CollectionUtils.isEmpty(betaList)) { anlyseResultIn.setB_channel_det(sourceData.b_channel); anlyseResultIn.setB_energy_det(sourceData.b_electron_energy); } else { @@ -5661,7 +5665,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } - public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn, BgCalibratePara BgCalPara, List betaFittingPara, List gammaFittingPara,List betaFittingParaToUi, List gammaFittingParaToUi, BetaDataFile betaDataFile) { + public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn, BgCalibratePara BgCalPara, List betaFittingPara, List gammaFittingPara, List betaFittingParaToUi, List gammaFittingParaToUi, BetaDataFile betaDataFile) { File sampleTmp = null; File gasTmp = null; File detTmp = null; @@ -5853,30 +5857,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements anlyseResultIn.setBetaCalibrationDEC(betaCalibrationDEC); } List roiChannelsSpectrumList = new LinkedList<>(); - for (int i=0; i roiResultsSpectrumList = new LinkedList<>(); - for (int i=0; ibgAnalyseResult.MDC.get(i)) { + if (bgAnalyseResult.ROI_con_uncer.get(i) > bgAnalyseResult.MDC.get(i)) { roiResults.setNidFlag(1); } else { roiResults.setNidFlag(0); @@ -5922,7 +5926,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements List xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList(); xeDataList = getXeDataList(xeResultsSpectrumList); } - for (GardsXeResults xeData :xeDataList) { + for (GardsXeResults xeData : xeDataList) { if (xeData.getNuclideName().equals(XeNuclideName.XE_131m.getType())) { xeData.setNidFlag(anlyseResultIn.getXe131mFlag()); } else if (xeData.getNuclideName().equals(XeNuclideName.XE_133.getType())) { @@ -5962,13 +5966,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements public List getXeDataList(List xeResultsSpectrumList) { List xeDataList = new LinkedList<>(); if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { - for (GardsXeResultsSpectrum xeResultsSpectrum:xeResultsSpectrumList) { + for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrumList) { GardsXeResults xeResults = new GardsXeResults(); BeanUtil.copyProperties(xeResultsSpectrum, xeResults); xeDataList.add(xeResults); } } - return xeDataList; + return xeDataList; } @Override