自建台站新增实体类存储公用的数据内容

自建台站返回内容增加det相关数据
web模块增加查询系统类型对应的配置核素信息
web模块增加查询系统类型对应的核素统计信息
人工交互模块增加beta部分日志文件的存在情况判断,上传后的日志文件不进行删除
This commit is contained in:
qiaoqinzheng 2024-01-18 10:33:07 +08:00
parent ee2dd272d1
commit 82713a8795
11 changed files with 678 additions and 276 deletions

View File

@ -24,12 +24,19 @@ public class SelfStationUtil extends AbstractLogOrReport {
@Autowired
private FTPUtil ftpUtil;
public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, Map<String, Object> map) {
public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, String systemType, Map<String, Object> map) {
try {
//读取sample的分析文件内容
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
SpectrumData spectrumData = new SpectrumData();
EnergySpectrumStruct struct = null;
if (systemType.equals("sample")) {
//读取sample的分析文件内容
struct = selfStationData.getSampleStruct();
} else if (systemType.equals("det")) {
struct = selfStationData.getDetStruct();
}
//存储页面操作数据
SelfStationVueData selfStationVueData = new SelfStationVueData();
//封装散点图下的基础数据信息
SpectrumData spectrumData = new SpectrumData();
//Station Code
String stationCode = struct.site_code;
//Detector Code
@ -91,36 +98,80 @@ public class SelfStationUtil extends AbstractLogOrReport {
spectrumData.setMeasurementId(measurementId);
map.put("spectrumData", spectrumData);
//根据范围1划分 范围1对应的折线图
statisticsROIList(struct.POI_B_x1.get(0).intValue(), struct.POI_B_x2.get(0).intValue(), 1, selfStationData);
if ( CollectionUtils.isNotEmpty(selfStationData.getROIOneList()) && Objects.nonNull(selfStationData.getROIOneBetaStart())
&& Objects.nonNull(selfStationData.getROIOneBetaStop()) ) {
map.put("ROIOneList", selfStationData.getROIOneList());
map.put("ROIOneStart", selfStationData.getROIOneBetaStart());
map.put("ROIOneStop", selfStationData.getROIOneBetaStop());
Map<String, Object> oneMap = statisticsROIList(struct.POI_B_x1.get(0).intValue(), struct.POI_B_x2.get(0).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if (CollectionUtils.isNotEmpty(oneMap) ) {
Integer startChannel = (Integer) oneMap.get("startChannel");
Integer endChannel = (Integer) oneMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) oneMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIOneBetaStart(startChannel);
selfStationData.getSampleVueData().setROIOneBetaStop(endChannel);
selfStationData.getSampleVueData().setROIOneList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIOneBetaStart(startChannel);
selfStationData.getDetVueData().setROIOneBetaStop(endChannel);
selfStationData.getDetVueData().setROIOneList(seriseDataList);
}
map.put("ROIOneStart", startChannel);
map.put("ROIOneStop", endChannel);
map.put("ROIOneList", seriseDataList);
}
//根据范围2划分 范围2对应的折线图
statisticsROIList(struct.POI_B_x1.get(1).intValue(), struct.POI_B_x2.get(1).intValue(), 2, selfStationData);
if ( CollectionUtils.isNotEmpty(selfStationData.getROITwoList()) && Objects.nonNull(selfStationData.getROITwoBetaStart())
&& Objects.nonNull(selfStationData.getROITwoBetaStop()) ) {
map.put("ROITwoList", selfStationData.getROITwoList());
map.put("ROITwoStart", selfStationData.getROITwoBetaStart());
map.put("ROITwoStop", selfStationData.getROITwoBetaStop());
Map<String, Object> twoMap = statisticsROIList(struct.POI_B_x1.get(1).intValue(), struct.POI_B_x2.get(1).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(twoMap) ) {
Integer startChannel = (Integer) twoMap.get("startChannel");
Integer endChannel = (Integer) twoMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) twoMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROITwoBetaStart(startChannel);
selfStationData.getSampleVueData().setROITwoBetaStop(endChannel);
selfStationData.getSampleVueData().setROITwoList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROITwoBetaStart(startChannel);
selfStationData.getDetVueData().setROITwoBetaStop(endChannel);
selfStationData.getDetVueData().setROITwoList(seriseDataList);
}
map.put("ROITwoStart", startChannel);
map.put("ROITwoStop", endChannel);
map.put("ROITwoList", seriseDataList);
}
//根据范围3划分 范围3对应的折线图
statisticsROIList(struct.POI_B_x1.get(2).intValue(), struct.POI_B_x2.get(2).intValue(), 3, selfStationData);
if ( CollectionUtils.isNotEmpty(selfStationData.getROIThreeList()) && Objects.nonNull(selfStationData.getROIThreeBetaStart())
&& Objects.nonNull(selfStationData.getROIThreeBetaStop()) ) {
map.put("ROIThreeList", selfStationData.getROIThreeList());
map.put("ROIThreeStart", selfStationData.getROIThreeBetaStart());
map.put("ROIThreeStop", selfStationData.getROIThreeBetaStop());
Map<String, Object> threeMap = statisticsROIList(struct.POI_B_x1.get(2).intValue(), struct.POI_B_x2.get(2).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(threeMap) ) {
Integer startChannel = (Integer) threeMap.get("startChannel");
Integer endChannel = (Integer) threeMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) threeMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIThreeBetaStart(startChannel);
selfStationData.getSampleVueData().setROIThreeBetaStop(endChannel);
selfStationData.getSampleVueData().setROIThreeList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIThreeBetaStart(startChannel);
selfStationData.getDetVueData().setROIThreeBetaStop(endChannel);
selfStationData.getDetVueData().setROIThreeList(seriseDataList);
}
map.put("ROIThreeStart", startChannel);
map.put("ROIThreeStop", endChannel);
map.put("ROIThreeList", seriseDataList);
}
//根据范围4划分 范围4对应的折线图
statisticsROIList(struct.POI_B_x1.get(3).intValue(), struct.POI_B_x2.get(3).intValue(), 4, selfStationData);
if ( CollectionUtils.isNotEmpty(selfStationData.getROIFourList()) && Objects.nonNull(selfStationData.getROIFourBetaStart())
&& Objects.nonNull(selfStationData.getROIFourBetaStop()) ) {
map.put("ROIFourList", selfStationData.getROIFourList());
map.put("ROIFourStart", selfStationData.getROIFourBetaStart());
map.put("ROIFourStop", selfStationData.getROIFourBetaStop());
Map<String, Object> fourMap = statisticsROIList(struct.POI_B_x1.get(3).intValue(), struct.POI_B_x2.get(3).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(fourMap) ) {
Integer startChannel = (Integer) fourMap.get("startChannel");
Integer endChannel = (Integer) fourMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) fourMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIFourBetaStart(startChannel);
selfStationData.getSampleVueData().setROIFourBetaStop(endChannel);
selfStationData.getSampleVueData().setROIFourList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIFourBetaStart(startChannel);
selfStationData.getDetVueData().setROIFourBetaStop(endChannel);
selfStationData.getDetVueData().setROIFourList(seriseDataList);
}
map.put("ROIFourStart", startChannel);
map.put("ROIFourStop", endChannel);
map.put("ROIFourList", seriseDataList);
}
//散点图
//统计散点图
@ -186,51 +237,55 @@ public class SelfStationUtil extends AbstractLogOrReport {
//g_Energy
if (CollectionUtils.isNotEmpty(struct.g_energy) && CollectionUtils.isNotEmpty(struct.g_centroid_channel) && CollectionUtils.isNotEmpty(struct.g_uncertainty) && Objects.nonNull(struct.g_record_count)) {
GEnergyBlock gEnergyBlock = new GEnergyBlock();
gEnergyBlock.setG_energy(struct.g_energy);
gEnergyBlock.setCentroid_channel(struct.g_centroid_channel);
gEnergyBlock.setUncertainty(struct.g_uncertainty);
gEnergyBlock.setRecord_count(struct.g_record_count);
selfStationData.getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo);
if (systemType.equals("sample")) {
GEnergyBlock gEnergyBlock = new GEnergyBlock();
gEnergyBlock.setG_energy(struct.g_energy);
gEnergyBlock.setCentroid_channel(struct.g_centroid_channel);
gEnergyBlock.setUncertainty(struct.g_uncertainty);
gEnergyBlock.setRecord_count(struct.g_record_count);
selfStationData.getSampleVueData().getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
//g_Resolution
if (CollectionUtils.isNotEmpty(struct.g_r_energy) && CollectionUtils.isNotEmpty(struct.g_r_FWHM) && CollectionUtils.isNotEmpty(struct.g_r_uncertainty) && Objects.nonNull(struct.g_r_record_count)) {
GResolutionBlock gResolutionBlock = new GResolutionBlock();
gResolutionBlock.setG_energy(struct.g_r_energy);
gResolutionBlock.setFWHM(struct.g_r_FWHM);
gResolutionBlock.setUncertainty(struct.g_r_uncertainty);
gResolutionBlock.setRecord_count(struct.g_r_record_count);
selfStationData.getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo);
if (systemType.equals("sample")) {
GResolutionBlock gResolutionBlock = new GResolutionBlock();
gResolutionBlock.setG_energy(struct.g_r_energy);
gResolutionBlock.setFWHM(struct.g_r_FWHM);
gResolutionBlock.setUncertainty(struct.g_r_uncertainty);
gResolutionBlock.setRecord_count(struct.g_r_record_count);
selfStationData.getSampleVueData().getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
//g_Efficiency
if (CollectionUtils.isNotEmpty(struct.g_e_energy) && CollectionUtils.isNotEmpty(struct.g_e_efficiency) && CollectionUtils.isNotEmpty(struct.g_e_uncertainty) && Objects.nonNull(struct.g_e_record_count)) {
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
gEfficiencyBlock.setG_energy(struct.g_e_energy);
gEfficiencyBlock.setEfficiency(struct.g_e_efficiency);
gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty);
gEfficiencyBlock.setRecord_count(struct.g_e_record_count);
selfStationData.getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo);
if (systemType.equals("sample")) {
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
gEfficiencyBlock.setG_energy(struct.g_e_energy);
gEfficiencyBlock.setEfficiency(struct.g_e_efficiency);
gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty);
gEfficiencyBlock.setRecord_count(struct.g_e_record_count);
selfStationData.getSampleVueData().getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
@ -265,17 +320,12 @@ public class SelfStationUtil extends AbstractLogOrReport {
* 统计道值范围内数量
* @param startChannel 起始道值
* @param endChannel 结束道值
* @param num 第几个范围
* @param selfStationData 自建台站对象
* @param betaChannels 行数
* @param gammaChannels 列数
* @param h_counts 计数数组
*/
public void statisticsROIList(Integer startChannel, Integer endChannel, Integer num, SelfStationData selfStationData) {
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
//获取总行数信息
long betaChannels = struct.b_channels;
//获取总列数信息
long gammaChannels = struct.g_channels;
//获取散点图数量信息
List<Long> h_counts = struct.h_counts;
public Map<String, Object> statisticsROIList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
Map<String, Object> map = new HashMap<>();
//存储同一列不同行加和后的数量
List<Integer> sumList = new LinkedList<>();
List<SeriseData> seriseDataList = new LinkedList<>();
@ -286,7 +336,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
int sum = 0;
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
for (int j=startChannel; j <= endChannel; j++) {
//道值 * 总行数 + 当前列数 获取对应的数据数组下标
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
int index = (int) (i * betaChannels + j);
long count = 0;
//判断下标是否在h_counts范围内
@ -299,23 +349,10 @@ public class SelfStationUtil extends AbstractLogOrReport {
sumList.add(sum);
seriseDataList.add(seriseData);
}
if (1 == num) {
selfStationData.setROIOneList(seriseDataList);
selfStationData.setROIOneBetaStart(startChannel);
selfStationData.setROIOneBetaStop(endChannel);
} else if (2 == num) {
selfStationData.setROITwoList(seriseDataList);
selfStationData.setROITwoBetaStart(startChannel);
selfStationData.setROITwoBetaStop(endChannel);
} else if (3 == num) {
selfStationData.setROIThreeList(seriseDataList);
selfStationData.setROIThreeBetaStart(startChannel);
selfStationData.setROIThreeBetaStop(endChannel);
} else if (4 == num) {
selfStationData.setROIFourList(seriseDataList);
selfStationData.setROIFourBetaStart(startChannel);
selfStationData.setROIFourBetaStop(endChannel);
}
map.put("startChannel", startChannel);
map.put("endChannel", endChannel);
map.put("dataList", seriseDataList);
return map;
}
public String UpdateEquationEnergy(ParameterInfo m_curParam) {
@ -412,7 +449,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
vChan.add(1.0);
vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels));
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getUsedEnerPara().getP()).counts;
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts;
double d = vEner.get(0), maxE = vEner.get(1);
double dStep = maxE / width * 2;
@ -545,7 +582,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
vChan.add(1.0);
vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels));
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getUsedEnerPara().getP()).counts;
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts;
double d = vEner.get(0);
double maxE = vEner.get(1);
double dStep = maxE / width * 2;

