Compare commits

...

86 Commits

Author SHA1 Message Date
xiaoguangbin
ebdf8d863a fix:增加海水系统和自建台站beta的系统类型 2024-06-26 15:42:08 +08:00
xiaoguangbin
80985a74d7 Merge remote-tracking branch 'refs/remotes/origin/SelfStation' into noFtp-seflStation
# Conflicts:
#	jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/DictConstant.java
#	jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java
#	jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/CalculateConcController.java
#	jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/redisStream/AnalysisConsumer.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractSpectrumHandler.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumParsingActuator.java
#	jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java
#	jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java
#	jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java
#	jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumFileServiceImpl.java
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java
2024-06-26 10:43:45 +08:00
xiaoguangbin
0a560452bf Merge remote-tracking branch 'refs/remotes/origin/sleepDownload' into noFtp-seflStation
# Conflicts:
#	jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java
2024-06-26 10:06:41 +08:00
xiaoguangbin
f6b963145f fix:增加catch中exception写入log日志 2024-06-25 11:03:09 +08:00
nieziyan
8b40646076 feat:Application异常结束退出 2024-06-19 16:33:55 +08:00
nieziyan
cf0751109d feat:添加IDC数据源控制访问 2024-06-18 14:52:44 +08:00
nieziyan
64a98bd4ea fix:邮件接收超时时间 2024-06-12 15:33:23 +08:00
nieziyan
f1410028fa fix:不删除saveFile下谱文件 2024-06-06 16:51:24 +08:00
nieziyan
d5dce1c3fc feat:探测器报警信息 2024-06-04 09:52:58 +08:00
nieziyan
e83c1d6199 feat:探测器报警信息 2024-06-04 09:47:58 +08:00
nieziyan
86968e383b fix:删除多余文件 2024-05-13 14:58:41 +08:00
qiaoqinzheng
9fffd2436c 自动处理模块模块同步代码 2024-05-13 14:14:01 +08:00
qiaoqinzheng
2407b65a06 自动处理模块下载邮件代码修改 2024-05-13 14:09:42 +08:00
qiaoqinzheng
6c5a0bf546 人工交互模块BetaDataFile实体类增加detectorId字段用于报警使用 2024-05-13 09:24:25 +08:00
qiaoqinzheng
caf47a58d5 人工交互模块增加判断如果不是正常谱提示异常信息内容 2024-05-10 16:12:26 +08:00
qiaoqinzheng
600c5235ec 自建台站分支同步代码 2024-04-30 11:51:54 +08:00
qiaoqinzheng
3a1567f853 自建台站分支初始化数据返回值关键字改为void 2024-04-26 11:25:27 +08:00
nieziyan
18b495d1d0 Merge remote-tracking branch 'origin/noFtp' into noFtp 2024-04-25 15:05:45 +08:00
nieziyan
6335a3f588 fix:修改FTP为本地文件 2024-04-24 09:34:59 +08:00
nieziyan
d5b18e57b5 fix:增加排序 2024-04-11 14:51:57 +08:00
nieziyan
14e64306b2 Merge remote-tracking branch 'origin/SelfStation' into SelfStation 2024-04-10 19:10:14 +08:00
nieziyan
0c8019ad15 feat:修改是否对文件内容解码逻辑 2024-04-10 19:09:32 +08:00
qiaoqinzheng
d92d55befc 自动处理模块GPS谱流程代码修改 2024-04-10 12:40:14 +08:00
qiaoqinzheng
fc4623e584 自动处理模块GPS谱流程代码修改 2024-04-10 11:31:27 +08:00
qiaoqinzheng
8d3b380837 自动处理模块service配置类增加GPS基础数据相关service实体 2024-04-10 09:13:56 +08:00
nieziyan
eedcd67113 feat:报警编码内容替换 2024-04-09 18:19:37 +08:00
nieziyan
4c16d4527d feat:报警编码信息管理 2024-04-08 18:35:24 +08:00
nieziyan
2d840bcd8b feat:解码Base64邮件内容保存为可处理.eml文件 2024-04-03 16:46:34 +08:00
qiaoqinzheng
5c181d60b1 同步mdc分支代码 2024-03-21 10:29:47 +08:00
qiaoqinzheng
bde5eed237 同步mdc分支代码 2024-03-21 10:28:04 +08:00
qiaoqinzheng
1c34f3dde1 app端代码同步 2024-02-29 10:50:41 +08:00
qiaoqinzheng
8b9882842f 人工交互模块beta存储公式参数问题修改 2024-02-02 17:04:58 +08:00
qiaoqinzheng
19b0366ace 存储谱数据到数据库时,生成的临时日志,报告文件进行删除 2024-02-02 09:31:01 +08:00
qiaoqinzheng
b6bad77274 消息推送OPPO,VIVO增加厂商配置参数 2024-01-31 17:51:11 +08:00
qiaoqinzheng
c892a339e0 增加客户绑定的客户端id去重,避免同一个用户发送多条的情况 2024-01-31 16:00:28 +08:00
qiaoqinzheng
9e8935c9d4 新增推送通知基础配置类MyApiHelper
新增推送通知工具类PushAppUtil
增加在线,离线推送消息相关方法
消息推送根据报警规则组id,获取绑定用户id,根据用户id查询绑定的客户端id推送消息
新增表绑定用户以及客户端信息
app登陆增加新的redisKey存储当前用户名对应的token信息,在别处登陆时清除上一个登陆token退出用户登陆
新增接口用户在app端登陆时,新增或修改当前用户id绑定的客户端id
定时任务增加推送通知工具类声明
分析结果消费者代码增加推送通知工具类
2024-01-31 15:25:15 +08:00
nieziyan
9107cdf13e Merge remote-tracking branch 'origin/SelfStation' into SelfStation 2024-01-30 11:52:16 +08:00
nieziyan
01eb8d22c2 fix:send message 2024-01-30 11:51:34 +08:00
qiaoqinzheng
412d7e74d9 拼接文件路径,在ftp目录路径及ftp文件夹路径间多拼接路径符号问题修改
同步mdc修改
2024-01-29 14:21:21 +08:00
qiaoqinzheng
6a65d9cdd6 上传文件重命名内容修改 2024-01-29 13:41:28 +08:00
nieziyan
7af7fafc86 Merge branch 'mdc' into SelfStation
# Conflicts:
#	jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumServiceQuotes.java
#	jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclLibMapper.java
#	jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java
#	jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java
2024-01-26 17:00:07 +08:00
qiaoqinzheng
dac0736e72 查询统计核素信息接口增加对数据是inf,nan的数据赋值空值处理 2024-01-26 16:48:46 +08:00
qiaoqinzheng
c62b55913a 数据库加载增加判断analysisId条件 2024-01-26 15:27:10 +08:00
qiaoqinzheng
071e9690c6 自建台站新增initValue方法
自建台站新增暂时数据库加载数据方法
2024-01-26 15:21:34 +08:00
qiaoqinzheng
a730178204 新增加GPS谱数据的内容解析及保存 2024-01-26 10:39:59 +08:00
qiaoqinzheng
cf2fe9dd8e 自动处理错误谱文件修改名称方法内容修改 2024-01-26 10:38:55 +08:00
qiaoqinzheng
39348f16f3 自动处理文件名称重命名错误问题修改 2024-01-25 14:15:04 +08:00
qiaoqinzheng
8c5f85b499 查询统计核素方法新增标识判断是否已经存储过当前日期
查询统计核素方法返回内容移除全日期数据
2024-01-24 18:06:02 +08:00
qiaoqinzheng
e3e8a52344 台站运行管理台站接收状态线程台站id数组获取内容修改 2024-01-24 16:45:08 +08:00
qiaoqinzheng
a2ff824fc7 台站运行管理启动时增加查询所有用户最大缓存时间的方法
台站运行管理查询台站的运行状态接口根据用户设置的缓存时间进行结果切割返回
系统启动类新增加缓存台站id及台站id关联的探测器数组方法
台站运行管理数据状态线程向redis缓存过于频繁导致触发redis序列化错误问题修改
2024-01-24 14:12:14 +08:00
qiaoqinzheng
1aa68d4974 采集时间日期截取下标位置错误导致匹配失败问题修改 2024-01-23 19:42:56 +08:00
qiaoqinzheng
a6deb7c53f 新增获取时间范围内年月日小时的方法
统计横坐标根据时间范围内的年月日小时填充数据并回显
2024-01-23 19:24:23 +08:00
qiaoqinzheng
229d1980dd 台站运行管理初始化台站运行状态,台站运行效率新增过滤台站状态条件 2024-01-23 15:33:41 +08:00
qiaoqinzheng
f7677e56e2 同步mdc 2024-01-23 15:13:57 +08:00
qiaoqinzheng
35ac1ebf0c Merge remote-tracking branch 'origin/SelfStation' into SelfStation 2024-01-23 15:03:29 +08:00
qiaoqinzheng
5498e0e433 同步mdc 2024-01-23 15:03:21 +08:00
nieziyan
cc3c056bcf fix:findAutoPage增加参数sampleType 2024-01-23 14:20:45 +08:00
qiaoqinzheng
630bc4ee4f 探测器状态判断改为调用枚举类内容 2024-01-23 09:02:26 +08:00
qiaoqinzheng
d611bf1ff1 人工交互beta,gamma上传文件后删除本地文件操作移除 2024-01-23 08:55:08 +08:00
qiaoqinzheng
49dee87eed 同步mdc 2024-01-22 14:08:37 +08:00
qiaoqinzheng
d8e980fdb2 统计分析导出核素对比统计数据功能实现 2024-01-22 13:47:12 +08:00
qiaoqinzheng
680c263033 人工交互分析gamma部分baseline,lc,scac文件上传到ftp代码实现 2024-01-18 18:58:00 +08:00
qiaoqinzheng
90684089a1 人工交互存储gamma分析结果mdc数据如果已经存在数据需要删除对应的mdc结果后重新插入 2024-01-18 18:37:39 +08:00
qiaoqinzheng
df15a907e9 同步分支mdc 2024-01-18 17:50:52 +08:00
qiaoqinzheng
2f1f658d33 新增动态生成excel内容方法 2024-01-18 17:44:43 +08:00
qiaoqinzheng
b7c0553239 人工交互分析报告存放地址改为Rrr文件夹与Arr区分开 2024-01-18 14:06:19 +08:00
qiaoqinzheng
0d4deaf403 人工交互分析beta日志文件没有创建导致无法上传的问题修改 2024-01-18 11:43:23 +08:00
qiaoqinzheng
e159740d76 人工交互模块增加beta部分日志文件的存在情况判断,上传后的日志文件不进行删除 2024-01-18 10:35:56 +08:00
qiaoqinzheng
82713a8795 自建台站新增实体类存储公用的数据内容
自建台站返回内容增加det相关数据
web模块增加查询系统类型对应的配置核素信息
web模块增加查询系统类型对应的核素统计信息
人工交互模块增加beta部分日志文件的存在情况判断,上传后的日志文件不进行删除
2024-01-18 10:33:07 +08:00
qiaoqinzheng
ee2dd272d1 自建台站折线图ROI范围计算结果取值下标计算公式参数问题修改 2024-01-17 16:24:17 +08:00
qiaoqinzheng
9f8e79226e 台站运行管理查询台站,核设施列表排序问题修改,台站内容放置在核设施前并分别排序 2024-01-17 14:02:09 +08:00
qiaoqinzheng
1452be8f31 MDC分析结果存储改为字符串格式与数据库格式匹配 2024-01-16 19:01:08 +08:00
qiaoqinzheng
e33fc8df83 自建台站修改ROI返回接口改为put请求
自建台站实体类去掉多余参数
2024-01-16 17:08:50 +08:00
qiaoqinzheng
d1de32433e 自建台站已经加载过的数据再次加载页面数据丢失问题修改
人工交互beta保存日志路径,报告路径sql代码
2024-01-16 09:35:30 +08:00
qiaoqinzheng
eb3605d9e8 名称格式化文件增加beta使用的名称格式化方法 2024-01-15 19:32:39 +08:00
qiaoqinzheng
55f9cd49e1 人工交互beta,gamma存储并上传日志,报告文件 2024-01-15 19:30:07 +08:00
qiaoqinzheng
76acc20a7d 新增加自建台站系统类型判断,根据sample文件名称可以通过系统类型查询到关联的det文件类型
新增加查询台站运行轨迹方法
2024-01-15 19:23:43 +08:00
qiaoqinzheng
84d6c4a5a2 自动处理SOH,MET文件存储内容中如果是占位数据-999999存储时数据内容超出精度范围问题修改 2024-01-15 10:44:03 +08:00
qiaoqinzheng
16f59f0273 人工交互,自动处理启动时查询全核素信息方法修改 2024-01-12 15:56:16 +08:00
qiaoqinzheng
63576edde8 探测器新增代码同步 2024-01-11 18:26:12 +08:00
qiaoqinzheng
03955c3691 自建台站散点图G,B横纵坐标取值修改 2024-01-11 09:34:58 +08:00
qiaoqinzheng
8faa97d8f1 gamma分析部分生成报告内容中关于version描述区分颗粒物和气体
增加人工交互,自动处理启动时加载全核素信息方法
人工交互,自动处理启动时加载全核素信息方法调用接口类方法修改
2024-01-11 09:00:48 +08:00
qiaoqinzheng
3c4aae44e0 散点图B,G位置颠倒问题修改 2024-01-10 18:30:24 +08:00
qiaoqinzheng
ee3a04af2f 新增删除自建台站缓存接口 2024-01-10 15:47:15 +08:00
qiaoqinzheng
941c6c0685 ftp路径前多拼接了/导致文件找不到 2024-01-10 15:32:16 +08:00
qiaoqinzheng
cadbdb3ba9 人工交互新增自建台站相关实体类对象
人工交互新增自建台站管理代码
人工交互新增自建台站数据缓存对象
人工交互新增自建台站工具类
2024-01-10 11:40:50 +08:00
52 changed files with 3551 additions and 163 deletions

