fix: self:1.nuclideReview弹窗多个接口;2.解决分析之后 gamma三个calibration弹窗无数据问题
This commit is contained in:
parent
0cd2e0f29c
commit
cf369218da
|
@ -284,6 +284,35 @@ public class SelfStationController {
|
||||||
commentsInfo.getComments(), request);
|
commentsInfo.getComments(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("nuclideReviewGamma")
|
||||||
|
@ApiOperation(value = "gamma主页面选择Nuclide Review信息接口", notes = "gamma主页面选择Nuclide Review信息接口")
|
||||||
|
public Result nuclideReviewGamma(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request) {
|
||||||
|
return selfStationService.nuclideReviewGamma(sampleId, fileName, gammaROINum, channel, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("nuclideReview")
|
||||||
|
@ApiOperation(value = "InteractiveTool页面选择Nuclide Review信息接口", notes = "InteractiveTool页面选择Nuclide Review信息接口")
|
||||||
|
public Result nuclideReview(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request) {
|
||||||
|
return selfStationService.nuclideReview(sampleId, fileName, gammaROINum, channel, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("changeNuclideGamma")
|
||||||
|
@ApiOperation(value = "gamma主页面Nuclide Review页面切换nuclide数据", notes = "gamma主页面Nuclide Review页面切换nuclide数据")
|
||||||
|
public Result changeNuclideGamma(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request) {
|
||||||
|
return selfStationService.changeNuclideGamma(sampleId, fileName, gammaROINum, nuclideName, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("changeNuclide")
|
||||||
|
@ApiOperation(value = "Nuclide Review页面切换nuclide数据", notes = "Nuclide Review页面切换nuclide数据")
|
||||||
|
public Result changeNuclide(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request) {
|
||||||
|
return selfStationService.changeNuclide(sampleId, fileName, gammaROINum, nuclideName, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("searchNuclide")
|
||||||
|
@ApiOperation(value = "Nuclide Review页面查询nuclide数据", notes = "Nuclide Review页面查询nuclide数据")
|
||||||
|
public Result searchNuclide(Integer sampleId, String fileName, int gammaROINum, Double energy, Double tolerance, HttpServletRequest request) {
|
||||||
|
return selfStationService.searchNuclide(sampleId, fileName, gammaROINum, energy, tolerance, request);
|
||||||
|
}
|
||||||
@PostMapping("replotBaseLine")
|
@PostMapping("replotBaseLine")
|
||||||
public Result replotBaseLine(@RequestBody BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
public Result replotBaseLine(@RequestBody BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||||
return selfStationService.replotBaseLine(baseLineCtrls, request);
|
return selfStationService.replotBaseLine(baseLineCtrls, request);
|
||||||
|
|
|
@ -92,6 +92,16 @@ public interface ISelfStationService {
|
||||||
|
|
||||||
Result addGeneralComment(String fileName, int gammaROINum, String comments, HttpServletRequest request);
|
Result addGeneralComment(String fileName, int gammaROINum, String comments, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result nuclideReviewGamma(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result nuclideReview(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result changeNuclideGamma(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result changeNuclide(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result searchNuclide(Integer sampleId, String fileName, int gammaROINum, Double energy, Double tolerance, HttpServletRequest request);
|
||||||
|
|
||||||
Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request);
|
Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request);
|
||||||
|
|
||||||
Result acceptBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request);
|
Result acceptBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request);
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
|
@ -565,9 +566,9 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
if ( CollectionUtils.isNotEmpty(resultMap) ) {
|
if ( CollectionUtils.isNotEmpty(resultMap) ) {
|
||||||
Integer startChannelValue = (Integer) resultMap.get("startChannel");
|
Integer startChannelValue = (Integer) resultMap.get("startChannel");
|
||||||
Integer endChannelValue = (Integer) resultMap.get("endChannel");
|
Integer endChannelValue = (Integer) resultMap.get("endChannel");
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) resultMap.get("dataList");
|
List<SeriseData> seriseDataList = (List<SeriseData>) resultMap.get("dataList");
|
||||||
if (1 == ROINum) {
|
if (1 == ROINum) {
|
||||||
map.put("ROIOneList", seriseDataList);
|
map.put("ROIOneList", seriseDataList);
|
||||||
map.put("ROIOneStart", startChannelValue);
|
map.put("ROIOneStart", startChannelValue);
|
||||||
map.put("ROIOneStop", endChannelValue);
|
map.put("ROIOneStop", endChannelValue);
|
||||||
} else if (2 == ROINum) {
|
} else if (2 == ROINum) {
|
||||||
|
@ -1965,6 +1966,20 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
roiMap.put("ROI2", this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap));
|
roiMap.put("ROI2", this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap));
|
||||||
roiMap.put("ROI3", this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap));
|
roiMap.put("ROI3", this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap));
|
||||||
roiMap.put("ROI4", this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap));
|
roiMap.put("ROI4", this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap));
|
||||||
|
|
||||||
|
sampleVueData.setUsedEner(phdOne.getUsedEner());
|
||||||
|
sampleVueData.setUsedEnerKD(phdOne.getUsedEnerKD());
|
||||||
|
sampleVueData.setUsedEffiKD(phdOne.getUsedEffiKD());
|
||||||
|
sampleVueData.setUsedResoKD(phdOne.getUsedResoKD());
|
||||||
|
sampleVueData.setMapEnerKD(phdOne.getMapEnerKD());
|
||||||
|
sampleVueData.setMapResoKD(phdOne.getMapResoKD());
|
||||||
|
sampleVueData.setMapEffiKD(phdOne.getMapEffiKD());
|
||||||
|
sampleVueData.setUsedEnerPara(phdOne.getUsedEnerPara());
|
||||||
|
sampleVueData.setUsedEffiPara(phdOne.getUsedEffiPara());
|
||||||
|
sampleVueData.setUsedResoPara(phdOne.getUsedResoPara());
|
||||||
|
sampleVueData.setMapEnerPara(phdOne.getMapEnerPara());
|
||||||
|
sampleVueData.setMapResoPara(phdOne.getMapResoPara());
|
||||||
|
sampleVueData.setMapEffiPara(phdOne.getMapEffiPara());
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(roiMap);
|
result.setResult(roiMap);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
@ -2323,7 +2338,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result deletePeak(String fileName, int gammaROINum, int curRow, HttpServletRequest request) {
|
public Result deletePeak(String fileName, int curRow, int gammaROINum, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
//获取用户名称
|
//获取用户名称
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
@ -2789,6 +2804,389 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result nuclideReviewGamma(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request) {
|
||||||
|
Result result = new Result();
|
||||||
|
if (Objects.isNull(channel) || channel <= 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
//获取自建台站缓存信息
|
||||||
|
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, gammaROINum, selfStationCache);
|
||||||
|
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
result.error500("Please select the parse file first!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
double value = gammaFileUtil.GetEnergyByFloatChan(phd, channel.intValue()-1);
|
||||||
|
BigDecimal bigDecimal = BigDecimal.valueOf(value);
|
||||||
|
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
map.put("energy", bigDecimal);
|
||||||
|
//返回的核素列信息
|
||||||
|
List<String> nuclideList = new LinkedList<>();
|
||||||
|
double min = bigDecimal.doubleValue() - 0.5;
|
||||||
|
double max = bigDecimal.doubleValue() + 0.5;
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
|
||||||
|
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
|
||||||
|
//判断缓存的核素信息是否为空
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
//遍历核素信息
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
|
||||||
|
//获取核素的关联信息
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
//获取核素关联的全部能量信息
|
||||||
|
List<Double> venergy = nuclideLines.getVenergy();
|
||||||
|
//遍历能量
|
||||||
|
for (int i=0; i<venergy.size(); i++) {
|
||||||
|
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
|
||||||
|
if (venergy.get(i) > min && venergy.get(i) < max) {
|
||||||
|
nuclideList.add(entry.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (phd.getHeader().getSystem_type().equals("P")) {
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
|
||||||
|
//遍历核素信息
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
|
||||||
|
//获取核素的关联信息
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
//获取核素关联的全部能量信息
|
||||||
|
List<Double> venergy = nuclideLines.getVenergy();
|
||||||
|
//遍历能量
|
||||||
|
for (int i=0; i<venergy.size(); i++) {
|
||||||
|
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
|
||||||
|
if (venergy.get(i) > min && venergy.get(i) < max) {
|
||||||
|
nuclideList.add(entry.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nuclideList = nuclideList.stream().distinct().collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideList)) {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
String name = nuclideList.get(0);
|
||||||
|
InitTable(name, map, phd, colorMap, nuclideMap);
|
||||||
|
} else {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
map.put("chart", new LinkedList<>());
|
||||||
|
map.put("table", new LinkedList<>());
|
||||||
|
map.put("name", "");
|
||||||
|
map.put("lines", "");
|
||||||
|
map.put("halfLife", "");
|
||||||
|
map.put("halfLifeErr", "");
|
||||||
|
}
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result nuclideReview(Integer sampleId, String fileName, int gammaROINum, Double channel, HttpServletRequest request) {
|
||||||
|
Result result = new Result();
|
||||||
|
if (Objects.isNull(channel)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
//获取自建台站缓存信息
|
||||||
|
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, gammaROINum, selfStationCache);
|
||||||
|
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
result.error500("Please select the parse file first!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
double value = gammaFileUtil.GetEnergyByFloatChan(phd, channel.intValue());
|
||||||
|
BigDecimal bigDecimal = BigDecimal.valueOf(value);
|
||||||
|
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
map.put("energy", bigDecimal);
|
||||||
|
//返回的核素列信息
|
||||||
|
List<String> nuclideList = new LinkedList<>();
|
||||||
|
double min = bigDecimal.doubleValue() - 0.5;
|
||||||
|
double max = bigDecimal.doubleValue() + 0.5;
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
|
||||||
|
//判断缓存的核素信息是否为空
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
//遍历核素信息
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
|
||||||
|
//获取核素的关联信息
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
//获取核素关联的全部能量信息
|
||||||
|
List<Double> venergy = nuclideLines.getVenergy();
|
||||||
|
//遍历能量
|
||||||
|
for (int i=0; i<venergy.size(); i++) {
|
||||||
|
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
|
||||||
|
if (venergy.get(i) > min && venergy.get(i) < max) {
|
||||||
|
nuclideList.add(entry.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideList)) {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
String name = nuclideList.get(0);
|
||||||
|
InitTable(name, map, phd, colorMap, nuclideMap);
|
||||||
|
} else {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
map.put("chart", new LinkedList<>());
|
||||||
|
map.put("table", new LinkedList<>());
|
||||||
|
map.put("name", "");
|
||||||
|
map.put("lines", "");
|
||||||
|
map.put("halfLife", "");
|
||||||
|
map.put("halfLifeErr", "");
|
||||||
|
}
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitTable(String name, Map<String, Object> map, PHDFile phd, Map<String, String> colorMap, Map<String, NuclideLines> nuclideMap) {
|
||||||
|
InitNuclideInfo(name, map);
|
||||||
|
long span = phd.getSpec().getG_energy_span();
|
||||||
|
|
||||||
|
//判断缓存的核素信息是否为空
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
//获取当前核素名称的核素集合
|
||||||
|
NuclideLines lines = nuclideMap.get(name);
|
||||||
|
List<GardsNuclLinesLib> nuclideTableList = new LinkedList<>();//spectrumAnalysisMapper.getNuclideTable(name, span);
|
||||||
|
for (int i=0; i<lines.fullNames.size(); i++) {
|
||||||
|
Double energy = lines.venergy.get(i);
|
||||||
|
if (Objects.nonNull(energy)) {
|
||||||
|
if (lines.venergy.get(i) >= 30 && lines.venergy.get(i) <= span) {
|
||||||
|
GardsNuclLinesLib nuclLinesLib = new GardsNuclLinesLib();
|
||||||
|
nuclLinesLib.setFullName(lines.fullNames.get(i));
|
||||||
|
nuclLinesLib.setEnergy(Double.valueOf(String.format("%.3f", lines.venergy.get(i))));
|
||||||
|
nuclLinesLib.setEnergyUncert(Objects.nonNull(lines.vuncertE.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertE.get(i))):0.0);
|
||||||
|
nuclLinesLib.setYield(Objects.nonNull(lines.vyield.get(i))?Double.valueOf(String.format("%.3f", lines.vyield.get(i)*100)):0.0);
|
||||||
|
nuclLinesLib.setYieldUncert(Objects.nonNull(lines.vuncertY.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertY.get(i))):0.0);
|
||||||
|
nuclideTableList.add(nuclLinesLib);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideTableList)) {
|
||||||
|
nuclideTableList = nuclideTableList.stream().sorted(Comparator.comparing(GardsNuclLinesLib::getYield)).collect(Collectors.toList());
|
||||||
|
nuclideTableList.stream().max(Comparator.comparing(GardsNuclLinesLib::getYield)).get().setKeyFlag(1);
|
||||||
|
map.put("table", nuclideTableList);
|
||||||
|
gammaFileUtil.InitChart(nuclideTableList, phd, map, colorMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitNuclideInfo(String name, Map<String, Object> map) {
|
||||||
|
map.put("name", name);
|
||||||
|
Map<String, GardsNuclLib> nuclLibs = (Map<String, GardsNuclLib>) redisUtil.get("nuclLibs");
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclLibs)) {
|
||||||
|
GardsNuclLib nuclideInfo = nuclLibs.get(name);
|
||||||
|
if (Objects.nonNull(nuclideInfo)) {
|
||||||
|
map.put("lines", nuclideInfo.getNumLines());
|
||||||
|
if (Objects.isNull(nuclideInfo.getHalflife())) {
|
||||||
|
map.put("halfLife", "");
|
||||||
|
} else {
|
||||||
|
String units = "D";
|
||||||
|
double halflife = nuclideInfo.getHalflife().doubleValue();
|
||||||
|
if (halflife >= 1000) {
|
||||||
|
halflife = halflife / 365.25;
|
||||||
|
units = "A";
|
||||||
|
} else if (halflife < 0.1 && halflife >= 1.0 / 1440) {
|
||||||
|
halflife = halflife * 1440;
|
||||||
|
units = "M";
|
||||||
|
} else if (halflife <= 1.0 / 1440 && halflife > 0) {
|
||||||
|
halflife = halflife * 86400;
|
||||||
|
units = "S";
|
||||||
|
}
|
||||||
|
halflife = halflife + 0.0001;
|
||||||
|
map.put("halfLife", String.format("%.3f", halflife) + units);
|
||||||
|
}
|
||||||
|
if (Objects.isNull(nuclideInfo.getHalflifeErr())) {
|
||||||
|
map.put("halfLifeErr", "");
|
||||||
|
} else {
|
||||||
|
map.put("halfLifeErr", String.format("%.3f", nuclideInfo.getHalflifeErr().doubleValue()) + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result changeNuclideGamma(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request) {
|
||||||
|
Result result = new Result();
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
//获取自建台站缓存信息
|
||||||
|
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, gammaROINum, selfStationCache);
|
||||||
|
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
result.error500("Please select the parse file first!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideLinesMap = new HashMap<>();
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
|
||||||
|
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
|
||||||
|
if (phd.getHeader().getSystem_type().equals("P")) {
|
||||||
|
NuclideLines newNuclideLines = new NuclideLines();
|
||||||
|
List<String> fullNames = new LinkedList<>();
|
||||||
|
List<Double> vEnergy = new LinkedList<>();
|
||||||
|
List<Double> vEnergyUncert = new LinkedList<>();
|
||||||
|
List<Double> vYield = new LinkedList<>();
|
||||||
|
List<Double> vYieldUncert = new LinkedList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
if (nuclideLines.fullNames.contains(nuclideName)) {
|
||||||
|
nuclideName = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
if (nuclideLines.fullNames.contains(nuclideName)) {
|
||||||
|
nuclideName = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NuclideLines nuclideLines = nuclideMap.get(nuclideName);
|
||||||
|
if (Objects.nonNull(nuclideLines)) {
|
||||||
|
fullNames.addAll(nuclideLines.fullNames);
|
||||||
|
vEnergy.addAll(nuclideLines.venergy);
|
||||||
|
vEnergyUncert.addAll(nuclideLines.vuncertE);
|
||||||
|
vYield.addAll(nuclideLines.vyield);
|
||||||
|
vYieldUncert.addAll(nuclideLines.vuncertY);
|
||||||
|
}
|
||||||
|
NuclideLines nuclideSumLines = nuclCoincidenceSumMap.get(nuclideName);
|
||||||
|
if (Objects.nonNull(nuclideSumLines)) {
|
||||||
|
fullNames.addAll(nuclideSumLines.fullNames);
|
||||||
|
vEnergy.addAll(nuclideSumLines.venergy);
|
||||||
|
vEnergyUncert.addAll(nuclideSumLines.vuncertE);
|
||||||
|
vYield.addAll(nuclideSumLines.vyield);
|
||||||
|
vYieldUncert.addAll(nuclideSumLines.vuncertY);
|
||||||
|
}
|
||||||
|
newNuclideLines.fullNames = fullNames;
|
||||||
|
newNuclideLines.venergy = vEnergy;
|
||||||
|
newNuclideLines.vuncertE = vEnergyUncert;
|
||||||
|
newNuclideLines.vyield = vYield;
|
||||||
|
newNuclideLines.vuncertY = vYieldUncert;
|
||||||
|
nuclideLinesMap.put(nuclideName, newNuclideLines);
|
||||||
|
} else {
|
||||||
|
nuclideLinesMap = nuclideMap;
|
||||||
|
}
|
||||||
|
InitTable(nuclideName, map, phd, colorMap, nuclideLinesMap);
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result changeNuclide(Integer sampleId, String fileName, int gammaROINum, String nuclideName, HttpServletRequest request) {
|
||||||
|
Result result = new Result();
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
//获取自建台站缓存信息
|
||||||
|
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, gammaROINum, selfStationCache);
|
||||||
|
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
result.error500("Please select the parse file first!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
if (nuclideLines.fullNames.contains(nuclideName)) {
|
||||||
|
nuclideName = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
|
||||||
|
if (phd.getHeader().getSystem_type().equals("P") && CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
if (nuclideLines.fullNames.contains(nuclideName)) {
|
||||||
|
nuclideName = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
InitTable(nuclideName, map, phd, colorMap, nuclideMap);
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result searchNuclide(Integer sampleId, String fileName, int gammaROINum, Double energy, Double tolerance, HttpServletRequest request) {
|
||||||
|
Result result = new Result();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
//获取自建台站缓存信息
|
||||||
|
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, gammaROINum, selfStationCache);
|
||||||
|
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
result.error500("Please select the parse file first!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
BigDecimal bigDecimal = BigDecimal.valueOf(energy);
|
||||||
|
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
map.put("energy", bigDecimal);
|
||||||
|
//返回的核素列信息
|
||||||
|
List<String> nuclideList = new LinkedList<>();
|
||||||
|
double min = bigDecimal.doubleValue() - tolerance;
|
||||||
|
double max = bigDecimal.doubleValue() + tolerance;
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
|
||||||
|
//判断缓存的核素信息是否为空
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideMap)) {
|
||||||
|
//遍历核素信息
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
|
||||||
|
//获取核素的关联信息
|
||||||
|
NuclideLines nuclideLines = entry.getValue();
|
||||||
|
//获取核素关联的全部能量信息
|
||||||
|
List<Double> venergy = nuclideLines.getVenergy();
|
||||||
|
//遍历能量
|
||||||
|
for (int i=0; i<venergy.size(); i++) {
|
||||||
|
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
|
||||||
|
if (venergy.get(i) > min && venergy.get(i) < max) {
|
||||||
|
nuclideList.add(entry.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclideList)) {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
String name = nuclideList.get(0);
|
||||||
|
InitTable(name, map, phd, colorMap, nuclideMap);
|
||||||
|
} else {
|
||||||
|
map.put("list", nuclideList);
|
||||||
|
map.put("chart", new LinkedList<>());
|
||||||
|
map.put("table", new LinkedList<>());
|
||||||
|
map.put("name", "");
|
||||||
|
map.put("lines", "");
|
||||||
|
map.put("halfLife", "");
|
||||||
|
map.put("halfLifeErr", "");
|
||||||
|
}
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user