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

This commit is contained in:
nieziyan 2023-10-24 10:45:07 +08:00
commit 74c54c98f0
24 changed files with 434 additions and 354 deletions

View File

@ -126,8 +126,14 @@ public class EmailServiceManager {
//如果邮箱邮件数量 > 0
final int messageCount = folder.getMessageCount();
if(messageCount > 0){
Message[] messages = null;
if(Objects.isNull(this.systemStartupTime)){
int finalNum = messageCount > this.receiveNum?this.receiveNum:messageCount;
//邮箱邮件下标是从1开始的
return folder.getMessages(1,finalNum);
}
SearchTerm searchTerm = new ReceivedDateTerm(ComparisonTerm.GE,this.systemStartupTime);
Message[] messages = folder.search(searchTerm);
messages = folder.search(searchTerm);
Arrays.sort(messages, (o1, o2) -> {
try {
return o1.getReceivedDate().compareTo(o2.getReceivedDate());
@ -139,9 +145,8 @@ public class EmailServiceManager {
if(this.receiveNum >= messages.length){
return messages;
}else{
messages = Arrays.copyOfRange(messages,0,this.receiveNum-1);
return Arrays.copyOfRange(messages,0,this.receiveNum-1);
}
return messages;
}
return null;
}
@ -233,7 +238,6 @@ public class EmailServiceManager {
if(part.isMimeType(MailContentType.PLAIN.getContentType())){
content.append(part.getContent());
}else if(part.isMimeType("multipart/*")){
System.out.println(part.getContentType());
Multipart multipart = (Multipart) part.getContent();
for(int i=0;i<multipart.getCount();i++) {
final Part bodyPart = multipart.getBodyPart(i);

View File

@ -59,7 +59,7 @@ public class GammaReportUtil {
try {
out = new PrintWriter(file);
out.println("#" + fileType);
out.printf("%" + (String.valueOf(data.size()).length() + (colLength - String.valueOf(data.size()).length())) + "s", data.size() + "\n");
// out.printf("%" + (String.valueOf(data.size()).length() + (colLength - String.valueOf(data.size()).length())) + "s", data.size() + "\n");
format(data, out);
} catch (FileNotFoundException e) {

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.exception;
/**
* B谱分析异常
*/
public class GAnalyseException extends Exception{
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public GAnalyseException(String message) {
super(message);
}
}

View File

@ -15,4 +15,11 @@ public interface IAlertSpectrumService extends IService<GardsAlertData> {
* @param fileName
*/
public GardsAlertData create(AlertSpectrumStruct struct,String fileName) throws Exception;
/**
* 查询GardsAlertData
* @param inputFileName
* @return
*/
public GardsAlertData findByInputFileName(String inputFileName);
}

View File

@ -3,7 +3,6 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.original.GardsSohData;
import org.jeecg.modules.native_jni.struct.SOHSpectrumStruct;
import java.util.List;
/**

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -7,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsAlertData;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.mapper.GardsAlertDataMapper;
import org.jeecg.modules.mapper.GardsStationsMapper;
import org.jeecg.modules.native_jni.struct.AlertSpectrumStruct;
@ -48,8 +50,25 @@ public class AlertSpectrumServiceImpl extends ServiceImpl<GardsAlertDataMapper,
alertData.setTime(DateUtils.parseDate(struct.date+" "+struct.time));
alertData.setAlertType(struct.alert_type);
alertData.setAlertText(struct.desc);
alertData.setInputFileName(fileName);
alertData.setInputFileName(FileOperation.separatorConvert(fileName));
this.save(alertData);
return alertData;
}
/**
* 查询GardsAlertData
*
* @param inputFileName
* @return
*/
@Override
public GardsAlertData findByInputFileName(String inputFileName) {
if (StrUtil.isNotBlank(inputFileName)){
inputFileName = FileOperation.separatorConvert(inputFileName);
LambdaQueryWrapper<GardsAlertData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GardsAlertData::getInputFileName,inputFileName);
return this.getOne(queryWrapper);
}
return null;
}
}

View File

@ -8,6 +8,7 @@ import org.apache.commons.compress.utils.Lists;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsMetData;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.mapper.GardsMetDataMapper;
import org.jeecg.modules.mapper.GardsStationsMapper;
import org.jeecg.modules.native_jni.struct.MetSpectrumStruct;
@ -61,7 +62,7 @@ public class MetSpectrumServiceImpl extends ServiceImpl<GardsMetDataMapper, Gard
metData.setAveWindDir(struct.average_wind_direction.get(i));
metData.setAveWindSpeed(struct.average_wind_speed.get(i));
metData.setRainfall(struct.rainfall.get(i));
metData.setInputFileName(fileName);
metData.setInputFileName(FileOperation.separatorConvert(fileName));
metData.setModdate(new Date());
list.add(metData);
}

View File

@ -9,6 +9,7 @@ import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsSohData;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.mapper.GardsDetectorsMapper;
import org.jeecg.modules.mapper.GardsSohDataMapper;
import org.jeecg.modules.mapper.GardsStationsMapper;
@ -67,7 +68,7 @@ public class SOHSpectrumServiceImpl extends ServiceImpl<GardsSohDataMapper, Gard
sohData.setTime(struct.af_interval_duration.get(i).doubleValue());
sohData.setAvgflowrate(struct.average_flow_rate.get(i));
sohData.setFlowratedev(struct.flow_rate_standard_deviation.get(i));
sohData.setInputFileName(fileName);
sohData.setInputFileName(FileOperation.separatorConvert(fileName));
sohData.setDetectorId(gardsDetectors.getDetectorId());
sohData.setModdate(new Date());
list.add(sohData);

View File

@ -6,6 +6,7 @@ import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.original.GardsAlertData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.exception.FileRepeatException;
import org.jeecg.modules.exception.PHD_ReadException;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
@ -34,6 +35,10 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
* 结束存库时间
*/
private Date endIntoDatabaseTime = null;
/**
* 文件是否重复
*/
private boolean isFileRepeat;
/**
* 设置过滤链路
@ -56,18 +61,23 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
DataType.ALERT_TEMP.getType().equals(super.currDataType.getType()) ||
DataType.ALERT_SYSTEM.getType().equals(super.currDataType.getType()) ||
DataType.ALERT_UPS.getType().equals(super.currDataType.getType())){
//打印当前处理的能谱类型
super.printCurrDataType();
//解析邮件内容
this.parseingEmail();
//保存PHD文件到savefile
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//删除本地临时文件
super.deleteLocalTemporaryFile();
//把流程日志保存到日志目录
this.saveLogToLogDir();
try{
//打印当前处理的能谱类型
super.printCurrDataType();
//解析邮件内容
this.parseingEmail();
//保存PHD文件到savefile
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//删除本地临时文件
super.deleteLocalTemporaryFile();
}catch (Exception e){
throw e;
}finally {
//把流程日志保存到日志目录
this.saveLogToLogDir();
}
}else{
super.next.handler();
}
@ -129,6 +139,13 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
@Override
protected void handlerOriginalData() throws Exception {
this.startIntoDatabaseTime = new Date();
final GardsAlertData alertData = super.spectrumServiceQuotes.getAlertSpectrumService().findByInputFileName(super.spectrumFileRelativePath);
if(Objects.nonNull(alertData)){
this.alertData = alertData;
this.endIntoDatabaseTime = new Date();
this.isFileRepeat = true;
throw new FileRepeatException("file repeat");
}
this.alertData = super.spectrumServiceQuotes.getAlertSpectrumService().create(this.sourceData, super.spectrumFileRelativePath);
this.endIntoDatabaseTime = new Date();
}
@ -138,18 +155,28 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
*/
@Override
protected void saveLogToLogDir() throws IOException {
final SpectrumPathProperties properties = super.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getRootPath()+File.separator+properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+File.separator+fileName;
//组装日志文件内容
StringBuilder logContent = new StringBuilder();
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("ALERT ID: ").append(this.alertData.getAlertId()).append(" StandardFile:").append(super.spectrumServiceQuotes.getSpectrumPathProperties().getRootPath()).append(StringConstant.SLASH).append(super.spectrumFileRelativePath);
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
final SpectrumPathProperties properties = super.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+File.separator+fileName;
String handleFlag = "Successfully";
if(this.isFileRepeat){
handleFlag = "Error";
String fileStoreRelativePath = this.getFileSaveRelativePath()+File.separator+fileName;
logContent.append("File: ").append(fileStoreRelativePath).append(" repeat");
logContent.append(System.lineSeparator()).append(System.lineSeparator());
}
logContent.append("------------------- ").append("Write Data into Database ").append(handleFlag).append(" at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
logContent.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
FileOperation.saveOrAppendFile(finalPath,logContent.toString(),true);
}
}

View File

@ -1,6 +1,5 @@
package org.jeecg.modules.spectrum;
import cn.hutool.core.io.FileUtil;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties;
@ -39,7 +38,7 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
*/
private Date endIntoDatabaseTime = null;
private List<GardsSohData> sohDatas;
private List<GardsSohData> sohData;
/**
* 设置过滤链路
@ -134,7 +133,7 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
@Override
protected void handlerOriginalData() throws Exception {
this.startIntoDatabaseTime = new Date();
this.sohDatas = spectrumServiceQuotes.getSohSpectrumService().create(this.sourceData, super.spectrumFileRelativePath);
this.sohData = spectrumServiceQuotes.getSohSpectrumService().create(this.sourceData, super.spectrumFileRelativePath);
this.endIntoDatabaseTime = new Date();
}
@ -145,8 +144,8 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
protected void saveLogToLogDir() throws IOException {
//获取健康谱记录ID范围
String sohIdRange = "";
if(!CollectionUtils.isEmpty(this.sohDatas)){
sohIdRange = this.sohDatas.get(0).getSohId()+"-"+this.sohDatas.get(this.sohDatas.size()-1).getSohId();
if(!CollectionUtils.isEmpty(this.sohData)){
sohIdRange = this.sohData.get(0).getSohId()+"-"+this.sohData.get(this.sohData.size()-1).getSohId();
}
//组装日志文件内容
StringBuilder logContent = new StringBuilder();
@ -157,7 +156,7 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String dirPath = properties.getRootPath()+File.separator+properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+ File.separator+fileName;
FileOperation.saveOrAppendFile(finalPath,logContent.toString(),true);

View File

@ -150,7 +150,7 @@ public class MetSpectrum extends AbstractSpectrumHandler{
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String dirPath = properties.getRootPath()+File.separator+properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+File.separator+fileName;
FileOperation.saveOrAppendFile(finalPath,logContent.toString(),true);

View File

@ -50,7 +50,6 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus();
}catch (Exception e){
e.printStackTrace();
//修改状态为解析失败
super.status = SampleStatus.FAIL.getValue();
super.updateStatus();

View File

@ -104,7 +104,6 @@ public class SpectrumParsingActuator implements Runnable{
}
}
} catch (Exception e) {
// log.error(mailContent.toString());
log.error("This email failed to parse. The email subject is: {}, sent on: {}, received on: {}, and the reason for the failure is: {}",subject,sendTime,receiveTime,e.getMessage());
e.printStackTrace();
}finally {

View File

@ -67,7 +67,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
result.error500("ftp connection failed");
return false;
}
InputStream inputStream = null;
@ -280,7 +280,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp连接失败";
String warning = "ftp connection failed";
}
InputStream inputStream = null;
File file = null;
@ -328,7 +328,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp连接失败";
String warning = "ftp connection failed";
}
InputStream inputStream = null;
File file = null;
@ -376,7 +376,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
String warning = "ftp连接失败";
String warning = "ftp connection failed";
}
InputStream inputStream = null;
try {
@ -2641,349 +2641,354 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public String GetReportContent(GStoreMiddleProcessData middleData) {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append(" CNL06 GENERATED REPORT");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" "+middleData.analyses_type+" RADIONUCLIDE REPORT");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" (Noble Gas Version) ");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" Creation Date "+DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss"));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#SAMPLE INFORMATION");
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//报告内容第一部分数据
String[] cells1 = new String[]{" Station ID", " Detector ID", " Sample ID", " Sample Geometry", " Sample Quantity[m3]", " Sample Type", " Collection Start", " Collection Stop",
" Sampling Time[h]", " Decay Time[h]", " Acquisition Start", " Acquisition Stop", " Acquisition Time[s]", " Avg Flow Rate[m3/h]", " Collection Station Comments"};
String[] datas1 = new String[]{middleData.sample_stationID, middleData.sample_detectID, middleData.sample_id, middleData.sample_Geometry, middleData.sample_quantity, middleData.sample_Type, middleData.sample_collection_start,
middleData.sample_collection_stop, middleData.sample_time, middleData.sample_decay_time, middleData.sample_acquisiton_start, middleData.sample_acquistion_stop, middleData.sample_acquistion_time, middleData.sample_Avg_Flow_Rate,
middleData.Collection_Station_Comments};
//根据固定宽度切割数据
Map<String, List<String>> reportMap1 = GetReportFixedWidth(cells1, datas1, 30);
List<String> title1 = reportMap1.get("title");
List<String> content1 = reportMap1.get("content");
for (int i=0; i< title1.size(); i++) {
String title = title1.get(i);
String content = content1.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
try {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append(" CNL06 GENERATED REPORT");
//换行
strBuffer.append(System.lineSeparator());
}
//报告内容第二部分数据
String[] cell2 = new String[]{" Analysis General Comments"};
String[] datas2 = new String[]{middleData.NDC_Analysis_General_Comments};
//根据固定宽度切割数据
Map<String, List<String>> reportMap2 = GetReportFixedWidth(cell2, datas2, 30);
List<String> title2 = reportMap2.get("title");
List<String> content2 = reportMap2.get("content");
for (int i=0; i< title2.size(); i++) {
String title = title2.get(i);
String content = content2.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
strBuffer.append(" "+middleData.analyses_type+" RADIONUCLIDE REPORT");
//换行
strBuffer.append(System.lineSeparator());
}
//获取核素信息
String qsNuclidesName = "";
for(int m=0;m<middleData.nucl_ided_Nuclidename.size()-1;m++) {
qsNuclidesName = qsNuclidesName+ middleData.nucl_ided_Nuclidename.get(m) + ";";
}
if(middleData.nucl_ided_Nuclidename.size()>1) {
qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.get(middleData.nucl_ided_Nuclidename.size()-1);
}
strBuffer.append("#ACTIVITY SUMMARY");
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//报告内容第三部分数据
String[] cells3 = new String[]{" Nuclides Identified"};
String[] datas3 = new String[]{qsNuclidesName};
//根据固定宽度切割数据
Map<String, List<String>> reportMap3 = GetReportFixedWidth(cells3, datas3, 30);
List<String> title3 = reportMap3.get("title");
List<String> content3 = reportMap3.get("content");
for (int i=0; i< title3.size(); i++) {
String title = title3.get(i);
String content = content3.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
strBuffer.append(" (Noble Gas Version) ");
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Keyline Activities for Nuclides", StringPool.SPACE, ""));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " with defined Reference Line", StringPool.SPACE, ""));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Activity Reference Time", StringPool.SPACE, middleData.sample_acquisiton_start));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Concentration Reference Time", StringPool.SPACE, middleData.sample_collection_start));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
String nuclideTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s";
String[] nuclideData = new String[]{" Nuclide", "Halflife(s)", "Activity(Bq)", "RelErr%", "MDA(Bq)", "Conc(uBq/m^3)", "MDC"};
strBuffer.append(rowFormat(nuclideTitle, nuclideData));
strBuffer.append(System.lineSeparator());
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
rowFormat(nuclideTitle, StringPool.SPACE + middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Halflife.get(i), String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key.get(i))),
String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key_err.get(i))/Double.valueOf(middleData.nucl_ided_activ_key.get(i))*100), middleData.nucl_ided_mda.get(i),
middleData.nucl_ided_Concentration.get(i), middleData.nucl_ided_MDC.get(i));
strBuffer.append(" Creation Date "+DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss"));
//换行
strBuffer.append(System.lineSeparator());
}
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#PEAK SEARCH RESULTS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(StringPool.SPACE+middleData.peaks_idPeak.size()+" peaks reported:");
//换行
strBuffer.append(System.lineSeparator());
double peaksUsed = 0;
for(int m=0;m<middleData.peaks_Nuclide_name.size();m++) {
if(StringUtils.isNotBlank(middleData.peaks_Nuclide_name.get(m))) {
peaksUsed++;
}
}
strBuffer.append(StringPool.SPACE+peaksUsed+" peaks with ID ("+(peaksUsed/middleData.peaks_idPeak.size()*100)+"%):");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(StringPool.SPACE+(middleData.peaks_idPeak.size()-peaksUsed)+" peaks without ID("+Double.valueOf(middleData.peaks_idPeak.size()-peaksUsed)/middleData.peaks_idPeak.size()*100+"%):");
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
String peakTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s%-11s%-28s";
String[] peakData = new String[]{" PeakID", "Energy[kev]", "Centroid", "FWHM[kev]", "NetArea", "NAErr%", "Signif", "Sensit", "Nuclide"};
strBuffer.append(rowFormat(peakTitle, peakData));
strBuffer.append(System.lineSeparator());
for (int i=0; i<middleData.peaks_idPeak.size(); i++){
strBuffer.append(rowFormat(peakTitle, StringPool.SPACE+middleData.peaks_idPeak.get(i), String.format("%.3f", Double.valueOf(middleData.peaks_Energy.get(i))),
String.format("%.3f", Double.valueOf(middleData.peaks_peakCentroid.get(i))), String.format("%.3f", Double.valueOf(middleData.peaks_Fwhm.get(i))),
String.format("%.3f", Double.valueOf(middleData.peaks_Area.get(i))),
String.format("%.3f", (Double.valueOf(middleData.peaks_areaErr.get(i))/Double.valueOf(middleData.peaks_Area.get(i))*100)),
String.format("%.3f", Double.valueOf(middleData.peaks_Significance.get(i))), String.format("%.3f", Double.valueOf(middleData.peaks_Sensitivity.get(i))),
StringUtils.join(middleData.peaks_Nuclide_name.get(i), StringPool.SEMICOLON)));
//换行
strBuffer.append(System.lineSeparator());
}
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#PROCESSING PARAMETERS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_Low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_Low())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_High", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_High())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " EnergyTolerance", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getEnergyTolerance())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " BaseImprovePSS", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getBaseImprovePSS())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " PSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getPss_low())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_back", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_back())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_alpha", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_alpha())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_beta", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_beta())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " RiskLevelK", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getRiskLevelK())));
//换行
strBuffer.append(System.lineSeparator());
Date refTimeAct = middleData.setting_specSetup.getRefTime_act();
strBuffer.append(String.format("%s:%-30s%s", " refTime_act", StringPool.SPACE, DateUtils.formatDate(refTimeAct), "yyyy-MM-dd HH:mm:ss"));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " refTime_conc", StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_conc(), "yyyy-MM-dd HH:mm:ss")));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#CALIBRATION PARAMETERS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_low())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_high", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_high())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " bUpdateCal", StringPool.SPACE, (middleData.setting_specSetup.isBUpdateCal()?"1":"0")));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " KeepCalPeakSearchPeaks", StringPool.SPACE, (middleData.setting_specSetup.isKeepCalPeakSearchPeaks()?"1":"0")));
//换行
strBuffer.append(System.lineSeparator());
if(middleData.calibration_pairs_E_idCalPoint.size()>0) {
strBuffer.append("#Calibration");
strBuffer.append("#SAMPLE INFORMATION");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" Energy Calibration ["+middleData.calibration_pairs_E_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_E_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_E_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells4 = new String[]{" P"};
String[] datas4 = new String[]{middleData.calibration_E_coeff_string};
//报告内容第一部分数据
String[] cells1 = new String[]{" Station ID", " Detector ID", " Sample ID", " Sample Geometry", " Sample Quantity[m3]", " Sample Type", " Collection Start", " Collection Stop",
" Sampling Time[h]", " Decay Time[h]", " Acquisition Start", " Acquisition Stop", " Acquisition Time[s]", " Avg Flow Rate[m3/h]", " Collection Station Comments"};
String[] datas1 = new String[]{middleData.sample_stationID, middleData.sample_detectID, middleData.sample_id, middleData.sample_Geometry, middleData.sample_quantity, middleData.sample_Type, middleData.sample_collection_start,
middleData.sample_collection_stop, middleData.sample_time, middleData.sample_decay_time, middleData.sample_acquisiton_start, middleData.sample_acquistion_stop, middleData.sample_acquistion_time, middleData.sample_Avg_Flow_Rate,
middleData.Collection_Station_Comments};
//根据固定宽度切割数据
Map<String, List<String>> reportMap4 = GetReportFixedWidth(cells4, datas4, 30);
List<String> title4 = reportMap4.get("title");
List<String> content4 = reportMap4.get("content");
for (int i=0; i< title4.size(); i++) {
String title = title4.get(i);
String content = content4.get(i);
Map<String, List<String>> reportMap1 = GetReportFixedWidth(cells1, datas1, 30);
List<String> title1 = reportMap1.get("title");
List<String> content1 = reportMap1.get("content");
for (int i=0; i< title1.size(); i++) {
String title = title1.get(i);
String content = content1.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
//报告内容第二部分数据
String[] cell2 = new String[]{" Analysis General Comments"};
String[] datas2 = new String[]{middleData.NDC_Analysis_General_Comments};
//根据固定宽度切割数据
Map<String, List<String>> reportMap2 = GetReportFixedWidth(cell2, datas2, 30);
List<String> title2 = reportMap2.get("title");
List<String> content2 = reportMap2.get("content");
for (int i=0; i< title2.size(); i++) {
String title = title2.get(i);
String content = content2.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
//获取核素信息
String qsNuclidesName = "";
for(int m=0;m<middleData.nucl_ided_Nuclidename.size()-1;m++) {
qsNuclidesName = qsNuclidesName+ middleData.nucl_ided_Nuclidename.get(m) + ";";
}
if(middleData.nucl_ided_Nuclidename.size()>1) {
qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.get(middleData.nucl_ided_Nuclidename.size()-1);
}
strBuffer.append("#ACTIVITY SUMMARY");
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//报告内容第三部分数据
String[] cells3 = new String[]{" Nuclides Identified"};
String[] datas3 = new String[]{qsNuclidesName};
//根据固定宽度切割数据
Map<String, List<String>> reportMap3 = GetReportFixedWidth(cells3, datas3, 30);
List<String> title3 = reportMap3.get("title");
List<String> content3 = reportMap3.get("content");
for (int i=0; i< title3.size(); i++) {
String title = title3.get(i);
String content = content3.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Keyline Activities for Nuclides", StringPool.SPACE, ""));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " with defined Reference Line", StringPool.SPACE, ""));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Activity Reference Time", StringPool.SPACE, middleData.sample_acquisiton_start));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Concentration Reference Time", StringPool.SPACE, middleData.sample_collection_start));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
String nuclideTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s";
String[] nuclideData = new String[]{" Nuclide", "Halflife(s)", "Activity(Bq)", "RelErr%", "MDA(Bq)", "Conc(uBq/m^3)", "MDC"};
strBuffer.append(rowFormat(nuclideTitle, nuclideData));
strBuffer.append(System.lineSeparator());
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
rowFormat(nuclideTitle, StringPool.SPACE + middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Halflife.get(i), String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key.get(i))),
String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key_err.get(i))/Double.valueOf(middleData.nucl_ided_activ_key.get(i))*100), middleData.nucl_ided_mda.get(i),
middleData.nucl_ided_Concentration.get(i), middleData.nucl_ided_MDC.get(i));
//换行
strBuffer.append(System.lineSeparator());
}
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_E_uncoeff_string));
strBuffer.append("#PEAK SEARCH RESULTS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_E_Input));
strBuffer.append(StringPool.SPACE+middleData.peaks_idPeak.size()+" peaks reported:");
//换行
strBuffer.append(System.lineSeparator());
double peaksUsed = 0;
for(int m=0;m<middleData.peaks_Nuclide_name.size();m++) {
if(StringUtils.isNotBlank(middleData.peaks_Nuclide_name.get(m))) {
peaksUsed++;
}
}
strBuffer.append(StringPool.SPACE+peaksUsed+" peaks with ID ("+(peaksUsed/middleData.peaks_idPeak.size()*100)+"%):");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(StringPool.SPACE+(middleData.peaks_idPeak.size()-peaksUsed)+" peaks without ID("+Double.valueOf(middleData.peaks_idPeak.size()-peaksUsed)/middleData.peaks_idPeak.size()*100+"%):");
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//换行
String peakTitle = "%-41s%-33s%-15s%-14s%-15s%-21s%-15s%-11s%-28s";
String[] peakData = new String[]{" PeakID", "Energy[kev]", "Centroid", "FWHM[kev]", "NetArea", "NAErr%", "Signif", "Sensit", "Nuclide"};
strBuffer.append(rowFormat(peakTitle, peakData));
strBuffer.append(System.lineSeparator());
}
if(middleData.calibration_pairs_R_idCalPoint.size()>0) {
strBuffer.append(" Resolution Calibration ["+middleData.calibration_pairs_R_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_R_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_R_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells5 = new String[]{" P"};
String[] datas5 = new String[]{middleData.calibration_R_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap5 = GetReportFixedWidth(cells5, datas5, 30);
List<String> title5 = reportMap5.get("title");
List<String> content5 = reportMap5.get("content");
for (int i=0; i< title5.size(); i++) {
String title = title5.get(i);
String content = content5.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
for (int i=0; i<middleData.peaks_idPeak.size(); i++){
strBuffer.append(rowFormat(peakTitle, StringPool.SPACE+middleData.peaks_idPeak.get(i), String.format("%.3f", Double.valueOf(middleData.peaks_Energy.get(i))),
String.format("%.3f", Double.valueOf(middleData.peaks_peakCentroid.get(i))), String.format("%.3f", Double.valueOf(middleData.peaks_Fwhm.get(i))),
String.format("%.3f", Double.valueOf(middleData.peaks_Area.get(i))),
String.format("%.3f", (Double.valueOf(middleData.peaks_areaErr.get(i))/Double.valueOf(middleData.peaks_Area.get(i))*100)),
String.format("%.3f", Double.valueOf(middleData.peaks_Significance.get(i))), String.format("%.3f", Double.valueOf(middleData.peaks_Sensitivity.get(i))),
StringUtils.join(middleData.peaks_Nuclide_name.get(i), StringPool.SEMICOLON)));
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_R_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_R_Input));
strBuffer.append("#PROCESSING PARAMETERS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_Low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_Low())));
//换行
strBuffer.append(System.lineSeparator());
}
if(middleData.calibration_pairs_EF_idCalPoint.size()>0) {
strBuffer.append(" Efficiency Calibration ["+middleData.calibration_pairs_EF_Input+" ]");
strBuffer.append(String.format("%s:%-30s%s", " ECutAnalysis_High", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getECutAnalysis_High())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_EF_functionTypeDef));
strBuffer.append(String.format("%s:%-30s%s", " EnergyTolerance", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getEnergyTolerance())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_EF_functionDef));
strBuffer.append(String.format("%s:%-30s%s", " BaseImprovePSS", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getBaseImprovePSS())));
//换行
strBuffer.append(System.lineSeparator());
String[] cells6 = new String[]{" P"};
String[] datas6 = new String[]{middleData.calibration_EF_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap6 = GetReportFixedWidth(cells6, datas6, 30);
List<String> title6 = reportMap6.get("title");
List<String> content6 = reportMap6.get("content");
for (int i=0; i< title6.size(); i++) {
String title = title6.get(i);
String content = content6.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
strBuffer.append(String.format("%s:%-30s%s", " PSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getPss_low())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_back", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_back())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_alpha", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_alpha())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " k_beta", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getK_beta())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " RiskLevelK", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getRiskLevelK())));
//换行
strBuffer.append(System.lineSeparator());
Date refTimeAct = middleData.setting_specSetup.getRefTime_act();
strBuffer.append(String.format("%s:%-30s%s", " refTime_act", StringPool.SPACE, DateUtils.formatDate(refTimeAct), "yyyy-MM-dd HH:mm:ss"));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " refTime_conc", StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_conc(), "yyyy-MM-dd HH:mm:ss")));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append("#CALIBRATION PARAMETERS");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_low", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_low())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " CalibrationPSS_high", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getCalibrationPSS_high())));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " bUpdateCal", StringPool.SPACE, (middleData.setting_specSetup.isBUpdateCal()?"1":"0")));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " KeepCalPeakSearchPeaks", StringPool.SPACE, (middleData.setting_specSetup.isKeepCalPeakSearchPeaks()?"1":"0")));
//换行
strBuffer.append(System.lineSeparator());
if(middleData.calibration_pairs_E_idCalPoint.size()>0) {
strBuffer.append("#Calibration");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" Energy Calibration ["+middleData.calibration_pairs_E_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_E_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_E_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells4 = new String[]{" P"};
String[] datas4 = new String[]{middleData.calibration_E_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap4 = GetReportFixedWidth(cells4, datas4, 30);
List<String> title4 = reportMap4.get("title");
List<String> content4 = reportMap4.get("content");
for (int i=0; i< title4.size(); i++) {
String title = title4.get(i);
String content = content4.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_E_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_E_Input));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_EF_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_EF_Input));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
}
if(middleData.calibration_pairs_T_idCalPoint.size()>0) {
strBuffer.append(" Tot_efficiency Calibration ["+middleData.calibration_pairs_T_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_T_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_T_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells7 = new String[]{" P"};
String[] datas7 = new String[]{middleData.calibration_T_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap7 = GetReportFixedWidth(cells7, datas7, 30);
List<String> title7 = reportMap7.get("title");
List<String> content7 = reportMap7.get("content");
for (int i=0; i< title7.size(); i++) {
String title = title7.get(i);
String content = content7.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
if(middleData.calibration_pairs_R_idCalPoint.size()>0) {
strBuffer.append(" Resolution Calibration ["+middleData.calibration_pairs_R_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_R_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_R_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells5 = new String[]{" P"};
String[] datas5 = new String[]{middleData.calibration_R_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap5 = GetReportFixedWidth(cells5, datas5, 30);
List<String> title5 = reportMap5.get("title");
List<String> content5 = reportMap5.get("content");
for (int i=0; i< title5.size(); i++) {
String title = title5.get(i);
String content = content5.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_R_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_R_Input));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_T_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_T_Input));
if(middleData.calibration_pairs_EF_idCalPoint.size()>0) {
strBuffer.append(" Efficiency Calibration ["+middleData.calibration_pairs_EF_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_EF_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_EF_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells6 = new String[]{" P"};
String[] datas6 = new String[]{middleData.calibration_EF_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap6 = GetReportFixedWidth(cells6, datas6, 30);
List<String> title6 = reportMap6.get("title");
List<String> content6 = reportMap6.get("content");
for (int i=0; i< title6.size(); i++) {
String title = title6.get(i);
String content = content6.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_EF_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_EF_Input));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
}
if(middleData.calibration_pairs_T_idCalPoint.size()>0) {
strBuffer.append(" Tot_efficiency Calibration ["+middleData.calibration_pairs_T_Input+" ]");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Function", StringPool.SPACE, middleData.calibration_T_functionTypeDef));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " E", StringPool.SPACE, middleData.calibration_T_functionDef));
//换行
strBuffer.append(System.lineSeparator());
String[] cells7 = new String[]{" P"};
String[] datas7 = new String[]{middleData.calibration_T_coeff_string};
//根据固定宽度切割数据
Map<String, List<String>> reportMap7 = GetReportFixedWidth(cells7, datas7, 30);
List<String> title7 = reportMap7.get("title");
List<String> content7 = reportMap7.get("content");
for (int i=0; i< title7.size(); i++) {
String title = title7.get(i);
String content = content7.get(i);
strBuffer.append(String.format("%s:%-30s%s", title, StringPool.SPACE, content));
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append(String.format("%s:%-30s%s", " Err", StringPool.SPACE, middleData.calibration_T_uncoeff_string));
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(String.format("%s:%-30s%s", " Data", StringPool.SPACE, middleData.calibration_pairs_T_Input));
//换行
strBuffer.append(System.lineSeparator());
//换行
strBuffer.append(System.lineSeparator());
}
strBuffer.append("#DATA QUALITY FLAGS");
//换行
strBuffer.append(System.lineSeparator());
String qualityTitle = "%-41s%-33s%-15s%-14s";
strBuffer.append(rowFormat(qualityTitle, " Name", "Pass/Fail", "Value", "Test"));
//换行
strBuffer.append(System.lineSeparator());
for (int i=0;i<middleData.QC_CHECK_QC_NAME.size(); i++){
strBuffer.append(rowFormat(qualityTitle, StringPool.SPACE+middleData.QC_CHECK_QC_NAME.get(i), (middleData.QC_CHECK_QC_RESULT.get(i).equals("0")?"Fail":"Pass"), String.format("%.3f", Double.valueOf(middleData.QC_CHECK_QC_VALUE.get(i))), middleData.QC_CHECK_QC_STANDARD.get(i)));
//换行
strBuffer.append(System.lineSeparator());
}
return strBuffer.toString();
} catch (Exception e) {
log.error("错误文件名称:"+ middleData.analyses_save_filePath+" 错误内容:"+e.getMessage());
}
strBuffer.append("#DATA QUALITY FLAGS");
//换行
strBuffer.append(System.lineSeparator());
String qualityTitle = "%-41s%-33s%-15s%-14s";
strBuffer.append(rowFormat(qualityTitle, " Name", "Pass/Fail", "Value", "Test"));
//换行
strBuffer.append(System.lineSeparator());
for (int i=0;i<middleData.QC_CHECK_QC_NAME.size(); i++){
strBuffer.append(rowFormat(qualityTitle, StringPool.SPACE+middleData.QC_CHECK_QC_NAME.get(i), (middleData.QC_CHECK_QC_RESULT.get(i).equals("0")?"Fail":"Pass"), String.format("%.3f", Double.valueOf(middleData.QC_CHECK_QC_VALUE.get(i))), middleData.QC_CHECK_QC_STANDARD.get(i)));
//换行
strBuffer.append(System.lineSeparator());
}
return strBuffer.toString();
return "";
}
public List<String> DoubleLimit(List data) {
@ -4064,7 +4069,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
result.error500("ftp connection failed");
return m_vecCompare;
}
InputStream inputStream = null;

View File

@ -265,7 +265,7 @@ public class PHDFileUtil {
FTPClient ftpClient = ftpUtil.LoginFTP();
//判断ftp是否连接成功
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
throw new RuntimeException("ftp connection failed!");
}
InputStream iStream= null;
File file = null;

View File

@ -134,7 +134,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
result.setResult(stations);
result.setSuccess(true);
}else {
result.error500("台站下对应信息不存在");
result.error500("The corresponding information under the station does not exist");
}
}else if(type.equals("Nuclear Facility")){
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
@ -148,10 +148,10 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
result.setResult(nuclearfacility);
result.setSuccess(true);
}else {
result.error500("核设施下对应信息不存在");
result.error500("The corresponding information does not exist in the nuclear facility");
}
}else {
result.error500("当前类型不存在");
result.error500("The current type does not exist");
}
return result;
}
@ -233,7 +233,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
//获取传递的半径数据
Double radius = pointVo.getRadius();
if (Objects.isNull(radius)) {
result.error500("请传入半径");
result.error500("Please pass in radius");
}
try {
if (CollectionUtils.isNotEmpty(stationIds)){
@ -273,16 +273,16 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
//获取当前查询的纬度 圆心位置纬度信息
Double latitudeD = point.getLat();
if (Objects.isNull(longitudeD)) {
result.error500("请传入经度");
result.error500("Pass in longitude, please");
}
if (Objects.isNull(latitudeD)) {
result.error500("请传入纬度");
result.error500("Please pass in latitude");
}
if (!(longitudeD >= -180 && longitudeD <= 180)) {
result.error500("经度不合法");
result.error500("Longitude is not legal");
}
if (!(latitudeD >= -85.05112878 && latitudeD <= 85.05112878)) {
result.error500("纬度不合法");
result.error500("Latitude illegality");
}
// 1.获取外接正方形
Rectangle rectangle = getRectangle(radius, longitudeD, latitudeD);
@ -383,7 +383,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
}
}
if (StringUtils.isBlank(cacheTime)){
result.error500("缓存时间不能为空");
result.error500("The cache time cannot be empty");
return result;
}
//根据用户id查询出当前用户关注的台站信息

View File

@ -84,7 +84,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
//根据用户名称查询对应的用户信息
SysUser sysUser = cacheTimeService.findUserByName(username);
if (Objects.isNull(sysUser)){
result.error500("当前用户不存在!");
result.error500("The current user does not exist!");
return result;
}
//判断传递参数信息是否为空
@ -145,7 +145,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
//根据用户名称查询对应的用户信息
SysUser sysUser = cacheTimeService.findUserByName(username);
if (Objects.isNull(sysUser)){
result.error500("当前用户不存在!");
result.error500("The current user does not exist!");
return result;
}
LambdaQueryWrapper<SysUserFocusStationStation> queryWrapper = new LambdaQueryWrapper<>();

View File

@ -322,7 +322,7 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTaskSystem
this.baseMapper.deleteById(fromSysTask);
}
result.setSuccess(true);
result.success("交接完成");
result.success("Handover completed");
} catch (ParseException e) {
throw new RuntimeException(e);
}

View File

@ -49,12 +49,12 @@ public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsA
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
result.error500("The start time cannot be empty");
return result;
}
String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
result.error500("The end time cannot be empty");
return result;
}
String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59";

View File

@ -40,11 +40,11 @@ public class GardsMetDataServiceImpl extends ServiceImpl<GardsMetDataMapper, Gar
return result;
}
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
result.error500("The start time cannot be empty");
return result;
}
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
result.error500("The end time cannot be empty");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");

View File

@ -47,11 +47,11 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
return result;
}
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
result.error500("The start time cannot be empty");
return result;
}
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
result.error500("The end time cannot be empty");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
@ -94,11 +94,11 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
return result;
}
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
result.error500("The start time cannot be empty");
return result;
}
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
result.error500("The end time cannot be empty");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");

View File

@ -49,12 +49,12 @@ public class ReviewedServiceImpl extends ServiceImpl<GardsAnalysesManMapper, Gar
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
result.error500("The start time cannot be empty");
return result;
}
String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
result.error500("The end time cannot be empty");
return result;
}
String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59";

View File

@ -71,7 +71,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
System.loadLibrary("ReadPHDFile");
System.loadLibrary("GammaAnaly");
//根据配置文件配置邮件获取策略定义时间条件默认EmailReceivePolicy.HISTORY_ORDER_RECEIVE.getPolicy()
Date systemStartupTime = DateUtils.parseDate("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss");
Date systemStartupTime = null;
if(EmailReceivePolicy.CURR_DATE_ORDER_RECEIVE.getPolicy().equals(taskProperties.getReceivePolicy())){
systemStartupTime = new Date();
}

View File

@ -15,4 +15,5 @@ spring:
config:
import:
- optional:nacos:armd.yaml
- optional:nacos:armd-@profile.name@.yaml
- optional:nacos:armd-@profile.name@.yaml
- optional:nacos:armd-analysis-@profile.name@.yaml