View File

@ -1,8 +1,6 @@
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;
@ -32,7 +30,6 @@ 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;
@ -127,7 +124,7 @@ public class EmailServiceManager {
/**
* 接收邮件
*/
public Message[] receiveMail() throws MessagingException {
public Message[] receiveMail() throws Exception {
String status = EmailLogManager.STATUS_SUCCESS;
try{
//配置邮件服务属性
@ -135,6 +132,8 @@ 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 {
@ -177,6 +176,7 @@ public class EmailServiceManager {
return o1.getReceivedDate().compareTo(o2.getReceivedDate());
} catch (MessagingException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
return 0;
});
@ -186,7 +186,7 @@ public class EmailServiceManager {
return Arrays.copyOfRange(messages,0,this.receiveNum-1);
}
}
} catch (MessagingException e){
} catch (Exception 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;
@ -727,6 +727,7 @@ 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);
@ -748,7 +749,7 @@ public class EmailServiceManager {
if(null != store){
store.close();
}
log.info("EmailServiceManage资源关闭完成.");
log.info(Thread.currentThread().getName() + ",EmailServiceManage资源关闭完成.");
// for(String messageId : messageIds){
// String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
// redisUtil.del(key);
@ -756,6 +757,7 @@ 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

@ -805,4 +805,51 @@ public class DateUtils extends PropertyEditorSupport {
return days;
}
/**
* 获取开始时间和结束时间之间的全部小时信息
* @param beginDay
* @param endDay
* @return
*/
public static List<String> getAllDayTime(String beginDay, String endDay){
List<String> dayTimes = new ArrayList<>();
try {
//开始日期
Calendar begin = Calendar.getInstance();
begin.setTime(DateUtils.parseDate(beginDay, "yyyy-MM-dd"));
//将开始日期的24个小时放入集合中
for (int i=0; i< 24; i++) {
String dayTime = beginDay;
if (i < 10) {
dayTime+=" 0"+i;
} else {
dayTime+=" "+i;
}
dayTime+=":00:00";
dayTimes.add(dayTime);
}
//结束日期
Calendar end = Calendar.getInstance();
end.setTime(DateUtils.parseDate(endDay, "yyyy-MM-dd"));
//判断 如果结束日期的时间在开始日期的时间之后
while(end.getTime().after(begin.getTime())){
//开始日期需要+1天
begin.add(Calendar.DAY_OF_MONTH, 1);
for (int i=0; i< 24; i++) {
String dayTime = DateUtils.formatDate(begin.getTime(),"yyyy-MM-dd");
if (i < 10) {
dayTime+=" 0"+i;
} else {
dayTime+=" "+i;
}
dayTime+=":00:00";
dayTimes.add(dayTime);
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
return dayTimes;
}
}

View File

@ -0,0 +1,12 @@
package org.jeecg.modules.base.bizVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecg.common.api.QueryRequest;
@Data
public class AlertSystemVo extends QueryRequest {
private String code;
private String content;
}

View File

@ -0,0 +1,35 @@
package org.jeecg.modules.base.entity.configuration;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("CONFIGURATION.GARDS_ALERT_SYSTEM")
public class GardsAlertSystem implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String type;
private String code;
private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
@TableField(exist = false)
private String typeStr;
public GardsAlertSystem(){ moddate = new Date(); }
}

View File

@ -0,0 +1,51 @@
package org.jeecg.modules.base.entity.original;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("ORIGINAL.SAMPLE_WATER_RESULT")
public class SampleWaterResult implements Serializable {
@TableField(value = "SAMPLE_RESULT_ID")
private Integer sampleResultId;
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "NUCLIDE_NAME")
private String nuclideName;
@TableField(value = "ENERGY")
private Double energy;
@TableField(value = "CSC_RATIO")
private Double cscRatio;
@TableField(value = "HALF_LIFE")
private Double halfLife;
@TableField(value = "MDA")
private Double mda;
@TableField(value = "ACTIVITY")
private Double activity;
@TableField(value = "SPEC_ACTIVITY")
private Double specActivity;
@TableField(value = "NID_FLAG")
private Integer nidFlag;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
}

View File

@ -50,7 +50,11 @@ public enum DataType {
*/
GASBKPHD("GASBKPHD",".PHD"),
SPHDP("SPHDP", ".PHD"),
SPHDF("SPHDF", ".PHD");
SPHDF("SPHDF", ".PHD"),
GPS("RMSGPS", ".gps"),
RESULT("HRULT", ".result");
private String type;

View File

@ -13,7 +13,15 @@ public enum SystemType {
/**
* γ
*/
GAMMA("G");
GAMMA("G"),
/**
* 自建台站 β-γ
*/
SELFSTATION("C"),
/**
* 海水系统 γ
*/
WATER("W");
private String type;

View File

@ -0,0 +1,26 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class ResultNuclide implements Serializable {
private String nuclideName;
private Double energy;
private Double cscRatio;
private String halfLife;
private Double mda;
private Double activity;
private Double specActivity;
private String nidFlag;
}

View File

@ -1,6 +1,5 @@
package org.jeecg.modules;
import cn.hutool.core.util.RandomUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.RedisConstant;
@ -120,6 +119,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -169,6 +169,7 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start);
@ -178,6 +179,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -251,6 +253,7 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
@ -260,6 +263,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -304,6 +308,7 @@ 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();
@ -325,6 +330,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}

View File

@ -86,8 +86,8 @@ 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")) {
@ -122,6 +122,7 @@ 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 {
//清除本批次邮件日志缓存
@ -142,6 +143,8 @@ public class EmailParsingActuator extends Thread{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
throw new RuntimeException();
}
}
}

View File

@ -0,0 +1,12 @@
package org.jeecg.modules.exception;
/*
GPS文件读取失败时抛出异常
*/
public class GPSFileReadException extends RuntimeException{
public GPSFileReadException(String message) {
super(message);
}
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.original.GardsGPSData;
public interface GardsGPSDataMapper extends BaseMapper<GardsGPSData> {
}

View File

@ -0,0 +1,13 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.original.GardsGPSData;
import org.jeecg.modules.native_jni.struct.GPSSpectrumStruct;
import java.util.List;
public interface IGardsGPSDataService extends IService<GardsGPSData> {
List<GardsGPSData> create(GPSSpectrumStruct sourceData, String fileName);
}

View File

@ -0,0 +1,72 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsGPSData;
import org.jeecg.modules.exception.StationNotFoundException;
import org.jeecg.modules.mapper.GardsGPSDataMapper;
import org.jeecg.modules.native_jni.struct.GPSSpectrumStruct;
import org.jeecg.modules.service.GardsStationsService;
import org.jeecg.modules.service.IGardsGPSDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsGPSDataServiceImpl extends ServiceImpl<GardsGPSDataMapper, GardsGPSData> implements IGardsGPSDataService {
@Autowired
private GardsStationsService stationsService;
@Override
@Transactional(rollbackFor = Exception.class)
public List<GardsGPSData> create(GPSSpectrumStruct sourceData, String fileName) {
List<GardsGPSData> dataList = new LinkedList<>();
try {
//根据台站编码查询台站id
GardsStations station = stationsService.check(sourceData.stationCode, fileName);
if (Objects.nonNull(station)) {
//遍历时间和经纬度数据
for (int i=0; i<sourceData.recordDateList.size(); i++) {
GardsGPSData data = new GardsGPSData();
data.setStationId(station.getStationId());
data.setStationCode(sourceData.stationCode);
//拼接记录时间
if (StringUtils.isNotBlank(sourceData.recordDateList.get(i)) && StringUtils.isNotBlank(sourceData.recordTimeList.get(i))) {
String recordTimeStr = sourceData.recordDateList.get(i) + StringPool.SPACE + sourceData.recordTimeList.get(i);
data.setRecordTime(DateUtils.parseDate(recordTimeStr));
} else {
data.setRecordTime(null);
}
//时间间隔
data.setTimeSpan(StringUtils.isNotBlank(sourceData.spanTimeList.get(i))?Integer.valueOf(sourceData.spanTimeList.get(i)):0);
//经度
data.setLon(StringUtils.isNotBlank(sourceData.lonList.get(i))?Double.valueOf(sourceData.lonList.get(i)):null);
//纬度
data.setLat(StringUtils.isNotBlank(sourceData.latList.get(i))?Double.valueOf(sourceData.latList.get(i)):null);
dataList.add(data);
}
if (CollectionUtils.isNotEmpty(dataList)) {
this.saveBatch(dataList);
}
}
return dataList;
} catch (StationNotFoundException e) {
throw new RuntimeException(e);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
}

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

@ -0,0 +1,277 @@
package org.jeecg.modules.spectrum;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.commons.io.FileUtils;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.entity.original.GardsGPSData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
import org.jeecg.modules.enums.ErrorType;
import org.jeecg.modules.exception.GPSFileReadException;
import org.jeecg.modules.exception.PHD_ReadException;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.native_jni.struct.GPSSpectrumStruct;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
public class GPSSpectrum extends AbstractSpectrumHandler{
private List<String> lines = null;
private GPSSpectrumStruct sourceData = null;
/**
* 开始存库时间
*/
private Date startIntoDatabaseTime = null;
/**
* 结束存库时间
*/
private Date endIntoDatabaseTime = null;
private List<GardsGPSData> gpsData = null;
/**
* 设置过滤链路
*/
@Override
protected void setChina() {
AbstractSpectrumHandler spectrumHandler = new WaterResultSpectrum();
spectrumHandler.initNext(super.spectrumServiceQuotes,super.spectrumFile,super.sourceFilePath,
super.currDataType,super.mailContent,super.emlFileName,
super.spectrumSource,super.returnFileName, super.batchesCounter);
spectrumHandler.setPrevious(this);
super.setNext(spectrumHandler);
}
/**
* 前置检查
*/
@Override
protected void preCheck() {
this.readFile();
}
protected void readFile() {
//获取文件内容
File gpsFile = new File(super.spectrumFile.getAbsolutePath());
//判断文件是否存在如果不存在抛出phd文件读取异常
if (!gpsFile.exists()) {
throw new GPSFileReadException("This GPS file cannot be found in:"+super.spectrumFile.getAbsolutePath());
}
//文件内容读取
try {
lines = FileUtils.readLines(gpsFile, "UTF-8");
} catch (IOException e) {
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), "This GPS file read content error", super.spectrumFile.getName()));
throw new GPSFileReadException("This GPS file read content error");
}
}
@Override
public void handler() throws Exception {
if(DataType.GPS.getType().equals(super.currDataType.getType())){
try {
//前置检查
this.preCheck();
//打印当前处理的能谱类型
super.printCurrDataType();
//解析邮件内容
this.parseingEmail();
//修改能谱文件名称
this.updateSpectrumFileName();
//保存PHD文件到savefile
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//把流程日志保存到日志目录
this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//异常返回文件名称用于报错日志
super.returnFileName.append(super.spectrumFile.getName());
//处理解析失败的文件
super.handleParseingFailFile(e);
throw e;
}
}
}
/**
* 解析邮件内容
* @throws Exception
*/
@Override
protected void parseingEmail() throws Exception {
this.sourceData = new GPSSpectrumStruct();
//初始下标是0 0不进行读取
int index = 0;
//从第第五行开始遍历文件内容
for (int i=0; i< lines.size(); i++) {
//读取文件行内容
String lineContent = lines.get(i);
//判断当前行是否包含begin 如果包含 从当前行开始向后读取4行
if (lineContent.contains(SampleFileHeader.BEGIN.getMessage())) {
index = i + 4;
}
//切割任意类型空格 获取行内容
List<String> contents = Arrays.asList(lineContent.split("\\s+"));
//固定格式BEGIN 后的第五行的数据是台站编码
if (index > 0 && i == index) {
if (StringUtils.isNotBlank(contents.get(0))) {
this.sourceData.stationCode = contents.get(0);
} else {
this.sourceData.stationCode = "";
}
if (StringUtils.isNotBlank(contents.get(1))) {
this.sourceData.receiveDate = contents.get(1);
} else {
this.sourceData.receiveDate = "";
}
if (StringUtils.isNotBlank(contents.get(2))) {
this.sourceData.receiveTime = contents.get(2);
} else {
this.sourceData.receiveTime = "";
}
} else if (index > 0 && i > index) {
if (!contents.contains(SampleFileHeader.STOP.getMessage()) ) {
if (StringUtils.isNotBlank(contents.get(0))) {
//记录日期
this.sourceData.recordDateList.add(contents.get(0));
} else {
//记录日期
this.sourceData.recordDateList.add("");
}
if (StringUtils.isNotBlank(contents.get(1))) {
//记录时间
this.sourceData.recordTimeList.add(contents.get(1));
} else {
//记录时间
this.sourceData.recordTimeList.add("");
}
if (StringUtils.isNotBlank(contents.get(2))) {
//数据采集间隔持续时间
this.sourceData.spanTimeList.add(contents.get(2));
} else {
//数据采集间隔持续时间
this.sourceData.spanTimeList.add("");
}
if (StringUtils.isNotBlank(contents.get(3))) {
//经度
this.sourceData.lonList.add(contents.get(3));
} else {
//经度
this.sourceData.lonList.add("");
}
if (StringUtils.isNotBlank(contents.get(4))) {
//纬度
this.sourceData.latList.add(contents.get(4));
} else {
//纬度
this.sourceData.latList.add("");
}
}
}
}
}
@Override
protected String getFileSaveRelativePath() {
final int year = LocalDate.now().getYear();
final int month = LocalDate.now().getMonth().getValue();
final SpectrumPathProperties properties = super.spectrumServiceQuotes.getSpectrumPathProperties();
StringBuilder relativePath = new StringBuilder();
relativePath.append(properties.getFilePathMap().get(super.currDataType.getType()));
relativePath.append(File.separator);
relativePath.append(year);
relativePath.append(File.separator);
relativePath.append(month>=10?month:"0"+month);
return relativePath.toString();
}
@Override
protected void updateSpectrumFileName() throws FileNotFoundException {
StringBuilder newFileName = new StringBuilder();
newFileName.append(this.sourceData.stationCode);
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(super.currDataType.getType());
newFileName.append(StringPool.DASH);
newFileName.append(this.sourceData.receiveDate.replace(StringPool.SLASH, ""));
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(this.sourceData.receiveTime.replace(StringPool.COLON, ""));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);
//设置能谱文件保存相对路径包含文件名称
String fileSavePath = this.getFileSaveRelativePath();
this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName();
}
@Override
protected void updateErrorSpectrumFileName() throws FileNotFoundException {
StringBuilder newFileName = new StringBuilder();
newFileName.append(this.sourceData.stationCode);
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(super.currDataType.getType());
newFileName.append(StringPool.DASH);
newFileName.append(this.sourceData.receiveDate.replace(StringPool.SLASH, ""));
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(this.sourceData.receiveTime.replace(StringPool.COLON, ""));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);
}
@Override
protected void handlerOriginalData() throws Exception {
this.startIntoDatabaseTime = new Date();
this.gpsData = spectrumServiceQuotes.getGardsGPSDataService().create(this.sourceData, super.spectrumFileRelativePath);
this.endIntoDatabaseTime = new Date();
}
/**
* 把流程日志保存到日志目录
*/
@Override
protected void saveLogToLogDir() throws IOException {
//获取健康谱记录ID范围
String gpsIdRange = "";
if(!CollectionUtils.isEmpty(this.gpsData)){
gpsIdRange = this.gpsData.get(0).getGpsId()+"-"+this.gpsData.get(this.gpsData.size()-1).getGpsId();
}
//组装日志文件内容
StringBuilder logContent = new StringBuilder();
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("GPS ID: ").append(gpsIdRange).append(" StandardFile:").append(super.spectrumFile.getAbsolutePath());
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getRootPath()+properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+ File.separator+fileName;
super.sendSpectrumLogToQueue(finalPath,logContent.toString());
}
}