View File

@ -32,105 +32,18 @@ public class SelfStationData implements Serializable {
private EnergySpectrumStruct detStruct;
/**
* ROI-1结果数据
* sample对应的操作数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIOneList;
//ROI-1范围矩形框起始道值
private Integer ROIOneBetaStart;
//ROI-1范围矩形框终止道值
private Integer ROIOneBetaStop;
private SelfStationVueData sampleVueData;
/**
* ROI-2结果数据
* det对应的操作数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROITwoList;
//ROI-2范围矩形框起始道值
private Integer ROITwoBetaStart;
//ROI-2范围矩形框终止道值
private Integer ROITwoBetaStop;
/**
* ROI-3结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIThreeList;
//ROI-3范围矩形框起始道值
private Integer ROIThreeBetaStart;
//ROI-3范围矩形框终止道值
private Integer ROIThreeBetaStop;
/**
* ROI-4结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIFourList;
//ROI-4范围矩形框起始道值
private Integer ROIFourBetaStart;
//ROI-4范围矩形框终止道值
private Integer ROIFourBetaStop;
// 当前修改的刻度名称
private String newEner;
private String newReso;
private String newEffi;
/**
* 使用中的能量参数对应的刻度名称
*/
private String usedEner;
private String usedReso;
private String usedEffi;
// 当前寻峰结果所用的刻度数据
private GEnergyBlock usedEnerKD;
private GResolutionBlock usedResoKD;
private GEfficiencyBlock usedEffiKD;
// 存储所有的刻度数据
private Map<String, GEnergyBlock> mapEnerKD; // 能量刻度
private Map<String, GResolutionBlock> mapResoKD; // 分辨率刻度
private Map<String, GEfficiencyBlock> mapEffiKD; // 效率刻度
// 当前寻峰结果所用的刻度参数
private ParameterInfo usedEnerPara;
private ParameterInfo usedResoPara;
private ParameterInfo usedEffiPara;
// 存储所有的刻度参数
private Map<String, ParameterInfo> mapEnerPara;
private Map<String, ParameterInfo> mapResoPara;
private Map<String, ParameterInfo> mapEffiPara;
private SelfStationVueData detVueData;
public SelfStationData() {
newEner = "PHD";
newReso = "PHD";
newEffi = "PHD";
usedEner= "";
usedReso= "";
usedEffi= "";
mapEnerKD = new HashMap<>();
mapResoKD = new HashMap<>();
mapEffiKD = new HashMap<>();
usedEnerPara = new ParameterInfo();
usedResoPara = new ParameterInfo();
usedEffiPara = new ParameterInfo();
mapEnerPara = new HashMap<>();
mapResoPara = new HashMap<>();
mapEffiPara = new HashMap<>();
sampleVueData = new SelfStationVueData();
detVueData = new SelfStationVueData();
}
}

