gamma缓存核素信息key修改
gamma生成日志,报告,保存公用方法增加标识区分 beta查看BG Log Viewer接口如果文件不存在则返回空内容
This commit is contained in:
parent
c9c1ab26bf
commit
e087e80196
|
@ -12,14 +12,18 @@ import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
import org.apache.commons.net.ftp.FTPFile;
|
||||||
import org.apache.commons.net.ftp.FTPReply;
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class Sample_G_Analysis {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行分析业务代码
|
// 执行分析业务代码
|
||||||
gammaFileUtil.GetMiddleData(phdFile, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData, MiddleDataType.Auto.getType());
|
gammaFileUtil.GetMiddleData(phdFile, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData, MiddleDataType.Auto.getType(), "");
|
||||||
|
|
||||||
// 数据插入数据库
|
// 数据插入数据库
|
||||||
this.storageDataToDatabase(middleData, phdFile.getQcItems());
|
this.storageDataToDatabase(middleData, phdFile.getQcItems());
|
||||||
|
|
|
@ -274,7 +274,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
String baselineFileName = prefixName+"_"+subFileName + ".baseline";
|
String baselineFileName = prefixName+"_"+subFileName + ".baseline";
|
||||||
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
|
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
|
||||||
inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
|
File file = ftpUtil.downloadFile(fromPathBase, "betaGamma");
|
||||||
|
inputStreamBase = new FileInputStream(file);
|
||||||
|
// inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
|
||||||
// 调用处理BaseCtrl的方法
|
// 调用处理BaseCtrl的方法
|
||||||
ReadBaseCtrlInfo(phd, inputStreamBase);
|
ReadBaseCtrlInfo(phd, inputStreamBase);
|
||||||
// 将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
|
// 将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
|
||||||
|
@ -2228,9 +2230,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
map.put("AllData", datalist);
|
map.put("AllData", datalist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String GetReportContent(PHDFile phd, String userName, boolean bLog) {
|
public String GetReportContent(PHDFile phd, String userName, boolean bLog, String flag) {
|
||||||
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
||||||
GetInterMiddlData(phd, userName, middleData);
|
GetInterMiddlData(phd, userName, middleData, flag);
|
||||||
if(bLog) {
|
if(bLog) {
|
||||||
return GetLogContent(middleData);
|
return GetLogContent(middleData);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2238,11 +2240,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean GetInterMiddlData(PHDFile phd, String userName, GStoreMiddleProcessData middleData) {
|
public boolean GetInterMiddlData(PHDFile phd, String userName, GStoreMiddleProcessData middleData, String flag) {
|
||||||
boolean bRet = true;
|
boolean bRet = true;
|
||||||
Map<String, NuclideLines> temp = new HashMap<>();
|
Map<String, NuclideLines> temp = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
bRet = GetMiddleData(phd, userName, temp,middleData, MiddleDataType.InterAction.getType());
|
bRet = GetMiddleData(phd, userName, temp,middleData, MiddleDataType.InterAction.getType(), flag);
|
||||||
middleData.analyses_type ="Interactive";
|
middleData.analyses_type ="Interactive";
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -2989,7 +2991,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean GetMiddleData(PHDFile fileAnlyse, String userName,Map<String, NuclideLines> nucline,GStoreMiddleProcessData middleData, String type) throws ParseException {
|
public boolean GetMiddleData(PHDFile fileAnlyse, String userName,Map<String, NuclideLines> nucline,GStoreMiddleProcessData middleData, String type, String flag) throws ParseException {
|
||||||
boolean bRet=true;
|
boolean bRet=true;
|
||||||
//标准名称规范化
|
//标准名称规范化
|
||||||
String dataType = fileAnlyse.getMsgInfo().getData_type();
|
String dataType = fileAnlyse.getMsgInfo().getData_type();
|
||||||
|
@ -3024,7 +3026,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
||||||
middleData.analyses_analysisBegin = anylseBegin;
|
middleData.analyses_analysisBegin = anylseBegin;
|
||||||
middleData.analyses_analysisEnd = anylseEnd;
|
middleData.analyses_analysisEnd = anylseEnd;
|
||||||
} else if (type.equals(MiddleDataType.InterAction.getType())){ //如果是人工交互分析 则先上传phd对应文件信息
|
} else if (type.equals(MiddleDataType.InterAction.getType()) && flag.equalsIgnoreCase("save")){ //如果是人工交互分析 则先上传phd对应文件信息
|
||||||
//上传本次文件到ftp人工交互存储路径下
|
//上传本次文件到ftp人工交互存储路径下
|
||||||
File sampleTmp = null;
|
File sampleTmp = null;
|
||||||
try {
|
try {
|
||||||
|
@ -3055,9 +3057,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
String qsSaveBaseLine = savePath + StringPool.SLASH + qsBaseLinePath;
|
String qsSaveBaseLine = savePath + StringPool.SLASH + qsBaseLinePath;
|
||||||
String qsSaveLc = savePath + StringPool.SLASH + qsLcPath;
|
String qsSaveLc = savePath + StringPool.SLASH + qsLcPath;
|
||||||
String qsSaveScac = savePath + StringPool.SLASH + qsScacPath;
|
String qsSaveScac = savePath + StringPool.SLASH + qsScacPath;
|
||||||
GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), rootPath + qsSaveBaseLine);
|
if((type.equals(MiddleDataType.Auto.getType())) || (type.equals(MiddleDataType.InterAction.getType()) && flag.equalsIgnoreCase("save")) ) {
|
||||||
GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", rootPath + qsSaveLc);
|
GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), rootPath + qsSaveBaseLine);
|
||||||
GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", rootPath + qsSaveScac);
|
GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", rootPath + qsSaveLc);
|
||||||
|
GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", rootPath + qsSaveScac);
|
||||||
|
}
|
||||||
|
|
||||||
double totalNumber = 0.0;
|
double totalNumber = 0.0;
|
||||||
for(int m=0;m<fileAnlyse.getSpec().getCounts().size();m++) {
|
for(int m=0;m<fileAnlyse.getSpec().getCounts().size();m++) {
|
||||||
|
|
|
@ -138,6 +138,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
private IGardsQcCheckSpectrumService qcCheckSpectrumService;
|
private IGardsQcCheckSpectrumService qcCheckSpectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
|
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
|
||||||
|
@Autowired
|
||||||
|
private FTPClient ftpClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
|
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
|
||||||
|
@ -169,7 +171,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
}
|
}
|
||||||
// 从数据库中读取相关信息
|
// 从数据库中读取相关信息
|
||||||
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
|
||||||
// 查询当前用户关联的核素信息
|
// 查询当前用户关联的核素信息
|
||||||
List<String> userLib = new LinkedList<>();
|
List<String> userLib = new LinkedList<>();
|
||||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
@ -178,7 +180,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
}
|
}
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -188,7 +190,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||||
String fileName = samfileName;
|
String fileName = samfileName;
|
||||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
|
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
|
||||||
if (!redisUtil.hasKey(userName)) {
|
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
|
||||||
// 查询当前用户关联的核素信息
|
// 查询当前用户关联的核素信息
|
||||||
List<String> userLib = new LinkedList<>();
|
List<String> userLib = new LinkedList<>();
|
||||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
@ -197,7 +199,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(userName, nuclideMap);
|
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
}
|
}
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -224,7 +226,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(fileName+"-"+userName);//GetNuclideLines(nuclides);
|
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
|
||||||
// 解析获取临时文件信息
|
// 解析获取临时文件信息
|
||||||
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
|
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
@ -472,7 +474,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
}
|
}
|
||||||
// 从数据库中读取phd其他相关信息
|
// 从数据库中读取phd其他相关信息
|
||||||
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||||
if (!redisUtil.hasKey(userName)) {
|
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
|
||||||
// 查询当前用户关联的核素信息
|
// 查询当前用户关联的核素信息
|
||||||
List<String> userLib = new LinkedList<>();
|
List<String> userLib = new LinkedList<>();
|
||||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
@ -481,7 +483,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(userName, nuclideMap);
|
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
}
|
}
|
||||||
// 判断数据库信息是否读取正常
|
// 判断数据库信息是否读取正常
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
|
@ -837,7 +839,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (!redisUtil.hasKey(userName)) {
|
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
|
||||||
// 查询当前用户关联的核素信息
|
// 查询当前用户关联的核素信息
|
||||||
List<String> userLib = new LinkedList<>();
|
List<String> userLib = new LinkedList<>();
|
||||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
@ -846,7 +848,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(userName, nuclideMap);
|
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新 ‘QC Flags’ 状态
|
// 更新 ‘QC Flags’ 状态
|
||||||
|
@ -1051,7 +1053,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
"2. You didn't change any setting or calibration.";
|
"2. You didn't change any setting or calibration.";
|
||||||
result.error500(warning);
|
result.error500(warning);
|
||||||
} else if (flag == -1) {
|
} else if (flag == -1) {
|
||||||
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(fileName+"-"+userName);//GetNuclideLines(nuclides);
|
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
|
||||||
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
|
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
|
||||||
gammaFileUtil.RunQC(phd);
|
gammaFileUtil.RunQC(phd);
|
||||||
String warning = "Finish three tasks:\n" +
|
String warning = "Finish three tasks:\n" +
|
||||||
|
@ -1060,7 +1062,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
"\t3.Test QC again.";
|
"\t3.Test QC again.";
|
||||||
result.error500(warning);
|
result.error500(warning);
|
||||||
} else {
|
} else {
|
||||||
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(fileName+"-"+userName);//GetNuclideLines(nuclides);
|
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
|
||||||
gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
|
gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
|
||||||
// 重新分析各峰值对应的核素信息
|
// 重新分析各峰值对应的核素信息
|
||||||
// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
|
// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
|
||||||
|
@ -1467,8 +1469,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
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的缓存信息
|
//获取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);
|
||||||
|
@ -1476,6 +1476,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//获取缓存的核素信息
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
|
||||||
//获取颜色信息
|
//获取颜色信息
|
||||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
//声明一个结果的map
|
//声明一个结果的map
|
||||||
|
@ -1657,7 +1659,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
// if (CollectionUtils.isEmpty(userLib)) {
|
// if (CollectionUtils.isEmpty(userLib)) {
|
||||||
// userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
// userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
// }
|
// }
|
||||||
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(fileName+"-"+userName);//GetNuclideLines(userLib);
|
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(userLib);
|
||||||
// 查询出核素信息
|
// 查询出核素信息
|
||||||
NuclideLines it_line = mapNucLines.get(nuclideName);
|
NuclideLines it_line = mapNucLines.get(nuclideName);
|
||||||
// 如果核素信息不存在返回
|
// 如果核素信息不存在返回
|
||||||
|
@ -1686,8 +1688,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
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, 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);
|
||||||
|
@ -1695,6 +1695,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
|
||||||
//判断当前选择的核素名称是否包含在当前Peak的核素列表中
|
//判断当前选择的核素名称是否包含在当前Peak的核素列表中
|
||||||
int index = list_identify.indexOf(nuclideName);
|
int index = list_identify.indexOf(nuclideName);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -3575,7 +3577,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
}
|
}
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
} else {
|
} else {
|
||||||
result.success("Modification failure!");
|
result.success("Modification failure!");
|
||||||
}
|
}
|
||||||
|
@ -3683,7 +3685,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
||||||
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
||||||
// 连接ftp
|
// 连接ftp
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
if (Objects.isNull(ftpClient)) {
|
if (Objects.isNull(ftpClient)) {
|
||||||
throw new RuntimeException("ftp connection failed");
|
throw new RuntimeException("ftp connection failed");
|
||||||
}
|
}
|
||||||
|
@ -3711,14 +3712,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(ftpClient)) {
|
// if (Objects.nonNull(ftpClient)) {
|
||||||
ftpClient.disconnect();
|
// ftpClient.disconnect();
|
||||||
}
|
// }
|
||||||
if (ObjectUtil.isNotNull(inputStream)) {
|
if (ObjectUtil.isNotNull(inputStream)) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(outputStream)) {
|
if (ObjectUtil.isNotNull(outputStream)) {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
ftpClient.completePendingCommand();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -3733,7 +3735,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
||||||
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
||||||
// 连接ftp
|
// 连接ftp
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = null;
|
||||||
if (Objects.isNull(ftpClient)) {
|
if (Objects.isNull(ftpClient)) {
|
||||||
throw new RuntimeException("ftp connection failed");
|
throw new RuntimeException("ftp connection failed");
|
||||||
}
|
}
|
||||||
|
@ -3765,14 +3767,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(ftpClient)) {
|
// if (Objects.nonNull(ftpClient)) {
|
||||||
ftpClient.disconnect();
|
// ftpClient.disconnect();
|
||||||
}
|
// }
|
||||||
if (ObjectUtil.isNotNull(inputStream)) {
|
if (ObjectUtil.isNotNull(inputStream)) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(outputStream)) {
|
if (ObjectUtil.isNotNull(outputStream)) {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
ftpClient.completePendingCommand();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -3790,7 +3793,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
String reportContent = gammaFileUtil.GetReportContent(phd, userName, false);
|
String reportContent = gammaFileUtil.GetReportContent(phd, userName, false, "log");
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(reportContent);
|
result.setResult(reportContent);
|
||||||
return result;
|
return result;
|
||||||
|
@ -3804,7 +3807,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (Objects.isNull(phd)) {
|
if (Objects.isNull(phd)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String reportContent = gammaFileUtil.GetReportContent(phd, userName, false);
|
String reportContent = gammaFileUtil.GetReportContent(phd, userName, false, "log");
|
||||||
OutputStream fos = null;
|
OutputStream fos = null;
|
||||||
try {
|
try {
|
||||||
// 设置响应类型
|
// 设置响应类型
|
||||||
|
@ -4271,7 +4274,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
|
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
|
||||||
String fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
|
String fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
|
||||||
// 连接ftp
|
// 连接ftp
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
if (Objects.isNull(ftpClient)) {
|
if (Objects.isNull(ftpClient)) {
|
||||||
throw new RuntimeException("ftp connection failed");
|
throw new RuntimeException("ftp connection failed");
|
||||||
}
|
}
|
||||||
|
@ -4324,7 +4326,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
result.error500("Please select the parse file first!");
|
result.error500("Please select the parse file first!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
String reportContent = gammaFileUtil.GetReportContent(phd, userName, true);
|
String reportContent = gammaFileUtil.GetReportContent(phd, userName, true, "log");
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(reportContent);
|
result.setResult(reportContent);
|
||||||
return result;
|
return result;
|
||||||
|
@ -4416,7 +4418,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
// 如果有权限则开始保存数据库操作
|
// 如果有权限则开始保存数据库操作
|
||||||
// 将PHDFile数据 生成用于数据库存储的数据结构
|
// 将PHDFile数据 生成用于数据库存储的数据结构
|
||||||
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
||||||
bRet = gammaFileUtil.GetInterMiddlData(phd, userName, middleData);
|
bRet = gammaFileUtil.GetInterMiddlData(phd, userName, middleData, "save");
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
|
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -518,8 +518,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
Map<String, Object> gasBgMap = new HashMap<>();
|
Map<String, Object> gasBgMap = new HashMap<>();
|
||||||
Map<String, Object> detBgMap = new HashMap<>();
|
Map<String, Object> detBgMap = new HashMap<>();
|
||||||
Map<String, Object> qcMap = new HashMap<>();
|
Map<String, Object> qcMap = new HashMap<>();
|
||||||
boolean bProcessed = false;
|
|
||||||
boolean savedAnalysisResult = false;
|
|
||||||
//页面展示结果数组
|
//页面展示结果数组
|
||||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||||
//获取本地缓存信息
|
//获取本地缓存信息
|
||||||
|
@ -3494,13 +3492,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
FileInputStream inputStream = null;
|
FileInputStream inputStream = null;
|
||||||
OutputStream fos = null;
|
OutputStream fos = null;
|
||||||
try {
|
try {
|
||||||
inputStream = new FileInputStream(new File(logFilePath));
|
File file = new File(logFilePath);
|
||||||
fos = response.getOutputStream();
|
if (file.exists()) {
|
||||||
byte[] buffer = new byte[1024];
|
inputStream = new FileInputStream(file);
|
||||||
int bytesRead;
|
fos = response.getOutputStream();
|
||||||
// 将文件输出流写入到输出流中
|
byte[] buffer = new byte[1024];
|
||||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
int bytesRead;
|
||||||
fos.write(buffer, 0, bytesRead);
|
// 将文件输出流写入到输出流中
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
fos.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user