fix:#MINIMUM数据块

This commit is contained in:
nieziyan 2024-10-08 21:43:34 +08:00
parent d940f1d6e4
commit c2c0566dae
4 changed files with 68 additions and 0 deletions

View File

@ -55,6 +55,15 @@ public class NumUtil {
return result;
}
public static String keep6ScienceStr(Double value){
if (ObjectUtil.isNull(value))
return null;
String result = NumberUtil.decimalFormat("0.######E00", value);
if (!StrUtil.contains(result, "E-"))
return StrUtil.replace(result, "E", "E+");
return result;
}
public static Double keep(Double value, int scale){
if (ObjectUtil.isNull(value))
return null;

View File

@ -1,8 +1,12 @@
package org.jeecg.modules.entity.vo;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import org.jeecg.common.util.NumUtil;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.List;
@Data
@ -48,4 +52,39 @@ public class CalMDCInfo implements Serializable {
*/
private Double yield;
private Double mda;
private String halfLifeStr = "";
private String mdcStr = "";
private String mdaStr = "";
public void format(){
if (ObjectUtil.isNotNull(halflife))
halfLifeStr = halfLifeStr(halflife);
if (ObjectUtil.isNotNull(mdc))
mdcStr = NumUtil.keep6ScienceStr(mdc);
if (ObjectUtil.isNotNull(mda))
mdaStr = NumUtil.keep6ScienceStr(mda);
}
private String halfLifeStr(Double halflife){
String units = "D";
if (halflife >= 1000) {
halflife = halflife / 365.25;
units = "A";
} else if (halflife < 0.1 && halflife >= 1.0 / 1440.0) {
halflife = halflife * 1440.0;
units = "M";
} else if (halflife <= 1.0 / 1440.0 && halflife > 0.0) {
halflife = halflife * 86400.0;
units = "S";
}
if (halflife < 1000)
return String.format("%.3f", halflife) + units;
NumberFormat numberFormat = new DecimalFormat("0.###E0");
return numberFormat.format(halflife) + units;
}
}

View File

@ -231,6 +231,8 @@ public class GStoreMiddleProcessData implements Serializable {
//SpecSetup
public SpecSetup setting_specSetup;
public List<CalMDCInfo> mdcInfos;
public GStoreMiddleProcessData(){
dbWriteFlag = false;
dbWriteStatusFlag = "";

View File

@ -2809,6 +2809,24 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#MINIMUM DETECTABLE CONCENTRATION FOR KEY NUCLIDES");
strBuffer.append(System.lineSeparator());
List<CalMDCInfo> mdcInfos = middleData.mdcInfos;
String mdcTitle = "%-15s%-18s%-15s%-15s";
String[] mdcData = new String[]{" Nuclide", "Halflife", "MDC", "MDA(Bq)"};
strBuffer.append(rowFormat(mdcTitle, mdcData));
strBuffer.append(System.lineSeparator());
for (CalMDCInfo mdcDto : mdcInfos) {
mdcDto.format();
strBuffer.append(rowFormat(mdcTitle, StringPool.SPACE + mdcDto.getNuclideName(),
mdcDto.getHalfLifeStr(), mdcDto.getMdcStr(), mdcDto.getMdaStr()));
//换行
strBuffer.append(System.lineSeparator());
}
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#PEAK SEARCH RESULTS");
//换行
strBuffer.append(System.lineSeparator());