View File

@ -0,0 +1,115 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class SelfStationVueData implements Serializable {
/**
* ROI-1结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIOneList;
//ROI-1范围矩形框起始道值
private Integer ROIOneBetaStart;
//ROI-1范围矩形框终止道值
private Integer ROIOneBetaStop;
/**
* ROI-2结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROITwoList;
//ROI-2范围矩形框起始道值
private Integer ROITwoBetaStart;
//ROI-2范围矩形框终止道值
private Integer ROITwoBetaStop;
/**
* ROI-3结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIThreeList;
//ROI-3范围矩形框起始道值
private Integer ROIThreeBetaStart;
//ROI-3范围矩形框终止道值
private Integer ROIThreeBetaStop;
/**
* ROI-4结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIFourList;
//ROI-4范围矩形框起始道值
private Integer ROIFourBetaStart;
//ROI-4范围矩形框终止道值
private Integer ROIFourBetaStop;
// 当前修改的刻度名称
private String newEner;
private String newReso;
private String newEffi;
/**
* 使用中的能量参数对应的刻度名称
*/
private String usedEner;
private String usedReso;
private String usedEffi;
// 当前寻峰结果所用的刻度数据
private GEnergyBlock usedEnerKD;
private GResolutionBlock usedResoKD;
private GEfficiencyBlock usedEffiKD;
// 存储所有的刻度数据
private Map<String, GEnergyBlock> mapEnerKD; // 能量刻度
private Map<String, GResolutionBlock> mapResoKD; // 分辨率刻度
private Map<String, GEfficiencyBlock> mapEffiKD; // 效率刻度
// 当前寻峰结果所用的刻度参数
private ParameterInfo usedEnerPara;
private ParameterInfo usedResoPara;
private ParameterInfo usedEffiPara;
// 存储所有的刻度参数
private Map<String, ParameterInfo> mapEnerPara;
private Map<String, ParameterInfo> mapResoPara;
private Map<String, ParameterInfo> mapEffiPara;
public SelfStationVueData() {
newEner = "PHD";
newReso = "PHD";
newEffi = "PHD";
usedEner= "";
usedReso= "";
usedEffi= "";
mapEnerKD = new HashMap<>();
mapResoKD = new HashMap<>();
mapEffiKD = new HashMap<>();
usedEnerPara = new ParameterInfo();
usedResoPara = new ParameterInfo();
usedEffiPara = new ParameterInfo();
mapEnerPara = new HashMap<>();
mapResoPara = new HashMap<>();
mapEffiPara = new HashMap<>();
}
}