View File

@ -48,6 +48,12 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
*/
@Override
protected void setChina() {
AbstractSpectrumHandler spectrumHandler = new GPSSpectrum();
spectrumHandler.initNext(super.spectrumServiceQuotes,super.spectrumFile,super.sourceFilePath,
super.currDataType,super.mailContent,super.emlFileName,
super.spectrumSource,super.returnFileName, super.batchesCounter);
spectrumHandler.setPrevious(this);
super.setNext(spectrumHandler);
}
/**
@ -102,6 +108,8 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
super.handleParseingFailFile(e);
throw e;
}
} else {
super.next.handler();
}
}

View File

@ -85,6 +85,9 @@ public class SpectrumServiceQuotes {
private final RedisUtil redisUtil;
private final MaximumPoolSizeProperties maximumPoolSizeProperties;
private final IGardsGPSDataService gardsGPSDataService;
/**
* 原始库插入数据锁
*/

View File

@ -0,0 +1,219 @@
package org.jeecg.modules.spectrum;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import org.apache.commons.io.FileUtils;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.entity.original.SampleWaterResult;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.eneity.event.FormatErrorEvent;
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
import org.jeecg.modules.exception.GPSFileReadException;
import org.jeecg.modules.file.FileOperation;
import org.jeecg.modules.native_jni.struct.WaterResultStruct;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.time.LocalDate;
import java.util.*;
public class WaterResultSpectrum extends AbstractSpectrumHandler{
private List<String> lines = null;
private WaterResultStruct sourceData = null;
/**
* 开始存库时间
*/
private Date startIntoDatabaseTime = null;
/**
* 结束存库时间
*/
private Date endIntoDatabaseTime = null;
private List<SampleWaterResult> waterResultList = null;
@Override
protected void setChina() {
}
@Override
protected void preCheck() {
this.readFile();
}
protected void readFile() {
//获取文件内容
File resultFile = new File(super.spectrumFile.getAbsolutePath());
//判断文件是否存在如果不存在抛出phd文件读取异常
if (!resultFile.exists()) {
throw new GPSFileReadException("This Result file cannot be found in:"+super.spectrumFile.getAbsolutePath());
}
//文件内容读取
try {
lines = FileUtils.readLines(resultFile, "UTF-8");
} catch (IOException e) {
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), "This Result file read content error", super.spectrumFile.getName()));
throw new GPSFileReadException("This Result file read content error");
}
}
@Override
public void handler() throws Exception {
if(DataType.RESULT.getType().equals(super.currDataType.getType())){
try {
//前置检查
this.preCheck();
//打印当前处理的能谱类型
super.printCurrDataType();
//解析邮件内容
this.parseingEmail();
//修改能谱文件名称
this.updateSpectrumFileName();
//保存PHD文件到savefile
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//把流程日志保存到日志目录
this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//异常返回文件名称用于报错日志
super.returnFileName.append(super.spectrumFile.getName());
//处理解析失败的文件
super.handleParseingFailFile(e);
throw e;
}
}
}
@Override
protected void parseingEmail() throws Exception {
this.sourceData = new WaterResultStruct();
//遍历文件内容
for (int i=0; i< lines.size(); i++) {
//获取行内容
String lineContent = lines.get(i);
//判断行内容是否包含header的内容
if (lineContent.contains(SampleFileHeader.HEADER.getMessage())) {
Map<String, String> map = new HashMap<>();
this.readContent(i+1, map);
}
}
}
private int readContent(int index, Map<String, String> map) {
int lastIndex = 0;
for (int i= index; i<lines.size(); i++) {
//从当前下标开始读取内容 直到下一个结束的标识为止 并返回结束标识的下标
String lineContent = lines.get(i);
//判断当前行是否包含# 或者 STOP 如果都不包含则进行内容读取 如果包含则跳过
if (!lineContent.contains("#") && !lineContent.contains(SampleFileHeader.STOP.getMessage())) {
//切割任意类型空格 获取行内容
List<String> contents = Arrays.asList(lineContent.split("\\s+"));
//遍历当前行内容
for (int j=0; j<contents.size(); j++) {
String content = contents.get(j);
}
} else {
lastIndex = i;
}
}
return lastIndex;
}
@Override
protected String getFileSaveRelativePath() {
final int year = LocalDate.now().getYear();
final int month = LocalDate.now().getMonth().getValue();
final SpectrumPathProperties properties = super.spectrumServiceQuotes.getSpectrumPathProperties();
StringBuilder relativePath = new StringBuilder();
relativePath.append(properties.getFilePathMap().get(super.currDataType.getType()));
relativePath.append(File.separator);
relativePath.append(year);
relativePath.append(File.separator);
relativePath.append(month>=10?month:"0"+month);
return relativePath.toString();
}
@Override
protected void updateSpectrumFileName() throws FileNotFoundException {
StringBuilder newFileName = new StringBuilder();
newFileName.append(this.sourceData.stationCode);
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(super.currDataType.getType());
newFileName.append(StringPool.DASH);
newFileName.append(this.sourceData.sampleRefId.substring(5, 17));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);
//设置能谱文件保存相对路径包含文件名称
String fileSavePath = this.getFileSaveRelativePath();
this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName();
}
@Override
protected void updateErrorSpectrumFileName() throws FileNotFoundException {
StringBuilder newFileName = new StringBuilder();
newFileName.append(this.sourceData.stationCode);
newFileName.append(StringPool.UNDERSCORE);
newFileName.append(super.currDataType.getType());
newFileName.append(StringPool.DASH);
newFileName.append(this.sourceData.sampleRefId.substring(5, 17));
newFileName.append(super.currDataType.getSuffix());
if(!super.spectrumFile.exists()){
//发送格式化错误事件后续统计报告使用
spectrumServiceQuotes.getApplicationContext().publishEvent(new FormatErrorEvent());
throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist");
}
super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true);
}
@Override
protected void handlerOriginalData() throws Exception {
this.startIntoDatabaseTime = new Date();
// this.gpsData = spectrumServiceQuotes.getGardsGPSDataService().create(this.sourceData, super.spectrumFileRelativePath);
this.endIntoDatabaseTime = new Date();
}
/**
* 把流程日志保存到日志目录
*/
@Override
protected void saveLogToLogDir() throws IOException {
//获取海水结果谱记录核素ID范围
String nuclideIdRange = "";
if(!CollectionUtils.isEmpty(this.waterResultList)){
nuclideIdRange = this.waterResultList.get(0).getSampleResultId()+"-"+this.waterResultList.get(this.waterResultList.size()-1).getSampleResultId();
}
//组装日志文件内容
StringBuilder logContent = new StringBuilder();
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("WATER RESULT NUCLIDE ID: ").append(nuclideIdRange).append(" StandardFile:").append(super.spectrumFile.getAbsolutePath());
logContent.append(System.lineSeparator()).append(System.lineSeparator());
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
final String dirPath = properties.getRootPath()+properties.getLogPath()+File.separator+this.getFileSaveRelativePath();
final String fileName = super.spectrumFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
final String finalPath = dirPath+ File.separator+fileName;
super.sendSpectrumLogToQueue(finalPath,logContent.toString());
}
}

