添加能谱分析耗时计算

This commit is contained in:
duwenyuan 2025-09-28 10:14:56 +08:00
parent 88be0c9bb3
commit d3481b1b0e
7 changed files with 47 additions and 0 deletions

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.common.constant.StringConstant; import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
@ -25,6 +27,7 @@ import java.util.Objects;
/** /**
* 警告谱处理 * 警告谱处理
*/ */
@Slf4j
public class AlertSpectrum extends AbstractSpectrumHandler{ public class AlertSpectrum extends AbstractSpectrumHandler{
/** /**
@ -76,6 +79,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
DataType.ALERT_SYSTEM.getType().equals(super.currDataType.getType()) || DataType.ALERT_SYSTEM.getType().equals(super.currDataType.getType()) ||
DataType.ALERT_UPS.getType().equals(super.currDataType.getType())){ DataType.ALERT_UPS.getType().equals(super.currDataType.getType())){
try{ try{
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//打印当前处理的能谱类型 //打印当前处理的能谱类型
super.printCurrDataType(); super.printCurrDataType();
//解析邮件内容 //解析邮件内容
@ -86,6 +91,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
this.handlerOriginalData(); this.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//若本次文件来自于undel目录解析成功则删除 //若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile(); deleteIfFromUndelFile();
}catch (Exception e){ }catch (Exception e){

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleStatus; import org.jeecg.modules.base.enums.SampleStatus;
import java.util.Objects; import java.util.Objects;
@ -7,6 +9,7 @@ import java.util.Objects;
/** /**
* 探测器本地谱处理 * 探测器本地谱处理
*/ */
@Slf4j
public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
/** /**
@ -29,6 +32,8 @@ public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.DETBKPHD.getType().equals(super.currDataType.getType())){ if(DataType.DETBKPHD.getType().equals(super.currDataType.getType())){
try{ try{
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//声明日志处理对象 //声明日志处理对象
@ -45,6 +50,8 @@ public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
super.handlerOriginalData(); super.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//修改状态为解析完成 //修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue(); super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus(); super.updateStatus();

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleStatus; import org.jeecg.modules.base.enums.SampleStatus;
import java.util.Objects; import java.util.Objects;
@ -31,6 +32,8 @@ public class GasbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.GASBKPHD.getType().equals(super.currDataType.getType())){ if(DataType.GASBKPHD.getType().equals(super.currDataType.getType())){
try{ try{
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//声明日志处理对象 //声明日志处理对象
@ -47,6 +50,8 @@ public class GasbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
super.handlerOriginalData(); super.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//修改状态为解析完成 //修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue(); super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus(); super.updateStatus();

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.common.constant.StringConstant; import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
@ -26,6 +28,7 @@ import java.util.Objects;
/** /**
* 健康状态谱处理 * 健康状态谱处理
*/ */
@Slf4j
public class HealthStatusSpectrum extends AbstractSpectrumHandler{ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
/** /**
@ -73,6 +76,8 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.SOH.getType().equals(super.currDataType.getType())){ if(DataType.SOH.getType().equals(super.currDataType.getType())){
try { try {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//打印当前处理的能谱类型 //打印当前处理的能谱类型
@ -85,6 +90,8 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
this.handlerOriginalData(); this.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//把流程日志保存到日志目录 //把流程日志保存到日志目录
this.saveLogToLogDir(); this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除 //若本次文件来自于undel目录解析成功则删除

View File

@ -1,7 +1,9 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.common.constant.StringConstant; import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
@ -21,6 +23,7 @@ import java.util.Objects;
/** /**
* 气象谱处理 * 气象谱处理
*/ */
@Slf4j
public class MetSpectrum extends AbstractSpectrumHandler{ public class MetSpectrum extends AbstractSpectrumHandler{
/** /**
@ -66,6 +69,8 @@ public class MetSpectrum extends AbstractSpectrumHandler{
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.MET.getType().equals(super.currDataType.getType())){ if(DataType.MET.getType().equals(super.currDataType.getType())){
try { try {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//打印当前处理的能谱类型 //打印当前处理的能谱类型
super.printCurrDataType(); super.printCurrDataType();
//解析邮件内容 //解析邮件内容
@ -76,6 +81,8 @@ public class MetSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
this.handlerOriginalData(); this.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//把流程日志保存到日志目录 //把流程日志保存到日志目录
this.saveLogToLogDir(); this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除 //若本次文件来自于undel目录解析成功则删除

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleStatus; import org.jeecg.modules.base.enums.SampleStatus;
import java.util.Objects; import java.util.Objects;
@ -7,6 +9,7 @@ import java.util.Objects;
/** /**
* QC谱处理 * QC谱处理
*/ */
@Slf4j
public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
/** /**
@ -30,6 +33,8 @@ public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//判断当前邮件内容是否是QC谱 //判断当前邮件内容是否是QC谱
if(DataType.QCPHD.getType().equals(super.currDataType.getType())){ if(DataType.QCPHD.getType().equals(super.currDataType.getType())){
try{ try{
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//声明日志处理对象 //声明日志处理对象
@ -46,6 +51,8 @@ public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.saveFileToSavefile(); super.saveFileToSavefile();
//结构体数据入库 //结构体数据入库
super.handlerOriginalData(); super.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//修改状态为解析完成 //修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue(); super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus(); super.updateStatus();

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;
import org.jeecg.modules.ErrorLogManager; import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleStatus; import org.jeecg.modules.base.enums.SampleStatus;
@ -19,6 +21,7 @@ import java.util.Objects;
/** /**
* 样品谱处理 * 样品谱处理
*/ */
@Slf4j
public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
/** /**
@ -41,6 +44,8 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){ if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){
try{ try{
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//声明日志处理对象 //声明日志处理对象
@ -60,6 +65,8 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
} }
//结构体数据入库 //结构体数据入库
super.handlerOriginalData(); super.handlerOriginalData();
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",spectrumFile.getName(),stopWatch.getTime());
//进行BG(P)谱分析 //进行BG(P)谱分析
this.autoAnalysis(); this.autoAnalysis();
//保存PHD文件到savefile //保存PHD文件到savefile