Beta新增Extrapolation页面分析接口返回内容修改

This commit is contained in:
qiaoqinzheng 2023-10-18 14:59:02 +08:00
parent 4f528dff93
commit 6a456f7b8f
3 changed files with 65 additions and 38 deletions

View File

@ -151,7 +151,7 @@ public class SpectrumAnalysesController {
//todo--功能不明确待完成
@PostMapping("analyseExtrapolation")
public Result analyseExtrapolation(@RequestBody AnalyseExtInfo extInfo, HttpServletRequest request) {
return null;
return spectrumAnalysisService.analyseExtrapolation(extInfo, request);
}
@GetMapping("viewMDC")

View File

@ -0,0 +1,18 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class TableExtData implements Serializable {
private Integer index;
private Double eb;
private Double nx;
private Double ny;
}

View File

@ -2266,12 +2266,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
for(int i=0;i<Nx.size()&&i<Ny.size();i++) {
SeriseData temp = new SeriseData();
temp.setX(Nx.get(pos));
temp.setY(Ny.get(pos));
temp.setX(Nx.get(i));
temp.setY(Ny.get(i));
scatter_serise_data.add(temp);
}
String fittingTitle = "";
String fittingDataFormat = "";
String functionFit = "";
String tempStr = "";
if(fittype.equals("liner")) {
SeriseData left = new SeriseData();
@ -2291,8 +2290,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
right.setY(rData.get(0));
line_serise_data.add(left);
line_serise_data.add(right);
// fittingTitle = RESULT_FITTING_LINER_TITLE;
// fittingDataFormat = tempStr.sprintf(RESULT_FITTING_LINER_DATA,fittingPara.at(0),fittingPara.at(1));
functionFit = "Y = A*X + B ";
if (scatter_serise_data.size()>1) {
functionFit = String.format("Y = %f*X + %f ", fittingPara.get(0), fittingPara.get(1));
}
} else if(fittype.equals("poly2")) {
for(int i=1;i<51;i++) {
SeriseData temp = new SeriseData();
@ -2304,43 +2305,51 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
temp.setY(rData.get(0));
line_serise_data.add(temp);
}
// fittingTitle = RESULT_FITTING_2_TITLE;
// fittingDataFormat = tempStr.sprintf(RESULT_FITTING_2_DATA,fittingPara.at(0),fittingPara.at(1),fittingPara.at(2));
functionFit = "Y = A+ B*X + C*X^2 ";
if (scatter_serise_data.size()>1) {
functionFit = String.format("Y = %f+ %f*X + C*%f^2 ",fittingPara.get(0),fittingPara.get(1),fittingPara.get(2));
}
} else if(fittype.equals("poly3")) {
// fittingTitle = RESULT_FITTING_3_TITLE;
// fittingDataFormat = RESULT_FITTING_3_DATA;
functionFit = "Y = A+ B*X + C*X^2 +D*X^3 ";
}
List<TableExtData> extDataList = new LinkedList<>();
for(int i=0;i<Nx.size()&&i<Ny.size()&&i<Eb.size();i++) {
TableExtData extData = new TableExtData();
extData.setIndex(i);
extData.setEb( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Eb.get(i)))) );
extData.setNx( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Nx.get(i)))) );
extData.setNy( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Ny.get(i)))) );
extDataList.add(extData);
}
String refTime = "Reference Time: ";
String xeAct = "Xe Activity (Bq): ";
if (scatter_serise_data.size()>1) {
refTime = String.format("Reference Time: %s ",sampleTmp.acquisition_start_date+" "+sampleTmp.acquisition_start_time);
xeAct = String.format("Xe Activity (Bq): %f", Xe_activity);
}
map.put("tableData", extDataList);
map.put("functionFit", functionFit);
map.put("refTime", refTime);
map.put("xeAct", xeAct);
map.put("resultViewScatterDataValue", scatter_serise_data);
map.put("resultViewLineDataValue", line_serise_data);
if(maxLeft<=0||maxBottom<=0||scatter_serise_data.size()<=1) {
result.setSuccess(true);
result.setResult(map);
return result;
}
if(maxLeft<4) {
map.put("leftFormat", "%f");
} else {
map.put("leftFormat", "%i");
}
// String resultText = "";
// resultText+=RESULT_TITLE;
// resultText+=tempStr.sprintf(RESULT_DATA_TITLE);
// for(int i=0;i<Nx.size()&&i<Ny.size()&&i<Eb.size();i++) {
// resultText+=tempStr.sprintf(RESULT_DATA,i,Eb.get(i),Nx.get(i),Ny.get(i));
// }
// resultText+=fittingTitle;
// resultText+=fittingDataFormat;
// resultText+=XE_ACTIVTITY_TITLE;
// resultText+=tempStr.sprintf(XE_ACTIVTITY_DATA,ui->label_acquisition_start_show->text().toStdString().c_str(),Xe_activity);
// if(maxLeft<=0||maxBottom<=0||scatter_serise_data.size()<=1) {
// return result;
// }
// if(maxLeft<4) {
// m_extraResult.SetLeftFormat(QLatin1String("%f"));
// } else {
// m_extraResult.SetLeftFormat(QLatin1String("%i"));
// }
maxBottom+=1;
maxLeft*=1.5;
minLeft-=1.5;
// m_extraResult.SetResultText(resultText);
// m_extraResult.SetResultViewLeftRange(0,maxLeft);
// m_extraResult.SetResultVIewBottomRange(minLeft,maxBottom);
// m_extraResult.SetResultViewScatterDataValue(scatter_serise_data);
// m_extraResult.SetResultViewLineDataValue(line_serise_data);
return null;
result.setSuccess(true);
result.setResult(map);
return result;
}
private List<Long> handleHistogram(List<Long> hcounts, long bChannels, long gChannels, String type) {