Merge branch 'mdc'
# Conflicts: # jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TemplateUtil.java # jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/redisStream/AnalysisConsumer.java # jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java # jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/jobs/DatabaseJob.java # jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/jobs/ServerJob.java
This commit is contained in:
commit
99cd4bbbfe
|
@ -1,13 +1,14 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataTool {
|
||||
|
||||
private int counter = 1;
|
||||
|
||||
private final Map<String, Object> data = new HashMap<>();
|
||||
private final Map<String, Object> data = new LinkedHashMap<>();
|
||||
|
||||
public DataTool put(Object value) {
|
||||
data.put(String.format("p%d", counter), value);
|
||||
|
|
|
@ -61,7 +61,8 @@ public class TemplateUtil {
|
|||
for (String key : keys) {
|
||||
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
|
||||
}
|
||||
templateContent = CollUtil.join(contents, "#");
|
||||
String join = StrUtil.SPACE + "#" + StrUtil.SPACE;
|
||||
templateContent = CollUtil.join(contents, join);
|
||||
String content = FreemarkerParseFactory
|
||||
.parseTemplateContent(templateContent, data, true);
|
||||
messageDTO.setContent(content);
|
||||
|
@ -102,7 +103,8 @@ public class TemplateUtil {
|
|||
for (String key : keys) {
|
||||
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
|
||||
}
|
||||
templateContent = CollUtil.join(contents, "#");
|
||||
String join = StrUtil.SPACE + "#" + StrUtil.SPACE;
|
||||
templateContent = CollUtil.join(contents, join);
|
||||
String content = FreemarkerParseFactory
|
||||
.parseTemplateContent(templateContent, data, true);
|
||||
messageDTO.setContent(content);
|
||||
|
|
|
@ -164,8 +164,8 @@ public class TokenUtils {
|
|||
String secret = CommonConstant.TEMP_TOKEN_SECRET;
|
||||
// 模拟登录生成Token
|
||||
String token = JwtUtil.sign(username, secret);
|
||||
// 设置Token缓存有效时间为 3 分钟
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token, 3 * 60);
|
||||
// 设置Token缓存有效时间为 60 秒
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token, 60);
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SampNucl {
|
||||
|
||||
private String sampleId;
|
||||
|
||||
private String nuclideName;
|
||||
}
|
|
@ -7,12 +7,13 @@ import lombok.Getter;
|
|||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum Item {
|
||||
EMAIL_CONN("1", "Connection Status"),
|
||||
TABLESPACE_USAGE("2", "TableSpace Usage");
|
||||
EMAIL_CONN("1", "Email Connection Status"),
|
||||
TABLESPACE_USAGE("2", "TableSpace Usage"),
|
||||
EMAIL_UNPROCESSED("3", "Email Unprocessed");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public static Item of(String value){
|
||||
for (Item item : Item.values()) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.base.enums;
|
|||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
|
@ -9,22 +10,19 @@ import cn.hutool.core.util.StrUtil;
|
|||
* @author nieziyan
|
||||
* @date 2023-06-30
|
||||
*/
|
||||
@Getter
|
||||
public enum SourceType {
|
||||
|
||||
EMAIL("Email"),
|
||||
DATABASE("Database"),
|
||||
SERVER("Server");
|
||||
|
||||
private String type;
|
||||
private final String type;
|
||||
|
||||
SourceType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public static SourceType typeOf(String type){
|
||||
for (SourceType sourceType : SourceType.values()) {
|
||||
if (StrUtil.equals(sourceType.getType(),type))
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
@ -67,4 +68,9 @@ public class SysEmailLogController {
|
|||
@RequestParam("endDate") String endDate){
|
||||
return sysEmailLogService.analysis(emailId, startDate, endDate);
|
||||
}
|
||||
|
||||
@GetMapping("getMinus")
|
||||
public Integer getMinus(@RequestParam("emailId") String emailId){
|
||||
return sysEmailLogService.getMinus(emailId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,5 +43,7 @@ public interface SystemClient {
|
|||
@PostMapping("/sys/appMessage/pushMessageToSingle")
|
||||
void pushMessageToSingle(@RequestBody MessageDTO messageDTO, @RequestParam String groupId);
|
||||
|
||||
|
||||
/* GardsSampleDataController下相关接口 */
|
||||
@GetMapping("/gardsSampleData/getDetectorId")
|
||||
String getDetectorId(@RequestParam String sampleId);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,5 +16,5 @@ public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
|
|||
|
||||
List<ConcDto> getConc(Map<String,Object> param);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,5 +15,5 @@ public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
|
|||
|
||||
List<ConcDto> getConc(Map<String, Object> param);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,5 +16,5 @@ public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
|
|||
|
||||
List<ConcDtoXe> getConc(Map<String,Object> params);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,5 +16,5 @@ public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
|
|||
|
||||
List<ConcDtoXe> getConc(Map<String,Object> params);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -23,18 +23,20 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="nuclideNames" resultType="java.lang.String">
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
NUCLIDENAME
|
||||
n.SAMPLE_ID,
|
||||
n.NUCLIDENAME AS nuclideName
|
||||
FROM
|
||||
RNAUTO.GARDS_NUCL_IDED
|
||||
WHERE
|
||||
NUCLIDENAME IN
|
||||
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||
#{nuclideName}
|
||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||
INNER JOIN RNAUTO.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||
AND n.NUCLIDENAME IN
|
||||
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
NUCLIDENAME
|
||||
</if>
|
||||
AND TO_NUMBER(n.CONCENTRATION) > TO_NUMBER(n.MDC)
|
||||
</select>
|
||||
</mapper>
|
|
@ -23,18 +23,20 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="nuclideNames" resultType="java.lang.String">
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
NUCLIDENAME
|
||||
n.SAMPLE_ID,
|
||||
n.NUCLIDENAME AS nuclideName
|
||||
FROM
|
||||
RNMAN.GARDS_NUCL_IDED
|
||||
WHERE
|
||||
NUCLIDENAME IN
|
||||
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||
#{nuclideName}
|
||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||
INNER JOIN RNMAN.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||
AND n.NUCLIDENAME IN
|
||||
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
NUCLIDENAME
|
||||
</if>
|
||||
AND TO_NUMBER(n.CONCENTRATION) > TO_NUMBER(n.MDC)
|
||||
</select>
|
||||
</mapper>
|
|
@ -23,18 +23,20 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="nuclideNames" resultType="java.lang.String">
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
NUCLIDE_NAME
|
||||
n.SAMPLE_ID,
|
||||
n.NUCLIDE_NAME
|
||||
FROM
|
||||
RNAUTO.GARDS_XE_RESULTS
|
||||
WHERE
|
||||
NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||
#{nuclideName}
|
||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||
INNER JOIN RNAUTO.GARDS_XE_RESULTS n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||
AND n.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
NUCLIDE_NAME
|
||||
</if>
|
||||
AND n.NID_FLAG = 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -23,18 +23,20 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="nuclideNames" resultType="java.lang.String">
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
NUCLIDE_NAME
|
||||
n.SAMPLE_ID,
|
||||
n.NUCLIDE_NAME
|
||||
FROM
|
||||
RNMAN.GARDS_XE_RESULTS
|
||||
WHERE
|
||||
NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||
#{nuclideName}
|
||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||
INNER JOIN RNMAN.GARDS_XE_RESULTS n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||
AND n.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
NUCLIDE_NAME
|
||||
</if>
|
||||
AND n.NID_FLAG = 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -5,21 +5,18 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.StrBuilder;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hwpf.sprm.SprmIterator;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.constant.enums.SampleType;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory;
|
||||
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||
import org.jeecg.modules.base.dto.Info;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
|
@ -40,13 +37,10 @@ import org.springframework.stereotype.Component;
|
|||
import static org.jeecg.common.constant.enums.MessageTypeEnum.*;
|
||||
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||
import static org.jeecg.modules.base.enums.Template.ANALYSIS_NUCLIDE;
|
||||
import static org.jeecg.modules.base.enums.Template.MONITOR_EMAIL;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
|
@ -156,6 +150,8 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
String betaOrGamma = info.getBetaOrGamma();
|
||||
String datasource = info.getDatasource();
|
||||
String stationId = info.getStationId();
|
||||
String sampleId = info.getSampleId();
|
||||
String sampleName = info.getSampleName();
|
||||
// 获取谱文件采样日期 如果为null 则默认为LocalDate.now()
|
||||
LocalDate collDate = ObjectUtil.isNull(info.getCollectionDate()) ? LocalDate.now() :
|
||||
info.getCollectionDate().toLocalDate();
|
||||
|
@ -163,20 +159,20 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
List<String> conditions = ListUtil.toList(conditionStr.split(COMMA));
|
||||
List<String> firstDetected = new ArrayList<>(); // 首次发现
|
||||
List<NuclideInfo> moreThanAvg = new ArrayList<>(); // 超浓度均值
|
||||
List<String> meanwhile = new ArrayList<>(); // 同时出现两种及以上核素
|
||||
List<String> meanWhile = new ArrayList<>(); // 同时出现两种及以上核素
|
||||
for (String con : conditions) {
|
||||
Condition condition = Condition.valueOf1(con);
|
||||
if (ObjectUtil.isNull(condition)) continue;
|
||||
switch (condition){
|
||||
case FIRST_FOUND: // 首次发现该元素
|
||||
firstDetected = firstDetected(betaOrGamma, datasource, nuclideNames);
|
||||
firstDetected = firstDetected(betaOrGamma, datasource, stationId, sampleId, nuclideNames);
|
||||
break;
|
||||
case ABOVE_AVERAGE: // 元素浓度高于均值
|
||||
moreThanAvg = moreThanAvg(datasource, stationId, collDate, nuclidesCross);
|
||||
break;
|
||||
case MEANWHILE: // 同时出现两种及以上核素
|
||||
if (CollUtil.isNotEmpty(nuclideNames) && nuclideNames.size() >= 2)
|
||||
meanwhile.addAll(nuclideNames);
|
||||
meanWhile = meanWhile(betaOrGamma, datasource, sampleId, nuclideNames);
|
||||
if (meanWhile.size() < 2) meanWhile = ListUtil.empty();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -192,10 +188,13 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
.collect(Collectors.joining(StrUtil.COMMA + StrUtil.SPACE));
|
||||
dataTool.put("moreThanAvg", above);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(meanwhile))
|
||||
dataTool.put("meanwhile", CollUtil.join(meanwhile, StrUtil.COMMA + StrUtil.SPACE));
|
||||
if (CollUtil.isNotEmpty(meanWhile))
|
||||
dataTool.put("meanwhile", CollUtil.join(meanWhile, StrUtil.COMMA + StrUtil.SPACE));
|
||||
// 如果报警数据为空 则不需要发送报警信息和生成报警日志
|
||||
if (MapUtil.isEmpty(dataTool.get())) return;
|
||||
// 产生报警信息的Sample信息
|
||||
dataTool.put("sampleId", sampleId).put("sampleName", sampleName);
|
||||
// 构建预警信息实例 准备发送预警信息
|
||||
MessageDTO messageDTO = TemplateUtil.parse1(ANALYSIS_NUCLIDE.getCode(), dataTool.get());
|
||||
// 保存报警日志
|
||||
AlarmAnalysisLog logInfo = new AlarmAnalysisLog();
|
||||
|
@ -216,13 +215,14 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
/**
|
||||
* 首次发现该核素
|
||||
*/
|
||||
private List<String> firstDetected(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
Set<String> nuclideNames){
|
||||
List<String> existNames = analysisResultService
|
||||
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
||||
// 两个集合元素相减
|
||||
return CollUtil.subtractToList(nuclideNames, existNames);
|
||||
private List<String> firstDetected(String betaOrGamma, String dataSourceType,
|
||||
String stationId, String sampleId, Set<String> nuclideNames){
|
||||
/* 查询用户关注的核素是否存在 如果不存在则为首次发现该核素
|
||||
判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
|
||||
*/
|
||||
String detectorId = systemClient.getDetectorId(sampleId);
|
||||
return analysisResultService.nuclideFirst(betaOrGamma, dataSourceType, stationId,
|
||||
detectorId, sampleId, nuclideNames);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,8 +240,6 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
String nuclideName = nuclide.getKey();
|
||||
String concValue = nuclide.getValue();// 浓度值
|
||||
String avgValue = nuclideAvgs.get(nuclideName);// 浓度均值
|
||||
if (StrUtil.isBlank(concValue) || StrUtil.isBlank(avgValue))
|
||||
continue;
|
||||
if (!NumberUtil.isNumber(concValue) || !NumberUtil.isNumber(avgValue))
|
||||
continue;
|
||||
BigDecimal conc = new BigDecimal(concValue);
|
||||
|
@ -260,6 +258,17 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
return nuclideInfos;
|
||||
}
|
||||
|
||||
/*
|
||||
* 是否同时存在两种及以上核素
|
||||
* */
|
||||
private List<String> meanWhile(String betaOrGamma, String dataSourceType,
|
||||
String sampleId, Set<String> nuclideNames){
|
||||
/* 查询用户关注的核素中 该谱中是否存在两种及以上核素
|
||||
判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
|
||||
*/
|
||||
return analysisResultService.nuclideExist(betaOrGamma, dataSourceType, sampleId, nuclideNames);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
// start 生成临时Token到线程中
|
||||
UserTokenContext.setToken(getTempToken());
|
||||
|
|
|
@ -5,7 +5,10 @@ import java.util.Set;
|
|||
|
||||
public interface AnalysisResultService {
|
||||
|
||||
List<String> nuclideNames(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
Set<String> nuclideNames);
|
||||
List<String> nuclideExist(String betaOrGamma, String dataSourceType,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
|
||||
List<String> nuclideFirst(String betaOrGamma, String dataSourceType,
|
||||
String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.jeecg.modules.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -13,5 +12,8 @@ public interface IGardsNuclIdedAutoService extends IService<GardsNuclIded> {
|
|||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
|
||||
|
||||
List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -12,5 +12,8 @@ public interface IGardsNuclIdedManService extends IService<GardsNuclIded> {
|
|||
|
||||
List<ConcDto> getConc(Map<String, Object> params);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
|
||||
|
||||
List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
|
||||
|
@ -13,5 +12,8 @@ public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
|
|||
|
||||
List<ConcDtoXe> getConc(Map<String,Object> params, Set<String> nuclides);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
|
||||
|
||||
List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
|
||||
|
@ -13,5 +12,8 @@ public interface IGardsXeResultsManService extends IService<GardsXeResults> {
|
|||
|
||||
List<ConcDtoXe> getConc(Map<String,Object> params, Set<String> nuclides);
|
||||
|
||||
List<String> nuclideNames(Set<String> nuclideNames);
|
||||
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
|
||||
|
||||
List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISysEmailLogService extends IService<SysEmailLog> {
|
||||
|
@ -16,4 +17,6 @@ public interface ISysEmailLogService extends IService<SysEmailLog> {
|
|||
Result<?> todayMin(String emailId);
|
||||
|
||||
Result<?> analysis(String emailId, String startDate, String endDate);
|
||||
|
||||
Integer getMinus(String emailId);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.modules.feignclient.SystemClient;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -26,25 +27,51 @@ public class AnalysisResultServiceImpl implements AnalysisResultService {
|
|||
|
||||
|
||||
@Override
|
||||
public List<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
|
||||
public List<String> nuclideExist(String betaOrGamma, String dataSourceType,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsAutoService.nuclideNames(nuclideNames);
|
||||
return xeResultsAutoService.nuclideExist(sampleId, nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedAutoService.nuclideNames(nuclideNames);
|
||||
return nuclIdedAutoService.nuclideExist(sampleId, nuclideNames);
|
||||
}else {
|
||||
return ListUtil.toList(nuclideNames);
|
||||
return ListUtil.empty();
|
||||
}
|
||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsManService.nuclideNames(nuclideNames);
|
||||
return xeResultsManService.nuclideExist(sampleId, nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedManService.nuclideNames(nuclideNames);
|
||||
return nuclIdedManService.nuclideExist(sampleId, nuclideNames);
|
||||
}else {
|
||||
return ListUtil.toList(nuclideNames);
|
||||
return ListUtil.empty();
|
||||
}
|
||||
}else {
|
||||
return ListUtil.toList(nuclideNames);
|
||||
return ListUtil.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideFirst(String betaOrGamma, String dataSourceType,
|
||||
String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsAutoService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedAutoService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
|
||||
}else {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsManService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedManService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
|
||||
}else {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
}else {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;
|
||||
|
@ -13,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
@ -30,7 +36,34 @@ public class GardsNuclIdedAutoServiceImpl extends ServiceImpl<GardsNuclIdedAutoM
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||
return baseMapper.nuclideNames(nuclideNames);
|
||||
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsNuclIded::getSampleId, sampleId);
|
||||
wrapper.in(GardsNuclIded::getNuclideName, nuclideNames);
|
||||
List<GardsNuclIded> nuclIdeds = this.list(wrapper);
|
||||
// 判断核素是否存在的条件: 该核素Conc值是否大于MDC值
|
||||
Set<String> existNuclides = nuclIdeds.stream()
|
||||
.filter(item -> NumberUtil.isNumber(item.getConcentration()))
|
||||
.filter(item -> NumberUtil.isNumber(item.getMdc()))
|
||||
.filter(item -> NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
|
||||
.map(GardsNuclIded::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return ListUtil.toList(existNuclides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
|
||||
// 获取除了当前谱的所有存在的核素
|
||||
Set<String> notCurrent = sampNucls.stream()
|
||||
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 获取当前谱的所有存在的核素
|
||||
Set<String> current = sampNucls.stream()
|
||||
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
|
||||
return CollUtil.subtractToList(current, notCurrent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
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.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
|
||||
import org.jeecg.modules.mapper.GardsNuclIdedManMapper;
|
||||
import org.jeecg.modules.service.IGardsNuclIdedManService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
@ -28,7 +33,34 @@ public class GardsNuclIdedManServiceImpl extends ServiceImpl<GardsNuclIdedManMap
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||
return baseMapper.nuclideNames(nuclideNames);
|
||||
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsNuclIded::getSampleId, sampleId);
|
||||
wrapper.in(GardsNuclIded::getNuclideName, nuclideNames);
|
||||
List<GardsNuclIded> nuclIdeds = this.list(wrapper);
|
||||
// 判断核素是否存在的条件: 该核素Conc值是否大于MDC值
|
||||
Set<String> existNuclides = nuclIdeds.stream()
|
||||
.filter(item -> NumberUtil.isNumber(item.getConcentration()))
|
||||
.filter(item -> NumberUtil.isNumber(item.getMdc()))
|
||||
.filter(item -> NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
|
||||
.map(GardsNuclIded::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return ListUtil.toList(existNuclides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
|
||||
// 获取除了当前谱的所有存在的核素
|
||||
Set<String> notCurrent = sampNucls.stream()
|
||||
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 获取当前谱的所有存在的核素
|
||||
Set<String> current = sampNucls.stream()
|
||||
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
|
||||
return CollUtil.subtractToList(current, notCurrent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsXeResultsAutoMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsAutoService;
|
||||
|
@ -51,7 +53,33 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||
return baseMapper.nuclideNames(nuclideNames);
|
||||
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsXeResults::getSampleId, sampleId);
|
||||
wrapper.in(GardsXeResults::getNuclideName, nuclideNames);
|
||||
List<GardsXeResults> xeResults = this.list(wrapper);
|
||||
// 判断核素是否存在的条件: 该核素NidFlag值是否为1
|
||||
Set<String> existNuclides = xeResults.stream()
|
||||
.filter(item -> ObjectUtil.isNotNull(item.getNidFlag()))
|
||||
.filter(item -> item.getNidFlag() == 1)
|
||||
.map(GardsXeResults::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return ListUtil.toList(existNuclides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
|
||||
// 获取除了当前谱的所有存在的核素
|
||||
Set<String> notCurrent = sampNucls.stream()
|
||||
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 获取当前谱的所有存在的核素
|
||||
Set<String> current = sampNucls.stream()
|
||||
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
|
||||
return CollUtil.subtractToList(current, notCurrent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.dto.SampNucl;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsXeResultsManMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsManService;
|
||||
|
@ -51,7 +53,33 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||
return baseMapper.nuclideNames(nuclideNames);
|
||||
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsXeResults::getSampleId, sampleId);
|
||||
wrapper.in(GardsXeResults::getNuclideName, nuclideNames);
|
||||
List<GardsXeResults> xeResults = this.list(wrapper);
|
||||
// 判断核素是否存在的条件: 该核素NidFlag值是否为1
|
||||
Set<String> existNuclides = xeResults.stream()
|
||||
.filter(item -> ObjectUtil.isNotNull(item.getNidFlag()))
|
||||
.filter(item -> item.getNidFlag() == 1)
|
||||
.map(GardsXeResults::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return ListUtil.toList(existNuclides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> nuclideFirst(String stationId, String detectorId,
|
||||
String sampleId, Set<String> nuclideNames) {
|
||||
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
|
||||
// 获取除了当前谱的所有存在的核素
|
||||
Set<String> notCurrent = sampNucls.stream()
|
||||
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 获取当前谱的所有存在的核素
|
||||
Set<String> current = sampNucls.stream()
|
||||
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
|
||||
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
|
||||
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
|
||||
return CollUtil.subtractToList(current, notCurrent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -227,4 +230,20 @@ public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEm
|
|||
result.put("yData",yData);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMinus(String emailId) {
|
||||
LambdaQueryWrapper<SysEmailLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysEmailLog::getEmailId, emailId);
|
||||
wrapper.orderByDesc(SysEmailLog::getCreateTime);
|
||||
wrapper.last("limit 1");
|
||||
SysEmailLog emailLog = getOne(wrapper, false);
|
||||
if (ObjectUtil.isNull(emailLog))
|
||||
return -1;
|
||||
Date createTime = emailLog.getCreateTime();
|
||||
if (ObjectUtil.isNull(createTime))
|
||||
return -1;
|
||||
// 获取最新一条数据和当前时间所间隔的分钟数
|
||||
return Math.toIntExact(DateUtil.between(createTime, new Date(), DateUnit.MINUTE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
@ -44,7 +43,6 @@ import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
|
|||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
|
@ -301,7 +299,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
Result result = new Result();
|
||||
List<Map<String, Object>> resultList = new LinkedList<>();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
String filePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
|
||||
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
|
||||
String sampleRx = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.PHD";
|
||||
Pattern regexPattern = Pattern.compile(sampleRx);
|
||||
String sampleRx1 = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.\\d+\\.PHD";
|
||||
|
@ -482,9 +480,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
betaDataFile.setSampleId(String.valueOf(sampleId));
|
||||
//判断sample信息是否存在
|
||||
if (Objects.nonNull(sample)) {
|
||||
betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getSampleFilePath());
|
||||
betaDataFile.setSampleFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getSampleFilePath());
|
||||
betaDataFile.setSampleFileName(sampleFileName);
|
||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName());
|
||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(sampleTmp)) {
|
||||
//sample临时文件路径存储
|
||||
betaDataFile.setSampleTmpPath(sampleTmp.getAbsolutePath());
|
||||
|
@ -519,9 +517,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//判断gas信息是否存在
|
||||
if (Objects.nonNull(gasBg)) {
|
||||
betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getGasBgFilePath());
|
||||
betaDataFile.setGasFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getGasBgFilePath());
|
||||
betaDataFile.setGasFileName(gasFileName);
|
||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName());
|
||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(gasTmp)) {
|
||||
//存储gas临时文件路径
|
||||
betaDataFile.setGasTmpPath(gasTmp.getAbsolutePath());
|
||||
|
@ -556,9 +554,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//判断det信息是否存在
|
||||
if (Objects.nonNull(detBg)) {
|
||||
betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getDetBgFilePath());
|
||||
betaDataFile.setDetFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getDetBgFilePath());
|
||||
betaDataFile.setDetFileName(detFileName);
|
||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName());
|
||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(detTmp)) {
|
||||
//存储det临时文件路径
|
||||
betaDataFile.setDetTmpPath(detTmp.getAbsolutePath());
|
||||
|
@ -593,9 +591,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//判断qc信息是否存在
|
||||
if (Objects.nonNull(qc)) {
|
||||
betaDataFile.setQcFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbQcFilePath);
|
||||
betaDataFile.setQcFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbQcFilePath);
|
||||
betaDataFile.setQcFileName(qcFileName);
|
||||
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName());
|
||||
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(qcTmp)) {
|
||||
betaDataFile.setQcTmpPath(qcTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(qcTmp.getAbsolutePath());
|
||||
|
@ -673,7 +671,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
//获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//上传文件路径
|
||||
String path = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
Map<String, Object> sampleMap = new HashMap<>();
|
||||
Map<String, Object> gasBgMap = new HashMap<>();
|
||||
|
@ -785,7 +783,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
File file = null;
|
||||
try {
|
||||
//根据完整的文件路径 获取临时文件
|
||||
file = ftpUtil.downloadFile(filePathName);
|
||||
file = ftpUtil.downloadFile(filePathName, "betaGamma");
|
||||
if (Objects.nonNull(file)) {
|
||||
if (type.equalsIgnoreCase("sample")) {
|
||||
betaDataFile.setSampleTmpPath(file.getAbsolutePath());
|
||||
|
@ -882,6 +880,26 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
String betaKey = sampleFileName + "-" + userName;
|
||||
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||
BetaDataFile betaDataFile = cache.getIfPresent(betaKey);
|
||||
String sampleTmpPath = betaDataFile.getSampleTmpPath();
|
||||
if (StringUtils.isNotBlank(sampleTmpPath)) {
|
||||
File file = new File(sampleTmpPath);
|
||||
file.delete();
|
||||
}
|
||||
String gasTmpPath = betaDataFile.getGasTmpPath();
|
||||
if (StringUtils.isNotBlank(gasTmpPath)) {
|
||||
File file = new File(gasTmpPath);
|
||||
file.delete();
|
||||
}
|
||||
String detTmpPath = betaDataFile.getDetTmpPath();
|
||||
if (StringUtils.isNotBlank(detTmpPath)) {
|
||||
File file = new File(detTmpPath);
|
||||
file.delete();
|
||||
}
|
||||
String qcTmpPath = betaDataFile.getQcTmpPath();
|
||||
if (StringUtils.isNotBlank(qcTmpPath)) {
|
||||
File file = new File(qcTmpPath);
|
||||
file.delete();
|
||||
}
|
||||
betaCache.deleteBetaCache(betaKey);
|
||||
}
|
||||
|
||||
|
@ -930,7 +948,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
InputStream inputStream = null;
|
||||
ServletOutputStream outputStream = null;
|
||||
try {
|
||||
inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt");
|
||||
inputStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt");
|
||||
if (Objects.nonNull(inputStream)){
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
|
@ -4005,7 +4023,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
InputStream inputStream = null;
|
||||
ServletOutputStream outputStream = null;
|
||||
try {
|
||||
inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath);
|
||||
inputStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath);
|
||||
if (Objects.nonNull(inputStream)){
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
|
@ -4284,68 +4302,55 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//上传本次文件到ftp人工交互存储路径下
|
||||
try {
|
||||
if (StringUtils.isNotBlank(sampleFilePathName)) {
|
||||
//sample文件的saveFile存储路径
|
||||
String saveSamplePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName;
|
||||
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath()) && !saveSamplePath.equals(betaDataFile.getSampleTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
|
||||
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||
File sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||
ftpUtil.saveFile(saveSamplePath, new FileInputStream(sampleTmp));
|
||||
ftpUtil.saveFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(gasFilePathName)) {
|
||||
//gas文件的saveFile存储路径
|
||||
String saveGasPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName;
|
||||
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath()) && !saveGasPath.equals(betaDataFile.getGasTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
|
||||
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||
File gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||
ftpUtil.saveFile(saveGasPath, new FileInputStream(gasTmp));
|
||||
ftpUtil.saveFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(detFilePathName)) {
|
||||
//det文件的saveFile存储路径
|
||||
String saveDetPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName;
|
||||
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath()) && !saveDetPath.equals(betaDataFile.getDetTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
|
||||
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||
File detTmp = new File(betaDataFile.getDetTmpPath());
|
||||
ftpUtil.saveFile(saveDetPath, new FileInputStream(detTmp));
|
||||
ftpUtil.saveFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(qcFilePathName)) {
|
||||
//qc文件的saveFile存储路径
|
||||
String saveQcPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName;
|
||||
if (StringUtils.isNotBlank(betaDataFile.getQcTmpPath()) && !saveQcPath.equals(betaDataFile.getQcTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
|
||||
if (StringUtils.isNotBlank(betaDataFile.getQcTmpPath())) {
|
||||
File qcTmp = new File(betaDataFile.getQcTmpPath());
|
||||
ftpUtil.saveFile(saveQcPath, new FileInputStream(qcTmp));
|
||||
}
|
||||
ftpUtil.saveFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName.substring(0, qcFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getQcFileName(), new FileInputStream(qcTmp));
|
||||
}
|
||||
//分析成功后存储日志文件和报告文件
|
||||
{
|
||||
String logFileName = betaDataFile.getSampleFileName().replace("PHD", "log");
|
||||
String logPathName = analyses_absolute_LogPath.substring(0, analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH));
|
||||
String logFileName = analyses_absolute_LogPath.substring(analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1);
|
||||
//获取日志的文件存放路径
|
||||
String logFilePath = parameterProperties.getLogFilePath() + File.separator + DateUtils.formatDate(new Date(), "yyyy-MM-dd");
|
||||
String localLogName = betaDataFile.getSampleFileName().replace("PHD", "log");
|
||||
//判断文件路径是否存在
|
||||
File logPath = new File(logFilePath);
|
||||
if (!logPath.exists()) {
|
||||
logPath.mkdirs();
|
||||
}
|
||||
File logFile = new File(logFilePath + File.separator +logFileName);
|
||||
File logFile = new File(logFilePath + File.separator +localLogName);
|
||||
try {
|
||||
//判断日志文件是否存在 如果不存在创建一个空的文件 上传到ftp
|
||||
if (!logFile.exists()) {
|
||||
FileUtil.writeString("", logFile, "UTF-8");
|
||||
}
|
||||
FileInputStream in = new FileInputStream(logFile);
|
||||
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_LogPath, in);
|
||||
ftpUtil.saveFile(logPathName, logFileName, in);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
{
|
||||
String rptContent = phdFileUtil.OutPutRnRpt(betaDataFile);
|
||||
String rptPathName = analyses_absolute_ReportPath.substring(0, analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH));
|
||||
String rptFileName = analyses_absolute_ReportPath.substring(analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
|
||||
File rptFile = new File(rptFileName);
|
||||
try {
|
||||
FileUtil.writeString(rptContent, rptFile, "UTF-8");
|
||||
FileInputStream in = new FileInputStream(rptFile);
|
||||
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_ReportPath+".txt", in);
|
||||
ftpUtil.saveFile(rptPathName, rptFileName, in);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
|
@ -4420,7 +4425,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
String error = "get station_id or detect_id error";
|
||||
return false;
|
||||
}
|
||||
betaDataFile.setDetectorId(detectorId.toString());
|
||||
//新增Gards_Sample_Data表数据
|
||||
sampleDataSpectrumService.saveSampleData(sourceData, stationId, detectorId, filePathName, readLines);
|
||||
//获取sampleId
|
||||
|
|
|
@ -43,4 +43,8 @@ public interface AbnormalAlarmClient {
|
|||
/* SysServerController下相关接口 */
|
||||
@GetMapping("/sysServer/getNameById")
|
||||
String getServerName(@RequestParam String id);
|
||||
|
||||
/* SysEmailLogController下相关接口 */
|
||||
@GetMapping("/sysEmailLog/getMinus")
|
||||
Integer getMinus(@RequestParam String emailId);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DatabaseJob extends Monitor {
|
|||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
if (!needWarn) continue;
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
|
@ -129,7 +129,6 @@ public class DatabaseJob extends Monitor {
|
|||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
}catch (FeignException.Unauthorized e){
|
||||
ManageUtil.refreshToken();
|
||||
log.warn("向运管系统查询ItemHistory信息异常: Token失效,已刷新Token");
|
||||
|
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
|
@ -18,13 +17,11 @@ import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
|||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
import org.jeecg.modules.base.enums.Item;
|
||||
import org.jeecg.modules.quartz.entity.Monitor;
|
||||
import org.quartz.*;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jeecg.modules.base.enums.SourceType.EMAIL;
|
||||
import static org.jeecg.modules.base.enums.Template.MONITOR_EMAIL;
|
||||
|
@ -32,6 +29,7 @@ import static org.jeecg.modules.base.enums.Template.MONITOR_EMAIL;
|
|||
@Slf4j
|
||||
@Component
|
||||
public class EmailJob extends Monitor{
|
||||
|
||||
/**
|
||||
* 解析Email预警规则
|
||||
**/
|
||||
|
@ -69,8 +67,11 @@ public class EmailJob extends Monitor{
|
|||
if (ObjectUtil.isNull(item)) continue;
|
||||
Number current = null;
|
||||
switch (item){
|
||||
case EMAIL_CONN: // 监控项-1: 测试邮箱服务是否可以连接成功
|
||||
current = isConnection(sourceId);
|
||||
case EMAIL_CONN: // 监控项id 1: 测试邮箱服务是否可以连接成功
|
||||
current = connectionStatus(sourceId);
|
||||
break;
|
||||
case EMAIL_UNPROCESSED: // 监控项id 3: 邮箱邮件是否被自动处理程序处理
|
||||
current = unProcess(sourceId);
|
||||
break;
|
||||
// 追加的监控项...
|
||||
default:
|
||||
|
@ -82,7 +83,7 @@ public class EmailJob extends Monitor{
|
|||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
if (!needWarn) continue;
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
|
@ -106,7 +107,6 @@ public class EmailJob extends Monitor{
|
|||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Email预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
}catch (Exception e){
|
||||
|
@ -117,9 +117,9 @@ public class EmailJob extends Monitor{
|
|||
}
|
||||
|
||||
/*
|
||||
* 监控项-1: 测试邮箱服务是否可以连接成功 (0:失败 1:成功)
|
||||
* 监控项id: 1 测试邮箱服务是否可以连接成功 (预警值: 0 非0值则不需要报警)
|
||||
* */
|
||||
private Integer isConnection(String emailId){
|
||||
private Integer connectionStatus(String emailId){
|
||||
int res = 1;
|
||||
String statusKey = RedisConstant.EMAIL_STATUS;
|
||||
NameValue nameValue = (NameValue)getRedisUtil().hget(statusKey, emailId);
|
||||
|
@ -127,4 +127,11 @@ public class EmailJob extends Monitor{
|
|||
res = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* 监控项id: 3 邮箱邮件在一定时间内是否被自动处理程序处理
|
||||
* */
|
||||
private Integer unProcess(String emailId){
|
||||
return getAlarmClient().getMinus(emailId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ServerJob extends Monitor{
|
|||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
if (!needWarn) continue;
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
|
@ -126,7 +126,6 @@ public class ServerJob extends Monitor{
|
|||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
} catch (FeignException.Unauthorized e){
|
||||
ManageUtil.refreshToken();
|
||||
log.warn("向运管系统查询ItemHistory信息异常: Token失效,已刷新Token");
|
||||
|
|
|
@ -95,7 +95,7 @@ public class TableSpaceJob extends Monitor {
|
|||
}
|
||||
|
||||
// 如果当前值超过阈值 则需要发送报警信息
|
||||
if (needWarn){
|
||||
if (!needWarn) continue;
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
|
@ -119,7 +119,6 @@ public class TableSpaceJob extends Monitor {
|
|||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Database-TableSpace预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
}catch (Exception e){
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
|||
public class GardsSampleDataController {
|
||||
|
||||
@Autowired
|
||||
private IGardsSampleDataService gardsSampleDataService;
|
||||
private IGardsSampleDataService sampleDataService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class GardsSampleDataController {
|
|||
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest,
|
||||
GardsSampleDataSystem gardsSampleData,
|
||||
boolean collectStopCheck, boolean acqDotStartCheck){
|
||||
return gardsSampleDataService.findPage(queryRequest, gardsSampleData, collectStopCheck, acqDotStartCheck);
|
||||
return sampleDataService.findPage(queryRequest, gardsSampleData, collectStopCheck, acqDotStartCheck);
|
||||
}
|
||||
|
||||
@GetMapping("findStations")
|
||||
|
@ -49,7 +49,11 @@ public class GardsSampleDataController {
|
|||
@ApiOperation(value = "删除DATA_BASE数据", notes = "删除DATA_BASE数据")
|
||||
public Result<?> deleteById(@RequestParam Integer sampleId, boolean sampleData,
|
||||
boolean rnAuto, boolean rnMan){
|
||||
return gardsSampleDataService.deleteById(sampleId, sampleData, rnAuto, rnMan);
|
||||
return sampleDataService.deleteById(sampleId, sampleData, rnAuto, rnMan);
|
||||
}
|
||||
|
||||
@GetMapping("getDetectorId")
|
||||
public String getDetectorId(@RequestParam String sampleId){
|
||||
return sampleDataService.getDetectorId(sampleId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,6 @@ public interface IGardsSampleDataService extends IService<GardsSampleDataSystem>
|
|||
GardsSampleDataSystem getOne(Integer sampleId);
|
||||
|
||||
void delTables(List<String> tableNames, Integer sampleId);
|
||||
|
||||
String getDetectorId(String sampleId);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
|
@ -25,6 +26,7 @@ import org.jeecg.common.util.FTPUtil;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.dto.AnalysesDto;
|
||||
import org.jeecg.modules.base.dto.OwnerDto;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
|
||||
import org.jeecg.modules.system.entity.GardsSampleDataSystem;
|
||||
import org.jeecg.modules.system.mapper.GardsSampleDataMapper;
|
||||
|
@ -201,6 +203,15 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDetectorId(String sampleId) {
|
||||
LambdaQueryWrapper<GardsSampleDataSystem> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsSampleDataSystem::getSampleId, sampleId);
|
||||
Integer detectorId = Optional.of(this.getOne(wrapper, false))
|
||||
.orElse(new GardsSampleDataSystem()).getDetectorId();
|
||||
return ObjectUtil.isNull(detectorId) ? null : detectorId.toString();
|
||||
}
|
||||
|
||||
private String samplePath(String savePath, Integer sampleId){
|
||||
GardsSampleDataSystem sampleData = getOne(sampleId);
|
||||
String inputFileName = sampleData.getInputFileName();
|
||||
|
|
Loading…
Reference in New Issue
Block a user