View File

@ -0,0 +1,33 @@
package org.jeecg.modules.native_jni.struct;
import java.util.LinkedList;
import java.util.List;
public class GPSSpectrumStruct {
public String stationCode;
public String receiveDate;
public String receiveTime;
public List<String> recordDateList;
public List<String> recordTimeList;
public List<String> spanTimeList;
public List<String> lonList;
public List<String> latList;
public GPSSpectrumStruct() {
recordDateList = new LinkedList<>();
recordTimeList = new LinkedList<>();
spanTimeList = new LinkedList<>();
lonList = new LinkedList<>();
latList = new LinkedList<>();
}
}

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.native_jni.struct;
import org.jeecg.modules.entity.vo.ResultNuclide;
import java.util.LinkedList;
import java.util.List;
public class WaterResultStruct {
public String stationCode;
public String detectorCode;
public String sampleRefId;
public Double lon;
public Double lat;
public List<ResultNuclide> resultNuclideList;
public WaterResultStruct() {
resultNuclideList = new LinkedList<>();
}
}

View File

@ -0,0 +1,48 @@
package org.jeecg.common.cache;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.jeecg.common.properties.DurationProperties;
import org.jeecg.modules.entity.vo.SelfStationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@Component
public class SelfCache {
@Autowired
private DurationProperties durationProperties;
private Cache<String, SelfStationData> selfCache;
public void initCache() {
selfCache = CacheBuilder.newBuilder()
//设置缓存初始大小应该合理设置后续会扩容
.initialCapacity(10)
//最大值
.maximumSize(100)
//并发数设置
.concurrencyLevel(5)
//缓存过期时间写入后XX小时后过期
.expireAfterWrite(durationProperties.getCache(), TimeUnit.HOURS)
//统计缓存命中率
.recordStats()
.build();
}
public Cache<String, SelfStationData> getSelfCache() {
return selfCache;
}
public void setSelfCache(Cache<String, SelfStationData> selfCache) {
this.selfCache = selfCache;
}
public void deleteSelfCache(String key){
this.selfCache.invalidate(key);
}
}

View File

