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

This commit is contained in:
nieziyan 2023-11-14 18:59:11 +08:00
commit 4ef79c1a2b
25 changed files with 599 additions and 366 deletions

View File

@ -167,9 +167,9 @@ public class FTPUtil {
response.reset();
//设置响应类型
response.setContentType("application/download");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(fileName,"UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
//获取输出流
out = response.getOutputStream();
//声明一个长度参数
@ -437,6 +437,8 @@ public class FTPUtil {
public File downloadFile(String fromPath, String toPath) {
FTPClient ftpClient = null;
InputStream inputStream = null;
// 声明一个临时文件
File tempFile = null;
try {
ftpClient = LoginFTP();
// 切换被动模式
@ -446,10 +448,11 @@ public class FTPUtil {
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
inputStream = ftpClient.retrieveFileStream(fromPath);
// 声明一个临时文件
File tempFile = File.createTempFile(toPath, null);
// 将FTP文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, tempFile);
if (Objects.nonNull(inputStream)) {
tempFile = File.createTempFile(toPath, null);
// 将FTP文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, tempFile);
}
return tempFile;
} catch (IOException e) {
e.printStackTrace();

View File

@ -64,6 +64,8 @@ public class PeakInfo implements Serializable {
public PeakInfo(){
nuclides = new LinkedList<>();
comments = "";
recoilBetaChan = "nan";
recoilDeltaChan = "nan";
}
}

View File

@ -3363,8 +3363,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
dvctUPPERTAIL.add(fileAnlyse.getVPeak().get(m).upperTail);
dvctUPPERTAILALPHA.add(fileAnlyse.getVPeak().get(m).upperTailAlpha);
dvctBWWIDTHCHAN.add(fileAnlyse.getVPeak().get(m).BWWidthChan);
dvctRECOILBETACHAN.add(Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan));
dvctRECOILDELTACHAN.add(Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan));
dvctRECOILBETACHAN.add(fileAnlyse.getVPeak().get(m).recoilBetaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan));
dvctRECOILDELTACHAN.add(fileAnlyse.getVPeak().get(m).recoilDeltaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan));
dvctSTEPRAIO.add(fileAnlyse.getVPeak().get(m).stepRatio);
dvctBACKGROUNDAREA.add(fileAnlyse.getVPeak().get(m).backgroundArea);
dvctMEANBACKCOUNT.add(fileAnlyse.getVPeak().get(m).meanBackCount);
@ -3508,8 +3508,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
dvctACTIV_KEY.add(itor_v.getValue().getActivity());
dvctACTIV_KEY_ERR.add(itor_v.getValue().getAct_err());
dvctMDA.add(String.format("%e", itor_v.getValue().getMda()));
dvctMDC.add(itor_v.getValue().getMdc()>0?String.format("%e", itor_v.getValue().getMdc()):"0.0");
dvctCONCENTRATION.add(String.format("%e", itor_v.getValue().getConcentration()));
dvctMDC.add(Objects.isNull(itor_v.getValue().getMdc())?null:(itor_v.getValue().getMdc().isInfinite()?"inf":(itor_v.getValue().getMdc()>0?String.format("%e", itor_v.getValue().getMdc()):"0.0")));
dvctCONCENTRATION.add(Objects.isNull(itor_v.getValue().getConcentration())?null:itor_v.getValue().getConcentration().isInfinite()?"inf":String.format("%e", itor_v.getValue().getConcentration()));
dvctCSC_RATIO.add(1.0);
dvctCSC_RATIO_ERR.add(0.0);
if(itor_v.getValue().getCalculateIdx() >= 0 && itor_v.getValue().getCalculateIdx()<itor_v.getValue().getVEnergy().size()) {
@ -3633,17 +3633,21 @@ public class GammaFileUtil extends AbstractLogOrReport {
String str_mda = (nuc.getMda() <= 0 ? "null" : NumberFormatUtil.numberFormat(String.valueOf(nuc.getMda())));
tableNuclideActivity.setMda(str_mda);
if (Double.isFinite(nuc.getConcentration())) {
DecimalFormat decimalFormat = new DecimalFormat("0.###E0");
nuc.setConcentration(Double.valueOf(decimalFormat.format(nuc.getConcentration())));
if (Objects.nonNull(nuc.getConcentration())) {
if (Double.isFinite(nuc.getConcentration())) {
DecimalFormat decimalFormat = new DecimalFormat("0.###E0");
nuc.setConcentration(Double.valueOf(decimalFormat.format(nuc.getConcentration())));
}
}
String str_con = (Double.isFinite(nuc.getConcentration())? nuc.getConcentration() <= 0 ? "null" : NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration())) : "inf");
String str_con = (Objects.nonNull(nuc.getConcentration())?(Double.isFinite(nuc.getConcentration())? nuc.getConcentration() <= 0 ? "null" : NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration())) : "inf"):"null");
tableNuclideActivity.setConc(str_con);
if (Double.isFinite(nuc.getMdc())) {
DecimalFormat decimalFormat = new DecimalFormat("0.###E0");
nuc.setMdc(Double.valueOf(decimalFormat.format(nuc.getMdc())));
if (Objects.nonNull(nuc.getMdc())) {
if (Double.isFinite(nuc.getMdc())) {
DecimalFormat decimalFormat = new DecimalFormat("0.###E0");
nuc.setMdc(Double.valueOf(decimalFormat.format(nuc.getMdc())));
}
}
String str_mdc = (Double.isFinite(nuc.getMdc())? nuc.getMdc() <= 0 ? "null" : NumberFormatUtil.numberFormat(String.valueOf(nuc.getMdc())) : "inf");
String str_mdc = (Objects.nonNull(nuc.getMdc())?(Double.isFinite(nuc.getMdc())?nuc.getMdc() <= 0 ? "null" : NumberFormatUtil.numberFormat(String.valueOf(nuc.getMdc())) : "inf"):"null");
tableNuclideActivity.setMdc(str_mdc);
nuclideActivityList.add(tableNuclideActivity);
}
@ -3864,15 +3868,18 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public List<PeakInfo> InitPeakTable(List<PeakInfo> vPeak) {
//遍历vPeak
for (PeakInfo info:vPeak) {
if (Objects.isNull(info.recoilBetaChan)) {
info.recoilBetaChan = "nan";
}
if (Objects.isNull(info.recoilDeltaChan)) {
info.recoilDeltaChan = "nan";
}
}
List<PeakInfo> result = new LinkedList<>();
for(int i=0; i<vPeak.size(); i++) {
PeakInfo peakInfo = new PeakInfo();
if (StringUtils.isBlank(vPeak.get(i).recoilDeltaChan)) {
vPeak.get(i).recoilDeltaChan = vPeak.get(i-1).recoilDeltaChan;
}
if (StringUtils.isBlank(vPeak.get(i).recoilBetaChan)) {
vPeak.get(i).recoilBetaChan = vPeak.get(i-1).recoilBetaChan;
}
peakInfo.index = i+1;
peakInfo.left = vPeak.get(i).left;
peakInfo.right = vPeak.get(i).right;

View File

@ -1,71 +0,0 @@
package org.jeecg.modules.entity.vo;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
public class PeakInfo implements Serializable {
public int index; //峰序号
public int multiIndex; //重峰序号
public int left; //峰的左边界
public int right; //峰的右边界
public double peakCentroid; //峰拟合后加权峰中心道
public double energy;
public double fwhmc; //半高宽
public double fwhm; //以keV为单位的半高宽
public double area; //净面积
public double areaErr; //
public double efficiency;
public double lc;
public double ld;
public double meanBackCount;
public double backgroundArea;
public double significance;
public double sensitivity;
public double stepRatio;
public double tail;
public double tailAlpha;
public double upperTail;
public double upperTailAlpha;
public double BWWidthChan;
public String recoilBetaChan;
public String recoilDeltaChan;
public String comments;
public List<String> nuclides;
public PeakInfo(){
nuclides = new LinkedList<>();
comments = "";
recoilBetaChan = "nan";
recoilDeltaChan = "nan";
}
}

View File

@ -32,8 +32,8 @@ public class GammaController {
@GetMapping("initValue")
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
public Result initValue(Integer sampleId, String dbName, String fileName, HttpServletRequest request) {
return gammaService.initValue(sampleId, dbName, fileName, request);
public Result initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request) {
return gammaService.initValue(sampleId, dbName, analyst, fileName, request);
}
@ -43,8 +43,8 @@ public class GammaController {
}
@GetMapping("gammaByDB")
public Result gammaByDB(Integer sampleId, String dbName, HttpServletRequest request){
return gammaService.gammaByDB(dbName, sampleId, request);
public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){
return gammaService.gammaByDB(dbName, sampleId, analyst, request);
}
@GetMapping("gammaByFile")

View File

@ -26,8 +26,8 @@ public class SpectrumAnalysesController {
@GetMapping("getDBSearchList")
@ApiOperation(value = "查询查询条件数据接口", notes = "查询查询条件数据接口")
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes) {
return spectrumAnalysisService.getDBSearchList(request, AllUsers, dbName, menuTypes);
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers) {
return spectrumAnalysisService.getDBSearchList(request, AllUsers);
}
@GetMapping("getDBSpectrumList")

View File

@ -31,6 +31,9 @@ public class GardsSampleDataSpectrum extends GardsSampleData {
@TableField(exist = false)
private String dbName;
@TableField(exist = false)
private String analyst;
@TableField(exist = false)
@Excel(name = "NO" ,orderNum = "1")
private Integer no;

View File

@ -12,11 +12,11 @@ import java.util.List;
public interface IGammaService{
Result initValue(Integer sampleId, String dbName, String fileName, HttpServletRequest request);
Result initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request);
Result testFun(String fileName, HttpServletRequest request);
Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request);
Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
Result gammaByFile(String fileName, HttpServletRequest request);

View File

@ -14,7 +14,7 @@ import java.util.List;
public interface ISpectrumAnalysisService {
Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes);
Result getDBSearchList(HttpServletRequest request, boolean AllUsers);
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String dbName, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request);

View File

@ -140,7 +140,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
@Override
public Result initValue(Integer sampleId, String dbName, String samfileName, HttpServletRequest request) {
public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
Result result = new Result();
//获取用户名
String userName = JwtUtil.getUserNameByToken(request);
@ -168,7 +168,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (dbName.equals("auto")) {
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
} else if (dbName.equals("man")) {
gammaFileUtil.SetBaseInfo(phd, userName);
gammaFileUtil.SetBaseInfo(phd, analyst);
}
// 从数据库中读取phd其他相关信息
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
@ -410,10 +410,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
for (PeakInfo info:phd.getVPeak()) {
if (StringUtils.isBlank(info.recoilBetaChan)) {
if (Objects.isNull(info.recoilBetaChan)) {
info.recoilBetaChan = "nan";
}
if (StringUtils.isBlank(info.recoilDeltaChan)) {
if (Objects.isNull(info.recoilDeltaChan)) {
info.recoilDeltaChan = "nan";
}
}
@ -433,7 +433,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
@Override
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
Result result = new Result();
// 通过token获取用户名
String userName = JwtUtil.getUserNameByToken(request);
@ -466,7 +466,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (dbName.equals("auto")) {
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
} else if (dbName.equals("man")) {
gammaFileUtil.SetBaseInfo(phd, userName);
gammaFileUtil.SetBaseInfo(phd, analyst);
}
// 从数据库中读取phd其他相关信息
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
@ -596,16 +596,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
peakInfo.ld = peaksSpectrum.getLd() == null ? 0 : peaksSpectrum.getLd();
peakInfo.meanBackCount = peaksSpectrum.getMeanbackcount() == null ? 0 : peaksSpectrum.getMeanbackcount();
peakInfo.backgroundArea = peaksSpectrum.getBackgroundarea() == null ? 0 : peaksSpectrum.getBackgroundarea();
peakInfo.significance = peaksSpectrum.getSignificance() == null ? 0 : peaksSpectrum.getSignificance();
peakInfo.sensitivity = peaksSpectrum.getSensitivity() == null ? 0 : peaksSpectrum.getSensitivity();
peakInfo.significance = peaksSpectrum.getSignificance() == null ? Double.NaN : peaksSpectrum.getSignificance();
peakInfo.sensitivity = peaksSpectrum.getSensitivity() == null ? Double.NaN : peaksSpectrum.getSensitivity();
peakInfo.stepRatio = peaksSpectrum.getStepraio() == null ? 0 : peaksSpectrum.getStepraio();
peakInfo.tail = peaksSpectrum.getTail() == null ? 0 : peaksSpectrum.getTail();
peakInfo.tailAlpha = peaksSpectrum.getTailAlpha() == null ? 0 : peaksSpectrum.getTailAlpha();
peakInfo.upperTail = peaksSpectrum.getUpperTail() == null ? 0 : peaksSpectrum.getUpperTail();
peakInfo.upperTailAlpha = peaksSpectrum.getUpperTailAlpha() == null ? 0 : peaksSpectrum.getUpperTailAlpha();
peakInfo.BWWidthChan = peaksSpectrum.getBwwidthchan() == null ? 0 : peaksSpectrum.getBwwidthchan();
peakInfo.recoilBetaChan = "1";
peakInfo.recoilDeltaChan = peaksSpectrum.getRecoildeltachan() == null ? "1" : peaksSpectrum.getRecoildeltachan().toString();
peakInfo.BWWidthChan = peaksSpectrum.getBwwidthchan() == null ? Double.NaN : peaksSpectrum.getBwwidthchan();
peakInfo.recoilBetaChan = "nan";
peakInfo.recoilDeltaChan = peaksSpectrum.getRecoildeltachan() == null ? "nan" : String.valueOf(peaksSpectrum.getRecoildeltachan());
peakInfo.comments = StringUtils.isNotBlank(peaksSpectrum.getPeakcomments()) ? peaksSpectrum.getPeakcomments() : "";
phd.getVPeak().add(peakInfo);
}
@ -1308,7 +1308,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
peak.peakCentroid = structInsertOutput.peakCentroid.get(j);
peak.energy = structInsertOutput.energy.get(j);
peak.area = structInsertOutput.area.get(j);
Double sensitivity = String.valueOf(structInsertOutput.sensitivity.get(j)).equalsIgnoreCase("nan") ? 0.0 : structInsertOutput.sensitivity.get(j);
Double sensitivity = String.valueOf(structInsertOutput.sensitivity.get(j)).equalsIgnoreCase("nan") ? Double.NaN : structInsertOutput.sensitivity.get(j);
peak.sensitivity = sensitivity;
peak.fwhm = structInsertOutput.fwhm.get(j);
peak.fwhmc = structInsertOutput.fwhmc.get(j);
@ -1434,9 +1434,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
for (int j = 0; j < tablePeaksList.size(); j++) {
TablePeaks nPeak = tablePeaksList.get(j);
PeakInfo peak = phd.getVPeak().get(Integer.valueOf(nPeak.getLab()) - 1);
peak.energy = Double.parseDouble(nPeak.getEnergy());
peak.area = Double.parseDouble(nPeak.getNetArea());
peak.fwhm = Double.parseDouble(nPeak.getFwhm());
if (!NumberFormatUtil.numberFormat(String.valueOf(peak.energy)).equals(nPeak.getEnergy()) ) {
peak.energy = Double.parseDouble(nPeak.getEnergy());
}
if (!NumberFormatUtil.numberFormat(String.valueOf(peak.area)).equals(nPeak.getNetArea())) {
peak.area = Double.parseDouble(nPeak.getNetArea());
}
if (!NumberFormatUtil.numberFormat(String.valueOf(peak.fwhm)).equals(nPeak.getFwhm())) {
peak.fwhm = Double.parseDouble(nPeak.getFwhm());
}
double dE = CalValuesHandler.calDerivaOut(peak.peakCentroid, phd.getUsedEnerPara().getP());
if (peak.energy < vE_Rg.get(0) || peak.energy > vE_Rg.get(1)) {
@ -1453,13 +1459,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
if (!tablePeaksList.get(j).isNetAreaB()) {
Af.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
Af.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
}
if (!tablePeaksList.get(j).isCentroid()) {
Cf.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
Cf.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
}
if (!tablePeaksList.get(j).isFwhmB()) {
Ff.add(Integer.valueOf(tablePeaksList.get(j).getLab()));
Ff.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
}
}
ObjectMapper mapper = new ObjectMapper();
@ -1573,7 +1579,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
gammaFileUtil.PeaksChanged(phd);
for (int i = 0; i < phd.getVPeak().size(); i++) {
PeakInfo peakInfo = phd.getVPeak().get(i);
peakInfo.index = i + 1;
peakInfo.index = i;
}
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
map.put("table", vPeak);
@ -4163,7 +4169,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
tableResult.setActErr(act_err);
tableResult.setFactor1(coverage_factor);
tableResult.setConfidence1(level_confidence);
tableResult.setConc(NumUtil.keep4ScienceStr(nuc.getConcentration() / 1000));
tableResult.setConc(Objects.isNull(nuc.getConcentration())?null:NumUtil.keep4ScienceStr(nuc.getConcentration() / 1000));
tableResult.setConcErr(act_err);
tableResult.setFactor2(coverage_factor);
tableResult.setConfidence2(level_confidence);

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.cache.Cache;
import io.swagger.models.auth.In;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.shiro.SecurityUtils;
@ -108,26 +109,20 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
@Autowired
private IGardsHistogramSpectrumService histogramService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes) {
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers) {
Result result = new Result();
Map<String, List<String>> map = new HashMap<>();
List<String> menuTypeList = Arrays.asList(menuTypes);
//查询谱对应的台站类型
if (CollectionUtils.isEmpty(menuTypeList)){
result.error500("The spectrum type cannot be empty");
return result;
}
List<String> stationTypes = sysDictService.findStationType(menuTypeList);
if (CollectionUtils.isEmpty(stationTypes)) {
result.error500("Please add the station type corresponding to the current system type in the data dictionary");
return result;
}
//获取台站编码
List<String> stationCodes = new LinkedList<>();
List<String> detectorCodes = new LinkedList<>();
//根据台站id查询台站名称
Map<String, String> stationMap = (Map<String, String>)redisUtil.get("stationMap");
//从redis中获取探测器信息
Map<Integer, String> detectorInfoMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
//获取台站信息
List<String> userStations = new LinkedList<>();
//如果没有勾选AllUsers
if (Objects.nonNull(AllUsers) && !AllUsers){
@ -137,23 +132,43 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
return result;
}
userStations = userTaskUtil.findUserStation(userName);
//判断当前用户在当天是否有排班任务的台站信息
if (CollectionUtils.isNotEmpty(userStations)) {
if (CollectionUtils.isNotEmpty(stationMap)){
for (Map.Entry<String, String> entry:stationMap.entrySet()) {
if (userStations.contains(entry.getKey())) {
stationCodes.add(entry.getValue());
}
}
}
if (CollectionUtils.isNotEmpty(detectorInfoMap)) {
for (Map.Entry<Integer, String> entry:detectorInfoMap.entrySet()) {
if (String.valueOf(entry.getKey()).length() <= 3) {
if (userStations.contains(String.valueOf(entry.getKey()))) {
detectorCodes.add(entry.getValue());
}
} else {
if (userStations.contains(String.valueOf(entry.getKey()).substring(0, 3))) {
detectorCodes.add(entry.getValue());
}
}
}
}
}
} else {
if (CollectionUtils.isNotEmpty(stationMap)) {
for (Map.Entry<String, String> entry: stationMap.entrySet()) {
stationCodes.add(entry.getValue());
}
}
if (CollectionUtils.isNotEmpty(detectorInfoMap)) {
for (Map.Entry<Integer, String> entry: detectorInfoMap.entrySet()) {
detectorCodes.add(entry.getValue());
}
}
}
if (dbName.equalsIgnoreCase("auto")){
dbName = "RNAUTO.GARDS_ANALYSES";
}else if (dbName.equalsIgnoreCase("man")){
dbName = "RNMAN.GARDS_ANALYSES";
}else {
result.error500("The database type does not exist");
return result;
}
List<GardsSampleDataSpectrum> sampleData = spectrumAnalysisMapper.getDBSearchList(dbName, stationTypes, userStations, AllUsers);
//获取台站编码
List<String> stationCodes = new LinkedList<>();
List<String> detectorCodes = new LinkedList<>();
if (CollectionUtils.isNotEmpty(sampleData)){
stationCodes = sampleData.stream().map(GardsSampleDataSpectrum::getStationName).distinct().collect(Collectors.toList());
detectorCodes = sampleData.stream().map(GardsSampleDataSpectrum::getDetectorsName).distinct().collect(Collectors.toList());
}
stationCodes = stationCodes.stream().sorted().collect(Collectors.toList());
detectorCodes = detectorCodes.stream().sorted().collect(Collectors.toList());
map.put("stationCode", stationCodes);
map.put("detectorCode", detectorCodes);
result.setSuccess(true);
@ -191,9 +206,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
String tempDBName = dbName;
if (dbName.equalsIgnoreCase("auto")){
dbName = "RNAUTO.GARDS_ANALYSES";
}else if (dbName.equalsIgnoreCase("man")){
} else if (dbName.equalsIgnoreCase("man")){
dbName = "RNMAN.GARDS_ANALYSES";
}else {
} else {
result.error500("The database type does not exist");
return result;
}
@ -953,264 +968,305 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (Objects.nonNull(detSourceData)) {
information.setDet_measid_name(detSourceData.measurement_id);
}
strBuffer.append("CNL06 GENERATED REPORT").append("\n");
strBuffer.append("REVIEWED RADIONUCLIDE REPORT").append("\n");
strBuffer.append("(Noble Gas Version)").append("\n");
strBuffer.append("Creation Date "+DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss")).append("\n");
strBuffer.append("\n");
strBuffer.append("#FILE INFORMATION").append("\n");
strBuffer.append(" SampleMeasID: ").append(information.getMeasurementID()).append("\n");
strBuffer.append(" GASBKMeasID: ").append(information.getGasBkgdMeasurementID()).append("\n");
strBuffer.append(" SRID: ").append(information.getSampleRefId()).append("\n");
strBuffer.append(" Detector Type: ").append("3D b-g").append("\n");
strBuffer.append("\n");
strBuffer.append("#COLLECTION INFORMATION").append("\n");
strBuffer.append(" Station CODE: ").append(information.getSit_det_code()).append("\n");
strBuffer.append(" Detector CODE: ").append(information.getDetect_code()).append("\n");
strBuffer.append(" Collection Start: ").append(DateUtils.formatDate(information.getCollect_start(), "yyyy/MM/dd HH:mm:ss")).append("\n");
strBuffer.append(" Collection Stop: ").append(DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss")).append("\n");
strBuffer.append(" Collection TIME(h): ").append((information.getCollect_stop().getTime()/1000-information.getCollect_start().getTime()/1000)/3600).append("\n");
strBuffer.append(" Air Volume[cm3]: ").append(information.getS_xe_stable_volume()).append("\n");
strBuffer.append(" Xe Volume[cm3]: ").append(information.getS_volume_of_Xe()).append("\n");
strBuffer.append("\n");
strBuffer.append("#ACQUISITION INFORMATION").append("\n");
strBuffer.append(" Acquisition Start: ").append(DateUtils.formatDate(information.getAcquisition_start(), "yyyy/MM/dd HH:mm:ss")).append("\n");
strBuffer.append(" Acq Real Time(s): ").append(information.getAcquisition_real_sec()).append("\n");
strBuffer.append(" Acq Live Time: ").append(information.getAcquisition_live_sec()).append("\n");
strBuffer.append("\n");
strBuffer.append("#SOFTWARE").append("\n");
strBuffer.append(" version: ").append("1.0.1").append("\n");
strBuffer.append("\n");
strBuffer.append("#SAMPLE Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
strBuffer.append("\n");
strBuffer.append("#SAMPLE New CALIBRATION").append("\n");
strBuffer.append(" New Beta New Gamma ").append("\n");
strBuffer.append(" CH(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3())))
+")x*x ")
.append(" CH(x) = ("+ (Objects.isNull(gammaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3())))
+")x*x ").append("\n");
strBuffer.append(" E(x) = ("+ (Objects.isNull(betaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3())))
+")x*x ")
.append(" E(x) = ("+ (Objects.isNull(gammaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3())))
+")x*x").append("\n");
strBuffer.append("\n");
strBuffer.append("#SAMPLE: LIMITS PER ROI").append("\n");
strBuffer.append(" Roi Beta Gamma ").append("\n");
strBuffer.append(titleFormat("%sCNL06 GENERATED REPORT%s", 60, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(titleFormat("%sREVIEWED RADIONUCLIDE REPORT%s", 57, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(titleFormat("%s(Noble Gas Version)%s", 61, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(titleFormat("%sCreation Date "+DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss")+"%s", 54, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#FILE INFORMATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sSampleMeasID:%-38s%s", StringPool.SPACE, StringPool.SPACE, information.getMeasurementID()));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sGASBKMeasID:%-39s%s", StringPool.SPACE, StringPool.SPACE, information.getGasBkgdMeasurementID()));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sSRID:%-46s%s", StringPool.SPACE, StringPool.SPACE, information.getSampleRefId()));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sDetector Type:%-37s%s", StringPool.SPACE, StringPool.SPACE, "3D b-g"));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#COLLECTION INFORMATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sStation CODE:%-38s%s", StringPool.SPACE, StringPool.SPACE, information.getSit_det_code()));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sDetector CODE:%-37s%s", StringPool.SPACE, StringPool.SPACE, information.getDetect_code()));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCollection Start:%-34s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getCollect_start(), "yyyy/MM/dd HH:mm:ss")));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCollection Stop:%-35s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss")));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCollection TIME(h):%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf((information.getCollect_stop().getTime()/1000-information.getCollect_start().getTime()/1000)/3600)));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sAir Volume[cm3]:%-35s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_xe_stable_volume())));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sXe Volume[cm3]:%-36s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_volume_of_Xe())));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#ACQUISITION INFORMATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sAcquisition Start:%-33s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getAcquisition_start(), "yyyy/MM/dd HH:mm:ss")));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sAcq Real Time(s):%-34s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getAcquisition_real_sec())));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sAcq Live Time:%-37s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getAcquisition_live_sec())));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#SOFTWARE");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sversion:%-43s%s", StringPool.SPACE, StringPool.SPACE, "1.0.1"));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#SAMPLE Old CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)), StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)), StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#SAMPLE New CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamS.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))),
(Objects.isNull(betaCalibrationParamS.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))),
(Objects.isNull(betaCalibrationParamS.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamS.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamS.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamS.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamES.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))),
(Objects.isNull(betaCalibrationParamES.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))),
(Objects.isNull(betaCalibrationParamES.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamES.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamES.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamES.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#SAMPLE: LIMITS PER ROI");
strBuffer.append(System.lineSeparator());
String limitRoi = "%s%-51s%-51s%-12s";
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumsSample)) {
for (GardsROIChannelsSpectrum channelsSpectrum:roiChannelsSpectrumsSample) {
strBuffer.append(StringPool.SPACE+channelsSpectrum.getRoi()+" "+channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop()+" "+channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()).append("\n");
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, String.valueOf(channelsSpectrum.getRoi()), channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop(), channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()));
strBuffer.append(System.lineSeparator());
}
}
strBuffer.append("\n");
strBuffer.append("#DET Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
strBuffer.append("\n");
strBuffer.append("#DET New CALIBRATION").append("\n");
strBuffer.append(" New Beta New Gamma ").append("\n");
strBuffer.append(" CH(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3())))
+")x*x ")
.append(" CH(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3())))
+")x*x").append("\n");
strBuffer.append(" E(x) = ("+ (Objects.isNull(betaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3())))
+")x*x ")
.append(" E(x) = ("+ (Objects.isNull(gammaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3())))
+")x*x").append("\n");
strBuffer.append("\n");
strBuffer.append("#DET: LIMITS PER ROI").append("\n");
strBuffer.append(" Roi Beta Gamma ").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#DET Old CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#DET New CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamD.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))),
(Objects.isNull(betaCalibrationParamD.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))),
(Objects.isNull(betaCalibrationParamD.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamD.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamD.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamD.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamED.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))),
(Objects.isNull(betaCalibrationParamED.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))),
(Objects.isNull(betaCalibrationParamED.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamED.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamED.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamED.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#DET: LIMITS PER ROI");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumsDet)) {
for (GardsROIChannelsSpectrum channelsSpectrum:roiChannelsSpectrumsDet) {
strBuffer.append(StringPool.SPACE+channelsSpectrum.getRoi()+" "+channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop()+" "+channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()).append("\n");
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, String.valueOf(channelsSpectrum.getRoi()), channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop(), channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()));
strBuffer.append(System.lineSeparator());
}
}
strBuffer.append("\n");
strBuffer.append("#GAS Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" CH(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
strBuffer.append("\n");
} else {
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
strBuffer.append("\n");
strBuffer.append("#GAS New CALIBRATION").append("\n");
strBuffer.append(" New Beta New Gamma ").append("\n");
strBuffer.append(" CH(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3())))
+")x*x ")
.append(" CH(x) = ("+ (Objects.isNull(gammaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3())))
+")x*x").append("\n");
strBuffer.append(" E(x) = ("+ (Objects.isNull(betaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3())))
+")x*x ")
.append(" E(x) = ("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3())))
+")x*x").append("\n");
strBuffer.append("\n");
strBuffer.append("#GAS: LIMITS PER ROI").append("\n");
strBuffer.append(" Roi Beta Gamma ").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#GAS Old CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sOld Beta%-43sOld Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)),
StringPool.SPACE, NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)),
NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#GAS New CALIBRATION");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCH(x) = (%s)+(%s)*x+(%s)x*x%-24sCH(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))),
(Objects.isNull(betaCalibrationParamG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))),
(Objects.isNull(betaCalibrationParamG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sE(x) = (%s)+(%s)*x+(%s)x*x%-24sE(x) = (%s)+(%s)*x+(%s)x*x%-24s", StringPool.SPACE,
(Objects.isNull(betaCalibrationParamEG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))),
(Objects.isNull(betaCalibrationParamEG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))),
(Objects.isNull(betaCalibrationParamEG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))),
StringPool.SPACE,
(Objects.isNull(gammaCalibrationParamEG.getCoeff1())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))),
(Objects.isNull(gammaCalibrationParamEG.getCoeff2())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))),
(Objects.isNull(gammaCalibrationParamEG.getCoeff3())?NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)):NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))),
StringPool.SPACE));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append("#GAS: LIMITS PER ROI");
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumsGas)) {
for (GardsROIChannelsSpectrum channelsSpectrum:roiChannelsSpectrumsGas) {
strBuffer.append(StringPool.SPACE+channelsSpectrum.getRoi()+" "+channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop()+" "+channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()).append("\n");
strBuffer.append(rowFormat(limitRoi, StringPool.SPACE, String.valueOf(channelsSpectrum.getRoi()), channelsSpectrum.getBChanStart()+" to "+channelsSpectrum.getBChanStop(), channelsSpectrum.getGChanStart()+" to "+channelsSpectrum.getGChanStop()));
strBuffer.append(System.lineSeparator());
}
}
strBuffer.append("\n");
strBuffer.append("#GROSS COUNTS PER ROI").append("\n");
strBuffer.append(" Roi Sample GasBkgnd DetBkgnd ").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#GROSS COUNTS PER ROI");
strBuffer.append(System.lineSeparator());
String grossRoi = "%s%-51s%-51s%-13s%-15s";
strBuffer.append(rowFormat(grossRoi, StringPool.SPACE, "Roi", "Sample", "GasBkgnd", "DetBkgnd"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums) {
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+resultsSpectrum.getSGross()+" "+resultsSpectrum.getGGross()+" "+resultsSpectrum.getBGross()+"").append("\n");
strBuffer.append(rowFormat(grossRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), String.valueOf(resultsSpectrum.getSGross()), String.valueOf(resultsSpectrum.getGGross()), String.valueOf(resultsSpectrum.getBGross())));
strBuffer.append(System.lineSeparator());
}
}
strBuffer.append("\n");
strBuffer.append("#NET COUNTS AND LC PER ROI").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#NET COUNTS AND LC PER ROI");
strBuffer.append(System.lineSeparator());
String netRoi = "%s%-51s%-51s%-13s";
if (betaDataFile.isBProcessed()) {
if (Objects.isNull(resultsSpectrums.get(0).getLcCts())) {
strBuffer.append(" Roi Net count ").append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, "Roi", "Net count", StringPool.SPACE));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))).append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr())), StringPool.SPACE));
strBuffer.append(System.lineSeparator());
}
}
} else {
strBuffer.append(" Roi Net count LC ").append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, "Roi", "Net count", "LC"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))+ " " + NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))).append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr())), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))));
strBuffer.append(System.lineSeparator());
}
}
}
} else {
if (Objects.isNull(resultsSpectrums.get(0).getLcCts())) {
strBuffer.append(" Roi Net count ").append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, "Roi", "Net count", StringPool.SPACE));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))).append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr()))), StringPool.SPACE));
strBuffer.append(System.lineSeparator());
}
}
} else {
strBuffer.append(" Roi Net count LC ").append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, "Roi", "Net count", "LC"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))+ " " + NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))).append("\n");
strBuffer.append(rowFormat(netRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr()))), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))));
strBuffer.append(System.lineSeparator());
}
}
}
}
strBuffer.append("\n");
strBuffer.append("#CONCENTRATION AND LC PER ROI").append("\n");
strBuffer.append(" Roi Conc(mBq/m3) LC(mBq/m3) MDC(mBq/m3): ").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#CONCENTRATION AND LC PER ROI");
strBuffer.append(System.lineSeparator());
String conLcRoi = "%s%-51s%-51s%-13s%-15s";
strBuffer.append(rowFormat(conLcRoi, StringPool.SPACE, "Roi", "Conc(mBq/m3)", "LC(mBq/m3)", "MDC(mBq/m3):"));
strBuffer.append(System.lineSeparator());
if (betaDataFile.isBProcessed()) {
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))).append("\n");
strBuffer.append(rowFormat(conLcRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr())), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc())), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))));
strBuffer.append(System.lineSeparator());
}
}
} else {
if (CollectionUtils.isNotEmpty(resultsSpectrums)) {
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums){
strBuffer.append(StringPool.SPACE+resultsSpectrum.getRoi()+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))).append("\n");
strBuffer.append(rowFormat(conLcRoi, StringPool.SPACE, String.valueOf(resultsSpectrum.getRoi()), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr())), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc())), NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))));
strBuffer.append(System.lineSeparator());
}
}
}
strBuffer.append("\n");
strBuffer.append("#RESULT SUMMARY").append("\n");
strBuffer.append(" Nuclide Name Conc LC MDC NID Flag ").append("\n");
strBuffer.append(System.lineSeparator());
strBuffer.append("#RESULT SUMMARY");
strBuffer.append(System.lineSeparator());
String resultSum = "%s%-51s%-51s%-13s%-15s%-11s";
strBuffer.append(rowFormat(resultSum, StringPool.SPACE, "Nuclide Name", "Conc", "LC", "MDC", "NID Flag"));
strBuffer.append(System.lineSeparator());
if (CollectionUtils.isNotEmpty(xeResultsSpectrums)) {
for (GardsXeResultsSpectrum xeResultsSpectrum:xeResultsSpectrums) {
strBuffer.append(StringPool.SPACE+xeResultsSpectrum.getNuclideName()+" "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc()))+" "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc()))+" "+xeResultsSpectrum.getNidFlag()).append("\n");
strBuffer.append(rowFormat(resultSum, StringPool.SPACE, xeResultsSpectrum.getNuclideName(), NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr())), NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc())), NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc())), String.valueOf(xeResultsSpectrum.getNidFlag())));
strBuffer.append(System.lineSeparator());
}
}
strBuffer.append("\n");
strBuffer.append(System.lineSeparator());
} catch (ParseException e) {
throw new RuntimeException(e);
}

