Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
77178c6a61
|
@ -8,6 +8,10 @@ public interface DateConstant {
|
|||
|
||||
String DATE_TIME = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
String DATE_BIAS = "yyyy/MM/dd";
|
||||
|
||||
String DATE_BIAS_TIME = "yyyy/MM/dd HH:mm:ss";
|
||||
|
||||
String TIME_START = " 00:00:00";
|
||||
|
||||
String TIME_END = " 23:59:59";
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class NumUtil {
|
||||
|
||||
/*
|
||||
* 整数位+小数位的和 保留指定位数
|
||||
* */
|
||||
public static Double fixedMax(int bit, Double value){
|
||||
if (ObjectUtil.isNull(value))
|
||||
return value;
|
||||
|
@ -17,4 +23,44 @@ public class NumUtil {
|
|||
BigDecimal decimal = new BigDecimal(value);
|
||||
return decimal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
public static String keep2Str(Double value){
|
||||
if (ObjectUtil.isNull(value))
|
||||
return null;
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
||||
return String.valueOf(decimal.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
}
|
||||
|
||||
public static String keep3Str(Double value){
|
||||
if (ObjectUtil.isNull(value))
|
||||
return null;
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
||||
return String.valueOf(decimal.setScale(3, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
}
|
||||
|
||||
public static String keep4ScienceStr(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;
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
||||
return decimal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
public static String keepStr(Double value, int scale){
|
||||
if (ObjectUtil.isNull(value))
|
||||
return null;
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
||||
return String.valueOf(decimal.setScale(scale, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package org.jeecg.modules.base.bizVo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
|
|
@ -21,4 +21,15 @@ public class Nuclides implements Serializable {
|
|||
private String mdc;
|
||||
|
||||
private String lc;
|
||||
|
||||
public Nuclides() {
|
||||
this.name = "";
|
||||
this.activity = "";
|
||||
this.uncertActivity = "";
|
||||
this.mda = "";
|
||||
this.concentration = "";
|
||||
this.uncertConcentration = "";
|
||||
this.mdc = "";
|
||||
this.lc = "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,11 @@ public class Ratios implements Serializable {
|
|||
private String isotopeRatio;
|
||||
|
||||
private String uncertRatio;
|
||||
|
||||
public Ratios() {
|
||||
this.nuclide1 = "";
|
||||
this.nuclide2 = "";
|
||||
this.isotopeRatio = "";
|
||||
this.uncertRatio = "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.io.Serializable;
|
|||
@Data
|
||||
public class TableAssociation implements Serializable {
|
||||
|
||||
private Integer index;
|
||||
|
||||
private String exLevel;
|
||||
|
||||
private String identified;
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.io.Serializable;
|
|||
@Data
|
||||
public class TablePeakFit implements Serializable {
|
||||
|
||||
private Integer index;
|
||||
|
||||
private String energy;
|
||||
|
||||
private String energyErr;
|
||||
|
|
Binary file not shown.
|
@ -43,7 +43,6 @@ import java.sql.Connection;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
@ -1928,7 +1927,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Date curTime = new Date();
|
||||
String dateTime = DateUtil.format(new Date(), DateConstant.DATE_BIAS_TIME);
|
||||
String date = DateUtil.format(new Date(), DateConstant.DATE_BIAS);
|
||||
String responsible_person = "wang shilian";
|
||||
String software = "GammaAnalyser,GammaAnalyALG";
|
||||
int num = phd.getVPeak().size();
|
||||
|
@ -1953,29 +1953,29 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("header_report_type", "FIN"); // 8: Report Type
|
||||
map.put("header_report_number", "1"); // 9: Report Number
|
||||
map.put("header_sample_category", "Category C"); // 10:Sample Category
|
||||
map.put("header_transmission", curTime); // 11:Message Transmission Time
|
||||
map.put("header_transmission", dateTime); // 11:Message Transmission Time
|
||||
// Init #Objective
|
||||
map.put("Obj_purpose", "The purpose of this analysis is proficiency test.");
|
||||
map.put("Obj_authorized", "High-resolution non-destructive gamma spectroscopy.");
|
||||
map.put("Obj_instruction", "`0");
|
||||
map.put("Obj_instruction", "0");
|
||||
// Init #Collection
|
||||
String col_start = phd.getCollect().getCollection_start_date() + StringPool.SPACE + phd.getCollect().getCollection_start_time();
|
||||
String col_stop = phd.getCollect().getCollection_stop_date() + StringPool.SPACE + phd.getCollect().getCollection_stop_time();
|
||||
map.put("collect_start", col_start);
|
||||
map.put("collect_stop", col_stop);
|
||||
map.put("collect_airVolume", phd.getCollect().getAir_volume());
|
||||
map.put("collect_airVolume", NumUtil.keep(phd.getCollect().getAir_volume(), 4));
|
||||
// Init #SampleReceipt
|
||||
if(StringUtils.isNotBlank(phd.getHeader().getSample_ref_id())){
|
||||
map.put("Receipt_srid", phd.getHeader().getSample_ref_id());
|
||||
}
|
||||
map.put("Receipt_sealNum", "0");
|
||||
map.put("Receipt_sample_dateTime", curTime);
|
||||
map.put("Receipt_sample_dateTime", dateTime);
|
||||
map.put("Receipt_package", "Parcel.");
|
||||
map.put("Receipt_seal", "Good.");
|
||||
map.put("Receipt_sample", "Good.");
|
||||
// Init #Test
|
||||
map.put("Test_type", "Analysis of a reference sample.");
|
||||
map.put("Test_completion", curTime);
|
||||
map.put("Test_completion", date);
|
||||
map.put("Test_person", responsible_person);
|
||||
map.put("Test_purpose", "The purpose of this analysis is proficiency test exercise.");
|
||||
// Init #PeaksMethod
|
||||
|
@ -1987,17 +1987,18 @@ public class GammaServiceImpl implements IGammaService {
|
|||
double live_time = phd.getAcq().getAcquisition_live_time();
|
||||
for(int i=0; i<num; ++i) {
|
||||
TablePeakFit tablePeak = new TablePeakFit();
|
||||
tablePeak.setIndex(i + 1);
|
||||
PeakInfo peak = phd.getVPeak().get(i);
|
||||
tablePeak.setEnergy(String.valueOf(peak.energy));
|
||||
tablePeak.setEnergy(NumUtil.keep3Str(peak.energy));
|
||||
tablePeak.setEnergyErr(energy_uncert);
|
||||
tablePeak.setNetArea(String.valueOf(peak.area));
|
||||
String area_err = peak.area > 0 ? String.valueOf(peak.areaErr/peak.area*100) : "0";
|
||||
tablePeak.setNetArea(NumUtil.keep4ScienceStr(peak.area));
|
||||
String area_err = peak.area > 0 ? NumUtil.keep2Str(peak.areaErr/peak.area*100) : "0";
|
||||
tablePeak.setAreaErr(area_err);
|
||||
String rate = live_time > 0 ? String.valueOf(peak.area/live_time) : "0";
|
||||
String rate = live_time > 0 ? NumUtil.keep4ScienceStr(peak.area/live_time) : "0";
|
||||
tablePeak.setNetCountRate(rate);
|
||||
tablePeak.setNcRateErr(area_err);
|
||||
tablePeak.setLc(String.valueOf(peak.lc));
|
||||
tablePeak.setSignificance(String.valueOf(peak.significance));
|
||||
tablePeak.setLc(NumUtil.keep4ScienceStr(peak.lc));
|
||||
tablePeak.setSignificance(NumUtil.keep2Str(peak.significance));
|
||||
peakFitList.add(tablePeak);
|
||||
}
|
||||
map.put("peakFit", peakFitList);
|
||||
|
@ -2012,6 +2013,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
List<TableAssociation> associationList = new LinkedList<>();
|
||||
for(int i=0; i<num; ++i) {
|
||||
TableAssociation tableAssociation = new TableAssociation();
|
||||
tableAssociation.setIndex(i + 1);
|
||||
tableAssociation.setExLevel(Explanation_Level);
|
||||
List<String> nuclides = phd.getVPeak().get(i).nuclides;
|
||||
String iden = "";
|
||||
|
@ -2033,20 +2035,28 @@ public class GammaServiceImpl implements IGammaService {
|
|||
String coverage_factor = "2.00";
|
||||
String level_confidence = "95.00";
|
||||
|
||||
map.put("Result_act_ref", phd.getUsedSetting().getRefTime_act());
|
||||
map.put("Result_conc_ref", phd.getUsedSetting().getRefTime_conc());
|
||||
Date refTimeAct = phd.getUsedSetting().getRefTime_act();
|
||||
Date refTimeConc = phd.getUsedSetting().getRefTime_conc();
|
||||
String timeAct = "";
|
||||
String timeConc = "";
|
||||
if (ObjectUtil.isNotNull(refTimeAct))
|
||||
timeAct = DateUtil.format(refTimeAct, DateConstant.DATE_BIAS_TIME);
|
||||
if (ObjectUtil.isNotNull(refTimeConc))
|
||||
timeConc = DateUtil.format(refTimeConc, DateConstant.DATE_BIAS_TIME);
|
||||
map.put("Result_act_ref", timeAct);
|
||||
map.put("Result_conc_ref", timeConc);
|
||||
List<TableResult> tableResultList = new LinkedList<>();
|
||||
for(Map.Entry<String, NuclideActMda> it : phd.getMapNucActMda().entrySet()){
|
||||
if(it.getValue().isBCalculateMDA()) {
|
||||
TableResult tableResult = new TableResult();
|
||||
NuclideActMda nuc = it.getValue();
|
||||
tableResult.setNuclide(it.getKey());
|
||||
tableResult.setActivity(String.valueOf(nuc.getActivity()));
|
||||
String act_err = nuc.getActivity() > 0 ? String.valueOf(nuc.getAct_err()/nuc.getActivity()*100) : "0";
|
||||
tableResult.setActivity(NumUtil.keep4ScienceStr(nuc.getActivity()));
|
||||
String act_err = nuc.getActivity() > 0 ? NumUtil.keepStr(nuc.getAct_err()/nuc.getActivity()*100, 2) : "0";
|
||||
tableResult.setActErr(act_err);
|
||||
tableResult.setFactor1(coverage_factor);
|
||||
tableResult.setConfidence1(level_confidence);
|
||||
tableResult.setConc(String.valueOf(nuc.getConcentration()/1000));
|
||||
tableResult.setConc(NumUtil.keep4ScienceStr(nuc.getConcentration()/1000));
|
||||
tableResult.setConcErr(act_err);
|
||||
tableResult.setFactor2(coverage_factor);
|
||||
tableResult.setConfidence2(level_confidence);
|
||||
|
@ -2075,8 +2085,10 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportRLR(GammaRLR gammaRLR, HttpServletResponse response) {
|
||||
if (ObjectUtil.isNull(gammaRLR)) return;
|
||||
String pathPrefix = "excelTemplate/";
|
||||
String path = pathPrefix + RLR_G.getName();
|
||||
String template = ClassUtil.classPath(path);
|
||||
|
@ -2149,6 +2161,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
||||
if (Objects.isNull(sampleId)){
|
||||
|
|
|
@ -1330,14 +1330,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||
String export = "RLR-Beta.xls";
|
||||
String template = RLR_B.getName();
|
||||
ExportUtil.exportXls(response, template, dataMap,export);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
BetaRLR betaRLR = new BetaRLR();
|
||||
Map<String,Object> dataMap = BeanUtil.beanToMap(betaRLR);
|
||||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||
dataMap.forEach((key, value) -> System.out.println(key + "---" + value));
|
||||
ExportUtil.exportXls(response, template, dataMap, export);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.system.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -10,4 +11,6 @@ import java.util.Map;
|
|||
public interface IGardsNuclLinesLibService extends IService<GardsNuclLinesLib> {
|
||||
|
||||
Map<String,List<GardsNuclLinesLib>> mapLines(List<String> nuclideNames);
|
||||
|
||||
Map<String, NuclideLines> defaultLines(List<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -2,17 +2,12 @@ package org.jeecg.modules.system.service.impl;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import org.apache.commons.collections.MultiHashMap;
|
||||
import org.jeecg.common.util.ListUtils;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
import org.jeecg.modules.system.mapper.GardsNuclLinesLibMapper;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLibService;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLinesLibService;
|
||||
|
@ -21,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -64,4 +60,40 @@ public class GardsNuclLinesLibServiceImpl extends ServiceImpl<GardsNuclLinesLibM
|
|||
result = allNuclide.stream().collect(Collectors.groupingBy(GardsNuclLinesLib::getName));
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Map<String, NuclideLines> defaultLines(List<String> nuclideNames) {
|
||||
Map<String, NuclideLines> result = new HashMap<>();
|
||||
LambdaQueryWrapper<GardsNuclLinesLib> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsNuclLinesLib::getName, nuclideNames);
|
||||
// 获取GardsNuclLinesLib核素数据
|
||||
List<GardsNuclLinesLib> allNuclide = list(wrapper);
|
||||
Map<String, Double> halfLife = nuclLibService.halfLife(nuclideNames);
|
||||
|
||||
// 按照 QT源代码 处理数据
|
||||
for (int i = 0; i < allNuclide.size(); i++) {
|
||||
NuclideLines nuclideLines;
|
||||
GardsNuclLinesLib lib = allNuclide.get(i);
|
||||
nuclideLines = result.containsKey(lib.getName()) ? result.get(lib.getName()) : new NuclideLines();
|
||||
|
||||
nuclideLines.getFullNames().add(lib.getFullName());
|
||||
nuclideLines.getVEnergy().add(lib.getEnergy());
|
||||
nuclideLines.getVUncertE().add(lib.getEnergyUncert());
|
||||
nuclideLines.getVYield().add(lib.getYield() / 100);
|
||||
nuclideLines.getVUncertY().add(lib.getYieldUncert());
|
||||
|
||||
int keyFlag = lib.getKeyFlag();
|
||||
if (keyFlag > 0){
|
||||
nuclideLines.setKey_flag(i);
|
||||
nuclideLines.setMaxYeildIdx(i);
|
||||
}
|
||||
|
||||
String name = lib.getName();
|
||||
Double day = halfLife.get(name);
|
||||
if (ObjectUtil.isNotNull(day))
|
||||
lib.setHalflife(day * 86400);
|
||||
|
||||
result.put(lib.getName(), nuclideLines);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.jeecg.common.constant.RedisConstant;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.system.mapper.SysDefaultNuclideMapper;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLinesLibService;
|
||||
|
@ -24,10 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
@ -108,21 +106,27 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
|
|||
@PostConstruct
|
||||
@Override
|
||||
public void mapLines2Redis() {
|
||||
HashMap<String, NuclideLines> linesHashMap = new HashMap<>();
|
||||
|
||||
List<String> nuclideTypes = ListUtil.toList("G","P");
|
||||
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysDefaultNuclide::getUseType,1);
|
||||
wrapper.in(SysDefaultNuclide::getNuclideType,nuclideTypes);
|
||||
// 获取自动处理需要的默认核素参数
|
||||
List<SysDefaultNuclide> nuclides = list(wrapper);
|
||||
// 根据核素类型分组
|
||||
Map<String, List<SysDefaultNuclide>> nuclideMap = nuclides.stream()
|
||||
.filter(nuclide -> StrUtil.isNotBlank(nuclide.getNuclideName()))
|
||||
.collect(Collectors.groupingBy(SysDefaultNuclide::getNuclideType));
|
||||
// 获取GardsNuclLinesLib核素数据
|
||||
for (Map.Entry<String, List<SysDefaultNuclide>> entry : nuclideMap.entrySet()) {
|
||||
List<String> nuclideNames = entry.getValue().stream()
|
||||
.map(SysDefaultNuclide::getNuclideName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
String nuclideType = entry.getKey();
|
||||
String key = RedisConstant.NUCLIDE_LINES_LIB + nuclideType;
|
||||
Map<String,List<GardsNuclLinesLib>> mapLines = nuclLinesLibService.mapLines(nuclideNames);
|
||||
Map<String,NuclideLines> mapLines = nuclLinesLibService.defaultLines(nuclideNames);
|
||||
redisUtil.set(key,mapLines);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user