Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b40646076 | ||
|
|
cf0751109d | ||
|
|
86968e383b | ||
|
|
9fffd2436c | ||
|
|
2407b65a06 | ||
|
|
6c5a0bf546 | ||
|
|
caf47a58d5 | ||
|
|
18b495d1d0 | ||
|
|
6335a3f588 |
|
|
@ -9,6 +9,8 @@ import com.sun.mail.imap.IMAPStore;
|
||||||
import com.sun.mail.smtp.SMTPAddressFailedException;
|
import com.sun.mail.smtp.SMTPAddressFailedException;
|
||||||
import io.swagger.models.auth.In;
|
import io.swagger.models.auth.In;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
|
|
@ -124,7 +126,7 @@ public class EmailServiceManager {
|
||||||
/**
|
/**
|
||||||
* 接收邮件
|
* 接收邮件
|
||||||
*/
|
*/
|
||||||
public Message[] receiveMail() {
|
public Message[] receiveMail() throws MessagingException {
|
||||||
String status = EmailLogManager.STATUS_SUCCESS;
|
String status = EmailLogManager.STATUS_SUCCESS;
|
||||||
try{
|
try{
|
||||||
//配置邮件服务属性
|
//配置邮件服务属性
|
||||||
|
|
@ -186,8 +188,7 @@ public class EmailServiceManager {
|
||||||
} catch (MessagingException 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());
|
||||||
e.printStackTrace();
|
throw e;
|
||||||
return null;
|
|
||||||
} finally {
|
} finally {
|
||||||
EmailLogEvent connectEvent = new EmailLogEvent(EmailLogManager.GS_TYPE_GET,email,status,EmailLogManager.CONNECT);
|
EmailLogEvent connectEvent = new EmailLogEvent(EmailLogManager.GS_TYPE_GET,email,status,EmailLogManager.CONNECT);
|
||||||
EmailLogManager.getInstance().setConnectLogEvent(connectEvent);
|
EmailLogManager.getInstance().setConnectLogEvent(connectEvent);
|
||||||
|
|
@ -532,7 +533,8 @@ public class EmailServiceManager {
|
||||||
File emlFile = null;
|
File emlFile = null;
|
||||||
String status = EmailLogManager.STATUS_SUCCESS;
|
String status = EmailLogManager.STATUS_SUCCESS;
|
||||||
Date receivedDate = null;
|
Date receivedDate = null;
|
||||||
FileOutputStream outputStream = null;
|
InputStream inputStream = null;
|
||||||
|
BufferedOutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
//获取发件人
|
//获取发件人
|
||||||
final String address = ((InternetAddress) message.getFrom()[0]).getAddress();
|
final String address = ((InternetAddress) message.getFrom()[0]).getAddress();
|
||||||
|
|
@ -566,25 +568,19 @@ public class EmailServiceManager {
|
||||||
final String rootPath = spectrumPathProperties.getRootPath();
|
final String rootPath = spectrumPathProperties.getRootPath();
|
||||||
final String emlPath = spectrumPathProperties.getEmlPath();
|
final String emlPath = spectrumPathProperties.getEmlPath();
|
||||||
emlFile = new File(rootPath+emlPath+File.separator+fileName);
|
emlFile = new File(rootPath+emlPath+File.separator+fileName);
|
||||||
outputStream = new FileOutputStream(emlFile);
|
// outputStream = new FileOutputStream(emlFile);
|
||||||
message.writeTo(outputStream);
|
// message.writeTo(outputStream);
|
||||||
|
|
||||||
|
int bufferSize = 1024 * 1024; // 1M
|
||||||
|
inputStream = message.getInputStream();
|
||||||
|
outputStream = new BufferedOutputStream(new FileOutputStream(emlFile), bufferSize);
|
||||||
|
// 从邮件的输入流读取内容,并写入到本地文件
|
||||||
|
byte[] buffer = new byte[bufferSize];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
// int bufferSize = 1024 * 1024; // 1M
|
|
||||||
// InputStream inputStream = message.getInputStream();
|
|
||||||
// BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, bufferSize);
|
|
||||||
// // 或者使用 BufferedOutputStream
|
|
||||||
// OutputStream outputStream = new FileOutputStream(emlFile);
|
|
||||||
// BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream, bufferSize);
|
|
||||||
// // 从邮件的输入流读取内容,并写入到本地文件
|
|
||||||
// byte[] buffer = new byte[bufferSize];
|
|
||||||
// int bytesRead;
|
|
||||||
// while ((bytesRead = bufferedInputStream.read(buffer)) != -1) {
|
|
||||||
// bufferedOutputStream.write(buffer, 0, bytesRead);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 关闭流
|
|
||||||
// bufferedInputStream.close();
|
|
||||||
// bufferedOutputStream.close();
|
|
||||||
} catch (MessagingException | IOException e) {
|
} catch (MessagingException | IOException e) {
|
||||||
// 下载邮件失败 抛出自定义邮件下载异常
|
// 下载邮件失败 抛出自定义邮件下载异常
|
||||||
status = EmailLogManager.STATUS_ERROR;
|
status = EmailLogManager.STATUS_ERROR;
|
||||||
|
|
@ -598,7 +594,11 @@ public class EmailServiceManager {
|
||||||
(Objects.isNull(emlFile)?" ":emlFile.getAbsolutePath()));
|
(Objects.isNull(emlFile)?" ":emlFile.getAbsolutePath()));
|
||||||
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),event);
|
EmailLogManager.getInstance().offer(Thread.currentThread().getId(),event);
|
||||||
try {
|
try {
|
||||||
|
if (Objects.nonNull(inputStream)) {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
if (Objects.nonNull(outputStream)) {
|
if (Objects.nonNull(outputStream)) {
|
||||||
|
outputStream.flush();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -233,10 +233,16 @@ public class AutoProcessManager{
|
||||||
if(databaseEmail.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){
|
if(databaseEmail.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){
|
||||||
final boolean testFlag = testConnectEmailServer(databaseEmail);
|
final boolean testFlag = testConnectEmailServer(databaseEmail);
|
||||||
if(testFlag){
|
if(testFlag){
|
||||||
|
if (emailExecThreadMap.containsKey(databaseEmail.getId())) {
|
||||||
|
EmailParsingActuator actuator = emailExecThreadMap.get(databaseEmail.getId());
|
||||||
|
actuator.setStop(false);
|
||||||
|
log.info("{}邮箱重新加入监测队列",databaseEmail.getUsername());
|
||||||
|
} else {
|
||||||
databaseEmail.setNewEmailFlag(true);
|
databaseEmail.setNewEmailFlag(true);
|
||||||
emailMap.put(databaseEmail.getId(),databaseEmail);
|
|
||||||
log.info("{}邮箱加入监测队列,设置新增标记",databaseEmail.getUsername());
|
log.info("{}邮箱加入监测队列,设置新增标记",databaseEmail.getUsername());
|
||||||
}
|
}
|
||||||
|
emailMap.put(databaseEmail.getId(),databaseEmail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -279,6 +285,7 @@ public class AutoProcessManager{
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,7 @@ import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
|
||||||
import javax.mail.Message;
|
import javax.mail.Message;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,11 +76,17 @@ public class EmailParsingActuator extends Thread{
|
||||||
try {
|
try {
|
||||||
Message[] messages = emailServiceManager.receiveMail();
|
Message[] messages = emailServiceManager.receiveMail();
|
||||||
if(ArrayUtils.isNotEmpty(messages)){
|
if(ArrayUtils.isNotEmpty(messages)){
|
||||||
log.info("EmailParsingActuator本次获取邮件数量为:{}",messages.length);
|
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")) {
|
||||||
|
System.out.println("Message ID是空值信息!!!!!!!");
|
||||||
|
messages = ArrayUtils.remove(messages, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!messages[i].isExpunged()){
|
if (!messages[i].isExpunged()){
|
||||||
String messageId = ((MimeMessage) messages[i]).getMessageID();
|
String messageId = ((MimeMessage) messages[i]).getMessageID();
|
||||||
|
System.out.println("正常获取到的Message ID是:"+messageId);
|
||||||
final boolean exist = emailServiceManager.check(messages[i],messageId);
|
final boolean exist = emailServiceManager.check(messages[i],messageId);
|
||||||
messageIds.add(messageId);
|
messageIds.add(messageId);
|
||||||
if(exist){
|
if(exist){
|
||||||
|
|
@ -105,10 +108,13 @@ public class EmailParsingActuator extends Thread{
|
||||||
taskLatch.await();
|
taskLatch.await();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
|
System.out.println("捕获MessagingException!!!!!!!!");
|
||||||
|
closeResource();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
closeResource();
|
||||||
|
log.error(""+e);
|
||||||
} finally {
|
} finally {
|
||||||
//清除本批次邮件日志缓存
|
//清除本批次邮件日志缓存
|
||||||
EmailLogManager.getInstance().clear();
|
EmailLogManager.getInstance().clear();
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,6 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
String emlName = subject+ StringConstant.UNDER_LINE+ receiveDate;
|
String emlName = subject+ StringConstant.UNDER_LINE+ receiveDate;
|
||||||
String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
||||||
// spectrumServiceQuotes.getRedisUtil().set(key,emlName,expiryTime);
|
// spectrumServiceQuotes.getRedisUtil().set(key,emlName,expiryTime);
|
||||||
//判断当前key的下载次数是否超过限制次数
|
|
||||||
spectrumServiceQuotes.getRedisUtil().incr(key, 1L);
|
|
||||||
spectrumServiceQuotes.getRedisUtil().expire(key, expiryTime);
|
|
||||||
//线程开始初始化时,初始本线程负责的能谱日志事件
|
//线程开始初始化时,初始本线程负责的能谱日志事件
|
||||||
SpectrumLogManager.mailSpectrumLogManager.offer(Thread.currentThread().getId(),null);
|
SpectrumLogManager.mailSpectrumLogManager.offer(Thread.currentThread().getId(),null);
|
||||||
|
|
||||||
|
|
@ -145,6 +142,9 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
}
|
}
|
||||||
emailServiceManager.removeMail(message,batchesCounter);
|
emailServiceManager.removeMail(message,batchesCounter);
|
||||||
} else {
|
} else {
|
||||||
|
//判断当前key的下载次数是否超过限制次数
|
||||||
|
spectrumServiceQuotes.getRedisUtil().incr(key, 1L);
|
||||||
|
spectrumServiceQuotes.getRedisUtil().expire(key, expiryTime);
|
||||||
// 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
|
// 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
|
||||||
if (Objects.nonNull(emlFile) && emlFile.exists()){
|
if (Objects.nonNull(emlFile) && emlFile.exists()){
|
||||||
moveEmail(emlFile, key);
|
moveEmail(emlFile, key);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ public class BetaDataFile implements Serializable {
|
||||||
|
|
||||||
private String stationId;
|
private String stationId;
|
||||||
|
|
||||||
|
private String detectorId;
|
||||||
|
|
||||||
private boolean bProcessed;
|
private boolean bProcessed;
|
||||||
|
|
||||||
private boolean saveAnalysisResult;
|
private boolean saveAnalysisResult;
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (Objects.nonNull(phd) && !phd.isValid()) {
|
||||||
|
result.error500("This Spectrum is invalid! it's counts are all zero");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
// 加载phd数据所需的lc,scac,baseline数据
|
// 加载phd数据所需的lc,scac,baseline数据
|
||||||
if (dbName.equals("auto")) {
|
if (dbName.equals("auto")) {
|
||||||
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
|
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
|
||||||
|
|
@ -609,6 +613,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
return result;
|
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")) {
|
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");
|
Map<String, NuclideLines> allNuclideMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
|
||||||
|
|
|
||||||
|
|
@ -4420,6 +4420,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
String error = "get station_id or detect_id error";
|
String error = "get station_id or detect_id error";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
betaDataFile.setDetectorId(detectorId.toString());
|
||||||
//新增Gards_Sample_Data表数据
|
//新增Gards_Sample_Data表数据
|
||||||
sampleDataSpectrumService.saveSampleData(sourceData, stationId, detectorId, filePathName, readLines);
|
sampleDataSpectrumService.saveSampleData(sourceData, stationId, detectorId, filePathName, readLines);
|
||||||
//获取sampleId
|
//获取sampleId
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
package org.jeecg.modules.quartz.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
|
||||||
import org.jeecg.common.constant.Prompt;
|
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
|
||||||
import org.jeecg.common.util.ImportExcelUtil;
|
|
||||||
import org.jeecg.common.util.RedisStreamUtil;
|
|
||||||
import org.jeecg.modules.base.dto.Info;
|
|
||||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
|
||||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.quartz.Scheduler;
|
|
||||||
import org.quartz.SchedulerException;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("sys/testana")
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "定时任务接口")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisStreamUtil redisStreamUtil;
|
|
||||||
|
|
||||||
@GetMapping("test")
|
|
||||||
public void test(){
|
|
||||||
Info info = new Info();
|
|
||||||
info.setStationId("205");
|
|
||||||
info.setSampleId("425496");
|
|
||||||
info.setBetaOrGamma("Gamma");
|
|
||||||
info.setFullOrPrel("FULL");
|
|
||||||
info.setDatasource("1");
|
|
||||||
info.setSampleName("CAX05_001-20230624_0220_Q_FULL_299.3.PHD");
|
|
||||||
info.setCollectionDate(LocalDateTime.now());
|
|
||||||
Map<String, String> nuclides = MapUtil.newHashMap();
|
|
||||||
nuclides.put("Be7","1000000");
|
|
||||||
nuclides.put("sss","1000000");
|
|
||||||
nuclides.put("Tl208","10");
|
|
||||||
info.setNuclides(nuclides);
|
|
||||||
redisStreamUtil.pushAnalysis(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package org.jeecg.modules.system.service.impl;
|
package org.jeecg.modules.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
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.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
|
@ -13,6 +15,7 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||||
|
import com.google.common.io.Files;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|
@ -47,9 +50,6 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FTPUtil ftpUtil;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpectrumPathProperties pathProperties;
|
private SpectrumPathProperties pathProperties;
|
||||||
|
|
||||||
|
|
@ -110,9 +110,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
||||||
TransactionDefinition txDef = new DefaultTransactionDefinition();
|
TransactionDefinition txDef = new DefaultTransactionDefinition();
|
||||||
final TransactionStatus txStatus = transactionManager.getTransaction(txDef);
|
final TransactionStatus txStatus = transactionManager.getTransaction(txDef);
|
||||||
try {
|
try {
|
||||||
String ftpRootPath = ftpUtil.getFtpRootPath();
|
String rootPath = pathProperties.getRootPath();
|
||||||
String savePath = ftpRootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
|
String savePath = rootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
|
||||||
String logPath = ftpRootPath + pathProperties.getLogPath() + StrUtil.SLASH;
|
String logPath = rootPath + pathProperties.getLogPath() + StrUtil.SLASH;
|
||||||
/* 删除数据库数据 */
|
/* 删除数据库数据 */
|
||||||
// 过滤掉多余的表
|
// 过滤掉多余的表
|
||||||
String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN";
|
String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN";
|
||||||
|
|
@ -170,16 +170,14 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
||||||
needDel = needDel.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
needDel = needDel.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(needDel))
|
if (CollUtil.isEmpty(needDel))
|
||||||
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
|
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
|
||||||
// 删除FTP文件
|
// 删除本地文件
|
||||||
List<String> failList = new ArrayList<>();
|
List<String> fails = new ArrayList<>();
|
||||||
for (String path : needDel) {
|
for (String path : needDel) {
|
||||||
boolean success = ftpUtil.removeFiles(path);
|
boolean success = FileUtil.del(path);
|
||||||
if (!success) {
|
if (!success) fails.add(path);
|
||||||
failList.add(path);
|
|
||||||
}
|
}
|
||||||
}
|
if (CollUtil.isNotEmpty(fails))
|
||||||
if (CollUtil.isNotEmpty(failList))
|
return Result.error("Data clearing is complete, but file clearing fails!", fails);
|
||||||
return Result.error("Data clearing is complete, but file clearing fails!", failList);
|
|
||||||
return Result.OK("Data and file cleanup complete!");
|
return Result.OK("Data and file cleanup complete!");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
transactionManager.rollback(txStatus);
|
transactionManager.rollback(txStatus);
|
||||||
|
|
@ -215,7 +213,6 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
||||||
Integer sampleId, String owner){
|
Integer sampleId, String owner){
|
||||||
List<String> fileList = new ArrayList<>();
|
List<String> fileList = new ArrayList<>();
|
||||||
List<AnalysesDto> AnalysesDtoList = baseMapper.getAnalysis(owner, sampleId);
|
List<AnalysesDto> AnalysesDtoList = baseMapper.getAnalysis(owner, sampleId);
|
||||||
if (CollectionUtils.isNotEmpty(AnalysesDtoList)) {
|
|
||||||
for (AnalysesDto AnalysesDto:AnalysesDtoList) {
|
for (AnalysesDto AnalysesDto:AnalysesDtoList) {
|
||||||
String baselinePath = AnalysesDto.getBaselinePath();
|
String baselinePath = AnalysesDto.getBaselinePath();
|
||||||
if (StrUtil.isNotBlank(baselinePath)) {
|
if (StrUtil.isNotBlank(baselinePath)) {
|
||||||
|
|
@ -237,7 +234,6 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
||||||
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
|
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return fileList;
|
return fileList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,19 @@ public class JeecgAbnormalAlarmApplication extends SpringBootServletInitializer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,19 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,19 @@ public class JeecgLogManageApplication extends SpringBootServletInitializer impl
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg;
|
package org.jeecg;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.cache.BetaCache;
|
import org.jeecg.common.cache.BetaCache;
|
||||||
import org.jeecg.common.cache.LocalCache;
|
import org.jeecg.common.cache.LocalCache;
|
||||||
|
|
@ -9,6 +10,7 @@ import org.jeecg.modules.service.IDataService;
|
||||||
import org.jeecg.modules.service.IGammaService;
|
import org.jeecg.modules.service.IGammaService;
|
||||||
import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService;
|
import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -40,6 +42,9 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDataService dataService;
|
private IDataService dataService;
|
||||||
|
|
||||||
|
@Value("${isOpen}")
|
||||||
|
private Boolean isOpen;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
|
@ -47,7 +52,19 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
@ -78,6 +95,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
gammaService.readMDCParameter();
|
gammaService.readMDCParameter();
|
||||||
nuclLibService.getNuclideMap();
|
nuclLibService.getNuclideMap();
|
||||||
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
|
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
|
||||||
|
if (ObjectUtil.isNotNull(isOpen) && isOpen)
|
||||||
dataService.viewStations();
|
dataService.viewStations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.modules.service.ISysUserFocusStationService;
|
import org.jeecg.modules.service.ISysUserFocusStationService;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.boot.ExitCodeGenerator;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
|
@ -35,7 +36,19 @@ public class JeecgStationOperationApplication extends SpringBootServletInitializ
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,18 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,19 @@ public class JeecgWebStatisticsApplication extends SpringBootServletInitializer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws UnknownHostException {
|
public static void main(String[] args) throws UnknownHostException {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
|
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);
|
||||||
Environment env = application.getEnvironment();
|
Environment env = application.getEnvironment();
|
||||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
String port = env.getProperty("server.port");
|
String port = env.getProperty("server.port");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user