diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/NuclideActMdaDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/NuclideActMdaDto.java new file mode 100644 index 00000000..a590bdd2 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/NuclideActMdaDto.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class NuclideActMdaDto implements Serializable { + + private String nuclide; + + private String halflife; + + private String yield; + + private String energy; + + private String efficiency; + + private String activity; + + private String actErr; + + private String mda; + + private String conc; + + private String mdc; +} diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java index 682da606..3017c195 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java @@ -29,6 +29,7 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.*; import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.bizVo.GammaRLR; +import org.jeecg.modules.base.dto.NuclideActMdaDto; import org.jeecg.modules.base.dto.PeakInfoDto; import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib; @@ -4115,44 +4116,77 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } data.put("peak", peakInfoDtos); /* The Results of Nuclide Identify */ - + // 获取所有核素名称 去重 + List nuclides = peakInfos.stream() + .flatMap(peakInfo -> peakInfo.nuclides.stream()) + .distinct().collect(Collectors.toList()); + String nuclideStr = String.join(" ", nuclides); + nuclideStr = ObjectUtil.isNull(nuclideStr) ? "" : nuclideStr; + data.put("nuclides", nuclideStr); /* Nuclide's Activity and Concentration */ - + // 时间部分 + String actTime = ""; String concTime = ""; + Date refTimeAct = phd.getUsedSetting().getRefTime_act(); + Date refTimeConc = phd.getUsedSetting().getRefTime_conc(); + if (ObjectUtil.isNotNull(refTimeAct)) + actTime = DateUtil.format(refTimeAct, DateConstant.DATE_BIAS_TIME); + if (ObjectUtil.isNotNull(refTimeConc)) + concTime = DateUtil.format(refTimeConc, DateConstant.DATE_BIAS_TIME); + data.put("actTime", actTime); data.put("concTime", concTime); + // 数据部分 + Map mapNucActMda = phd.getMapNucActMda(); + List nuclideActs = new ArrayList<>(); + for (Map.Entry entry : mapNucActMda.entrySet()) { + NuclideActMdaDto nuclideActMdaDto = new NuclideActMdaDto(); + String nuclide = entry.getKey(); + nuclideActMdaDto.setNuclide(nuclide); + NuclideActMda nuclideActMda = entry.getValue(); + String halflifeValue = ""; + if(nuclideActMda.isBCalculateMDA()) { + String units = "S"; + double halflife = nuclideActMda.getHalflife(); + if(halflife >= 31556736) { // 1年 = 31556736s + halflife /= 31556736; + units = "A"; + } else if(halflife >= 86400) { // 1天 = 86400s + halflife /= 86400; + units = "D"; + } else if(halflife >= 3600) { // 1小时 = 3600s + halflife /= 3600; + units = "H"; + } + halflifeValue = NumberFormatUtil.numberFormat(String.valueOf(halflife)) + units; + } + nuclideActMdaDto.setHalflife(halflifeValue); + String efficiency = NumberFormatUtil.numberFormat(String.valueOf(nuclideActMda.getEfficiency())); + nuclideActMdaDto.setEfficiency(efficiency); + double actErrValue = nuclideActMda.getAct_err(); + double activityValue = nuclideActMda.getActivity(); + String activity = NumberFormatUtil.numberFormat(String.valueOf(activityValue)); + nuclideActMdaDto.setActivity(activity); + String actErr = NumberFormatUtil.numberFormat(String.valueOf(actErrValue / activityValue * 100)); + nuclideActMdaDto.setActErr(actErr); + String mda = NumberFormatUtil.numberFormat(String.valueOf(nuclideActMda.getMda())); + nuclideActMdaDto.setMda(mda); + String conc = NumberFormatUtil.numberFormat(String.valueOf(nuclideActMda.getConcentration())); + nuclideActMdaDto.setConc(conc); + String mdc = NumberFormatUtil.numberFormat(String.valueOf(nuclideActMda.getMdc())); + nuclideActMdaDto.setMdc(mdc); + int calculateIdx = nuclideActMda.getCalculateIdx(); + List vEnergy = nuclideActMda.getVEnergy(); + List vYield = nuclideActMda.getVYield(); + if(calculateIdx >= 0 && calculateIdx < vEnergy.size()) { + String yield = NumberFormatUtil.numberFormat(String.valueOf(vYield.get(calculateIdx) * 100)); + String energy = NumberFormatUtil.numberFormat(String.valueOf(vEnergy.get(calculateIdx))); + nuclideActMdaDto.setYield(yield); nuclideActMdaDto.setEnergy(energy); + } else { + nuclideActMdaDto.setYield("NULL"); nuclideActMdaDto.setEnergy("NULL"); + } + nuclideActs.add(nuclideActMdaDto); + } + data.put("nuclideActs", nuclideActs); String template = SAVETOEXCEL_G.getName(); // 导出时使用默认文件名 file.xls ExportUtil.exportXls(response, template, data); } - - /** - * 行日志格式化 - * @param source 需要格式化的字符串 - * @param symbolNum 格式化的符号数量 - * @param args 格式化替换参数数组 - * @return - */ - private String titleFormat(String source, Integer symbolNum, String... args){ - StringBuilder firstParam = new StringBuilder(); - for (int i=0;i