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

This commit is contained in:
nieziyan 2023-11-10 20:17:57 +08:00
commit 75253d81db
27 changed files with 964 additions and 167 deletions

View File

@ -346,12 +346,14 @@ public class EmailServiceManager {
* @throws MessagingException
*/
public void removeMail(@NotNull Message message) throws MessagingException {
try {
message.setFlag(Flags.Flag.DELETED,true);
LogFileUtil.emailLog(spectrumPathProperties.getRootPath() + File.separator + spectrumPathProperties.getLogPath(), "Get", null, "Successful", "DELETEID", message.getSubject(), "");
} catch (MessagingException e) {
LogFileUtil.emailLog(spectrumPathProperties.getRootPath() + File.separator + spectrumPathProperties.getLogPath(), "Get", null, "Error", "DELETEID", message.getSubject(), "");
throw e;
synchronized (this){
try {
message.setFlag(Flags.Flag.DELETED,true);
LogFileUtil.emailLog(spectrumPathProperties.getRootPath() + File.separator + spectrumPathProperties.getLogPath(), "Get", null, "Successful", "DELETEID", message.getSubject(), "");
} catch (MessagingException e) {
LogFileUtil.emailLog(spectrumPathProperties.getRootPath() + File.separator + spectrumPathProperties.getLogPath(), "Get", null, "Error", "DELETEID", message.getSubject(), "");
throw e;
}
}
}

View File

@ -29,6 +29,11 @@ public class SpectrumPathProperties implements Serializable {
*/
private String saveFilePath;
/**
* 统计报告存储路径
*/
private String statisticsPath;
/**
* eml格式邮件存储路径
*/

View File

@ -71,4 +71,9 @@ public class TaskProperties implements Serializable {
*/
private String temporaryStoragePath;
/**
* 统计报告执行周期
*/
private Integer statisticsReportExecCycle;
}

View File

@ -0,0 +1,298 @@
package org.jeecg.modules;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.properties.TaskProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.eneity.event.RepeatErrorEvent;
import org.jeecg.modules.eneity.vo.DBInfoCount;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.service.IStatReportService;
import org.jeecg.modules.service.ISysMailLogService;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 统计报告处理
* 每24小时生成一份邮件解析统计报告
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class StatReportManager implements ApplicationListener<ApplicationEvent>{
/**
* 开始时间
*/
private Date beginTime = null;
/**
* 结束时间
*/
private Date endTime = null;
/**
* 格式化错误数量
*/
private Integer formatErrorNumber = 0;
/**
* 邮件重复数量
*/
private Integer repeatErrorNumber = 0;
private boolean isFirst = true;
private final ISysMailLogService mailLogService;
private final IStatReportService statReportService;
private final SpectrumPathProperties spectrumPathProperties;
private final TaskProperties taskProperties;
public void start(){
ReportExecThread reportExecThread = new ReportExecThread();
reportExecThread.setName("statisticsReportExecThread");
reportExecThread.start();
}
/**
* 统计报告执行线程
*/
private class ReportExecThread extends Thread{
@Override
public void run() {
for(;;){
long start = System.currentTimeMillis();
if(isFirst){
beginTime = new Date();
isFirst = false;
}else{
//生成报告和下面onApplicationEvent函数要加类锁保障生成报告时不接收新的错误事件
//否则可能造成错误事件数量大于实际的时间范围内的错误数量
synchronized(StatReportManager.class){
Date nowTime = new Date();
endTime = nowTime;
GeneratingReports report = new GeneratingReports();
report.genReport();
//报告生成结束后重新赋予beginTime值为上次结束时间毫秒加1
beginTime = new Date(nowTime.getTime()+1);
//生成报告后重新初始化参数
formatErrorNumber = 0;
repeatErrorNumber = 0;
}
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getStatisticsReportExecCycle() - (end-start);
//如果sleepTime > 0 需要睡眠到指定时间否则继续下次
if(sleepTime > 0){
try {
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 接收错误事件
* @param event
*/
@Override
public void onApplicationEvent(ApplicationEvent event) {
synchronized(StatReportManager.class){
if(event instanceof FormatErrorEvent){
formatErrorNumber++;
}else if (event instanceof RepeatErrorEvent){
repeatErrorNumber++;
}
}
}
/**
* 生成报告
*/
private class GeneratingReports extends AbstractLogOrReport{
/**
* 创建时间
*/
private Date createTime = new Date();
/**
* 邮件数量
*/
private long emailNumber = 0;
/**
* 原始库数据数量
*/
private Integer originalDBNumber = 0;
/**
* 邮件解析详情记录
*/
private List<DBInfoCount> dbInfoCounts = null;
/**
* 报告内容
*/
StringBuilder report = new StringBuilder();
/**
* 生成报告
*/
private void genReport(){
try {
this.countMailNumber();
this.countDBNumber();
this.setHeader();
this.setStatisticsInfo();
this.setStatisticsErrorFileInfo();
this.setDBInfo();
this.storeReport();
}catch (Exception e){
e.printStackTrace();
log.error("Failed to generate analysis report because: {}",e.getMessage());
}
}
/**
* 统计邮件数量
*/
private void countMailNumber() throws ParseException {
// Date d1 = DateUtils.parseDate("2023-11-07 00:00:00","yyyy-MM-dd HH:mm:ss");
// Date d2 = DateUtils.parseDate("2023-11-07 23:59:59","yyyy-MM-dd HH:mm:ss");
final long emailNumber = mailLogService.countEmailNumByCreateTimeRange(beginTime,endTime);
this.emailNumber = emailNumber;
}
/**
* 统计原始库和分析库入库数量
*/
private void countDBNumber() throws ParseException {
// Date d1 = DateUtils.parseDate("2023-10-12 00:00:00","yyyy-MM-dd HH:mm:ss");
// Date d2 = DateUtils.parseDate("2023-10-20 23:59:59","yyyy-MM-dd HH:mm:ss");
final List<DBInfoCount> dbInfoCounts = statReportService.countParsingMailRecords(beginTime,endTime);
if(!CollectionUtils.isEmpty(dbInfoCounts)){
this.dbInfoCounts = dbInfoCounts;
final int records = dbInfoCounts.stream().mapToInt(DBInfoCount::getOriginalDataNumber).sum();
this.originalDBNumber = records;
}
}
/**
* Header块
*/
private void setHeader(){
final String title = "%-36s GENERATED STATISTICS REPORT";
final String createDate = "%-33s Creation Date %s";
report.append(rowFormat(title,StringConstant.SPACE));
report.append(System.lineSeparator());
report.append(rowFormat(createDate,StringConstant.SPACE, DateUtils.formatDate(createTime,"yyyy/MM/dd-HH:mm:ss")));
report.append(System.lineSeparator()).append(System.lineSeparator());
}
/**
* #STATISTICS INFO
*/
private void setStatisticsInfo(){
final String blockTitle = "#STATISTICS INFO";
final String beginTimeRow = " Statistics BeginTime: %-11s %s";
final String endTimeRow = " Statistics EndTime: %-13s %s";
final String emailNumberRow = " Email Number: %-18s %s";
final String dbNumberRow = " Original Data Load to DB Number: %s";
report.append(rowFormat(blockTitle));
report.append(System.lineSeparator());
report.append(rowFormat(beginTimeRow,StringConstant.SPACE,DateUtils.formatDate(beginTime,"yyyy/MM/dd-HH:mm:ss")));
report.append(System.lineSeparator());
report.append(rowFormat(endTimeRow,StringConstant.SPACE,DateUtils.formatDate(endTime,"yyyy/MM/dd-HH:mm:ss")));
report.append(System.lineSeparator());
report.append(rowFormat(emailNumberRow,StringConstant.SPACE,String.valueOf(emailNumber)));
report.append(System.lineSeparator());
report.append(rowFormat(dbNumberRow,String.valueOf(originalDBNumber)));
report.append(System.lineSeparator()).append(System.lineSeparator());
}
/**
* #STATISTICS ERROR FILE
*/
private void setStatisticsErrorFileInfo(){
final String blockTitle = "#STATISTICS ERROR FILE";
final String formatErrorRow = " File Format Error: %-15s";
final String repeatErrorRow = " File Repeat Error: %-15s";
report.append(rowFormat(blockTitle));
report.append(System.lineSeparator());
report.append(rowFormat(formatErrorRow,String.valueOf(formatErrorNumber)));
report.append(System.lineSeparator());
report.append(rowFormat(repeatErrorRow,String.valueOf(repeatErrorNumber)));
report.append(System.lineSeparator()).append(System.lineSeparator());
}
/**
* #LOAD INTO DB INFO
*/
private void setDBInfo(){
final String blockTitle = "#LOAD INTO DB INFO";
final String rowTitle = " Station Name %-15s DataType %-12s Original Data Number %s Anlyse Data Number";
final String repeatErrorRow = " %-28s %-21s %-22s %s";
report.append(rowFormat(blockTitle));
report.append(System.lineSeparator());
report.append(rowFormat(rowTitle,StringConstant.SPACE,StringConstant.SPACE,StringConstant.SPACE));
report.append(System.lineSeparator());
if(!CollectionUtils.isEmpty(dbInfoCounts)){
for(DBInfoCount dbInfoCount : dbInfoCounts){
report.append(rowFormat(repeatErrorRow,dbInfoCount.getStationName(),this.dataTypeConvert(dbInfoCount.getDataType()),String.valueOf(dbInfoCount.getOriginalDataNumber()),String.valueOf(dbInfoCount.getAnlyseDataNumber())));
report.append(System.lineSeparator());
}
}
report.append(System.lineSeparator());
}
/**
* 保存报告到savefile/Statistics路径
* @throws IOException
*/
private void storeReport() throws IOException {
final String statisticsPath = spectrumPathProperties.getStatisticsPath();
StringBuilder finalPath = new StringBuilder();
finalPath.append(spectrumPathProperties.getRootPath());
finalPath.append(File.separator);
finalPath.append(spectrumPathProperties.getSaveFilePath());
finalPath.append(File.separator);
finalPath.append(spectrumPathProperties.getStatisticsPath());
finalPath.append(File.separator);
finalPath.append(DateUtils.formatDate(beginTime,"yyyyMMdd-HHmmss"));
finalPath.append(StringConstant.UNDER_LINE);
finalPath.append(DateUtils.formatDate(endTime,"yyyyMMdd-HHmmss"));
finalPath.append(".txt");
FileOperation.saveOrAppendFile(finalPath.toString(),report.toString(),false);
}
/**
* 格式化能谱类型
* @param dataType
* @return
*/
private String dataTypeConvert(String dataType){
switch (dataType){
case "S":
return "SAMPLEPHD";
case "Q":
return "QCPHD";
case "G":
return "GASBKPHD";
case "D":
return "DETBKPHD";
default:
return dataType;
}
}
}
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.eneity.event;
import org.springframework.context.ApplicationEvent;
import java.io.Serializable;
/**
* 格式化错误事件
*/
public class FormatErrorEvent extends ApplicationEvent implements Serializable {
public FormatErrorEvent() {
super(new Object());
}
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.eneity.event;
import org.springframework.context.ApplicationEvent;
import java.io.Serializable;
/**
* 邮件重复错误
*/
public class RepeatErrorEvent extends ApplicationEvent implements Serializable {
public RepeatErrorEvent() {
super(new Object());
}
}

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.eneity.vo;
import lombok.Data;
/**
* 统计报告使用
* 接收邮件解析后存储到数据库的记录数量信息
*/
@Data
public class DBInfoCount {
/**
* 台站名称
*/
private String stationName;
/**
* 能谱类型
*/
private String dataType;
/**
* 单封邮件解析后存储到原始库的记录数量
*/
private Integer originalDataNumber;
/**
* 单封邮件解析后存储到分析库的记录数量
*/
private Integer anlyseDataNumber;
}

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.eneity.vo.DBInfoCount;
import java.util.Date;
import java.util.List;
/**
* 统计报告Mapper
*/
public interface StatReportMapper extends BaseMapper {
/**
* 统计邮件解析产生的记录数
* @param beginDate
* @param endDate
* @return
*/
List<DBInfoCount> countParsingMailRecords(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.StatReportMapper">
<select id="countParsingMailRecords" resultType="org.jeecg.modules.eneity.vo.DBInfoCount">
select
r.stationName as stationName,
r.dataType as dataType,
r.originalDataNumber as originalDataNumber,
r.anlyseDataNumber as anlyseDataNumber
from (
select
substr(t.site_det_code,1,5) as stationName,
t.data_type as dataType,
(
1+
(select count(*) from original.GARDS_ROI_LIMITS grl where grl.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SAMPLE_AUX gsa where gsa.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SAMPLE_CERT gsc where gsc.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SAMPLE_CERT_LINE gscl where gscl.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SAMPLE_DESCRIPTION gsd where gsd.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SAMPLE_RATIOS gsr where gsr.sample_id = t.sample_id)+
(select count(*) from original.GARDS_SPECTRUM gs where gs.sample_id = t.sample_id)+
(select count(*) from original.GARDS_TOTAL_EFFICIENCY_PAIRS gtep where gtep.sample_id = t.sample_id)+
(select count(*) from original.GARDS_HISTOGRAM gh where gh.sample_id = t.sample_id)+
(select count(*) from original.GARDS_CALIBRATION_PAIRS_ORIG gcp where gcp.sample_id = t.sample_id)+
(select count(*) from original.GARDS_BG_EFFICIENCY_PAIRS gbep where gbep.sample_id = t.sample_id)
) as originalDataNumber,
(
(select count(*) from rnauto.GARDS_ANALYSES ga where ga.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_CALIBRATION gc where gc.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_CALIBRATION_PAIRS gcp where gcp.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_NUCL_IDED gn where gn.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_NUCL_LINES_IDED gnli where gnli.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_ROI_CHANNELS grc where grc.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_ROI_RESULTS grr where grr.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_XE_RESULTS gxr where gxr.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_PEAKS gp where gp.sample_id = t.sample_id)+
(select count(*) from rnauto.GARDS_QC_CHECK gqc where gqc.sample_id = t.sample_id)
) as anlyseDataNumber,
t.moddate
from original.GARDS_SAMPLE_DATA t
where t.moddate between #{beginDate} and #{endDate}
union all
select
min(t.station_code) as stationName,
'MET' as dataType,
count(*) as originalDataNumber,
0 as anlyseDataNumber,
min(t.moddate) as moddate
from original.GARDS_MET_DATA t
where t.moddate between #{beginDate} and #{endDate}
group by t.input_file_name
union all
select
min(t.station_code) as stationName,
'SOH' as dataType,
count(*) as originalDataNumber,
0 as anlyseDataNumber,
min(t.moddate) as moddate
from original.GARDS_SOH_DATA t
where t.moddate between #{beginDate} and #{endDate}
group by t.input_file_name
union all
select
t.station_code as stationName,
'ALERT' as dataType,
1 as originalDataNumber,
0 as anlyseDataNumber,
t.time as moddate
from original.GARDS_ALERT_DATA t
where t.time between #{beginDate} and #{endDate}
) r order by r.moddate asc
</select>
</mapper>

View File

@ -0,0 +1,20 @@
package org.jeecg.modules.service;
import org.jeecg.modules.eneity.vo.DBInfoCount;
import java.util.Date;
import java.util.List;
/**
* 统计报告Service
*/
public interface IStatReportService {
/**
* 统计邮件解析产生的记录数
* @param beginDate
* @param endDate
* @return
*/
List<DBInfoCount> countParsingMailRecords(Date beginDate, Date endDate);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import org.jeecg.modules.email.EmailProperties;
import javax.mail.Message;
import java.util.Date;
/**
* 邮件处理日志
@ -15,5 +16,13 @@ public interface ISysMailLogService extends IService<SysEmailLog> {
* @param message
* @param email
*/
public void create(Message message,EmailProperties email) throws Exception;
void create(Message message,EmailProperties email) throws Exception;
/**
* 根据时间范围统计邮件数量
* @param beginTime
* @param endTime
* @return
*/
long countEmailNumByCreateTimeRange(Date beginTime, Date endTime);
}

View File

@ -37,7 +37,6 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
detector.setDetectorId(format.formatDetectorCodeToId(detectorCode));
detector.setDetectorCode(detectorCode);
detector.setStatus(DetectorsStatus.OPERATING.getStatus());
detector.setModdate(new Date());
this.baseMapper.insert(detector);
return detector;
}

View File

@ -93,7 +93,6 @@ public class SpectrumBaseBlockServiceImpl implements ISpectrumBaseBlockService {
gardsSampleData.setAcquisitionLiveSec(struct.acquisition_live_time);
gardsSampleData.setQuantity(struct.air_volume);
gardsSampleData.setStatus(status);
gardsSampleData.setModdate(new Date());
this.sampleDataMapper.insert(gardsSampleData);

View File

@ -0,0 +1,39 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import lombok.RequiredArgsConstructor;
import org.jeecg.modules.eneity.vo.DBInfoCount;
import org.jeecg.modules.mapper.StatReportMapper;
import org.jeecg.modules.service.IStatReportService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* 统计报告Service
*/
@DS("ora")
@Service
@RequiredArgsConstructor
public class StatReportServiceImpl implements IStatReportService {
private final StatReportMapper statReportMapper;
/**
* 统计邮件解析产生的记录数
* @param beginDate
* @param endDate
* @return
*/
@Override
public List<DBInfoCount> countParsingMailRecords(Date beginDate, Date endDate) {
final List<DBInfoCount> dbInfoCounts = statReportMapper.countParsingMailRecords(beginDate, endDate);
if(CollectionUtils.isEmpty(dbInfoCounts)){
return Collections.EMPTY_LIST;
}
return dbInfoCounts;
}
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import org.jeecg.modules.email.EmailProperties;
@ -9,6 +10,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.mail.Message;
import javax.mail.internet.MimeUtility;
import java.util.Date;
/**
* 邮件处理日志
*/
@ -29,4 +32,18 @@ public class SysMailLogServiceImpl extends ServiceImpl<SysMailLogMapper, SysEmai
mailLog.setReceiveTime(message.getReceivedDate());
this.save(mailLog);
}
/**
* 根据时间范围统计邮件数量
* @param beginTime
* @param endTime
* @return
*/
@Override
public long countEmailNumByCreateTimeRange(Date beginTime, Date endTime) {
LambdaQueryWrapper<SysEmailLog> query = new LambdaQueryWrapper<>();
query.between(SysEmailLog::getCreateTime,beginTime,endTime);
final long count = this.count(query);
return count;
}
}

View File

@ -11,6 +11,8 @@ import org.jeecg.common.util.LogFileUtil;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.enums.SampleStatus;
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.eneity.event.RepeatErrorEvent;
import org.jeecg.modules.exception.AcquisitionBlockException;
import org.jeecg.modules.exception.FileRepeatException;
import org.jeecg.modules.exception.HeaderBlockException;
@ -72,6 +74,8 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa
*/
protected void checkHeaderBlock(){
if(this.mailContent.indexOf("#Header") == -1){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
LogFileUtil.emailLog(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath() + File.separator + spectrumServiceQuotes.getSpectrumPathProperties().getLogPath(), "Get", null, "Error", "GETIDHEADER", "", "");
throw new HeaderBlockException("header data error");
}
@ -94,6 +98,8 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa
protected void parseingEmail() throws Exception {
final EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(super.spectrumFile.getAbsolutePath());
if(Objects.isNull(sourceData) || StringUtils.isBlank(sourceData.data_type)){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
LogFileUtil.emailLog(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath() + File.separator + spectrumServiceQuotes.getSpectrumPathProperties().getLogPath(), "Get", null, "Error", "GETIDBODY", "", "");
throw new PHD_ReadException("THE PHDFile has some blocks can't be read:"+super.spectrumFile.getAbsolutePath());
}
@ -136,6 +142,8 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa
newFileName.append(StringUtils.replace(this.sourceData.acquisition_start_time.substring(0,this.sourceData.acquisition_start_time.lastIndexOf(":")),":",""));
newFileName.append(super.spectrumServiceQuotes.getNameStandUtil().GetSuffix(super.currDataType.getType(),this.sourceData.spectrum_quantity,String.valueOf(this.sourceData.acquisition_live_time)));
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileUtil.rename(super.spectrumFile, newFileName.toString(), true);
@ -169,6 +177,8 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa
this.endIntoDatabaseTime = new Date();
//设置文件重复标记为true
this.parsingProcessLog.setFileRepeat(true);
//发送文件重复错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new RepeatErrorEvent());
throw new FileRepeatException("file repeat");
}
DataSourceSwitcher.switchToOracle();

View File

@ -6,6 +6,8 @@ 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.eneity.event.FormatErrorEvent;
import org.jeecg.modules.eneity.event.RepeatErrorEvent;
import org.jeecg.modules.exception.FileRepeatException;
import org.jeecg.modules.exception.PHD_ReadException;
import org.jeecg.modules.file.FileOperation;
@ -91,7 +93,9 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
@Override
protected void parseingEmail() throws Exception {
final AlertSpectrumStruct sourceData = EnergySpectrumHandler.getAlertSourceData(super.spectrumFile.getAbsolutePath());
if(Objects.isNull(sourceData)){
if(Objects.isNull(sourceData) || StringUtils.isBlank(sourceData.station_code)){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new RepeatErrorEvent());
throw new PHD_ReadException("THE PHDFile has some blocks can't be read:"+super.spectrumFile.getAbsolutePath());
}
this.sourceData = sourceData;
@ -130,6 +134,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
newFileName.append(StringUtils.replace(this.sourceData.time,":",""));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);
@ -146,6 +152,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
this.alertData = alertData;
this.endIntoDatabaseTime = new Date();
this.isFileRepeat = true;
//发送文件重复错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileRepeatException("file repeat");
}
this.alertData = super.spectrumServiceQuotes.getAlertSpectrumService().create(this.sourceData, super.spectrumFileRelativePath);

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.GardsSohData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.exception.AirSamplerFlowException;
import org.jeecg.modules.exception.PHD_ReadException;
import org.jeecg.modules.file.FileOperation;
@ -86,7 +87,9 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
@Override
protected void parseingEmail() throws Exception {
final SOHSpectrumStruct sourceData = EnergySpectrumHandler.getSOHSourceData(super.spectrumFile.getAbsolutePath());
if(Objects.isNull(sourceData)){
if(Objects.isNull(sourceData) || StringUtils.isBlank(sourceData.station_code)){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new PHD_ReadException("THE PHDFile has some blocks can't be read:"+super.spectrumFile.getAbsolutePath());
}
if(sourceData.af_record_count <= 0 || sourceData.af_start_date.size() < 0 || sourceData.af_start_time.size() < 0){
@ -128,6 +131,8 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
newFileName.append(StringUtils.replace(this.sourceData.start_time,":",""));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);

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.GardsMetData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.MetSpectrumStruct;
@ -83,7 +84,9 @@ public class MetSpectrum extends AbstractSpectrumHandler{
@Override
protected void parseingEmail() throws Exception{
final MetSpectrumStruct sourceData = EnergySpectrumHandler.getMetSourceData(super.spectrumFile.getAbsolutePath());
if(Objects.isNull(sourceData)){
if(Objects.isNull(sourceData) || StringUtils.isBlank(sourceData.station_code)){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new RuntimeException("THE PHDFile has some blocks can't be read:"+super.spectrumFile.getAbsolutePath());
}
this.sourceData = sourceData;
@ -122,6 +125,8 @@ public class MetSpectrum extends AbstractSpectrumHandler{
newFileName.append(StringUtils.replace(this.sourceData.met_start_time.get(0),":",""));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);

View File

@ -85,6 +85,11 @@ public class SpectrumParsingActuator implements Runnable{
String receiveTime = null;
StringBuilder finalFileName = new StringBuilder();
try {
//所有邮件都需以.eml格式存储到eml文件夹中
downloadEmailToEmlDir();
//保存邮件日志到PG数据库
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
subject = MimeUtility.decodeText(message.getSubject());
sendTime = DateUtils.formatDate(message.getSentDate(),"yyyy-MM-dd HH:mm:ss");
receiveTime = DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss");
@ -92,8 +97,6 @@ public class SpectrumParsingActuator implements Runnable{
emailServiceManager.getMailContent(message,mailContent);
//读取文件内容成功后写入日志
LogFileUtil.emailLog(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath() + File.separator + spectrumServiceQuotes.getSpectrumPathProperties().getLogPath(),"Get", emailProperties, "Successful", "GETALLID", "", "");
//所有邮件都需以.eml格式存储到eml文件夹中
downloadEmailToEmlDir();
//读取文件内容成功后写入日志
LogFileUtil.emailLog(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath() + File.separator + spectrumServiceQuotes.getSpectrumPathProperties().getLogPath(),"Get", emailProperties, "Successful", "GETIDEML", subject, "");
//判断是否是IMS2.0协议文件
@ -102,8 +105,6 @@ public class SpectrumParsingActuator implements Runnable{
spectrumHandler.init(mailContent.toString(),spectrumServiceQuotes,finalFileName);
final boolean matchResult = spectrumHandler.saveEmailToLocal();
if(matchResult){
//保存邮件解析日志到PG数据库
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
//开始解析
spectrumHandler.handler();
}else{
@ -122,13 +123,13 @@ public class SpectrumParsingActuator implements Runnable{
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 {
this.taskLatch.countDown();
//删除邮箱中已处理过的邮件
try {
emailServiceManager.removeMail(message);
} catch (MessagingException e) {
e.printStackTrace();
}
this.taskLatch.countDown();
LogFileUtil.emailLog(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath() + File.separator + spectrumServiceQuotes.getSpectrumPathProperties().getLogPath(), "Get", null, "Successful", "DONE", "", "");
}
}

View File

@ -8,6 +8,7 @@ import org.jeecg.common.util.NameStandUtil;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.modules.datasource.OraDataSourceProperties;
import org.jeecg.modules.service.*;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ResourceLoader;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
@ -79,6 +80,8 @@ public class SpectrumServiceQuotes {
private final LogFileUtil logFileUtil;
private final ApplicationContext applicationContext;
/**
* 原始库插入数据锁
*/

View File

@ -3040,7 +3040,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
qsScacPath = qsScacPath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
String savePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath();
String savePath = spectrumPathProperties.getSaveFilePath();
String rootPath = spectrumPathProperties.getRootPath();
String qsSaveBaseLine = savePath + StringPool.SLASH + qsBaseLinePath;
@ -3867,6 +3867,12 @@ public class GammaFileUtil extends AbstractLogOrReport {
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

@ -174,6 +174,20 @@ public class PHDFileUtil extends AbstractLogOrReport {
List<List<Double>> gammaEnergyList = new LinkedList<>();
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
//C to E
List<Double> gammaFittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<String> gammaFittingParaStr = new LinkedList<>();
for (Double para:gammaFittingPara) {
gammaFittingParaStr.add(String.valueOf(para));
}
//E to C
List<Double> gammaFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
List<String> gammaFittingParaToUiStr = new LinkedList<>();
for (Double para:gammaFittingParaToUi) {
gammaFittingParaToUiStr.add(String.valueOf(para));
}
betaDataFile.setGammaFittingParaOld(gammaFittingParaStr);
betaDataFile.setGammaFittingParaToUiOld(gammaFittingParaToUiStr);
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<Double> gchannels = new ArrayList<>();
for (int i=0; i<numGChannel; i++){
@ -217,6 +231,20 @@ public class PHDFileUtil extends AbstractLogOrReport {
List<List<Double>> betaEnergyList = new LinkedList<>();
List<Double> bChannel = struct.b_channel;
List<Double> bElectronEnergy = struct.b_electron_energy;
//C to E
List<Double> betaFittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<String> betaFittingParaStr = new LinkedList<>();
for (Double para:betaFittingPara) {
betaFittingParaStr.add(String.valueOf(para));
}
//E to C
List<Double> betaFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
List<String> betaFittingParaToUiStr = new LinkedList<>();
for (Double para:betaFittingParaToUi) {
betaFittingParaToUiStr.add(String.valueOf(para));
}
betaDataFile.setBetaFittingParaOld(betaFittingParaStr);
betaDataFile.setBetaFittingParaToUiOld(betaFittingParaToUiStr);
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<Double> bchannels = new ArrayList<>();
for (int i=0; i<numBChannel; i++){
@ -226,6 +254,7 @@ public class PHDFileUtil extends AbstractLogOrReport {
betaEnergyList.add(betaEnergy);
}
map.put("betaEnergyData", betaEnergyList);
//计算边界值
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
@ -258,21 +287,45 @@ public class PHDFileUtil extends AbstractLogOrReport {
betaDataFile.setSampleBoundary(boundaryList);
betaDataFile.setSampleHistogramDataList(histogramDataList);
betaDataFile.setSampleHistogramDataDList(histogramDataDList);
betaDataFile.setSampleGammaOriginalSeriseData(gammaOriginalSeriseData);
betaDataFile.setSampleGammaProjectedSeriseData(gammaProjectedSeriseData);
betaDataFile.setSampleGammaEnergyList(gammaEnergyList);
betaDataFile.setSampleBetaOriginalSeriseData(betaOriginalSeriseData);
betaDataFile.setSampleBetaProjectedSeriseData(betaProjectedSeriseData);
betaDataFile.setSampleBetaEnergyList(betaEnergyList);
} else if (type.equalsIgnoreCase("gas")) {
betaDataFile.setGasSpectrumData(spectrumData);
betaDataFile.setGasBoundary(boundaryList);
betaDataFile.setGasHistogramDataList(histogramDataList);
betaDataFile.setGasHistogramDataDList(histogramDataDList);
betaDataFile.setGasGammaOriginalSeriseData(gammaOriginalSeriseData);
betaDataFile.setGasGammaProjectedSeriseData(gammaProjectedSeriseData);
betaDataFile.setGasGammaEnergyList(gammaEnergyList);
betaDataFile.setGasBetaOriginalSeriseData(betaOriginalSeriseData);
betaDataFile.setGasBetaProjectedSeriseData(betaProjectedSeriseData);
betaDataFile.setGasBetaEnergyList(betaEnergyList);
} else if (type.equalsIgnoreCase("det")) {
betaDataFile.setDetSpectrumData(spectrumData);
betaDataFile.setDetBoundary(boundaryList);
betaDataFile.setDetHistogramDataList(histogramDataList);
betaDataFile.setDetHistogramDataDList(histogramDataDList);
betaDataFile.setDetGammaOriginalSeriseData(gammaOriginalSeriseData);
betaDataFile.setDetGammaProjectedSeriseData(gammaProjectedSeriseData);
betaDataFile.setDetGammaEnergyList(gammaEnergyList);
betaDataFile.setDetBetaOriginalSeriseData(betaOriginalSeriseData);
betaDataFile.setDetBetaProjectedSeriseData(betaProjectedSeriseData);
betaDataFile.setSampleBetaEnergyList(betaEnergyList);
} else if (type.equalsIgnoreCase("qc")) {
betaDataFile.setQcSpectrumData(spectrumData);
betaDataFile.setQcBoundary(boundaryList);
betaDataFile.setQcHistogramDataList(histogramDataList);
betaDataFile.setQcHistogramDataDList(histogramDataDList);
betaDataFile.setQcGammaOriginalSeriseData(gammaOriginalSeriseData);
betaDataFile.setQcGammaProjectedSeriseData(gammaProjectedSeriseData);
betaDataFile.setQcGammaEnergyList(gammaEnergyList);
betaDataFile.setQcBetaOriginalSeriseData(betaOriginalSeriseData);
betaDataFile.setQcBetaProjectedSeriseData(betaProjectedSeriseData);
betaDataFile.setQcBetaEnergyList(betaEnergyList);
}
} catch (ParseException e) {
throw new RuntimeException(e);

View File

@ -141,6 +141,58 @@ public class BetaDataFile implements Serializable {
private List<HistogramData> qcHistogramDataDList;
private List<List<Double>> gammaNewEnergyList;
private List<List<Double>> betaNewEnergyList;
private List<SeriseData> sampleGammaOriginalSeriseData;
private List<SeriseData> sampleGammaProjectedSeriseData;
private List<List<Double>> sampleGammaEnergyList;
private List<SeriseData> sampleBetaOriginalSeriseData;
private List<SeriseData> sampleBetaProjectedSeriseData;
private List<List<Double>> sampleBetaEnergyList;
private List<SeriseData> gasGammaOriginalSeriseData;
private List<SeriseData> gasGammaProjectedSeriseData;
private List<List<Double>> gasGammaEnergyList;
private List<SeriseData> gasBetaOriginalSeriseData;
private List<SeriseData> gasBetaProjectedSeriseData;
private List<List<Double>> gasBetaEnergyList;
private List<SeriseData> detGammaOriginalSeriseData;
private List<SeriseData> detGammaProjectedSeriseData;
private List<List<Double>> detGammaEnergyList;
private List<SeriseData> detBetaOriginalSeriseData;
private List<SeriseData> detBetaProjectedSeriseData;
private List<List<Double>> detBetaEnergyList;
private List<SeriseData> qcGammaOriginalSeriseData;
private List<SeriseData> qcGammaProjectedSeriseData;
private List<List<Double>> qcGammaEnergyList;
private List<SeriseData> qcBetaOriginalSeriseData;
private List<SeriseData> qcBetaProjectedSeriseData;
private List<List<Double>> qcBetaEnergyList;
//存储分析结果信息
private List<GardsXeResults> xeDataList;
private List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList;
@ -184,6 +236,8 @@ public class BetaDataFile implements Serializable {
bBetaEnergyValidGas = false;
bGammaEnergyValidDet = false;
bBetaEnergyValidDet = false;
gammaNewEnergyList = new LinkedList<>();
betaNewEnergyList = new LinkedList<>();
xeResultsSpectrumList = new LinkedList<>();
sampleBoundary = new LinkedList<>();

View File

@ -232,7 +232,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("Please select the parse file first");
return result;
}
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
// 解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
@ -572,9 +572,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
int peakNum = 0;
if (Objects.nonNull(analysis)) {
phd.setId_analysis(analysis.getIdAnalysis().toString());
phd.setBaseline_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
phd.setBaseline_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
peakNum = analysis.getNumberOfPeaks();
phd.setTotalCmt(analysis.getComments());
phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel());
@ -1060,7 +1060,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
"2. You didn't change any setting or calibration.";
result.error500(warning);
} else if (flag == -1) {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
gammaFileUtil.RunQC(phd);
String warning = "Finish three tasks:\n" +
@ -1069,7 +1069,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
"\t3.Test QC again.";
result.error500(warning);
} else {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides);
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
// 重新分析各峰值对应的核素信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
@ -1416,6 +1416,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
HashMap<String, Object> map = new HashMap<>();
// 根据boolean 决定是否保留本次数据 如果保留则不需要操作vPeak 并重新拟合线
if (accept) {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
if (flag.equalsIgnoreCase("fit")) {// 如果传递的flag标识 fit则进行修改峰值等数据
for (int j = 0; j < newPeak.size(); j++) {
PeakInfo peakInfo = newPeak.get(j);
@ -1488,9 +1489,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
phd.setVPeak(value);
}
if (entry.getKey().equalsIgnoreCase("vBase")) {
List<Double> vBase = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVBase(vBase);
phd.getBaseCtrls().setBaseline(vBase);
}
}
// 重新计算peak的改变
gammaFileUtil.PeaksChanged(phd);
//重新计算核素活度浓度
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
map.put("table", vPeak);
@ -1578,6 +1586,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.getVPeak().remove(curRow);
//重新计算核素活度浓度
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
//重新分析数据
gammaFileUtil.PeaksChanged(phd);
for (int i = 0; i < phd.getVPeak().size(); i++) {
@ -1706,13 +1715,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// 根据要进行修改的列的数据下标 操作Vpeak数据
phd.getVPeak().get(curRow).nuclides.add(nuclideName);
// 查询当前用户所关心的核素名称
// // 查询当前用户关联的核素信息
// List<String> userLib = new LinkedList<>();
// // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
// userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
// if (CollectionUtils.isEmpty(userLib)) {
// userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
// }
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(userLib);
// 查询出核素信息
NuclideLines it_line = mapNucLines.get(nuclideName);
@ -1781,6 +1783,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
nuclideMap.remove(nuclideName);
//重新计算核素活度浓度
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
//从核素的选中列表中移除对应下标的核素信息
list_identify.remove(index);
//重新初始化峰列表信息
@ -2391,8 +2394,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
data.setPeakEffi(null);
}
} else {
effi = Math.exp(coeffData.Effciency1 * ener + coeffData.Effciency2 + coeffData.Effciency3 / ener + coeffData.Effciency4 / Math.pow(ener, 2) + coeffData.Effciency5 / Math.pow(ener, 3) + coeffData.Effciency6 / Math.pow(ener, 4));
totE = Math.exp(coeffData.totalEf1 * ener + coeffData.totalEf2 + coeffData.totalEf3 / ener + coeffData.totalEf4 / Math.pow(ener, 2) + coeffData.totalEf5 / Math.pow(ener, 3) + coeffData.totalEf6 / Math.pow(ener, 4));
effi = Math.exp( coeffData.Effciency1 * ener + coeffData.Effciency2 + coeffData.Effciency3 / ener + coeffData.Effciency4 / Math.pow(ener, 2) + coeffData.Effciency5 / Math.pow(ener, 3) + coeffData.Effciency6 / Math.pow(ener, 4) );
totE = Math.exp( coeffData.totalEf1 * ener + coeffData.totalEf2 + coeffData.totalEf3 / ener + coeffData.totalEf4 / Math.pow(ener, 2) + coeffData.totalEf5 / Math.pow(ener, 3) + coeffData.totalEf6 / Math.pow(ener, 4) );
data.setTotalEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(totE))));
data.setPeakEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(effi))));
}

View File

@ -657,31 +657,67 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
List<Boundary> boundaryList = new LinkedList<>();
List<HistogramData> histogramDataList = new LinkedList<>();
List<HistogramData> histogramDataDList = new LinkedList<>();
List<SeriseData> betaOriginalSeriseData = new LinkedList<>();
List<SeriseData> betaProjectedSeriseData = new LinkedList<>();
List<List<Double>> betaEnergyList = new LinkedList<>();
List<SeriseData> gammaOriginalSeriseData = new LinkedList<>();
List<SeriseData> gammaProjectedSeriseData = new LinkedList<>();
List<List<Double>> gammaEnergyList = new LinkedList<>();
if (type.equalsIgnoreCase("sample")) {
spectrumData = betaDataFile.getSampleSpectrumData();
boundaryList = betaDataFile.getSampleBoundary();
histogramDataList = betaDataFile.getSampleHistogramDataList();
histogramDataDList = betaDataFile.getSampleHistogramDataDList();
betaOriginalSeriseData = betaDataFile.getSampleBetaOriginalSeriseData();
betaProjectedSeriseData = betaDataFile.getSampleBetaProjectedSeriseData();
betaEnergyList = betaDataFile.getSampleBetaEnergyList();
gammaOriginalSeriseData = betaDataFile.getSampleGammaOriginalSeriseData();
gammaProjectedSeriseData = betaDataFile.getSampleGammaProjectedSeriseData();
gammaEnergyList = betaDataFile.getSampleGammaEnergyList();
} else if (type.equalsIgnoreCase("gas")) {
spectrumData = betaDataFile.getGasSpectrumData();
boundaryList = betaDataFile.getGasBoundary();
histogramDataList = betaDataFile.getGasHistogramDataList();
histogramDataDList = betaDataFile.getGasHistogramDataDList();
betaOriginalSeriseData = betaDataFile.getGasBetaOriginalSeriseData();
betaProjectedSeriseData = betaDataFile.getGasBetaProjectedSeriseData();
betaEnergyList = betaDataFile.getGasBetaEnergyList();
gammaOriginalSeriseData = betaDataFile.getGasGammaOriginalSeriseData();
gammaProjectedSeriseData = betaDataFile.getGasGammaProjectedSeriseData();
gammaEnergyList = betaDataFile.getGasGammaEnergyList();
} else if (type.equalsIgnoreCase("det")) {
spectrumData = betaDataFile.getDetSpectrumData();
boundaryList = betaDataFile.getDetBoundary();
histogramDataList = betaDataFile.getDetHistogramDataList();
histogramDataDList = betaDataFile.getDetHistogramDataDList();
betaOriginalSeriseData = betaDataFile.getDetBetaOriginalSeriseData();
betaProjectedSeriseData = betaDataFile.getDetBetaProjectedSeriseData();
betaEnergyList = betaDataFile.getDetBetaEnergyList();
gammaOriginalSeriseData = betaDataFile.getDetGammaOriginalSeriseData();
gammaProjectedSeriseData = betaDataFile.getDetGammaProjectedSeriseData();
gammaEnergyList = betaDataFile.getDetGammaEnergyList();
} else if (type.equalsIgnoreCase("qc")) {
spectrumData = betaDataFile.getQcSpectrumData();
boundaryList = betaDataFile.getQcBoundary();
histogramDataList = betaDataFile.getQcHistogramDataList();
histogramDataDList = betaDataFile.getQcHistogramDataDList();
betaOriginalSeriseData = betaDataFile.getQcBetaOriginalSeriseData();
betaProjectedSeriseData = betaDataFile.getQcBetaProjectedSeriseData();
betaEnergyList = betaDataFile.getQcBetaEnergyList();
gammaOriginalSeriseData = betaDataFile.getQcGammaOriginalSeriseData();
gammaProjectedSeriseData = betaDataFile.getQcGammaProjectedSeriseData();
gammaEnergyList = betaDataFile.getQcGammaEnergyList();
}
map.put("spectrumData", spectrumData);
map.put("Boundary", boundaryList);
map.put("histogramDataList", histogramDataList);
map.put("histogramDataDList", histogramDataDList);
map.put("gammaOriginalData", gammaOriginalSeriseData);
map.put("gammaProjectedData", gammaProjectedSeriseData);
map.put("gammaEnergyData", gammaEnergyList);
map.put("betaOriginalData", betaOriginalSeriseData);
map.put("betaProjectedData", betaProjectedSeriseData);
map.put("betaEnergyData", betaEnergyList);
return map;
}
@ -947,53 +983,48 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append("\n");
strBuffer.append("#SAMPLE Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (betaDataFile.isBBetaEnergyValidSample() || betaDataFile.isBGammaEnergyValidSample()){
if (betaDataFile.isBBetaEnergyValidSample()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidSample()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (betaDataFile.isBBetaEnergyValidSample()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidSample()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ").append(" CH(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ").append(" E(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" 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(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(" CH(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(" E(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1())))
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(" E(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())))
.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");
@ -1006,54 +1037,49 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append("\n");
strBuffer.append("#DET Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (betaDataFile.isBBetaEnergyValidDet() || betaDataFile.isBGammaEnergyValidDet()){
if (betaDataFile.isBBetaEnergyValidDet()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidDet()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (betaDataFile.isBBetaEnergyValidDet()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidDet()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ").append(" CH(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ").append(" E(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" 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(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(" CH(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(" E(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1())))
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(" E(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1())))
.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");
@ -1065,53 +1091,48 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append("\n");
strBuffer.append("#GAS Old CALIBRATION").append("\n");
strBuffer.append(" Old Beta Old Gamma ").append("\n");
if (betaDataFile.isBBetaEnergyValidGas() || betaDataFile.isBGammaEnergyValidGas()){
if (betaDataFile.isBBetaEnergyValidGas()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidGas()) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (betaDataFile.isBBetaEnergyValidGas()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (betaDataFile.isBGammaEnergyValidGas()) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ").append(" CH(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" E(x) = (?1)+(?2)*x+(?3)x*x ").append(" E(x) = (?1)+(?2)*x+(?3)x*x").append("\n");
strBuffer.append(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaOld())) {
strBuffer.append(rowFormat(" CH(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(" CH(x) = (?1)+(?2)*x+(?3)x*x ");
strBuffer.append("\n");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" E(x) = (?1)+(?2)*x+(?3)x*x ");
}
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaFittingParaToUiOld())) {
strBuffer.append(rowFormat(" E(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(" 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(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(" CH(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(" E(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1())))
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(" E(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())))
.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");
@ -1617,17 +1638,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
map.put("max", max);
map.put("gammaSpectrum", seriseDataList);
if (betaDataFile.getGammaList().size()<=0) {
if (betaDataFile.getGammaList().size() <= 0 ) {
betaDataFile.setGammaList(oldScatterSeries);
}
if (betaDataFile.getGammaFittingPara().size()<=0) {
if (betaDataFile.getGammaFittingPara().size() <= 0 ) {
betaDataFile.setGammaFittingPara(fittingParaStr);
}
if (betaDataFile.getGammaFittingParaToUi().size()<=0) {
if (betaDataFile.getGammaFittingParaToUi().size() <= 0 ) {
betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr);
}
betaDataFile.setGammaFittingParaOld(fittingParaStr);
betaDataFile.setGammaFittingParaToUiOld(fittingParaToUiStr);
}
result.setSuccess(true);
result.setResult(map);
@ -1740,8 +1759,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (betaDataFile.getBetaFittingParaToUi().size()<=0) {
betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr);
}
betaDataFile.setBetaFittingParaOld(fittingParaStr);
betaDataFile.setBetaFittingParaToUiOld(fittingParaToUiStr);
}
result.setSuccess(true);
result.setResult(map);
@ -2495,6 +2512,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara);
List<SeriseData> newLineSeries = new LinkedList<>();
List<List<Double>> energyList = new LinkedList<>();
for (Double calEnergy:energys) {
List<Double> newEnergy = new LinkedList<>();
newEnergy.add(calEnergy);
energyList.add(newEnergy);
}
for (int i=0; i<channels.size(); ++i) {
SeriseData seriseData = new SeriseData();
seriseData.setX(channels.get(i));
@ -2531,10 +2554,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setBetaList(tempPoints);
betaDataFile.setBetaFittingPara(fittingParaStr);
betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr);
betaDataFile.setBetaNewEnergyList(energyList);
} else if (tabName.equalsIgnoreCase("gamma")) {
betaDataFile.setGammaList(tempPoints);
betaDataFile.setGammaFittingPara(fittingParaStr);
betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr);
betaDataFile.setGammaNewEnergyList(energyList);
}
} else {
List<Double> fittingPara = new LinkedList<>();
@ -2575,6 +2600,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara);
List<SeriseData> newLineSeries = new LinkedList<>();
List<List<Double>> energyList = new LinkedList<>();
for (Double calEnergy:energys) {
List<Double> newEnergy = new LinkedList<>();
newEnergy.add(calEnergy);
energyList.add(newEnergy);
}
for (int i=0; i<channels.size(); ++i) {
SeriseData seriseData = new SeriseData();
seriseData.setX(channels.get(i));
@ -2594,10 +2625,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setBetaList(tempPoints);
betaDataFile.setBetaFittingPara(fittingParaStr);
betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr);
betaDataFile.setBetaNewEnergyList(energyList);
} else if (tabName.equalsIgnoreCase("gamma")) {
betaDataFile.setGammaList(tempPoints);
betaDataFile.setGammaFittingPara(fittingParaStr);
betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr);
betaDataFile.setGammaNewEnergyList(energyList);
}
}
result.setSuccess(true);
@ -2658,11 +2691,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
Map<String, Object> map = new HashMap<>();
//获取当前登陆的用户名
String userName = JwtUtil.getUserNameByToken(request);
//获取当前操作的文件名称
String currentFileName = analyseData.getCurrentFileName();
//获取缓存信息
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
if ("CurrentSpectrum".equals(analyseData.getApplyType())) {
String sampleFileName = analyseData.getSampleFileNames().get(0);
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
BetaDataFile betaDataFile = cache.getIfPresent(currentFileName + "-" + userName);
if (Objects.isNull(betaDataFile)) {
result.error500("Load basic file information first!");
return result;
@ -2674,9 +2708,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
result.setResult(map);
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
//获取当前选中的文件名称
String currentFileName = analyseData.getCurrentFileName();
String currentQCFileName = analyseData.getCurrentQCFileName();
map = BetaGammaAnalyzeAllProcess(analyseData, userName, currentFileName, currentQCFileName);
map = BetaGammaAnalyzeAllProcess(analyseData, userName, currentFileName);
if (CollectionUtils.isNotEmpty(map)) {
map.put("bProcessed", true);
map.put("savedAnalysisResult", true);
@ -2722,12 +2754,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
spectrum_group.b_c2e = bc2e;
if (analyseData.isSampleData()) {
betaDataFile.setBBetaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
betaDataFile.setSampleBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("sampleBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isGasBgData()) {
betaDataFile.setBBetaEnergyValidGas(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
betaDataFile.setGasBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("gasBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isDetBgData()) {
betaDataFile.setBBetaEnergyValidDet(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
betaDataFile.setDetBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("detBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isQcData()) {
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
betaDataFile.setQcBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("qcBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
}
//判断是否对gamma页面进行过分析
@ -2744,12 +2794,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
spectrum_group.g_c2e = gc2e;
if (analyseData.isSampleData()) {
betaDataFile.setBGammaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
betaDataFile.setSampleGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("sampleGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isGasBgData()) {
betaDataFile.setBGammaEnergyValidGas(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
betaDataFile.setGasGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("gasGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isDetBgData()) {
betaDataFile.setBGammaEnergyValidDet(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
betaDataFile.setDetGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("detGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isQcData()) {
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
betaDataFile.setQcGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("qcGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
}
//判断是否勾选了sample
@ -2834,7 +2902,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
return xeMap;
}
private Map<String, Object> BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName, String currentQCFileName){
private Map<String, Object> BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName){
//从本地缓存获取beta gamma的数组
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
//返回最终结果用的map
@ -2885,12 +2953,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
spectrum_group.b_c2e = bc2e;
if (analyseData.isSampleData()) {
sampleBetaData.setBBetaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
sampleBetaData.setSampleBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("sampleBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isGasBgData()) {
sampleBetaData.setBBetaEnergyValidGas(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
sampleBetaData.setGasBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("gasBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isDetBgData()) {
sampleBetaData.setBBetaEnergyValidDet(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
sampleBetaData.setDetBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("detBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
if (analyseData.isQcData()) {
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
sampleBetaData.setQcBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("qcBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
}
}
if (analyseData.isGammaEnergyValid()) {
@ -2906,12 +2992,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
spectrum_group.g_c2e = gc2e;
if (analyseData.isSampleData()) {
sampleBetaData.setBGammaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
sampleBetaData.setSampleGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("sampleGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isGasBgData()) {
sampleBetaData.setBGammaEnergyValidGas(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
sampleBetaData.setGasGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("gasGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isDetBgData()) {
sampleBetaData.setBGammaEnergyValidDet(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
sampleBetaData.setDetGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("detGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
if (analyseData.isQcData()) {
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
sampleBetaData.setQcGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("qcGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
}
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();

View File

@ -8,10 +8,7 @@ import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.properties.TaskProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.AutoProcessManager;
import org.jeecg.modules.DelFileManager;
import org.jeecg.modules.FileSourceHandleManager;
import org.jeecg.modules.UndealHandleManager;
import org.jeecg.modules.*;
import org.jeecg.modules.email.EmailReceivePolicy;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@ -46,7 +43,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
private final UndealHandleManager undealHandleManager;
private final FileSourceHandleManager fileSourceHandleManager;
private final DelFileManager delFileManager;
private final Object ftpOpierationLock = new Object();
private final StatReportManager statReportManager;
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
@ -81,11 +78,13 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
checkTempStorageDirectory();
//校验存储目录是否存在不存在则创建存在无操作
checkStorageDirectory();
autoProcessManager.start(systemStartupTime);
// autoProcessManager.start(systemStartupTime);
undealHandleManager.start();
fileSourceHandleManager.start();
// 删除过期的文件
delFileManager.start();
//统计报告执行线程
statReportManager.start();
}
/**