Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
2bc6d4352b
|
@ -28,8 +28,8 @@ public enum MessageTypeEnum {
|
||||||
|
|
||||||
MessageTypeEnum(String type, String note, String value){
|
MessageTypeEnum(String type, String note, String value){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
|
||||||
this.note = note;
|
this.note = note;
|
||||||
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.common.util;
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.modules.base.dto.RuleDto;
|
import org.jeecg.modules.base.dto.RuleDto;
|
||||||
|
@ -159,7 +158,7 @@ public class RedisStreamUtil {
|
||||||
*
|
*
|
||||||
* @param ruleDto
|
* @param ruleDto
|
||||||
*/
|
*/
|
||||||
public String pushWarn(RuleDto ruleDto){
|
public String pushAlarm(RuleDto ruleDto){
|
||||||
String warnKey = RedisConstant.STREAM_ALARM;
|
String warnKey = RedisConstant.STREAM_ALARM;
|
||||||
ObjectRecord<String, RuleDto> record = StreamRecords.newRecord()
|
ObjectRecord<String, RuleDto> record = StreamRecords.newRecord()
|
||||||
.in(warnKey).ofObject(ruleDto);
|
.in(warnKey).ofObject(ruleDto);
|
||||||
|
@ -167,6 +166,14 @@ public class RedisStreamUtil {
|
||||||
return putRecord(record);
|
return putRecord(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String pushAnalysis(RuleDto ruleDto){
|
||||||
|
String analysisKey = RedisConstant.STREAM_ANALYSIS;
|
||||||
|
ObjectRecord<String, RuleDto> record = StreamRecords.newRecord()
|
||||||
|
.in(analysisKey).ofObject(ruleDto);
|
||||||
|
// 向Redis Stream中推送消息
|
||||||
|
return putRecord(record);
|
||||||
|
}
|
||||||
|
|
||||||
public void setSilence(Map<String, Long> silenceMap){
|
public void setSilence(Map<String, Long> silenceMap){
|
||||||
// 返回批处理的执行结果
|
// 返回批处理的执行结果
|
||||||
List<Object> execResult = redisTemplate.executePipelined((RedisConnection connection) -> {
|
List<Object> execResult = redisTemplate.executePipelined((RedisConnection connection) -> {
|
||||||
|
|
|
@ -14,31 +14,7 @@ public class NuclideInfo implements Serializable {
|
||||||
|
|
||||||
private String threshold;
|
private String threshold;
|
||||||
|
|
||||||
private String armdarr;
|
private String datasource;
|
||||||
|
|
||||||
private String armdrrr;
|
private String value;
|
||||||
|
|
||||||
private String idcarr;
|
|
||||||
|
|
||||||
private String idcrrr;
|
|
||||||
|
|
||||||
@JsonProperty("ARMDARR")
|
|
||||||
public void setArmdarr(String armdarr) {
|
|
||||||
this.armdarr = armdarr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty("ARMDRRR")
|
|
||||||
public void setArmdrrr(String armdrrr) {
|
|
||||||
this.armdrrr = armdrrr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty("IDCARR")
|
|
||||||
public void setIdcarr(String idcarr) {
|
|
||||||
this.idcarr = idcarr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty("IDCRRR")
|
|
||||||
public void setIdcrrr(String idcrrr) {
|
|
||||||
this.idcrrr = idcrrr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.base.dto;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.jeecg.modules.base.enums.SourceType;
|
import org.jeecg.modules.base.enums.SourceType;
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class RuleDto implements Serializable{
|
public class RuleDto implements Serializable{
|
||||||
// 资源类型
|
// 资源类型
|
||||||
|
@ -25,6 +27,9 @@ public class RuleDto implements Serializable{
|
||||||
// 台站id
|
// 台站id
|
||||||
private String stationId;
|
private String stationId;
|
||||||
|
|
||||||
|
// 谱id
|
||||||
|
private String sampleId;
|
||||||
|
|
||||||
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
|
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
|
||||||
private String dataSourceType;
|
private String dataSourceType;
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
package org.jeecg.modules.base.entity.postgre;
|
package org.jeecg.modules.base.entity.postgre;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
|
@ -28,15 +33,18 @@ public class AlarmAnalysisLog implements Serializable{
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date alarmStartDate;
|
private LocalDateTime alarmStartDate = LocalDateTime.now();
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date collectionDate;
|
private LocalDateTime collectionDate;
|
||||||
|
|
||||||
private String alarmInfo;
|
private String alarmInfo;
|
||||||
|
|
||||||
private Integer sampleId;
|
private String sampleId;
|
||||||
|
|
||||||
private String nuclideInfo;
|
private String nuclideInfo;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<NuclideInfo> nuclideInfoList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class GardsNuclIded implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 核素名称
|
* 核素名称
|
||||||
*/
|
*/
|
||||||
@TableField(value = "NUCLIDE_NAME")
|
@TableField(value = "NUCLIDENAME")
|
||||||
private String nuclideName;
|
private String nuclideName;
|
||||||
/**
|
/**
|
||||||
* 核素类型
|
* 核素类型
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class GardsNuclIded implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 核素名称
|
* 核素名称
|
||||||
*/
|
*/
|
||||||
@TableField(value = "NUCLIDE_NAME")
|
@TableField(value = "NUCLIDENAME")
|
||||||
private String nuclideName;
|
private String nuclideName;
|
||||||
/**
|
/**
|
||||||
* 核素类型
|
* 核素类型
|
||||||
|
|
|
@ -8,12 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
||||||
@Api(value = "",tags="")
|
@Api(value = "核素浓度均值信息管理",tags="核素浓度均值信息管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("alarmAnalysisNuclideAvg")
|
@RequestMapping("nuclideAvg")
|
||||||
public class AlarmAnalysisNuclideAvgController extends JeecgController<AlarmAnalysisNuclideAvg, IAlarmAnalysisNuclideAvgService> {
|
public class AlarmAnalysisNuclideAvgController extends JeecgController<AlarmAnalysisNuclideAvg, IAlarmAnalysisNuclideAvgService> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAlarmAnalysisNuclideAvgService alarmAnalysisNuclideAvgService;
|
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.controller;
|
package org.jeecg.modules.controller;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -10,13 +11,18 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(value = "", tags= "")
|
@Api(value = "核素浓度均值计算参数管理", tags= "核素浓度均值计算参数管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("alarmAnalysisNuclideParam")
|
@RequestMapping("nuclideParam")
|
||||||
public class AlarmAnalysisNuclideParamController extends JeecgController<AlarmAnalysisNuclideParam, IAlarmAnalysisNuclideParamService> {
|
public class AlarmAnalysisNuclideParamController extends JeecgController<AlarmAnalysisNuclideParam, IAlarmAnalysisNuclideParamService> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAlarmAnalysisNuclideParamService alarmAnalysisNuclideParamService;
|
private IAlarmAnalysisNuclideParamService nuclideParamService;
|
||||||
|
|
||||||
|
@GetMapping("refresh")
|
||||||
|
@ApiOperation(value = "定时刷新核素计算参数信息",notes = "定时刷新核素计算参数信息")
|
||||||
|
public void refreshParam(){
|
||||||
|
nuclideParamService.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.controller;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.modules.service.CalculateConcService;
|
import org.jeecg.modules.service.CalculateConcService;
|
||||||
|
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.controller;
|
package org.jeecg.modules.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("sysEmailLog")
|
@RequestMapping("sysEmailLog")
|
||||||
@Api(value = "邮箱日志服务", tags = "邮箱日志服务")
|
@Api(value = "邮箱日志服务", tags = "邮箱日志服务")
|
||||||
|
@ -33,7 +36,11 @@ public class SysEmailLogController {
|
||||||
@GetMapping("space")
|
@GetMapping("space")
|
||||||
@ApiOperation("邮箱服务器空间")
|
@ApiOperation("邮箱服务器空间")
|
||||||
public Result space(@RequestParam("emailId") String emailId){
|
public Result space(@RequestParam("emailId") String emailId){
|
||||||
return null;
|
HashMap<String, String> map = MapUtil.newHashMap();
|
||||||
|
map.put("total","500G");
|
||||||
|
map.put("residue","300G");
|
||||||
|
map.put("usage","74.3%");
|
||||||
|
return Result.OK(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("total")
|
@GetMapping("total")
|
||||||
|
|
|
@ -19,6 +19,11 @@ public interface SystemClient {
|
||||||
@RequestMapping("/sys/user/findUserMap")
|
@RequestMapping("/sys/user/findUserMap")
|
||||||
Map<String, SysUser> findUserMap();
|
Map<String, SysUser> findUserMap();
|
||||||
|
|
||||||
|
@GetMapping("/sys/sendMessage/send")
|
||||||
|
void sendMessage(@RequestParam String message,
|
||||||
|
@RequestParam String groupId,
|
||||||
|
@RequestParam String notific);
|
||||||
|
|
||||||
/* SysDictController下相关接口 */
|
/* SysDictController下相关接口 */
|
||||||
@GetMapping("/sys/dict/getItems")
|
@GetMapping("/sys/dict/getItems")
|
||||||
List<DictModel> getItems(@RequestParam String dictCode);
|
List<DictModel> getItems(@RequestParam String dictCode);
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
|
public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> param);
|
List<ConcDto> getConc(Map<String,Object> param);
|
||||||
|
|
||||||
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
|
public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> param);
|
List<ConcDto> getConc(Map<String,Object> param);
|
||||||
|
|
||||||
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
|
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
|
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
|
||||||
|
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||||
SELECT
|
SELECT
|
||||||
xe.NUCLIDE_NAME,
|
nucl.NUCLIDENAME,
|
||||||
xe.CONC,
|
nucl.CONCENTRATION AS CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN
|
||||||
FROM
|
FROM
|
||||||
RNAUTO.GARDS_XE_RESULTS xe
|
RNAUTO.GARDS_NUCL_IDED nucl
|
||||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND xe.NUCLIDE_NAME IN
|
AND nucl.NUCLIDENAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="nuclideNames" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
NUCLIDENAME
|
||||||
|
FROM
|
||||||
|
RNAUTO.GARDS_NUCL_IDED
|
||||||
|
WHERE
|
||||||
|
NUCLIDENAME IN
|
||||||
|
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||||
|
#{nuclideName}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
NUCLIDENAME
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,25 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
||||||
|
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||||
SELECT
|
SELECT
|
||||||
xe.NUCLIDE_NAME,
|
nucl.NUCLIDENAME,
|
||||||
xe.CONC,
|
nucl.CONCENTRATION AS CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN
|
||||||
FROM
|
FROM
|
||||||
RNMAN.GARDS_XE_RESULTS xe
|
RNMAN.GARDS_NUCL_IDED nucl
|
||||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND xe.NUCLIDE_NAME IN
|
AND nucl.NUCLIDENAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="nuclideNames" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
NUCLIDENAME
|
||||||
|
FROM
|
||||||
|
RNMAN.GARDS_NUCL_IDED
|
||||||
|
WHERE
|
||||||
|
NUCLIDENAME IN
|
||||||
|
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||||
|
#{nuclideName}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
NUCLIDENAME
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -4,22 +4,36 @@
|
||||||
|
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||||
SELECT
|
SELECT
|
||||||
nucl.NUCLIDENAME,
|
xe.NUCLIDE_NAME,
|
||||||
nucl.CONCENTRATION AS CONC,
|
xe.CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN
|
||||||
FROM
|
FROM
|
||||||
RNAUTO.GARDS_NUCL_IDED nucl
|
RNAUTO.GARDS_XE_RESULTS xe
|
||||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND nucl.NUCLIDENAME IN
|
AND xe.NUCLIDE_NAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="nuclideNames" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
NUCLIDE_NAME
|
||||||
|
FROM
|
||||||
|
RNAUTO.GARDS_XE_RESULTS
|
||||||
|
WHERE
|
||||||
|
NUCLIDE_NAME IN
|
||||||
|
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||||
|
#{nuclideName}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
NUCLIDE_NAME
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,25 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
||||||
|
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||||
SELECT
|
SELECT
|
||||||
nucl.NUCLIDENAME,
|
xe.NUCLIDE_NAME,
|
||||||
nucl.CONCENTRATION AS CONC,
|
xe.CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN
|
||||||
FROM
|
FROM
|
||||||
RNMAN.GARDS_NUCL_IDED nucl
|
RNMAN.GARDS_XE_RESULTS xe
|
||||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND nucl.NUCLIDENAME IN
|
AND xe.NUCLIDE_NAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="nuclideNames" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
NUCLIDE_NAME
|
||||||
|
FROM
|
||||||
|
RNMAN.GARDS_XE_RESULTS
|
||||||
|
WHERE
|
||||||
|
NUCLIDE_NAME IN
|
||||||
|
<foreach collection="nuclideNames" separator="," item="nuclideName" index="index" open="(" close=")">
|
||||||
|
#{nuclideName}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
NUCLIDE_NAME
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -7,9 +7,12 @@ import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
@ -18,9 +21,12 @@ import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.base.dto.NuclideInfo;
|
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||||
import org.jeecg.modules.base.dto.RuleDto;
|
import org.jeecg.modules.base.dto.RuleDto;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||||
|
import org.jeecg.modules.feignclient.SystemClient;
|
||||||
import org.jeecg.modules.service.AnalysisResultService;
|
import org.jeecg.modules.service.AnalysisResultService;
|
||||||
|
import org.jeecg.modules.service.IAlarmAnalysisLogService;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -28,8 +34,12 @@ import org.springframework.data.redis.connection.stream.ObjectRecord;
|
||||||
import org.springframework.data.redis.connection.stream.RecordId;
|
import org.springframework.data.redis.connection.stream.RecordId;
|
||||||
import org.springframework.data.redis.stream.StreamListener;
|
import org.springframework.data.redis.stream.StreamListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import static org.jeecg.common.constant.enums.MessageTypeEnum.*;
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -43,12 +53,11 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
|
|
||||||
private String consumerName;
|
private String consumerName;
|
||||||
|
|
||||||
|
private SystemClient systemClient;
|
||||||
private RedisStreamUtil redisStreamUtil;
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
private IAlarmAnalysisLogService logService;
|
||||||
private IAlarmAnalysisRuleService ruleService;
|
private IAlarmAnalysisRuleService ruleService;
|
||||||
|
|
||||||
private AnalysisResultService analysisResultService;
|
private AnalysisResultService analysisResultService;
|
||||||
|
|
||||||
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
|
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
|
||||||
|
|
||||||
private final String comma = SymbolConstant.COMMA;
|
private final String comma = SymbolConstant.COMMA;
|
||||||
|
@ -83,24 +92,42 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
}catch (RuntimeException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void consume(RuleDto ruleDto){
|
private void consume(RuleDto ruleDto){
|
||||||
String stationId = ruleDto.getStationId();
|
String stationId = ruleDto.getStationId();
|
||||||
|
String sampleId = ruleDto.getSampleId();
|
||||||
|
String fullOrPrel = ruleDto.getFullOrPrel();
|
||||||
|
String betaOrGamma = ruleDto.getBetaOrGamma();
|
||||||
|
String dataSourceType = ruleDto.getDataSourceType();
|
||||||
Map<String, String> nuclides = ruleDto.getNuclides();
|
Map<String, String> nuclides = ruleDto.getNuclides();
|
||||||
if (StrUtil.isBlank(stationId)) return;
|
if (StrUtil.isBlank(stationId)) return;
|
||||||
|
if (StrUtil.isBlank(sampleId)) return;
|
||||||
if (MapUtil.isEmpty(nuclides)) return;
|
if (MapUtil.isEmpty(nuclides)) return;
|
||||||
List<AlarmAnalysisRule> rules = ruleService.allAnalysisRule();
|
List<AlarmAnalysisRule> rules = ruleService.allAnalysisRule();
|
||||||
for (AlarmAnalysisRule rule : rules) {
|
for (AlarmAnalysisRule rule : rules) {
|
||||||
|
// 当前规则是否有报警条件
|
||||||
String conditionStr = rule.getConditions();
|
String conditionStr = rule.getConditions();
|
||||||
if (StrUtil.isBlank(conditionStr)) continue;
|
if (StrUtil.isBlank(conditionStr)) continue;
|
||||||
|
// 是否在当前规则关注的台站列表内
|
||||||
String stations = rule.getStations();
|
String stations = rule.getStations();
|
||||||
boolean shot = StrUtil.contains(stations, stationId);
|
if (!StrUtil.contains(stations, stationId))
|
||||||
if (!shot) continue;
|
continue;
|
||||||
Set<String> names = nuclides.keySet();
|
// 是否在当前规则关注的数据源内
|
||||||
|
String source = rule.getSource();
|
||||||
|
if (!StrUtil.contains(source,dataSourceType))
|
||||||
|
continue;
|
||||||
|
// 是否在当前规则关注的谱类型内
|
||||||
|
String spectralQualifier = rule.getSpectralQualifier();
|
||||||
|
if (!StrUtil.contains(spectralQualifier,fullOrPrel))
|
||||||
|
continue;
|
||||||
|
// 是否有当前规则关注的核素
|
||||||
String nuclidesStr = rule.getNuclides();
|
String nuclidesStr = rule.getNuclides();
|
||||||
if (StrUtil.isBlank(nuclidesStr)) continue;
|
if (StrUtil.isBlank(nuclidesStr)) continue;
|
||||||
|
Set<String> names = nuclides.keySet();
|
||||||
List<String> follow = ListUtil.toList(nuclidesStr.split(comma));
|
List<String> follow = ListUtil.toList(nuclidesStr.split(comma));
|
||||||
// 推送过来的核素集合与所关注核素集合取交集
|
// 推送过来的核素集合与所关注核素集合取交集
|
||||||
Collection<String> cross = CollectionUtil.intersection(names, follow);
|
Collection<String> cross = CollectionUtil.intersection(names, follow);
|
||||||
|
@ -110,39 +137,63 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
// 开始对交集中的核素进行条件判断
|
// 开始对交集中的核素进行条件判断
|
||||||
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
|
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
|
||||||
|
String ruleId = rule.getId();
|
||||||
|
String groupId = rule.getContactGroup();
|
||||||
|
judge(ruleId,groupId,sampleId,betaOrGamma,dataSourceType,conditions,nuclidesCross);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judge(String betaOrGamma,
|
private void judge(String ruleId,
|
||||||
|
String groupId,
|
||||||
|
String sampleId,
|
||||||
|
String betaOrGamma,
|
||||||
String dataSourceType,
|
String dataSourceType,
|
||||||
List<String> conditions,
|
List<String> conditions,
|
||||||
Map<String,String> nuclides){
|
Map<String,String> nuclidesCross){
|
||||||
String ONE = "1";String TWO = "2";String THREE = "3";
|
String ONE = "1";String TWO = "2";String THREE = "3";
|
||||||
Set<String> nuclideNames = nuclides.keySet();
|
Set<String> nuclideNames = nuclidesCross.keySet();
|
||||||
|
String alarmInfo = "";
|
||||||
List<String> firstDetected;
|
List<String> firstDetected;
|
||||||
List<NuclideInfo> moreThanAvg;
|
List<NuclideInfo> moreThanAvg = new ArrayList<>();
|
||||||
List<String> twoOrMore;
|
|
||||||
for (String con : conditions) {
|
for (String con : conditions) {
|
||||||
if (ONE.equals(con)){ // 首次发现该元素
|
if (ONE.equals(con)){ // 首次发现该元素
|
||||||
firstDetected = firstDetected(betaOrGamma,dataSourceType,nuclideNames);
|
firstDetected = firstDetected(betaOrGamma,dataSourceType,nuclideNames);
|
||||||
if (CollUtil.isNotEmpty(firstDetected)){
|
if (CollUtil.isNotEmpty(firstDetected)){
|
||||||
String message = "核素:["+StrUtil.join(comma,firstDetected)+"]首次发现";
|
String message = "核素"+StrUtil.join(comma,firstDetected)+"首次发现";
|
||||||
|
alarmInfo += message;
|
||||||
}
|
}
|
||||||
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
||||||
moreThanAvg = moreThanAvg(dataSourceType,nuclides);
|
moreThanAvg = moreThanAvg(dataSourceType,nuclidesCross);
|
||||||
if (CollUtil.isNotEmpty(moreThanAvg)){
|
if (CollUtil.isNotEmpty(moreThanAvg)){
|
||||||
|
for (NuclideInfo nuclideInfo : moreThanAvg) {
|
||||||
|
String nuclide = nuclideInfo.getNuclide();
|
||||||
|
String threshold = nuclideInfo.getThreshold();
|
||||||
|
String message = "核素"+nuclide+"超出平均值:"+threshold;
|
||||||
|
alarmInfo += comma + message;
|
||||||
}
|
}
|
||||||
} else if (THREE.equals(con)) { // 发现两种及以上核素
|
}
|
||||||
twoOrMore = twoOrMore(betaOrGamma,dataSourceType,nuclideNames);
|
} else if (THREE.equals(con)) { // 同时出现两种及以上核素
|
||||||
if (twoOrMore.size() >= 2){
|
if (nuclideNames.size() >= 2){
|
||||||
String message = "同时检测到核素:["+StrUtil.join(comma,twoOrMore)+"]";
|
String message = "同时检测到核素"+StrUtil.join(comma,nuclideNames);
|
||||||
|
alarmInfo += comma + message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(alarmInfo)){
|
||||||
|
// 保存报警日志
|
||||||
|
AlarmAnalysisLog logInfo = new AlarmAnalysisLog();
|
||||||
|
logInfo.setRuleId(ruleId);
|
||||||
|
logInfo.setSampleId(sampleId);
|
||||||
|
if (alarmInfo.startsWith(comma))
|
||||||
|
alarmInfo = StrUtil.sub(alarmInfo, 1, alarmInfo.length());
|
||||||
|
logInfo.setAlarmInfo(alarmInfo);
|
||||||
|
if (CollUtil.isNotEmpty(moreThanAvg))
|
||||||
|
logInfo.setNuclideInfoList(moreThanAvg);
|
||||||
|
logService.saveLog(logInfo);
|
||||||
|
// 发送报警信息
|
||||||
|
if (StrUtil.isNotBlank(groupId))
|
||||||
|
systemClient.sendMessage(alarmInfo,groupId, ALL.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +202,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
private List<String> firstDetected(String betaOrGamma,
|
private List<String> firstDetected(String betaOrGamma,
|
||||||
String dataSourceType,
|
String dataSourceType,
|
||||||
Set<String> nuclideNames){
|
Set<String> nuclideNames){
|
||||||
Set<String> existNames = analysisResultService
|
List<String> existNames = analysisResultService
|
||||||
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
||||||
// 两个集合元素相减
|
// 两个集合元素相减
|
||||||
List<String> differ = CollUtil.subtractToList(nuclideNames, existNames);
|
List<String> differ = CollUtil.subtractToList(nuclideNames, existNames);
|
||||||
|
@ -162,14 +213,14 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
* 核素值大于历史浓度均值
|
* 核素值大于历史浓度均值
|
||||||
*/
|
*/
|
||||||
private List<NuclideInfo> moreThanAvg(String dataSourceType,
|
private List<NuclideInfo> moreThanAvg(String dataSourceType,
|
||||||
Map<String,String> nuclides){
|
Map<String,String> nuclidesCross){
|
||||||
List<NuclideInfo> nuclideInfos = new ArrayList<>();
|
List<NuclideInfo> nuclideInfos = new ArrayList<>();
|
||||||
Set<String> nuclideNames = nuclides.keySet();
|
Set<String> nuclideNames = nuclidesCross.keySet();
|
||||||
Map<String, String> nuclideAvgs = nuclideAvgService
|
Map<String, String> nuclideAvgs = nuclideAvgService
|
||||||
.list(nuclideNames, dataSourceType).stream()
|
.list(nuclideNames, dataSourceType).stream()
|
||||||
.collect(Collectors.toMap(AlarmAnalysisNuclideAvg::getNuclide,
|
.collect(Collectors.toMap(AlarmAnalysisNuclideAvg::getNuclide,
|
||||||
AlarmAnalysisNuclideAvg::getVal));
|
AlarmAnalysisNuclideAvg::getVal));
|
||||||
for (Map.Entry<String, String> nuclide : nuclides.entrySet()) {
|
for (Map.Entry<String, String> nuclide : nuclidesCross.entrySet()) {
|
||||||
String nuclideName = nuclide.getKey();
|
String nuclideName = nuclide.getKey();
|
||||||
String concValue = nuclide.getValue();// 浓度值
|
String concValue = nuclide.getValue();// 浓度值
|
||||||
String avgValue = nuclideAvgs.get(nuclideName);// 浓度均值
|
String avgValue = nuclideAvgs.get(nuclideName);// 浓度均值
|
||||||
|
@ -184,32 +235,42 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
continue;
|
continue;
|
||||||
NuclideInfo nuclideInfo = new NuclideInfo();
|
NuclideInfo nuclideInfo = new NuclideInfo();
|
||||||
nuclideInfo.setNuclide(nuclideName);
|
nuclideInfo.setNuclide(nuclideName);
|
||||||
nuclideInfo.setThreshold(avgValue);
|
nuclideInfo.setThreshold(avg.toString());
|
||||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
nuclideInfo.setDatasource(type(dataSourceType));
|
||||||
nuclideInfo.setArmdarr(concValue);
|
nuclideInfo.setValue(conc.toString());
|
||||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
|
||||||
nuclideInfo.setArmdrrr(concValue);
|
|
||||||
}
|
|
||||||
nuclideInfos.add(nuclideInfo);
|
nuclideInfos.add(nuclideInfo);
|
||||||
}
|
}
|
||||||
return nuclideInfos;
|
return nuclideInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private String type(String dataSourceType){
|
||||||
* 同时检测到两种或以上核素
|
switch (dataSourceType){
|
||||||
*/
|
case CommonConstant.ARMDARR:
|
||||||
private List<String> twoOrMore(String betaOrGamma,
|
return "ARMDARR";
|
||||||
String dataSourceType,
|
case CommonConstant.ARMDRRR:
|
||||||
Set<String> nuclideNames){
|
return "ARMDRRR";
|
||||||
Set<String> existNames = analysisResultService
|
case CommonConstant.IDCARR:
|
||||||
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
return "IDCARR";
|
||||||
return ListUtil.toList(existNames);
|
case CommonConstant.IDCRRR:
|
||||||
|
return "IDCRRR";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
// start:生成临时Token到线程中
|
||||||
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
systemClient = SpringContextUtils.getBean(SystemClient.class);
|
||||||
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
||||||
ruleService = SpringContextUtils.getBean(IAlarmAnalysisRuleService.class);
|
logService = SpringContextUtils.getBean(IAlarmAnalysisLogService.class);
|
||||||
analysisResultService = SpringContextUtils.getBean(AnalysisResultService.class);
|
analysisResultService = SpringContextUtils.getBean(AnalysisResultService.class);
|
||||||
|
ruleService = SpringContextUtils.getBean(IAlarmAnalysisRuleService.class);
|
||||||
nuclideAvgService = SpringContextUtils.getBean(IAlarmAnalysisNuclideAvgService.class);
|
nuclideAvgService = SpringContextUtils.getBean(IAlarmAnalysisNuclideAvgService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void destroy(){
|
||||||
|
// end:删除临时Token
|
||||||
|
UserTokenContext.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package org.jeecg.modules.service;
|
package org.jeecg.modules.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface AnalysisResultService {
|
public interface AnalysisResultService {
|
||||||
|
|
||||||
Set<String> nuclideNames(String betaOrGamma,
|
List<String> nuclideNames(String betaOrGamma,
|
||||||
String dataSourceType,
|
String dataSourceType,
|
||||||
Set<String> nuclideNames);
|
Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,6 @@ import org.jeecg.modules.base.vo.AnalysisLogVo;
|
||||||
public interface IAlarmAnalysisLogService extends IService<AlarmAnalysisLog> {
|
public interface IAlarmAnalysisLogService extends IService<AlarmAnalysisLog> {
|
||||||
|
|
||||||
Result findPage(AnalysisLogVo analysisLogVo);
|
Result findPage(AnalysisLogVo analysisLogVo);
|
||||||
|
|
||||||
|
boolean saveLog(AlarmAnalysisLog analysisLog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ public interface IGardsNuclIdedAutoService extends IService<GardsNuclIded> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ public interface IGardsNuclIdedManService extends IService<GardsNuclIded> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ public interface IGardsXeResultsManService extends IService<GardsXeResults> {
|
||||||
|
|
||||||
List<ConcDto> getConc(Map<String,Object> params);
|
List<ConcDto> getConc(Map<String,Object> params);
|
||||||
|
|
||||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
List<String> nuclideNames(Set<String> nuclideNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@ package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
@ -24,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -112,6 +116,22 @@ public class AlarmAnalysisLogServiceImpl extends ServiceImpl<AlarmAnalysisLogMap
|
||||||
return Result.OK(page);
|
return Result.OK(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveLog(AlarmAnalysisLog analysisLog) {
|
||||||
|
List<NuclideInfo> nuclideInfoList = analysisLog.getNuclideInfoList();
|
||||||
|
try {
|
||||||
|
if (CollUtil.isNotEmpty(nuclideInfoList)){
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
String nuclideInfo = mapper.writeValueAsString(nuclideInfoList);
|
||||||
|
analysisLog.setNuclideInfo(nuclideInfo);
|
||||||
|
}
|
||||||
|
return save(analysisLog);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> getShow(List<DictModel> dictModels,String dict){
|
private List<String> getShow(List<DictModel> dictModels,String dict){
|
||||||
List<String> show = new ArrayList<>();
|
List<String> show = new ArrayList<>();
|
||||||
if (StrUtil.isBlank(dict))
|
if (StrUtil.isBlank(dict))
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnaly
|
||||||
public boolean refresh() {
|
public boolean refresh() {
|
||||||
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
|
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
|
||||||
CopyOptions options = CopyOptions.create()
|
CopyOptions options = CopyOptions.create()
|
||||||
.setIgnoreProperties("id","create_time");
|
.setIgnoreProperties("id","createTime");
|
||||||
BeanUtil.copyProperties(getLatest(),nuclideParam,options);
|
BeanUtil.copyProperties(getLatest(),nuclideParam,options);
|
||||||
return save(nuclideParam);
|
return save(nuclideParam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.modules.service.*;
|
import org.jeecg.modules.service.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -24,14 +26,14 @@ public class AnalysisResultServiceImpl implements AnalysisResultService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
|
public List<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
|
||||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
||||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||||
return xeResultsAutoService.nuclideNames(nuclideNames);
|
return xeResultsAutoService.nuclideNames(nuclideNames);
|
||||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||||
return nuclIdedAutoService.nuclideNames(nuclideNames);
|
return nuclIdedAutoService.nuclideNames(nuclideNames);
|
||||||
}else {
|
}else {
|
||||||
return nuclideNames;
|
return ListUtil.toList(nuclideNames);
|
||||||
}
|
}
|
||||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
||||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||||
|
@ -39,10 +41,10 @@ public class AnalysisResultServiceImpl implements AnalysisResultService {
|
||||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||||
return nuclIdedManService.nuclideNames(nuclideNames);
|
return nuclIdedManService.nuclideNames(nuclideNames);
|
||||||
}else {
|
}else {
|
||||||
return nuclideNames;
|
return ListUtil.toList(nuclideNames);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
return nuclideNames;
|
return ListUtil.toList(nuclideNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,7 @@ public class GardsNuclIdedAutoServiceImpl extends ServiceImpl<GardsNuclIdedAutoM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
return baseMapper.nuclideNames(nuclideNames);
|
||||||
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
|
|
||||||
Set<String> result = list(wrapper).stream()
|
|
||||||
.map(GardsNuclIded::getNuclideName)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,7 @@ public class GardsNuclIdedManServiceImpl extends ServiceImpl<GardsNuclIdedManMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
return baseMapper.nuclideNames(nuclideNames);
|
||||||
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
|
|
||||||
Set<String> result = list(wrapper).stream()
|
|
||||||
.map(GardsNuclIded::getNuclideName)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,7 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
return baseMapper.nuclideNames(nuclideNames);
|
||||||
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
|
|
||||||
Set<String> result = list(wrapper).stream()
|
|
||||||
.map(GardsXeResults::getNuclideName)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,7 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
public List<String> nuclideNames(Set<String> nuclideNames) {
|
||||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
return baseMapper.nuclideNames(nuclideNames);
|
||||||
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
|
|
||||||
Set<String> result = list(wrapper).stream()
|
|
||||||
.map(GardsXeResults::getNuclideName)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,11 @@ public interface AbnormalAlarmClient {
|
||||||
@PostMapping("/alarmLog/create")
|
@PostMapping("/alarmLog/create")
|
||||||
Result create(@RequestBody AlarmLog alarmLog);
|
Result create(@RequestBody AlarmLog alarmLog);
|
||||||
|
|
||||||
/* AlarmAnalysisRuleController下相关接口 */
|
/* CalculateConcController下相关接口 */
|
||||||
|
@GetMapping("/calculateConc/caclAndSave")
|
||||||
|
void calculateConc();
|
||||||
|
|
||||||
|
/* AlarmAnalysisNuclideParamController下相关接口 */
|
||||||
|
@GetMapping("/nuclideParam/refresh")
|
||||||
|
void refreshParam();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,6 @@ public class SendMessage {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void send(String message,String groupId,String notific){
|
public void send(String message,String groupId,String notific){
|
||||||
// start:生成临时Token到线程中
|
|
||||||
UserTokenContext.setToken(getTempToken());
|
|
||||||
|
|
||||||
// 封装MessageDTO消息体
|
// 封装MessageDTO消息体
|
||||||
String title = "系统预警消息";
|
String title = "系统预警消息";
|
||||||
MessageDTO messageDTO = new MessageDTO(title,message);
|
MessageDTO messageDTO = new MessageDTO(title,message);
|
||||||
|
@ -85,8 +82,6 @@ public class SendMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end:删除临时Token
|
|
||||||
UserTokenContext.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.jeecg.modules.message.controller;
|
||||||
|
|
||||||
|
import org.jeecg.modules.message.SendMessage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/sendMessage")
|
||||||
|
public class SendMessageController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SendMessage sendMessage;
|
||||||
|
|
||||||
|
@GetMapping("send")
|
||||||
|
public void sendMessage(@RequestParam String message,
|
||||||
|
@RequestParam String groupId,
|
||||||
|
@RequestParam String notific){
|
||||||
|
sendMessage.send(message, groupId, notific);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,21 +0,0 @@
|
||||||
package org.jeecg.modules.quartz.job;
|
|
||||||
|
|
||||||
import org.quartz.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 此处的同步是指:当定时任务的执行时间大于任务的时间
|
|
||||||
* 间隔时会等待第一个任务执行完成才会走第二个任务
|
|
||||||
*/
|
|
||||||
@DisallowConcurrentExecution
|
|
||||||
@PersistJobDataAfterExecution
|
|
||||||
public class ConcJob implements Job {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init(){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此处的同步是指:当定时任务的执行时间大于任务的时间
|
||||||
|
* 间隔时会等待第一个任务执行完成才会走第二个任务
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时更新核素浓度计算参数
|
||||||
|
*/
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class NuclideParamJob implements Job {
|
||||||
|
|
||||||
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
init();
|
||||||
|
alarmClient.refreshParam();
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
// start:生成临时Token到线程中
|
||||||
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroy(){
|
||||||
|
// end:删除临时Token
|
||||||
|
UserTokenContext.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此处的同步是指:当定时任务的执行时间大于任务的时间
|
||||||
|
* 间隔时会等待第一个任务执行完成才会走第二个任务
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时计算核素浓度均值
|
||||||
|
*/
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class NucliedAvgJob implements Job {
|
||||||
|
|
||||||
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
init();
|
||||||
|
alarmClient.calculateConc();
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
// start:生成临时Token到线程中
|
||||||
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroy(){
|
||||||
|
// end:删除临时Token
|
||||||
|
UserTokenContext.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.DateConstant;
|
import org.jeecg.common.constant.DateConstant;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
|
@ -21,7 +22,7 @@ import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
import org.jeecg.modules.feignclient.MonitorSystem;
|
import org.jeecg.modules.feignclient.MonitorSystem;
|
||||||
import org.jeecg.modules.message.SendMessage;
|
import org.jeecg.modules.message.SendMessage;
|
||||||
import org.quartz.*;
|
import org.quartz.*;
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -36,6 +37,11 @@ public class SysInfoJob implements Job {
|
||||||
|
|
||||||
private String parameter;
|
private String parameter;
|
||||||
|
|
||||||
|
private SendMessage sendMessage;
|
||||||
|
private MonitorSystem monitorSystem;
|
||||||
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据host定时查询服务器信息
|
* 根据host定时查询服务器信息
|
||||||
* 并向消息队列中推送信息
|
* 并向消息队列中推送信息
|
||||||
|
@ -44,16 +50,12 @@ public class SysInfoJob implements Job {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
RedisStreamUtil redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
init();
|
||||||
MonitorSystem monitorSystem = SpringContextUtils.getBean(MonitorSystem.class);
|
|
||||||
SendMessage sendMessage = SpringContextUtils.getBean(SendMessage.class);
|
|
||||||
AbnormalAlarmClient alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
|
||||||
|
|
||||||
// 查询所有报警规则,根据报警规则查询监控项数据
|
// 查询所有报警规则,根据报警规则查询监控项数据
|
||||||
String pattern = RedisConstant.PREFIX_RULE;
|
String pattern = RedisConstant.PREFIX_RULE;
|
||||||
Set<String> keys = redisStreamUtil.keys(pattern);
|
Set<String> keys = redisStreamUtil.keys(pattern);
|
||||||
if (CollUtil.isEmpty(keys)) {
|
if (CollUtil.isEmpty(keys)) {
|
||||||
log.error("当前没有需要监控的预警规则!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +116,7 @@ public class SysInfoJob implements Job {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean parse(Rule rule){
|
private boolean parse(Rule rule){
|
||||||
|
@ -141,4 +144,18 @@ public class SysInfoJob implements Job {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
// start:生成临时Token到线程中
|
||||||
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
sendMessage = SpringContextUtils.getBean(SendMessage.class);
|
||||||
|
monitorSystem = SpringContextUtils.getBean(MonitorSystem.class);
|
||||||
|
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
||||||
|
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroy(){
|
||||||
|
// end:删除临时Token
|
||||||
|
UserTokenContext.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import org.jeecg.common.util.RedisStreamUtil;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.modules.base.dto.RuleDto;
|
||||||
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此处的同步是指:当定时任务的执行时间大于任务的时间
|
||||||
|
* 间隔时会等待第一个任务执行完成才会走第二个任务
|
||||||
|
*/
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class Test implements Job {
|
||||||
|
|
||||||
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
init();
|
||||||
|
RuleDto ruleDto = new RuleDto();
|
||||||
|
ruleDto.setStationId("101");
|
||||||
|
ruleDto.setSampleId("424249");
|
||||||
|
ruleDto.setBetaOrGamma("Gamma");
|
||||||
|
ruleDto.setFullOrPrel("FULL");
|
||||||
|
ruleDto.setDataSourceType("1");
|
||||||
|
Map<String, String> nuclides = MapUtil.newHashMap();
|
||||||
|
nuclides.put("Be7","1000000");
|
||||||
|
nuclides.put("sss","1000000");
|
||||||
|
nuclides.put("Tl208","10");
|
||||||
|
ruleDto.setNuclides(nuclides);
|
||||||
|
redisStreamUtil.pushAnalysis(ruleDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user