View File

@ -44,8 +44,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
@Override
public Result loadSelfStationByFile(String sampleFileName, String detFileName, HttpServletRequest request) {
Result result = new Result();
//返回结果map
Map<String, Object> map = new HashMap<>();
Map<String, Map<String, Object>> resultMap = new HashMap<>();
//获取用户名
String userName = JwtUtil.getUserNameByToken(request);
//解析文件
@ -62,28 +61,45 @@ public class SelfStationServiceImpl implements ISelfStationService {
if (StringUtils.isNotBlank(sampleFileName)) {
//拼接sample文件路径
String sampleFilePath = path + StringPool.SLASH + sampleFileName;
//返回结果map
Map<String, Object> map = new HashMap<>();
//获取sample分析后的对象
EnergySpectrumStruct struct = selfStationUtil.getSourceData(sampleFilePath, "sample", selfStationData);
if (Objects.nonNull(struct)) {
selfStationData.setSampleStruct(struct);
selfStationData.setSampleTmpPath(sampleFilePath);
selfStationUtil.loadFile(selfStationData, null, null, map);
selfStationUtil.loadFile(selfStationData, null, null, "sample", map);
resultMap.put("sample", map);
}
}
//判断det文件名是否为空
if (StringUtils.isNotBlank(detFileName)) {
//拼接det文件路径
String detFilePath = path + StringPool.SLASH + detFileName;
//返回结果map
Map<String, Object> map = new HashMap<>();
//获取sample分析后的对象
EnergySpectrumStruct struct = selfStationUtil.getSourceData(detFilePath, "det", selfStationData);
if (Objects.nonNull(struct)) {
selfStationData.setDetStruct(struct);
selfStationData.setDetTmpPath(detFilePath);
selfStationUtil.loadFile(selfStationData, null, null, "det", map);
resultMap.put("det", map);
}
}
} else {
selfStationUtil.loadFile(selfStationData, null, null, map);
if (StringUtils.isNotBlank(sampleFileName)) {
//返回结果map
Map<String, Object> map = new HashMap<>();
selfStationUtil.loadFile(selfStationData, null, null, "sample", map);
resultMap.put("sample", map);
}
if (StringUtils.isNotBlank(detFileName)) {
//返回结果map
Map<String, Object> map = new HashMap<>();
selfStationUtil.loadFile(selfStationData, null, null, "det", map);
resultMap.put("det", map);
}
}
//将自建台站的数据封装到缓存对象中
selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData);
@ -91,7 +107,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
selfStationCache.setSelfCache(selfCache);
//将返回内容存入返回对象中
result.setSuccess(true);
result.setResult(map);
result.setResult(resultMap);
return result;
}
@ -131,34 +147,28 @@ public class SelfStationServiceImpl implements ISelfStationService {
result.error500("Load basic file information first!");
return result;
}
selfStationUtil.statisticsROIList(startChannel, endChannel, ROINum,selfStationData);
if (1 == ROINum) {
if ( CollectionUtils.isNotEmpty(selfStationData.getROIOneList()) && Objects.nonNull(selfStationData.getROIOneBetaStart())
&& Objects.nonNull(selfStationData.getROIOneBetaStop()) ) {
map.put("ROIOneList", selfStationData.getROIOneList());
map.put("ROIOneStart", selfStationData.getROIOneBetaStart());
map.put("ROIOneStop", selfStationData.getROIOneBetaStop());
}
} else if (2 == ROINum) {
if ( CollectionUtils.isNotEmpty(selfStationData.getROITwoList()) && Objects.nonNull(selfStationData.getROITwoBetaStart())
&& Objects.nonNull(selfStationData.getROITwoBetaStop()) ) {
map.put("ROITwoList", selfStationData.getROITwoList());
map.put("ROITwoStart", selfStationData.getROITwoBetaStart());
map.put("ROITwoStop", selfStationData.getROITwoBetaStop());
}
} else if (3 == ROINum) {
if ( CollectionUtils.isNotEmpty(selfStationData.getROIThreeList()) && Objects.nonNull(selfStationData.getROIThreeBetaStart())
&& Objects.nonNull(selfStationData.getROIThreeBetaStop()) ) {
map.put("ROIThreeList", selfStationData.getROIThreeList());
map.put("ROIThreeStart", selfStationData.getROIThreeBetaStart());
map.put("ROIThreeStop", selfStationData.getROIThreeBetaStop());
}
} else if (4 == ROINum) {
if ( CollectionUtils.isNotEmpty(selfStationData.getROIFourList()) && Objects.nonNull(selfStationData.getROIFourBetaStart())
&& Objects.nonNull(selfStationData.getROIFourBetaStop()) ) {
map.put("ROIFourList", selfStationData.getROIFourList());
map.put("ROIFourStart", selfStationData.getROIFourBetaStart());
map.put("ROIFourStop", selfStationData.getROIFourBetaStop());
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
Map<String, Object> resultMap = selfStationUtil.statisticsROIList(startChannel, endChannel, struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(resultMap) ) {
Integer startChannelValue = (Integer) resultMap.get("startChannel");
Integer endChannelValue = (Integer) resultMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) resultMap.get("dataList");
if (1 == ROINum) {
map.put("ROIOneList", seriseDataList);
map.put("ROIOneStart", startChannelValue);
map.put("ROIOneStop", endChannelValue);
} else if (2 == ROINum) {
map.put("ROITwoList", seriseDataList);
map.put("ROITwoStart", startChannelValue);
map.put("ROITwoStop", endChannelValue);
} else if (3 == ROINum) {
map.put("ROIThreeList", seriseDataList);
map.put("ROIThreeStart", startChannelValue);
map.put("ROIThreeStop", endChannelValue);
} else if (4 == ROINum) {
map.put("ROIFourList", seriseDataList);
map.put("ROIFourStart", startChannelValue);
map.put("ROIFourStop", endChannelValue);
}
}
result.setSuccess(true);
@ -180,17 +190,17 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isBlank(currentText)) {
currentText = selfStationData.getUsedEner();
currentText = selfStationData.getSampleVueData().getUsedEner();
}
List<String> dataSourceList = selfStationData.getMapEnerKD().keySet().stream().collect(Collectors.toList());
List<String> dataSourceList = selfStationData.getSampleVueData().getMapEnerKD().keySet().stream().collect(Collectors.toList());
map.put("list_dataSource", dataSourceList);
if (StringUtils.isNotBlank(currentText)) {
map.put("currentText", currentText);
List<Double> m_vCurCentroid = selfStationData.getMapEnerKD().get(currentText).getCentroid_channel();
List<Double> m_vCurEnergy = selfStationData.getMapEnerKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getMapEnerKD().get(currentText).getUncertainty();
List<Double> m_vCurCentroid = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getCentroid_channel();
List<Double> m_vCurEnergy = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getUncertainty();
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = selfStationData.getMapEnerPara().get(currentText);
ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapEnerPara().get(currentText);
if (Objects.isNull(m_curParam)) {
m_curParam = new ParameterInfo();
}
@ -297,7 +307,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (!curCalName.contains("Input")) {
List<String> list_cal = selfStationData.getMapEnerKD().keySet().stream().collect(Collectors.toList());
List<String> list_cal = selfStationData.getSampleVueData().getMapEnerKD().keySet().stream().collect(Collectors.toList());
curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1);
list_cal.add(curCalName);
result.setSuccess(true);
@ -308,8 +318,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
gEnergyBlock.setG_energy(m_vCurEnergy);
gEnergyBlock.setUncertainty(m_vCurUncert);
gEnergyBlock.setRecord_count(m_vCurCentroid.size());
selfStationData.getMapEnerKD().put(curCalName, gEnergyBlock);
selfStationData.getMapEnerPara().put(curCalName, m_curParam);
selfStationData.getSampleVueData().getMapEnerKD().put(curCalName, gEnergyBlock);
selfStationData.getSampleVueData().getMapEnerPara().put(curCalName, m_curParam);
return result;
}
@ -393,7 +403,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = new ParameterInfo();
if (StringUtils.isNotBlank(currentText)) {
m_curParam = selfStationData.getMapEnerPara().get(currentText);
m_curParam = selfStationData.getSampleVueData().getMapEnerPara().get(currentText);
}
map.put("param", m_curParam);
int num = m_vCurEnergy.size();
@ -449,7 +459,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isNotBlank(currentName)) {
selfStationData.setNewEner(currentName);
selfStationData.getSampleVueData().setNewEner(currentName);
}
selfCache.put(fileName, selfStationData);
selfStationCache.setSelfCache(selfCache);
@ -471,17 +481,17 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isBlank(currentText)) {
currentText = selfStationData.getUsedReso();
currentText = selfStationData.getSampleVueData().getUsedReso();
}
List<String> dataSourceList = selfStationData.getMapResoKD().keySet().stream().collect(Collectors.toList());
List<String> dataSourceList = selfStationData.getSampleVueData().getMapResoKD().keySet().stream().collect(Collectors.toList());
map.put("list_dataSource", dataSourceList);
if (StringUtils.isNotBlank(currentText)) {
map.put("currentText", currentText);
List<Double> m_vCurReso = selfStationData.getMapResoKD().get(currentText).getFWHM();
List<Double> m_vCurEnergy = selfStationData.getMapResoKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getMapResoKD().get(currentText).getUncertainty();
List<Double> m_vCurReso = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getFWHM();
List<Double> m_vCurEnergy = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getUncertainty();
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = selfStationData.getMapResoPara().get(currentText);
ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapResoPara().get(currentText);
if (Objects.isNull(m_curParam)) {
m_curParam = new ParameterInfo();
}
@ -577,7 +587,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (!curCalName.contains("Input")) {
List<String> list_cal = selfStationData.getMapResoKD().keySet().stream().collect(Collectors.toList());
List<String> list_cal = selfStationData.getSampleVueData().getMapResoKD().keySet().stream().collect(Collectors.toList());
curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1);
list_cal.add(curCalName);
result.setSuccess(true);
@ -588,8 +598,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
gResolutionBlock.setG_energy(m_vCurEnergy);
gResolutionBlock.setUncertainty(m_vCurUncert);
gResolutionBlock.setRecord_count(m_vCurEnergy.size());
selfStationData.getMapResoKD().put(curCalName, gResolutionBlock);
selfStationData.getMapResoPara().put(curCalName, m_curParam);
selfStationData.getSampleVueData().getMapResoKD().put(curCalName, gResolutionBlock);
selfStationData.getSampleVueData().getMapResoPara().put(curCalName, m_curParam);
return result;
}
@ -673,7 +683,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = new ParameterInfo();
if (StringUtils.isNotBlank(currentText)) {
m_curParam = selfStationData.getMapResoPara().get(currentText);
m_curParam = selfStationData.getSampleVueData().getMapResoPara().get(currentText);
}
map.put("param", m_curParam);
int num = m_vCurEnergy.size();
@ -729,7 +739,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isNotBlank(currentName)) {
selfStationData.setNewReso(currentName);
selfStationData.getSampleVueData().setNewReso(currentName);
}
selfCache.put(fileName, selfStationData);
selfStationCache.setSelfCache(selfCache);
@ -759,17 +769,17 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isBlank(currentText)) {
currentText = selfStationData.getUsedEffi();
currentText = selfStationData.getSampleVueData().getUsedEffi();
}
List<String> dataSourceList = selfStationData.getMapEffiKD().keySet().stream().collect(Collectors.toList());
List<String> dataSourceList = selfStationData.getSampleVueData().getMapEffiKD().keySet().stream().collect(Collectors.toList());
map.put("list_dataSource", dataSourceList);
if (StringUtils.isNotBlank(currentText)) {
map.put("currentText", currentText);
List<Double> m_vCurEffi = selfStationData.getMapEffiKD().get(currentText).getEfficiency();
List<Double> m_vCurEnergy = selfStationData.getMapEffiKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getMapEffiKD().get(currentText).getUncertainty();
List<Double> m_vCurEffi = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getEfficiency();
List<Double> m_vCurEnergy = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getG_energy();
List<Double> m_vCurUncert = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getUncertainty();
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = selfStationData.getMapEffiPara().get(currentText);
ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapEffiPara().get(currentText);
if (Objects.isNull(m_curParam)) {
m_curParam = new ParameterInfo();
}
@ -865,7 +875,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (!curCalName.contains("Input")) {
List<String> list_cal = selfStationData.getMapEffiKD().keySet().stream().collect(Collectors.toList());
List<String> list_cal = selfStationData.getSampleVueData().getMapEffiKD().keySet().stream().collect(Collectors.toList());
curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1);
list_cal.add(curCalName);
result.setSuccess(true);
@ -876,8 +886,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
gEfficiencyBlock.setG_energy(m_vCurEnergy);
gEfficiencyBlock.setUncertainty(m_vCurUncert);
gEfficiencyBlock.setRecord_count(m_vCurEnergy.size());
selfStationData.getMapEffiKD().put(curCalName, gEfficiencyBlock);
selfStationData.getMapEffiPara().put(curCalName, m_curParam);
selfStationData.getSampleVueData().getMapEffiKD().put(curCalName, gEfficiencyBlock);
selfStationData.getSampleVueData().getMapEffiPara().put(curCalName, m_curParam);
return result;
}
@ -969,7 +979,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
map.put("uncert", m_vCurUncert);
ParameterInfo m_curParam = new ParameterInfo();
if (StringUtils.isNotBlank(currentText)) {
m_curParam = selfStationData.getMapEffiPara().get(currentText);
m_curParam = selfStationData.getSampleVueData().getMapEffiPara().get(currentText);
}
if (m_curParam.getP().size() > 0) {
m_curParam.getP().set(0, m_nFunId);
@ -1029,7 +1039,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
if (StringUtils.isNotBlank(currentName)) {
selfStationData.setNewEffi(currentName);
selfStationData.getSampleVueData().setNewEffi(currentName);
}
selfCache.put(fileName, selfStationData);
selfStationCache.setSelfCache(selfCache);

View File

@ -4057,14 +4057,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
String logFilePath = parameterProperties.getLogFilePath() + File.separator + DateUtils.formatDate(new Date(), "yyyy-MM-dd") + File.separator + betaDataFile.getSampleFileName().replace("PHD", "log");
File logFile = new File(logFilePath);
try {
FileInputStream in = new FileInputStream(logFile);
ftpUtil.saveFile(logPathName, logFileName, in);
if (logFile.exists()) {
FileInputStream in = new FileInputStream(logFile);
ftpUtil.saveFile(logPathName, logFileName, in);
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
if (Objects.nonNull(logFile)) {
logFile.delete();
}
}
}
{

View File

@ -198,4 +198,22 @@ public class WebStatisticsController {
HttpServletResponse response){
reviewedService.rrrExport(stationIds, startTime, endTime,response);
}
@GetMapping("findNuclideList")
@ApiOperation(value = "查询核素列表数据", notes = "查询核素列表数据")
public Result findNuclideList(String systemType) {
return gardsSampleDataWebService.findNuclideList(systemType);
}
@GetMapping("findNuclideStatistics")
@ApiOperation(value = "查询核素统计结果", notes = "查询核素统计结果")
public Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return gardsSampleDataWebService.findNuclideStatistics(stationId, systemType, dbName, nuclideNames, startDate, endDate);
}
}

