Merge remote-tracking branch 'origin/SelfStation' into SelfStation
This commit is contained in:
commit
48fc1b30e5
|
@ -284,6 +284,45 @@ public class SelfStationController {
|
|||
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")
|
||||
public Result replotBaseLine(@RequestBody BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||
return selfStationService.replotBaseLine(baseLineCtrls, request);
|
||||
}
|
||||
|
||||
@PostMapping("acceptBaseLine")
|
||||
public Result acceptBaseLine(@RequestBody BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||
return selfStationService.acceptBaseLine(baseLineCtrls, request);
|
||||
}
|
||||
|
||||
/***************************************** beta ******************************************/
|
||||
|
||||
@PostMapping("fitting")
|
||||
|
@ -298,6 +337,12 @@ public class SelfStationController {
|
|||
return selfStationService.getGammaGated(chartHeight, channelWidth, gammaChannel, sampleId, qcFileName, sampleFileName, request);
|
||||
}
|
||||
|
||||
@PostMapping("resetButton")
|
||||
@ApiOperation(value = "重置计算数据", notes = "重置计算数据")
|
||||
public void resetButton(String sampleFileName, String tabName, HttpServletRequest request) {
|
||||
selfStationService.resetButton(sampleFileName, tabName, request);
|
||||
}
|
||||
|
||||
@GetMapping("NuclideLibrary")
|
||||
@ApiOperation(value = "查看Nuclide Library页面数据", notes = "查看Nuclide Library页面数据")
|
||||
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {
|
||||
|
|
|
@ -7,4 +7,6 @@ public class BaseLineCtrls extends BaseControls {
|
|||
|
||||
private String fileName;
|
||||
|
||||
private int gammaROINum;
|
||||
|
||||
}
|
||||
|
|
|
@ -92,11 +92,27 @@ public interface ISelfStationService {
|
|||
|
||||
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 acceptBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request);
|
||||
|
||||
Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPointsArray, Integer count,
|
||||
String sampleFileName, String tabName, boolean fittingBtn, HttpServletRequest request);
|
||||
|
||||
Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, String sampleFileName, HttpServletRequest request);
|
||||
|
||||
void resetButton(String sampleFileName, String tabName, HttpServletRequest request);
|
||||
|
||||
Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request);
|
||||
|
||||
Result configUserLibrary(Integer sampleId, String fileName, HttpServletRequest request);
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
|
@ -600,9 +601,9 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
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);
|
||||
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) {
|
||||
|
@ -2000,6 +2001,20 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
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));
|
||||
|
||||
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.setResult(roiMap);
|
||||
} catch (RuntimeException e) {
|
||||
|
@ -2358,7 +2373,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
}
|
||||
|
||||
@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();
|
||||
//获取用户名称
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
|
@ -2824,6 +2839,485 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
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
|
||||
public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
// 获取文件名称
|
||||
String fileName = baseLineCtrls.getFileName();
|
||||
//获取自建台站缓存信息
|
||||
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, baseLineCtrls.getGammaROINum(), 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;
|
||||
}
|
||||
List<Long> m_vCount = new LinkedList<>();
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||
// 获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
// 确保绘制曲线时所有谱都是从1道开始
|
||||
int i = 0;
|
||||
if (m_nSChan == 0) {
|
||||
i = 1;
|
||||
}
|
||||
for (; i < m_nCount; ++i) {
|
||||
m_vCount.add(phd.getSpec().getCounts().get(i));
|
||||
}
|
||||
if (m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
if (baseLineCtrls.isReplotNeeded()) {
|
||||
baseLineCtrls.setReplotNeeded(false);
|
||||
BaseControls m_baseCtrl = new BaseLineCtrls();
|
||||
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
|
||||
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), m_baseCtrl.getBaseline(), colorMap.get("Color_Peak"), m_nCount, null, false);
|
||||
map.put("peakSet", peakSet);
|
||||
ChartData chartData = gammaFileUtil.CreateTempBaseLine(colorMap.get("Color_Base"), "BaseLine", m_baseCtrl);
|
||||
map.put("chartData", chartData);
|
||||
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(m_baseCtrl);
|
||||
map.put("shapeData", shapeData);
|
||||
if (m_baseCtrl.getBaseStack().size() > 2) {
|
||||
for (int j = 1; j < m_baseCtrl.getBaseStack().size() - 1; j++) {
|
||||
m_baseCtrl.getBaseStack().remove(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result acceptBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
// 获取文件名称
|
||||
String fileName = baseLineCtrls.getFileName();
|
||||
//获取自建台站缓存信息
|
||||
PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, baseLineCtrls.getGammaROINum(), 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;
|
||||
}
|
||||
// if(baseLineCtrls.getBaseStack().size() > 1) {
|
||||
// for (int i=0; i<baseLineCtrls.getBaseStack().size(); i++) {
|
||||
// baseLineCtrls.getBaseStack().remove(i);
|
||||
// }
|
||||
BaseControls m_baseCtrl = new BaseLineCtrls();
|
||||
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
|
||||
phd.setBaseCtrls(m_baseCtrl);
|
||||
phd.setVBase(m_baseCtrl.getBaseline());
|
||||
// }
|
||||
// 获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||
map.put("barChart", differance);
|
||||
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base"));
|
||||
map.put("channelBaseLineChart", channelBaseLine);
|
||||
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_Peak"), phd.getSpec().getNum_g_channel(), null, false);
|
||||
map.put("peakSet", peakSet);
|
||||
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
|
||||
map.put("shapeData", shapeData);
|
||||
map.put("peak", phd.getVPeak());
|
||||
// 更新主界面的 Chart
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPoints, Integer count,
|
||||
String sampleFileName, String tabName, boolean fittingBtn, HttpServletRequest request) {
|
||||
|
@ -3064,6 +3558,36 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetButton(String sampleFileName, String tabName, HttpServletRequest request) {
|
||||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取自建台站缓存信息
|
||||
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
|
||||
SelfStationData betaDataFile = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
||||
//获取缓存信息
|
||||
// Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||
// BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
|
||||
if (Objects.nonNull(betaDataFile)) {
|
||||
//判断需要重置的tab页
|
||||
if (tabName.equalsIgnoreCase("gamma")) {
|
||||
betaDataFile.setGammaListNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setGammaFittingParaNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setGammaFittingParaToUiNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setGammaNewEnergyListNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaListNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaFittingParaNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaFittingParaToUiNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaNewEnergyListNow(Collections.EMPTY_LIST);
|
||||
} else if (tabName.equalsIgnoreCase("beta")) {
|
||||
betaDataFile.setBetaListNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaFittingParaNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaFittingParaToUiNow(Collections.EMPTY_LIST);
|
||||
betaDataFile.setBetaNewEnergyListNow(Collections.EMPTY_LIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SeriseData> getGateGamma(int channelWidth, int chartHeight, int gammaChannel, SelfStationData betaDataFile){
|
||||
List<SeriseData> serise_data = new LinkedList<>();
|
||||
//选择矩形框高度
|
||||
|
|
Loading…
Reference in New Issue
Block a user