View File

@ -105,6 +105,12 @@ public class WebStatisticsController {
return readLineUtil.readFtpFile(filePath,response);
}
@GetMapping("downloadFile")
@ApiOperation("查看Radionuclide的文件")
public void downloadFile(@RequestParam Integer sampleId, HttpServletResponse response){
gardsSampleDataWebService.downloadFile(sampleId, response);
}
@GetMapping("sohFile")
@ApiOperation(value = "查看RMSSHO的文件",notes = "查看RMSSHO的文件")
public Result sohFile(@RequestParam Integer sohId,

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsBgEfficiencyPairs;
@Mapper
public interface GardsBgEfficiencyPairsMapper extends BaseMapper<GardsBgEfficiencyPairs> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsCalibrationPairsOrig;
@Mapper
public interface GardsCalibrationPairsOrigMapper extends BaseMapper<GardsCalibrationPairsOrig> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsHistogram;
@Mapper
public interface GardsHistogramMapper extends BaseMapper<GardsHistogram> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsRoiLimits;
@Mapper
public interface GardsRoiLimitsMapper extends BaseMapper<GardsRoiLimits> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleCertLine;
@Mapper
public interface GardsSampleCertLineMapper extends BaseMapper<GardsSampleCertLine> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleCert;
@Mapper
public interface GardsSampleCertMapper extends BaseMapper<GardsSampleCert> {
}

View File

@ -3,8 +3,10 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import java.util.List;
@ -17,4 +19,12 @@ public interface GardsSampleDataWebMapper extends BaseMapper<GardsSampleDataWeb>
Page<GardsSampleDataWeb> findParticulatePage(String dataType, String spectralQualifie, String startDate, String endDate, List<Integer> stationIdList, Page<GardsSampleDataWeb> page);
Integer getAnalysisID(@Param(value = "sampleId") Integer sampleId);
SpectrumFileRecord getDBSpectrumFilePath(Integer sampleId, Integer analysisID);
String getQCFilePath(String siteDetCode, String collectStartStr);
Integer getSampleId(@Param(value = "filePathName") String filePathName);
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleDescription;
@Mapper
public interface GardsSampleDescriptionMapper extends BaseMapper<GardsSampleDescription> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleRatios;
@Mapper
public interface GardsSampleRatiosMapper extends BaseMapper<GardsSampleRatios> {
}

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSpectrum;
@Mapper
public interface GardsSpectrumMapper extends BaseMapper<GardsSpectrum> {
}

View File

@ -126,4 +126,44 @@
ORDER BY ACQUISITION_START DESC
</select>
<select id="getAnalysisID" resultType="java.lang.Integer">
SELECT ANALYSIS_DB.IDANALYSIS FROM RNAUTO.GARDS_ANALYSES ANALYSIS_DB WHERE ANALYSIS_DB.SAMPLE_ID = #{sampleId} and ANALYST = 'RNAUTO'
</select>
<select id="getDBSpectrumFilePath" resultType="org.jeecg.modules.entity.vo.SpectrumFileRecord">
SELECT
org_sample.SAMPLE_ID sampleId,
org_sample.INPUT_FILE_NAME sampleFilePath,
analyses.USEDGASPHD gasBgFilePath,
analyses.USEDDETPHD detBgFilePath,
analyses.LOG_PATH logFilePath,
analyses.REPORT_PAHT reportFilePath,
TRIM(org_sample.SITE_DET_CODE) siteDetCode,
org_sample.COLLECT_START collectStart
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample,
RNAUTO.GARDS_ANALYSES analyses
<where>
analyses.SAMPLE_ID = #{sampleId}
AND analyses.IDANALYSIS = #{analysisID}
AND org_sample.SAMPLE_ID=analyses.SAMPLE_ID
</where>
</select>
<select id="getQCFilePath" resultType="java.lang.String">
SELECT org_sample_data.INPUT_FILE_NAME
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample_data
<where>
org_sample_data.ACQUISITION_START=
(SELECT MAX(qc_samples.ACQUISITION_START) FROM ORIGINAL.GARDS_SAMPLE_DATA qc_samples WHERE qc_samples.SITE_DET_CODE= '${siteDetCode}'
AND qc_samples.DATA_TYPE='Q'
AND qc_samples.SPECTRAL_QUALIFIE='FULL'
AND qc_samples.ACQUISITION_START &lt;= TO_DATE('${collectStartStr}', 'YYYY-MM-DD hh24:mi:ss'))
AND org_sample_data.SITE_DET_CODE= '${siteDetCode}'
</where>
</select>
<select id="getSampleId" resultType="java.lang.Integer">
SELECT SAMPLE_ID FROM ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME = #{filePathName}
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.swagger.models.auth.In;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSampleDataWeb;
@ -33,6 +34,7 @@ public interface IGardsSampleDataWebService extends IService<GardsSampleDataWeb>
Result sampleInfo(Integer sampleId);
void downloadFile(Integer sampleId, HttpServletResponse response);
GardsSampleDataWeb getOneSample(Integer sampleId);

View File

@ -5,23 +5,26 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.*;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.ExportUtil;
import org.jeecg.common.util.ReadLineUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.original.*;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import org.jeecg.modules.mapper.*;
import org.jeecg.modules.service.IGardsSampleDataWebService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -30,8 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@ -66,6 +69,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
private GardsSampleCertLineMapper gardsSampleCertLineMapper;
@Autowired
private ReadLineUtil readLineUtil;
@Autowired
private FTPUtil ftpUtil;
@Autowired
private SpectrumPathProperties spectrumPathProperties;
@Autowired
private ParameterProperties parameterProperties;
@Override
public Result findParticulatePage(QueryRequest queryRequest, Integer[] stationIds, String dataType, String spectralQualifie, Date startTime,Date endTime) {
@ -167,6 +176,149 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
return Result.OK(report);
}
@Override
public void downloadFile(Integer sampleId, HttpServletResponse response) {
//创建一个zip文件 将需要压缩进去的文件都压缩到zip中
File zipFile = null;
FileInputStream inputStream = null;
OutputStream outputStream = null;
//samplegasdetqc的临时文件
File sampleFile = null;
InputStream sampleStream = null;
File gasFile = null;
InputStream gasStream = null;
File detFile = null;
InputStream detStream = null;
File qcFile = null;
InputStream qcStream = null;
String zipFileName = "";
try {
//根据sampleId查询自动处理库获取相应分析id
Integer analysisID = this.baseMapper.getAnalysisID(sampleId);
//如果有分析id 则是sample文件可以查询到对应关联文件内容
if (Objects.nonNull(analysisID)) {
//根据sampleId和分析id查询数据库文件信息
SpectrumFileRecord dbSpectrumFilePath = this.baseMapper.getDBSpectrumFilePath(sampleId, analysisID);
if (Objects.nonNull(dbSpectrumFilePath)) {
//判断临时存放压缩包位置是否存在
File dir = new File(parameterProperties.getLogFilePath());
if (!dir.exists()) {
dir.mkdirs();
}
//获取sample文件路径 截取sample文件名称 将PHD改为zip
zipFileName = dbSpectrumFilePath.getSampleFilePath().substring(dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH) + 1).replace("PHD", "zip");
//获取分析表中的采集开始时间
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
//根据探测器信息以及采集开始时间查询对应的qc文件路径
String dbQcFilePath = this.baseMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
//根据各路径返回samplegasdetqc对应的文件sampleId
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())) {
sampleStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath());
if (Objects.nonNull(sampleStream)) {
sampleFile = new File(parameterProperties.getLogFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH) + 1));
FileUtils.copyInputStreamToFile(sampleStream, sampleFile);
}
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
gasStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath());
if (Objects.nonNull(gasStream)) {
gasFile = new File(parameterProperties.getLogFilePath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH) + 1));
FileUtils.copyInputStreamToFile(gasStream, gasFile);
}
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
detStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath());
if (Objects.nonNull(detStream)) {
detFile = new File(parameterProperties.getLogFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH) + 1));
FileUtils.copyInputStreamToFile(detStream, detFile);
}
}
if (StringUtils.isNotBlank(dbQcFilePath)) {
qcStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + dbQcFilePath);
if (Objects.nonNull(qcStream)) {
qcFile = new File(parameterProperties.getLogFilePath() + StringPool.SLASH + dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH) + 1));
FileUtils.copyInputStreamToFile(qcStream, qcFile);
}
}
}
} else {//如果没有分析id 则是其他谱类型文件 直接获取文件路径
GardsSampleDataWeb sampleData = getOneSample(sampleId);
String filePath = sampleData.getInputFileName();
if (StringUtils.isNotBlank(filePath)) {
zipFileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH)+1).replace("PHD", "zip");
sampleStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + filePath);
if (Objects.nonNull(sampleStream)) {
sampleFile = new File(parameterProperties.getLogFilePath() + StringPool.SLASH + filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1));
FileUtils.copyInputStreamToFile(sampleStream, sampleFile);
}
}
}
if (Objects.nonNull(sampleFile) || Objects.nonNull(gasFile) || Objects.nonNull(detFile) ||Objects.nonNull(qcFile)) {
//创建zip的临时文件
zipFile = File.createTempFile("betaGammaZip", null);
File zip = ZipUtil.zip(zipFile, true, sampleFile, gasFile, detFile, qcFile);
//获取压缩文件的文件输入流
inputStream = new FileInputStream(zip);
//重置响应信息
response.reset();
//设置响应类型
response.setContentType("application/download");
//解决中文不能生成文件
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(zipFileName,"UTF-8"));
//获取响应流的输出流
outputStream = response.getOutputStream();
//定义一个字节大小
byte[] buffer = new byte[1024];
int bytesRead;
// 将文件输出流写入到输出流中
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(sampleFile)) {
sampleFile.delete();
}
if (Objects.nonNull(sampleStream)) {
sampleStream.close();
}
if (Objects.nonNull(gasFile)) {
gasFile.delete();
}
if (Objects.nonNull(gasStream)) {
gasStream.close();
}
if (Objects.nonNull(detFile)) {
detFile.delete();
}
if (Objects.nonNull(detStream)) {
detStream.close();
}
if (Objects.nonNull(qcFile)) {
qcFile.delete();
}
if (Objects.nonNull(qcStream)) {
qcStream.close();
}
if (Objects.nonNull(zipFile)) {
zipFile.delete();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (Objects.nonNull(outputStream)) {
outputStream.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private void findInfo(Integer sampleId, Report report) {
//声明多个对象 分别封装独立的信息
GeneralInformation generalInformation = new GeneralInformation();
@ -580,8 +732,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
public GardsSampleDataWeb getOneSample(Integer sampleId) {
LambdaQueryWrapper<GardsSampleDataWeb> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsSampleDataWeb::getSampleId,sampleId);
return Optional.ofNullable(getOne(wrapper))
.orElse(new GardsSampleDataWeb());
return Optional.ofNullable(getOne(wrapper)).orElse(new GardsSampleDataWeb());
}
@Override