AcceptInfo实体类新增tablePeaksList字段

CalValuesHandler新增方法fitPeakFull重新拟合peak的数据
gamma功能修改acceptResults接口及对应执行体代码
GammaFileUtil保存文件路径修改
SpectrumPathProperties新增保存文件路径
This commit is contained in:
qiaoqinzheng 2023-10-16 18:19:07 +08:00
parent 3c1ee016f0
commit 59f35cd7cc
10 changed files with 501 additions and 298 deletions

View File

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

View File

@ -3104,9 +3104,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
String qsSaveBaseLine = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsBaseLinePath;
String qsSaveLc = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsLcPath;
String qsSaveScac = StringPool.SLASH+spectrumPathProperties.getRootPath()+StringPool.SLASH+qsScacPath;
String qsSaveBaseLine = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsBaseLinePath;
String qsSaveLc = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsLcPath;
String qsSaveScac = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsScacPath;
GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), qsSaveBaseLine);
GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", qsSaveLc);
GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", qsSaveScac);
@ -3135,9 +3135,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
middleData.analyses_baseline_absolute_filePath =qsSaveLc;
middleData.analyses_lc_absolute_filePath=qsSaveLc;
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_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) {
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 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) {
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = new EnergySpectrumStruct();
EnergySpectrumStruct struct = null;
FTPClient ftpClient = ftpUtil.LoginFTP();
InputStream inputStream = null;
File file = null;
@ -981,4 +953,59 @@ public class PHDFileUtil {
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")
@ApiOperation(value = "InteractiveTool页面Insert页面save", notes = "InteractiveTool页面Insert页面save")
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")

View File

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

View File

@ -34,7 +34,7 @@ public interface IGammaService{
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);

View File

@ -147,7 +147,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("样品文件不存在!");
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);
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
if (!flag){
@ -424,7 +424,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
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);
//调用加载文件的方法 传入文件路径文件名称全局变量phd响应结果result
@ -505,9 +505,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
int peakNum = 0;
if (Objects.nonNull(analysis)){
phd.setId_analysis(analysis.getIdAnalysis().toString());
phd.setBaseline_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + analysis.getScacPath());
phd.setBaseline_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
peakNum = analysis.getNumberOfPeaks();
phd.setTotalCmt(analysis.getComments());
phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel());
@ -1157,7 +1157,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
a++;
}
PeakInfo peak = new PeakInfo();
peak.index = a;
peak.index = a+1;
peak.left = structInsertOutput.vLeft.get(j).intValue();;
peak.right = structInsertOutput.vRight.get(j).intValue();;
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.recoilDeltaChan = String.valueOf(structInsertOutput.recoilDeltaChan.get(j));
newPeaks.add(a, peak);
newPeak.add(peak);
}
}
int left = structInsertOutput.vLeft.get(0).intValue();
@ -1194,21 +1193,21 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
ii++;
}
List<TablePeaks> tablePeaksList = FitPeakBaseLine(newPeaks, phd.getUsedEnerPara().getP(), vIdx);
map.put("tablePeaksList", tablePeaksList);
FitPeakBaseLine(newPeaks, phd.getUsedEnerPara().getP(), vIdx, map);
map.put("oldPeaks", vOriPeaks);
map.put("newPeaks", newPeak);
result.setSuccess(true);
result.setResult(map);
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<PeakInfo> newPeaks = new LinkedList<>();
int peakNum = vIdx.size();
for (int i=0; i<peakNum; i++) {
int peakIdx = vIdx.get(i);
PeakInfo peak = vPeaks.get(peakIdx);
newPeaks.add(peak);
TablePeaks tablePeaks = new TablePeaks();
tablePeaks.setLab(String.valueOf(peakIdx + 1));
String nuclide = "";
@ -1228,11 +1227,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
tablePeaks.setFwhmB(true);
tablePeaksList.add(tablePeaks);
}
return tablePeaksList;
map.put("tablePeaksList", tablePeaksList);
map.put("newPeaks", newPeaks);
}
@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();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
@ -1241,69 +1241,120 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("请先选择解析文件!");
return result;
}
List<Long> m_vCount = new LinkedList<>();
long m_nCount = phd.getSpec().getNum_g_channel();
long m_nSChan = phd.getSpec().getBegin_channel();
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 确保绘制曲线时所有谱都是从1道开始
int i = 0;
if(m_nSChan == 0){
i = 1;
}
for(; i<m_nCount; ++i) {
m_vCount.add(phd.getSpec().getCounts().get(i));
}
if(m_nSChan == 0) {
m_vCount.add(0L);
}
HashMap<String, Object> map = new HashMap<>();
//根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线
if (accept){
if (flag.equalsIgnoreCase("fit")) {//如果传递的flag标识 fit则进行修改峰值等数据
for (int j=0; j<newPeak.size(); j++) {
PeakInfo peakInfo = newPeak.get(j);
phd.getVPeak().set(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) {
try {
List<Long> m_vCount = new LinkedList<>();
long m_nCount = phd.getSpec().getNum_g_channel();
long m_nSChan = phd.getSpec().getBegin_channel();
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 确保绘制曲线时所有谱都是从1道开始
int i = 0;
if(m_nSChan == 0){
i = 1;
}
for(; i<m_nCount; ++i) {
m_vCount.add(phd.getSpec().getCounts().get(i));
}
if(m_nSChan == 0) {
m_vCount.add(0L);
}
HashMap<String, Object> map = new HashMap<>();
//根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线
if (accept){
if (flag.equalsIgnoreCase("fit")) {//如果传递的flag标识 fit则进行修改峰值等数据
for (int j=0; j<newPeak.size(); j++) {
PeakInfo peakInfo = newPeak.get(j);
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());
map.put("table", vPeak);
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
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<Double> vC_Rg = new LinkedList<>();
vC_Rg.add(Double.valueOf(phd.getBaseCtrls().getRg_low()));
vC_Rg.add(Double.valueOf(phd.getBaseCtrls().getRg_high()));
List<Double> vE_Rg = CalValuesHandler.calFcnEval(vC_Rg, phd.getUsedEnerPara().getP()).counts;
if(vE_Rg.size() != 2 || vE_Rg.get(0).isNaN() || vE_Rg.get(1).isNaN()) {
return result;
}
List<Integer> Af = new LinkedList<>();
List<Integer> Cf = new LinkedList<>();
List<Integer> Ff = new LinkedList<>();
//遍历列表中的数据
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"));
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;
}
@ -1385,16 +1436,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
// 备份原来的峰列表
List<PeakInfo> vOriPeaks = phd.getVPeak();
List<PeakInfo> newPeak = new LinkedList<>();
for (int i=0; i<vIdx.size(); i++) {
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);
FitPeakBaseLine(phd.getVPeak(), phd.getUsedEnerPara().getP(), vIdx, map);
map.put("oldPeaks", vOriPeaks);
map.put("newPeaks", newPeak);
result.setSuccess(true);
result.setResult(map);
return result;
@ -1757,44 +1801,55 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override
public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) {
// Result result = new Result();
// HashMap<String, Object> map = new HashMap<>();
// //获取用户名
// String userName = JwtUtil.getUserNameByToken(request);
// //获取文件名称
// String fileName = baseLineCtrls.getFileName();
// Cache<String, PHDFile> phdCache = localCache.getPHDCache();
// PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
// if (Objects.isNull(phd)){
// result.error500("请先选择解析文件!");
// return result;
// }
// List<Long> m_vCount = new LinkedList<>();
// long m_nCount = phd.getSpec().getNum_g_channel();
// long m_nSChan = phd.getSpec().getBegin_channel();
// //获取当前角色的颜色配置
// Map<String, String> colorMap = sysUserColorService.initColor(userName);
// // 确保绘制曲线时所有谱都是从1道开始
// int i = 0;
// if(m_nSChan == 0){
// i = 1;
// }
// for(; i<m_nCount; ++i) {
// m_vCount.add(phd.getSpec().getCounts().get(i));
// }
// if(m_nSChan == 0) {
// m_vCount.add(0L);
// }
// if(baseLineCtrls.isReplotNeeded()) {
// baseLineCtrls.setReplotNeeded(false);
// List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), baseLineCtrls.getBaseline(), colorMap.get("Color_peak"), m_nCount, null, false);
// m_chart->AddData(CreateTempBaseLine(m_data->m_Color[Color_base], "BaseLine"));
// CreateShapeCP(MyChartSpace::Shape_Round);
//
// if(m_baseCtrl.BaseStack.size() > 2) m_baseCtrl.BaseStack.remove(1, m_baseCtrl.BaseStack.size()-2);
// }
return null;
Result result = new Result();
HashMap<String, Object> map = new HashMap<>();
//获取用户名
String userName = JwtUtil.getUserNameByToken(request);
//获取文件名称
String fileName = baseLineCtrls.getFileName();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
result.error500("请先选择解析文件!");
return result;
}
List<Long> m_vCount = new LinkedList<>();
long m_nCount = phd.getSpec().getNum_g_channel();
long m_nSChan = phd.getSpec().getBegin_channel();
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 确保绘制曲线时所有谱都是从1道开始
int i = 0;
if(m_nSChan == 0){
i = 1;
}
for(; i<m_nCount; ++i) {
m_vCount.add(phd.getSpec().getCounts().get(i));
}
if(m_nSChan == 0) {
m_vCount.add(0L);
}
if(baseLineCtrls.isReplotNeeded()) {
baseLineCtrls.setReplotNeeded(false);
BaseControls m_baseCtrl = new BaseLineCtrls();
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
phd.setBaseCtrls(m_baseCtrl);
phd.setVBase(m_baseCtrl.getBaseline());
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);
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
@ -1811,15 +1866,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("请先选择解析文件!");
return result;
}
if(baseLineCtrls.getBaseStack().size() > 1) {
for (int i=0; i<baseLineCtrls.getBaseStack().size(); i++) {
baseLineCtrls.getBaseStack().remove(i);
}
// if(baseLineCtrls.getBaseStack().size() > 1) {
// for (int i=0; i<baseLineCtrls.getBaseStack().size(); i++) {
// baseLineCtrls.getBaseStack().remove(i);
// }
BaseControls m_baseCtrl = new BaseLineCtrls();
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
phd.setBaseCtrls(m_baseCtrl);
phd.setVBase(m_baseCtrl.getBaseline());
}
// }
List<Long> m_vCount = new LinkedList<>();
long m_nCount = phd.getSpec().getNum_g_channel();
long m_nSChan = phd.getSpec().getBegin_channel();
@ -3240,15 +3295,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override
public void viewARR(Integer sampleId, HttpServletResponse response) {
if(Objects.isNull(sampleId)) {
String waring = "The file isn't existed.";
}
//获取自动处理生成的报告地址
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
if(StringUtils.isBlank(reportPath.trim())) {
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";
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -3304,7 +3353,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if(StringUtils.isBlank(reportPath.trim())) {
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";
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
@ -3841,13 +3890,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
if (Objects.isNull(sampleId)){
String waring = "The file isn't existed.";
}
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 fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
//连接ftp

View File

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

View File

@ -47,7 +47,7 @@ public class ReadLineUtil {
try {
ftpClient.enterLocalPassiveMode();
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)){
//在当前工作路径下读取文件
@ -187,7 +187,7 @@ public class ReadLineUtil {
OutputStream outputStream = null;
InputStream inputStream = null;
try {
filePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + filePath;
filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath;
// 切换工作目录为 /
ftpClient.changeWorkingDirectory(SymbolConstant.SINGLE_SLASH);