@ -0,0 +1,626 @@
package org.jeecg.common.util;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.text.ParseException;
import java.util.*;
@Component
@Slf4j
public class SelfStationUtil extends AbstractLogOrReport {
@Autowired
private FTPUtil ftpUtil;
public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, String systemType, Map<String, Object> map) {
try {
EnergySpectrumStruct struct = null;
if (systemType.equals("sample")) {
//读取sample的分析文件内容
struct = selfStationData.getSampleStruct();
} else if (systemType.equals("det")) {
struct = selfStationData.getDetStruct();
}
//存储页面操作数据
SelfStationVueData selfStationVueData = new SelfStationVueData();
//封装散点图下的基础数据信息
SpectrumData spectrumData = new SpectrumData();
//Station Code
String stationCode = struct.site_code;
//Detector Code
String detectorCode = struct.detector_code;
//Data Type
String dataType = struct.data_type;
//Collection Start
Date CollectionStart = null;
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time);
}
//Collection Stop
Date CollectionStop = null;
if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){
CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time);
}
//Collection Time
String CollectionTime = "";
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000));
}
//Acquisition Start
Date AcquisitionStart = null;
if ( StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time) ){
AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time);
}
//Acq Real Time
double AcquisitionRealTime = struct.acquisition_real_time;
//Acq live Time
double AcquisitionLiveTime = struct.acquisition_live_time;
//Air Volume[m3]
double airVolume = struct.air_volume;
//Xe Volume[m3]
double xeVolume = struct.sample_volume_of_Xe;
//xeCollectionYield
double xeCollectionYield = struct.Xe_collection_yield;
//gasBkMeasurementId
String gasBkMeasurementId = struct.gas_bk_measurement_id;
//detectorBkMeasurementId
String detectorBkMeasurementId = struct.detector_bk_measurement_id;
//measurementId
String measurementId = struct.measurement_id;
spectrumData.setSampleId(sampleId);
spectrumData.setStatus(status);
spectrumData.setStationCode(stationCode);
spectrumData.setDetectorCode(detectorCode);
spectrumData.setDataType(dataType);
spectrumData.setCollectionStart(CollectionStart);
spectrumData.setCollectionStop(CollectionStop);
spectrumData.setCollectionTime(CollectionTime);
spectrumData.setAcquisitionStart(AcquisitionStart);
spectrumData.setAcquisitionRealTime(String.format("%.2f", AcquisitionRealTime));
spectrumData.setAcquisitionLiveTime(String.format("%.2f", AcquisitionLiveTime));
spectrumData.setAirVolume(String.format("%.5f", airVolume));
spectrumData.setXeVolume(String.format("%.5f", xeVolume));
spectrumData.setYield(xeCollectionYield);
spectrumData.setGasBkMeasurementId(gasBkMeasurementId);
spectrumData.setDetectorBkMeasurementId(detectorBkMeasurementId);
spectrumData.setMeasurementId(measurementId);
map.put("spectrumData", spectrumData);
//根据范围1划分 范围1对应的折线图
Map<String, Object> oneMap = statisticsROIList(struct.POI_B_x1.get(0).intValue(), struct.POI_B_x2.get(0).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if (CollectionUtils.isNotEmpty(oneMap) ) {
Integer startChannel = (Integer) oneMap.get("startChannel");
Integer endChannel = (Integer) oneMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) oneMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIOneBetaStart(startChannel);
selfStationData.getSampleVueData().setROIOneBetaStop(endChannel);
selfStationData.getSampleVueData().setROIOneList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIOneBetaStart(startChannel);
selfStationData.getDetVueData().setROIOneBetaStop(endChannel);
selfStationData.getDetVueData().setROIOneList(seriseDataList);
}
map.put("ROIOneStart", startChannel);
map.put("ROIOneStop", endChannel);
map.put("ROIOneList", seriseDataList);
}
//根据范围2划分 范围2对应的折线图
Map<String, Object> twoMap = statisticsROIList(struct.POI_B_x1.get(1).intValue(), struct.POI_B_x2.get(1).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(twoMap) ) {
Integer startChannel = (Integer) twoMap.get("startChannel");
Integer endChannel = (Integer) twoMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) twoMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROITwoBetaStart(startChannel);
selfStationData.getSampleVueData().setROITwoBetaStop(endChannel);
selfStationData.getSampleVueData().setROITwoList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROITwoBetaStart(startChannel);
selfStationData.getDetVueData().setROITwoBetaStop(endChannel);
selfStationData.getDetVueData().setROITwoList(seriseDataList);
}
map.put("ROITwoStart", startChannel);
map.put("ROITwoStop", endChannel);
map.put("ROITwoList", seriseDataList);
}
//根据范围3划分 范围3对应的折线图
Map<String, Object> threeMap = statisticsROIList(struct.POI_B_x1.get(2).intValue(), struct.POI_B_x2.get(2).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(threeMap) ) {
Integer startChannel = (Integer) threeMap.get("startChannel");
Integer endChannel = (Integer) threeMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) threeMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIThreeBetaStart(startChannel);
selfStationData.getSampleVueData().setROIThreeBetaStop(endChannel);
selfStationData.getSampleVueData().setROIThreeList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIThreeBetaStart(startChannel);
selfStationData.getDetVueData().setROIThreeBetaStop(endChannel);
selfStationData.getDetVueData().setROIThreeList(seriseDataList);
}
map.put("ROIThreeStart", startChannel);
map.put("ROIThreeStop", endChannel);
map.put("ROIThreeList", seriseDataList);
}
//根据范围4划分 范围4对应的折线图
Map<String, Object> fourMap = statisticsROIList(struct.POI_B_x1.get(3).intValue(), struct.POI_B_x2.get(3).intValue(), struct.b_channels, struct.g_channels, struct.h_counts);
if ( CollectionUtils.isNotEmpty(fourMap) ) {
Integer startChannel = (Integer) fourMap.get("startChannel");
Integer endChannel = (Integer) fourMap.get("endChannel");
List<SeriseData> seriseDataList = (List<SeriseData>) fourMap.get("dataList");
if (systemType.equals("sample")) {
selfStationData.getSampleVueData().setROIFourBetaStart(startChannel);
selfStationData.getSampleVueData().setROIFourBetaStop(endChannel);
selfStationData.getSampleVueData().setROIFourList(seriseDataList);
} else if (systemType.equals("det")) {
selfStationData.getDetVueData().setROIFourBetaStart(startChannel);
selfStationData.getDetVueData().setROIFourBetaStop(endChannel);
selfStationData.getDetVueData().setROIFourList(seriseDataList);
}
map.put("ROIFourStart", startChannel);
map.put("ROIFourStop", endChannel);
map.put("ROIFourList", seriseDataList);
}
//散点图
//统计散点图
//横坐标 beta-gamma
long bChannels = struct.b_channels;
//纵坐标 gamma
long gChannels = struct.g_channels;
//
List<Long> hCounts = struct.h_counts;
List<HistogramData> histogramDataList = new LinkedList<>();
List<HistogramData> histogramDataDList = new LinkedList<>();
for (int i=0; i<gChannels; i++){
for (int j=0; j< bChannels; j++){
Long index = i * bChannels + j;
Long count = hCounts.get(index.intValue());
if (count > 0){
HistogramData his = new HistogramData();
his.setG(i);
his.setB(j);
his.setC(count);
histogramDataList.add(his);
histogramDataDList.add(his);
}else {
HistogramData his = new HistogramData();
his.setG(i);
his.setB(j);
his.setC(count);
histogramDataDList.add(his);
}
}
}
map.put("histogramDataList", histogramDataList);
// map.put("histogramDataDList", histogramDataDList);
//gamma能量部分的计算参数 道值
List<Double> gCentroidChannel = struct.g_centroid_channel;
//gamma能量部分的计算参数 道值对应能量
List<Double> gEnergy = struct.g_energy;
//调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
//存储需要计算gamma能量的道值
List<Double> gchannels = new ArrayList<>();
for (int i=0; i<gChannels; i++){
gchannels.add(Double.valueOf(i));
}
//调用算法 传递gamma参与计算的道值以及计算公式参数 得到各道值对应的能量
List<Double> gammaEnergyList = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
//将gamma能量折线图进行赋值返回
map.put("gammaEnergyData", gammaEnergyList);
//beta能量部分的计算参数 道值
List<Double> bChannel = struct.b_channel;
//beta能量部分的计算参数 道值对应的能量
List<Double> bElectronEnergy = struct.b_electron_energy;
//调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<Double> bchannels = new ArrayList<>();
for (int i=0; i<bChannels; i++){
bchannels.add(Double.valueOf(i));
}
//传入道值和计算公式的参数计算出各道值对应的beta能量
List<Double> betaEnergyList = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
//将beta能量折线图进行赋值返回
map.put("betaEnergyData", betaEnergyList);
//g_Energy
if (CollectionUtils.isNotEmpty(struct.g_energy) && CollectionUtils.isNotEmpty(struct.g_centroid_channel) && CollectionUtils.isNotEmpty(struct.g_uncertainty) && Objects.nonNull(struct.g_record_count)) {
if (systemType.equals("sample")) {
GEnergyBlock gEnergyBlock = new GEnergyBlock();
gEnergyBlock.setG_energy(struct.g_energy);
gEnergyBlock.setCentroid_channel(struct.g_centroid_channel);
gEnergyBlock.setUncertainty(struct.g_uncertainty);
gEnergyBlock.setRecord_count(struct.g_record_count);
selfStationData.getSampleVueData().getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
//g_Resolution
if (CollectionUtils.isNotEmpty(struct.g_r_energy) && CollectionUtils.isNotEmpty(struct.g_r_FWHM) && CollectionUtils.isNotEmpty(struct.g_r_uncertainty) && Objects.nonNull(struct.g_r_record_count)) {
if (systemType.equals("sample")) {
GResolutionBlock gResolutionBlock = new GResolutionBlock();
gResolutionBlock.setG_energy(struct.g_r_energy);
gResolutionBlock.setFWHM(struct.g_r_FWHM);
gResolutionBlock.setUncertainty(struct.g_r_uncertainty);
gResolutionBlock.setRecord_count(struct.g_r_record_count);
selfStationData.getSampleVueData().getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
//g_Efficiency
if (CollectionUtils.isNotEmpty(struct.g_e_energy) && CollectionUtils.isNotEmpty(struct.g_e_efficiency) && CollectionUtils.isNotEmpty(struct.g_e_uncertainty) && Objects.nonNull(struct.g_e_record_count)) {
if (systemType.equals("sample")) {
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
gEfficiencyBlock.setG_energy(struct.g_e_energy);
gEfficiencyBlock.setEfficiency(struct.g_e_efficiency);
gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty);
gEfficiencyBlock.setRecord_count(struct.g_e_record_count);
selfStationData.getSampleVueData().getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock);
//计算得到公式的参数
List<Double> calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty);
ParameterInfo parameterInfo = new ParameterInfo();
parameterInfo.setP(calEnergyParam);
selfStationData.getSampleVueData().getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo);
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* 根据文件路径类型获取对应的解析文件内容并返回进行存储
* @param filePathName
* @param type
* @param selfStationData
* @return
*/
public EnergySpectrumStruct getSourceData(String filePathName, String type, SelfStationData selfStationData) {
EnergySpectrumStruct struct = null;
File file = null;
try {
//根据完整的文件路径 获取临时文件
file = ftpUtil.downloadFile(filePathName, "betaGamma");
if (Objects.nonNull(file)) {
if (type.equalsIgnoreCase("sample")) {
selfStationData.setSampleTmpPath(file.getAbsolutePath());
} else if (type.equalsIgnoreCase("det")) {
selfStationData.setDetTmpPath(file.getAbsolutePath());
}
//解析文件内容
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
}
} catch (Exception e) {
e.printStackTrace();
}
return struct;
}
/**
* 统计道值范围内数量
* @param startChannel 起始道值
* @param endChannel 结束道值
* @param betaChannels 行数
* @param gammaChannels 列数
* @param h_counts 计数数组
*/
public Map<String, Object> statisticsROIList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
Map<String, Object> map = new HashMap<>();
//存储同一列不同行加和后的数量
List<Integer> sumList = new LinkedList<>();
List<SeriseData> seriseDataList = new LinkedList<>();
//遍历所有列
for (int i=0; i<gammaChannels; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(i);
int sum = 0;
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
for (int j=startChannel; j <= endChannel; j++) {
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
int index = (int) (i * betaChannels + j);
long count = 0;
//判断下标是否在h_counts范围内
if (index < h_counts.size()) {
count = h_counts.get(index);
}
sum+=count;
}
seriseData.setY(sum);
sumList.add(sum);
seriseDataList.add(seriseData);
}
map.put("startChannel", startChannel);
map.put("endChannel", endChannel);
map.put("dataList", seriseDataList);
return map;
}
public String UpdateEquationEnergy(ParameterInfo m_curParam) {
String equation ="";
int p_size = m_curParam.getP().size()-1;
if(p_size >= 2 && m_curParam.getP().get(2) > 0) {
// Polynomial: y=a0+a1*x+a2*x^2+a3*x^3
equation +="Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + C * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
for(int i=3; i<=p_size; i++) {
equation += " + C<sup style=\"vertical-align:super;\">" + (i-1) +"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+"";
}
} else if(p_size == 1) {
equation = "Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * C";
}
return equation;
}
public void UpdateChartEnergy(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurCentroid, SelfStationData selfStationData, Double width, Map<String, Object> map) {
int num = m_vCurEnergy.size();
if(num < 1){
return;
}
List<ChartData> datalist = new LinkedList<>();
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
// 拟合曲线
ChartData lData = new ChartData();
lData.setColor("rgb(255, 255, 0)");
lData.setType("Line");
List<Double> vChan = new LinkedList<>();
double MaxChan = Double.valueOf(selfStationData.getSampleStruct().g_channels);
double d = 1;
double dStep = MaxChan / width * 2;
while(d < MaxChan) {
vChan.add(d);
d+= dStep;
}
vChan.add(MaxChan);
List<Double> vFit = CalValuesHandler.calFcnEval(vChan, m_curParam.getP()).counts;
for(int i=0; i<vChan.size(); i++) {
if(vFit.get(i) > 0){
SeriseData seriseData = new SeriseData();
seriseData.setX(vChan.get(i));
seriseData.setY(vFit.get(i));
lData.getPointlist().add(seriseData);
}
}
if(lData.getPointlist().size() > 1){
datalist.add(lData);
}
}
// ChannelEnergy 点集
ChartData pData = new ChartData();
pData.setColor("red");
pData.setType("Scatter");
for(int i=0; i<num; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(m_vCurCentroid.get(i));
seriseData.setY(m_vCurEnergy.get(i));
pData.getPointlist().add(seriseData);
}
datalist.add(pData);
map.put("AllData", datalist);
}
public String UpdateEquationResolution(ParameterInfo m_curParam) {
String equation = "";
int p_size = m_curParam.getP().size()-1;
if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
// Square root of polynomial: y = sqrt(a0+a1*x+a2*x^2+a3*x^3 )
equation += "FWHM = ("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + E * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
for(int i=3; i<=p_size; i++) {
equation += " + E<sup style=\"vertical-align:super;\">"+(i-1)+"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)));
}
equation += ")<sup style=\"vertical-align:super;\">"+1+"/"+2+"</sup>";
}
return equation;
}
public void UpdateChartResolution(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurReso, SelfStationData selfStationData, Double width, Map<String, Object> map) {
int num = m_vCurEnergy.size();
if(num < 1) return;
List<ChartData> datalist = new LinkedList<>();
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
// 拟合曲线
ChartData lData = new ChartData();
lData.setColor("rgb(255, 255, 0)");
lData.setType("Line");
List<Double> vChan = new LinkedList<>();
vChan.add(1.0);
vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels));
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts;
double d = vEner.get(0), maxE = vEner.get(1);
double dStep = maxE / width * 2;
vEner.remove(vEner.size()-1);
while(d < maxE) {
vEner.add(d);
d += dStep;
}
vEner.add(maxE);
List<Double> vFit = CalValuesHandler.calFcnEval(vEner, m_curParam.getP()).counts;
for(int i=0; i<vEner.size(); i++) {
if(vFit.get(i) > 0){
SeriseData seriseData = new SeriseData();
seriseData.setX(vEner.get(i));
seriseData.setY(vFit.get(i));
lData.getPointlist().add(seriseData);
}
}
if(lData.getPointlist().size() > 1){
datalist.add(lData);
}
}
// ChannelEnergy 点集
ChartData pData = new ChartData();
pData.setColor("red");
pData.setType("Scatter");
for(int i=0; i<num; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(m_vCurEnergy.get(i));
seriseData.setY(m_vCurReso.get(i));
pData.getPointlist().add(seriseData);
}
datalist.add(pData);
map.put("AllData", datalist);
}
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, Integer curRow, Integer funId) {
String equation = "";
if(m_curParam.getP().size() > 2) {
int p_size = m_curParam.getP().size()-1;
int e_size = m_vCurEnergy.size();
if (Objects.isNull(funId)) {
funId = m_curParam.getP().get(0).intValue();
}
switch(funId) {
case 1: // Interpolation: y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x<x(i+1)
if(p_size == 2 * e_size && p_size >= 4) {
int i = curRow;
if(i < 0 || i >= e_size) break;
double y1, y0, x1, x0;
if(i < e_size - 1)
{
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+3))));
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+2))));
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
} else {
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-1))));
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-2))));
}
equation += "Efficiency = "+y0+" + ("+y1+"-"+y0+") * (E - "+x0+") / ("+x1+" - "+x0+")";
}
break;
case 5: // HT Efficiency: y = A*exp(-(E1/x)^k)*(1-exp(-(E2/x)^n))
if(p_size == 5) {
for(int i=1; i<=p_size; i++) {
if(m_curParam.getP().get(i) <= 0) break;
}
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1-exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
}
break;
case 6: // Polynomial in log(y) against log(x): log(y) = a0 + a1*log(x) +a2*log(x)^2+ a3*log(x)^3
if(p_size >= 2) {
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(E)";
for(int i=3; i<=p_size; i++) {
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
}
}
break;
case 8: // Polynomial in log(y) against log(1/x): log(y) = a0 + a1*log(c/x) + a2*log(c/x)^2 + a3*log(c/x)^3 + a4*log(c/x)^4
if(p_size >= 3) {
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(C/E)";
for(int i=3; i<=p_size; i++) {
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(C/E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
}
}
break;
case 93: // HAE Efficiency (1-3): y=S*exp(-(E1/x)^k)*(1- exp(-(2*E3/(x-E3))^n))
if(p_size == 5) {
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
}
break;
case 94: // HAE Efficiency (1-2): y=S*exp(-(E1/x)^k)*(1- exp(-b*(1/(x-E2))^m))
if(p_size == 6) {
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>))";
}
break;
case 95: // HAE Efficiency (1-2-3): y = S * exp(-(E1/x)^k) * (1- exp(-b*(1/(x-E2))^m)) *(1 - exp(-(2*E3/(E-E3))^n))
if(p_size == 8) {
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>)) * "+
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(8)))+"</sup>))";
}
break;
}
}
return equation;
}
public void UpdateChartEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurEffi, SelfStationData selfStationData, Double width, Map<String, Object> map) {
int num = m_vCurEnergy.size();
if(num < 1) return;
List<ChartData> datalist = new LinkedList<>();
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
// 拟合曲线
ChartData lData = new ChartData();
lData.setColor("rgb(255, 255, 0)");
lData.setType("Line");
List<Double> vChan = new LinkedList<>();
vChan.add(1.0);
vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels));
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts;
double d = vEner.get(0);
double maxE = vEner.get(1);
double dStep = maxE / width * 2;
vEner.remove(vEner.size()-1);
while(d < maxE) {
vEner.add(d);
d += dStep;
}
vEner.add(maxE);
List<Double> vFit = CalValuesHandler.calFcnEval(vEner, m_curParam.getP()).counts;
for(int i=0; i<vEner.size(); i++) {
if(vFit.get(i) > 0){
SeriseData seriseData = new SeriseData();
seriseData.setX(vEner.get(i));
seriseData.setY(vFit.get(i));
lData.getPointlist().add(seriseData);
}
}
if(lData.getPointlist().size() > 1){
datalist.add(lData);
}
}
// ChannelEnergy 点集
ChartData pData = new ChartData();
pData.setColor("red");
pData.setType("Scatter");
for(int i=0; i<num; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(m_vCurEnergy.get(i));
seriseData.setY(m_vCurEffi.get(i));
pData.getPointlist().add(seriseData);
}
datalist.add(pData);
map.put("AllData", datalist);
}
}

