Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
ad6fdb06ed
|
@ -1,12 +1,11 @@
|
||||||
package org.jeecg.common.email;
|
package org.jeecg.common.email;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
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;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -44,11 +43,6 @@ public class EmailLogManager {
|
||||||
@Setter
|
@Setter
|
||||||
private EmailLogEvent getAllIdLogEvent = null;
|
private EmailLogEvent getAllIdLogEvent = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 完成解析邮件流程的线程id集合
|
|
||||||
*/
|
|
||||||
private LinkedList<Long> completeThreadIds = new LinkedList<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 线程邮件日志队列
|
* 线程邮件日志队列
|
||||||
*/
|
*/
|
||||||
|
@ -64,9 +58,6 @@ public class EmailLogManager {
|
||||||
|
|
||||||
public EmailLogManager(SpectrumPathProperties spectrumPathProperties) {
|
public EmailLogManager(SpectrumPathProperties spectrumPathProperties) {
|
||||||
this.spectrumPathProperties = spectrumPathProperties;
|
this.spectrumPathProperties = spectrumPathProperties;
|
||||||
EmailLogExecThread logExecThread = new EmailLogExecThread();
|
|
||||||
logExecThread.setName("email-get-exec-thread");
|
|
||||||
logExecThread.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,13 +73,9 @@ public class EmailLogManager {
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
public void offer(Long threadId,EmailLogEvent event){
|
public void offer(Long threadId,EmailLogEvent event){
|
||||||
synchronized (completeThreadIds){
|
synchronized (queue){
|
||||||
if(queue.containsKey(threadId)){
|
if(queue.containsKey(threadId)){
|
||||||
queue.get(threadId).offer(event);
|
queue.get(threadId).offer(event);
|
||||||
if(EmailLogManager.DONE.equals(event.getLogProcess())){
|
|
||||||
completeThreadIds.offer(threadId);
|
|
||||||
completeThreadIds.notify();
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
LinkedList<EmailLogEvent> logEventList = new LinkedList<>();
|
LinkedList<EmailLogEvent> logEventList = new LinkedList<>();
|
||||||
logEventList.offer(event);
|
logEventList.offer(event);
|
||||||
|
@ -97,61 +84,39 @@ public class EmailLogManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空队列日志
|
||||||
|
*/
|
||||||
|
public void clear(){
|
||||||
|
synchronized (queue){
|
||||||
|
this.setConnectLogEvent(null);
|
||||||
|
this.setGetAllIdLogEvent(null);
|
||||||
|
this.queue.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取日志事件
|
* 获取日志事件
|
||||||
* @return
|
* @return
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public LinkedList<EmailLogEvent> take(Long threadId) throws InterruptedException {
|
public void writeLog(Long threadId){
|
||||||
synchronized (completeThreadIds){
|
synchronized (queue){
|
||||||
final LinkedList<EmailLogEvent> logEventList = queue.remove(threadId);
|
if(queue.containsKey(threadId)){
|
||||||
return logEventList;
|
final LinkedList<EmailLogEvent> logEventList = queue.remove(threadId);
|
||||||
}
|
if(!CollectionUtils.isEmpty(logEventList)){
|
||||||
}
|
if(Objects.nonNull(getAllIdLogEvent)){
|
||||||
|
logEventList.addFirst(getAllIdLogEvent);
|
||||||
/**
|
|
||||||
* 获取解析邮件完成的线程id
|
|
||||||
* @return
|
|
||||||
* @throws InterruptedException
|
|
||||||
*/
|
|
||||||
public Long getCompleteThreadId() throws InterruptedException {
|
|
||||||
synchronized (completeThreadIds){
|
|
||||||
if(completeThreadIds.isEmpty()){
|
|
||||||
completeThreadIds.wait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final Long threadId = completeThreadIds.removeFirst();
|
|
||||||
return threadId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 邮件日志执行线程
|
|
||||||
*/
|
|
||||||
private class EmailLogExecThread extends Thread{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for(;;){
|
|
||||||
try {
|
|
||||||
final Long threadId = EmailLogManager.getInstance().getCompleteThreadId();
|
|
||||||
if(Objects.nonNull(threadId)){
|
|
||||||
final LinkedList<EmailLogEvent> logEventList = EmailLogManager.getInstance().take(threadId);
|
|
||||||
if(Objects.nonNull(getAllIdLogEvent)){
|
|
||||||
logEventList.addFirst(getAllIdLogEvent);
|
|
||||||
}
|
|
||||||
if(Objects.nonNull(connectLogEvent)){
|
|
||||||
logEventList.addFirst(connectLogEvent);
|
|
||||||
}
|
|
||||||
List<String> logContentList = new ArrayList<>();
|
|
||||||
logEventList.forEach(logEvent->{
|
|
||||||
final String logContent = getLogContent(logEvent);
|
|
||||||
logContentList.add(logContent);
|
|
||||||
});
|
|
||||||
writeLog(GS_TYPE_GET,logContentList);
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
if(Objects.nonNull(connectLogEvent)){
|
||||||
e.printStackTrace();
|
logEventList.addFirst(connectLogEvent);
|
||||||
|
}
|
||||||
|
List<String> logContentList = new ArrayList<>();
|
||||||
|
logEventList.forEach(logEvent->{
|
||||||
|
final String logContent = this.getLogContent(logEvent);
|
||||||
|
logContentList.add(logContent);
|
||||||
|
});
|
||||||
|
this.write(GS_TYPE_GET,logContentList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +304,7 @@ public class EmailLogManager {
|
||||||
/**
|
/**
|
||||||
* 把日志写入文件
|
* 把日志写入文件
|
||||||
*/
|
*/
|
||||||
private void writeLog(String gsType, List<String> logContentList){
|
private void write(String gsType, List<String> logContentList){
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
StringBuilder logFilePath = new StringBuilder();
|
StringBuilder logFilePath = new StringBuilder();
|
||||||
logFilePath.append(spectrumPathProperties.getRootPath());
|
logFilePath.append(spectrumPathProperties.getRootPath());
|
||||||
|
|
|
@ -223,6 +223,7 @@ public class EmailServiceManager {
|
||||||
// props.put("mail.imap.starttls.enable", "true");
|
// props.put("mail.imap.starttls.enable", "true");
|
||||||
|
|
||||||
Session session = Session.getInstance(props, new Authenticator() {
|
Session session = Session.getInstance(props, new Authenticator() {
|
||||||
|
@Override
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(username, password);
|
return new PasswordAuthentication(username, password);
|
||||||
}
|
}
|
||||||
|
@ -286,6 +287,7 @@ public class EmailServiceManager {
|
||||||
// props.put("mail.smtp.starttls.enable", "true");
|
// props.put("mail.smtp.starttls.enable", "true");
|
||||||
|
|
||||||
Session session = Session.getInstance(props, new Authenticator() {
|
Session session = Session.getInstance(props, new Authenticator() {
|
||||||
|
@Override
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(username, password);
|
return new PasswordAuthentication(username, password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,8 @@ public class EmailParsingActuator extends Thread{
|
||||||
}catch (InterruptedException e) {
|
}catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}finally {
|
}finally {
|
||||||
//每批次连接关闭后清空邮箱全局日志
|
//清除本批次日志缓存
|
||||||
EmailLogManager.getInstance().setConnectLogEvent(null);
|
EmailLogManager.getInstance().clear();
|
||||||
EmailLogManager.getInstance().setGetAllIdLogEvent(null);
|
|
||||||
//关闭资源
|
//关闭资源
|
||||||
emailServiceManager.close();
|
emailServiceManager.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,12 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
|
||||||
storageLog.append(System.lineSeparator()).append(System.lineSeparator());
|
storageLog.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
storageLog.append(rowFormat(INSTANCE_STATUS,spectrumHandler.status));
|
storageLog.append(rowFormat(INSTANCE_STATUS,spectrumHandler.status));
|
||||||
storageLog.append(System.lineSeparator()).append(System.lineSeparator());
|
storageLog.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
storageLog.append(titleFormat(WRITE_INTO_SUCCESS,19,StringConstant.DASH,endIntoDatabaseTime,StringConstant.DASH));
|
//判断是否有文件重复 或 gas,det文件不存在的情况 或 分析数据存储失败
|
||||||
|
if (fileRepeat || fileNotExist || analysisDataStoreFlag) {
|
||||||
|
storageLog.append(titleFormat(WRITE_INTO_ERROR,19,StringConstant.DASH,endIntoDatabaseTime,StringConstant.DASH));
|
||||||
|
} else {
|
||||||
|
storageLog.append(titleFormat(WRITE_INTO_SUCCESS,19,StringConstant.DASH,endIntoDatabaseTime,StringConstant.DASH));
|
||||||
|
}
|
||||||
storageLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
|
storageLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,8 +176,8 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
|
||||||
this.NCC_analysis();
|
this.NCC_analysis();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(analysisDataStoreFlag == true){
|
if(fileRepeat || fileNotExist || analysisDataStoreFlag){
|
||||||
storeFlag = "error";
|
storeFlag = "Error";
|
||||||
}
|
}
|
||||||
analysisLog.append(rowFormat(storeResult,storeFlag));
|
analysisLog.append(rowFormat(storeResult,storeFlag));
|
||||||
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
|
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
|
|
@ -23,7 +23,9 @@ import org.jeecg.modules.base.bizVo.AttributeItemVo;
|
||||||
import org.jeecg.modules.base.dto.*;
|
import org.jeecg.modules.base.dto.*;
|
||||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||||
import org.jeecg.modules.base.entity.rnauto.*;
|
import org.jeecg.modules.base.entity.rnauto.*;
|
||||||
|
import org.jeecg.modules.base.enums.DSType;
|
||||||
import org.jeecg.modules.base.enums.MiddleDataType;
|
import org.jeecg.modules.base.enums.MiddleDataType;
|
||||||
|
import org.jeecg.modules.base.enums.SpectrumType;
|
||||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.exception.GAnalyseException;
|
import org.jeecg.modules.exception.GAnalyseException;
|
||||||
|
@ -34,8 +36,14 @@ import org.springframework.transaction.TransactionStatus;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.jeecg.modules.service.BlockConstant.XE_131m;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Sample_G_Analysis {
|
public class Sample_G_Analysis {
|
||||||
|
@ -169,6 +177,9 @@ public class Sample_G_Analysis {
|
||||||
File.separator + reportName;
|
File.separator + reportName;
|
||||||
// 保存文件
|
// 保存文件
|
||||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||||
|
//发送数据到redis
|
||||||
|
middleData.setSample_id(String.valueOf(sampleId));
|
||||||
|
pushToRedis(middleData);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("Sample_G_Analysis", e);
|
log.error("Sample_G_Analysis", e);
|
||||||
|
@ -185,6 +196,32 @@ public class Sample_G_Analysis {
|
||||||
log.info("Gamma自动处理分析--End");
|
log.info("Gamma自动处理分析--End");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析成功数据发送到Redis
|
||||||
|
*/
|
||||||
|
private void pushToRedis(GStoreMiddleProcessData middleData){
|
||||||
|
try {
|
||||||
|
Info info = new Info();
|
||||||
|
info.setStationId(this.sampleData.getStationId().toString());
|
||||||
|
info.setSampleId(middleData.sample_id);
|
||||||
|
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1));
|
||||||
|
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
|
||||||
|
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
info.setCollectionDate(collectTime);
|
||||||
|
info.setDatasource(DSType.ARMDARR.getType());
|
||||||
|
info.setFullOrPrel(this.sampleData.getSpectralQualifie());
|
||||||
|
info.setBetaOrGamma(SpectrumType.GAMMA.getType());
|
||||||
|
Map<String,String> nuclides = Maps.newHashMap();
|
||||||
|
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
|
||||||
|
nuclides.put(middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Concentration.get(i));
|
||||||
|
}
|
||||||
|
info.setNuclides(nuclides);
|
||||||
|
serviceQuotes.getRedisStreamUtil().pushAnalysis(info);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void storageDataToDatabase(GStoreMiddleProcessData middleData, Map<String, QcCheckItem> qcItems){
|
private void storageDataToDatabase(GStoreMiddleProcessData middleData, Map<String, QcCheckItem> qcItems){
|
||||||
//如果数据已经存储,不在重复存储
|
//如果数据已经存储,不在重复存储
|
||||||
final Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
final Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
||||||
|
@ -226,6 +263,7 @@ public class Sample_G_Analysis {
|
||||||
DataSourceSwitcher.clearDataSource();
|
DataSourceSwitcher.clearDataSource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成日志文件
|
* 生成日志文件
|
||||||
* @param logFilePath
|
* @param logFilePath
|
||||||
|
|
|
@ -87,13 +87,19 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
log.warn("This email {} parsing failed and is not listed in the Met, Alert, SOH, Sample, Detbkphd, QC, Gasbkphd spectra.",subject);
|
log.warn("This email {} parsing failed and is not listed in the Met, Alert, SOH, Sample, Detbkphd, QC, Gasbkphd spectra.",subject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emailServiceManager.removeMail(message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
emailServiceManager.removeMail(message);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}finally {
|
}finally {
|
||||||
emailServiceManager.removeMail(message);
|
try {
|
||||||
EmailLogEvent expungeEvent = new EmailLogEvent(EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
EmailLogEvent expungeEvent = new EmailLogEvent(EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
||||||
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),expungeEvent);
|
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),expungeEvent);
|
||||||
this.taskLatch.countDown();
|
|
||||||
|
EmailLogManager.getInstance().writeLog(Thread.currentThread().getId());
|
||||||
|
}finally {
|
||||||
|
this.taskLatch.countDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class BetaDataFile implements Serializable {
|
||||||
|
|
||||||
private String sampleId;
|
private String sampleId;
|
||||||
|
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
private boolean bProcessed;
|
private boolean bProcessed;
|
||||||
|
|
||||||
private boolean saveAnalysisResult;
|
private boolean saveAnalysisResult;
|
||||||
|
@ -225,6 +227,7 @@ public class BetaDataFile implements Serializable {
|
||||||
qcFilePathName = "";
|
qcFilePathName = "";
|
||||||
qcFileName = "";
|
qcFileName = "";
|
||||||
sampleId = "";
|
sampleId = "";
|
||||||
|
stationId = "";
|
||||||
bProcessed = false;
|
bProcessed = false;
|
||||||
saveAnalysisResult = false;
|
saveAnalysisResult = false;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -31,16 +32,14 @@ import org.jeecg.common.system.vo.LoginUser;
|
||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
|
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
|
||||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||||
|
import org.jeecg.modules.base.dto.Info;
|
||||||
import org.jeecg.modules.base.dto.NuclideActMdaDto;
|
import org.jeecg.modules.base.dto.NuclideActMdaDto;
|
||||||
import org.jeecg.modules.base.dto.PeakInfoDto;
|
import org.jeecg.modules.base.dto.PeakInfoDto;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||||
import org.jeecg.modules.base.entity.postgre.SysUser;
|
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||||
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
||||||
import org.jeecg.modules.base.enums.CalName;
|
import org.jeecg.modules.base.enums.*;
|
||||||
import org.jeecg.modules.base.enums.CalType;
|
|
||||||
import org.jeecg.modules.base.enums.ExportTemplate;
|
|
||||||
import org.jeecg.modules.base.enums.RoleType;
|
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.entity.*;
|
import org.jeecg.modules.entity.*;
|
||||||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||||
|
@ -68,7 +67,9 @@ import java.sql.Statement;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -139,6 +140,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
private IGardsQcCheckSpectrumService qcCheckSpectrumService;
|
private IGardsQcCheckSpectrumService qcCheckSpectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
|
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
|
||||||
|
@Autowired
|
||||||
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
|
public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
|
||||||
|
@ -4588,11 +4591,41 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
//更新detial Information
|
//更新detial Information
|
||||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
||||||
map.put("DetailedInformation", detailedInfo);
|
map.put("DetailedInformation", detailedInfo);
|
||||||
|
//发送数据到redis
|
||||||
|
middleData.setSample_stationID(String.valueOf(stationId));
|
||||||
|
middleData.setSample_id(String.valueOf(phd.getId_sample()));
|
||||||
|
pushToRedis(middleData, phd);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析成功数据发送到Redis
|
||||||
|
*/
|
||||||
|
private void pushToRedis(GStoreMiddleProcessData middleData, PHDFile phd){
|
||||||
|
try {
|
||||||
|
Info info = new Info();
|
||||||
|
info.setStationId(middleData.sample_stationID);
|
||||||
|
info.setSampleId(middleData.sample_id);
|
||||||
|
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1));
|
||||||
|
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
|
||||||
|
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
info.setCollectionDate(collectTime);
|
||||||
|
info.setDatasource(DSType.ARMDRRR.getType());
|
||||||
|
info.setFullOrPrel(phd.getHeader().getSpectrum_quantity());
|
||||||
|
info.setBetaOrGamma(SpectrumType.GAMMA.getType());
|
||||||
|
Map<String,String> nuclides = Maps.newHashMap();
|
||||||
|
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
|
||||||
|
nuclides.put(middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Concentration.get(i));
|
||||||
|
}
|
||||||
|
info.setNuclides(nuclides);
|
||||||
|
redisStreamUtil.pushAnalysis(info);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||||
boolean bRet = false;
|
boolean bRet = false;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import io.swagger.models.auth.In;
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
@ -55,7 +56,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -109,6 +112,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
private IGardsSpectrumSpectrumService spectrumService;
|
private IGardsSpectrumSpectrumService spectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsHistogramSpectrumService histogramService;
|
private IGardsHistogramSpectrumService histogramService;
|
||||||
|
@Autowired
|
||||||
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3667,6 +3672,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
//根据台站名称获取台站id
|
//根据台站名称获取台站id
|
||||||
Integer stationId = spectrumAnalysisMapper.getStationId(anlyseResultIn.getStationName());
|
Integer stationId = spectrumAnalysisMapper.getStationId(anlyseResultIn.getStationName());
|
||||||
|
betaDataFile.setStationId(String.valueOf(stationId));
|
||||||
//判断当前分析员当天是否有对应台站的排班任务
|
//判断当前分析员当天是否有对应台站的排班任务
|
||||||
List<String> userStation = userTaskUtil.findUserStation(userName);
|
List<String> userStation = userTaskUtil.findUserStation(userName);
|
||||||
boolean bAnalysisResultWriteAuthority = false;
|
boolean bAnalysisResultWriteAuthority = false;
|
||||||
|
@ -3865,11 +3871,48 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
betaDataFile.setQcSpectrumData(qcData);
|
betaDataFile.setQcSpectrumData(qcData);
|
||||||
map.put("qc", qcData);
|
map.put("qc", qcData);
|
||||||
}
|
}
|
||||||
|
//发送数据到redis
|
||||||
|
pushToRedis(betaDataFile);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析成功数据发送到Redis
|
||||||
|
*/
|
||||||
|
private void pushToRedis(BetaDataFile betaDataFile){
|
||||||
|
try {
|
||||||
|
Info info = new Info();
|
||||||
|
info.setStationId(betaDataFile.getStationId());
|
||||||
|
info.setSampleId(betaDataFile.getSampleId());
|
||||||
|
info.setSampleName(betaDataFile.getSampleFileName());
|
||||||
|
final Instant instant = DateUtils.parseDate(betaDataFile.getSampleStruct().collection_start_date+ StringPool.SPACE+betaDataFile.getSampleStruct().collection_start_time).toInstant();
|
||||||
|
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
info.setCollectionDate(collectTime);
|
||||||
|
info.setDatasource(DSType.ARMDRRR.getType());
|
||||||
|
info.setFullOrPrel(betaDataFile.getSampleStruct().spectrum_quantity);
|
||||||
|
info.setBetaOrGamma(SpectrumType.BETA.getType());
|
||||||
|
Map<String,String> nuclides = Maps.newHashMap();
|
||||||
|
for (int i=0; i< betaDataFile.getXeDataList().size(); i++) {
|
||||||
|
GardsXeResults xeResults = betaDataFile.getXeDataList().get(i);
|
||||||
|
if (xeResults.getNuclideName().equalsIgnoreCase(XeNuclideName.XE_131m.getType())) {
|
||||||
|
nuclides.put(XeNuclideName.XE_131m.getType(), String.valueOf(xeResults.getConc()));
|
||||||
|
} else if (xeResults.getNuclideName().equalsIgnoreCase(XeNuclideName.XE_133.getType())) {
|
||||||
|
nuclides.put(XeNuclideName.XE_133.getType(), String.valueOf(xeResults.getConc()));
|
||||||
|
} else if (xeResults.getNuclideName().equalsIgnoreCase(XeNuclideName.XE_133m.getType())) {
|
||||||
|
nuclides.put(XeNuclideName.XE_133m.getType(), String.valueOf(xeResults.getConc()));
|
||||||
|
} else if (xeResults.getNuclideName().equalsIgnoreCase(XeNuclideName.XE_135.getType())) {
|
||||||
|
nuclides.put(XeNuclideName.XE_135.getType(), String.valueOf(xeResults.getConc()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info.setNuclides(nuclides);
|
||||||
|
redisStreamUtil.pushAnalysis(info);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取需要导出的数据 (saveToHtml|saveToTxt|saveToExcel)
|
* 获取需要导出的数据 (saveToHtml|saveToTxt|saveToExcel)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -43,27 +43,12 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ICacheTimeService cacheTimeService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StationSampleDataMapper stationSampleDataMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StationSohDataMapper stationSohDataMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StationMetDataMapper stationMetDataMapper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysUserFocusStationMapper sysUserFocusStationMapper;
|
private SysUserFocusStationMapper sysUserFocusStationMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StationTypeUtil stationTypeUtil;
|
private StationTypeUtil stationTypeUtil;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CalculateStationData calCulateStationData;
|
|
||||||
|
|
||||||
private final SpatialContext spatialContext = SpatialContext.GEO;
|
private final SpatialContext spatialContext = SpatialContext.GEO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -566,7 +551,11 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
||||||
@Override
|
@Override
|
||||||
public Result getDataProvisionEfficiency() {
|
public Result getDataProvisionEfficiency() {
|
||||||
Map<String, StationInfo> stationInfoMap = (Map<String, StationInfo>) redisUtil.get("dataStationInfoList");
|
Map<String, StationInfo> stationInfoMap = (Map<String, StationInfo>) redisUtil.get("dataStationInfoList");
|
||||||
List<StationInfo> stationInfoList = stationInfoMap.values().stream().filter(Objects::nonNull).collect(Collectors.toList());
|
List<StationInfo> stationInfoList = new LinkedList<>();
|
||||||
|
if (Objects.nonNull(stationInfoMap)) {
|
||||||
|
stationInfoList = stationInfoMap.values().stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
// // 获取所有的台站信息
|
// // 获取所有的台站信息
|
||||||
// HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
|
// HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
|
||||||
// List<Integer> detectorsUsedList = (List<Integer>) redisUtil.get("detectorsUsedList");
|
// List<Integer> detectorsUsedList = (List<Integer>) redisUtil.get("detectorsUsedList");
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
|
||||||
EmailLogManager.init(spectrumPathProperties);
|
EmailLogManager.init(spectrumPathProperties);
|
||||||
//校验存储目录是否存在,不存在则创建,存在无操作
|
//校验存储目录是否存在,不存在则创建,存在无操作
|
||||||
checkStorageDirectory();
|
checkStorageDirectory();
|
||||||
// autoProcessManager.start(systemStartupTime);
|
autoProcessManager.start(systemStartupTime);
|
||||||
undealHandleManager.start();
|
undealHandleManager.start();
|
||||||
fileSourceHandleManager.start();
|
fileSourceHandleManager.start();
|
||||||
// 删除过期的文件
|
// 删除过期的文件
|
||||||
|
|
Loading…
Reference in New Issue
Block a user