beta删除jdbc调用数据查询的相关代码
gamma功能删除核素或峰值数据时,判断核素信息是否是主峰对应核素,如果是对应主峰核素删除所有相关核素信息并重新计算核素活度浓度
This commit is contained in:
parent
cbd4df77f8
commit
eba58395da
|
@ -241,7 +241,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
//文件名称需要加上自动处理的前缀以及修改不同的文件后缀名
|
//文件名称需要加上自动处理的前缀以及修改不同的文件后缀名
|
||||||
String subFileName = fileName.substring(0, fileName.lastIndexOf(StringPool.DOT));
|
String subFileName = fileName.substring(0, fileName.lastIndexOf(StringPool.DOT));
|
||||||
if(StringUtils.isNotBlank(subFileName)){
|
if(StringUtils.isNotBlank(subFileName)){
|
||||||
|
|
||||||
//连接ftp
|
//连接ftp
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
|
@ -270,8 +269,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
List<Double> vData = ReadLcScacInfo(readLines);
|
List<Double> vData = ReadLcScacInfo(readLines);
|
||||||
//将数据结果赋值给 phdFile的vLc
|
//将数据结果赋值给 phdFile的vLc
|
||||||
phd.setVLc(vData);
|
phd.setVLc(vData);
|
||||||
// 删除临时文件
|
|
||||||
//file.delete();
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -993,6 +990,19 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateChart(PHDFile phd, Map<String, Object> map, Map<String, String> colorMap) {
|
public void UpdateChart(PHDFile phd, Map<String, Object> map, Map<String, String> colorMap) {
|
||||||
|
ChartData shadowEnergyChart = Energy_Count(phd, colorMap.get("Color_Spec"));
|
||||||
|
ChartData shadowChannelChart = Channel_Count(phd, colorMap.get("Color_Spec"));
|
||||||
|
map.put("shadowEnergyChart", shadowEnergyChart);
|
||||||
|
map.put("shadowChannelChart", shadowChannelChart);
|
||||||
|
List<ChartData> allData = AllData(false, phd, colorMap);
|
||||||
|
map.put("allData", allData);
|
||||||
|
List<ShapeData> shapeEnergyData = Energy_BaseCP(phd);
|
||||||
|
map.put("shapeEnergyData", shapeEnergyData);
|
||||||
|
List<ShapeData> shapeChannelData = Channel_BaseCP(phd);
|
||||||
|
map.put("shapeChannelData", shapeChannelData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChartData Energy_Count(PHDFile phd, String color) {
|
||||||
//声明一个数组
|
//声明一个数组
|
||||||
List<Long> m_vCount = new LinkedList<>();
|
List<Long> m_vCount = new LinkedList<>();
|
||||||
//获取 phdFile的Spec的num_g_channel
|
//获取 phdFile的Spec的num_g_channel
|
||||||
|
@ -1009,19 +1019,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
if(m_nSChan == 0) {
|
if(m_nSChan == 0) {
|
||||||
m_vCount.add(0L);
|
m_vCount.add(0L);
|
||||||
}
|
}
|
||||||
ChartData shadowEnergyChart = Energy_Count(phd, m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
|
||||||
ChartData shadowChannelChart = Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
|
||||||
map.put("shadowEnergyChart", shadowEnergyChart);
|
|
||||||
map.put("shadowChannelChart", shadowChannelChart);
|
|
||||||
List<ChartData> allData = AllData(false, phd, m_vCount, m_nCount, colorMap);
|
|
||||||
map.put("allData", allData);
|
|
||||||
List<ShapeData> shapeEnergyData = Energy_BaseCP(phd);
|
|
||||||
map.put("shapeEnergyData", shapeEnergyData);
|
|
||||||
List<ShapeData> shapeChannelData = Channel_BaseCP(phd);
|
|
||||||
map.put("shapeChannelData", shapeChannelData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChartData Energy_Count(PHDFile phd, List<Long> m_vCount, long m_nCount, String color) {
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
long end = -1;
|
long end = -1;
|
||||||
//Energy
|
//Energy
|
||||||
|
@ -1033,10 +1031,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
if(end < 1 || end > m_nCount){
|
if(end < 1 || end > m_nCount){
|
||||||
end = m_nCount;
|
end = m_nCount;
|
||||||
}
|
}
|
||||||
for(int i=start-1; i<end; i++) {
|
for(int j=start-1; j<end; j++) {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(phd.getVEnergy().get(i));
|
seriseData.setX(phd.getVEnergy().get(j));
|
||||||
seriseData.setY(m_vCount.get(i));
|
seriseData.setY(m_vCount.get(j));
|
||||||
data1.getPointlist().add(seriseData);
|
data1.getPointlist().add(seriseData);
|
||||||
}
|
}
|
||||||
data1.setName("Energy");
|
data1.setName("Energy");
|
||||||
|
@ -1046,7 +1044,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return data1;
|
return data1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChartData Channel_Count(List<Long> m_vCount, long m_nCount, String color) {
|
public ChartData Channel_Count(PHDFile phd, String color) {
|
||||||
|
// Chart 折线图
|
||||||
|
List<Long> m_vCount = new LinkedList<>();
|
||||||
|
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||||
|
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||||
|
// 确保绘制曲线时所有谱都是从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);
|
||||||
|
}
|
||||||
int start = 1;
|
int start = 1;
|
||||||
long end = -1;
|
long end = -1;
|
||||||
ChartData data1 = new ChartData();
|
ChartData data1 = new ChartData();
|
||||||
|
@ -1057,10 +1070,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
if(end < 1 || end > m_nCount){
|
if(end < 1 || end > m_nCount){
|
||||||
end = m_nCount;
|
end = m_nCount;
|
||||||
}
|
}
|
||||||
for(int i=start-1; i<end; i++) {
|
for(int j=start-1; j<end; j++) {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(i+1);
|
seriseData.setX(j+1);
|
||||||
seriseData.setY(m_vCount.get(i));
|
seriseData.setY(m_vCount.get(j));
|
||||||
data1.getPointlist().add(seriseData);
|
data1.getPointlist().add(seriseData);
|
||||||
}
|
}
|
||||||
data1.setName("Count");
|
data1.setName("Count");
|
||||||
|
@ -1070,7 +1083,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return data1;
|
return data1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChartData> Lc_Scac_base(boolean showLc, PHDFile phd, long m_nCount, Map<String, String> colorMap) {
|
public List<ChartData> Lc_Scac_base(boolean showLc, PHDFile phd, Map<String, String> colorMap) {
|
||||||
|
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||||
List<ChartData> datalist = new LinkedList<>();
|
List<ChartData> datalist = new LinkedList<>();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
long end = -1;
|
long end = -1;
|
||||||
|
@ -1183,12 +1197,12 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return datalist;
|
return datalist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChartData> Channel_Peak(PHDFile phd, long m_nCount, String color) {
|
public List<ChartData> Channel_Peak(PHDFile phd, String color) {
|
||||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, null, false);
|
return PeakSet(phd.getVPeak(), phd.getVBase(), color, phd.getSpec().getNum_g_channel(), null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChartData> Energy_Peak(PHDFile phd, long m_nCount, String color) {
|
public List<ChartData> Energy_Peak(PHDFile phd, String color) {
|
||||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, phd.getUsedEnerPara().getP(), true);
|
return PeakSet(phd.getVPeak(), phd.getVBase(), color, phd.getSpec().getNum_g_channel(), phd.getUsedEnerPara().getP(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy) {
|
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy) {
|
||||||
|
@ -1224,7 +1238,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
for(int i=startPeak; i<=endPeak; i++) {
|
for(int i=startPeak; i<=endPeak; i++) {
|
||||||
PeakInfo peak = vPeak.get(i);
|
PeakInfo peak = vPeak.get(i);
|
||||||
|
|
||||||
ChartData cData = new ChartData();
|
ChartData cData = new ChartData();
|
||||||
cData.setColor(color);
|
cData.setColor(color);
|
||||||
cData.setName("Peak");
|
cData.setName("Peak");
|
||||||
|
@ -1259,7 +1272,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(regChan.get(ii));
|
seriseData.setX(regChan.get(ii));
|
||||||
seriseData.setY(regPeak.get(ii));
|
seriseData.setY(regPeak.get(ii).isNaN()?0:regPeak.get(ii));
|
||||||
cData.getPointlist().add(seriseData);
|
cData.getPointlist().add(seriseData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1303,13 +1316,13 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChartData> AllData(boolean showLc, PHDFile phd, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap) {
|
public List<ChartData> AllData(boolean showLc, PHDFile phd, Map<String, String> colorMap) {
|
||||||
List<ChartData> datalist = new LinkedList<>();
|
List<ChartData> datalist = new LinkedList<>();
|
||||||
datalist.add(Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
datalist.add(Channel_Count(phd, colorMap.get("Color_Spec")));
|
||||||
datalist.add(Energy_Count(phd, m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
datalist.add(Energy_Count(phd, colorMap.get("Color_Spec")));
|
||||||
datalist.addAll(Lc_Scac_base(showLc, phd, m_nCount, colorMap));
|
datalist.addAll(Lc_Scac_base(showLc, phd, colorMap));
|
||||||
datalist.addAll(Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
datalist.addAll(Channel_Peak(phd, colorMap.get("Color_Peak")));
|
||||||
datalist.addAll(Energy_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
datalist.addAll(Energy_Peak(phd, colorMap.get("Color_Peak")));
|
||||||
return datalist;
|
return datalist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1866,7 +1879,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChartData Channel_BaseLine(PHDFile phd, long m_nCount, String color) {
|
public ChartData Channel_BaseLine(PHDFile phd, String color) {
|
||||||
|
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||||
ChartData cData = new ChartData();
|
ChartData cData = new ChartData();
|
||||||
int start =0;
|
int start =0;
|
||||||
long end = -1;
|
long end = -1;
|
||||||
|
@ -1892,7 +1906,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return cData;
|
return cData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SeriseData> Differance(PHDFile phd, List<PeakInfo> vecPeak, List<Long> m_vCount, long m_nCount) {
|
public List<SeriseData> Differance(PHDFile phd, List<PeakInfo> vecPeak) {
|
||||||
|
// Chart 折线图
|
||||||
|
List<Long> m_vCount = new LinkedList<>();
|
||||||
|
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||||
|
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||||
|
// 确保绘制曲线时所有谱都是从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);
|
||||||
|
}
|
||||||
List<SeriseData> pointlist = new LinkedList<>();
|
List<SeriseData> pointlist = new LinkedList<>();
|
||||||
int start =0;
|
int start =0;
|
||||||
long end = -1;
|
long end = -1;
|
||||||
|
@ -1928,8 +1957,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
List<Double> regPeak = new LinkedList<>();
|
List<Double> regPeak = new LinkedList<>();
|
||||||
int channel = 1;
|
int channel = 1;
|
||||||
for(int i=start-1; i<end; i++) {
|
for(int j=start-1; j<end; j++) {
|
||||||
channel = i + 1;
|
channel = j + 1;
|
||||||
PeakInfo peak = vecPeak.get(startPeak);
|
PeakInfo peak = vecPeak.get(startPeak);
|
||||||
if(channel >= peak.left && channel <= peak.right) {
|
if(channel >= peak.left && channel <= peak.right) {
|
||||||
if(CollectionUtils.isEmpty(regPeak)) {
|
if(CollectionUtils.isEmpty(regPeak)) {
|
||||||
|
@ -1944,12 +1973,12 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
// 差值 = 原谱值 - 峰面积
|
// 差值 = 原谱值 - 峰面积
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(channel);
|
seriseData.setX(channel);
|
||||||
seriseData.setY(m_vCount.get(i) - regPeak.get(channel-peak.left));
|
seriseData.setY(m_vCount.get(j) - regPeak.get(channel-peak.left));
|
||||||
pointlist.add(seriseData);
|
pointlist.add(seriseData);
|
||||||
} else if(m_vCount.get(i) > 0 && phd.getVBase().get(i) > 0) {
|
} else if(m_vCount.get(j) > 0 && phd.getVBase().get(j) > 0) {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(channel);
|
seriseData.setX(channel);
|
||||||
seriseData.setY(m_vCount.get(i) - phd.getVBase().get(i));
|
seriseData.setY(m_vCount.get(j) - phd.getVBase().get(j));
|
||||||
pointlist.add(seriseData);
|
pointlist.add(seriseData);
|
||||||
} else{
|
} else{
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
|
@ -1959,21 +1988,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vecPeak.get(startPeak).right < channel) {
|
if(vecPeak.get(startPeak).right < channel) {
|
||||||
++startPeak; regPeak.clear();
|
++startPeak;
|
||||||
|
regPeak.clear();
|
||||||
}
|
}
|
||||||
if(startPeak > endPeak){
|
if(startPeak > endPeak){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=channel; i<end; i++) {
|
for(int j=channel; j<end; j++) {
|
||||||
if(m_vCount.get(i) > 0 && phd.getVBase().get(i) > 0) {
|
if(m_vCount.get(j) > 0 && phd.getVBase().get(j) > 0) {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(i+1);
|
seriseData.setX(j+1);
|
||||||
seriseData.setY(m_vCount.get(i) - phd.getVBase().get(i));
|
seriseData.setY(m_vCount.get(j) - phd.getVBase().get(j));
|
||||||
pointlist.add(seriseData);
|
pointlist.add(seriseData);
|
||||||
} else {
|
} else {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(i+1);
|
seriseData.setX(j+1);
|
||||||
seriseData.setY(0);
|
seriseData.setY(0);
|
||||||
pointlist.add(seriseData);
|
pointlist.add(seriseData);
|
||||||
}
|
}
|
||||||
|
@ -3882,8 +3912,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
int j = i;
|
int j = i;
|
||||||
double temp = channel - peak.peakCentroid;
|
double temp = channel - peak.peakCentroid;
|
||||||
while(++j < peakNum && vPeak.get(j).multiIndex == peak.multiIndex) {
|
while(++j < peakNum && vPeak.get(j).multiIndex == peak.multiIndex) {
|
||||||
if(Math.abs(vPeak.get(j).peakCentroid - channel) < temp) // 找出重峰中峰中心道离 channel 最近的峰
|
// 找出重峰中峰中心道离 channel 最近的峰
|
||||||
{
|
if(Math.abs(vPeak.get(j).peakCentroid - channel) < temp) {
|
||||||
temp = Math.abs(vPeak.get(j).peakCentroid - channel);
|
temp = Math.abs(vPeak.get(j).peakCentroid - channel);
|
||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
|
@ -3910,6 +3940,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
for(int i=0; i<vPeak.size(); i++) {
|
for(int i=0; i<vPeak.size(); i++) {
|
||||||
PeakInfo peakInfo = new PeakInfo();
|
PeakInfo peakInfo = new PeakInfo();
|
||||||
peakInfo.index = i+1;
|
peakInfo.index = i+1;
|
||||||
|
peakInfo.left = vPeak.get(i).left;
|
||||||
|
peakInfo.right = vPeak.get(i).right;
|
||||||
BigDecimal energy = new BigDecimal(vPeak.get(i).energy);
|
BigDecimal energy = new BigDecimal(vPeak.get(i).energy);
|
||||||
energy = energy.setScale(3, RoundingMode.HALF_UP);
|
energy = energy.setScale(3, RoundingMode.HALF_UP);
|
||||||
peakInfo.energy = energy.doubleValue();
|
peakInfo.energy = energy.doubleValue();
|
||||||
|
@ -3952,7 +3984,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
NuclideActMda ActMda = new NuclideActMda();
|
NuclideActMda ActMda = new NuclideActMda();
|
||||||
ActMda.setHalflife(Objects.isNull(mapHalflife.get(nucName))?lines.halflife : mapHalflife.get(nucName));
|
ActMda.setHalflife(Objects.isNull(mapHalflife.get(nucName))?lines.halflife : mapHalflife.get(nucName));
|
||||||
for (int i=0, j=0; i<vEnergy.size(); i++) {
|
for (int i=0, j=0; i<vEnergy.size(); i++) {
|
||||||
for(; j<vPeakIdx.size(); ++j) {
|
for(; j<vPeakIdx.size(); j++) {
|
||||||
double energy = phd.getVPeak().get(vPeakIdx.get(j)).energy;
|
double energy = phd.getVPeak().get(vPeakIdx.get(j)).energy;
|
||||||
if(vEnergy.get(i) < energy - energyWidth) {
|
if(vEnergy.get(i) < energy - energyWidth) {
|
||||||
break;
|
break;
|
||||||
|
@ -4005,18 +4037,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
// 否则删除该核素与该峰所有关联的射线信息
|
// 否则删除该核素与该峰所有关联的射线信息
|
||||||
boolean needReCalc = false;
|
boolean needReCalc = false;
|
||||||
for(int i=nuc.getVPeakIdx().size()-1; i>=0; i--) {
|
for(int i=nuc.getVPeakIdx().size()-1; i>=0; i--) {
|
||||||
|
//判断当前下标对应的核素下标是否是需要删除的下标
|
||||||
if(nuc.getVPeakIdx().get(i) == removePeakIdx) {
|
if(nuc.getVPeakIdx().get(i) == removePeakIdx) {
|
||||||
nuc.getVEnergy().remove(i);
|
nuc.getVEnergy().remove(i);
|
||||||
nuc.getVUncertE().remove(i);
|
nuc.getVUncertE().remove(i);
|
||||||
nuc.getVYield().remove(i);
|
nuc.getVYield().remove(i);
|
||||||
nuc.getVUncertY().remove(i);
|
nuc.getVUncertY().remove(i);
|
||||||
nuc.getFullNames().remove(i);
|
nuc.getFullNames().remove(i);
|
||||||
|
//判断主峰核素下标是否与当前下标一致 且 BCalculateMDA是true
|
||||||
if(nuc.getCalculateIdx() == i && nuc.isBCalculateMDA()) {
|
if(nuc.getCalculateIdx() == i && nuc.isBCalculateMDA()) {
|
||||||
needReCalc = true;
|
needReCalc = true;
|
||||||
}
|
}
|
||||||
|
nuc.setCalculateIdx(nuc.getVEnergy().size()-1);
|
||||||
|
nuc.getVPeakIdx().remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nuc.getVPeakIdx().remove(removePeakIdx);
|
|
||||||
// 如果该核素只与一个峰对应则直接删除该核素的 MDA 信息
|
// 如果该核素只与一个峰对应则直接删除该核素的 MDA 信息
|
||||||
if(nuc.getVPeakIdx().size() < 1) {
|
if(nuc.getVPeakIdx().size() < 1) {
|
||||||
phd.getMapNucActMda().remove(nuclide);
|
phd.getMapNucActMda().remove(nuclide);
|
||||||
|
@ -4026,7 +4062,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
if(needReCalc) {
|
if(needReCalc) {
|
||||||
double maxYield = 0;
|
double maxYield = 0;
|
||||||
int mainPeakIdx = -1;
|
int mainPeakIdx = -1;
|
||||||
for(int j=0; j<nuc.getVYield().size(); ++j) {
|
for(int j=0; j<nuc.getVYield().size(); j++) {
|
||||||
if(nuc.getVYield().get(j) > maxYield) {
|
if(nuc.getVYield().get(j) > maxYield) {
|
||||||
nuc.setCalculateIdx(j);
|
nuc.setCalculateIdx(j);
|
||||||
maxYield = nuc.getVYield().get(j);
|
maxYield = nuc.getVYield().get(j);
|
||||||
|
@ -4486,7 +4522,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
String number1 = RightFill(String.valueOf(j), 5);
|
String number1 = RightFill(String.valueOf(j), 5);
|
||||||
String number2 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
String number2 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
||||||
spectrum.append(rowFormat(spectrumData3, number1, number2));
|
spectrum.append(rowFormat(spectrumData3, number1, number2));
|
||||||
for(i = i+1; i < phd.getSpec().getNum_g_channel(); ++i) {
|
for(i = i+1; i < phd.getSpec().getNum_g_channel(); i++) {
|
||||||
String spectrumData4 = " %s";
|
String spectrumData4 = " %s";
|
||||||
String number3 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
String number3 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
||||||
spectrum.append(rowFormat(spectrumData4, number3));
|
spectrum.append(rowFormat(spectrumData4, number3));
|
||||||
|
@ -4503,7 +4539,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
ChartData cData = new ChartData();
|
ChartData cData = new ChartData();
|
||||||
cData.setColor(color);
|
cData.setColor(color);
|
||||||
cData.setName(name);
|
cData.setName(name);
|
||||||
for(int i=0; i<m_baseCtrl.getBaseline().size(); ++i) {
|
for(int i=0; i<m_baseCtrl.getBaseline().size(); i++) {
|
||||||
SeriseData seriseData = new SeriseData();
|
SeriseData seriseData = new SeriseData();
|
||||||
seriseData.setX(i+1);
|
seriseData.setX(i+1);
|
||||||
seriseData.setY(m_baseCtrl.getBaseline().get(i));
|
seriseData.setY(m_baseCtrl.getBaseline().get(i));
|
||||||
|
@ -4514,7 +4550,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
public List<ShapeData> CreateShapeCP(BaseControls baseControls) {
|
public List<ShapeData> CreateShapeCP(BaseControls baseControls) {
|
||||||
List<ShapeData> shapes = new LinkedList<>();
|
List<ShapeData> shapes = new LinkedList<>();
|
||||||
for(int i=0; i<baseControls.getXCtrl().size(); ++i) {
|
for(int i=0; i<baseControls.getXCtrl().size(); i++) {
|
||||||
ShapeData shape = new ShapeData();
|
ShapeData shape = new ShapeData();
|
||||||
shape.setType("Shape_Round");
|
shape.setType("Shape_Round");
|
||||||
shape.setName("tmpCP"+i);
|
shape.setName("tmpCP"+i);
|
||||||
|
|
|
@ -89,6 +89,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserTaskUtil userTaskUtil;
|
private UserTaskUtil userTaskUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
@Autowired
|
||||||
private ISysDefaultNuclideSpectrumService defaultNuclideSpectrumService;
|
private ISysDefaultNuclideSpectrumService defaultNuclideSpectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserColorService sysUserColorService;
|
private ISysUserColorService sysUserColorService;
|
||||||
|
@ -138,12 +140,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
@Override
|
@Override
|
||||||
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
|
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
//
|
//获取用户名
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
PHDFile phd = new PHDFile();
|
PHDFile phd = new PHDFile();
|
||||||
// 读取文件内容
|
// 读取文件内容
|
||||||
String lastName = "";
|
String key = "";
|
||||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||||
// 根据sampleId获取sample文件路径
|
// 根据sampleId获取sample文件路径
|
||||||
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||||
|
@ -164,7 +166,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
lastName = fileName;
|
key = fileName + "-" + userName;
|
||||||
} else {
|
} else {
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||||
String fileName = samfileName;
|
String fileName = samfileName;
|
||||||
|
@ -172,9 +174,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
lastName = fileName;
|
key = fileName + "-" + userName;
|
||||||
}
|
}
|
||||||
phdCache.put(lastName, phd);
|
phdCache.put(key, phd);
|
||||||
localCache.setPHDCache(phdCache);
|
localCache.setPHDCache(phdCache);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(phd);
|
result.setResult(phd);
|
||||||
|
@ -443,6 +445,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
gammaFileUtil.SetBaseInfo(phd);
|
gammaFileUtil.SetBaseInfo(phd);
|
||||||
// 从数据库中读取phd其他相关信息
|
// 从数据库中读取phd其他相关信息
|
||||||
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||||
|
// 查询当前用户关联的核素信息
|
||||||
|
List<String> userLib = new LinkedList<>();
|
||||||
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
if (CollectionUtils.isEmpty(userLib)) {
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
}
|
||||||
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
|
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||||
// 判断数据库信息是否读取正常
|
// 判断数据库信息是否读取正常
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -465,6 +476,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
||||||
map.put("bAnalyed", phd.isBAnalyed());
|
map.put("bAnalyed", phd.isBAnalyed());
|
||||||
map.put("peak", phd.getVPeak());
|
map.put("peak", phd.getVPeak());
|
||||||
|
map.put("BaseCtrls", phd.getBaseCtrls());
|
||||||
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
|
map.put("barChart", differance);
|
||||||
// 更新页面折线图信息
|
// 更新页面折线图信息
|
||||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
// 将当前加载的phd信息加入到缓存中 文件名称作为缓存信息的key
|
// 将当前加载的phd信息加入到缓存中 文件名称作为缓存信息的key
|
||||||
|
@ -784,6 +798,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
phd = new PHDFile();
|
phd = new PHDFile();
|
||||||
// 加载文件内容
|
// 加载文件内容
|
||||||
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
||||||
|
// 查询当前用户关联的核素信息
|
||||||
|
List<String> userLib = new LinkedList<>();
|
||||||
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
if (CollectionUtils.isEmpty(userLib)) {
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
}
|
||||||
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
|
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -803,6 +826,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
||||||
map.put("bAnalyed", phd.isBAnalyed());
|
map.put("bAnalyed", phd.isBAnalyed());
|
||||||
map.put("peak", phd.getVPeak());
|
map.put("peak", phd.getVPeak());
|
||||||
|
map.put("BaseCtrls", phd.getBaseCtrls());
|
||||||
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
|
map.put("barChart", differance);
|
||||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
phdCache.put(fileName + "-" + userName, phd);
|
phdCache.put(fileName + "-" + userName, phd);
|
||||||
localCache.setPHDCache(phdCache);
|
localCache.setPHDCache(phdCache);
|
||||||
|
@ -1007,6 +1033,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
map.put("QCFlag", qcstate);
|
map.put("QCFlag", qcstate);
|
||||||
map.put("bAnalyed", phd.isBAnalyed());
|
map.put("bAnalyed", phd.isBAnalyed());
|
||||||
map.put("peak", phd.getVPeak());
|
map.put("peak", phd.getVPeak());
|
||||||
|
map.put("BaseCtrls", phd.getBaseCtrls());
|
||||||
|
// Bar Chart 柱状图
|
||||||
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
|
map.put("barChart", differance);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
}
|
}
|
||||||
|
@ -1073,16 +1103,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (m_nSChan == 0) {
|
if (m_nSChan == 0) {
|
||||||
m_vCount.add(0L);
|
m_vCount.add(0L);
|
||||||
}
|
}
|
||||||
ChartData channelCountChart = gammaFileUtil.Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
ChartData channelCountChart = gammaFileUtil.Channel_Count(phd, colorMap.get("Color_Spec"));
|
||||||
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base"));
|
||||||
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, colorMap.get("Color_Peak"));
|
||||||
List<ShapeData> channelBaseCPChart = gammaFileUtil.Channel_BaseCP(phd);
|
List<ShapeData> channelBaseCPChart = gammaFileUtil.Channel_BaseCP(phd);
|
||||||
map.put("channelCountChart", channelCountChart);
|
map.put("channelCountChart", channelCountChart);
|
||||||
map.put("channelBaseLineChart", channelBaseLineChart);
|
map.put("channelBaseLineChart", channelBaseLineChart);
|
||||||
map.put("channelPeakChart", channelPeakChart);
|
map.put("channelPeakChart", channelPeakChart);
|
||||||
map.put("channelBaseCPChart", channelBaseCPChart);
|
map.put("channelBaseCPChart", channelBaseCPChart);
|
||||||
// Bar Chart 柱状图
|
// Bar Chart 柱状图
|
||||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
map.put("barChart", differance);
|
map.put("barChart", differance);
|
||||||
// 赋值energy
|
// 赋值energy
|
||||||
map.put("energy", phd.getVEnergy());
|
map.put("energy", phd.getVEnergy());
|
||||||
|
@ -1370,11 +1400,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
|
|
||||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||||
map.put("table", vPeak);
|
map.put("table", vPeak);
|
||||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, colorMap.get("Color_Peak"));
|
||||||
map.put("channelPeakChart", channelPeak);
|
map.put("channelPeakChart", channelPeak);
|
||||||
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base"));
|
||||||
map.put("channelBaseLineChart", channelBaseLine);
|
map.put("channelBaseLineChart", channelBaseLine);
|
||||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
map.put("barChart", differance);
|
map.put("barChart", differance);
|
||||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
} else {// 如果不保留 根据下标移除对应的vPeak数据
|
} else {// 如果不保留 根据下标移除对应的vPeak数据
|
||||||
|
@ -1382,7 +1412,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
phd.getVPeak().clear();
|
phd.getVPeak().clear();
|
||||||
phd.setVPeak(oldPeak);
|
phd.setVPeak(oldPeak);
|
||||||
map.put("table", phd.getVPeak());
|
map.put("table", phd.getVPeak());
|
||||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, colorMap.get("Color_Peak"));
|
||||||
map.put("channelPeakChart", channelPeak);
|
map.put("channelPeakChart", channelPeak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1397,24 +1427,61 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
@Override
|
@Override
|
||||||
public Result deletePeak(String fileName, int curRow, HttpServletRequest request) {
|
public Result deletePeak(String fileName, int curRow, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
//获取用户名称
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(fileName + "-" + userName);
|
||||||
|
//获取PHDFile的缓存信息
|
||||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
||||||
if (Objects.isNull(phd)) {
|
if (Objects.isNull(phd)) {
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//获取颜色信息
|
||||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
//声明一个结果的map
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
//获取峰的大小
|
||||||
int peakNum = phd.getVPeak().size();
|
int peakNum = phd.getVPeak().size();
|
||||||
if (peakNum < 1) {
|
if (peakNum < 1) {
|
||||||
result.error500("No peak to delete.");
|
result.error500("No peak to delete.");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//判断当前要操作的下标是否在范围内
|
||||||
if (curRow >= 0 && curRow < peakNum) {
|
if (curRow >= 0 && curRow < peakNum) {
|
||||||
|
//获取当前下标位置的峰值信息
|
||||||
|
PeakInfo info = phd.getVPeak().get(curRow);
|
||||||
|
//获取当前选中的峰值信息的能量值
|
||||||
|
double energy = info.energy;
|
||||||
|
//遍历核素信息
|
||||||
|
for (String nuclideName : info.nuclides) {
|
||||||
|
//从缓存信息中获取核素名称
|
||||||
|
NuclideLines nuclideLines = nuclideMap.get(nuclideName);
|
||||||
|
//获取最大活度的核素位置
|
||||||
|
int maxYeildIdx = nuclideLines.maxYeildIdx;
|
||||||
|
//获取最大活度对应的核素能量值
|
||||||
|
Double maxEnergy = nuclideLines.getVenergy().get(maxYeildIdx);
|
||||||
|
//判断当前选中的峰值信息的能量值 是否在 最大活度对应的核素能量值公差范围内
|
||||||
|
if (energy >= maxEnergy-0.5 && energy <= maxEnergy+0.5) {
|
||||||
|
//则需要删除所有关联的核素信息并 从MapNucAct中移除相关核素内容
|
||||||
|
for (PeakInfo peakInfo: phd.getVPeak()) {
|
||||||
|
//如果峰的核素名称中包含当前删除的核素
|
||||||
|
if (peakInfo.nuclides.contains(nuclideName)) {
|
||||||
|
peakInfo.nuclides.remove(nuclideName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//从核素相关map中移除核素信息
|
||||||
|
phd.getMapNucActMda().remove(nuclideName);
|
||||||
|
//移除核素信息
|
||||||
|
nuclideMap.remove(nuclideName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//重新计算核素活度浓度
|
||||||
|
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
|
||||||
|
//将当前行从峰数组中移除
|
||||||
phd.getVPeak().remove(curRow);
|
phd.getVPeak().remove(curRow);
|
||||||
|
//重新分析数据
|
||||||
gammaFileUtil.PeaksChanged(phd);
|
gammaFileUtil.PeaksChanged(phd);
|
||||||
for (int i = 0; i < phd.getVPeak().size(); i++) {
|
for (int i = 0; i < phd.getVPeak().size(); i++) {
|
||||||
PeakInfo peakInfo = phd.getVPeak().get(i);
|
PeakInfo peakInfo = phd.getVPeak().get(i);
|
||||||
|
@ -1422,7 +1489,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
}
|
}
|
||||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||||
map.put("table", vPeak);
|
map.put("table", vPeak);
|
||||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, colorMap.get("Color_Peak"));
|
||||||
map.put("channelPeakChart", channelPeak);
|
map.put("channelPeakChart", channelPeak);
|
||||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
}
|
}
|
||||||
|
@ -1576,30 +1643,65 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
@Override
|
@Override
|
||||||
public Result deleteNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request) {
|
public Result deleteNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
//获取用户名
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(fileName + "-" + userName);
|
||||||
|
//缓存中获取缓存信息
|
||||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
||||||
if (Objects.isNull(phd)) {
|
if (Objects.isNull(phd)) {
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//判断当前选择的核素名称是否包含在当前Peak的核素列表中
|
||||||
int index = list_identify.indexOf(nuclideName);
|
int index = list_identify.indexOf(nuclideName);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
// 如果所选的行下标小于0 或者 超出界限 则不进行处理
|
// 如果所选的行下标小于0 或者 超出界限 则不进行处理
|
||||||
if (curRow < 0 || curRow >= phd.getVPeak().size()) {
|
if (curRow < 0 || curRow >= phd.getVPeak().size()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// 更新峰信息列表和表格
|
//从缓存信息中获取核素名称
|
||||||
// 根据核素名称获取对应的下标并从list_identify,phd.getVPeak()移除
|
NuclideLines nuclideLines = nuclideMap.get(nuclideName);
|
||||||
list_identify.remove(index);
|
//获取最大活度的核素位置
|
||||||
int peakNuclIndex = phd.getVPeak().get(curRow).nuclides.indexOf(nuclideName);
|
int maxYeildIdx = nuclideLines.maxYeildIdx;
|
||||||
phd.getVPeak().get(curRow).nuclides.remove(peakNuclIndex);
|
//获取最大活度对应的核素能量值
|
||||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
Double maxEnergy = nuclideLines.getVenergy().get(maxYeildIdx);
|
||||||
// 处理核素MDA、MDC
|
//获取当前选中的峰值信息的能量值
|
||||||
gammaFileUtil.ReCalcMdaMdc(phd, nuclideName, curRow + 1);
|
double energy = phd.getVPeak().get(curRow).energy;
|
||||||
map.put("identify", list_identify);
|
//判断当前选中的峰值信息的能量值 是否在 最大活度对应的核素能量值公差范围内
|
||||||
map.put("table", vPeak);
|
if (energy >= maxEnergy-0.5 && energy <= maxEnergy+0.5) {
|
||||||
|
//则需要删除所有关联的核素信息并 从MapNucAct中移除相关核素内容
|
||||||
|
for (PeakInfo peakInfo: phd.getVPeak()) {
|
||||||
|
//如果峰的核素名称中包含当前删除的核素
|
||||||
|
if (peakInfo.nuclides.contains(nuclideName)) {
|
||||||
|
peakInfo.nuclides.remove(nuclideName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//从核素相关map中移除核素信息
|
||||||
|
phd.getMapNucActMda().remove(nuclideName);
|
||||||
|
//移除核素信息
|
||||||
|
nuclideMap.remove(nuclideName);
|
||||||
|
//重新计算核素活度浓度
|
||||||
|
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
|
||||||
|
//从核素的选中列表中移除对应下标的核素信息
|
||||||
|
list_identify.remove(index);
|
||||||
|
//重新初始化峰列表信息
|
||||||
|
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||||
|
map.put("identify", list_identify);
|
||||||
|
map.put("table", vPeak);
|
||||||
|
} else {
|
||||||
|
// 更新峰信息列表和表格
|
||||||
|
// 根据核素名称获取对应的下标并从list_identify,phd.getVPeak()移除
|
||||||
|
list_identify.remove(index);
|
||||||
|
int peakNuclIndex = phd.getVPeak().get(curRow).nuclides.indexOf(nuclideName);
|
||||||
|
phd.getVPeak().get(curRow).nuclides.remove(peakNuclIndex);
|
||||||
|
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||||
|
// 处理核素MDA、MDC
|
||||||
|
gammaFileUtil.ReCalcMdaMdc(phd, nuclideName, curRow + 1);
|
||||||
|
map.put("identify", list_identify);
|
||||||
|
map.put("table", vPeak);
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
}
|
}
|
||||||
|
@ -1909,30 +2011,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
phd.setBaseCtrls(m_baseCtrl);
|
phd.setBaseCtrls(m_baseCtrl);
|
||||||
phd.setVBase(m_baseCtrl.getBaseline());
|
phd.setVBase(m_baseCtrl.getBaseline());
|
||||||
// }
|
// }
|
||||||
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);
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
// 确保绘制曲线时所有谱都是从1道开始
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
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);
|
|
||||||
}
|
|
||||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
|
||||||
map.put("barChart", differance);
|
map.put("barChart", differance);
|
||||||
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base"));
|
||||||
map.put("channelBaseLineChart", channelBaseLine);
|
map.put("channelBaseLineChart", channelBaseLine);
|
||||||
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_Peak"), m_nCount, null, false);
|
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_Peak"), phd.getSpec().getNum_g_channel(), null, false);
|
||||||
map.put("peakSet", peakSet);
|
map.put("peakSet", peakSet);
|
||||||
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
|
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
|
||||||
map.put("shapeData", shapeData);
|
map.put("shapeData", shapeData);
|
||||||
|
map.put("peak", phd.getVPeak());
|
||||||
// 更新主界面的 Chart
|
// 更新主界面的 Chart
|
||||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
|
|
|
@ -155,60 +155,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
result.error500("The database type does not exist");
|
result.error500("The database type does not exist");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
StringBuilder sbSql = new StringBuilder();
|
List<GardsSampleDataSpectrum> sampleData = spectrumAnalysisMapper.getDBSearchList(dbName, stationTypes, userStations, AllUsers);
|
||||||
sbSql.append("SELECT\n" +
|
|
||||||
" DISTINCT\n" +
|
|
||||||
" cfg_stations.station_code stationName,\n" +
|
|
||||||
" cfg_detectors.detector_code detectorsName\n" +
|
|
||||||
" FROM\n" +
|
|
||||||
" CONFIGURATION.GARDS_STATIONS cfg_stations,\n" +
|
|
||||||
" CONFIGURATION.GARDS_DETECTORS cfg_detectors,\n" +
|
|
||||||
" ORIGINAL.GARDS_SAMPLE_DATA org_samples,\n" +
|
|
||||||
" (SELECT analyses.sample_id FROM "+dbName+" analyses) analyses_sample_ids\n" +
|
|
||||||
" where\n" +
|
|
||||||
" org_samples.sample_id=analyses_sample_ids.sample_id\n" +
|
|
||||||
" AND org_samples.station_id=cfg_stations.station_id\n" +
|
|
||||||
" AND org_samples.detector_id=cfg_detectors.detector_id\n" +
|
|
||||||
" AND cfg_stations.type in (");
|
|
||||||
for (String f : stationTypes) {
|
|
||||||
sbSql.append("'").append(f).append("',");
|
|
||||||
}
|
|
||||||
|
|
||||||
sbSql = new StringBuilder(sbSql.substring(0, sbSql.length()-1));
|
|
||||||
sbSql.append(") ");
|
|
||||||
|
|
||||||
if (userStations.size() > 0) {
|
|
||||||
sbSql.append("and org_samples.station_id in (");
|
|
||||||
for (String f : userStations) {
|
|
||||||
sbSql.append("'").append(f).append("',");
|
|
||||||
}
|
|
||||||
sbSql = new StringBuilder(sbSql.substring(0, sbSql.length()-1));
|
|
||||||
sbSql.append(") ");
|
|
||||||
}
|
|
||||||
System.out.println(sbSql.toString());
|
|
||||||
List<GardsSampleDataSpectrum> sampleData = Lists.newArrayList();
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
try (Connection connection = jdbcTemplate.getDataSource().getConnection();
|
|
||||||
PreparedStatement statement = connection.prepareStatement(sbSql.toString());
|
|
||||||
ResultSet resultSet = statement.executeQuery()) {
|
|
||||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
|
||||||
int columnCount = metaData.getColumnCount();
|
|
||||||
while (resultSet.next()) {
|
|
||||||
|
|
||||||
GardsSampleDataSpectrum sp = new GardsSampleDataSpectrum();
|
|
||||||
sp.setStationName(resultSet.getObject(1).toString());
|
|
||||||
sp.setDetectorsName(resultSet.getObject(2).toString());
|
|
||||||
sampleData.add(sp);
|
|
||||||
for (int i = 1; i <= columnCount; i++) {
|
|
||||||
Object value = resultSet.getObject(i);
|
|
||||||
// 处理结果集的每一列数据
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println(">>>>>>>>>>>>>"+(System.currentTimeMillis() - start));
|
|
||||||
// List<GardsSampleDataSpectrum> sampleData = spectrumAnalysisMapper.getDBSearchList(dbName, stationTypes, userStations, AllUsers);
|
|
||||||
//获取台站编码
|
//获取台站编码
|
||||||
List<String> stationCodes = new LinkedList<>();
|
List<String> stationCodes = new LinkedList<>();
|
||||||
List<String> detectorCodes = new LinkedList<>();
|
List<String> detectorCodes = new LinkedList<>();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user