View File

@ -0,0 +1,161 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.vo.ChangeData;
import org.jeecg.modules.service.ISelfStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("selfStation")
@Api(value = "自建台站管理", tags = "自建台站管理")
public class SelfStationController {
@Autowired
private ISelfStationService selfStationService;
@GetMapping("initValue")
@ApiOperation(value = "预加载谱文件数据", notes = "预加载谱文件数据")
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String detFileName, HttpServletRequest request) {
selfStationService.initValue(dbName, sampleId, analyst, sampleFileName, detFileName, request);
}
@GetMapping("loadFromDB")
@ApiOperation(value = "从数据库加载自建台站数据", notes = "从数据库加载自建台站数据")
public Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
return selfStationService.loadFromDB(dbName, sampleId, analyst, request);
}
@GetMapping("loadFromFile")
@ApiOperation(value = "从文件加载自建台站谱数据", notes = "从文件加载自建台站谱数据")
public Result loadFromFile(String sampleFileName, String detFileName, HttpServletRequest request) {
return selfStationService.loadSelfStationByFile(sampleFileName, detFileName, request);
}
@DeleteMapping("deleteSelfStationCache")
public void deleteSelfStationCache(String sampleFileName, HttpServletRequest request) {
selfStationService.deleteSelfStationCache(sampleFileName, request);
}
@PutMapping("updateROI")
@ApiOperation(value = "更新ROI范围", notes = "更新ROI范围")
public Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request) {
return selfStationService.updateROI(startChannel, endChannel, ROINum, sampleFileName, request);
}
@GetMapping("energyCalibration")
@ApiOperation(value = "查看Energy Calibration数据", notes = "查看Energy Calibration数据")
public Result energyCalibration(String fileName, String currentText, Double width, HttpServletRequest request) {
return selfStationService.energyCalibration(fileName, currentText, width, request);
}
@PostMapping("changeDataEnergy")
@ApiOperation(value = "修改Energy Calibration数据", notes = "修改Energy Calibration数据")
public Result changeDataEnergy(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.changeDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth(), request);
}
@PostMapping("applyDataEnergy")
@ApiOperation(value = "Apply Energy Calibration数据", notes = "Apply Energy Calibration数据")
public Result applyDataEnergy(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.applyDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getCurCalName(), changeData.getSampleId(), changeData.getFileName(), request);
}
@PostMapping("saveDataEnergy")
@ApiOperation(value = "保存Energy Calibration数据", notes = "保存Energy Calibration数据")
public void saveDataEnergy(@RequestBody ChangeData changeData, HttpServletResponse response) {
selfStationService.saveDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
}
@PostMapping("callDataEnergy")
@ApiOperation(value = "导入Energy Calibration数据", notes = "导入Energy Calibration数据")
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return selfStationService.callDataEnergy(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentEnergy")
@ApiOperation(value = "Energy Calibration页面set to current按钮", notes = "Energy Calibration页面set to current按钮")
public Result setCurrentEnergy(String fileName, String currentName, HttpServletRequest request) {
return selfStationService.setCurrentEnergy(fileName, currentName, request);
}
@GetMapping("resolutionCalibration")
@ApiOperation(value = "查看Resolution Calibration数据", notes = "查看Resolution Calibration数据")
public Result resolutionCalibration(String fileName, String currentText, Double width, HttpServletRequest request) {
return selfStationService.resolutionCalibration(fileName, currentText, width, request);
}
@PostMapping("changeDataResolution")
@ApiOperation(value = "修改Resolution Calibration数据", notes = "修改Resolution Calibration数据")
public Result changeDataResolution(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.changeDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth(), request);
}
@PostMapping("applyDataResolution")
@ApiOperation(value = "Apply Resolution Calibration数据", notes = "Apply Resolution Calibration数据")
public Result applyDataResolution(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.applyDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getCurCalName(), changeData.getSampleId(), changeData.getFileName(), request);
}
@PostMapping("saveDataResolution")
@ApiOperation(value = "保存Resolution Calibration数据", notes = "保存Resolution Calibration数据")
public void saveDataResolution(@RequestBody ChangeData changeData, HttpServletResponse response) {
selfStationService.saveDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
}
@PostMapping("callDataResolution")
@ApiOperation(value = "导入Resolution Calibration数据", notes = "导入Resolution Calibration数据")
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return selfStationService.callDataResolution(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentResolution")
@ApiOperation(value = "Resolution Calibration页面set to current按钮", notes = "Resolution Calibration页面set to current按钮")
public Result setCurrentResolution(String fileName, String currentName, HttpServletRequest request) {
return selfStationService.setCurrentResolution(fileName, currentName, request);
}
@GetMapping("EfficiencyCalibration")
@ApiOperation(value = "查看Efficiency Calibration数据", notes = "查看Efficiency Calibration数据")
public Result EfficiencyCalibration(String fileName, String currentText, Double width, HttpServletRequest request) {
return selfStationService.EfficiencyCalibration(fileName, currentText, width, request);
}
@PostMapping("changeDataEfficiency")
@ApiOperation(value = "修改Efficiency Calibration数据", notes = "修改Efficiency Calibration数据")
public Result changeDataEfficiency(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.changeDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getFuncId(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth(), changeData.getCurRow(), request);
}
@PostMapping("applyDataEfficiency")
@ApiOperation(value = "Apply Efficiency Calibration数据", notes = "Apply Efficiency Calibration数据")
public Result applyDataEfficiency(@RequestBody ChangeData changeData, HttpServletRequest request) {
return selfStationService.applyDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getCurCalName(), changeData.getSampleId(), changeData.getFileName(), request);
}
@PostMapping("saveDataEfficiency")
@ApiOperation(value = "保存Efficiency Calibration数据", notes = "保存Efficiency Calibration数据")
public void saveDataEfficiency(@RequestBody ChangeData changeData, HttpServletResponse response) {
selfStationService.saveDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getFuncId(), response);
}
@PostMapping("callDataEfficiency")
@ApiOperation(value = "导入Efficiency Calibration数据", notes = "导入Efficiency Calibration数据")
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return selfStationService.callDataEfficiency(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentEfficiency")
@ApiOperation(value = "Efficiency Calibration页面set to current按钮", notes = "Efficiency Calibration页面set to current按钮")
public Result setCurrentEfficiency(String fileName, String currentName, HttpServletRequest request) {
return selfStationService.setCurrentEfficiency(fileName, currentName, request);
}
}

View File

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

View File

@ -0,0 +1,49 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class SelfStationData implements Serializable {
/**
* sample临时文件路径
*/
private String sampleTmpPath;
/**
* det临时文件路径
*/
private String detTmpPath;
/**
* sample文件分析内容
*/
private EnergySpectrumStruct sampleStruct;
/**
* det文件分析内容
*/
private EnergySpectrumStruct detStruct;
/**
* sample对应的操作数据
*/
private SelfStationVueData sampleVueData;
/**
* det对应的操作数据
*/
private SelfStationVueData detVueData;
public SelfStationData() {
sampleVueData = new SelfStationVueData();
detVueData = new SelfStationVueData();
}
}

