Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
nieziyan 2023-12-11 18:56:01 +08:00
commit 79d7981789
13 changed files with 297 additions and 63 deletions

View File

@ -63,8 +63,20 @@ public class SysUserColor implements Serializable {
/** /**
* 两谱和曲线颜色 * 两谱和曲线颜色
*/ */
@TableField(value = "color_strip") @TableField(value = "color_spec_sum")
private String colorStrip; private String colorSpecSum;
/**
* 两谱差曲线颜色
*/
@TableField(value = "color_spec_cut")
private String colorSpecCut;
/**
* 参考谱曲线颜色
*/
@TableField(value = "color_reference")
private String colorReference;
/** /**
* 创建人 * 创建人

View File

@ -16,6 +16,8 @@ public class FittingBody implements Serializable {
private List<SeriseData> tempPoints; private List<SeriseData> tempPoints;
private boolean fittingBtn;
private Integer count; private Integer count;
private String sampleFileName; private String sampleFileName;

View File

@ -2669,7 +2669,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
//换行 //换行
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String nuclideTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s"; String nuclideTitle = "%-15s%-18s%-15s%-15s%-15s%-21s%-15s";
String[] nuclideData = new String[]{" Nuclide", "Halflife(s)", "Activity(Bq)", "RelErr%", "MDA(Bq)", "Conc(uBq/m^3)", "MDC"}; String[] nuclideData = new String[]{" Nuclide", "Halflife(s)", "Activity(Bq)", "RelErr%", "MDA(Bq)", "Conc(uBq/m^3)", "MDC"};
strBuffer.append(rowFormat(nuclideTitle, nuclideData)); strBuffer.append(rowFormat(nuclideTitle, nuclideData));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
@ -2704,7 +2704,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
//换行 //换行
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String peakTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s%-11s%-28s"; String peakTitle = "%-10s%-15s%-15s%-14s%-15s%-21s%-15s%-11s%-28s";
String[] peakData = new String[]{" PeakID", "Energy[kev]", "Centroid", "FWHM[kev]", "NetArea", "NAErr%", "Signif", "Sensit", "Nuclide"}; String[] peakData = new String[]{" PeakID", "Energy[kev]", "Centroid", "FWHM[kev]", "NetArea", "NAErr%", "Signif", "Sensit", "Nuclide"};
strBuffer.append(rowFormat(peakTitle, peakData)); strBuffer.append(rowFormat(peakTitle, peakData));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
@ -2958,7 +2958,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append("#DATA QUALITY FLAGS"); strBuffer.append("#DATA QUALITY FLAGS");
//换行 //换行
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String qualityTitle = "%-41s%-33s%-15s%-14s"; String qualityTitle = "%-15s%-15s%-15s%-15s";
strBuffer.append(rowFormat(qualityTitle, " Name", "Pass/Fail", "Value", "Test")); strBuffer.append(rowFormat(qualityTitle, " Name", "Pass/Fail", "Value", "Test"));
//换行 //换行
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
@ -4084,11 +4084,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
} }
} }
public List<Long> loadCompareData(String compareFileName, String userName, long m_nCount, Result result) { public List<Long> loadCompareData(File file, String userName, long m_nCount, Result result) {
List<Long> m_vecCompare = new LinkedList<>(); List<Long> m_vecCompare = new LinkedList<>();
String compareFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = compareFilePath + StringPool.SLASH + compareFileName;
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
//读取文件信息 //读取文件信息
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath()); EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//判断当前用来进行比较的文件的#g_Spectrum数量是否与原文件的大小一致 //判断当前用来进行比较的文件的#g_Spectrum数量是否与原文件的大小一致
@ -4101,8 +4098,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
m_vecCompare.add(0L); m_vecCompare.add(0L);
m_vecCompare.remove(0); m_vecCompare.remove(0);
} }
if (ObjectUtil.isNotNull(file))
file.delete();
return m_vecCompare; return m_vecCompare;
} }
@ -4140,6 +4135,40 @@ public class GammaFileUtil extends AbstractLogOrReport {
return datalist; return datalist;
} }
public List<ChartData> ReferenceData(List<Long> m_vecCompare, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy) {
List<ChartData> datalist = new LinkedList<>();
int size = m_vecCompare.size();
if(size == m_nCount) {
ChartData data1 = new ChartData();
data1.setName("Compare");
data1.setGroup("channel");
data1.setColor(colorMap.get("Color_Reference"));
// Compare two Spectrum in Channel
for(int i=0; i<size; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(i+1);
seriseData.setY(m_vecCompare.get(i));
data1.getPointlist().add(seriseData);
}
datalist.add(data1);
if(vEnergy.size() == size) {
ChartData data2 = new ChartData();
data2.setName("Compare");
data2.setGroup("energy");
data2.setColor(colorMap.get("Color_Reference"));
// Compare two Spectrum in Energy
for(int i=0; i<size; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(vEnergy.get(i));
seriseData.setY(m_vecCompare.get(i));
data2.getPointlist().add(seriseData);
}
datalist.add(data2);
}
}
return datalist;
}
public List<ChartData> StripData(List<Long> m_vecCompare, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy, Double ratioRate) { public List<ChartData> StripData(List<Long> m_vecCompare, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy, Double ratioRate) {
List<ChartData> datalist = new LinkedList<>(); List<ChartData> datalist = new LinkedList<>();
int size = m_vecCompare.size(); int size = m_vecCompare.size();
@ -4147,7 +4176,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
ChartData data1 = new ChartData(); ChartData data1 = new ChartData();
data1.setName("Compare"); data1.setName("Compare");
data1.setGroup("channel"); data1.setGroup("channel");
data1.setColor(colorMap.get("Color_Strip")); if (ratioRate<0) {
data1.setColor(colorMap.get("Color_SpecCut"));
} else {
data1.setColor(colorMap.get("Color_SpecSum"));
}
// type: 1 Add a Spectrum in Channel; -1 Cut a Spectrum in Channel // type: 1 Add a Spectrum in Channel; -1 Cut a Spectrum in Channel
for(int i=0; i<size; i++) { for(int i=0; i<size; i++) {
SeriseData seriseData = new SeriseData(); SeriseData seriseData = new SeriseData();
@ -4160,7 +4193,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
ChartData data2 = new ChartData(); ChartData data2 = new ChartData();
data2.setName("Compare"); data2.setName("Compare");
data2.setGroup("energy"); data2.setGroup("energy");
data2.setColor(colorMap.get("Color_Strip")); if (ratioRate<0) {
data2.setColor(colorMap.get("Color_SpecCut"));
} else {
data2.setColor(colorMap.get("Color_SpecSum"));
}
// type: 1 Add a Spectrum in Energy; -1 Cut a Spectrum in Energy // type: 1 Add a Spectrum in Energy; -1 Cut a Spectrum in Energy
for(int i=0; i<size; i++) { for(int i=0; i<size; i++) {
SeriseData seriseData = new SeriseData(); SeriseData seriseData = new SeriseData();

View File

@ -21,7 +21,7 @@ public class BetaCache {
//并发数设置 //并发数设置
.concurrencyLevel(5) .concurrencyLevel(5)
//缓存过期时间写入后5秒钟过期 //缓存过期时间写入后5秒钟过期
.expireAfterWrite(5, TimeUnit.HOURS) .expireAfterWrite(24, TimeUnit.HOURS)
//统计缓存命中率 //统计缓存命中率
.recordStats() .recordStats()
.build(); .build();

View File

@ -18,7 +18,7 @@ public class LocalCache {
//并发数设置 //并发数设置
.concurrencyLevel(5) .concurrencyLevel(5)
//缓存过期时间写入后5秒钟过期 //缓存过期时间写入后5秒钟过期
.expireAfterWrite(5, TimeUnit.HOURS) .expireAfterWrite(24, TimeUnit.HOURS)
//统计缓存命中率 //统计缓存命中率
.recordStats() .recordStats()
.build(); .build();

View File

@ -53,11 +53,21 @@ public class GammaController {
gammaService.delPHDCache(fileName); gammaService.delPHDCache(fileName);
} }
@GetMapping("CompareDB")
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
return gammaService.CompareDB(fileName, sampleId, request);
}
@GetMapping("Compare") @GetMapping("Compare")
public Result Compare(String fileName, String compareFileName, HttpServletRequest request) { public Result Compare(String fileName, String compareFileName, HttpServletRequest request) {
return gammaService.Compare(fileName, compareFileName, request); return gammaService.Compare(fileName, compareFileName, request);
} }
@GetMapping("StripDB")
public Result StripDB(String fileName, Integer sampleId, Double ratioRate, HttpServletRequest request) {
return gammaService.StripDB(fileName, sampleId, ratioRate, request);
}
@GetMapping("Strip") @GetMapping("Strip")
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) { public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
return gammaService.Strip(fileName, stripFileName, ratioRate, request); return gammaService.Strip(fileName, stripFileName, ratioRate, request);

View File

@ -187,7 +187,7 @@ public class SpectrumAnalysesController {
@PostMapping("fitting") @PostMapping("fitting")
@ApiOperation(value = "公式计算新的曲线", notes = "公式计算新的曲线") @ApiOperation(value = "公式计算新的曲线", notes = "公式计算新的曲线")
public Result fitting(@RequestBody FittingBody fittingBody, HttpServletRequest request) { public Result fitting(@RequestBody FittingBody fittingBody, HttpServletRequest request) {
return spectrumAnalysisService.fitting(fittingBody.getParamA(), fittingBody.getParamB(), fittingBody.getParamC(), fittingBody.getTempPoints(), fittingBody.getCount(), fittingBody.getSampleFileName(), fittingBody.getTabName(), request); return spectrumAnalysisService.fitting(fittingBody.getParamA(), fittingBody.getParamB(), fittingBody.getParamC(), fittingBody.getTempPoints(), fittingBody.getCount(), fittingBody.getSampleFileName(), fittingBody.getTabName(), fittingBody.isFittingBtn(), request);
} }
@GetMapping("getGammaGated") @GetMapping("getGammaGated")
@ -196,6 +196,12 @@ public class SpectrumAnalysesController {
return spectrumAnalysisService.getGammaGated(chartHeight, channelWidth, gammaChannel, sampleId, qcFileName, sampleFileName, request); return spectrumAnalysisService.getGammaGated(chartHeight, channelWidth, gammaChannel, sampleId, qcFileName, sampleFileName, request);
} }
@PostMapping("resetButton")
@ApiOperation(value = "重置计算数据", notes = "重置计算数据")
public void resetButton(String sampleFileName, String tabName, HttpServletRequest request) {
spectrumAnalysisService.resetButton(sampleFileName, tabName, request);
}
@PostMapping("ReAnalyse") @PostMapping("ReAnalyse")
public Result ReAnalyse(@RequestBody AnalyseData analyseData, HttpServletRequest request) { public Result ReAnalyse(@RequestBody AnalyseData analyseData, HttpServletRequest request) {
return spectrumAnalysisService.ReAnalyse(analyseData, request); return spectrumAnalysisService.ReAnalyse(analyseData, request);

View File

@ -21,7 +21,10 @@ public class ColorInfo implements Serializable {
private String colorFitbase; private String colorFitbase;
private String colorStrip; private String colorSpecSum;
private String colorSpecCut;
private String colorReference;
} }

View File

@ -22,8 +22,12 @@ public interface IGammaService{
void delPHDCache(String fileName); void delPHDCache(String fileName);
Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request);
Result Compare(String fileName, String compareFileName, HttpServletRequest request); Result Compare(String fileName, String compareFileName, HttpServletRequest request);
Result StripDB(String fileName, Integer sampleId, Double ratioRate, HttpServletRequest request);
Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request); Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request);
Result configure(Integer sampleId, String fileName, HttpServletRequest request); Result configure(Integer sampleId, String fileName, HttpServletRequest request);

View File

@ -68,10 +68,12 @@ public interface ISpectrumAnalysisService {
Result statisticsQueryBtn(Integer detectorId, String detectorName, Integer stationId, String statisticsType, Date startTime, Date endTime); Result statisticsQueryBtn(Integer detectorId, String detectorName, Integer stationId, String statisticsType, Date startTime, Date endTime);
Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPointsArray, Integer count, String sampleFileName, String tabName, 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); 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 ReAnalyse(AnalyseData analyseData, HttpServletRequest request); Result ReAnalyse(AnalyseData analyseData, HttpServletRequest request);
Result analyseCurrentSpectrum(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request); Result analyseCurrentSpectrum(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);

View File

@ -899,6 +899,43 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
localCache.deletePHDCache(key); localCache.deletePHDCache(key);
} }
@Override
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
Result result = new Result();
//获取用户名称
String userName = JwtUtil.getUserNameByToken(request);
// 获取当前角色配置的颜色信息
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 获取缓存的phd数据
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy();
//根据sampleId查询文件路径
String compareFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
if (StringUtils.isBlank(compareFilePath)) {
result.error500("The comparison file path does not exist");
return result;
}
compareFilePath = StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + compareFilePath;
File compareFile = ftpUtil.downloadFile(compareFilePath, "betaGamma");
if (Objects.nonNull(compareFile)) {
// 获取Compare数据
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(compareFile, userName, m_nCount, result);
if (CollectionUtils.isNotEmpty(m_vecCompare)) {
List<ChartData> chartDataList = gammaFileUtil.CompareData(m_vecCompare, m_nCount, colorMap, vEnergy);
result.setSuccess(true);
result.setResult(chartDataList);
}
compareFile.delete();
}
return result;
}
@Override @Override
public Result Compare(String fileName, String compareFileName, HttpServletRequest request) { public Result Compare(String fileName, String compareFileName, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();
@ -914,19 +951,27 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
long m_nCount = phd.getSpec().getNum_g_channel(); long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy(); List<Double> vEnergy = phd.getVEnergy();
//加载compare文件
String compareFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = compareFilePath + StringPool.SLASH + compareFileName;
File compareFile = ftpUtil.downloadFile(fromPath, "betaGamma");
if (Objects.nonNull(compareFile)) {
// 获取Compare数据 // 获取Compare数据
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(compareFileName, userName, m_nCount, result); List<Long> m_vecCompare = gammaFileUtil.loadCompareData(compareFile, userName, m_nCount, result);
if (CollectionUtils.isNotEmpty(m_vecCompare)) { if (CollectionUtils.isNotEmpty(m_vecCompare)) {
List<ChartData> chartDataList = gammaFileUtil.CompareData(m_vecCompare, m_nCount, colorMap, vEnergy); List<ChartData> chartDataList = gammaFileUtil.CompareData(m_vecCompare, m_nCount, colorMap, vEnergy);
result.setSuccess(true); result.setSuccess(true);
result.setResult(chartDataList); result.setResult(chartDataList);
} }
compareFile.delete();
}
return result; return result;
} }
@Override @Override
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) { public Result StripDB(String fileName, Integer sampleId, Double ratioRate, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();
Map<String, List<ChartData>> stripMap = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request); String userName = JwtUtil.getUserNameByToken(request);
// 获取当前角色配置的颜色信息 // 获取当前角色配置的颜色信息
Map<String, String> colorMap = sysUserColorService.initColor(userName); Map<String, String> colorMap = sysUserColorService.initColor(userName);
@ -952,12 +997,75 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (m_nSChan == 0) { if (m_nSChan == 0) {
m_vCount.add(0L); m_vCount.add(0L);
} }
//根据sampleId查询文件路径
String stripFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
if (StringUtils.isBlank(stripFilePath)) {
result.error500("The comparison file path does not exist");
return result;
}
stripFilePath = StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + stripFilePath;
File stripFile = ftpUtil.downloadFile(stripFilePath, "betaGamma");
if (Objects.nonNull(stripFile)) {
// 获取Compare数据 // 获取Compare数据
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(stripFileName, userName, m_nCount, result); List<Long> m_vecCompare = gammaFileUtil.loadCompareData(stripFile, userName, m_nCount, result);
if (CollectionUtils.isNotEmpty(m_vecCompare)) { if (CollectionUtils.isNotEmpty(m_vecCompare)) {
List<ChartData> referenceDataList = gammaFileUtil.ReferenceData(m_vecCompare, m_nCount, colorMap, vEnergy);
List<ChartData> chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate); List<ChartData> chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate);
stripMap.put("reference", referenceDataList);
stripMap.put("result", chartDataList);
result.setSuccess(true); result.setSuccess(true);
result.setResult(chartDataList); result.setResult(stripMap);
}
stripFile.delete();
}
return result;
}
@Override
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
Result result = new Result();
Map<String, List<ChartData>> stripMap = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
// 获取当前角色配置的颜色信息
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 获取缓存的phd数据
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy();
long m_nSChan = phd.getSpec().getBegin_channel();
List<Long> m_vCount = new LinkedList<>();
// 确保绘制曲线时所有谱都是从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);
}
//加载strip文件
String stripFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = stripFilePath + StringPool.SLASH + stripFileName;
File stripFile = ftpUtil.downloadFile(fromPath, "betaGamma");
if (Objects.nonNull(stripFile)) {
// 获取Compare数据
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(stripFile, userName, m_nCount, result);
if (CollectionUtils.isNotEmpty(m_vecCompare)) {
List<ChartData> referenceDataList = gammaFileUtil.ReferenceData(m_vecCompare, m_nCount, colorMap, vEnergy);
List<ChartData> chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate);
stripMap.put("reference", referenceDataList);
stripMap.put("result", chartDataList);
result.setSuccess(true);
result.setResult(stripMap);
}
stripFile.delete();
} }
return result; return result;
} }
@ -1436,12 +1544,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// 根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线 // 根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线
if (accept) { if (accept) {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
if (flag.equalsIgnoreCase("fit")) {// 如果传递的flag标识 fit则进行修改峰值等数据 if (flag.equalsIgnoreCase("insert")) {// 如果传递的flag标识 Insert则进行峰值的插入
for (int j = 0; j < newPeak.size(); j++) {
PeakInfo peakInfo = newPeak.get(j);
phd.getVPeak().set(peakInfo.index - 1, peakInfo);
}
} else if (flag.equalsIgnoreCase("insert")) {// 如果传递的flag标识 Insert则进行峰值的插入
//重新赋值index //重新赋值index
for (int k=0; k<newPeak.size(); k++) { for (int k=0; k<newPeak.size(); k++) {
newPeak.get(k).index = k; newPeak.get(k).index = k;
@ -1495,7 +1598,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String phdStr = mapper.writeValueAsString(phd); String phdStr = mapper.writeValueAsString(phd);
String strValue = HttpClient.fitPeakFull(phdStr, Af, Cf, Ff); String strValue = CalValuesHandler.fitPeakFull(phdStr, Af, Cf, Ff);
// String strValue = HttpClient.fitPeakFull(phdStr, Af, Cf, Ff);
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class); Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry : parseMap.entrySet()) { for (Map.Entry<String, Object> entry : parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("vPeak")) { if (entry.getKey().equalsIgnoreCase("vPeak")) {
@ -2008,6 +2112,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
item.setYieldUncert(Double.valueOf(String.format("%.3f", 0.0))); item.setYieldUncert(Double.valueOf(String.format("%.3f", 0.0)));
} }
}); });
nuclideTableList.stream().max(Comparator.comparing(GardsNuclLinesLib::getYield)).get().setKeyFlag(1);
map.put("table", nuclideTableList); map.put("table", nuclideTableList);
gammaFileUtil.InitChart(nuclideTableList, phd, map, colorMap); gammaFileUtil.InitChart(nuclideTableList, phd, map, colorMap);
} }
@ -5074,7 +5179,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public void IecToIms(FileData datas, MultipartFile file, HttpServletResponse response) { public void IecToIms(FileData datas, MultipartFile file, HttpServletResponse response) {
String IecName = file.getOriginalFilename(); String IecName = file.getOriginalFilename();
String ImsName = IecName.substring(0, IecName.length() - 4) + ".Ims"; String ImsName = IecName.substring(0, IecName.length() - 4) + ".PHD";
File iecFile = null; File iecFile = null;
InputStream inputStream = null; InputStream inputStream = null;
// 导出数据内容到txt文本 // 导出数据内容到txt文本
@ -5120,7 +5225,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public void SpcToIms(FileData datas, MultipartFile file, HttpServletResponse response) { public void SpcToIms(FileData datas, MultipartFile file, HttpServletResponse response) {
String SpcName = file.getOriginalFilename(); String SpcName = file.getOriginalFilename();
String ImsName = SpcName.substring(0, SpcName.length() - 4) + ".IMS"; String ImsName = SpcName.substring(0, SpcName.length() - 4) + ".PHD";
File spcFile = null; File spcFile = null;
InputStream inputStream = null; InputStream inputStream = null;
// 导出数据内容到txt文本 // 导出数据内容到txt文本

View File

@ -1089,7 +1089,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append("#SAMPLE: LIMITS PER ROI"); strBuffer.append("#SAMPLE: LIMITS PER ROI");
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String limitRoi = "%s%-51s%-51s%-12s"; String limitRoi = "%s%-15s%-15s%-15s";
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma")); strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma"));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumsSample)) { if (CollectionUtils.isNotEmpty(roiChannelsSpectrumsSample)) {
@ -1218,7 +1218,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append("#GROSS COUNTS PER ROI"); strBuffer.append("#GROSS COUNTS PER ROI");
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String grossRoi = "%s%-51s%-51s%-13s%-15s"; String grossRoi = "%s%-15s%-15s%-15s%-15s";
strBuffer.append(rowFormat(grossRoi, StringPool.SPACE, "Roi", "Sample", "GasBkgnd", "DetBkgnd")); strBuffer.append(rowFormat(grossRoi, StringPool.SPACE, "Roi", "Sample", "GasBkgnd", "DetBkgnd"));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) { if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
@ -1230,7 +1230,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append("#NET COUNTS AND LC PER ROI"); strBuffer.append("#NET COUNTS AND LC PER ROI");
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String netRoi = "%s%-51s%-51s%-13s"; String netRoi = "%s%-15s%-25s%-15s";
if (betaDataFile.isBProcessed()) { if (betaDataFile.isBProcessed()) {
if (CollectionUtils.isNotEmpty(resultsSpectrums)) { if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
if (Objects.isNull(resultsSpectrums.get(0).getLcCts())) { if (Objects.isNull(resultsSpectrums.get(0).getLcCts())) {
@ -1285,7 +1285,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append("#CONCENTRATION AND LC PER ROI"); strBuffer.append("#CONCENTRATION AND LC PER ROI");
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String conLcRoi = "%s%-51s%-51s%-13s%-15s"; String conLcRoi = "%s%-15s%-25s%-15s%-15s";
strBuffer.append(rowFormat(conLcRoi, StringPool.SPACE, "Roi", "Conc(mBq/m3)", "LC(mBq/m3)", "MDC(mBq/m3):")); strBuffer.append(rowFormat(conLcRoi, StringPool.SPACE, "Roi", "Conc(mBq/m3)", "LC(mBq/m3)", "MDC(mBq/m3):"));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
if (betaDataFile.isBProcessed()) { if (betaDataFile.isBProcessed()) {
@ -1306,7 +1306,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append("#RESULT SUMMARY"); strBuffer.append("#RESULT SUMMARY");
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
String resultSum = "%s%-51s%-51s%-13s%-15s%-11s"; String resultSum = "%s%-15s%-25s%-15s%-15s%-15s";
strBuffer.append(rowFormat(resultSum, StringPool.SPACE, "Nuclide Name", "Conc", "LC", "MDC", "NID Flag")); strBuffer.append(rowFormat(resultSum, StringPool.SPACE, "Nuclide Name", "Conc", "LC", "MDC", "NID Flag"));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(xeResultsSpectrums)) { if (CollectionUtils.isNotEmpty(xeResultsSpectrums)) {
@ -1854,6 +1854,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
} }
map.put("betaEnergy", betaEnergyList); map.put("betaEnergy", betaEnergyList);
//gamma Energy 散点图坐标点关联gamma部分相关数据 //gamma Energy 散点图坐标点关联gamma部分相关数据
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
map.put("gammaEnergy", betaDataFile.getGammaNewEnergyList());
} else {
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<Double> gchannels = new ArrayList<>(); List<Double> gchannels = new ArrayList<>();
List<List<Double>> gammaEnergyList = new LinkedList<>(); List<List<Double>> gammaEnergyList = new LinkedList<>();
@ -1864,6 +1867,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
gammaEnergyList.add(gammaEnergy); gammaEnergyList.add(gammaEnergy);
} }
map.put("gammaEnergy", gammaEnergyList); map.put("gammaEnergy", gammaEnergyList);
}
//Beta-Gamma Spectrum: QC 散点图相关数据 //Beta-Gamma Spectrum: QC 散点图相关数据
List<HistogramData> histogramDataList = new LinkedList<>(); List<HistogramData> histogramDataList = new LinkedList<>();
for (int column=0; column<bChannels; column++) { for (int column=0; column<bChannels; column++) {
@ -2668,7 +2672,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
} }
@Override @Override
public Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPoints, Integer count, String sampleFileName, String tabName, HttpServletRequest request) { public Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPoints, Integer count, String sampleFileName, String tabName, boolean fittingBtn, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();
//获取用户名 //获取用户名
String userName = JwtUtil.getUserNameByToken(request); String userName = JwtUtil.getUserNameByToken(request);
@ -2704,6 +2708,24 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
channels.add(Double.valueOf(i)); channels.add(Double.valueOf(i));
} }
List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara); List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara);
//如果当前fitting按钮没有进行过操作 并且 操作的是gamma探测器相关的
if (tabName.equalsIgnoreCase("gamma") && !fittingBtn) {
//根据临时点的道值修改对应能量值
//遍历所有道值
for (int i=0; i< channels.size(); i++) {
//获取道值
double channel = channels.get(i).doubleValue();
//遍历临时点数据
for (int j=0; j<tempPoints.size(); j++) {
SeriseData seriseData = tempPoints.get(j);
double tempChannel = seriseData.getX();
//如果道值等于临时点的道值
if (channel == tempChannel) {
energys.set(i, seriseData.getY());
}
}
}
}
List<SeriseData> newLineSeries = new LinkedList<>(); List<SeriseData> newLineSeries = new LinkedList<>();
List<List<Double>> energyList = new LinkedList<>(); List<List<Double>> energyList = new LinkedList<>();
for (Double calEnergy:energys) { for (Double calEnergy:energys) {
@ -2877,6 +2899,29 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
return result; return result;
} }
@Override
public void resetButton(String sampleFileName, String tabName, HttpServletRequest request) {
//获取用户名
String userName = JwtUtil.getUserNameByToken(request);
//获取缓存信息
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
if (Objects.nonNull(betaDataFile)) {
//判断需要重置的tab页
if (tabName.equalsIgnoreCase("gamma")) {
betaDataFile.setGammaList(Collections.EMPTY_LIST);
betaDataFile.setGammaFittingPara(Collections.EMPTY_LIST);
betaDataFile.setGammaFittingParaToUi(Collections.EMPTY_LIST);
betaDataFile.setGammaNewEnergyList(Collections.EMPTY_LIST);
} else if (tabName.equalsIgnoreCase("beta")) {
betaDataFile.setBetaList(Collections.EMPTY_LIST);
betaDataFile.setBetaFittingPara(Collections.EMPTY_LIST);
betaDataFile.setBetaFittingParaToUi(Collections.EMPTY_LIST);
betaDataFile.setBetaNewEnergyList(Collections.EMPTY_LIST);
}
}
}
@Override @Override
public Result ReAnalyse(AnalyseData analyseData, HttpServletRequest request) { public Result ReAnalyse(AnalyseData analyseData, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();

View File

@ -31,14 +31,16 @@ public class SysUserColorServiceImpl extends ServiceImpl<SysUserColorMapper, Sys
if (Objects.isNull(userColor)) { if (Objects.isNull(userColor)) {
userColor = new SysUserColor(); userColor = new SysUserColor();
userColor.setId(String.valueOf(IdWorker.getId())); userColor.setId(String.valueOf(IdWorker.getId()));
userColor.setColorSpec("yellow"); userColor.setColorSpec("rgb(255, 255, 0)");
userColor.setColorPeak("rgb(255, 127, 39)"); userColor.setColorPeak("rgb(255, 127, 39)");
userColor.setColorLc("red"); userColor.setColorLc("rgb(255, 0, 0)");
userColor.setColorBase("rgb(0, 246, 255)"); userColor.setColorBase("rgb(0, 246, 255)");
userColor.setColorScac("rgb(244, 112, 247)"); userColor.setColorScac("rgb(244, 112, 247)");
userColor.setColorCompare("green"); userColor.setColorCompare("rgb(0, 255, 0)");
userColor.setColorFitbase("white"); userColor.setColorFitbase("rgb(255, 255, 255)");
userColor.setColorStrip("blue"); userColor.setColorSpecSum("rgb(0, 0, 255)");
userColor.setColorSpecCut("rgb(0, 0, 255)");
userColor.setColorReference("rgb(0, 0, 255)");
userColor.setCreateBy(userName); userColor.setCreateBy(userName);
this.baseMapper.insert(userColor); this.baseMapper.insert(userColor);
} }
@ -49,7 +51,9 @@ public class SysUserColorServiceImpl extends ServiceImpl<SysUserColorMapper, Sys
map.put("Color_Scac", userColor.getColorScac()); map.put("Color_Scac", userColor.getColorScac());
map.put("Color_Compare", userColor.getColorCompare()); map.put("Color_Compare", userColor.getColorCompare());
map.put("Color_Fitbase", userColor.getColorFitbase()); map.put("Color_Fitbase", userColor.getColorFitbase());
map.put("Color_Strip", userColor.getColorStrip()); map.put("Color_SpecSum", userColor.getColorSpecSum());
map.put("Color_SpecCut", userColor.getColorSpecCut());
map.put("Color_Reference", userColor.getColorReference());
return map; return map;
} }
@ -68,7 +72,9 @@ public class SysUserColorServiceImpl extends ServiceImpl<SysUserColorMapper, Sys
userColor.setColorScac(colorInfo.getColorScac()); userColor.setColorScac(colorInfo.getColorScac());
userColor.setColorCompare(colorInfo.getColorCompare()); userColor.setColorCompare(colorInfo.getColorCompare());
userColor.setColorFitbase(colorInfo.getColorFitbase()); userColor.setColorFitbase(colorInfo.getColorFitbase());
userColor.setColorStrip(colorInfo.getColorStrip()); userColor.setColorSpecSum(colorInfo.getColorSpecSum());
userColor.setColorSpecCut(colorInfo.getColorSpecCut());
userColor.setColorReference(colorInfo.getColorReference());
this.baseMapper.updateById(userColor); this.baseMapper.updateById(userColor);
} }
map.put("Color_Spec", userColor.getColorSpec()); map.put("Color_Spec", userColor.getColorSpec());
@ -78,7 +84,9 @@ public class SysUserColorServiceImpl extends ServiceImpl<SysUserColorMapper, Sys
map.put("Color_Scac", userColor.getColorScac()); map.put("Color_Scac", userColor.getColorScac());
map.put("Color_Compare", userColor.getColorCompare()); map.put("Color_Compare", userColor.getColorCompare());
map.put("Color_Fitbase", userColor.getColorFitbase()); map.put("Color_Fitbase", userColor.getColorFitbase());
map.put("Color_Strip", userColor.getColorStrip()); map.put("Color_SpecSum", userColor.getColorSpecSum());
map.put("Color_SpecCut", userColor.getColorSpecCut());
map.put("Color_Reference", userColor.getColorReference());
return map; return map;
} }