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

This commit is contained in:
nieziyan 2023-10-16 18:19:36 +08:00
commit fcaf1b8519
10 changed files with 501 additions and 298 deletions

View File

@ -34,6 +34,8 @@ public class SpectrumPathProperties implements Serializable {
*/ */
private String emlPath; private String emlPath;
private String saveFilePath;
/** /**
* 日志文件存储路径 * 日志文件存储路径
*/ */

View File

@ -3105,9 +3105,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
String qsSaveBaseLine = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsBaseLinePath; String qsSaveBaseLine = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsBaseLinePath;
String qsSaveLc = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsLcPath; String qsSaveLc = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsLcPath;
String qsSaveScac = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsScacPath; String qsSaveScac = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsScacPath;
GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), qsSaveBaseLine); GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), qsSaveBaseLine);
GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", qsSaveLc); GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", qsSaveLc);
GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", qsSaveScac); GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", qsSaveScac);
@ -3136,9 +3136,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
middleData.analyses_baseline_absolute_filePath =qsSaveLc; middleData.analyses_baseline_absolute_filePath =qsSaveLc;
middleData.analyses_lc_absolute_filePath=qsSaveLc; middleData.analyses_lc_absolute_filePath=qsSaveLc;
middleData.analyses_scac_absolute_filePath=qsSaveScac; middleData.analyses_scac_absolute_filePath=qsSaveScac;
middleData.analyses_save_absolute_filePath=spectrumPathProperties.getRootPath()+StringPool.SLASH+qsSaveFile; middleData.analyses_save_absolute_filePath=spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsSaveFile;
middleData.analyses_absolute_LogPath=spectrumPathProperties.getLogPath()+StringPool.SLASH+qsLogPath; middleData.analyses_absolute_LogPath=spectrumPathProperties.getLogPath()+StringPool.SLASH+qsLogPath;
middleData.analyses_absolute_ReportPath=spectrumPathProperties.getRootPath()+StringPool.SLASH+qsReportPath; middleData.analyses_absolute_ReportPath=spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsReportPath;
if(fileAnlyse.getUsedEnerKD() != null && fileAnlyse.getUsedEnerKD().getG_energy().size() != 0) { if(fileAnlyse.getUsedEnerKD() != null && fileAnlyse.getUsedEnerKD().getG_energy().size() != 0) {
middleData.calibration_pairs_E_Caltype = CalType.ENERGY_CAL.getType(); middleData.calibration_pairs_E_Caltype = CalType.ENERGY_CAL.getType();

View File

@ -27,4 +27,6 @@ public class CalValuesHandler {
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process); public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process);
public static native String fitPeakFull(String phd, List<Integer> Af, List<Integer> Cf, List<Integer> Ff);
} }

View File

@ -779,36 +779,8 @@ public class PHDFileUtil {
} }
} }
// public void CalQCBoundary() {
// //QC需要独立计算
// //从本地缓存获取beta gamma的数组
// Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
// //根据qc文件名称-用户名-beta的方式获取beta的内容
// Map<String, Object> betaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-beta");
// List<SeriseData> betaList = new LinkedList<>();
// List<String> betaFittingPara = new LinkedList<>();
// List<String> betaFittingParaToUi = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(betaMap)) {
// betaList = (List<SeriseData>)betaMap.get("Series");
// betaFittingPara = (List<String>) betaMap.get("fittingPara");
// betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
// }
// //根据qc文件名称-用户名-gamma的方式获取gamma的内容
// Map<String, Object> gammaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-gamma");
// List<SeriseData> gammaList = new LinkedList<>();
// List<String> gammaFittingPara = new LinkedList<>();
// List<String> gammaFittingParaToUi = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(gammaMap)) {
// gammaList = (List<SeriseData>)gammaMap.get("Series");
// gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
// gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
// }
// }
public EnergySpectrumStruct analyzeFileSourceData(String filePath, String fileName) { public EnergySpectrumStruct analyzeFileSourceData(String filePath, String fileName) {
//加载dll工具库 EnergySpectrumStruct struct = null;
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = new EnergySpectrumStruct();
FTPClient ftpClient = ftpUtil.LoginFTP(); FTPClient ftpClient = ftpUtil.LoginFTP();
InputStream inputStream = null; InputStream inputStream = null;
File file = null; File file = null;
@ -981,4 +953,59 @@ public class PHDFileUtil {
return result; return result;
} }
public List<Double> StringToDouble(List<String> datas) {
List<Double> result = new LinkedList<>();
for (String data: datas) {
result.add(Double.valueOf(data));
}
return result;
}
public void CalQCBoundary(List<SeriseData> betaList, List<SeriseData> gammaList, List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi, EnergySpectrumStruct struct, Map<String, Object> map) {
//计算边界值
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
if (CollectionUtils.isNotEmpty(betaList) && CollectionUtils.isNotEmpty(gammaList) && CollectionUtils.isNotEmpty(betaFittingParaToUi) && CollectionUtils.isNotEmpty(gammaFittingParaToUi)) {
calcBgBoundaryParam.g_e_cal = StringToDouble(gammaFittingParaToUi);
calcBgBoundaryParam.b_e_cal = StringToDouble(betaFittingParaToUi);
List<Double> bChannels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList());
List<Double> bEnergys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList());
List<Double> gChannels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList());
List<Double> gEnergys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
calcBgBoundaryParam.b_energy = bEnergys;
calcBgBoundaryParam.b_channel = bChannels;
calcBgBoundaryParam.g_channel = gChannels;
calcBgBoundaryParam.g_energy = gEnergys;
} else {
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
List<Double> bChannel = struct.b_channel;
List<Double> bElectronEnergy = struct.b_electron_energy;
calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
calcBgBoundaryParam.b_energy = struct.b_electron_energy;
calcBgBoundaryParam.b_channel = struct.b_channel;
calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
calcBgBoundaryParam.g_energy = struct.g_energy;
}
calcBgBoundaryParam.ROI_B_start_x1 = struct.POI_B_x1;
calcBgBoundaryParam.ROI_B_stop_x2 = struct.POI_B_x2;
calcBgBoundaryParam.ROI_G_start_y1 = struct.POI_G_y1;
calcBgBoundaryParam.ROI_G_stop_y2 = struct.POI_G_y2;
BgBoundary bgBoundary = EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam);
List<Boundary> boundaryList = new LinkedList<>();
List<Integer> roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start;
List<Integer> roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop;
List<Integer> roiGBoundaryStart = bgBoundary.ROI_G_Boundary_start;
List<Integer> roiGBoundaryStop = bgBoundary.ROI_G_Boundary_stop;
for (int i=0; i<roiBBoundaryStart.size(); i++){
Boundary boundary = new Boundary();
boundary.setMinX(roiBBoundaryStart.get(i));
boundary.setMaxX(roiBBoundaryStop.get(i));
boundary.setMinY(roiGBoundaryStart.get(i));
boundary.setMaxY(roiGBoundaryStop.get(i));
boundaryList.add(boundary);
}
map.put("QCBoundary", boundaryList);
}
} }

View File