View File

@ -0,0 +1,115 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class SelfStationVueData implements Serializable {
/**
* ROI-1结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIOneList;
//ROI-1范围矩形框起始道值
private Integer ROIOneBetaStart;
//ROI-1范围矩形框终止道值
private Integer ROIOneBetaStop;
/**
* ROI-2结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROITwoList;
//ROI-2范围矩形框起始道值
private Integer ROITwoBetaStart;
//ROI-2范围矩形框终止道值
private Integer ROITwoBetaStop;
/**
* ROI-3结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIThreeList;
//ROI-3范围矩形框起始道值
private Integer ROIThreeBetaStart;
//ROI-3范围矩形框终止道值
private Integer ROIThreeBetaStop;
/**
* ROI-4结果数据
*/
//折线图横纵坐标数组
private List<SeriseData> ROIFourList;
//ROI-4范围矩形框起始道值
private Integer ROIFourBetaStart;
//ROI-4范围矩形框终止道值
private Integer ROIFourBetaStop;
// 当前修改的刻度名称
private String newEner;
private String newReso;
private String newEffi;
/**
* 使用中的能量参数对应的刻度名称
*/
private String usedEner;
private String usedReso;
private String usedEffi;
// 当前寻峰结果所用的刻度数据
private GEnergyBlock usedEnerKD;
private GResolutionBlock usedResoKD;
private GEfficiencyBlock usedEffiKD;
// 存储所有的刻度数据
private Map<String, GEnergyBlock> mapEnerKD; // 能量刻度
private Map<String, GResolutionBlock> mapResoKD; // 分辨率刻度
private Map<String, GEfficiencyBlock> mapEffiKD; // 效率刻度
// 当前寻峰结果所用的刻度参数
private ParameterInfo usedEnerPara;
private ParameterInfo usedResoPara;
private ParameterInfo usedEffiPara;
// 存储所有的刻度参数
private Map<String, ParameterInfo> mapEnerPara;
private Map<String, ParameterInfo> mapResoPara;
private Map<String, ParameterInfo> mapEffiPara;
public SelfStationVueData() {
newEner = "PHD";
newReso = "PHD";
newEffi = "PHD";
usedEner= "";
usedReso= "";
usedEffi= "";
mapEnerKD = new HashMap<>();
mapResoKD = new HashMap<>();
mapEffiKD = new HashMap<>();
usedEnerPara = new ParameterInfo();
usedResoPara = new ParameterInfo();
usedEffiPara = new ParameterInfo();
mapEnerPara = new HashMap<>();
mapResoPara = new HashMap<>();
mapEffiPara = new HashMap<>();
}
}

View File

@ -0,0 +1,59 @@
package org.jeecg.modules.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.vo.ParameterInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
public interface ISelfStationService {
void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String detFileName, HttpServletRequest request);
Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
Result loadSelfStationByFile(String sampleFileName, String detFileName, HttpServletRequest request);
void deleteSelfStationCache(String sampleFileName, HttpServletRequest request);
Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request);
Result energyCalibration(String fileName, String currentText, Double width, HttpServletRequest request);
Result changeDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width, HttpServletRequest request);
Result applyDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName, HttpServletRequest request);
void saveDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentEnergy(String fileName, String currentName, HttpServletRequest request);
Result resolutionCalibration(String fileName, String currentText, Double width, HttpServletRequest request);
Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width, HttpServletRequest request);
Result applyDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName, HttpServletRequest request);
void saveDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentResolution(String fileName, String currentName, HttpServletRequest request);
Result EfficiencyCalibration(String fileName, String currentText, Double width, HttpServletRequest request);
Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName, Double width, Integer curRow, HttpServletRequest request);
Result applyDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName, HttpServletRequest request);
void saveDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, Integer funId, HttpServletResponse response);
Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentEfficiency(String fileName, String currentName, HttpServletRequest request);
}

View File

@ -194,6 +194,10 @@ 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");
@ -609,6 +613,10 @@ 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

@ -363,12 +363,29 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
map.put("qcFileName", qcphd);
map.put("qcFileStatus", qcStatus);
map.put("sampleSystemType", sampleSystemType);
} else {
} else if (sampleSystemType.equals(SystemType.GAMMA.getType()) || sampleSystemType.equals(SystemType.PARTICULATE.getType())) {
map.put("sampleFileName", sampleFileName);
map.put("gasFileName", "");
map.put("detFileName", "");
map.put("qcFileName", "");
map.put("sampleSystemType", sampleSystemType);
} else if (sampleSystemType.equals(SystemType.SELFSTATION.getType())) {
//加载并获取当前路径下所有的文件名称并进行名称格式化 仅需要格式化和sample文件同一个台站 名称格式化为最终名称
List<String> fileNames = phdFileUtil.FileNameByStandardForm(filePath, sampleFileName);
//匹配detFile
boolean detStatus = false;
String detaFileName = fileData.get("detaFileName");
String detphd = phdFileUtil.GetMatchFile(detaFileName, fileNames, DataTypeAbbr.DETBKPHD.getType());
if (StringUtils.isNotBlank(detphd)) {
detaFileName = detphd;
detStatus = true;
}
map.put("sampleFileName", sampleFileName);
map.put("gasFileName", "");
map.put("detFileName", detaFileName);
map.put("detFileStatus", detStatus);
map.put("qcFileName", "");
map.put("sampleSystemType", sampleSystemType);
}
}
if (CollectionUtils.isNotEmpty(map)) {
@ -4420,6 +4437,7 @@ 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,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);
}
}

View File

