Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
bc59a15887
|
@ -11,6 +11,11 @@ import java.io.Serializable;
|
|||
@ConfigurationProperties(prefix = "parameter")
|
||||
public class ParameterProperties implements Serializable {
|
||||
|
||||
/**
|
||||
* 分析后生成的日志文件路径
|
||||
*/
|
||||
private String logFilePath;
|
||||
|
||||
/**
|
||||
* 算法计算需要用到的文件存储路径
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,8 @@ public class AnalyseData implements Serializable {
|
|||
|
||||
private String currentFileName;
|
||||
|
||||
private String currentQCFileName;
|
||||
|
||||
private boolean sampleData;
|
||||
|
||||
private boolean gasBgData;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -216,8 +216,8 @@ public class SpectrumAnalysesController {
|
|||
|
||||
@GetMapping("viewBGLogViewer")
|
||||
@ApiOperation(value = "查看BG Log Viewer数据", notes = "查看BG Log Viewer数据")
|
||||
public Result viewBGLogViewer(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
return null;
|
||||
public void viewBGLogViewer(String sampleFileName, HttpServletResponse response) {
|
||||
spectrumAnalysisService.viewBGLogViewer(sampleFileName, response);
|
||||
}
|
||||
|
||||
@PostMapping("saveToDB")
|
||||
|
|
|
@ -76,7 +76,7 @@ public interface ISpectrumAnalysisService {
|
|||
|
||||
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
||||
|
||||
Result viewBGLogViewer(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
|
||||
void viewBGLogViewer(String sampleFileName, HttpServletResponse response);
|
||||
|
||||
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request);
|
||||
|
||||
|
|
|
@ -2519,6 +2519,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
try {
|
||||
// 设置响应类型
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
// 解决中文不能生成文件
|
||||
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("EnergyCalibration.Ent", "UTF-8"));
|
||||
fos = response.getOutputStream();
|
||||
|
@ -2792,6 +2793,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
try {
|
||||
// 设置响应类型
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
// 解决中文不能生成文件
|
||||
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("ResolutionCalibration.Ent", "UTF-8"));
|
||||
fos = response.getOutputStream();
|
||||
|
@ -3075,6 +3077,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
try {
|
||||
// 设置响应类型
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
// 解决中文不能生成文件
|
||||
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("EfficiencyCalibration.Eft", "UTF-8"));
|
||||
fos = response.getOutputStream();
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.common.cache.BetaCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
|
@ -57,6 +58,7 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.*;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -83,6 +85,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Autowired
|
||||
private SpectrumPathProperties spectrumPathProperties;
|
||||
@Autowired
|
||||
private ParameterProperties parameterProperties;
|
||||
@Autowired
|
||||
private UserTaskUtil userTaskUtil;
|
||||
@Autowired
|
||||
private PHDFileUtil phdFileUtil;
|
||||
|
@ -3103,6 +3107,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
|
||||
//获取当前选中的文件名称
|
||||
String currentFileName = analyseData.getCurrentFileName();
|
||||
String currentQCFileName = analyseData.getCurrentQCFileName();
|
||||
List<Map<String, String>> loadDataList = new LinkedList<>();
|
||||
for (int i=0; i<analyseData.getSampleIds().size(); i++) {
|
||||
Map<String, String> m_loadData = new HashMap<>();
|
||||
|
@ -3154,7 +3159,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
m_loadData.put("qcFileName", qcFileName);
|
||||
loadDataList.add(m_loadData);
|
||||
}
|
||||
List<GardsXeResultsSpectrum> analyseResultList = BetaGammaAnalyzeAllProcess(loadDataList, analyseData, userName, currentFileName);
|
||||
List<GardsXeResultsSpectrum> analyseResultList = BetaGammaAnalyzeAllProcess(loadDataList, analyseData, userName, currentFileName, currentQCFileName);
|
||||
map.put("XeData", analyseResultList);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
|
@ -3284,6 +3289,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
|
||||
//调用重新分析算法 获取算法结果
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入分析用到的数据
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入计算后得到的xeData数据
|
||||
|
@ -3385,7 +3396,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return xeResultsSpectrumList;
|
||||
}
|
||||
|
||||
private List<GardsXeResultsSpectrum> BetaGammaAnalyzeAllProcess(List<Map<String, String>> loadDataList, AnalyseData analyseData, String userName, String currentFileName){
|
||||
private List<GardsXeResultsSpectrum> BetaGammaAnalyzeAllProcess(List<Map<String, String>> loadDataList, AnalyseData analyseData, String userName, String currentFileName, String currentQCFileName){
|
||||
Map<String, List<GardsXeResultsSpectrum>> analyseResultMap = new HashMap<>();
|
||||
File sampleTmp = null;
|
||||
File gasTmp = null;
|
||||
|
@ -3409,7 +3420,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
//从本地缓存获取beta gamma的数组
|
||||
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
|
||||
//根据qc文件名称-用户名-beta的方式获取beta的内容
|
||||
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
|
||||
Map<String, Object> betaMap = cache.getIfPresent(currentQCFileName + "-" + userName + "-beta");
|
||||
List<SeriseData> betaList = new LinkedList<>();
|
||||
List<String> betaFittingPara = new LinkedList<>();
|
||||
List<String> betaFittingParaToUi = new LinkedList<>();
|
||||
|
@ -3417,9 +3428,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
betaList = (List<SeriseData>)betaMap.get("Series");
|
||||
betaFittingPara = (List<String>) betaMap.get("fittingPara");
|
||||
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
|
||||
cache.put(qcFileName+ "-" + userName + "-beta", betaMap);
|
||||
}
|
||||
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
|
||||
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
|
||||
Map<String, Object> gammaMap = cache.getIfPresent(currentQCFileName + "-" + userName + "-gamma");
|
||||
List<SeriseData> gammaList = new LinkedList<>();
|
||||
List<String> gammaFittingPara = new LinkedList<>();
|
||||
List<String> gammaFittingParaToUi = new LinkedList<>();
|
||||
|
@ -3427,6 +3439,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gammaList = (List<SeriseData>)gammaMap.get("Series");
|
||||
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
|
||||
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
|
||||
cache.put(qcFileName+ "-" + userName + "-gamma", gammaMap);
|
||||
}
|
||||
|
||||
if (analyseData.isBetaEnergyValid()) {
|
||||
|
@ -3491,6 +3504,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
|
||||
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入重新分析的参数
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入xeData数据
|
||||
|
@ -3923,75 +3942,34 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result viewBGLogViewer(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//从本地缓存获取beta gamma的数组
|
||||
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
|
||||
//拼接ftp上传临时文件路径
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
//声明一个实体类获取数据库中文件路径
|
||||
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
|
||||
Integer analysisID = null;
|
||||
String samplePath = "";
|
||||
String gasPath = "";
|
||||
String detPath = "";
|
||||
String qcPath = "";
|
||||
File sampleTmp = null;
|
||||
File gasTmp = null;
|
||||
File detTmp = null;
|
||||
BgCalibratePara BgCalPara = null;
|
||||
public void viewBGLogViewer(String sampleFileName, HttpServletResponse response) {
|
||||
//日志路径及名称
|
||||
String logFilePath = parameterProperties.getLogFilePath() + File.separator + DateUtils.formatDate(new Date(), "yyyy-MM-dd") + File.separator + sampleFileName.replace("PHD", "log");
|
||||
FileInputStream inputStream = null;
|
||||
OutputStream fos = null;
|
||||
try {
|
||||
//如果sampleId不为空 说明数据来源数据库 查询出对应的文件路径
|
||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
} else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
inputStream = new FileInputStream(new File(logFilePath));
|
||||
fos = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
// 将文件输出流写入到输出流中
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, bytesRead);
|
||||
}
|
||||
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
|
||||
samplePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
|
||||
gasPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
detPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
||||
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
|
||||
if (StringUtils.isNotBlank(dbQcFilePath)) {
|
||||
qcPath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
|
||||
}
|
||||
} else if ( (Objects.isNull(sampleId) && StringUtils.isNotBlank(dbName)) || (Objects.nonNull(sampleId) && StringUtils.isBlank(dbName)) ){
|
||||
result.error500("Data load From DB need to pass in sampleId and dbName");
|
||||
return result;
|
||||
} else {//如果sampleId,dbNamed都为空 就指向ftp上传文件临时路径
|
||||
samplePath = path;
|
||||
gasPath = path;
|
||||
detPath = path;
|
||||
qcPath = path;
|
||||
}
|
||||
//根据文件路径 文件名称获取对应的临时文件
|
||||
sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
|
||||
gasTmp = phdFileUtil.analyzeFile(gasPath, gasFileName);
|
||||
detTmp = phdFileUtil.analyzeFile(detPath, detFileName);
|
||||
//调用动态库解析文件
|
||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||
BgAnalyseResult bgAnalyseResult = null;
|
||||
if (Objects.isNull(BgCalPara)) {
|
||||
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
|
||||
} else {
|
||||
bgAnalyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
|
||||
}
|
||||
//拿分析的结果去生成日志内容
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
try {
|
||||
if (Objects.nonNull(inputStream)) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (Objects.nonNull(fos)) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user