fix:修复新beta的分析接口,增加对roiParams的处理
This commit is contained in:
parent
9a7cdbe1ed
commit
cd3d19db70
|
@ -0,0 +1,8 @@
|
|||
package org.jeecg.common.constant;
|
||||
|
||||
public class SelfStationConstant {
|
||||
public static final String ROI1 = "ROI1";
|
||||
public static final String ROI2 = "ROI2";
|
||||
public static final String ROI3 = "ROI3";
|
||||
public static final String ROI4 = "ROI4";
|
||||
}
|
|
@ -1577,4 +1577,64 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ROI是否更新
|
||||
* @param sampleVueData
|
||||
* @param ROINum
|
||||
* @return
|
||||
*/
|
||||
public boolean checkROIRenew(SelfStationVueData sampleVueData, String ROINum) {
|
||||
boolean flag = false;
|
||||
if (StrUtil.isNotBlank(ROINum)) {
|
||||
switch (ROINum) {
|
||||
case "ROI1":
|
||||
if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "ROI2":
|
||||
if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "ROI3":
|
||||
if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "ROI4":
|
||||
if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) {
|
||||
return true;
|
||||
} else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) {
|
||||
return true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,8 +189,9 @@ public class SelfStationController {
|
|||
|
||||
@PostMapping("Reprocessing")
|
||||
@ApiOperation(value = "analyze菜单下Reprocessing页面数据", notes = "analyze菜单下Reprocessing页面数据")
|
||||
public Result Reprocessing(String fileName, String processKey, HttpServletRequest request) {
|
||||
return selfStationService.Reprocessing(fileName, processKey, request);
|
||||
public Result Reprocessing(@RequestParam String fileName, @RequestParam String processKey,
|
||||
@RequestParam String roiParams, HttpServletRequest request) {
|
||||
return selfStationService.Reprocessing(fileName, processKey, roiParams, request);
|
||||
}
|
||||
|
||||
@GetMapping("InteractiveTool")
|
||||
|
|
|
@ -30,6 +30,14 @@ public class SelfStationVueData implements Serializable {
|
|||
* ROI-1范围矩形框终止道值
|
||||
*/
|
||||
private Integer ROIOneBetaStop;
|
||||
/**
|
||||
* ROI-1范围矩形框起始道值(分析后
|
||||
*/
|
||||
private Integer usedROIOneBetaStart;
|
||||
/**
|
||||
* ROI-1范围矩形框终止道值(分析后
|
||||
*/
|
||||
private Integer usedROIOneBetaStop;
|
||||
/**
|
||||
* ROI-1 GammaPHD数据
|
||||
*/
|
||||
|
@ -55,6 +63,14 @@ public class SelfStationVueData implements Serializable {
|
|||
* ROI-2范围矩形框终止道值
|
||||
*/
|
||||
private Integer ROITwoBetaStop;
|
||||
/**
|
||||
* ROI-2范围矩形框起始道值(分析后
|
||||
*/
|
||||
private Integer usedROITwoBetaStart;
|
||||
/**
|
||||
* ROI-2范围矩形框终止道值(分析后
|
||||
*/
|
||||
private Integer usedROITwoBetaStop;
|
||||
/**
|
||||
* ROI-2 GammaPHD数据
|
||||
*/
|
||||
|
@ -74,6 +90,10 @@ public class SelfStationVueData implements Serializable {
|
|||
private Integer ROIThreeBetaStart;
|
||||
//ROI-3范围矩形框终止道值
|
||||
private Integer ROIThreeBetaStop;
|
||||
//ROI-3范围矩形框起始道值(分析后
|
||||
private Integer usedROIThreeBetaStart;
|
||||
//ROI-3范围矩形框终止道值(分析后
|
||||
private Integer usedROIThreeBetaStop;
|
||||
/**
|
||||
* ROI-3 GammaPHD数据
|
||||
*/
|
||||
|
@ -93,6 +113,10 @@ public class SelfStationVueData implements Serializable {
|
|||
private Integer ROIFourBetaStart;
|
||||
//ROI-4范围矩形框终止道值
|
||||
private Integer ROIFourBetaStop;
|
||||
//ROI-4范围矩形框起始道值(分析后
|
||||
private Integer usedROIFourBetaStart;
|
||||
//ROI-4范围矩形框终止道值(分析后
|
||||
private Integer usedROIFourBetaStop;
|
||||
/**
|
||||
* ROI-4 GammaPHD数据
|
||||
*/
|
||||
|
@ -163,6 +187,15 @@ public class SelfStationVueData implements Serializable {
|
|||
ROITwoPHDFile = new PHDFile();
|
||||
ROIThreePHDFile = new PHDFile();
|
||||
ROIFourPHDFile = new PHDFile();
|
||||
|
||||
usedROIOneBetaStart = 0;
|
||||
usedROIOneBetaStop = 0;
|
||||
usedROITwoBetaStart = 0;
|
||||
usedROITwoBetaStop = 0;
|
||||
usedROIThreeBetaStart = 0;
|
||||
usedROIThreeBetaStop = 0;
|
||||
usedROIFourBetaStart = 0;
|
||||
usedROIFourBetaStop = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ public interface ISelfStationService {
|
|||
|
||||
void deleteSelfStationCache(String sampleFileName, HttpServletRequest request);
|
||||
|
||||
Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request);
|
||||
|
||||
Result updateROI(List<ROIParam> roiParams, String sampleFileName, String dataType, HttpServletRequest request);
|
||||
|
||||
Result energyCalibration(String fileName, String currentText, Double width, HttpServletRequest request);
|
||||
|
@ -63,7 +61,7 @@ public interface ISelfStationService {
|
|||
|
||||
Result viewBetaDetectorCalibration(Integer sampleId, String sampleFileName, String qcFileName, boolean fittingBtn, HttpServletRequest request);
|
||||
|
||||
Result Reprocessing(String fileName, String processKey, HttpServletRequest request);
|
||||
Result Reprocessing(String fileName, String processKey, String roiParams, HttpServletRequest request);
|
||||
|
||||
Result InteractiveTool(Integer sampleId, String fileName, int gammaROINum, HttpServletRequest request);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
|
@ -14,10 +15,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.google.common.cache.Cache;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import me.zhyd.oauth.log.Log;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.SelfCache;
|
||||
import org.jeecg.common.constant.SelfStationConstant;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.constant.enums.FileTypeEnum;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
|
@ -666,47 +669,15 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
selfStationCache.deleteSelfCache(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//读取自建台站缓存
|
||||
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
|
||||
//获取缓存的当前谱对应的数据
|
||||
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
||||
if (Objects.isNull(selfStationData)) {
|
||||
result.error500("Load basic file information first!");
|
||||
return result;
|
||||
}
|
||||
public void updateROI(List<ROIParam> roiParams, SelfStationData selfStationData) {
|
||||
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);
|
||||
}
|
||||
LinkedList<Integer> roiBBoundaryStart = Lists.newLinkedList();
|
||||
LinkedList<Integer> roiBBoundaryStop = Lists.newLinkedList();
|
||||
for (ROIParam roiParam : roiParams) {
|
||||
roiBBoundaryStart.add(roiParam.getRoiNum() - 1, roiParam.getStartChannel());
|
||||
roiBBoundaryStop.add(roiParam.getRoiNum() - 1, roiParam.getEndChannel());
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
selfStationUtil.getGammaByROI(struct.system_type, roiBBoundaryStart, roiBBoundaryStop, selfStationData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2135,7 +2106,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result Reprocessing(String fileName, String processKey, HttpServletRequest request) {
|
||||
public Result Reprocessing(String fileName, String processKey, String roiParams, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
|
||||
|
@ -2149,6 +2120,11 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
result.error500("Please select the parse file first!");
|
||||
return result;
|
||||
}
|
||||
List<ROIParam> roiParamList = null;
|
||||
if (StrUtil.isNotBlank(roiParams)) {
|
||||
roiParamList = JSONArray.parseArray(roiParams, ROIParam.class);
|
||||
this.updateROI(roiParamList, selfStationData);
|
||||
}
|
||||
|
||||
// Gamma文件内容转换为PHD实体
|
||||
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||
|
@ -2160,10 +2136,23 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
|
||||
Map<String, Object> roiMap = new HashMap<>();
|
||||
try {
|
||||
roiMap.put("ROI1", this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap));
|
||||
roiMap.put("ROI2", this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap));
|
||||
roiMap.put("ROI3", this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap));
|
||||
roiMap.put("ROI4", this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap));
|
||||
boolean bROI1 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI1);
|
||||
boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2);
|
||||
boolean bROI3 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI3);
|
||||
boolean bROI4 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI4);
|
||||
roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, bROI1));
|
||||
roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2));
|
||||
roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3));
|
||||
roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4));
|
||||
// 用于下次分析判断是否更新
|
||||
sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart());
|
||||
sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop());
|
||||
sampleVueData.setUsedROITwoBetaStart(sampleVueData.getROITwoBetaStart());
|
||||
sampleVueData.setUsedROITwoBetaStop(sampleVueData.getROITwoBetaStop());
|
||||
sampleVueData.setUsedROIThreeBetaStart(sampleVueData.getROIThreeBetaStart());
|
||||
sampleVueData.setUsedROIThreeBetaStop(sampleVueData.getROIThreeBetaStop());
|
||||
sampleVueData.setUsedROIFourBetaStart(sampleVueData.getUsedROIFourBetaStart());
|
||||
sampleVueData.setUsedROIFourBetaStop(sampleVueData.getROIFourBetaStop());
|
||||
|
||||
sampleVueData.setUsedEner(phdOne.getUsedEner());
|
||||
sampleVueData.setUsedEnerKD(phdOne.getUsedEnerKD());
|
||||
|
@ -2182,6 +2171,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
result.setResult(roiMap);
|
||||
selfStationData.setBAnalyed(true);
|
||||
} catch (RuntimeException e) {
|
||||
Log.error("analyse error:", e);
|
||||
result.error500(StrUtil.replace(e.getMessage(), "%s", "ROI"));
|
||||
}
|
||||
return result;
|
||||
|
@ -5358,8 +5348,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
if (!FileUtil.exist(logPath))
|
||||
return Result.error("The log generated by the automatic processor does not exist!");
|
||||
result.put("Beta", FileUtil.readUtf8String(logPath));
|
||||
List<GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
||||
for (GardsAnalysisRoi analysisRoi : analysisRois) {
|
||||
List<org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
||||
for (org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi analysisRoi : analysisRois) {
|
||||
Integer roiNum = analysisRoi.getRoiNum();
|
||||
String roiLogPath = analysisRoi.getLogPath();
|
||||
roiLogPath = rootPath + logPathPrefix + StrUtil.SLASH + roiLogPath;
|
||||
|
@ -5494,13 +5484,14 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
* @throws RuntimeException
|
||||
*/
|
||||
private Map<String, Object> gammaAnalyse(String processKey, PHDFile phd, Map<String, NuclideLines> nuclideLinesMap,
|
||||
Map<String, String> colorMap) throws RuntimeException{
|
||||
Map<String, String> colorMap, boolean bROI) throws RuntimeException{
|
||||
|
||||
phd.setUserId(processKey);
|
||||
// 赋值xml文件存放路径
|
||||
phd.setXmlFilePath(parameterProperties.getFilePath());
|
||||
int flag = gammaFileUtil.AnalyseData(phd);
|
||||
if (flag == 0) {
|
||||
// bROI = false 表示ROI数据没有被修改
|
||||
if (flag == 0 || !bROI) {
|
||||
String warning = "The spectrum needn't Analyed. Maybe:\n" +
|
||||
"1. It has already Analyed.\n" +
|
||||
"2. You didn't change any setting or calibration.";
|
||||
|
|
Loading…
Reference in New Issue
Block a user