@ -94,7 +94,7 @@ public class GammaController {
@PostMapping("acceptResults") @PostMapping("acceptResults")
@ApiOperation(value = "InteractiveTool页面Insert页面save", notes = "InteractiveTool页面Insert页面save") @ApiOperation(value = "InteractiveTool页面Insert页面save", notes = "InteractiveTool页面Insert页面save")
public Result acceptResults(@RequestBody AcceptInfo acceptInfo, HttpServletRequest request) { public Result acceptResults(@RequestBody AcceptInfo acceptInfo, HttpServletRequest request) {
return gammaService.acceptResults(acceptInfo.getFileName(), acceptInfo.isAccept(), acceptInfo.getOldPeak(), acceptInfo.getNewPeak(), acceptInfo.getFlag(), request); return gammaService.acceptResults(acceptInfo.getFileName(), acceptInfo.isAccept(), acceptInfo.getOldPeak(), acceptInfo.getTablePeaksList(), acceptInfo.getNewPeak(), acceptInfo.getFlag(), request);
} }
@GetMapping("deletePeak") @GetMapping("deletePeak")

View File

@ -14,6 +14,8 @@ public class AcceptInfo implements Serializable {
private List<PeakInfo> oldPeak; private List<PeakInfo> oldPeak;
private List<TablePeaks> tablePeaksList;
private List<PeakInfo> newPeak; private List<PeakInfo> newPeak;
private String flag; private String flag;

View File

@ -34,7 +34,7 @@ public interface IGammaService{
Result insertPeak(Integer sampleId, String fileName, Integer curChan, HttpServletRequest request); Result insertPeak(Integer sampleId, String fileName, Integer curChan, HttpServletRequest request);
Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, List<PeakInfo> newPeak, String flag, HttpServletRequest request); Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, List<TablePeaks> tablePeaksList, List<PeakInfo> newPeak, String flag, HttpServletRequest request);
Result deletePeak(String fileName, int curRow, HttpServletRequest request); Result deletePeak(String fileName, int curRow, HttpServletRequest request);

View File

@ -147,7 +147,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("样品文件不存在!"); result.error500("样品文件不存在!");
return result; return result;
} }
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result); boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
if (!flag){ if (!flag){
@ -424,7 +424,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result; return result;
} }
//切割数据库存储的文件路径获取路径信息 //切割数据库存储的文件路径获取路径信息
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
//切割数据库存储的文件路径获取文件名称 //切割数据库存储的文件路径获取文件名称
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
//调用加载文件的方法 传入文件路径文件名称全局变量phd响应结果result //调用加载文件的方法 传入文件路径文件名称全局变量phd响应结果result
@ -505,9 +505,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
int peakNum = 0; int peakNum = 0;
if (Objects.nonNull(analysis)){ if (Objects.nonNull(analysis)){
phd.setId_analysis(analysis.getIdAnalysis().toString()); phd.setId_analysis(analysis.getIdAnalysis().toString());
phd.setBaseline_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getBaselinePath()); phd.setBaseline_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getLcPath()); phd.setLc_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getScacPath()); phd.setScac_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
peakNum = analysis.getNumberOfPeaks(); peakNum = analysis.getNumberOfPeaks();
phd.setTotalCmt(analysis.getComments()); phd.setTotalCmt(analysis.getComments());
phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel()); phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel());
@ -1157,7 +1157,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
a++; a++;
} }
PeakInfo peak = new PeakInfo(); PeakInfo peak = new PeakInfo();
peak.index = a; peak.index = a+1;
peak.left = structInsertOutput.vLeft.get(j).intValue();; peak.left = structInsertOutput.vLeft.get(j).intValue();;
peak.right = structInsertOutput.vRight.get(j).intValue();; peak.right = structInsertOutput.vRight.get(j).intValue();;
peak.peakCentroid = structInsertOutput.peakCentroid.get(j); peak.peakCentroid = structInsertOutput.peakCentroid.get(j);
@ -1177,7 +1177,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
peak.recoilBetaChan = String.valueOf(structInsertOutput.recoilBetaChan.get(j)); peak.recoilBetaChan = String.valueOf(structInsertOutput.recoilBetaChan.get(j));
peak.recoilDeltaChan = String.valueOf(structInsertOutput.recoilDeltaChan.get(j)); peak.recoilDeltaChan = String.valueOf(structInsertOutput.recoilDeltaChan.get(j));
newPeaks.add(a, peak); newPeaks.add(a, peak);
newPeak.add(peak);
} }
} }
int left = structInsertOutput.vLeft.get(0).intValue(); int left = structInsertOutput.vLeft.get(0).intValue();
@ -1194,21 +1193,21 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
ii++; ii++;
} }
List<TablePeaks> tablePeaksList = FitPeakBaseLine(newPeaks, phd.getUsedEnerPara().getP(), vIdx); FitPeakBaseLine(newPeaks, phd.getUsedEnerPara().getP(), vIdx, map);
map.put("tablePeaksList", tablePeaksList);
map.put("oldPeaks", vOriPeaks); map.put("oldPeaks", vOriPeaks);
map.put("newPeaks", newPeak);
result.setSuccess(true); result.setSuccess(true);
result.setResult(map); result.setResult(map);
return result; return result;
} }
public List<TablePeaks> FitPeakBaseLine(List<PeakInfo> vPeaks, List<Double> p, List<Integer> vIdx) { public void FitPeakBaseLine(List<PeakInfo> vPeaks, List<Double> p, List<Integer> vIdx, Map<String, Object> map) {
List<TablePeaks> tablePeaksList = new LinkedList<>(); List<TablePeaks> tablePeaksList = new LinkedList<>();
List<PeakInfo> newPeaks = new LinkedList<>();
int peakNum = vIdx.size(); int peakNum = vIdx.size();
for (int i=0; i<peakNum; i++) { for (int i=0; i<peakNum; i++) {
int peakIdx = vIdx.get(i); int peakIdx = vIdx.get(i);
PeakInfo peak = vPeaks.get(peakIdx); PeakInfo peak = vPeaks.get(peakIdx);
newPeaks.add(peak);
TablePeaks tablePeaks = new TablePeaks(); TablePeaks tablePeaks = new TablePeaks();
tablePeaks.setLab(String.valueOf(peakIdx + 1)); tablePeaks.setLab(String.valueOf(peakIdx + 1));
String nuclide = ""; String nuclide = "";
@ -1228,11 +1227,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
tablePeaks.setFwhmB(true); tablePeaks.setFwhmB(true);
tablePeaksList.add(tablePeaks); tablePeaksList.add(tablePeaks);
} }
return tablePeaksList; map.put("tablePeaksList", tablePeaksList);
map.put("newPeaks", newPeaks);
} }
@Override @Override
public Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, List<PeakInfo> newPeak, String flag, HttpServletRequest request) { public Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, List<TablePeaks> tablePeaksList, List<PeakInfo> newPeak, String flag, 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();
@ -1241,69 +1241,120 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("请先选择解析文件!"); result.error500("请先选择解析文件!");
return result; return result;
} }
List<Long> m_vCount = new LinkedList<>(); try {
long m_nCount = phd.getSpec().getNum_g_channel(); List<Long> m_vCount = new LinkedList<>();
long m_nSChan = phd.getSpec().getBegin_channel(); long m_nCount = phd.getSpec().getNum_g_channel();
//获取当前角色的颜色配置 long m_nSChan = phd.getSpec().getBegin_channel();
Map<String, String> colorMap = sysUserColorService.initColor(userName); //获取当前角色的颜色配置
// 确保绘制曲线时所有谱都是从1道开始 Map<String, String> colorMap = sysUserColorService.initColor(userName);
int i = 0; // 确保绘制曲线时所有谱都是从1道开始
if(m_nSChan == 0){ int i = 0;
i = 1; if(m_nSChan == 0){
} i = 1;
for(; i<m_nCount; ++i) { }
m_vCount.add(phd.getSpec().getCounts().get(i)); for(; i<m_nCount; ++i) {
} m_vCount.add(phd.getSpec().getCounts().get(i));
if(m_nSChan == 0) { }
m_vCount.add(0L); if(m_nSChan == 0) {
} m_vCount.add(0L);
HashMap<String, Object> map = new HashMap<>(); }
//根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线 HashMap<String, Object> map = new HashMap<>();
if (accept){ //根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线
if (flag.equalsIgnoreCase("fit")) {//如果传递的flag标识 fit则进行修改峰值等数据 if (accept){
for (int j=0; j<newPeak.size(); j++) { if (flag.equalsIgnoreCase("fit")) {//如果传递的flag标识 fit则进行修改峰值等数据
PeakInfo peakInfo = newPeak.get(j); for (int j=0; j<newPeak.size(); j++) {
phd.getVPeak().set(peakInfo.index-1, peakInfo); PeakInfo peakInfo = newPeak.get(j);
}
} else if (flag.equalsIgnoreCase("insert")){//如果传递的flag标识 Insert则进行峰值的插入
for (int j=0; j<newPeak.size(); j++) {
//获取需要插入的第一个峰值信息
PeakInfo peakInfo = newPeak.get(j);
//根据下标获取旧的峰值数据
PeakInfo info = oldPeak.get(peakInfo.index - 1);
String newEnergy = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.energy));
String oldEnergy = NumberFormatUtil.numberFormat(String.valueOf(info.energy));
//将旧的峰值能量与新的峰值能量格式化后 比较 如果一致则覆盖 不一致则在对应下标插入峰值
if (oldEnergy.equals(newEnergy) && peakInfo.index == info.index) {
phd.getVPeak().set(peakInfo.index-1, peakInfo); phd.getVPeak().set(peakInfo.index-1, peakInfo);
} else { }
phd.getVPeak().add(peakInfo.index-1, peakInfo); } else if (flag.equalsIgnoreCase("insert")){//如果传递的flag标识 Insert则进行峰值的插入
for (int j=0; j<newPeak.size(); j++) {
//获取需要插入的第一个峰值信息
PeakInfo peakInfo = newPeak.get(j);
//根据下标获取旧的峰值数据
PeakInfo info = oldPeak.get(peakInfo.index - 1);
String newEnergy = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.energy));
String oldEnergy = NumberFormatUtil.numberFormat(String.valueOf(info.energy));
//将旧的峰值能量与新的峰值能量格式化后 比较 如果一致则覆盖 不一致则在对应下标插入峰值
if (oldEnergy.equals(newEnergy) && peakInfo.index == info.index) {
phd.getVPeak().set(peakInfo.index-1, peakInfo);
} else {
phd.getVPeak().add(peakInfo.index-1, peakInfo);
}
} }
} }
}
//重新计算peak的改变
gammaFileUtil.PeaksChanged(phd);
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak()); List<Double> vC_Rg = new LinkedList<>();
map.put("table", vPeak); vC_Rg.add(Double.valueOf(phd.getBaseCtrls().getRg_low()));
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak")); vC_Rg.add(Double.valueOf(phd.getBaseCtrls().getRg_high()));
map.put("channelPeakChart", channelPeak);
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base")); List<Double> vE_Rg = CalValuesHandler.calFcnEval(vC_Rg, phd.getUsedEnerPara().getP()).counts;
map.put("channelBaseLineChart", channelBaseLine); if(vE_Rg.size() != 2 || vE_Rg.get(0).isNaN() || vE_Rg.get(1).isNaN()) {
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount); return result;
map.put("barChart", differance); }
gammaFileUtil.UpdateChart(phd, map, colorMap);
} else {//如果不保留 根据下标移除对应的vPeak数据 List<Integer> Af = new LinkedList<>();
if (CollectionUtils.isNotEmpty(oldPeak)) { List<Integer> Cf = new LinkedList<>();
phd.getVPeak().clear(); List<Integer> Ff = new LinkedList<>();
phd.setVPeak(oldPeak); //遍历列表中的数据
map.put("table", phd.getVPeak()); for(int j=0; j< tablePeaksList.size(); j++){
TablePeaks nPeak = tablePeaksList.get(j);
PeakInfo peak = phd.getVPeak().get(Integer.valueOf(nPeak.getLab())-1);
double dE = CalValuesHandler.calDerivaOut(peak.peakCentroid, phd.getUsedEnerPara().getP());
if(peak.energy < vE_Rg.get(0) || peak.energy > vE_Rg.get(1)) {
result.error500("The energy isn't in the analysis range.");
return result;
}
List<Double> energys = new LinkedList<>();
energys.add(peak.energy);
peak.peakCentroid = CalValuesHandler.energyToChannel(energys, phd.getUsedEnerPara().getP()).counts.get(0);
peak.stepRatio = Double.valueOf(nPeak.getStep()) / peak.area;
peak.BWWidthChan = Double.valueOf(nPeak.getBwGamma()) / dE;
if(dE > 0) {
peak.fwhmc = peak.fwhm / dE;
}
if(!tablePeaksList.get(j).isNetAreaB()) {
Af.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
}
if(!tablePeaksList.get(j).isCentroid()) {
Cf.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
}
if(!tablePeaksList.get(j).isFwhmB()) {
Ff.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
}
}
ObjectMapper mapper = new ObjectMapper();
String phdStr = mapper.writeValueAsString(phd);
String str = CalValuesHandler.fitPeakFull(phdStr, Af, Cf, Ff);
//重新计算peak的改变
gammaFileUtil.PeaksChanged(phd);
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, m_nCount, colorMap.get("Color_Peak"));
map.put("channelPeakChart", channelPeak); map.put("channelPeakChart", channelPeak);
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
map.put("channelBaseLineChart", channelBaseLine);
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
map.put("barChart", differance);
gammaFileUtil.UpdateChart(phd, map, colorMap);
} else {//如果不保留 根据下标移除对应的vPeak数据
if (CollectionUtils.isNotEmpty(oldPeak)) {
phd.getVPeak().clear();
phd.setVPeak(oldPeak);
map.put("table", phd.getVPeak());
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
map.put("channelPeakChart", channelPeak);
}
} }
result.setSuccess(true);
result.setResult(map);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
result.setSuccess(true);
result.setResult(map);
return result; return result;
} }
@ -1385,16 +1436,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
// 备份原来的峰列表 // 备份原来的峰列表
List<PeakInfo> vOriPeaks = phd.getVPeak(); List<PeakInfo> vOriPeaks = phd.getVPeak();
List<PeakInfo> newPeak = new LinkedList<>();
for (int i=0; i<vIdx.size(); i++) { FitPeakBaseLine(phd.getVPeak(), phd.getUsedEnerPara().getP(), vIdx, map);
int peakIdx = vIdx.get(i);
PeakInfo peak = phd.getVPeak().get(peakIdx);
newPeak.add(peak);
}
List<TablePeaks> tablePeaksList = FitPeakBaseLine(phd.getVPeak(), phd.getUsedEnerPara().getP(), vIdx);
map.put("tablePeaksList", tablePeaksList);
map.put("oldPeaks", vOriPeaks); map.put("oldPeaks", vOriPeaks);
map.put("newPeaks", newPeak);
result.setSuccess(true); result.setSuccess(true);
result.setResult(map); result.setResult(map);
return result; return result;
@ -1757,44 +1801,55 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) { public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
// Result result = new Result(); Result result = new Result();
// HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
// //获取用户名 //获取用户名
// String userName = JwtUtil.getUserNameByToken(request); String userName = JwtUtil.getUserNameByToken(request);
// //获取文件名称 //获取文件名称
// String fileName = baseLineCtrls.getFileName(); String fileName = baseLineCtrls.getFileName();
// 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("请先选择解析文件!"); result.error500("请先选择解析文件!");
// return result; return result;
// } }
// List<Long> m_vCount = new LinkedList<>(); List<Long> m_vCount = new LinkedList<>();
// long m_nCount = phd.getSpec().getNum_g_channel(); long m_nCount = phd.getSpec().getNum_g_channel();
// long m_nSChan = phd.getSpec().getBegin_channel(); long m_nSChan = phd.getSpec().getBegin_channel();
// //获取当前角色的颜色配置 //获取当前角色的颜色配置
// Map<String, String> colorMap = sysUserColorService.initColor(userName); Map<String, String> colorMap = sysUserColorService.initColor(userName);
// // 确保绘制曲线时所有谱都是从1道开始 // 确保绘制曲线时所有谱都是从1道开始
// int i = 0; int i = 0;
// if(m_nSChan == 0){ if(m_nSChan == 0){
// i = 1; i = 1;
// } }
// for(; i<m_nCount; ++i) { for(; i<m_nCount; ++i) {
// m_vCount.add(phd.getSpec().getCounts().get(i)); m_vCount.add(phd.getSpec().getCounts().get(i));
// } }
// if(m_nSChan == 0) { if(m_nSChan == 0) {
// m_vCount.add(0L); m_vCount.add(0L);
// } }
// if(baseLineCtrls.isReplotNeeded()) { if(baseLineCtrls.isReplotNeeded()) {
// baseLineCtrls.setReplotNeeded(false); baseLineCtrls.setReplotNeeded(false);
// List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), baseLineCtrls.getBaseline(), colorMap.get("Color_peak"), m_nCount, null, false); BaseControls m_baseCtrl = new BaseLineCtrls();
// m_chart->AddData(CreateTempBaseLine(m_data->m_Color[Color_base], "BaseLine")); BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
// CreateShapeCP(MyChartSpace::Shape_Round); phd.setBaseCtrls(m_baseCtrl);
// phd.setVBase(m_baseCtrl.getBaseline());
// if(m_baseCtrl.BaseStack.size() > 2) m_baseCtrl.BaseStack.remove(1, m_baseCtrl.BaseStack.size()-2); List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), baseLineCtrls.getBaseline(), colorMap.get("Color_peak"), m_nCount, null, false);
// } map.put("peakSet", peakSet);
ChartData chartData = gammaFileUtil.CreateTempBaseLine(colorMap.get("Color_base"), "BaseLine", m_baseCtrl);
return null; map.put("chartData", chartData);
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
map.put("shapeData", shapeData);
if(m_baseCtrl.getBaseStack().size() > 2) {
for (int j =1; j<m_baseCtrl.getBaseStack().size()-1; j++) {
m_baseCtrl.getBaseStack().remove(j);
}
}
}
result.setSuccess(true);
result.setResult(map);
return result;
} }
@Override @Override
@ -1811,15 +1866,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("请先选择解析文件!"); result.error500("请先选择解析文件!");
return result; return result;
} }
if(baseLineCtrls.getBaseStack().size() > 1) { // if(baseLineCtrls.getBaseStack().size() > 1) {
for (int i=0; i<baseLineCtrls.getBaseStack().size(); i++) { // for (int i=0; i<baseLineCtrls.getBaseStack().size(); i++) {
baseLineCtrls.getBaseStack().remove(i); // baseLineCtrls.getBaseStack().remove(i);
} // }
BaseControls m_baseCtrl = new BaseLineCtrls(); BaseControls m_baseCtrl = new BaseLineCtrls();
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl); BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
phd.setBaseCtrls(m_baseCtrl); phd.setBaseCtrls(m_baseCtrl);
phd.setVBase(m_baseCtrl.getBaseline()); phd.setVBase(m_baseCtrl.getBaseline());
} // }
List<Long> m_vCount = new LinkedList<>(); List<Long> m_vCount = new LinkedList<>();
long m_nCount = phd.getSpec().getNum_g_channel(); long m_nCount = phd.getSpec().getNum_g_channel();
long m_nSChan = phd.getSpec().getBegin_channel(); long m_nSChan = phd.getSpec().getBegin_channel();
@ -3240,15 +3295,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public void viewARR(Integer sampleId, HttpServletResponse response) { public void viewARR(Integer sampleId, HttpServletResponse response) {
if(Objects.isNull(sampleId)) {
String waring = "The file isn't existed.";
}
//获取自动处理生成的报告地址 //获取自动处理生成的报告地址
String reportPath = spectrumAnalysisMapper.viewARR(sampleId); String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
if(StringUtils.isBlank(reportPath.trim())) { String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String waring = "The file isn't existed.";
}
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + 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 = ftpUtil.LoginFTP();
@ -3304,7 +3353,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if(StringUtils.isBlank(reportPath.trim())) { if(StringUtils.isBlank(reportPath.trim())) {
String waring = "The file isn't existed."; String waring = "The file isn't existed.";
} }
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + 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 = ftpUtil.LoginFTP();
@ -3841,13 +3890,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) { public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
if (Objects.isNull(sampleId)){
String waring = "The file isn't existed.";
}
String logPath = spectrumAnalysisMapper.findAutomaticLogPath(sampleId); String logPath = spectrumAnalysisMapper.findAutomaticLogPath(sampleId);
if (StringUtils.isBlank(logPath)){
String waring = "The file isn't existed.";
}
String pathName = StringPool.SLASH + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + 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

View File

@ -41,6 +41,8 @@ import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper; import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult; import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.*; import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -309,6 +311,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
List<Boundary> sampleBoundary = new LinkedList<>(); List<Boundary> sampleBoundary = new LinkedList<>();
List<Boundary> gasBoundary = new LinkedList<>(); List<Boundary> gasBoundary = new LinkedList<>();
List<Boundary> detBoundary = new LinkedList<>(); List<Boundary> detBoundary = new LinkedList<>();
List<Boundary> qcBoundary = new LinkedList<>();
if (Objects.isNull(sampleId)){ if (Objects.isNull(sampleId)){
result.error500("请选择一条数据"); result.error500("请选择一条数据");
return result; return result;
@ -338,7 +341,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath(); String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
filePath.add(sampleFilePath); filePath.add(sampleFilePath);
GardsSampleData sample = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePath); GardsSampleData sample = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
sampleMap = this.fenxi(pathName, fileName, sample.getSampleId(), sample.getStatus()); sampleMap = this.fenxi(pathName, fileName, sample.getSampleId(), sample.getStatus());
resultMap.put("sample",sampleMap); resultMap.put("sample",sampleMap);
@ -347,7 +350,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath(); String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
filePath.add(gasBgFilePath); filePath.add(gasBgFilePath);
GardsSampleData gasBg = spectrumAnalysisMapper.findSampleByFilePath(gasBgFilePath); GardsSampleData gasBg = spectrumAnalysisMapper.findSampleByFilePath(gasBgFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(gasBg)) { if (Objects.nonNull(gasBg)) {
gasBgMap = this.fenxi(pathName, fileName, gasBg.getSampleId(), gasBg.getStatus()); gasBgMap = this.fenxi(pathName, fileName, gasBg.getSampleId(), gasBg.getStatus());
@ -358,7 +361,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath(); String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
filePath.add(detBgFilePath); filePath.add(detBgFilePath);
GardsSampleData detBg = spectrumAnalysisMapper.findSampleByFilePath(detBgFilePath); GardsSampleData detBg = spectrumAnalysisMapper.findSampleByFilePath(detBgFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(detBg)) { if (Objects.nonNull(detBg)) {
detBgMap = this.fenxi(pathName, fileName, detBg.getSampleId(), detBg.getStatus()); detBgMap = this.fenxi(pathName, fileName, detBg.getSampleId(), detBg.getStatus());
@ -371,7 +374,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
dbSpectrumFilePath.setQcFilePath(dbQcFilePath); dbSpectrumFilePath.setQcFilePath(dbQcFilePath);
filePath.add(dbQcFilePath); filePath.add(dbQcFilePath);
GardsSampleData qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath); GardsSampleData qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1); String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(qc)) { if (Objects.nonNull(qc)) {
qcMap = this.fenxi(pathName, fileName, qc.getSampleId(), qc.getStatus()); qcMap = this.fenxi(pathName, fileName, qc.getSampleId(), qc.getStatus());
@ -387,6 +390,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
sampleBoundary = (List<Boundary>) xeDataMap.get("SampleBoundary"); sampleBoundary = (List<Boundary>) xeDataMap.get("SampleBoundary");
gasBoundary = (List<Boundary>) xeDataMap.get("GasBoundary"); gasBoundary = (List<Boundary>) xeDataMap.get("GasBoundary");
detBoundary = (List<Boundary>) xeDataMap.get("DetBoundary"); detBoundary = (List<Boundary>) xeDataMap.get("DetBoundary");
qcBoundary = (List<Boundary>) xeDataMap.get("QCBoundary");
bProcessed = true; bProcessed = true;
if (CollectionUtils.isNotEmpty(sampleBoundary)) { if (CollectionUtils.isNotEmpty(sampleBoundary)) {
sampleMap.put("Boundary", sampleBoundary); sampleMap.put("Boundary", sampleBoundary);
@ -397,6 +401,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (CollectionUtils.isNotEmpty(detBoundary)) { if (CollectionUtils.isNotEmpty(detBoundary)) {
detBgMap.put("Boundary", detBoundary); detBgMap.put("Boundary", detBoundary);
} }
if (CollectionUtils.isNotEmpty(qcBoundary)) {
qcMap.put("Boundary", qcBoundary);
}
} }
//Xe //Xe
if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
@ -436,6 +443,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
List<Boundary> sampleBoundary = new LinkedList<>(); List<Boundary> sampleBoundary = new LinkedList<>();
List<Boundary> gasBoundary = new LinkedList<>(); List<Boundary> gasBoundary = new LinkedList<>();
List<Boundary> detBoundary = new LinkedList<>(); List<Boundary> detBoundary = new LinkedList<>();
List<Boundary> qcBoundary = new LinkedList<>();
List<String> filePath = new LinkedList<>(); List<String> filePath = new LinkedList<>();
Map<String, Object> sampleMap = new HashMap<>(); Map<String, Object> sampleMap = new HashMap<>();
Map<String, Object> gasBgMap = new HashMap<>(); Map<String, Object> gasBgMap = new HashMap<>();
@ -478,6 +486,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
sampleBoundary = (List<Boundary>) xeDataMap.get("SampleBoundary"); sampleBoundary = (List<Boundary>) xeDataMap.get("SampleBoundary");
gasBoundary = (List<Boundary>) xeDataMap.get("GasBoundary"); gasBoundary = (List<Boundary>) xeDataMap.get("GasBoundary");
detBoundary = (List<Boundary>) xeDataMap.get("DetBoundary"); detBoundary = (List<Boundary>) xeDataMap.get("DetBoundary");
qcBoundary = (List<Boundary>) xeDataMap.get("QCBoundary");
bProcessed = true; bProcessed = true;
savedAnalysisResult = true; savedAnalysisResult = true;
//Xe //Xe
@ -506,6 +515,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (CollectionUtils.isNotEmpty(detBoundary)) { if (CollectionUtils.isNotEmpty(detBoundary)) {
detBgMap.put("Boundary", detBoundary); detBgMap.put("Boundary", detBoundary);
} }
if (CollectionUtils.isNotEmpty(qcBoundary)) {
qcMap.put("Boundary", qcBoundary);
}
} }
resultMap.put("XeData", xeResultsSpectrumList); resultMap.put("XeData", xeResultsSpectrumList);
resultMap.put("bProcessed", bProcessed); resultMap.put("bProcessed", bProcessed);
@ -583,7 +595,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
//判断sampleId是否为空 如果不为空 则当前操作数据来源是数据库 文件路径从数据库中查询 //判断sampleId是否为空 如果不为空 则当前操作数据来源是数据库 文件路径从数据库中查询
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId); String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId); CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId);
if (Objects.nonNull(commentData)){ if (Objects.nonNull(commentData)){
if (!commentData.getAnalyst().equals(userName)){ if (!commentData.getAnalyst().equals(userName)){
@ -653,7 +665,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (StringUtils.isBlank(reportPath)){ if (StringUtils.isBlank(reportPath)){
throw new RuntimeException("自动处理程序生成报告不存在!"); throw new RuntimeException("自动处理程序生成报告不存在!");
} }
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH)); String pathName = StringPool.SLASH + 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 = ftpUtil.LoginFTP();
@ -727,9 +739,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID); SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
if (Objects.nonNull(dbSpectrumFilePath)){ if (Objects.nonNull(dbSpectrumFilePath)){
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)); sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)); gasFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)); detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
} }
} else { } else {
sampleFilePath = path; sampleFilePath = path;
@ -766,49 +778,55 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (StringUtils.isNotBlank(sampleFilePath)){ if (StringUtils.isNotBlank(sampleFilePath)){
try { try {
EnergySpectrumStruct sampleSourceData = phdFileUtil.analyzeFileSourceData(sampleFilePath, rrrLogInfo.getSampleFileName()); EnergySpectrumStruct sampleSourceData = phdFileUtil.analyzeFileSourceData(sampleFilePath, rrrLogInfo.getSampleFileName());
information.setSample_measid_name(sampleSourceData.measurement_id); if (Objects.nonNull(sampleSourceData)) {
information.setSample_det_measid_name(sampleSourceData.detector_bk_measurement_id); information.setSample_measid_name(sampleSourceData.measurement_id);
information.setSample_gas_measid_name(sampleSourceData.gas_bk_measurement_id); information.setSample_det_measid_name(sampleSourceData.detector_bk_measurement_id);
information.setSit_det_code(sampleSourceData.site_code); information.setSample_gas_measid_name(sampleSourceData.gas_bk_measurement_id);
information.setSample_type(sampleSourceData.system_type); information.setSit_det_code(sampleSourceData.site_code);
information.setGeometry(sampleSourceData.sample_geometry); information.setSample_type(sampleSourceData.system_type);
information.setSpectral_qualifie(sampleSourceData.spectrum_quantity); information.setGeometry(sampleSourceData.sample_geometry);
String transmit_dtg_str=sampleSourceData.transmit_date+StringPool.SPACE+sampleSourceData.transmit_time; information.setSpectral_qualifie(sampleSourceData.spectrum_quantity);
Date transmit_dtg = DateUtils.parseDate(transmit_dtg_str); String transmit_dtg_str=sampleSourceData.transmit_date+StringPool.SPACE+sampleSourceData.transmit_time;
information.setTransmit_dtg(transmit_dtg); Date transmit_dtg = DateUtils.parseDate(transmit_dtg_str);
information.setDetect_code(sampleSourceData.detector_code); information.setTransmit_dtg(transmit_dtg);
information.setMeasurementID(sampleSourceData.measurement_id.replace("\\","/")); information.setDetect_code(sampleSourceData.detector_code);
information.setBkgdMeasurementID(sampleSourceData.detector_bk_measurement_id.replace("\\","/")); information.setMeasurementID(sampleSourceData.measurement_id.replace("\\","/"));
information.setGasBkgdMeasurementID(sampleSourceData.gas_bk_measurement_id.replace("\\","/")); information.setBkgdMeasurementID(sampleSourceData.detector_bk_measurement_id.replace("\\","/"));
information.setSampleRefId(sampleSourceData.sample_ref_id); information.setGasBkgdMeasurementID(sampleSourceData.gas_bk_measurement_id.replace("\\","/"));
String collect_start_str = sampleSourceData.collection_start_date+StringPool.SPACE+sampleSourceData.collection_start_time; information.setSampleRefId(sampleSourceData.sample_ref_id);
Date collect_start = DateUtils.parseDate(collect_start_str); String collect_start_str = sampleSourceData.collection_start_date+StringPool.SPACE+sampleSourceData.collection_start_time;
information.setCollect_start(collect_start); Date collect_start = DateUtils.parseDate(collect_start_str);
String collect_stop_str = sampleSourceData.collection_stop_date+StringPool.SPACE+sampleSourceData.collection_stop_time; information.setCollect_start(collect_start);
Date collect_stop = DateUtils.parseDate(collect_stop_str); String collect_stop_str = sampleSourceData.collection_stop_date+StringPool.SPACE+sampleSourceData.collection_stop_time;
information.setCollect_stop(collect_stop); Date collect_stop = DateUtils.parseDate(collect_stop_str);
information.setS_xe_stable_volume(sampleSourceData.air_volume); information.setCollect_stop(collect_stop);
String acquisition_start_str = sampleSourceData.acquisition_start_date+StringPool.SPACE+sampleSourceData.acquisition_start_time; information.setS_xe_stable_volume(sampleSourceData.air_volume);
Date acquisition_start = DateUtils.parseDate(acquisition_start_str); String acquisition_start_str = sampleSourceData.acquisition_start_date+StringPool.SPACE+sampleSourceData.acquisition_start_time;
information.setAcquisition_start(acquisition_start); Date acquisition_start = DateUtils.parseDate(acquisition_start_str);
long dataTime = (long) (acquisition_start.getTime() + sampleSourceData.acquisition_live_time * 1000); information.setAcquisition_start(acquisition_start);
String acquisition_stop_str = DateUtils.formatDate(new Date(dataTime), "yyyy/MM/dd HH:mm:ss"); long dataTime = (long) (acquisition_start.getTime() + sampleSourceData.acquisition_live_time * 1000);
Date acquisition_stop = DateUtils.parseDate(acquisition_stop_str); String acquisition_stop_str = DateUtils.formatDate(new Date(dataTime), "yyyy/MM/dd HH:mm:ss");
information.setAcquisition_stop(acquisition_stop); Date acquisition_stop = DateUtils.parseDate(acquisition_stop_str);
information.setAcquisition_real_sec(sampleSourceData.acquisition_real_time); information.setAcquisition_stop(acquisition_stop);
information.setAcquisition_live_sec(sampleSourceData.acquisition_live_time); information.setAcquisition_real_sec(sampleSourceData.acquisition_real_time);
information.setS_volume_of_Xe(sampleSourceData.sample_volume_of_Xe); information.setAcquisition_live_sec(sampleSourceData.acquisition_live_time);
information.setS_volume_of_Xe(sampleSourceData.sample_volume_of_Xe);
}
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
if (StringUtils.isNotBlank(gasFilePath)){ if (StringUtils.isNotBlank(gasFilePath)){
EnergySpectrumStruct gasSourceData = phdFileUtil.analyzeFileSourceData(gasFilePath, rrrLogInfo.getGasFileName()); EnergySpectrumStruct gasSourceData = phdFileUtil.analyzeFileSourceData(gasFilePath, rrrLogInfo.getGasFileName());
information.setGas_measid_name(gasSourceData.measurement_id); if (Objects.nonNull(gasSourceData)) {
information.setGas_measid_name(gasSourceData.measurement_id);
}
} }
if (StringUtils.isNotBlank(detFilePath)){ if (StringUtils.isNotBlank(detFilePath)){
EnergySpectrumStruct detSourceData = phdFileUtil.analyzeFileSourceData(detFilePath, rrrLogInfo.getDetFileName()); EnergySpectrumStruct detSourceData = phdFileUtil.analyzeFileSourceData(detFilePath, rrrLogInfo.getDetFileName());
information.setDet_measid_name(detSourceData.measurement_id); if (Objects.nonNull(detSourceData)) {
information.setDet_measid_name(detSourceData.measurement_id);
}
} }
StringBuffer strBuffer = new StringBuffer(); StringBuffer strBuffer = new StringBuffer();
strBuffer.append("CNL06 GENERATED REPORT").append("\n"); strBuffer.append("CNL06 GENERATED REPORT").append("\n");
@ -952,7 +970,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if(StringUtils.isNotBlank(sampleFileName)) { if(StringUtils.isNotBlank(sampleFileName)) {
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + sampleFileName; String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + sampleFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())) {
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath(); sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath();
} }
List<String> lines = phdFileUtil.readLine(sampleFilePath); List<String> lines = phdFileUtil.readLine(sampleFilePath);
map.put("sample", lines); map.put("sample", lines);
@ -960,7 +978,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if(StringUtils.isNotBlank(gasFileName)) { if(StringUtils.isNotBlank(gasFileName)) {
String gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + gasFileName; String gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + gasFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath(); gasBgFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath();
} }
List<String> lines = phdFileUtil.readLine(gasBgFilePath); List<String> lines = phdFileUtil.readLine(gasBgFilePath);
map.put("gasBg", lines); map.put("gasBg", lines);
@ -968,7 +986,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if(StringUtils.isNotBlank(detFileName)) { if(StringUtils.isNotBlank(detFileName)) {
String detBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + detFileName; String detBgFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + detFileName;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
detBgFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath(); detBgFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath();
} }
List<String> lines = phdFileUtil.readLine(detBgFilePath); List<String> lines = phdFileUtil.readLine(detBgFilePath);
map.put("detBg", lines); map.put("detBg", lines);
@ -977,7 +995,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + qcFileName; String dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName + StringPool.SLASH + qcFileName;
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) { if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr); dbQcFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
} }
List<String> lines = phdFileUtil.readLine(dbQcFilePath); List<String> lines = phdFileUtil.readLine(dbQcFilePath);
map.put("qc", lines); map.put("qc", lines);
@ -994,7 +1012,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String pathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String pathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId); String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
} }
if (StringUtils.isNotBlank(sampleFileName)){ if (StringUtils.isNotBlank(sampleFileName)){
FTPClient ftpClient = ftpUtil.LoginFTP(); FTPClient ftpClient = ftpUtil.LoginFTP();
@ -1153,9 +1171,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName); analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
} }
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID); dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)); sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)); gasFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)); detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
//查询数据库中结果的Xe数据 //查询数据库中结果的Xe数据
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId); xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
xeDataList = xeDataList.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_133.getType())).collect(Collectors.toList()); xeDataList = xeDataList.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_133.getType())).collect(Collectors.toList());
@ -1182,43 +1200,45 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
EnergySpectrumStruct gasSourceData = phdFileUtil.analyzeFileSourceData(gasFilePath, gasFileName); EnergySpectrumStruct gasSourceData = phdFileUtil.analyzeFileSourceData(gasFilePath, gasFileName);
EnergySpectrumStruct detSourceData = phdFileUtil.analyzeFileSourceData(detFilePath, detFileName); EnergySpectrumStruct detSourceData = phdFileUtil.analyzeFileSourceData(detFilePath, detFileName);
try { try {
Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time); if (Objects.nonNull(sampleSourceData) && Objects.nonNull(gasSourceData) && Objects.nonNull(detSourceData)) {
Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time); Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time);
Double collection_time = Double.valueOf(collectStopDate.getTime() / 1000 - collectStartDate.getTime() / 1000); Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time);
String collection_time_value = String.format("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)/3600.0); Double collection_time = Double.valueOf(collectStopDate.getTime() / 1000 - collectStartDate.getTime() / 1000);
qcResult.setCollectTimeValue(collection_time_value); String collection_time_value = String.format("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)/3600.0);
if (collectionTimeSections.get(1) < collection_time/3600 && collection_time/3600 < collectionTimeSections.get(4)){ qcResult.setCollectTimeValue(collection_time_value);
qcResult.setCollectTimeStatus("Pass"); if (collectionTimeSections.get(1) < collection_time/3600 && collection_time/3600 < collectionTimeSections.get(4)){
}else { qcResult.setCollectTimeStatus("Pass");
qcResult.setCollectTimeStatus("Failed"); }else {
} qcResult.setCollectTimeStatus("Failed");
String acquisition_live_sec = String.format("%.2f",sampleSourceData.acquisition_live_time/3600.0); }
qcResult.setAcquisitionTimeValue(acquisition_live_sec); String acquisition_live_sec = String.format("%.2f",sampleSourceData.acquisition_live_time/3600.0);
if (acquisitionTimeSections.get(1) < sampleSourceData.acquisition_live_time/3600.0 && sampleSourceData.acquisition_live_time/3600.0 < acquisitionTimeSections.get(4)){ qcResult.setAcquisitionTimeValue(acquisition_live_sec);
qcResult.setAcquisitionTimeStatus("Pass"); if (acquisitionTimeSections.get(1) < sampleSourceData.acquisition_live_time/3600.0 && sampleSourceData.acquisition_live_time/3600.0 < acquisitionTimeSections.get(4)){
}else { qcResult.setAcquisitionTimeStatus("Pass");
qcResult.setAcquisitionTimeStatus("Failed"); }else {
} qcResult.setAcquisitionTimeStatus("Failed");
String s_xe_stable_volume = String.valueOf(sampleSourceData.sample_volume_of_Xe); }
qcResult.setXenonVolumeValue(s_xe_stable_volume); String s_xe_stable_volume = String.valueOf(sampleSourceData.sample_volume_of_Xe);
if (xeVolumeSections.get(1) < sampleSourceData.sample_volume_of_Xe){ qcResult.setXenonVolumeValue(s_xe_stable_volume);
qcResult.setXenonVolumeStatus("Pass"); if (xeVolumeSections.get(1) < sampleSourceData.sample_volume_of_Xe){
}else { qcResult.setXenonVolumeStatus("Pass");
qcResult.setXenonVolumeStatus("Failed"); }else {
} qcResult.setXenonVolumeStatus("Failed");
// }
String gasMeasurementID = gasSourceData.measurement_id; //
if (gasMeasurementID.equals(sampleSourceData.gas_bk_measurement_id)){ String gasMeasurementID = gasSourceData.measurement_id;
qcResult.setGasBgValueAndStatus(true); if (gasMeasurementID.equals(sampleSourceData.gas_bk_measurement_id)){
}else { qcResult.setGasBgValueAndStatus(true);
qcResult.setGasBgValueAndStatus(false); }else {
} qcResult.setGasBgValueAndStatus(false);
// }
String detMeasurementID = detSourceData.measurement_id; //
if (detMeasurementID.equals(sampleSourceData.detector_bk_measurement_id)){ String detMeasurementID = detSourceData.measurement_id;
qcResult.setDetBgValueAndStatus(true); if (detMeasurementID.equals(sampleSourceData.detector_bk_measurement_id)){
}else { qcResult.setDetBgValueAndStatus(true);
qcResult.setDetBgValueAndStatus(false); }else {
qcResult.setDetBgValueAndStatus(false);
}
} }
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -1297,7 +1317,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE); ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId); sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
//查询数据库中结果的Xe数据 //查询数据库中结果的Xe数据
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId); xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
} else { } else {
@ -1415,7 +1435,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr); String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) { if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH)); qcPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
} }
} }
FTPClient ftpClient = ftpUtil.LoginFTP(); FTPClient ftpClient = ftpUtil.LoginFTP();
@ -1563,7 +1583,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr); String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) { if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH)); qcPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
} }
} }
FTPClient ftpClient = ftpUtil.LoginFTP(); FTPClient ftpClient = ftpUtil.LoginFTP();
@ -1709,7 +1729,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String samplePathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String samplePathName = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)){ if (Objects.nonNull(sampleId)){
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId); String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
samplePathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); samplePathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
} }
//加载dll工具库 //加载dll工具库
//System.loadLibrary("ReadPHDFile"); //System.loadLibrary("ReadPHDFile");
@ -1860,7 +1880,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
//判断sampleId是否存在 //判断sampleId是否存在
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId); String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
filePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
} }
//加载dll工具库 //加载dll工具库
//System.loadLibrary("ReadPHDFile"); //System.loadLibrary("ReadPHDFile");
@ -2381,7 +2401,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr); String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(dbQcFilePath)) { if (StringUtils.isNotBlank(dbQcFilePath)) {
qcPathName=StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH)); qcPathName=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
} }
} }
FTPClient ftpClient = ftpUtil.LoginFTP(); FTPClient ftpClient = ftpUtil.LoginFTP();
@ -2473,7 +2493,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)); String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)); String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)); String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, sampleFilePath, gasFilePath, detFilePath, userName); String qcFilePath = "";
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)) {
qcFilePath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, sampleFilePath, gasFilePath, detFilePath, qcFilePath, userName);
map.put("xeData", analyseResult); map.put("xeData", analyseResult);
map.put("bProcessed", true); map.put("bProcessed", true);
map.put("savedAnalysisResult", true); map.put("savedAnalysisResult", true);
@ -2482,7 +2509,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
} else { } else {
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, path, path, path, userName); List<GardsXeResultsSpectrum> analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, path, path, path, path, userName);
map.put("XeData", analyseResult); map.put("XeData", analyseResult);
map.put("bProcessed", true); map.put("bProcessed", true);
map.put("savedAnalysisResult", true); map.put("savedAnalysisResult", true);
@ -2515,17 +2542,27 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)); String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)); String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)); String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
String qcFilePath = "";
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)) {
qcFilePath=StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
}
m_loadData.put("sampleFilePath", sampleFilePath); m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath); m_loadData.put("gasFilePath", gasFilePath);
m_loadData.put("detFilePath", detFilePath); m_loadData.put("detFilePath", detFilePath);
m_loadData.put("qcFilePath", qcFilePath);
} }
} else { } else {
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String gasFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String gasFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String detFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String detFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String qcFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
m_loadData.put("sampleFilePath", sampleFilePath); m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath); m_loadData.put("gasFilePath", gasFilePath);
m_loadData.put("detFilePath", detFilePath); m_loadData.put("detFilePath", detFilePath);
m_loadData.put("qcFilePath", qcFilePath);
} }
m_loadData.put("sampleFileName", sampleFileName); m_loadData.put("sampleFileName", sampleFileName);
m_loadData.put("gasFileName", gasFileName); m_loadData.put("gasFileName", gasFileName);
@ -2543,7 +2580,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return result; return result;
} }
private List<GardsXeResultsSpectrum> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, String sampleFilePath, String gasFilePath, String detFilePath, String userName) { private List<GardsXeResultsSpectrum> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, String sampleFilePath, String gasFilePath, String detFilePath, String qcFilePath, String userName) {
//根据文件路径 文件名称获取对应的临时文件 //根据文件路径 文件名称获取对应的临时文件
File sampleTmp = null; File sampleTmp = null;
File gasTmp = null; File gasTmp = null;
@ -2573,17 +2610,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache(); Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容 //根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta"); Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingPara = new LinkedList<>(); List<String> betaFittingPara = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>(); List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) { if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingPara = (List<String>) betaMap.get("fittingPara"); betaFittingPara = (List<String>) betaMap.get("fittingPara");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi"); betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
} }
//根据qc文件名称-用户名-gamma的方式获取gamma的内容 //根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma"); Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>(); List<String> gammaFittingPara = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>(); List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) { if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingPara = (List<String>) gammaMap.get("fittingPara"); gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi"); gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
} }
@ -2732,6 +2773,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
xeMap.put("DetBoundary", boundaryList); xeMap.put("DetBoundary", boundaryList);
} }
if (analyseData.isQcData()) {
if (StringUtils.isNotBlank(qcFilePath)) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
}
}
}
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中 //将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map); cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap); cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
@ -2766,6 +2815,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = m_loadData.get("sampleFilePath"); String sampleFilePath = m_loadData.get("sampleFilePath");
String gasFilePath = m_loadData.get("gasFilePath"); String gasFilePath = m_loadData.get("gasFilePath");
String detFilePath = m_loadData.get("detFilePath"); String detFilePath = m_loadData.get("detFilePath");
String qcFilePath = m_loadData.get("qcFilePath");
//存储重新分析字段的实体类 //存储重新分析字段的实体类
SpectrumGroup spectrum_group = new SpectrumGroup(); SpectrumGroup spectrum_group = new SpectrumGroup();
//声明一个map 缓存重新分析用到的数据 //声明一个map 缓存重新分析用到的数据
@ -2776,17 +2826,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache(); Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容 //根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta"); Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingPara = new LinkedList<>(); List<String> betaFittingPara = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>(); List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) { if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingPara = (List<String>) betaMap.get("fittingPara"); betaFittingPara = (List<String>) betaMap.get("fittingPara");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi"); betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
} }
//根据qc文件名称-用户名-gamma的方式获取gamma的内容 //根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma"); Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>(); List<String> gammaFittingPara = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>(); List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) { if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingPara = (List<String>) gammaMap.get("fittingPara"); gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi"); gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
} }
@ -2927,6 +2981,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
xeMap.put("DetBoundary", boundaryList); xeMap.put("DetBoundary", boundaryList);
} }
if (analyseData.isQcData()) {
if (StringUtils.isNotBlank(qcFilePath)) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
}
}
}
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中 //将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map); cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap); cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
@ -2963,6 +3025,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String samplePath = ""; String samplePath = "";
String gasPath = ""; String gasPath = "";
String detPath = ""; String detPath = "";
String qcPath = "";
File sampleTmp = null; File sampleTmp = null;
File gasTmp = null; File gasTmp = null;
File detTmp = null; File detTmp = null;
@ -2978,9 +3041,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName); analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
} }
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID); dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
samplePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)); samplePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
gasPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)); gasPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
detPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().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)) ){ } 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"); result.error500("Data load From DB need to pass in sampleId and dbName");
return result; return result;
@ -2988,6 +3057,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
samplePath = path; samplePath = path;
gasPath = path; gasPath = path;
detPath = path; detPath = path;
qcPath = path;
} }
//根据文件路径 文件名称获取对应的临时文件 //根据文件路径 文件名称获取对应的临时文件
sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName); sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
@ -3000,6 +3070,22 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
map.put("sampleFileName", sampleFileName); map.put("sampleFileName", sampleFileName);
//获取本地缓存的数据信息 //获取本地缓存的数据信息
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache(); Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
}
//根据key获取重新分析的参数 //根据key获取重新分析的参数
Map<String, Object> reAnalyseParam = cache.getIfPresent(sampleFileName + "-" + userName + "-reAnalyseParam"); Map<String, Object> reAnalyseParam = cache.getIfPresent(sampleFileName + "-" + userName + "-reAnalyseParam");
//判断重新分析的参数信息是否为空 //判断重新分析的参数信息是否为空
@ -3008,6 +3094,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
//调用分析方法 //调用分析方法
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map); phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(qcPath)) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
}
}
if (CollectionUtils.isNotEmpty(map)) { if (CollectionUtils.isNotEmpty(map)) {
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData"); List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
if (CollectionUtils.isNotEmpty(xeDataList)){ if (CollectionUtils.isNotEmpty(xeDataList)){
@ -3061,6 +3154,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
try { try {
if (CollectionUtils.isNotEmpty(sampleFileNames)) { if (CollectionUtils.isNotEmpty(sampleFileNames)) {
for (int i=0; i<sampleFileNames.size(); i++) { for (int i=0; i<sampleFileNames.size(); i++) {
//拼接ftp上传临时文件路径
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String samplePath = "";
String gasPath = "";
String detPath = "";
String qcPath = "";
String dbName = dbNames.get(i); String dbName = dbNames.get(i);
Integer sampleId = sampleIds.get(i); Integer sampleId = sampleIds.get(i);
String sampleFileName = sampleFileNames.get(i); String sampleFileName = sampleFileNames.get(i);
@ -3082,24 +3181,29 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName); analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
} }
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID); dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
samplePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasPath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
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)) ){ } 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"); result.error500("Data load From DB need to pass in sampleId and dbName");
return result; return result;
} } else {//如果sampleId,dbNamed都为空 就指向ftp上传文件临时路径
//拼接ftp上传临时文件路径 samplePath = path;
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName; gasPath = path;
//判断数据库文件路径是否为空 如果为空 就指向ftp上传文件临时路径 detPath = path;
String samplePath = path; qcPath = path;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
samplePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
}
String gasPath = path;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
}
String detPath = path;
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
detPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
} }
//根据文件路径 文件名称获取对应的临时文件 //根据文件路径 文件名称获取对应的临时文件
sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName); sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
@ -3108,6 +3212,22 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
map.put("sampleFileName", sampleFileName); map.put("sampleFileName", sampleFileName);
//获取本地缓存的数据信息 //获取本地缓存的数据信息
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache(); Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
}
//根据key获取重新分析的参数 //根据key获取重新分析的参数
Map<String, Object> reAnalyseParam = cache.getIfPresent(sampleFileName + "-" + userName + "-reAnalyseParam"); Map<String, Object> reAnalyseParam = cache.getIfPresent(sampleFileName + "-" + userName + "-reAnalyseParam");
//判断重新分析的参数信息是否为空 //判断重新分析的参数信息是否为空
@ -3116,6 +3236,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
//调用分析方法 //调用分析方法
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map); phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(qcPath)) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
}
}
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData"); List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
if (CollectionUtils.isNotEmpty(xeDataList)){ if (CollectionUtils.isNotEmpty(xeDataList)){
for (GardsXeResultsSpectrum xeData:xeDataList) { for (GardsXeResultsSpectrum xeData:xeDataList) {
@ -3243,19 +3370,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID); SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){ if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
} }
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
} }
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
} }
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) { if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr); String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
if (StringUtils.isNotBlank(qcFilePath)) { if (StringUtils.isNotBlank(qcFilePath)) {
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH))); anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
} }
} }
} }
@ -3412,9 +3539,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName()); sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName()); gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName()); detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp)); ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp)); ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp)); ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
@ -3500,18 +3627,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(sampleId)) { if (Objects.nonNull(sampleId)) {
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID); SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId, analysisID);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){ if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
} }
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
} }
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) { if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH))); anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
} }
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) { if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss"); String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr); String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH))); anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
} }
} }
} else { } else {

View File

@ -47,7 +47,7 @@ public class ReadLineUtil {
try { try {
ftpClient.enterLocalPassiveMode(); ftpClient.enterLocalPassiveMode();
String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1); String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1);
String parameterFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH)); String parameterFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
//判断文件路径是否为空 //判断文件路径是否为空
if (StringUtils.isNotBlank(parameterFilePath)){ if (StringUtils.isNotBlank(parameterFilePath)){
//在当前工作路径下读取文件 //在当前工作路径下读取文件
@ -187,7 +187,7 @@ public class ReadLineUtil {
OutputStream outputStream = null; OutputStream outputStream = null;
InputStream inputStream = null; InputStream inputStream = null;
try { try {
filePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + filePath; filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath;
// 切换工作目录为 / // 切换工作目录为 /
ftpClient.changeWorkingDirectory(SymbolConstant.SINGLE_SLASH); ftpClient.changeWorkingDirectory(SymbolConstant.SINGLE_SLASH);