Compare commits
No commits in common. "a762d4ababc3ab08cedd65877d9f335ff5105ec6" and "8a6e79aef9b870b0855691322dbe6d807d436c74" have entirely different histories.
a762d4abab
...
8a6e79aef9
|
|
@ -111,7 +111,7 @@ public class EmailServiceManager {
|
||||||
log.info("{}邮件服务连接测试成功",email.getName());
|
log.info("{}邮件服务连接测试成功",email.getName());
|
||||||
flag = true;
|
flag = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("{}邮件服务连接测试失败,请检查邮件服务属性配置是否正确或邮件服务未开启,原因: ",email.getName(),e);
|
log.error("{}邮件服务连接测试失败,请检查邮件服务属性配置是否正确或邮件服务未开启,原因{}",email.getName(),e.getMessage());
|
||||||
}finally {
|
}finally {
|
||||||
try {
|
try {
|
||||||
if(null != socket){
|
if(null != socket){
|
||||||
|
|
@ -127,7 +127,7 @@ public class EmailServiceManager {
|
||||||
/**
|
/**
|
||||||
* 接收邮件
|
* 接收邮件
|
||||||
*/
|
*/
|
||||||
public Message[] receiveMail() throws Exception {
|
public Message[] receiveMail() throws MessagingException {
|
||||||
String status = EmailLogManager.STATUS_SUCCESS;
|
String status = EmailLogManager.STATUS_SUCCESS;
|
||||||
try{
|
try{
|
||||||
//配置邮件服务属性
|
//配置邮件服务属性
|
||||||
|
|
@ -135,8 +135,6 @@ public class EmailServiceManager {
|
||||||
properties.put("mail.store.protocol", "imap");
|
properties.put("mail.store.protocol", "imap");
|
||||||
properties.put("mail.imap.host", email.getEmailServerAddress());
|
properties.put("mail.imap.host", email.getEmailServerAddress());
|
||||||
properties.put("mail.imap.port",email.getPort());
|
properties.put("mail.imap.port",email.getPort());
|
||||||
properties.put("mail.imap.connectiontimeout", "3000");
|
|
||||||
properties.put("mail.imap.timeout", "3000");
|
|
||||||
if (email.getIsQiye() == 1) {
|
if (email.getIsQiye() == 1) {
|
||||||
properties.put("mail.imap.ssl.enable", "true");
|
properties.put("mail.imap.ssl.enable", "true");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -179,7 +177,6 @@ public class EmailServiceManager {
|
||||||
return o1.getReceivedDate().compareTo(o2.getReceivedDate());
|
return o1.getReceivedDate().compareTo(o2.getReceivedDate());
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
@ -189,7 +186,7 @@ public class EmailServiceManager {
|
||||||
return Arrays.copyOfRange(messages,0,this.receiveNum-1);
|
return Arrays.copyOfRange(messages,0,this.receiveNum-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (MessagingException e){
|
||||||
status = EmailLogManager.STATUS_ERROR;
|
status = EmailLogManager.STATUS_ERROR;
|
||||||
log.error("Email connection is abnormal, account is {}, service is {},the reason is {}.",email.getName(),email.getEmailServerAddress(),e.getMessage());
|
log.error("Email connection is abnormal, account is {}, service is {},the reason is {}.",email.getName(),email.getEmailServerAddress(),e.getMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
|
@ -593,7 +590,6 @@ public class EmailServiceManager {
|
||||||
throw new DownloadEmailException(errorMsg);
|
throw new DownloadEmailException(errorMsg);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("",e);
|
log.error("",e);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}finally {
|
}finally {
|
||||||
EmailLogEvent event = new EmailLogEvent(batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,status,EmailLogManager.GETIDEML,subject,DateUtils.formatDate(receivedDate,"yyyy-MM-dd HH:mm:ss:SSS"),
|
EmailLogEvent event = new EmailLogEvent(batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,status,EmailLogManager.GETIDEML,subject,DateUtils.formatDate(receivedDate,"yyyy-MM-dd HH:mm:ss:SSS"),
|
||||||
(Objects.isNull(emlFile)?" ":emlFile.getAbsolutePath()));
|
(Objects.isNull(emlFile)?" ":emlFile.getAbsolutePath()));
|
||||||
|
|
@ -729,11 +725,9 @@ public class EmailServiceManager {
|
||||||
// log.info("EmailServiceManager: Remove Email:{},receiveTime:{}",message.getSubject(), DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss"));
|
// log.info("EmailServiceManager: Remove Email:{},receiveTime:{}",message.getSubject(), DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss"));
|
||||||
} catch (MessagingException | UnsupportedEncodingException e) {
|
} catch (MessagingException | UnsupportedEncodingException e) {
|
||||||
status = EmailLogManager.STATUS_ERROR;
|
status = EmailLogManager.STATUS_ERROR;
|
||||||
log.error("Email deletion failed, the subject of the email is :{}, the reason is :",subject, e);
|
log.error("Email deletion failed, the subject of the email is :{}, the reason is :{}.",subject,e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
}finally {
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
} finally {
|
|
||||||
EmailLogEvent removeEvent = new EmailLogEvent(batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,status,EmailLogManager.DELETEID,subject,DateUtils.formatDate(receivedDate,"yyyy-MM-dd HH:mm:ss:SSS"));
|
EmailLogEvent removeEvent = new EmailLogEvent(batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,status,EmailLogManager.DELETEID,subject,DateUtils.formatDate(receivedDate,"yyyy-MM-dd HH:mm:ss:SSS"));
|
||||||
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),removeEvent);
|
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),removeEvent);
|
||||||
//这里删除和彻底删除一起写入日志,java和C++处理有差异,java是在连接关闭时彻底删除的
|
//这里删除和彻底删除一起写入日志,java和C++处理有差异,java是在连接关闭时彻底删除的
|
||||||
|
|
@ -754,13 +748,13 @@ public class EmailServiceManager {
|
||||||
if(null != store){
|
if(null != store){
|
||||||
store.close();
|
store.close();
|
||||||
}
|
}
|
||||||
log.info("{}: EmailServiceManage资源关闭完成.", Thread.currentThread().getName());
|
log.info("EmailServiceManage资源关闭完成.");
|
||||||
// for(String messageId : messageIds){
|
// for(String messageId : messageIds){
|
||||||
// String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
// String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
||||||
// redisUtil.del(key);
|
// redisUtil.del(key);
|
||||||
// }
|
// }
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
log.error("Email closure failed, email address is: {}, reason is: {}",email.getUsername(),e);
|
log.error("Email closure failed, email address is: {}, reason is: {}",email.getUsername(),e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ package org.jeecg.modules.entity.vo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class GStoreMiddleProcessData implements Serializable {
|
public class GStoreMiddleProcessData implements Serializable {
|
||||||
|
|
@ -418,7 +421,6 @@ public class GStoreMiddleProcessData implements Serializable {
|
||||||
Collection_Station_Comments = "";
|
Collection_Station_Comments = "";
|
||||||
NDC_Analysis_General_Comments = "";
|
NDC_Analysis_General_Comments = "";
|
||||||
setting_specSetup = new SpecSetup();
|
setting_specSetup = new SpecSetup();
|
||||||
mdcInfos = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -41,12 +40,12 @@ public class AutoProcessManager{
|
||||||
/**
|
/**
|
||||||
* 以邮件Id为key,邮件信息为value
|
* 以邮件Id为key,邮件信息为value
|
||||||
*/
|
*/
|
||||||
private Map<String,EmailProperties> emailMap = new ConcurrentHashMap<>();
|
private Map<String,EmailProperties> emailMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 以邮件id为key,以邮件执行线程为value
|
* 以邮件id为key,以邮件执行线程为value
|
||||||
*/
|
*/
|
||||||
private Map<String,EmailParsingActuator> emailExecThreadMap = new ConcurrentHashMap<>();
|
private Map<String,EmailParsingActuator> emailExecThreadMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动自动处理
|
* 启动自动处理
|
||||||
|
|
@ -83,39 +82,34 @@ public class AutoProcessManager{
|
||||||
public void run() {
|
public void run() {
|
||||||
for(;;){
|
for(;;){
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
try {
|
if(!CollectionUtils.isEmpty(emailMap)){
|
||||||
if(!CollectionUtils.isEmpty(emailMap)){
|
synchronized (lock){
|
||||||
synchronized (lock){
|
Iterator<EmailProperties> iterator = emailMap.values().iterator();
|
||||||
Iterator<EmailProperties> iterator = emailMap.values().iterator();
|
while(iterator.hasNext()){
|
||||||
while(iterator.hasNext()){
|
EmailProperties next = iterator.next();
|
||||||
EmailProperties next = iterator.next();
|
if (next.isResetFlag()) {
|
||||||
if (next.isResetFlag()) {
|
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
||||||
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
actuator.updateEmail(next);
|
||||||
actuator.updateEmail(next);
|
next.setResetFlag(false);
|
||||||
next.setResetFlag(false);
|
}
|
||||||
}
|
if(next.isNewEmailFlag()){
|
||||||
if(next.isNewEmailFlag()){
|
// 网络正常之后才允许创建新的实例
|
||||||
// 网络正常之后才允许创建新的实例
|
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
||||||
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
emailServiceManager.init(next);
|
||||||
emailServiceManager.init(next);
|
boolean testFlag = emailServiceManager.testConnectEmailServer();
|
||||||
boolean testFlag = emailServiceManager.testConnectEmailServer();
|
if(testFlag){
|
||||||
if(testFlag){
|
EmailParsingActuator emailParsingActuator = new EmailParsingActuator();
|
||||||
EmailParsingActuator emailParsingActuator = new EmailParsingActuator();
|
emailParsingActuator.init(next,spectrumServiceQuotes,emailCounter,systemStartupTime);
|
||||||
emailParsingActuator.init(next,spectrumServiceQuotes,emailCounter,systemStartupTime);
|
emailParsingActuator.setName(next.getUsername()+"-email-monitor");
|
||||||
emailParsingActuator.setName(next.getUsername()+"-email-monitor");
|
emailParsingActuator.start();
|
||||||
emailParsingActuator.start();
|
//把邮件监测执行线程加入管理队列
|
||||||
//把邮件监测执行线程加入管理队列
|
emailExecThreadMap.put(next.getId(),emailParsingActuator);
|
||||||
emailExecThreadMap.put(next.getId(),emailParsingActuator);
|
//新邮件监测监测线程已启动则修改新邮件标记为false
|
||||||
//新邮件监测监测线程已启动则修改新邮件标记为false
|
next.setNewEmailFlag(false);
|
||||||
next.setNewEmailFlag(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
|
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
|
||||||
|
|
@ -126,7 +120,6 @@ public class AutoProcessManager{
|
||||||
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +169,6 @@ public class AutoProcessManager{
|
||||||
//捕获异常不处理保障线程异常不退出
|
//捕获异常不处理保障线程异常不退出
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start);
|
long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start);
|
||||||
|
|
@ -186,7 +178,6 @@ public class AutoProcessManager{
|
||||||
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +251,6 @@ public class AutoProcessManager{
|
||||||
//捕获异常不处理保障线程异常不退出
|
//捕获异常不处理保障线程异常不退出
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
|
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
|
||||||
|
|
@ -270,7 +260,6 @@ public class AutoProcessManager{
|
||||||
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -288,52 +277,45 @@ public class AutoProcessManager{
|
||||||
public void run() {
|
public void run() {
|
||||||
for(;;){
|
for(;;){
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
try {
|
if(!CollectionUtils.isEmpty(emailExecThreadMap)){
|
||||||
if(!CollectionUtils.isEmpty(emailExecThreadMap)){
|
//遍历邮箱执行线程,如果状态为已停止则删除
|
||||||
//遍历邮箱执行线程,如果状态为已停止则删除
|
final Iterator<Map.Entry<String, EmailParsingActuator>> checkStopThreads = emailExecThreadMap.entrySet().iterator();
|
||||||
final Iterator<Map.Entry<String, EmailParsingActuator>> checkStopThreads = emailExecThreadMap.entrySet().iterator();
|
while (checkStopThreads.hasNext()){
|
||||||
while (checkStopThreads.hasNext()){
|
final Map.Entry<String, EmailParsingActuator> next = checkStopThreads.next();
|
||||||
final Map.Entry<String, EmailParsingActuator> next = checkStopThreads.next();
|
if(next.getValue().getState() == State.TERMINATED){
|
||||||
if(next.getValue().getState() == State.TERMINATED){
|
log.info("{}邮箱执行线程已停止,emailExecThreadMap删除此邮箱数据",next.getValue().getEmailProperties().getUsername());
|
||||||
log.info("{}邮箱执行线程已停止,emailExecThreadMap删除此邮箱数据",next.getValue().getEmailProperties().getUsername());
|
checkStopThreads.remove();
|
||||||
checkStopThreads.remove();
|
emailMap.remove(next.getKey());
|
||||||
emailMap.remove(next.getKey());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//遍历邮箱执行线程,如果邮箱执行线程stop属性已被设置为true则关闭资源停止线程
|
||||||
|
final Iterator<Map.Entry<String, EmailParsingActuator>> iterator = emailExecThreadMap.entrySet().iterator();
|
||||||
|
emailExecThreadMap.forEach((emailId,emailExecThread)->{
|
||||||
|
try{
|
||||||
|
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
|
||||||
|
final long nowTime = System.currentTimeMillis();
|
||||||
|
final long setStoptime = emailExecThread.getStopTime().getTime();
|
||||||
|
final long val = nowTime - setStoptime;
|
||||||
|
if(val >= taskProperties.getForceDeletedTime()){
|
||||||
|
log.info("关闭{}邮箱线程内部线程池资源",emailExecThread.getEmailProperties().getUsername());
|
||||||
|
emailExecThread.closeResource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
|
||||||
|
final long nowTime = System.currentTimeMillis();
|
||||||
|
final long setStoptime = emailExecThread.getStopTime().getTime();
|
||||||
|
final long val = nowTime - setStoptime;
|
||||||
|
if(val >= taskProperties.getForceDeletedTime()){
|
||||||
|
log.info("强制停止{}邮箱线程",emailExecThread.getEmailProperties().getUsername());
|
||||||
|
emailExecThread.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
//遍历邮箱执行线程,如果邮箱执行线程stop属性已被设置为true则关闭资源停止线程
|
|
||||||
final Iterator<Map.Entry<String, EmailParsingActuator>> iterator = emailExecThreadMap.entrySet().iterator();
|
|
||||||
emailExecThreadMap.forEach((emailId,emailExecThread)->{
|
|
||||||
try{
|
|
||||||
log.info("当前线程状态:{}", emailExecThread.getState());
|
|
||||||
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
|
|
||||||
final long nowTime = System.currentTimeMillis();
|
|
||||||
final long setStoptime = emailExecThread.getStopTime().getTime();
|
|
||||||
final long val = nowTime - setStoptime;
|
|
||||||
if(val >= taskProperties.getForceDeletedTime()){
|
|
||||||
log.info("关闭{}邮箱线程内部线程池资源",emailExecThread.getEmailProperties().getUsername());
|
|
||||||
emailExecThread.closeResource();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}finally {
|
|
||||||
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
|
|
||||||
final long nowTime = System.currentTimeMillis();
|
|
||||||
final long setStoptime = emailExecThread.getStopTime().getTime();
|
|
||||||
final long val = nowTime - setStoptime;
|
|
||||||
if(val >= taskProperties.getForceDeletedTime()){
|
|
||||||
log.info("强制停止{}邮箱线程",emailExecThread.getEmailProperties().getUsername());
|
|
||||||
emailExecThread.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
long sleepTime = taskProperties.getDeletedMailThreadExecCycle() - (end-start);
|
long sleepTime = taskProperties.getDeletedMailThreadExecCycle() - (end-start);
|
||||||
|
|
@ -343,7 +325,6 @@ public class AutoProcessManager{
|
||||||
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@ public class EmailParsingActuator extends Thread{
|
||||||
List<String> messageIds = new ArrayList<>();
|
List<String> messageIds = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
Message[] messages = emailServiceManager.receiveMail();
|
Message[] messages = emailServiceManager.receiveMail();
|
||||||
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), ArrayUtils.isEmpty(messages) ? 0 : messages.length);
|
|
||||||
if(ArrayUtils.isNotEmpty(messages)){
|
if(ArrayUtils.isNotEmpty(messages)){
|
||||||
|
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), messages.length);
|
||||||
//检验获取的邮件是否在之前删除失败列表中,若在直接调用邮件API删除,并且此次数组里元素也删除
|
//检验获取的邮件是否在之前删除失败列表中,若在直接调用邮件API删除,并且此次数组里元素也删除
|
||||||
for(int i=messages.length-1;i>=0;i--){
|
for(int i=messages.length-1;i>=0;i--){
|
||||||
if (null == messages[i].getHeader("Message-ID")) {
|
if (null == messages[i].getHeader("Message-ID")) {
|
||||||
|
|
@ -119,7 +119,7 @@ public class EmailParsingActuator extends Thread{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("EmailParsingActuator has exception: ", e);
|
log.error("EmailParsingActuator has exception: {}", e.getMessage());
|
||||||
log.info("Mail-Parsing线程池资源关闭...");
|
log.info("Mail-Parsing线程池资源关闭...");
|
||||||
closeResource();
|
closeResource();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
@ -142,8 +142,6 @@ public class EmailParsingActuator extends Thread{
|
||||||
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
TimeUnit.MILLISECONDS.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,15 +152,13 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//输出异常信息
|
|
||||||
log.error("邮件处理异常{},邮件主题:{}:", e, subject);
|
|
||||||
// todo 需要解决其他异常会进入if 删除邮件
|
|
||||||
// 如果不是下载导致的失败 并且 下载成功,则删除下载的邮件对象
|
// 如果不是下载导致的失败 并且 下载成功,则删除下载的邮件对象
|
||||||
if(!(e instanceof DownloadEmailException) && downloadFlag){
|
if(!(e instanceof DownloadEmailException) && downloadFlag){
|
||||||
log.error("Catch Remove Email:"+ subject + StringPool.UNDERSCORE + receiveDate + StringPool.UNDERSCORE);
|
log.error("Catch Remove Email:"+ subject + StringPool.UNDERSCORE + receiveDate + StringPool.UNDERSCORE);
|
||||||
emailServiceManager.removeMail(message,batchesCounter);
|
emailServiceManager.removeMail(message,batchesCounter);
|
||||||
}
|
}
|
||||||
|
//输出异常信息
|
||||||
|
log.error("邮件处理异常{},邮件主题:{}:", e, subject);
|
||||||
}finally {
|
}finally {
|
||||||
try {
|
try {
|
||||||
EmailLogEvent expungeEvent = new EmailLogEvent(this.batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
EmailLogEvent expungeEvent = new EmailLogEvent(this.batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package org.jeecg.common.util;
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
@ -11,6 +11,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.net.ftp.FTP;
|
||||||
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.ejml.simple.SimpleMatrix;
|
import org.ejml.simple.SimpleMatrix;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.properties.ParameterProperties;
|
import org.jeecg.common.properties.ParameterProperties;
|
||||||
|
|
@ -1527,10 +1529,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e){
|
} catch (JsonProcessingException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("AnalyseSpectrum(): {}", e);
|
log.error("AnalyseSpectrum(): {}", e.getMessage());
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("AnalyseSpectrum(): {}", e);
|
log.error("AnalyseSpectrum(): {}", e.getMessage());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3123,10 +3125,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
return strBuffer.toString();
|
return strBuffer.toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("错误文件名称:"+ middleData.analyses_save_filePath+" 错误内容:"+e.getMessage());
|
||||||
log.error("错误文件名称:"+ middleData.analyses_save_filePath+" 错误内容:", e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> DoubleLimit(List data) {
|
public List<String> DoubleLimit(List data) {
|
||||||
|
|
@ -3207,7 +3208,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
public boolean GetMiddleData(PHDFile fileAnlyse, String userName,Map<String, NuclideLines> nucline,GStoreMiddleProcessData middleData, String type, String flag) throws ParseException {
|
public boolean GetMiddleData(PHDFile fileAnlyse, String userName,Map<String, NuclideLines> nucline,GStoreMiddleProcessData middleData, String type, String flag) throws ParseException {
|
||||||
boolean bRet=true;
|
boolean bRet=true;
|
||||||
//标准名称规范化
|
//标准名称规范化
|
||||||
middleData.mdcInfos = ListUtil.toList(fileAnlyse.getMdcInfoMap().values());
|
|
||||||
String dataType = fileAnlyse.getMsgInfo().getData_type();
|
String dataType = fileAnlyse.getMsgInfo().getData_type();
|
||||||
String subDirSavePath = "";
|
String subDirSavePath = "";
|
||||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
||||||
|
|
@ -4156,7 +4156,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CalcNuclideMDA(PHDFile phd, NuclideLines lines, String nucName, List<Integer> vPeakIdx, Double energyTolerance) {
|
public void CalcNuclideMDA(PHDFile phd, NuclideLines lines, String nucName, List<Integer> vPeakIdx) {
|
||||||
if(lines.halflife <= 0) {
|
if(lines.halflife <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -4168,9 +4168,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
List<String> vNuclides = new LinkedList<>(); // 只识别不计算活度/浓度的核素
|
List<String> vNuclides = new LinkedList<>(); // 只识别不计算活度/浓度的核素
|
||||||
ReadSpecialNuclides(mapHalflife, vNuclides);
|
ReadSpecialNuclides(mapHalflife, vNuclides);
|
||||||
|
|
||||||
// double energyWidth = phd.getUsedSetting().getEnergyTolerance();
|
double energyWidth = phd.getUsedSetting().getEnergyTolerance();
|
||||||
// fix:改为使用页面传递的公差 20241114,结果用户插入修改公差之后的核素,mda无法计算到的问题
|
|
||||||
double energyWidth = energyTolerance;
|
|
||||||
List<Double> vEnergy = lines.venergy; // 该核素的所有γ射线能量
|
List<Double> vEnergy = lines.venergy; // 该核素的所有γ射线能量
|
||||||
double maxYield = 0;
|
double maxYield = 0;
|
||||||
int mainPeakIdx = -1; // 记录核素主γ峰的索引下标
|
int mainPeakIdx = -1; // 记录核素主γ峰的索引下标
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ public class GammaController {
|
||||||
@PostMapping("addNuclide")
|
@PostMapping("addNuclide")
|
||||||
@ApiOperation(value = "InteractiveTool页面增加核素信息接口", notes = "InteractiveTool页面增加核素信息接口")
|
@ApiOperation(value = "InteractiveTool页面增加核素信息接口", notes = "InteractiveTool页面增加核素信息接口")
|
||||||
public Result addNuclide(@RequestBody NuclideInfo nuclideInfo, HttpServletRequest request) {
|
public Result addNuclide(@RequestBody NuclideInfo nuclideInfo, HttpServletRequest request) {
|
||||||
return gammaService.addNuclide(nuclideInfo.getCurRow(), nuclideInfo.getNuclideName(), nuclideInfo.getFileName(),
|
return gammaService.addNuclide(nuclideInfo.getCurRow(), nuclideInfo.getNuclideName(), nuclideInfo.getFileName(), nuclideInfo.getList_identify(), request);
|
||||||
nuclideInfo.getList_identify(), nuclideInfo.getEnergyTolerance(), request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("deleteNuclide")
|
@PostMapping("deleteNuclide")
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,4 @@ public class NuclideInfo implements Serializable {
|
||||||
|
|
||||||
private List<String> list_identify;
|
private List<String> list_identify;
|
||||||
|
|
||||||
private Double energyTolerance;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ public interface IGammaService{
|
||||||
|
|
||||||
Result getSelPosNuclide(Integer sampleId, String fileName, int channel, HttpServletRequest request);
|
Result getSelPosNuclide(Integer sampleId, String fileName, int channel, HttpServletRequest request);
|
||||||
|
|
||||||
Result addNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, Double energyTolerance,
|
Result addNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request);
|
||||||
HttpServletRequest request);
|
|
||||||
|
|
||||||
Result deleteNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request);
|
Result deleteNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1663,8 +1663,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result addNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify,
|
public Result addNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request) {
|
||||||
Double energyTolerance, HttpServletRequest request) {
|
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
|
@ -1709,7 +1708,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
t_idx++;
|
t_idx++;
|
||||||
}
|
}
|
||||||
//重新计算核素的MDA值
|
//重新计算核素的MDA值
|
||||||
gammaFileUtil.CalcNuclideMDA(phd, it_line, nuclideName, vPeakIdx, energyTolerance);
|
gammaFileUtil.CalcNuclideMDA(phd, it_line, nuclideName, vPeakIdx);
|
||||||
map.put("identify", list_identify);
|
map.put("identify", list_identify);
|
||||||
//格式化核素表单内容
|
//格式化核素表单内容
|
||||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user