From 537b013f14e2dc889b40d2dafc569a0464ee11b9 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Thu, 16 Nov 2023 17:01:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?gamma=E5=8A=9F=E8=83=BD=E5=AF=BC=E5=87=BARR?= =?UTF-8?q?R=E6=8A=A5=E5=91=8A=E5=86=85=E5=AE=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=AF=B9=E4=B8=8D=E9=BD=90=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/abstracts/AbstractLogOrReport.java | 3 +- .../org/jeecg/common/util/GammaFileUtil.java | 177 ++++++++++++------ 2 files changed, 123 insertions(+), 57 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/abstracts/AbstractLogOrReport.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/abstracts/AbstractLogOrReport.java index a9dcda5b..acf7dd8b 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/abstracts/AbstractLogOrReport.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/abstracts/AbstractLogOrReport.java @@ -127,7 +127,8 @@ public abstract class AbstractLogOrReport { if (j==0) { titles.add(cell); } else { - titles.add(" "); + titles.add(StringPool.SPACE); + dataSub = StringPool.SPACE+dataSub; } contents.add(dataSub); } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java index 7254a3d3..5ec46a17 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -2481,7 +2481,7 @@ public class GammaFileUtil extends AbstractLogOrReport { String activity = String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key.get(i))) + " bq"; String relErr = String.format("%.3f", (Double.valueOf(middleData.nucl_ided_activ_key_err.get(i)) / Double.valueOf(middleData.nucl_ided_activ_key.get(i)) * 100)) + " %"; String conc = middleData.nucl_ided_Concentration.get(i) + " uBq/m^3"; - String mdc = StringUtils.join(middleData.nucl_ided_MDC.get(i), " "); + String mdc = StringUtils.join(middleData.nucl_ided_MDC.get(i), StringPool.SPACE); strBuffer.append(rowFormat(data15, nuclideName, halflife, activity, relErr, conc, mdc)); //换行 strBuffer.append(System.lineSeparator()); @@ -2569,11 +2569,36 @@ public class GammaFileUtil extends AbstractLogOrReport { //换行 strBuffer.append(System.lineSeparator()); //报告内容第一部分数据 - String[] cells1 = new String[]{" Station ID", " Detector ID", " Sample ID", " Sample Geometry", " Sample Quantity[m3]", " Sample Type", " Collection Start", " Collection Stop", - " Sampling Time[h]", " Decay Time[h]", " Acquisition Start", " Acquisition Stop", " Acquisition Time[s]", " Avg Flow Rate[m3/h]", " Collection Station Comments"}; - String[] datas1 = new String[]{middleData.sample_stationID, middleData.sample_detectID, middleData.sample_id, middleData.sample_Geometry, middleData.sample_quantity, middleData.sample_Type, middleData.sample_collection_start, - middleData.sample_collection_stop, middleData.sample_time, middleData.sample_decay_time, middleData.sample_acquisiton_start, middleData.sample_acquistion_stop, middleData.sample_acquistion_time, middleData.sample_Avg_Flow_Rate, - middleData.Collection_Station_Comments}; + strBuffer.append(rowFormat("%sStation ID:%-29s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_stationID)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sDetector ID:%-28s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_detectID)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sSample ID:%-30s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_id)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sSample Geometry:%-24s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_Geometry)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sSample Quantity[m3]:%-20s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_quantity)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sSample Type:%-28s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_Type)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sCollection Start:%-23s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_collection_start)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sCollection Stop:%-24s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_collection_stop)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sSampling Time[h]:%-23s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_time)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sDecay Time[h]:%-26s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_decay_time)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sAcquisition Start:%-22s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_acquisiton_start)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sAcquisition Stop:%-23s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_acquistion_stop)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sAcquisition Time[s]:%-20s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_acquistion_time)); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%sAvg Flow Rate[m3/h]:%-20s%s", StringPool.SPACE, StringPool.SPACE, middleData.sample_Avg_Flow_Rate)); + strBuffer.append(System.lineSeparator()); + String[] cells1 = new String[]{" Collection Station Comments"}; + String[] datas1 = new String[]{middleData.Collection_Station_Comments}; //根据固定宽度切割数据 Map> reportMap1 = GetReportFixedWidth(cells1, datas1, 30); List title1 = reportMap1.get("title"); @@ -2581,7 +2606,7 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title1.size(); i++) { String title = title1.get(i); String content = content1.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(String.format("%s:%-12s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } @@ -2595,7 +2620,7 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title2.size(); i++) { String title = title2.get(i); String content = content2.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(String.format("%s:%-14s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } @@ -2624,20 +2649,20 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title3.size(); i++) { String title = title3.get(i); String content = content3.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(String.format("%s:%-20s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } - strBuffer.append(String.format("%s:%-30s%s", " Keyline Activities for Nuclides", StringPool.SPACE, "")); + strBuffer.append(String.format("%s:%-8s%s", " Keyline Activities for Nuclides", StringPool.SPACE, "")); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " with defined Reference Line", StringPool.SPACE, "")); + strBuffer.append(String.format("%s:%-12s%s", " with defined Reference Line", StringPool.SPACE, "")); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Activity Reference Time", StringPool.SPACE, middleData.sample_acquisiton_start)); + strBuffer.append(String.format("%s:%-16s%s", " Activity Reference Time", StringPool.SPACE, middleData.sample_acquisiton_start)); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Concentration Reference Time", StringPool.SPACE, middleData.sample_collection_start)); + strBuffer.append(String.format("%s:%-11s%s", " Concentration Reference Time", StringPool.SPACE, middleData.sample_collection_start)); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2700,38 +2725,38 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append("#PROCESSING PARAMETERS"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_Low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_Low()))); + strBuffer.append(rowFormat("%sECutAnalysis_Low:%-23s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_Low()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_High", StringPool.SPACE, middleData.setting_specSetup.getECutAnalysis_High()==-9999?"inf":String.valueOf(middleData.setting_specSetup.getECutAnalysis_High()))); + strBuffer.append(rowFormat("%sECutAnalysis_High:%-22s%s", StringPool.SPACE, StringPool.SPACE, middleData.setting_specSetup.getECutAnalysis_High()==-9999?"inf":String.valueOf(middleData.setting_specSetup.getECutAnalysis_High()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " EnergyTolerance", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getEnergyTolerance()))); + strBuffer.append(rowFormat("%sEnergyTolerance:%-24s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getEnergyTolerance()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " BaseImprovePSS", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getBaseImprovePSS()))); + strBuffer.append(rowFormat("%sBaseImprovePSS:%-25s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getBaseImprovePSS()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " PSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getPss_low()))); + strBuffer.append(rowFormat("%sPSS_low:%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getPss_low()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " k_back", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_back()))); + strBuffer.append(rowFormat("%sk_back:%-33s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_back()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " k_alpha", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_alpha()))); + strBuffer.append(rowFormat("%sk_alpha:%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_alpha()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " k_beta", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_beta()))); + strBuffer.append(rowFormat("%sk_beta:%-33s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_beta()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " RiskLevelK", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getRiskLevelK()))); + strBuffer.append(rowFormat("%sRiskLevelK:%-29s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getRiskLevelK()))); //换行 strBuffer.append(System.lineSeparator()); Date refTimeAct = middleData.setting_specSetup.getRefTime_act(); - strBuffer.append(String.format("%s:%-30s%s", " refTime_act", StringPool.SPACE, DateUtils.formatDate(refTimeAct), "yyyy-MM-dd HH:mm:ss")); + strBuffer.append(rowFormat("%srefTime_act:%-28s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(refTimeAct), "yyyy-MM-dd HH:mm:ss")); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " refTime_conc", StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_conc(), "yyyy-MM-dd HH:mm:ss"))); + strBuffer.append(rowFormat("%srefTime_conc:%-27s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_conc(), "yyyy-MM-dd HH:mm:ss"))); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2739,16 +2764,16 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append("#CALIBRATION PARAMETERS"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_low()))); + strBuffer.append(rowFormat("%sCalibrationPSS_low:%-21s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_low()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_high", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_high()))); + strBuffer.append(rowFormat("%sCalibrationPSS_high:%-20s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_high()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " bUpdateCal", StringPool.SPACE, (middleData.setting_specSetup.isBUpdateCal()?"1":"0"))); + strBuffer.append(rowFormat("%sbUpdateCal:%-29s%s", StringPool.SPACE, StringPool.SPACE, (middleData.setting_specSetup.isBUpdateCal()?"1":"0"))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " KeepCalPeakSearchPeaks", StringPool.SPACE, (middleData.setting_specSetup.isKeepCalPeakSearchPeaks()?"1":"0"))); + strBuffer.append(rowFormat("%sKeepCalPeakSearchPeaks:%-17s%s", StringPool.SPACE, StringPool.SPACE, (middleData.setting_specSetup.isKeepCalPeakSearchPeaks()?"1":"0"))); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2760,12 +2785,22 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append(" Energy Calibration ["+middleData.calibration_pairs_E_Input+" ]"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_E_functionTypeDef)); - //换行 - strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_E_functionDef)); + strBuffer.append(rowFormat("%sFunction:%-31s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_E_functionTypeDef)); //换行 strBuffer.append(System.lineSeparator()); + String[] cellsE4 = new String[]{" E"}; + String[] datasE4 = new String[]{middleData.calibration_E_functionDef}; + //根据固定宽度切割数据 + Map> reportMapE4 = GetReportFixedWidth(cellsE4, datasE4, 30); + List titleE4 = reportMapE4.get("title"); + List contentE4 = reportMapE4.get("content"); + for (int i=0; i< titleE4.size(); i++) { + String title = titleE4.get(i); + String content = contentE4.get(i); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); + //换行 + strBuffer.append(System.lineSeparator()); + } String[] cells4 = new String[]{" P"}; String[] datas4 = new String[]{middleData.calibration_E_coeff_string}; //根据固定宽度切割数据 @@ -2775,16 +2810,16 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title4.size(); i++) { String title = title4.get(i); String content = content4.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_E_uncoeff_string)); + strBuffer.append(rowFormat("%sErr:%-36s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_E_uncoeff_string)); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_E_Input)); + strBuffer.append(rowFormat("%sData:%-35s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_pairs_E_Input)); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2796,12 +2831,22 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append(" Resolution Calibration ["+middleData.calibration_pairs_R_Input+" ]"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_R_functionTypeDef)); - //换行 - strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_R_functionDef)); + strBuffer.append(rowFormat("%sFunction:%-31s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_R_functionTypeDef)); //换行 strBuffer.append(System.lineSeparator()); + String[] cellsE5 = new String[]{" E"}; + String[] datasE5 = new String[]{middleData.calibration_R_functionDef}; + //根据固定宽度切割数据 + Map> reportMapE5 = GetReportFixedWidth(cellsE5, datasE5, 30); + List titleE5 = reportMapE5.get("title"); + List contentE5 = reportMapE5.get("content"); + for (int i=0; i< titleE5.size(); i++) { + String title = titleE5.get(i); + String content = contentE5.get(i); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); + //换行 + strBuffer.append(System.lineSeparator()); + } String[] cells5 = new String[]{" P"}; String[] datas5 = new String[]{middleData.calibration_R_coeff_string}; //根据固定宽度切割数据 @@ -2811,14 +2856,14 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title5.size(); i++) { String title = title5.get(i); String content = content5.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } - strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_R_uncoeff_string)); + strBuffer.append(rowFormat("%sErr:%-36s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_R_uncoeff_string)); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_R_Input)); + strBuffer.append(rowFormat("%sData:%-35s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_pairs_R_Input)); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2828,12 +2873,22 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append(" Efficiency Calibration ["+middleData.calibration_pairs_EF_Input+" ]"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_EF_functionTypeDef)); - //换行 - strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_EF_functionDef)); + strBuffer.append(rowFormat("%sFunction:%-31s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_EF_functionTypeDef)); //换行 strBuffer.append(System.lineSeparator()); + String[] cellsE6 = new String[]{" E"}; + String[] datasE6 = new String[]{middleData.calibration_EF_functionDef}; + //根据固定宽度切割数据 + Map> reportMapE6 = GetReportFixedWidth(cellsE6, datasE6, 30); + List titleE6 = reportMapE6.get("title"); + List contentE6 = reportMapE6.get("content"); + for (int i=0; i< titleE6.size(); i++) { + String title = titleE6.get(i); + String content = contentE6.get(i); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); + //换行 + strBuffer.append(System.lineSeparator()); + } String[] cells6 = new String[]{" P"}; String[] datas6 = new String[]{middleData.calibration_EF_coeff_string}; //根据固定宽度切割数据 @@ -2843,14 +2898,14 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title6.size(); i++) { String title = title6.get(i); String content = content6.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } - strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_EF_uncoeff_string)); + strBuffer.append(rowFormat("%sErr:%-36s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_EF_uncoeff_string)); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_EF_Input)); + strBuffer.append(rowFormat("%sData:%-35s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_pairs_EF_Input)); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2860,12 +2915,22 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append(" Tot_efficiency Calibration ["+middleData.calibration_pairs_T_Input+" ]"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_T_functionTypeDef)); - //换行 - strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_T_functionDef)); + strBuffer.append(rowFormat("%sFunction:%-31s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_T_functionTypeDef)); //换行 strBuffer.append(System.lineSeparator()); + String[] cellsE7 = new String[]{" E"}; + String[] datasE7 = new String[]{middleData.calibration_T_functionDef}; + //根据固定宽度切割数据 + Map> reportMapE7 = GetReportFixedWidth(cellsE7, datasE7, 30); + List titleE7 = reportMapE7.get("title"); + List contentE7 = reportMapE7.get("content"); + for (int i=0; i< titleE7.size(); i++) { + String title = titleE7.get(i); + String content = contentE7.get(i); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); + //换行 + strBuffer.append(System.lineSeparator()); + } String[] cells7 = new String[]{" P"}; String[] datas7 = new String[]{middleData.calibration_T_coeff_string}; //根据固定宽度切割数据 @@ -2875,14 +2940,14 @@ public class GammaFileUtil extends AbstractLogOrReport { for (int i=0; i< title7.size(); i++) { String title = title7.get(i); String content = content7.get(i); - strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content)); + strBuffer.append(rowFormat("%s:%-38s%s", title, StringPool.SPACE, content)); //换行 strBuffer.append(System.lineSeparator()); } - strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_T_uncoeff_string)); + strBuffer.append(rowFormat("%sErr:%-36s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_T_uncoeff_string)); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_T_Input)); + strBuffer.append(rowFormat("%sData:%-35s%s", StringPool.SPACE, StringPool.SPACE, middleData.calibration_pairs_T_Input)); //换行 strBuffer.append(System.lineSeparator()); //换行 From 44b991733698a44bf1990ef02ebdf8b94a8ed4bf Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Thu, 16 Nov 2023 17:29:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?beta=E5=8A=9F=E8=83=BDRRR=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E5=AF=B9=E9=BD=90=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SpectrumAnalysisServiceImpl.java | 125 ++++++++++-------- 1 file changed, 71 insertions(+), 54 deletions(-) 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 a3f4e952..ad48ef96 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 @@ -1039,40 +1039,46 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), - NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)), StringPool.SPACE)); + //拼接历史计算公式 CH + String oldBetaSampleCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))); + String oldGammaSampleCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), + NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)), StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaSampleCHStr.length())+"s%s", oldBetaSampleCHStr, StringPool.SPACE, oldGammaSampleCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), - NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)), StringPool.SPACE)); + //拼接历史计算公式 E + String oldBetaSampleEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))); + String oldGammaSampleEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), + NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)), StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaSampleEStr.length())+"s%s", oldBetaSampleEStr, StringPool.SPACE, oldGammaSampleEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#SAMPLE New CALIBRATION"); strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 CH + String newBetaSampleCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamES.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))), (Objects.isNull(betaCalibrationParamES.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))), - (Objects.isNull(betaCalibrationParamES.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamES.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))), + (Objects.isNull(betaCalibrationParamES.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3())))); + String newGammaSampleCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamES.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))), (Objects.isNull(gammaCalibrationParamES.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))), (Objects.isNull(gammaCalibrationParamES.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaSampleCHStr.length())+"s%s", newBetaSampleCHStr, StringPool.SPACE, newGammaSampleCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 E + String newBetaSampleEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamS.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))), (Objects.isNull(betaCalibrationParamS.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))), - (Objects.isNull(betaCalibrationParamS.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamS.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))), + (Objects.isNull(betaCalibrationParamS.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3())))); + String newGammaSampleEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamS.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))), (Objects.isNull(gammaCalibrationParamS.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))), (Objects.isNull(gammaCalibrationParamS.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaSampleEStr.length())+"s%s", newBetaSampleEStr, StringPool.SPACE, newGammaSampleEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#SAMPLE: LIMITS PER ROI"); @@ -1091,42 +1097,48 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), + //拼接历史计算公式 CH + String oldBetaDetCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))); + String oldGammaDetCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaDetCHStr.length())+"s%s", oldBetaDetCHStr, StringPool.SPACE, oldGammaDetCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), + //拼接历史计算公式 E + String oldBetaDetEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))); + String oldGammaDetEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaDetEStr.length())+"s%s", oldBetaDetEStr, StringPool.SPACE, oldGammaDetEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#DET New CALIBRATION"); strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 CH + String newBetaDetCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamED.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))), (Objects.isNull(betaCalibrationParamED.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))), - (Objects.isNull(betaCalibrationParamED.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamED.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))), + (Objects.isNull(betaCalibrationParamED.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3())))); + String newGammaDetCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamED.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))), (Objects.isNull(gammaCalibrationParamED.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))), (Objects.isNull(gammaCalibrationParamED.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaDetCHStr.length())+"s%s", newBetaDetCHStr, StringPool.SPACE, newGammaDetCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 E + String newBetaDetEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamD.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))), (Objects.isNull(betaCalibrationParamD.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))), - (Objects.isNull(betaCalibrationParamD.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamD.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))), + (Objects.isNull(betaCalibrationParamD.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3())))); + String newGammaDetEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamD.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))), (Objects.isNull(gammaCalibrationParamD.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))), (Objects.isNull(gammaCalibrationParamD.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaDetEStr.length())+"s%s", newBetaDetEStr, StringPool.SPACE, newGammaDetEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#DET: LIMITS PER ROI"); @@ -1144,42 +1156,47 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), + //拼接历史计算公式 CH + String oldBetaGasCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))); + String oldGammaGasCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaGasCHStr.length())+"s%s", oldBetaGasCHStr, StringPool.SPACE, oldGammaGasCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), - NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)), - StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), + String oldBetaGasEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), + NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))); + String oldGammaGasEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-oldBetaGasEStr.length())+"s%s", oldBetaGasEStr, StringPool.SPACE, oldGammaGasEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#GAS New CALIBRATION"); strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 CH + String newBetaGasCHStr = rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamEG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))), (Objects.isNull(betaCalibrationParamEG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))), - (Objects.isNull(betaCalibrationParamEG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))), + (Objects.isNull(betaCalibrationParamEG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3())))); + String newGammaGasCHStr = rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))), (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))), (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaGasCHStr.length())+"s%s", newBetaGasCHStr, StringPool.SPACE, newGammaGasCHStr)); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, + //拼接新计算公式 E + String newBetaGasEStr = rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE, (Objects.isNull(betaCalibrationParamG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))), (Objects.isNull(betaCalibrationParamG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))), - (Objects.isNull(betaCalibrationParamG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))), - StringPool.SPACE, - (Objects.isNull(gammaCalibrationParamG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))), + (Objects.isNull(betaCalibrationParamG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3())))); + String newGammaGasEStr = rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x%-24s", (Objects.isNull(gammaCalibrationParamG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))), (Objects.isNull(gammaCalibrationParamG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))), (Objects.isNull(gammaCalibrationParamG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))), - StringPool.SPACE)); + StringPool.SPACE); + strBuffer.append(rowFormat("%s%-"+(52-newBetaGasEStr.length())+"s%s", newBetaGasEStr, StringPool.SPACE, newGammaGasEStr)); strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator()); strBuffer.append("#GAS: LIMITS PER ROI"); From 781d2892624ad5a52ff95c8acef5aa109d03d26f Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Thu, 16 Nov 2023 18:15:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?beta=E5=88=86=E6=9E=90=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E6=9B=B4=E6=96=B0=E8=BE=B9?= =?UTF-8?q?=E7=95=8C=E5=80=BC=EF=BC=8C=E4=B8=8D=E6=9B=B4=E6=96=B0XeData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/PHDFileUtil.java | 38 ++++++++++++++++++- .../impl/SpectrumAnalysisServiceImpl.java | 14 +++---- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java index adf82185..47c0697b 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java @@ -679,7 +679,43 @@ public class PHDFileUtil extends AbstractLogOrReport { analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara); } if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) { - System.out.println(analyseResult.error_log); + //新计算得到的边界值 + if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) { + List boundaryList = new LinkedList<>(); + for (int i=0; i boundaryList = new LinkedList<>(); + for (int i=0; i boundaryList = new LinkedList<>(); + for (int i=0; i sampleBoundary = (List) xeMap.get("SampleBoundary"); if(CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); From 51a5981faaf267f66d058c72ea9bef34ea58c805 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Thu, 16 Nov 2023 18:23:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?beta=E9=87=8D=E6=96=B0=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=87=8D=E6=96=B0=E5=88=86=E6=9E=90=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E5=8F=82=E6=95=B0=E8=B5=8B=E5=80=BC=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SpectrumAnalysisServiceImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 1358a0a7..6ef9ad0e 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 @@ -2926,7 +2926,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData(); //判断是否勾选了qc spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData(); - betaDataFile.setBgPara(spectrum_group.BgCalPara); File sampleTmp = null; File gasTmp = null; File detTmp = null; @@ -2989,6 +2988,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setXeResultsSpectrumList(xeResultsSpectrumList); betaDataFile.setBProcessed(true); betaDataFile.setSaveAnalysisResult(true); + betaDataFile.setBgPara(spectrum_group.BgCalPara); } } else { xeMap.put("XeData", Collections.EMPTY_LIST); @@ -3120,7 +3120,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData(); spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData(); spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData(); - sampleBetaData.setBgPara(spectrum_group.BgCalPara); File sampleTmp = null; File gasTmp = null; File detTmp = null; @@ -3136,15 +3135,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) { //调用分析方法进行分析操作 boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, sampleBetaData); - if (bRet) { - if (analyseData.isQcData()) { - if (StringUtils.isNotBlank(sampleBetaData.getQcFilePathName())) { - EnergySpectrumStruct struct = sampleBetaData.getQcStruct(); - if (Objects.nonNull(struct)) { - phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap, sampleBetaData); - } + if (analyseData.isQcData()) { + if (StringUtils.isNotBlank(sampleBetaData.getQcFilePathName())) { + EnergySpectrumStruct struct = sampleBetaData.getQcStruct(); + if (Objects.nonNull(struct)) { + phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap, sampleBetaData); } } + } + if (bRet) { List sampleBoundary = (List) xeMap.get("SampleBoundary"); if(CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); @@ -3183,6 +3182,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements sampleBetaData.setXeResultsSpectrumList(xeResultsSpectrumList); sampleBetaData.setBProcessed(true); sampleBetaData.setSaveAnalysisResult(true); + sampleBetaData.setBgPara(spectrum_group.BgCalPara); } analyseResultMap.put(sampleFileName, xeMap); } else {