@ -0,0 +1,44 @@
package org.jeecg.modules.system.controller;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.AlertSystemVo;
import org.jeecg.modules.base.entity.configuration.GardsAlertSystem;
import org.jeecg.modules.system.service.IGardsAlertSystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@RestController
@RequestMapping("sys/alertSystem")
public class GardsAlertSystemController {
@Autowired
private IGardsAlertSystemService alertSystemService;
@GetMapping( "list")
public Result<?> findPage(AlertSystemVo alertSystemVo) {
return alertSystemService.findPage(alertSystemVo);
}
@PostMapping( "saveOrUpdate")
public Result<?> saveOrUpdate(@RequestBody GardsAlertSystem alertSystem) {
return alertSystemService.saveOrUpdate1(alertSystem);
}
@DeleteMapping( "delete")
public Result<?> delete(@RequestParam("id") String id) {
return alertSystemService.delete(id);
}
@DeleteMapping( "deleteBatch")
public Result<?> deleteBatch(@RequestParam("ids") String ids) {
return alertSystemService.delete(ids);
}
@GetMapping("codeMap")
public Map<String, String> codeMap(){
return alertSystemService.codeMap();
}
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.configuration.GardsAlertSystem;
@Mapper
public interface GardsAlertSystemMapper extends BaseMapper<GardsAlertSystem> {
}

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.AlertSystemVo;
import org.jeecg.modules.base.entity.configuration.GardsAlertSystem;
import java.util.Map;
public interface IGardsAlertSystemService extends IService<GardsAlertSystem> {
Result<?> findPage(AlertSystemVo alertSystemVo);
Result<?> saveOrUpdate1(GardsAlertSystem alertSystem);
Result<?> delete(String id);
Result<?> deleteBatch(String ids);
Map<String, String> codeMap();
}

View File

@ -0,0 +1,110 @@
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.DictConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.base.bizVo.AlertSystemVo;
import org.jeecg.modules.base.entity.configuration.GardsAlertSystem;
import org.jeecg.modules.system.mapper.GardsAlertSystemMapper;
import org.jeecg.modules.system.service.IGardsAlertSystemService;
import org.jeecgframework.minidao.datasource.DataSourceContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsAlertSystemServiceImpl extends ServiceImpl<GardsAlertSystemMapper, GardsAlertSystem> implements IGardsAlertSystemService {
@Autowired
private SysDictServiceImpl dictService;
@Override
public Result<?> findPage(AlertSystemVo alertSystemVo) {
Integer pageNo = alertSystemVo.getPageNo();
Integer pageSize = alertSystemVo.getPageSize();
IPage<GardsAlertSystem> page = new Page<>(pageNo, pageSize);
// 封装查询条件
String code = alertSystemVo.getCode();
String content = alertSystemVo.getContent();
LambdaQueryWrapper<GardsAlertSystem> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByAsc(GardsAlertSystem::getCode);
wrapper.like(StrUtil.isNotBlank(code), GardsAlertSystem::getCode, code);
wrapper.like(StrUtil.isNotBlank(content), GardsAlertSystem::getContent, content);
page = this.page(page, wrapper);
// 手动切换为主数据源
DynamicDataSourceContextHolder.push("master");
List<DictModel> items = dictService.getItems(DictConstant.ALERT_SYSTEM_CODE);
DynamicDataSourceContextHolder.clear();
Map<String, String> typeMap = items.stream().collect(Collectors
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
page.getRecords().forEach(item -> {
String type = item.getType();
item.setTypeStr(typeMap.get(type));
});
return Result.OK(page);
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Result<?> saveOrUpdate1(GardsAlertSystem alertSystem) {
String id = alertSystem.getId();
String code = alertSystem.getCode();
LambdaQueryWrapper<GardsAlertSystem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAlertSystem::getCode, code);
if (StrUtil.isBlank(id)){ // 如果是新增,判断code是否已经存在
if (CollUtil.isNotEmpty(this.list(wrapper)))
return Result.error("Code " + code + " is exist!");
if (this.saveOrUpdate(alertSystem))
return Result.OK(Prompt.ADD_SUCC);
return Result.error(Prompt.ADD_ERR);
} else { // 如果是修改,判断code是否修改,如果code修改,判断修改的code是否已经存在
GardsAlertSystem alertSystemOld = this.getById(id);
String oldCode = alertSystemOld.getCode();
if (!StrUtil.equals(code, oldCode))
if (CollUtil.isNotEmpty(this.list(wrapper)))
return Result.error("Code " + code + " is exist!");
if (this.saveOrUpdate(alertSystem))
return Result.OK(Prompt.UPDATE_SUCC);
return Result.error(Prompt.UPDATE_ERR);
}
}
@Override
public Result<?> delete(String id) {
boolean success = this.removeById(id);
if (success)
return Result.OK(Prompt.DELETE_SUCC);
return Result.OK(Prompt.DELETE_ERR);
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Result<?> deleteBatch(String ids) {
boolean success = removeBatchByIds(ListUtil.toList(StrUtil.split(ids, StrUtil.COMMA)));
if (success)
return Result.OK(Prompt.DELETE_SUCC);
return Result.OK(Prompt.DELETE_ERR);
}
@Override
public Map<String, String> codeMap() {
return this.list().stream().collect(Collectors.toMap(GardsAlertSystem::getCode, GardsAlertSystem::getContent));
}
}

View File

@ -1,8 +1,10 @@
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;
@ -13,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
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;
@ -47,9 +50,6 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
@Autowired
private RedisUtil redisUtil;
@Autowired
private FTPUtil ftpUtil;
@Autowired
private SpectrumPathProperties pathProperties;
@ -110,9 +110,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
TransactionDefinition txDef = new DefaultTransactionDefinition();
final TransactionStatus txStatus = transactionManager.getTransaction(txDef);
try {
String ftpRootPath = ftpUtil.getFtpRootPath();
String savePath = ftpRootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
String logPath = ftpRootPath + pathProperties.getLogPath() + StrUtil.SLASH;
String rootPath = pathProperties.getRootPath();
String savePath = rootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH;
String logPath = rootPath + pathProperties.getLogPath() + StrUtil.SLASH;
/* 删除数据库数据 */
// 过滤掉多余的表
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());
if (CollUtil.isEmpty(needDel))
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
// 删除FTP文件
List<String> failList = new ArrayList<>();
for (String path:needDel) {
boolean success = ftpUtil.removeFiles(path);
if (!success) {
failList.add(path);
}
// 删除本地文件
List<String> fails = new ArrayList<>();
for (String path : needDel) {
boolean success = FileUtil.del(path);
if (!success) fails.add(path);
}
if (CollUtil.isNotEmpty(failList))
return Result.error("Data clearing is complete, but file clearing fails!", failList);
if (CollUtil.isNotEmpty(fails))
return Result.error("Data clearing is complete, but file clearing fails!", fails);
return Result.OK("Data and file cleanup complete!");
}catch (Exception e){
transactionManager.rollback(txStatus);
@ -215,27 +213,25 @@ 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)) {
fileList.add(savePath + baselinePath);
}
String lcPath = AnalysesDto.getLcPath();
if (StrUtil.isNotBlank(lcPath)) {
fileList.add(savePath + lcPath);
}
String scacPath = AnalysesDto.getScacPath();
if (StrUtil.isNotBlank(scacPath)) {
fileList.add(savePath + scacPath);
}
if (StrUtil.isNotBlank(AnalysesDto.getLogPath())) {
fileList.add(logPath + AnalysesDto.getLogPath());
}
String reportPath = AnalysesDto.getReportPath();
if (StrUtil.isNotBlank(reportPath)) {
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
}
for (AnalysesDto AnalysesDto:AnalysesDtoList) {
String baselinePath = AnalysesDto.getBaselinePath();
if (StrUtil.isNotBlank(baselinePath)) {
fileList.add(savePath + baselinePath);
}
String lcPath = AnalysesDto.getLcPath();
if (StrUtil.isNotBlank(lcPath)) {
fileList.add(savePath + lcPath);
}
String scacPath = AnalysesDto.getScacPath();
if (StrUtil.isNotBlank(scacPath)) {
fileList.add(savePath + scacPath);
}
if (StrUtil.isNotBlank(AnalysesDto.getLogPath())) {
fileList.add(logPath + AnalysesDto.getLogPath());
}
String reportPath = AnalysesDto.getReportPath();
if (StrUtil.isNotBlank(reportPath)) {
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
}
}
return fileList;

View File

@ -88,7 +88,7 @@ public class WebStatisticsController {
@GetMapping("findAlertSohPage")
@ApiOperation(value = "台站报警数据分页查询", notes = "台站报警数据分页查询")
public Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
public Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds, String startTime, String endTime){
return gardsSohDataService.findAlertSohPage(queryRequest, stationIds, startTime, endTime);
}

View File

@ -14,4 +14,6 @@ public class GardsAlertDataWeb extends GardsAlertData {
@TableField(exist = false)
private Integer no;
@TableField(exist = false)
private Integer category;
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.feignclient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Map;
@Component
@FeignClient("armd-system")
public interface SystemClient {
/* GardsAlertSystemController下相关接口 */
@GetMapping("/sys/alertSystem/codeMap")
Map<String, String> codeMap();
}

View File

@ -1,8 +1,12 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.entity.GardsAlertDataWeb;
public interface GardsAlertDataMapper extends BaseMapper<GardsAlertDataWeb> {
import java.util.List;
import java.util.Map;
public interface GardsAlertDataMapper extends BaseMapper<GardsAlertDataWeb> {
Page<GardsAlertDataWeb> page(Page<GardsAlertDataWeb> page, Map<String, Object> params);
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsAlertDataMapper">
<select id="page" resultType="org.jeecg.modules.entity.GardsAlertDataWeb">
SELECT
d.*, s.CATEGORY
FROM
ORIGINAL.GARDS_ALERT_DATA d
LEFT JOIN CONFIGURATION.GARDS_STATIONS s ON d.STATION_ID = s.STATION_ID
<where>
<if test="params.stationIds != null and params.stationIds.size() > 0">
d.STATION_ID IN
<foreach collection="params.stationIds" index="index" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
AND d.TIME BETWEEN TO_DATE(#{params.startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{params.endTime}, 'YYYY-MM-DD HH24:MI:SS')
</where>
ORDER BY d.TIME DESC
</select>
</mapper>

View File

@ -29,7 +29,7 @@ public interface IGardsSohDataService extends IService<GardsSohDataWeb> {
* @param endTime
* @return
*/
Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime);
Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds, String startTime, String endTime);
/**
* 获取单个SOH对象

View File

@ -1,8 +1,12 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -10,11 +14,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.ExportUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.GardsAlertDataWeb;
import org.jeecg.modules.entity.GardsSohDataWeb;
import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.mapper.GardsAlertDataMapper;
import org.jeecg.modules.mapper.GardsSohDataMapper;
import org.jeecg.modules.service.IGardsSohDataService;
@ -28,6 +35,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@Service("gardsSohDataService")
@DS("ora")
@ -35,6 +43,10 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
@Autowired
private RedisUtil redisUtil;
@Autowired
private SystemClient systemClient;
@Autowired
private GardsAlertDataMapper gardsAlertDataMapper;
@ -86,38 +98,47 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
}
@Override
public Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) {
try {
Result result = new Result();
if (Objects.isNull(stationIds)){
result.setResult(Collections.emptyList());
return result;
}
if (Objects.isNull(startTime)){
result.error500("The start time cannot be empty");
return result;
}
if (Objects.isNull(endTime)){
result.error500("The end time cannot be empty");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtils.parseDate(DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
//获取redis中缓存的探测器信息
Map<Integer, String> detectorsMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
Page<GardsAlertDataWeb> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
LambdaQueryWrapper<GardsAlertDataWeb> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(GardsAlertDataWeb::getStationId, stationIds);
queryWrapper.ge(GardsAlertDataWeb::getTime, startDate);
queryWrapper.le(GardsAlertDataWeb::getTime, endDate);
queryWrapper.orderByDesc(GardsAlertDataWeb::getTime);
Page<GardsAlertDataWeb> alertDataPage = gardsAlertDataMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(alertDataPage);
return result;
} catch (ParseException e) {
throw new RuntimeException(e);
public Result<?> findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds, String startTime, String endTime) {
if (StrUtil.isBlank(startTime))
return Result.error("StartTime" + Prompt.PARAM_REQUIRED);
if (StrUtil.isBlank(endTime))
return Result.error("EndTime" + Prompt.PARAM_REQUIRED);
startTime += DateConstant.TIME_START;
endTime += DateConstant.TIME_END;
Map<String, Object> params = new HashMap<>();
params.put("stationIds", ListUtil.toList(stationIds));
params.put("startTime", startTime);
params.put("endTime", endTime);
Integer pageNo = queryRequest.getPageNo();
Integer pageSize = queryRequest.getPageSize();
Page<GardsAlertDataWeb> page = new Page<>(pageNo, pageSize);
Page<GardsAlertDataWeb> alertDataPage = gardsAlertDataMapper.page(page, params);
List<GardsAlertDataWeb> records = alertDataPage.getRecords();
if (CollUtil.isEmpty(records))
return Result.OK(alertDataPage);
Map<String, String> codeMap = systemClient.codeMap();
String flag1 = "Error code: ";
String flag2 = "Error code : ";
String regex1 = flag1 + "(\\S+)";
String regex2 = flag2 + "(\\S+)";
for (GardsAlertDataWeb record : records) {
String alertType = record.getAlertType();
if (!StrUtil.equals(alertType, "ALERT_SYSTEM"))
continue;
String alertText = record.getAlertText();
boolean c1 = StrUtil.contains(alertText, flag1);
boolean c2 = StrUtil.contains(alertText, flag2);
if (!c1 && !c2) continue;
String flag = c1 ? flag1 : flag2;
String regex = c1 ? regex1 : regex2;
String code = ReUtil.getGroup1(regex, alertText);
String replace = flag + codeMap.get(code);
String replaced = ReUtil.getGroup0(regex, alertText);
alertText = StrUtil.replace(alertText, replaced, replace);
record.setAlertText(alertText);
}
return Result.OK(alertDataPage);
}
@Override

View File

@ -31,7 +31,19 @@ public class JeecgAbnormalAlarmApplication extends SpringBootServletInitializer
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -53,7 +53,19 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -15,11 +15,11 @@ db:
password:
'0': ${MYSQL-PWD:123456}
url:
'0': jdbc:postgresql://${MYSQL-HOST:182.92.183.230}:${MYSQL-PORT:5432}/${MYSQL-DB:nacos}?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
'0': jdbc:postgresql://${MYSQL-HOST:127.0.0.1}:${MYSQL-PORT:5432}/${MYSQL-DB:nacos}?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
#'0': jdbc:postgresql://${MYSQL-HOST:172.21.50.118}:${MYSQL-PORT:5432}/${MYSQL-DB:nacos}?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
user:
'0': ${MYSQL-USER:temp}
#'0': ${MYSQL-USER:postgres}
#'0': ${MYSQL-USER:temp}
'0': ${MYSQL-USER:postgres}
pool:
config:
driver-class-name: org.postgresql.Driver

View File

@ -27,7 +27,19 @@ public class JeecgLogManageApplication extends SpringBootServletInitializer impl
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -1,14 +1,17 @@
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;
import org.jeecg.common.cache.SelfCache;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.IGardsNuclLibService;
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;
@ -32,6 +35,8 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Autowired
private BetaCache betaCache;
@Autowired
private SelfCache selfCache;
@Autowired
private IGammaService gammaService;
@Autowired
private IGardsNuclCoincidenceSumSpectrumService nuclCoincidenceSumSpectrumService;
@ -40,6 +45,9 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Autowired
private IDataService dataService;
@Value("${isOpen}")
private Boolean isOpen;
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
@ -47,7 +55,19 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
@ -75,9 +95,11 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
//创建缓存
betaCache.initCache();
localCache.initCache();
selfCache.initCache();
gammaService.readMDCParameter();
nuclLibService.getNuclideMap();
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
dataService.viewStations();
if (ObjectUtil.isNotNull(isOpen) && isOpen)
dataService.viewStations();
}
}

View File

@ -5,6 +5,7 @@ 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;
@ -35,7 +36,19 @@ public class JeecgStationOperationApplication extends SpringBootServletInitializ
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -52,7 +52,18 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -26,7 +26,19 @@ public class JeecgWebStatisticsApplication extends SpringBootServletInitializer
}
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();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");