View File

@ -8,6 +8,7 @@ import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import java.util.List;
import java.util.Map;
@Mapper
public interface GardsSampleDataWebMapper extends BaseMapper<GardsSampleDataWeb> {
@ -26,4 +27,6 @@ public interface GardsSampleDataWebMapper extends BaseMapper<GardsSampleDataWeb>
Integer getSampleId(@Param(value = "filePathName") String filePathName);
List<Map<String, Object>> findNuclideStatistics(@Param(value = "stationId") String stationId, @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime, @Param(value = "nuclideSql") String nuclideSql);
}

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
@Mapper
public interface SysDefaultNuclideMapper extends BaseMapper<SysDefaultNuclide> {
}

View File

@ -174,4 +174,48 @@
SELECT SAMPLE_ID FROM ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME = #{filePathName}
</select>
<select id="findNuclideStatistics" resultType="java.util.Map">
SELECT
AA.STATION_ID,
AA.SAMPLE_ID,
AA.SAMPLE_REF_ID,
AA.SPECTRAL_QUALIFIE,
AA.COLLECT_START,
AA.COLLECT_STOP,
AA.QUANTITY,
AA.XE_VOLUME,
AA.ACQUISITION_START,
AA.ACQUISITION_STOP,
AA.ACQUISITION_LIVE_SEC,
AA.SITE_DET_CODE,
${nuclideSql}
FROM
(
SELECT
A.STATION_ID,
A.SAMPLE_ID,
B.SAMPLE_REF_ID,
A.SPECTRAL_QUALIFIE,
A.COLLECT_START,
A.COLLECT_STOP,
A.QUANTITY,
B.XE_VOLUME,
A.ACQUISITION_START,
A.ACQUISITION_STOP,
A.ACQUISITION_LIVE_SEC,
A.SITE_DET_CODE
FROM
ORIGINAL.GARDS_SAMPLE_DATA A,
ORIGINAL.GARDS_SAMPLE_AUX B
WHERE
A.STATION_ID = #{stationId}
AND A.SAMPLE_ID = B.SAMPLE_ID
AND A.DATA_TYPE = 'S'
AND A.SPECTRAL_QUALIFIE = 'FULL'
AND A.COLLECT_START BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
) AA
ORDER BY
AA.COLLECT_START
</select>
</mapper>

