Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
c2f303b5fb
|
@ -0,0 +1,70 @@
|
|||
package org.jeecg.common.constant;
|
||||
|
||||
/**
|
||||
* String常量
|
||||
*/
|
||||
public interface StringConstant {
|
||||
|
||||
String AMPERSAND = "&";
|
||||
String AND = "and";
|
||||
String AT = "@";
|
||||
String ASTERISK = "*";
|
||||
String STAR = "*";
|
||||
String BACK_SLASH = "\\";
|
||||
String COLON = ":";
|
||||
String DOUBLE_COLON = "::";
|
||||
String COMMA = ",";
|
||||
String DASH = "-";
|
||||
String DOLLAR = "$";
|
||||
String DOT = ".";
|
||||
String UNDER_LINE = "_";
|
||||
String DOUBLE_DOT = "..";
|
||||
String DOT_CLASS = ".class";
|
||||
String DOT_JAVA = ".java";
|
||||
String DOT_XML = ".xml";
|
||||
String EMPTY = "";
|
||||
String EQUALS = "=";
|
||||
String FALSE = "false";
|
||||
String SLASH = "/";
|
||||
String HASH = "#";
|
||||
String HAT = "^";
|
||||
String LEFT_BRACE = "{";
|
||||
String LEFT_BRACKET = "(";
|
||||
String LEFT_CHEV = "<";
|
||||
String DOT_NEWLINE = ",\n";
|
||||
String NEWLINE = "\n";
|
||||
String N = "n";
|
||||
String NO = "no";
|
||||
String NULL = "null";
|
||||
String OFF = "off";
|
||||
String ON = "on";
|
||||
String PERCENT = "%";
|
||||
String PIPE = "|";
|
||||
String PLUS = "+";
|
||||
String QUESTION_MARK = "?";
|
||||
String EXCLAMATION_MARK = "!";
|
||||
String QUOTE = "\"";
|
||||
String RETURN = "\r";
|
||||
String TAB = "\t";
|
||||
String RIGHT_BRACE = "}";
|
||||
String RIGHT_BRACKET = ")";
|
||||
String RIGHT_CHEV = ">";
|
||||
String SEMICOLON = ";";
|
||||
String SINGLE_QUOTE = "'";
|
||||
String BACKTICK = "`";
|
||||
String SPACE = " ";
|
||||
String TILDA = "~";
|
||||
String LEFT_SQ_BRACKET = "[";
|
||||
String RIGHT_SQ_BRACKET = "]";
|
||||
String TRUE = "true";
|
||||
String UTF_8 = "UTF-8";
|
||||
String US_ASCII = "US-ASCII";
|
||||
String ISO_8859_1 = "ISO-8859-1";
|
||||
String Y = "y";
|
||||
String YES = "yes";
|
||||
String ONE = "1";
|
||||
String ZERO = "0";
|
||||
String DOLLAR_LEFT_BRACE = "${";
|
||||
String HASH_LEFT_BRACE = "#{";
|
||||
String CRLF = "\r\n";
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.exception;
|
||||
/**
|
||||
* 能谱未包含#Acquisition块
|
||||
*/
|
||||
public class AcquisitionBlockException extends RuntimeException{
|
||||
|
||||
/**
|
||||
* Constructs a new runtime exception with the specified detail message.
|
||||
* The cause is not initialized, and may subsequently be initialized by a
|
||||
* call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for
|
||||
* later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public AcquisitionBlockException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.exception;
|
||||
|
||||
/**
|
||||
* SOH如果不包含此#AirSamplerFlow block,或者解析后info.record_count<=0 || info.start_date.size()<0 || info.start_time.size()<0
|
||||
*/
|
||||
public class AirSamplerFlowException extends RuntimeException{
|
||||
|
||||
/**
|
||||
* Constructs a new runtime exception with the specified detail message.
|
||||
* The cause is not initialized, and may subsequently be initialized by a
|
||||
* call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for
|
||||
* later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public AirSamplerFlowException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.exception;
|
||||
|
||||
public class FileRepeatException extends RuntimeException{
|
||||
|
||||
/**
|
||||
* Constructs a new runtime exception with the specified detail message.
|
||||
* The cause is not initialized, and may subsequently be initialized by a
|
||||
* call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for
|
||||
* later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public FileRepeatException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.modules.exception;
|
||||
|
||||
/**
|
||||
* 能谱未包含#Header块
|
||||
*/
|
||||
public class HeaderBlockException extends RuntimeException{
|
||||
|
||||
/**
|
||||
* Constructs a new runtime exception with the specified detail message.
|
||||
* The cause is not initialized, and may subsequently be initialized by a
|
||||
* call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for
|
||||
* later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public HeaderBlockException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
package org.jeecg.modules.native_jni;
|
||||
|
||||
import org.jeecg.modules.native_jni.struct.AlertSpectrumStruct;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.native_jni.struct.MetSpectrumStruct;
|
||||
import org.jeecg.modules.native_jni.struct.SOHSpectrumStruct;
|
||||
import org.jeecg.modules.native_jni.struct.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -39,4 +36,13 @@ public class EnergySpectrumHandler {
|
|||
* @return 能谱原始数据
|
||||
*/
|
||||
public static native MetSpectrumStruct getMetSourceData(String path);
|
||||
|
||||
/**
|
||||
* BetaGamma 分析算法
|
||||
* @param sampleFile 样品谱文件
|
||||
* @param gasFile 气体谱文件
|
||||
* @param detFile 探测器本地谱文件
|
||||
* @return
|
||||
*/
|
||||
public static native BgAnalyseResult bgAnalyse(String sampleFile, String gasFile, String detFile);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package org.jeecg.modules.native_jni.struct;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BgAnalyseResult {
|
||||
/************************** BgMDCPara **************************/
|
||||
/** MDC XE135 */
|
||||
public double MDC_Xe135;
|
||||
/** MDC XE131m */
|
||||
public double MDC_Xe131m;
|
||||
/** MDC XE133m*/
|
||||
public double MDC_Xe133m;
|
||||
/** MDC XE133 */
|
||||
public double MDC_Xe133;
|
||||
public List<Double> MDC;
|
||||
public List<Double> MDC_CTS;
|
||||
|
||||
/************************** BgXeConUncer **************************/
|
||||
/** 135不浓度 */
|
||||
public double Xe135_con;
|
||||
/** 135不确定度 */
|
||||
public double Xe135_uncer;
|
||||
public double Xe131m_con;
|
||||
public double Xe131m_uncer;
|
||||
public double Xe133m_con;
|
||||
public double Xe133m_uncer;
|
||||
public double Xe133_con;
|
||||
public double Xe133_uncer;
|
||||
|
||||
/**
|
||||
* 分析结果标记,true成功,false失败
|
||||
*/
|
||||
public boolean analyse_flag;
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
public String error_log;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
|
||||
public interface GardsSampleDataService extends IService<GardsSampleData> {
|
||||
|
||||
/**
|
||||
* 判断文件是否存在
|
||||
* @param inputFileName
|
||||
* @return
|
||||
*/
|
||||
public boolean fileExist(String inputFileName);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
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.original.GardsSampleData;
|
||||
import org.jeecg.modules.mapper.GardsSampleDataMapper;
|
||||
import org.jeecg.modules.service.GardsSampleDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMapper, GardsSampleData> implements GardsSampleDataService {
|
||||
|
||||
/**
|
||||
* 判断文件是否存在
|
||||
*
|
||||
* @param inputFileName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean fileExist(String inputFileName) {
|
||||
LambdaQueryWrapper<GardsSampleData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsSampleData::getInputFileName,inputFileName);
|
||||
queryWrapper.select(GardsSampleData::getSampleId);
|
||||
final GardsSampleData sampleData = this.getOne(queryWrapper);
|
||||
return Objects.nonNull(sampleData);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.original.GardsAlertData;
|
||||
|
@ -43,7 +44,7 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new HealthStatusSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -105,10 +106,10 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
//获取文件保存路径
|
||||
String fileSavePath = this.getFileSavePath();
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
fileSavePath = properties.getRootPath()+"/"+fileSavePath;
|
||||
fileSavePath = properties.getRootPath()+StringConstant.SLASH+fileSavePath;
|
||||
super.ftpUtil.saveFile(fileSavePath,this.mailFile.getName(),new FileInputStream(this.mailFile));
|
||||
//设置FTP文件保存路径
|
||||
super.ftpSavePath = fileSavePath+"/"+this.mailFile.getName();
|
||||
super.ftpSavePath = fileSavePath+StringConstant.SLASH+this.mailFile.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,9 +123,9 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
StringBuilder ftpPath = new StringBuilder();
|
||||
ftpPath.append(properties.getFilePathMap().get(super.currDataType.getType()));
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(year);
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(month>=10?month:"0"+month);
|
||||
return ftpPath.toString();
|
||||
}
|
||||
|
@ -136,11 +137,11 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
protected void updateSpectrumFileName() {
|
||||
StringBuilder newFileName = new StringBuilder();
|
||||
newFileName.append(this.sourceData.station_code);
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(super.currDataType.getType());
|
||||
newFileName.append("-");
|
||||
newFileName.append(StringUtils.replace(this.sourceData.date,"/",""));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.DASH);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.date,StringConstant.SLASH,""));
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.time,":",""));
|
||||
newFileName.append(super.currDataType.getSuffix());
|
||||
mailFile = FileUtil.rename(mailFile,newFileName.toString(),true);
|
||||
|
@ -164,14 +165,14 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
//组装日志文件内容
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
|
||||
logContent.append("\n\n");
|
||||
logContent.append("ALERT ID: ").append(this.alertData.getAlertId()).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append("/").append(super.ftpSavePath);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("ALERT ID: ").append(this.alertData.getAlertId()).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append(StringConstant.SLASH).append(super.ftpSavePath);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
final String ftpPath = properties.getLogPath()+"/"+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),".log");
|
||||
final String ftpPath = properties.getLogPath()+StringConstant.SLASH+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
super.ftpUtil.saveFile(ftpPath,fileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class DetbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new QcphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ public class DetbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.DETBKPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
|
|
|
@ -16,7 +16,7 @@ public class GasbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new MetSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class GasbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.GASBKPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
|
|
|
@ -2,10 +2,12 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.original.GardsSohData;
|
||||
import org.jeecg.modules.emuns.DataType;
|
||||
import org.jeecg.modules.exception.AirSamplerFlowException;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
import org.jeecg.modules.native_jni.struct.SOHSpectrumStruct;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -43,7 +45,12 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
*/
|
||||
@Override
|
||||
protected void setChina() {
|
||||
}
|
||||
|
||||
protected void checkAirSamplerFlowBlock(){
|
||||
if(this.mailContent.indexOf("#AirSamplerFlow") == -1){
|
||||
throw new AirSamplerFlowException("this is no ariSamplerFlow data");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,6 +93,9 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
if(Objects.isNull(sourceData)){
|
||||
throw new RuntimeException("THE PHDFile has some blocks can't be read:"+this.mailFile.getAbsolutePath());
|
||||
}
|
||||
if(sourceData.af_record_count <= 0 || sourceData.af_start_date.size() < 0 || sourceData.af_start_time.size() < 0){
|
||||
throw new AirSamplerFlowException("ariSamplerFlow data error");
|
||||
}
|
||||
this.sourceData = sourceData;
|
||||
}
|
||||
|
||||
|
@ -115,9 +125,9 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
StringBuilder ftpPath = new StringBuilder();
|
||||
ftpPath.append(properties.getFilePathMap().get(super.currDataType.getType()));
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(year);
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(month>=10?month:"0"+month);
|
||||
return ftpPath.toString();
|
||||
}
|
||||
|
@ -129,11 +139,11 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
protected void updateSpectrumFileName() {
|
||||
StringBuilder newFileName = new StringBuilder();
|
||||
newFileName.append(this.sourceData.station_code);
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(super.currDataType.getType());
|
||||
newFileName.append("-");
|
||||
newFileName.append(StringUtils.replace(this.sourceData.start_date,"/",""));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.DASH);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.start_date,StringConstant.SLASH,""));
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.start_time,":",""));
|
||||
newFileName.append(super.currDataType.getSuffix());
|
||||
mailFile = FileUtil.rename(mailFile,newFileName.toString(),true);
|
||||
|
@ -162,14 +172,14 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
//组装日志文件内容
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
|
||||
logContent.append("\n\n");
|
||||
logContent.append("SOH ID: ").append(sohIdRange).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append("/").append(super.ftpSavePath);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("SOH ID: ").append(sohIdRange).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append(StringConstant.SLASH).append(super.ftpSavePath);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
final String ftpPath = properties.getLogPath()+"/"+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),".log");
|
||||
final String ftpPath = properties.getLogPath()+StringConstant.SLASH+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
super.ftpUtil.saveFile(ftpPath,fileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.original.GardsMetData;
|
||||
|
@ -45,7 +46,7 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new AlertSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -121,9 +122,9 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
StringBuilder ftpPath = new StringBuilder();
|
||||
ftpPath.append(properties.getFilePathMap().get(super.currDataType.getType()));
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(year);
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(month>=10?month:"0"+month);
|
||||
return ftpPath.toString();
|
||||
}
|
||||
|
@ -135,11 +136,11 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
protected void updateSpectrumFileName() {
|
||||
StringBuilder newFileName = new StringBuilder();
|
||||
newFileName.append(this.sourceData.station_code);
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(super.currDataType.getType());
|
||||
newFileName.append("-");
|
||||
newFileName.append(StringUtils.replace(this.sourceData.met_start_date.get(0),"/",""));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.DASH);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.met_start_date.get(0),StringConstant.SLASH,""));
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.met_start_time.get(0),":",""));
|
||||
newFileName.append(super.currDataType.getSuffix());
|
||||
mailFile = FileUtil.rename(mailFile,newFileName.toString(),true);
|
||||
|
@ -168,14 +169,14 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
//组装日志文件内容
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
|
||||
logContent.append("\n\n");
|
||||
logContent.append("Met ID: ").append(metIdRange).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append("/").append(super.ftpSavePath);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Met ID: ").append(metIdRange).append(" StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append(StringConstant.SLASH).append(super.ftpSavePath);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
final String ftpPath = properties.getLogPath()+"/"+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),".log");
|
||||
final String ftpPath = properties.getLogPath()+StringConstant.SLASH+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
super.ftpUtil.saveFile(ftpPath,fileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class QcphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new GasbkphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class QcphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void handler() throws Exception {
|
||||
//判断当前邮件内容是否是QC谱
|
||||
if(DataType.QCPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
|
|
|
@ -4,10 +4,14 @@ import cn.hutool.core.io.FileUtil;
|
|||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.exception.AcquisitionBlockException;
|
||||
import org.jeecg.modules.exception.FileRepeatException;
|
||||
import org.jeecg.modules.exception.HeaderBlockException;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.ISpectrumBlockService;
|
||||
|
@ -46,6 +50,32 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
*/
|
||||
private GardsSampleData sampleData;
|
||||
|
||||
/**
|
||||
* 前置检查
|
||||
*/
|
||||
protected void preCheck() {
|
||||
this.checkHeaderBlock();
|
||||
this.checkAcquisitionBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查此邮件是否包含#Header block
|
||||
*/
|
||||
protected void checkHeaderBlock(){
|
||||
if(this.mailContent.indexOf("#Header") == -1){
|
||||
throw new HeaderBlockException("header data error");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查此邮件是否包含#Acquisition block
|
||||
*/
|
||||
protected void checkAcquisitionBlock(){
|
||||
if(this.mailContent.indexOf("#Acquisition") == -1){
|
||||
throw new AcquisitionBlockException("acquisition data error");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用dll解析邮件
|
||||
*/
|
||||
|
@ -68,10 +98,10 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
//获取文件保存路径
|
||||
String fileSavePath = this.getFileSavePath();
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
fileSavePath = properties.getRootPath()+"/"+fileSavePath;
|
||||
fileSavePath = properties.getRootPath()+StringConstant.SLASH+fileSavePath;
|
||||
super.ftpUtil.saveFile(fileSavePath,this.mailFile.getName(),new FileInputStream(this.mailFile));
|
||||
//设置FTP文件保存路径
|
||||
super.ftpSavePath = fileSavePath+"/"+this.mailFile.getName();
|
||||
super.ftpSavePath = fileSavePath+StringConstant.SLASH+this.mailFile.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,11 +115,11 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
StringBuilder ftpPath = new StringBuilder();
|
||||
ftpPath.append(properties.getFilePathMap().get(this.sourceData.system_type));
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(properties.getFilePathMap().get(this.sourceData.data_type));
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(year);
|
||||
ftpPath.append("/");
|
||||
ftpPath.append(StringConstant.SLASH);
|
||||
ftpPath.append(month>=10?month:"0"+month);
|
||||
return ftpPath.toString();
|
||||
}
|
||||
|
@ -101,15 +131,15 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
protected void updateSpectrumFileName() {
|
||||
StringBuilder newFileName = new StringBuilder();
|
||||
newFileName.append(this.sourceData.detector_code);
|
||||
newFileName.append("-");
|
||||
newFileName.append(StringUtils.replace(this.sourceData.acquisition_start_date,"/",""));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.DASH);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.acquisition_start_date,StringConstant.SLASH,""));
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(StringUtils.replace(this.sourceData.acquisition_start_time.substring(0,this.sourceData.acquisition_start_time.lastIndexOf(":")),":",""));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(this.sourceData.data_type.charAt(0));
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(this.sourceData.spectrum_quantity);
|
||||
newFileName.append("_");
|
||||
newFileName.append(StringConstant.UNDER_LINE);
|
||||
newFileName.append(this.sourceData.acquisition_live_time);
|
||||
newFileName.append(super.currDataType.getSuffix());
|
||||
mailFile = FileUtil.rename(mailFile,newFileName.toString(),true);
|
||||
|
@ -129,12 +159,15 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理原始数据
|
||||
*/
|
||||
@Override
|
||||
protected void handlerOriginalData() throws Exception {
|
||||
final boolean exist = spectrumServiceQuotes.getSampleDataService().fileExist(super.ftpSavePath);
|
||||
if(exist){
|
||||
throw new FileRepeatException("file repeat");
|
||||
}
|
||||
this.startIntoDatabaseTime = new Date();
|
||||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
|
||||
|
@ -172,28 +205,28 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
//组装日志文件内容
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("ApplicationPath:").append(this.getProjectAbsolutePath()).append(",").append("ApplicationName:").append(this.getProjectName()).append(",started by RNAUTO at ").append(this.startIntoDatabaseTime);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Successfully connected to database,source:").append(oraUrl.substring(oraUrl.lastIndexOf(":")+1)).append(",user=").append(oraUsername);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("SourceFile:").append(super.mailFile.getAbsolutePath());
|
||||
logContent.append("\n");
|
||||
logContent.append("StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append("/").append(super.ftpSavePath);
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append(StringConstant.SLASH).append(super.ftpSavePath);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Detector ID:").append(this.sampleData.getDetectorId());
|
||||
logContent.append("\n");
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("Station ID:").append(this.sampleData.getStationId());
|
||||
logContent.append("\n");
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("Sample ID:").append(this.sampleData.getSampleId());
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Instance status successfully set to:").append(this.sampleData.getStatus()).append(".....");
|
||||
logContent.append("\n\n");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
final String ftpPath = properties.getLogPath()+"/"+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),".log");
|
||||
final String ftpPath = properties.getLogPath()+StringConstant.SLASH+this.getFileSavePath();
|
||||
final String fileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
super.ftpUtil.saveFile(ftpPath,fileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new DetbkphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil);
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.util.Objects;
|
|||
public abstract class SpectrumHandler extends Chain{
|
||||
|
||||
private final static String DATA_TYPE_PREFIX = "DATA_TYPE ";
|
||||
|
||||
protected final static String LOG_FILE_SUFFIX = ".log";
|
||||
/**
|
||||
* 当前邮件信息
|
||||
*/
|
||||
|
@ -73,13 +75,14 @@ public abstract class SpectrumHandler extends Chain{
|
|||
* 初始化参数
|
||||
*/
|
||||
protected void initNext(SpectrumServiceQuotes spectrumServiceQuotes,File mailFile,DataType currDataType,
|
||||
Message message,EmailProperties emailProperties,FTPUtils ftpUtil){
|
||||
Message message,EmailProperties emailProperties,FTPUtils ftpUtil,String mailContent){
|
||||
this.spectrumServiceQuotes = spectrumServiceQuotes;
|
||||
this.mailFile = mailFile;
|
||||
this.currDataType = currDataType;
|
||||
this.message = message;
|
||||
this.emailProperties = emailProperties;
|
||||
this.ftpUtil = ftpUtil;
|
||||
this.mailContent = mailContent;
|
||||
this.setChina();
|
||||
}
|
||||
|
||||
|
@ -113,17 +116,20 @@ public abstract class SpectrumHandler extends Chain{
|
|||
*/
|
||||
protected abstract void handlerOriginalData() throws Exception;
|
||||
|
||||
/**
|
||||
* 把流程日志写入ftp日志文件
|
||||
*/
|
||||
protected abstract void saveLogToFtp() throws FileNotFoundException;
|
||||
|
||||
/**
|
||||
* 打印当前能谱类型
|
||||
*/
|
||||
protected void printCurrDataType(){
|
||||
log.info("----------------------------------");
|
||||
log.info(this.currDataType.getType());
|
||||
log.info("----------------------------------");
|
||||
}
|
||||
|
||||
/**
|
||||
* 把流程日志写入ftp日志文件
|
||||
*/
|
||||
protected abstract void saveLogToFtp() throws FileNotFoundException;
|
||||
|
||||
/**
|
||||
* 把邮件内容存储到本地
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.spectrum;
|
|||
import cn.hutool.core.io.FileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.email.EmailServiceManager;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
|
@ -111,6 +112,7 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
} catch (Exception e) {
|
||||
log.error(mailContent.toString());
|
||||
log.error("邮件解析失败,邮件主题为:{},发送时间为:{},接收时间为:{},失败原因为:{}",subject,sendTime,receiveTime,e.getMessage());
|
||||
this.handleErrorLog(e);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
this.taskLatch.countDown();
|
||||
|
@ -156,27 +158,36 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
private void downloadEmailToFtp() throws Exception{
|
||||
//获取发件人
|
||||
final String address = ((InternetAddress) message.getFrom()[0]).getAddress();
|
||||
final String from = address.substring(0,address.indexOf("@"));
|
||||
final String from = address.substring(0,address.indexOf(StringConstant.AT));
|
||||
//获取主题
|
||||
String subject = MimeUtility.decodeText(message.getSubject());
|
||||
if(subject.indexOf("/") != -1){
|
||||
subject = StringUtils.replace(subject,"/","");
|
||||
if(subject.indexOf(StringConstant.SLASH) != -1){
|
||||
subject = StringUtils.replace(subject,StringConstant.SLASH,"");
|
||||
}
|
||||
if(subject.indexOf(":") != -1){
|
||||
subject = StringUtils.replace(subject,":","");
|
||||
if(subject.indexOf(StringConstant.COLON) != -1){
|
||||
subject = StringUtils.replace(subject,StringConstant.COLON,"");
|
||||
}
|
||||
|
||||
StringBuilder fileName = new StringBuilder();
|
||||
fileName.append(from);
|
||||
fileName.append("_");
|
||||
fileName.append(StringConstant.UNDER_LINE);
|
||||
fileName.append(subject);
|
||||
fileName.append("_");
|
||||
fileName.append(StringConstant.UNDER_LINE);
|
||||
fileName.append(DateUtils.formatDate(new Date(),"YYMMdd"));
|
||||
fileName.append("_");
|
||||
fileName.append(StringConstant.UNDER_LINE);
|
||||
fileName.append(DateUtils.formatDate(new Date(),"HHMMSSSSS"));
|
||||
fileName.append("_");
|
||||
fileName.append(StringConstant.UNDER_LINE);
|
||||
fileName.append(emailCounter.getCurrValue());
|
||||
fileName.append(SAVE_EML_SUFFIX);
|
||||
ftpUtil.saveFile(spectrumPathProperties.getEmlPath(),fileName.toString(),message.getInputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理解析报错日志
|
||||
* @param e
|
||||
*/
|
||||
private void handleErrorLog(Exception e){
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,4 +44,6 @@ public class SpectrumServiceQuotes {
|
|||
|
||||
private final OraDataSourceProperties oraDataSourceProperties;
|
||||
|
||||
private final GardsSampleDataService sampleDataService;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StructInsertOutput implements Serializable {
|
||||
|
||||
//-----------------output:------------------
|
||||
|
|
|
@ -61,6 +61,7 @@ public class CalculateDataRateThread implements Runnable{
|
|||
calculateDataRate.setParameter(mRateparam);
|
||||
//根据台站编码 查询 台站信息
|
||||
StationInfo stationInfo = calCulStationDataService.getStationInfo(originalstationsinfo.getStationCode());
|
||||
stationInfo.setUsed(calCulStationDataService.getUsed(Integer.valueOf(stationInfo.getId())));
|
||||
//赋值台站信息
|
||||
calculateDataRate.setMStationId(stationInfo.getId());
|
||||
calculateDataRate.setMStationCode(stationInfo.getStationCode());
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.apache.ibatis.annotations.Param;
|
|||
import org.jeecg.modules.entity.data.ProvisionData;
|
||||
import org.jeecg.modules.entity.data.StationInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CalCulStationInfoMapper {
|
||||
|
||||
StationInfo getStationInfo(@Param("stationCode") String stationCode);
|
||||
|
@ -62,4 +64,6 @@ public interface CalCulStationInfoMapper {
|
|||
|
||||
ProvisionData findSphdMetSohProvisionParticulate(@Param("SPHD_NUM") String SPHD_NUM, @Param("MET_NUM") String MET_NUM, @Param("curDateTime") String curDateTime, @Param("pretime") String pretime, @Param("sphdMetSoh") String sphdMetSoh, @Param("stationId") String stationId);
|
||||
|
||||
List<Integer> getUsed(Integer stationId);
|
||||
|
||||
}
|
||||
|
|
|
@ -395,4 +395,8 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getUsed" resultType="java.lang.Integer">
|
||||
SELECT DETECTOR_ID FROM CONFIGURATION.GARDS_DETECTORS WHERE STATION_ID = #{stationId} AND STATUS = 'Operating'
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -61,4 +61,6 @@ public interface ICalCulStationDataService {
|
|||
|
||||
ProvisionData findSphdMetSohProvisionParticulate(String SPHD_NUM, String MET_NUM, String curDateTime, String pretime, String sphdMetSoh,String stationId);
|
||||
|
||||
String getUsed(Integer stationId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.jeecg.modules.entity.data.ProvisionData;
|
||||
import org.jeecg.modules.entity.data.StationInfo;
|
||||
import org.jeecg.modules.mapper.CalCulStationInfoMapper;
|
||||
import org.jeecg.modules.service.ICalCulStationDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("calCulStationDataService")
|
||||
@DS("ora")
|
||||
|
@ -440,5 +446,13 @@ public class CalCulStationInfoServiceImpl implements ICalCulStationDataService {
|
|||
return sphdMetSohProvision;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public String getUsed(Integer stationId){
|
||||
List<Integer> detectorIds = calCulStationInfoMapper.getUsed(stationId);
|
||||
String result = CollectionUtils.isNotEmpty(detectorIds) ? "YES" : "NO";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user