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));
|
||||
if(StringUtils.isNotBlank(subFileName)){
|
||||
|
||||
//连接ftp
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
if (Objects.isNull(ftpClient)){
|
||||
|
@ -270,8 +269,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
List<Double> vData = ReadLcScacInfo(readLines);
|
||||
//将数据结果赋值给 phdFile的vLc
|
||||
phd.setVLc(vData);
|
||||
// 删除临时文件
|
||||
//file.delete();
|
||||
}
|
||||
} catch (IOException 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) {
|
||||
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<>();
|
||||
//获取 phdFile的Spec的num_g_channel
|
||||
|
@ -1009,19 +1019,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
if(m_nSChan == 0) {
|
||||
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;
|
||||
long end = -1;
|
||||
//Energy
|
||||
|
@ -1033,10 +1031,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
if(end < 1 || 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.setX(phd.getVEnergy().get(i));
|
||||
seriseData.setY(m_vCount.get(i));
|
||||
seriseData.setX(phd.getVEnergy().get(j));
|
||||
seriseData.setY(m_vCount.get(j));
|
||||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
data1.setName("Energy");
|
||||
|
@ -1046,7 +1044,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
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;
|
||||
long end = -1;
|
||||
ChartData data1 = new ChartData();
|
||||
|
@ -1057,10 +1070,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
if(end < 1 || 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.setX(i+1);
|
||||
seriseData.setY(m_vCount.get(i));
|
||||
seriseData.setX(j+1);
|
||||
seriseData.setY(m_vCount.get(j));
|
||||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
data1.setName("Count");
|
||||
|
@ -1070,7 +1083,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
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<>();
|
||||
int start = 0;
|
||||
long end = -1;
|
||||
|
@ -1183,12 +1197,12 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
return datalist;
|
||||
}
|
||||
|
||||
public List<ChartData> Channel_Peak(PHDFile phd, long m_nCount, String color) {
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, null, false);
|
||||
public List<ChartData> Channel_Peak(PHDFile phd, String color) {
|
||||
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) {
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, phd.getUsedEnerPara().getP(), true);
|
||||
public List<ChartData> Energy_Peak(PHDFile phd, String color) {
|
||||
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) {
|
||||
|
@ -1224,7 +1238,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
|
||||
for(int i=startPeak; i<=endPeak; i++) {
|
||||
PeakInfo peak = vPeak.get(i);
|
||||
|
||||
ChartData cData = new ChartData();
|
||||
cData.setColor(color);
|
||||
cData.setName("Peak");
|
||||
|
@ -1259,7 +1272,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
}
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(regChan.get(ii));
|
||||
seriseData.setY(regPeak.get(ii));
|
||||
seriseData.setY(regPeak.get(ii).isNaN()?0:regPeak.get(ii));
|
||||
cData.getPointlist().add(seriseData);
|
||||
}
|
||||
}
|
||||
|
@ -1303,13 +1316,13 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
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<>();
|
||||
datalist.add(Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
||||
datalist.add(Energy_Count(phd, m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
||||
datalist.addAll(Lc_Scac_base(showLc, phd, m_nCount, colorMap));
|
||||
datalist.addAll(Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
||||
datalist.addAll(Energy_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
||||
datalist.add(Channel_Count(phd, colorMap.get("Color_Spec")));
|
||||
datalist.add(Energy_Count(phd, colorMap.get("Color_Spec")));
|
||||
datalist.addAll(Lc_Scac_base(showLc, phd, colorMap));
|
||||
datalist.addAll(Channel_Peak(phd, colorMap.get("Color_Peak")));
|
||||
datalist.addAll(Energy_Peak(phd, colorMap.get("Color_Peak")));
|
||||
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();
|
||||
int start =0;
|
||||
long end = -1;
|
||||
|
@ -1892,7 +1906,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
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<>();
|
||||
int start =0;
|
||||
long end = -1;
|
||||
|
@ -1928,8 +1957,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
|
||||
List<Double> regPeak = new LinkedList<>();
|
||||
int channel = 1;
|
||||
for(int i=start-1; i<end; i++) {
|
||||
channel = i + 1;
|
||||
for(int j=start-1; j<end; j++) {
|
||||
channel = j + 1;
|
||||
PeakInfo peak = vecPeak.get(startPeak);
|
||||
if(channel >= peak.left && channel <= peak.right) {
|
||||
if(CollectionUtils.isEmpty(regPeak)) {
|
||||
|
@ -1944,12 +1973,12 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
// 差值 = 原谱值 - 峰面积
|
||||
SeriseData seriseData = new SeriseData();
|
||||
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);
|
||||
} 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.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);
|
||||
} else{
|
||||
SeriseData seriseData = new SeriseData();
|
||||
|
@ -1959,21 +1988,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
}
|
||||
|
||||
if(vecPeak.get(startPeak).right < channel) {
|
||||
++startPeak; regPeak.clear();
|
||||
++startPeak;
|
||||
regPeak.clear();
|
||||
}
|
||||
if(startPeak > endPeak){
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(int i=channel; i<end; i++) {
|
||||
if(m_vCount.get(i) > 0 && phd.getVBase().get(i) > 0) {
|
||||
for(int j=channel; j<end; j++) {
|
||||
if(m_vCount.get(j) > 0 && phd.getVBase().get(j) > 0) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i+1);
|
||||
seriseData.setY(m_vCount.get(i) - phd.getVBase().get(i));
|
||||
seriseData.setX(j+1);
|
||||
seriseData.setY(m_vCount.get(j) - phd.getVBase().get(j));
|
||||
pointlist.add(seriseData);
|
||||
} else {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i+1);
|
||||
seriseData.setX(j+1);
|
||||
seriseData.setY(0);
|
||||
pointlist.add(seriseData);
|
||||
}
|
||||
|
@ -3882,8 +3912,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
int j = i;
|
||||
double temp = channel - peak.peakCentroid;
|
||||
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);
|
||||
i = j;
|
||||
}
|
||||
|
@ -3910,6 +3940,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
for(int i=0; i<vPeak.size(); i++) {
|
||||
PeakInfo peakInfo = new PeakInfo();
|
||||
peakInfo.index = i+1;
|
||||
peakInfo.left = vPeak.get(i).left;
|
||||
peakInfo.right = vPeak.get(i).right;
|
||||
BigDecimal energy = new BigDecimal(vPeak.get(i).energy);
|
||||
energy = energy.setScale(3, RoundingMode.HALF_UP);
|
||||
peakInfo.energy = energy.doubleValue();
|
||||
|
@ -3952,7 +3984,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
NuclideActMda ActMda = new NuclideActMda();
|
||||
ActMda.setHalflife(Objects.isNull(mapHalflife.get(nucName))?lines.halflife : mapHalflife.get(nucName));
|
||||
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;
|
||||
if(vEnergy.get(i) < energy - energyWidth) {
|
||||
break;
|
||||
|
@ -4005,18 +4037,22 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
// 否则删除该核素与该峰所有关联的射线信息
|
||||
boolean needReCalc = false;
|
||||
for(int i=nuc.getVPeakIdx().size()-1; i>=0; i--) {
|
||||
//判断当前下标对应的核素下标是否是需要删除的下标
|
||||
if(nuc.getVPeakIdx().get(i) == removePeakIdx) {
|
||||
nuc.getVEnergy().remove(i);
|
||||
nuc.getVUncertE().remove(i);
|
||||
nuc.getVYield().remove(i);
|
||||
nuc.getVUncertY().remove(i);
|
||||
nuc.getFullNames().remove(i);
|
||||
//判断主峰核素下标是否与当前下标一致 且 BCalculateMDA是true
|
||||
if(nuc.getCalculateIdx() == i && nuc.isBCalculateMDA()) {
|
||||
needReCalc = true;
|
||||
}
|
||||
nuc.setCalculateIdx(nuc.getVEnergy().size()-1);
|
||||
nuc.getVPeakIdx().remove(i);
|
||||
}
|
||||
}
|
||||
nuc.getVPeakIdx().remove(removePeakIdx);
|
||||
|
||||
// 如果该核素只与一个峰对应则直接删除该核素的 MDA 信息
|
||||
if(nuc.getVPeakIdx().size() < 1) {
|
||||
phd.getMapNucActMda().remove(nuclide);
|
||||
|
@ -4026,7 +4062,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
if(needReCalc) {
|
||||
double maxYield = 0;
|
||||
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) {
|
||||
nuc.setCalculateIdx(j);
|
||||
maxYield = nuc.getVYield().get(j);
|
||||
|
@ -4486,7 +4522,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
String number1 = RightFill(String.valueOf(j), 5);
|
||||
String number2 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
||||
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 number3 = RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10);
|
||||
spectrum.append(rowFormat(spectrumData4, number3));
|
||||
|
@ -4503,7 +4539,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
ChartData cData = new ChartData();
|
||||
cData.setColor(color);
|
||||
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.setX(i+1);
|
||||
seriseData.setY(m_baseCtrl.getBaseline().get(i));
|
||||
|
@ -4514,7 +4550,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
|
||||
public List<ShapeData> CreateShapeCP(BaseControls baseControls) {
|
||||
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();
|
||||
shape.setType("Shape_Round");
|
||||
shape.setName("tmpCP"+i);
|
||||
|
|
|
@ -89,6 +89,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Autowired
|
||||
private UserTaskUtil userTaskUtil;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private ISysDefaultNuclideSpectrumService defaultNuclideSpectrumService;
|
||||
@Autowired
|
||||
private ISysUserColorService sysUserColorService;
|
||||
|
@ -138,12 +140,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Override
|
||||
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
//
|
||||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = new PHDFile();
|
||||
// 读取文件内容
|
||||
String lastName = "";
|
||||
String key = "";
|
||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||
// 根据sampleId获取sample文件路径
|
||||
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||
|
@ -164,7 +166,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
if (!bRet) {
|
||||
return result;
|
||||
}
|
||||
lastName = fileName;
|
||||
key = fileName + "-" + userName;
|
||||
} else {
|
||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
String fileName = samfileName;
|
||||
|
@ -172,9 +174,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
if (!flag) {
|
||||
return result;
|
||||
}
|
||||
lastName = fileName;
|
||||
key = fileName + "-" + userName;
|
||||
}
|
||||
phdCache.put(lastName, phd);
|
||||
phdCache.put(key, phd);
|
||||
localCache.setPHDCache(phdCache);
|
||||
result.setSuccess(true);
|
||||
result.setResult(phd);
|
||||
|
@ -443,6 +445,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
gammaFileUtil.SetBaseInfo(phd);
|
||||
// 从数据库中读取phd其他相关信息
|
||||
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) {
|
||||
return result;
|
||||
|
@ -465,6 +476,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
||||
map.put("bAnalyed", phd.isBAnalyed());
|
||||
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);
|
||||
// 将当前加载的phd信息加入到缓存中 文件名称作为缓存信息的key
|
||||
|
@ -784,6 +798,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd = new PHDFile();
|
||||
// 加载文件内容
|
||||
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) {
|
||||
return result;
|
||||
}
|
||||
|
@ -803,6 +826,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
||||
map.put("bAnalyed", phd.isBAnalyed());
|
||||
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);
|
||||
phdCache.put(fileName + "-" + userName, phd);
|
||||
localCache.setPHDCache(phdCache);
|
||||
|
@ -1007,6 +1033,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
map.put("QCFlag", qcstate);
|
||||
map.put("bAnalyed", phd.isBAnalyed());
|
||||
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.setResult(map);
|
||||
}
|
||||
|
@ -1073,16 +1103,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
if (m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
ChartData channelCountChart = gammaFileUtil.Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
||||
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
||||
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
||||
ChartData channelCountChart = gammaFileUtil.Channel_Count(phd, colorMap.get("Color_Spec"));
|
||||
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base"));
|
||||
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, colorMap.get("Color_Peak"));
|
||||
List<ShapeData> channelBaseCPChart = gammaFileUtil.Channel_BaseCP(phd);
|
||||
map.put("channelCountChart", channelCountChart);
|
||||
map.put("channelBaseLineChart", channelBaseLineChart);
|
||||
map.put("channelPeakChart", channelPeakChart);
|
||||
map.put("channelBaseCPChart", channelBaseCPChart);
|
||||
// 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);
|
||||
// 赋值energy
|
||||
map.put("energy", phd.getVEnergy());
|
||||
|
@ -1370,11 +1400,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
|
||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||
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);
|
||||
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);
|
||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||
map.put("barChart", differance);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
} else {// 如果不保留 根据下标移除对应的vPeak数据
|
||||
|
@ -1382,7 +1412,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd.getVPeak().clear();
|
||||
phd.setVPeak(oldPeak);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1397,24 +1427,61 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Override
|
||||
public Result deletePeak(String fileName, int curRow, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
//获取用户名称
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取缓存的核素信息
|
||||
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(fileName + "-" + userName);
|
||||
//获取PHDFile的缓存信息
|
||||
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;
|
||||
}
|
||||
//获取颜色信息
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
//声明一个结果的map
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
//获取峰的大小
|
||||
int peakNum = phd.getVPeak().size();
|
||||
if (peakNum < 1) {
|
||||
result.error500("No peak to delete.");
|
||||
return result;
|
||||
}
|
||||
//判断当前要操作的下标是否在范围内
|
||||
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);
|
||||
|
||||
//重新分析数据
|
||||
gammaFileUtil.PeaksChanged(phd);
|
||||
for (int i = 0; i < phd.getVPeak().size(); 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());
|
||||
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);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
}
|
||||
|
@ -1576,30 +1643,65 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Override
|
||||
public Result deleteNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(fileName + "-" + userName);
|
||||
//缓存中获取缓存信息
|
||||
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;
|
||||
}
|
||||
//判断当前选择的核素名称是否包含在当前Peak的核素列表中
|
||||
int index = list_identify.indexOf(nuclideName);
|
||||
if (index >= 0) {
|
||||
// 如果所选的行下标小于0 或者 超出界限 则不进行处理
|
||||
if (curRow < 0 || curRow >= phd.getVPeak().size()) {
|
||||
return result;
|
||||
}
|
||||
// 更新峰信息列表和表格
|
||||
// 根据核素名称获取对应的下标并从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);
|
||||
//从缓存信息中获取核素名称
|
||||
NuclideLines nuclideLines = nuclideMap.get(nuclideName);
|
||||
//获取最大活度的核素位置
|
||||
int maxYeildIdx = nuclideLines.maxYeildIdx;
|
||||
//获取最大活度对应的核素能量值
|
||||
Double maxEnergy = nuclideLines.getVenergy().get(maxYeildIdx);
|
||||
//获取当前选中的峰值信息的能量值
|
||||
double energy = phd.getVPeak().get(curRow).energy;
|
||||
//判断当前选中的峰值信息的能量值 是否在 最大活度对应的核素能量值公差范围内
|
||||
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.setResult(map);
|
||||
}
|
||||
|
@ -1909,30 +2011,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd.setBaseCtrls(m_baseCtrl);
|
||||
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);
|
||||
// 确保绘制曲线时所有谱都是从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> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
|
|
@ -155,60 +155,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
result.error500("The database type does not exist");
|
||||
return result;
|
||||
}
|
||||
StringBuilder sbSql = new StringBuilder();
|
||||
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<GardsSampleDataSpectrum> sampleData = spectrumAnalysisMapper.getDBSearchList(dbName, stationTypes, userStations, AllUsers);
|
||||
//获取台站编码
|
||||
List<String> stationCodes = new LinkedList<>();
|
||||
List<String> detectorCodes = new LinkedList<>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user