View File

@ -51,4 +51,9 @@ public interface IGardsSampleDataWebService extends IService<GardsSampleDataWeb>
List<Integer> sampleIds);
List<GardsSampleDataWeb> queryByModDate(Date startTime, Date endTime);
Result findNuclideList(String systemType);
Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames, Date startDate, Date endDate);
}

View File

@ -23,6 +23,8 @@ import org.jeecg.common.util.*;
import org.jeecg.modules.base.entity.original.GardsSampleAux;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.original.GardsSampleDescription;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
import org.jeecg.modules.base.enums.SystemType;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
@ -52,26 +54,10 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
@Autowired
private GardsSampleAuxMapper gardsSampleAuxMapper;
@Autowired
private GardsCalibrationPairsOrigMapper gardsCalibrationPairsOrigMapper;
private SysDefaultNuclideMapper defaultNuclideMapper;
@Autowired
private GardsSampleDescriptionMapper gardsSampleDescriptionMapper;
@Autowired
private GardsBgEfficiencyPairsMapper gardsBgEfficiencyPairsMapper;
@Autowired
private GardsRoiLimitsMapper gardsRoiLimitsMapper;
@Autowired
private GardsSampleRatiosMapper gardsSampleRatiosMapper;
@Autowired
private GardsSpectrumMapper gardsSpectrumMapper;
@Autowired
private GardsHistogramMapper gardsHistogramMapper;
@Autowired
private GardsSampleCertMapper gardsSampleCertMapper;
@Autowired
private GardsSampleCertLineMapper gardsSampleCertLineMapper;
@Autowired
private ReadLineUtil readLineUtil;
@Autowired
private FTPUtil ftpUtil;
@Autowired
private SpectrumPathProperties spectrumPathProperties;
@ -866,4 +852,268 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
queryWrapper.orderByAsc(GardsSampleDataWeb::getSiteDetCode);
return list(queryWrapper);
}
@Override
@DS("master")
public Result findNuclideList(String systemType) {
Result result = new Result();
LambdaQueryWrapper<SysDefaultNuclide> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysDefaultNuclide::getUseType, 4);
if (systemType.equals("beta")) {
queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.BETA.getType());
} else if (systemType.equals("gamma")) {
queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.GAMMA.getType());
} else if (systemType.equals("Particulate")) {
queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.PARTICULATE.getType());
}
List<SysDefaultNuclide> defaultNuclides = defaultNuclideMapper.selectList(queryWrapper);
result.setSuccess(true);
result.setResult(defaultNuclides);
return result;
}
@Override
public Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames, Date startDate, Date endDate) {
Result result = new Result();
Map<String, Object> resultMap = new HashMap<>();
//判断开始时间是否为空
if (Objects.isNull(startDate)){
result.error500("The start time cannot be empty");
return result;
}
String startTime = DateUtils.formatDate(startDate, "yyyy-MM-dd") + " 00:00:00";
//判断结束时间是否为空
if (Objects.isNull(endDate)) {
result.error500("The end time cannot be empty");
return result;
}
String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59";
//判断查询的核素内容是否为空
List<String> nuclideNameList = new LinkedList<>();
if (nuclideNames != null && nuclideNames.length > 0) {
nuclideNameList = Arrays.asList(nuclideNames);
}
//判断要查询的数据库类型
if (dbName.equals("auto")) {
dbName = "RNAUTO";
} else if (dbName.equals("man")) {
dbName = "RNMAN";
}
//判断系统类型查询对应匹配的核素信息
String nuclideSql = "";
if (systemType.equals("beta")) {
nuclideSql = betaNuclideSql(dbName, nuclideNameList);
for (int i=0; i< nuclideNameList.size(); i++) {
String nuclideName = nuclideNameList.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
List<Double> concList = new LinkedList<>();
List<Double> mdcList = new LinkedList<>();
resultMap.put(nuclideName+"Conc", concList);
resultMap.put(nuclideName+"MDC", mdcList);
}
}
} else if (systemType.equals("gamma")) {
nuclideSql = gammaNuclideSql(dbName, nuclideNameList);
for (int i=0; i< nuclideNameList.size(); i++) {
String nuclideName = nuclideNameList.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
List<Double> concList = new LinkedList<>();
List<Double> mdcList = new LinkedList<>();
resultMap.put(nuclideName+"Conc", concList);
resultMap.put(nuclideName+"MDC", mdcList);
}
}
} else if (systemType.equals("Particulate")) {
nuclideSql = particulateSql(dbName, nuclideNameList);
for (int i=0; i< nuclideNameList.size(); i++) {
String nuclideName = nuclideNameList.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
List<Double> concList = new LinkedList<>();
resultMap.put(nuclideName+"Conc", concList);
}
}
}
//拼接sql查询结果
List<Map<String, Object>> nuclideStatisticsMap = this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql);
//处理查询结果
handleNuclideData(nuclideStatisticsMap, systemType, nuclideNameList, resultMap);
result.setSuccess(true);
result.setResult(resultMap);
return result;
}
private String betaNuclideSql(String dbName, List<String> nuclideNames) {
String sql = "";
//存储每个核素对应的sql
List<String> nuclideSqls = new LinkedList<>();
//遍历核素名称拼接sql语句
for (int i=0; i<nuclideNames.size(); i++) {
//读取核素名称
String nuclideName = nuclideNames.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
String nuclideSql = "(SELECT DISTINCT\n" +
"D.CONC\n" +
"FROM\n" +
""+dbName+".GARDS_XE_RESULTS D\n" +
"WHERE\n" +
"D.NUCLIDE_NAME = '"+nuclideName+"'\n" +
"AND D.SAMPLE_ID = AA.SAMPLE_ID\n" +
"AND D.NID_FLAG = 1\n" +
") AS "+nuclideName+",\n" +
"(SELECT DISTINCT\n" +
"D.MDC\n" +
"FROM\n" +
""+dbName+".GARDS_XE_RESULTS D\n" +
"WHERE\n" +
"D.NUCLIDE_NAME = '"+nuclideName+"'\n" +
"AND D.SAMPLE_ID = AA.SAMPLE_ID\n" +
") AS "+nuclideName+"MDC";
nuclideSqls.add(nuclideSql);
}
}
if (CollectionUtils.isNotEmpty(nuclideSqls)) {
//向数组的各sql后填充,合成一个sql
sql = StringUtils.join(nuclideSqls, StringPool.COMMA);
}
return sql;
}
private String gammaNuclideSql(String dbName, List<String> nuclideNames) {
String sql = "";
//存储每个核素对应的sql
List<String> nuclideSqls = new LinkedList<>();
//遍历核素名称
for (int i=0; i<nuclideNames.size(); i++) {
String nuclideName = nuclideNames.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
String nuclideSql = "(SELECT DISTINCT\n" +
"D.CONCENTRATION\n" +
"FROM\n" +
""+dbName+".GARDS_NUCL_IDED D\n" +
"WHERE\n" +
"D.NUCLIDENAME = '"+nuclideName+"'\n" +
"AND D.SAMPLE_ID = AA.SAMPLE_ID\n" +
") AS "+nuclideName+",\n" +
"(\n" +
"SELECT DISTINCT\n" +
"D.MDC\n" +
"FROM\n" +
""+dbName+".GARDS_NUCL_IDED D\n" +
"WHERE\n" +
"D.NUCLIDENAME = '"+nuclideName+"'\n" +
"AND D.SAMPLE_ID = AA.SAMPLE_ID\n" +
") AS "+nuclideName+"MDC";
nuclideSqls.add(nuclideSql);
}
}
if (CollectionUtils.isNotEmpty(nuclideSqls)) {
//向数组的各sql后填充,合成一个sql
sql = StringUtils.join(nuclideSqls, StringPool.COMMA);
}
return sql;
}
private String particulateSql(String dbName, List<String> nuclideNames) {
String sql = "";
//存储核素sql
List<String> nuclideSqls = new LinkedList<>();
//遍历核素信息
for (int i=0; i<nuclideNames.size(); i++) {
String nuclideName = nuclideNames.get(i);
if (StringUtils.isNotBlank(nuclideName)) {
String nuclideSql = "(SELECT DISTINCT\n" +
"D.CONCENTRATION\n" +
"FROM\n" +
""+dbName+".GARDS_NUCL_IDED D\n" +
"WHERE\n" +
"D.NUCLIDENAME = '"+nuclideName+"'\n" +
"AND D.SAMPLE_ID = AA.SAMPLE_ID\n" +
") AS "+nuclideName;
nuclideSqls.add(nuclideSql);
}
}
if (CollectionUtils.isNotEmpty(nuclideSqls)) {
sql = StringUtils.join(nuclideSqls, StringPool.COMMA);
}
return sql;
}
private void handleNuclideData(List<Map<String, Object>> nuclideStatisticsMap, String systemType, List<String> nuclideNameList, Map<String, Object> resultMap) {
//存储横坐标采集开始时间
List<String> collectStartList = new LinkedList<>();
//存储横坐标对应体积
List<Double> quantityList = new LinkedList<>();
//存储横坐标对应acq活时间
List<Double> acqLiveSecList = new LinkedList<>();
//遍历查询结果数组
for (Map<String, Object> nuclideStatistics: nuclideStatisticsMap) {
//获取采集开始时间
Object collectStart = nuclideStatistics.get("COLLECT_START");
//如果采集开始时间不为空 则存储
if (Objects.nonNull(collectStart)) {
collectStartList.add(collectStart.toString());
} else {//否则跳过本次循环
continue;
}
//获取体积
Object quantity = nuclideStatistics.get("QUANTITY");
//判断体积数值是否有 如果有 正常存储
if (Objects.nonNull(quantity)) {
quantityList.add(Double.valueOf(quantity.toString()));
} else {//如果没有存储0
quantityList.add(0.0);
}
//获取acq活时间
Object acquisitionLiveSec = nuclideStatistics.get("ACQUISITION_LIVE_SEC");
//判断活时间是否为空 如果不为空 正常存储
if (Objects.nonNull(acquisitionLiveSec)) {
acqLiveSecList.add(Double.valueOf(acquisitionLiveSec.toString()));
} else {//如果为空存储0
acqLiveSecList.add(0.0);
}
//判断系统类型决定读取核素的信息
if (systemType.equals("beta") || systemType.equals("gamma")) {
for (String nuclideName: nuclideNameList) {
List<Double> concList = (List<Double>) resultMap.get(nuclideName + "Conc");
List<Double> mdcList = (List<Double>) resultMap.get(nuclideName + "MDC");
//将核素名称转为全部大写
String columnName = StringUtils.upperCase(nuclideName);
//读取查询出的浓度
Object conc = nuclideStatistics.get(columnName);
//判断如果浓度不为空 正常存储
if (Objects.nonNull(conc)) {
concList.add(Double.valueOf(conc.toString()));
} else {//如果为空 存储0
concList.add(0.0);
}
//读取查询出的mdc结果
Object mdc = nuclideStatistics.get(columnName + "MDC");
//判断如果mdc结果不为空 正常存储
if (Objects.nonNull(mdc)) {
mdcList.add(Double.valueOf(mdc.toString()));
} else {
mdcList.add(0.0);
}
}
} else if (systemType.equals("Particulate")) {
for (String nuclideName: nuclideNameList) {
List<Double> concList = (List<Double>) resultMap.get(nuclideName + "Conc");
//将核素名称转为全部大写
String columnName = StringUtils.upperCase(nuclideName);
//读取查询出的浓度
Object conc = nuclideStatistics.get(columnName);
//判断如果浓度不为空 正常存储
if (Objects.nonNull(conc)) {
concList.add(Double.valueOf(conc.toString()));
} else {//如果为空 存储0
concList.add(0.0);
}
}
}
}
resultMap.put("CollectStart", collectStartList);
resultMap.put("Quantity", quantityList);
resultMap.put("AcqLiveSec", acqLiveSecList);
}
}