Compare commits

..

No commits in common. "9bafcef57bba711f5c3f1d3dc309e67d31354f10" and "d940f1d6e4f67ec51e8a39aa3457dd9bc3f3aba6" have entirely different histories.

15 changed files with 54 additions and 166 deletions

View File

@ -1,13 +1,13 @@
package org.jeecg.common.email;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.smtp.SMTPAddressFailedException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.constant.RedisConstant;
@ -32,6 +32,7 @@ import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
@ -126,7 +127,7 @@ public class EmailServiceManager {
/**
* 接收邮件
*/
public Message[] receiveMail() throws Exception {
public Message[] receiveMail() throws MessagingException {
String status = EmailLogManager.STATUS_SUCCESS;
try{
//配置邮件服务属性
@ -134,8 +135,6 @@ public class EmailServiceManager {
properties.put("mail.store.protocol", "imap");
properties.put("mail.imap.host", email.getEmailServerAddress());
properties.put("mail.imap.port",email.getPort());
properties.put("mail.imap.connectiontimeout", "3000"); // 设置连接超时时间为3秒
properties.put("mail.imap.timeout", "3000"); // 设置读取超时时间为3秒
if (email.getIsQiye() == 1) {
properties.put("mail.imap.ssl.enable", "true");
} else {
@ -178,7 +177,6 @@ public class EmailServiceManager {
return o1.getReceivedDate().compareTo(o2.getReceivedDate());
} catch (MessagingException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
return 0;
});
@ -188,7 +186,7 @@ public class EmailServiceManager {
return Arrays.copyOfRange(messages,0,this.receiveNum-1);
}
}
} catch (Exception e){
} catch (MessagingException e){
status = EmailLogManager.STATUS_ERROR;
log.error("Email connection is abnormal, account is {}, service is {},the reason is {}.",email.getName(),email.getEmailServerAddress(),e.getMessage());
throw e;
@ -729,7 +727,6 @@ public class EmailServiceManager {
status = EmailLogManager.STATUS_ERROR;
log.error("Email deletion failed, the subject of the email is :{}, the reason is :{}.",subject,e.getMessage());
e.printStackTrace();
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"));
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),removeEvent);
@ -751,7 +748,7 @@ public class EmailServiceManager {
if(null != store){
store.close();
}
log.info(Thread.currentThread().getName() + ",EmailServiceManage资源关闭完成.");
log.info("EmailServiceManage资源关闭完成.");
// for(String messageId : messageIds){
// String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
// redisUtil.del(key);
@ -759,7 +756,6 @@ public class EmailServiceManager {
} catch (MessagingException e) {
log.error("Email closure failed, email address is: {}, reason is: {}",email.getUsername(),e.getMessage());
e.printStackTrace();
log.error(e.getMessage(), e);
}
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules;
import cn.hutool.core.util.RandomUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.RedisConstant;
@ -119,7 +120,6 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -169,7 +169,6 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start);
@ -179,7 +178,6 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -237,7 +235,7 @@ public class AutoProcessManager{
if(testFlag){
if (emailExecThreadMap.containsKey(databaseEmail.getId())) {
EmailParsingActuator actuator = emailExecThreadMap.get(databaseEmail.getId());
actuator.setStop(false);
actuator.setThreadSleep(false);
log.info("{}邮箱重新加入监测队列",databaseEmail.getUsername());
} else {
databaseEmail.setNewEmailFlag(true);
@ -253,7 +251,6 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
@ -263,7 +260,6 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -308,7 +304,6 @@ public class AutoProcessManager{
}
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}finally {
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
final long nowTime = System.currentTimeMillis();
@ -330,7 +325,6 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}

View File

@ -86,18 +86,16 @@ public class EmailParsingActuator extends Thread{
List<String> messageIds = new ArrayList<>();
try {
Message[] messages = emailServiceManager.receiveMail();
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), ArrayUtils.isEmpty(messages) ? 0 : messages.length);
if(ArrayUtils.isNotEmpty(messages)){
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), messages.length);
//检验获取的邮件是否在之前删除失败列表中若在直接调用邮件API删除并且此次数组里元素也删除
for(int i=messages.length-1;i>=0;i--){
if (null == messages[i].getHeader("Message-ID")) {
System.out.println("Message ID是空值信息");
messages = ArrayUtils.remove(messages, i);
continue;
}
if (!messages[i].isExpunged()){
String messageId = ((MimeMessage) messages[i]).getMessageID();
System.out.println("正常获取到的Message ID是"+messageId);
final boolean exist = emailServiceManager.check(messages[i],messageId);
messageIds.add(messageId);
if(exist){
@ -124,7 +122,6 @@ public class EmailParsingActuator extends Thread{
log.error("EmailParsingActuator has exception: {}", e.getMessage());
log.info("Mail-Parsing线程池资源关闭...");
closeResource();
log.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
//清除本批次邮件日志缓存
@ -145,8 +142,6 @@ public class EmailParsingActuator extends Thread{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
throw new RuntimeException();
}
}
}

View File

@ -316,7 +316,7 @@ public abstract class AbstractSpectrumHandler extends AbstractChain {
ex.printStackTrace();
}
} else if(SpectrumSource.FROM_FILE_SOURCE.getSourceType().equals(spectrumSource) && (e instanceof FileRepeatException)){
//this.spectrumFile.delete(); // TODO 删除原始谱文件
this.spectrumFile.delete(); // TODO 删除原始谱文件
} else if (SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(spectrumSource) && !(e instanceof FileRepeatException)) {
try {
if (isDateFormatErr) {

View File

@ -41,8 +41,6 @@ public class BetaDataFile implements Serializable {
private String stationId;
private String detectorId;
private boolean bProcessed;
private boolean saveAnalysisResult;

View File

@ -194,10 +194,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!flag) {
return result;
}
if (Objects.nonNull(phd) && !phd.isValid()) {
result.error500("This Spectrum is invalid! it's counts are all zero");
return result;
}
// 加载phd数据所需的lcscacbaseline数据
if (dbName.equals("auto")) {
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
@ -613,10 +609,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!bRet) {
return result;
}
if (Objects.nonNull(phd) && !phd.isValid()) {
result.error500("This Spectrum is invalid! it's counts are all zero");
return result;
}
if (!redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list")) {
//读取缓存的全部核素信息
Map<String, NuclideLines> allNuclideMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");

View File

@ -4419,7 +4419,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
String error = "get station_id or detect_id error";
return false;
}
betaDataFile.setDetectorId(detectorId.toString());
//新增Gards_Sample_Data表数据
sampleDataSpectrumService.saveSampleData(sourceData, stationId, detectorId, filePathName, readLines);
//获取sampleId

View File

@ -1,10 +1,8 @@
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
@ -16,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
import com.google.common.io.Files;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
@ -52,6 +49,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
@Autowired
private RedisUtil redisUtil;
@Autowired
private FTPUtil ftpUtil;
@Autowired
private SpectrumPathProperties pathProperties;
@ -112,9 +112,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
TransactionDefinition txDef = new DefaultTransactionDefinition();
final TransactionStatus txStatus = transactionManager.getTransaction(txDef);
try {
String rootPath = pathProperties.getRootPath();
String savePath = rootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
String logPath = rootPath + pathProperties.getLogPath() + StrUtil.SLASH;
String ftpRootPath = ftpUtil.getFtpRootPath();
String savePath = ftpRootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
String logPath = ftpRootPath + pathProperties.getLogPath() + StrUtil.SLASH;
/* 删除数据库数据 */
// 过滤掉多余的表
String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN";
@ -172,14 +172,16 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
needDel = needDel.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList());
if (CollUtil.isEmpty(needDel))
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
// 删除本地文件
List<String> fails = new ArrayList<>();
// 删除FTP文件
List<String> failList = new ArrayList<>();
for (String path:needDel) {
boolean success = FileUtil.del(path);
if (!success) fails.add(path);
boolean success = ftpUtil.removeFiles(path);
if (!success) {
failList.add(path);
}
if (CollUtil.isNotEmpty(fails))
return Result.error("Data clearing is complete, but file clearing fails!", fails);
}
if (CollUtil.isNotEmpty(failList))
return Result.error("Data clearing is complete, but file clearing fails!", failList);
return Result.OK("Data and file cleanup complete!");
}catch (Exception e){
transactionManager.rollback(txStatus);
@ -224,6 +226,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
Integer sampleId, String owner){
List<String> fileList = new ArrayList<>();
List<AnalysesDto> AnalysesDtoList = baseMapper.getAnalysis(owner, sampleId);
if (CollectionUtils.isNotEmpty(AnalysesDtoList)) {
for (AnalysesDto AnalysesDto:AnalysesDtoList) {
String baselinePath = AnalysesDto.getBaselinePath();
if (StrUtil.isNotBlank(baselinePath)) {
@ -245,6 +248,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
}
}
}
return fileList;
}
}

View File

@ -31,19 +31,7 @@ public class JeecgAbnormalAlarmApplication extends SpringBootServletInitializer
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -53,19 +53,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -27,19 +27,7 @@ public class JeecgLogManageApplication extends SpringBootServletInitializer impl
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgLogManageApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -1,6 +1,5 @@
package org.jeecg;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.cache.BetaCache;
import org.jeecg.common.cache.LocalCache;
@ -10,7 +9,6 @@ import org.jeecg.modules.service.IDataService;
import org.jeecg.modules.service.IGammaService;
import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -42,9 +40,6 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Autowired
private IDataService dataService;
@Value("${isOpen}")
private Boolean isOpen;
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
@ -52,19 +47,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
@ -95,7 +78,6 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
gammaService.readMDCParameter();
nuclLibService.getNuclideMap();
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
if (ObjectUtil.isNotNull(isOpen) && isOpen)
dataService.viewStations();
}
}

View File

@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.ISysUserFocusStationService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -36,19 +35,7 @@ public class JeecgStationOperationApplication extends SpringBootServletInitializ
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgStationOperationApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
//ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -52,18 +52,7 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -26,19 +26,7 @@ public class JeecgWebStatisticsApplication extends SpringBootServletInitializer
}
public static void main(String[] args) throws UnknownHostException {
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");