Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
cef2f3d410
|
@ -461,74 +461,53 @@ public interface CommonConstant {
|
|||
*/
|
||||
Integer BPM_USER_EVENT_LEVEL = 2;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 用户租户状态(正常/已通过审核的)
|
||||
*/
|
||||
String USER_TENANT_NORMAL = "1";
|
||||
String USER_TENANT_NORMAL = "1";
|
||||
|
||||
/**
|
||||
* 用户租户状态(离职)
|
||||
*/
|
||||
String USER_TENANT_QUIT = "2";
|
||||
String USER_TENANT_QUIT = "2";
|
||||
|
||||
/**
|
||||
* 用户租户状态(审核中)
|
||||
*/
|
||||
String USER_TENANT_UNDER_REVIEW = "3";
|
||||
|
||||
/**
|
||||
* 用户租户状态(拒绝)
|
||||
*/
|
||||
String USER_TENANT_REFUSE = "4";
|
||||
/**
|
||||
* 用户租户状态(审核中)
|
||||
*/
|
||||
String USER_TENANT_UNDER_REVIEW = "3";
|
||||
|
||||
/**
|
||||
* 不是叶子节点
|
||||
*/
|
||||
Integer NOT_LEAF = 0;
|
||||
/**
|
||||
* 用户租户状态(拒绝)
|
||||
*/
|
||||
String USER_TENANT_REFUSE = "4";
|
||||
|
||||
/**
|
||||
* 是叶子节点
|
||||
*/
|
||||
Integer IS_LEAF = 1;
|
||||
/**
|
||||
* 不是叶子节点
|
||||
*/
|
||||
Integer NOT_LEAF = 0;
|
||||
|
||||
/**
|
||||
* 是叶子节点
|
||||
*/
|
||||
Integer IS_LEAF = 1;
|
||||
|
||||
/**
|
||||
* Redis Stream Key
|
||||
*/
|
||||
String STREAM_ALARM = "Stream:alarm";
|
||||
// 启用
|
||||
Integer ENABLED = 1;
|
||||
|
||||
/*
|
||||
* Redis Stream 消费组名
|
||||
*/
|
||||
String GROUP_WARN_A = "Group_Warn_A";
|
||||
String GROUP_WARN_B = "Group_Warn_B";
|
||||
// 禁用
|
||||
Integer DISENABLED = 0;
|
||||
|
||||
/*
|
||||
* Redis Stream 消费者名
|
||||
*/
|
||||
String CONSUMERWARNA1 = "Consumer_Warn_A1";
|
||||
String CONSUMERWARNA2 = "Consumer_Warn_A2";
|
||||
String CONSUMERWARNB1 = "Consumer_Warn_B1";
|
||||
// 用于生成临时token的用户名
|
||||
String TEMP_TOKEN_USERNAME = "admin";
|
||||
|
||||
/**
|
||||
* 预警规则Key前缀
|
||||
*/
|
||||
String PREFIX_RULE = "Rule:";
|
||||
// 用于生成临时token的密码
|
||||
String TEMP_TOKEN_SECRET = "cb362cfeefbf3d8d";
|
||||
|
||||
/*
|
||||
预警规则沉默周期Key
|
||||
*/
|
||||
String PREFIX_SILENCE = "SilenceCycle:";
|
||||
String ARMDARR = "1";
|
||||
String ARMDRRR = "2";
|
||||
String IDCARR = "3";
|
||||
String IDCRRR = "4";
|
||||
|
||||
// 启用
|
||||
Integer ENABLED = 1;
|
||||
|
||||
// 禁用
|
||||
Integer DISENABLED = 0;
|
||||
|
||||
// 用于生成临时token的用户名
|
||||
String TEMP_TOKEN_USERNAME = "admin";
|
||||
|
||||
// 用于生成临时token的密码
|
||||
String TEMP_TOKEN_SECRET = "cb362cfeefbf3d8d";
|
||||
String BETA = "Beta";
|
||||
String GAMMA = "Gamma";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.common.constant;
|
||||
|
||||
public interface DictConstant {
|
||||
|
||||
String ANALYSE_CONDITION = "alarm_analyse_rule_condition";
|
||||
|
||||
String SPECTRAL_QUALIFIER = "spectral_qualifier";
|
||||
|
||||
String ANALYSE_SOURCE = "alarm_analyse_rule_source";
|
||||
|
||||
String DATASOURCE_TYPE = "database_type";
|
||||
}
|
|
@ -25,5 +25,9 @@ public interface Prompt {
|
|||
|
||||
String FTP_ERR = "FTP Connection Failed!";
|
||||
|
||||
String NOT_REPEAT = " Can Not Repeat!";
|
||||
String NOT_REPEAT = " Can Not Be Repeat!";
|
||||
|
||||
String PARAM_REQUIRED = "Param Is Required!";
|
||||
|
||||
String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.common.constant;
|
||||
|
||||
public interface RedisConstant {
|
||||
|
||||
String STATION_CODE_MAP = "stationMap";
|
||||
|
||||
String PREFIX_RULE = "Rule:";
|
||||
|
||||
String ANALYSIS_RULE = "Rule:Analysis:All";
|
||||
|
||||
/*
|
||||
预警规则沉默周期Key
|
||||
*/
|
||||
String PREFIX_SILENCE = "SilenceCycle:";
|
||||
|
||||
String STREAM_ALARM = "Stream:Alarm";
|
||||
|
||||
String STREAM_ANALYSIS = "Stream:Analysis";
|
||||
|
||||
String GROUP_ALARM = "Group_Alarm";
|
||||
|
||||
String GROUP_ANALYSIS = "Group_Analysis";
|
||||
|
||||
String CONSUMER_ALARM = "Consumer_Alarm";
|
||||
|
||||
String CONSUMER_ANALYSIS = "Consumer_Analysis";
|
||||
}
|
|
@ -116,4 +116,9 @@ public class SymbolConstant {
|
|||
*/
|
||||
public static final String SQUARE_BRACKETS_RIGHT = "]";
|
||||
|
||||
/**
|
||||
* 符号:-
|
||||
*/
|
||||
public static final String BARRE = "-";
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.modules.base.dto.RuleDto;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
|
@ -159,7 +160,7 @@ public class RedisStreamUtil {
|
|||
* @param ruleDto
|
||||
*/
|
||||
public String pushWarn(RuleDto ruleDto){
|
||||
String warnKey = CommonConstant.STREAM_ALARM;
|
||||
String warnKey = RedisConstant.STREAM_ALARM;
|
||||
ObjectRecord<String, RuleDto> record = StreamRecords.newRecord()
|
||||
.in(warnKey).ofObject(ruleDto);
|
||||
// 向Redis Stream中推送消息
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AlarmAnalysisRuleDto implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<String> source;
|
||||
|
||||
private List<String> stations;
|
||||
|
||||
private List<String> nuclides;
|
||||
|
||||
private List<String> spectralQualifier;
|
||||
|
||||
private List<String> conditions;
|
||||
|
||||
private Integer enabled;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AlarmAnalysisRuleInfo implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<String> sourceChecked;
|
||||
|
||||
private List<String> stationChecked;
|
||||
|
||||
private List<String> nuclidesChecked;
|
||||
|
||||
private List<String> qualifierChecked;
|
||||
|
||||
private List<String> conditionChecked;
|
||||
|
||||
private Integer enabled;
|
||||
|
||||
private String contactGroup;
|
||||
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AnalysisLogDto extends AlarmAnalysisLog {
|
||||
|
||||
private String name;
|
||||
|
||||
private String source;
|
||||
|
||||
private List<String> sourceList;
|
||||
|
||||
private String stations;
|
||||
|
||||
private List<String> stationList;
|
||||
|
||||
private String nuclides;
|
||||
|
||||
private List<NuclideInfo> nuclideList;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ConcDto implements Serializable {
|
||||
|
||||
private String nuclideName;
|
||||
|
||||
private String conc;
|
||||
|
||||
private Date analysisBegin;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class NuclideInfo implements Serializable {
|
||||
|
||||
private String nuclide;
|
||||
|
||||
private String threshold;
|
||||
|
||||
private String armdarr;
|
||||
|
||||
private String armdrrr;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -6,13 +6,9 @@ import lombok.experimental.Accessors;
|
|||
import org.jeecg.modules.base.enums.SourceType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 预警项信息
|
||||
*
|
||||
* @author nieziyan
|
||||
* @date 2023-06-29
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
|
@ -25,4 +21,19 @@ public class RuleDto implements Serializable{
|
|||
|
||||
// 当前值
|
||||
private double value;
|
||||
|
||||
// 台站id
|
||||
private String stationId;
|
||||
|
||||
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
|
||||
private String dataSourceType;
|
||||
|
||||
// 谱类型 (FULL|PREL)
|
||||
private String fullOrPrel;
|
||||
|
||||
// 谱类型 (Gamma|Beta)
|
||||
private String betaOrGamma;
|
||||
|
||||
// 核素名称-浓度值
|
||||
private Map<String,String> nuclides;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.jeecg.modules.base.entity;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class Rule {
|
||||
public class Rule implements Serializable {
|
||||
|
||||
private String name; // 监控项名称
|
||||
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
package org.jeecg.modules.base.entity.configuration;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("CONFIGURATION.GARDS_NUCL_LIB")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class GardsNuclLib implements Serializable {
|
||||
|
||||
private Long nuclideId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer halflife;
|
||||
|
||||
private Integer halflifeErr;
|
||||
|
||||
private Long numLines;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date moddate;
|
||||
|
||||
@TableField("parents_1")
|
||||
private String parents1;
|
||||
|
||||
@TableField("parents_2")
|
||||
private String parents2;
|
||||
|
||||
@TableField("parents_3")
|
||||
private String parents3;
|
||||
|
||||
@TableField("parents_4")
|
||||
private String parents4;
|
||||
|
||||
@TableField("parents_5")
|
||||
private String parents5;
|
||||
|
||||
@TableField("parents_6")
|
||||
private String parents6;
|
||||
|
||||
@TableField("daughters_1")
|
||||
private String daughters1;
|
||||
|
||||
@TableField("daughters_2")
|
||||
private String daughters2;
|
||||
|
||||
@TableField("daughters_3")
|
||||
private String daughters3;
|
||||
|
||||
@TableField("daughters_4")
|
||||
private String daughters4;
|
||||
|
||||
@TableField("daughters_5")
|
||||
private String daughters5;
|
||||
|
||||
@TableField("branchingratios_1")
|
||||
private Integer branchingratios1;
|
||||
|
||||
@TableField("branchingratios_2")
|
||||
private Integer branchingratios2;
|
||||
|
||||
@TableField("branchingratios_3")
|
||||
private Integer branchingratios3;
|
||||
|
||||
@TableField("branchingratios_4")
|
||||
private Integer branchingratios4;
|
||||
|
||||
@TableField("branchingratios_5")
|
||||
private Integer branchingratios5;
|
||||
|
||||
@TableField("daughtersstable_1")
|
||||
private Long daughtersstable1;
|
||||
|
||||
@TableField("daughtersstable_2")
|
||||
private Long daughtersstable2;
|
||||
|
||||
@TableField("daughtersstable_3")
|
||||
private Long daughtersstable3;
|
||||
|
||||
@TableField("daughtersstable_4")
|
||||
private Long daughtersstable4;
|
||||
|
||||
@TableField("daughtersstable_5")
|
||||
private Long daughtersstable5;
|
||||
|
||||
@TableField("default")
|
||||
private Long isDefault;
|
||||
|
||||
private java.sql.Clob nucComment;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.base.entity.configuration;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
@ -20,7 +21,7 @@ public class GardsStations implements Serializable {
|
|||
/**
|
||||
* 台站id
|
||||
*/
|
||||
@TableField(value = "STATION_ID")
|
||||
@TableId("STATION_ID")
|
||||
@NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer stationId;
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package org.jeecg.modules.base.entity.postgre;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
@TableName("alarm_analysis_log")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class AlarmAnalysisLog implements Serializable{
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
private String ruleId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date alarmStartDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date collectionDate;
|
||||
|
||||
private String alarmInfo;
|
||||
|
||||
private Integer sampleId;
|
||||
|
||||
private String nuclideInfo;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.jeecg.modules.base.entity.postgre;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("alarm_analysis_nuclide_avg")
|
||||
public class AlarmAnalysisNuclideAvg extends JeecgEntity {
|
||||
|
||||
public AlarmAnalysisNuclideAvg(String nuclide, String val) {
|
||||
this.nuclide = nuclide;
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
/** 核素名称 */
|
||||
private String nuclide;
|
||||
|
||||
/** 核素浓度平均值 */
|
||||
private String val;
|
||||
|
||||
/** 统计周期 */
|
||||
private String cycle;
|
||||
|
||||
/** 数据源类型 */
|
||||
private String dataSourceType;
|
||||
|
||||
// 计算时间
|
||||
private LocalDate caclDate;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.jeecg.modules.base.entity.postgre;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
@TableName("alarm_analysis_nuclide_param")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class AlarmAnalysisNuclideParam extends JeecgEntity {
|
||||
|
||||
// 统计天数
|
||||
private Integer days;
|
||||
|
||||
// 计算位置
|
||||
private BigDecimal index;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.jeecg.modules.base.entity.postgre;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
@TableName("alarm_analysis_rule")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class AlarmAnalysisRule extends JeecgEntity {
|
||||
|
||||
/** 规则名称 */
|
||||
private String name;
|
||||
|
||||
/** 是否启用(0,1) */
|
||||
private Integer enabled;
|
||||
|
||||
/** 数据源[ARMD|IDC][ARR|RRR] */
|
||||
private String source;
|
||||
|
||||
/** 关注台站id */
|
||||
private String stations;
|
||||
|
||||
/** 关注核素 */
|
||||
private String nuclides;
|
||||
|
||||
/** 光谱限定符(全谱/半谱) */
|
||||
private String spectralQualifier;
|
||||
|
||||
/** 触发条件 */
|
||||
private String conditions;
|
||||
|
||||
/** 联系人组id */
|
||||
private String contactGroup;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AnalysisLogVo extends QueryRequest {
|
||||
|
||||
private List<String> source;
|
||||
|
||||
private List<String> stations;
|
||||
|
||||
private List<String> nuclides;
|
||||
|
||||
private String startDate;
|
||||
|
||||
private String endDate;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AnalysisRuleVo extends QueryRequest{
|
||||
|
||||
private List<String> source;
|
||||
|
||||
private List<String> stations;
|
||||
|
||||
private List<String> nuclides;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
import org.jeecg.modules.base.vo.AnalysisLogVo;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Api(value = "数据分析报警日志管理" ,tags="数据分析报警日志管理")
|
||||
@RestController
|
||||
@RequestMapping("alarmAnalysisLog")
|
||||
public class AlarmAnalysisLogController extends JeecgController<AlarmAnalysisLog, IAlarmAnalysisLogService> {
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisLogService alarmAnalysisLogService;
|
||||
|
||||
@ApiOperation(value="报警日志分页查询", notes="报警日志分页查询")
|
||||
@GetMapping(value = "findPage")
|
||||
public Result<?> findPage(AnalysisLogVo analysisLogVo) {
|
||||
return alarmAnalysisLogService.findPage(analysisLogVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value="添加报警日志", notes="添加报警日志")
|
||||
@PostMapping(value = "add")
|
||||
public Result<?> add(@RequestBody AlarmAnalysisLog alarmAnalysisLog) {
|
||||
boolean success = alarmAnalysisLogService.save(alarmAnalysisLog);
|
||||
if (success)
|
||||
return Result.OK(Prompt.ADD_SUCC);
|
||||
return Result.error(Prompt.ADD_ERR);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@Api(value = "",tags="")
|
||||
@RestController
|
||||
@RequestMapping("alarmAnalysisNuclideAvg")
|
||||
public class AlarmAnalysisNuclideAvgController extends JeecgController<AlarmAnalysisNuclideAvg, IAlarmAnalysisNuclideAvgService> {
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisNuclideAvgService alarmAnalysisNuclideAvgService;
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@Slf4j
|
||||
@Api(value = "", tags= "")
|
||||
@RestController
|
||||
@RequestMapping("alarmAnalysisNuclideParam")
|
||||
public class AlarmAnalysisNuclideParamController extends JeecgController<AlarmAnalysisNuclideParam, IAlarmAnalysisNuclideParamService> {
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisNuclideParamService alarmAnalysisNuclideParamService;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.base.vo.AnalysisRuleVo;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(value = "数据分析报警规则管理",tags="数据分析报警规则管理")
|
||||
@RestController
|
||||
@RequestMapping("alarmAnalysisRule")
|
||||
public class AlarmAnalysisRuleController extends JeecgController<AlarmAnalysisRule, IAlarmAnalysisRuleService> {
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisRuleService alarmAnalysisRuleService;
|
||||
|
||||
@ApiOperation(value="分页查询报警规则", notes="分页查询报警规则")
|
||||
@GetMapping(value = "findPage")
|
||||
public Result<?> findPage(AnalysisRuleVo analysisRuleVo) {
|
||||
return alarmAnalysisRuleService.page(analysisRuleVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value="添加报警规则", notes="添加报警规则")
|
||||
@PostMapping("add")
|
||||
public Result<?> add(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
|
||||
return alarmAnalysisRuleService.add(alarmAnalysisRule);
|
||||
}
|
||||
|
||||
@ApiOperation(value="编辑报警规则", notes="编辑报警规则")
|
||||
@PutMapping("edit")
|
||||
public Result<?> edit(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
|
||||
return alarmAnalysisRuleService.edit(alarmAnalysisRule);
|
||||
}
|
||||
|
||||
@ApiOperation(value="报警规则详情", notes="报警规则详情")
|
||||
@GetMapping("finInfo")
|
||||
public Result<?> findInfo(@RequestParam String id) {
|
||||
return alarmAnalysisRuleService.findInfo(id);
|
||||
}
|
||||
|
||||
@PutMapping("updateStatus")
|
||||
@ApiOperation(value = "修改规则状态", notes = "修改规则状态")
|
||||
public Result updateStatus(@RequestParam String id,
|
||||
@RequestParam Integer enabled){
|
||||
return alarmAnalysisRuleService.updateStatus(id,enabled);
|
||||
}
|
||||
|
||||
@ApiOperation(value="删除报警规则", notes="删除报警规则")
|
||||
@DeleteMapping(value = "delete")
|
||||
public Result<?> delete(@RequestParam String id) {
|
||||
return alarmAnalysisRuleService.delete(id);
|
||||
}
|
||||
|
||||
@ApiOperation(value="批量删除报警规则", notes="批量删除报警规则")
|
||||
@DeleteMapping("deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam List<String> ids) {
|
||||
return alarmAnalysisRuleService.deleteBatch(ids);
|
||||
}
|
||||
|
||||
@ApiOperation(value="获取所有报警规则", notes="获取所有报警规则")
|
||||
@GetMapping("all")
|
||||
public List<AlarmAnalysisRule> allAnalysisRule() {
|
||||
return alarmAnalysisRuleService.allAnalysisRule();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.modules.service.CalculateConcService;
|
||||
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.RestController;
|
||||
|
||||
@Api(value = "定时计算核素浓度" ,tags="定时计算核素浓度")
|
||||
@RestController
|
||||
@RequestMapping("calculateConc")
|
||||
public class CalculateConcController {
|
||||
|
||||
@Autowired
|
||||
private CalculateConcService calculateConcService;
|
||||
|
||||
@GetMapping("caclAndSave")
|
||||
@ApiOperation(value = "计算并保存核素浓度",notes = "计算并保存核素浓度")
|
||||
public void caclAndSave(){
|
||||
calculateConcService.calcAndSave();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.service.IGardsNuclLibService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@Api(value = "核素信息库管理",tags = "核素信息库管理")
|
||||
@RestController
|
||||
@RequestMapping("gardsNuclLib")
|
||||
public class GardsNuclLibController extends JeecgController<GardsNuclLib, IGardsNuclLibService> {
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclLibService gardsNuclLibService;
|
||||
|
||||
@GetMapping("allName")
|
||||
@ApiOperation(value = "核素名列表",notes = "核素名列表")
|
||||
public List<String> allName(){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
|
@ -15,7 +19,11 @@ public interface SystemClient {
|
|||
@RequestMapping("/sys/user/findUserMap")
|
||||
Map<String, SysUser> findUserMap();
|
||||
|
||||
/* 数据字典相关 */
|
||||
@GetMapping("/sys/dict/dataBaseType")
|
||||
Map<String,String> dataBaseType();
|
||||
/* SysDictController下相关接口 */
|
||||
@GetMapping("/sys/dict/getItems")
|
||||
List<DictModel> getItems(@RequestParam String dictCode);
|
||||
|
||||
/* GardsStationsController下相关接口 */
|
||||
@GetMapping("/gardsStations/getCodes")
|
||||
List<String> stationCodes(@RequestParam String stationIds);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.base.dto.AnalysisLogDto;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
|
||||
@Mapper
|
||||
public interface AlarmAnalysisLogMapper extends BaseMapper<AlarmAnalysisLog> {
|
||||
|
||||
List<AnalysisLogDto> findPage(String startDate,String endDate);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface AlarmAnalysisNuclideAvgMapper extends BaseMapper<AlarmAnalysisNuclideAvg> {
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface AlarmAnalysisNuclideParamMapper extends BaseMapper<AlarmAnalysisNuclideParam> {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
|
||||
@Mapper
|
||||
public interface AlarmAnalysisRuleMapper extends BaseMapper<AlarmAnalysisRule> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
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.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> param);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
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.entity.rnman.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> param);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
|
||||
public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
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.entity.rnauto.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
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.entity.rnman.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisLogMapper">
|
||||
|
||||
<select id="findPage" resultType="org.jeecg.modules.base.dto.AnalysisLogDto">
|
||||
SELECT
|
||||
l.*,
|
||||
r.name,
|
||||
r.source,
|
||||
r.stations,
|
||||
r.nuclides
|
||||
FROM
|
||||
alarm_analysis_log l
|
||||
INNER JOIN alarm_analysis_rule r ON l.rule_id = r.id
|
||||
<where>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
l.alarm_start_date >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND l.alarm_start_date <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY l.alarm_start_date DESC
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisNuclideAvgMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisNuclideParamMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisRuleMapper">
|
||||
|
||||
</mapper>
|
|
@ -12,6 +12,7 @@
|
|||
r.OPERATOR,
|
||||
r.source_type,
|
||||
r.source_id,
|
||||
r.create_time,
|
||||
g.NAME AS groupName,
|
||||
CASE
|
||||
r.source_type
|
||||
|
@ -40,6 +41,7 @@
|
|||
<if test="pageFlag == null">
|
||||
LIMIT #{pageSize} OFFSET #{pageStart}
|
||||
</if>
|
||||
ORDER BY enabled DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="findInfo" parameterType="String" resultType="org.jeecg.modules.base.dto.AlarmRuleInfo">
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
|
||||
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
SELECT
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNAUTO.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND xe.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
||||
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
SELECT
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNMAN.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND xe.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclLibMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
|
||||
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
SELECT
|
||||
nucl.NUCLIDENAME,
|
||||
nucl.CONCENTRATION AS CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNAUTO.GARDS_NUCL_IDED nucl
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND nucl.NUCLIDENAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
||||
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
SELECT
|
||||
nucl.NUCLIDENAME,
|
||||
nucl.CONCENTRATION AS CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNMAN.GARDS_NUCL_IDED nucl
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND nucl.NUCLIDENAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -7,14 +7,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.base.dto.RuleDto;
|
||||
import org.jeecg.modules.base.entity.Rule;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
import org.jeecg.modules.message.SendMessage;
|
||||
import org.springframework.data.redis.connection.stream.ObjectRecord;
|
||||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.stream.StreamListener;
|
||||
|
@ -28,17 +27,15 @@ import static org.jeecg.modules.base.enums.Op.*;
|
|||
@Slf4j
|
||||
@Component
|
||||
@NoArgsConstructor
|
||||
public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, RuleDto>> {
|
||||
public class AlarmConsumer implements StreamListener<String, ObjectRecord<String, RuleDto>> {
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String consumerName;
|
||||
|
||||
private SendMessage sendMessage;
|
||||
|
||||
private RedisStreamUtil redisStreamUtil;
|
||||
|
||||
public ConsumeA1(String groupName, String consumerName) {
|
||||
public AlarmConsumer(String groupName, String consumerName) {
|
||||
this.groupName = groupName;
|
||||
this.consumerName = consumerName;
|
||||
}
|
||||
|
@ -53,8 +50,9 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
|
|||
* 新消息在未进行ACK之前,状态也为pending,
|
||||
* 直接消费所有异常未确认的消息和新消息
|
||||
*/
|
||||
List<ObjectRecord<String, RuleDto>> pendingList = redisStreamUtil.read(streamKey, groupName, consumerName);
|
||||
for (ObjectRecord<String, RuleDto> record : pendingList) {
|
||||
List<ObjectRecord<String, RuleDto>> pendings = redisStreamUtil
|
||||
.read(streamKey, groupName, consumerName);
|
||||
for (ObjectRecord<String, RuleDto> record : pendings) {
|
||||
RecordId recordId = record.getId();
|
||||
RuleDto ruleDto = record.getValue();
|
||||
// 消费消息
|
||||
|
@ -66,10 +64,9 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
|
|||
redisStreamUtil.del(streamKey, recordId.getValue());
|
||||
}
|
||||
}catch (JsonProcessingException e) {
|
||||
log.error("消费者[{}]消费异常,报警规则解析失败!",consumerName);
|
||||
log.error("Alarm Rule Resolution Failed!");
|
||||
e.printStackTrace();
|
||||
}catch (RuntimeException e){
|
||||
log.error("消费者[{}]消费异常,请及时排查原因!",consumerName);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +81,7 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
|
|||
? "" : ruleDto.getSourceType().getType();
|
||||
int itemId = ruleDto.getItemId();
|
||||
String underline = SymbolConstant.UNDERLINE;
|
||||
String prefix = CommonConstant.PREFIX_RULE;
|
||||
String prefix = RedisConstant.PREFIX_RULE;
|
||||
String key = prefix + sourceType + underline + itemId;
|
||||
Boolean hasKey = redisStreamUtil.hasKey(key);
|
||||
if (!hasKey) return;
|
||||
|
@ -136,7 +133,6 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
|
|||
}
|
||||
|
||||
private void init(){
|
||||
sendMessage = SpringContextUtils.getBean(SendMessage.class);
|
||||
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
package org.jeecg.modules.redisStream;
|
||||
|
||||
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.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||
import org.jeecg.modules.base.dto.RuleDto;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.service.AnalysisResultService;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.stream.ObjectRecord;
|
||||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.stream.StreamListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Component
|
||||
@NoArgsConstructor
|
||||
public class AnalysisConsumer implements StreamListener<String, ObjectRecord<String, RuleDto>> {
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String consumerName;
|
||||
|
||||
private RedisStreamUtil redisStreamUtil;
|
||||
|
||||
private IAlarmAnalysisRuleService ruleService;
|
||||
|
||||
private AnalysisResultService analysisResultService;
|
||||
|
||||
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
|
||||
|
||||
private final String comma = SymbolConstant.COMMA;
|
||||
|
||||
public AnalysisConsumer(String groupName, String consumerName) {
|
||||
this.groupName = groupName;
|
||||
this.consumerName = consumerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(ObjectRecord<String, RuleDto> message) {
|
||||
/* 避免消费抛出异常后,取消此消费者的消费资格 */
|
||||
try {
|
||||
String streamKey = message.getStream();
|
||||
init();
|
||||
/**
|
||||
* 新消息在未进行ACK之前,状态也为pending,
|
||||
* 直接消费所有异常未确认的消息和新消息
|
||||
*/
|
||||
List<ObjectRecord<String, RuleDto>> pendings = redisStreamUtil
|
||||
.read(streamKey, groupName, consumerName);
|
||||
for (ObjectRecord<String, RuleDto> record : pendings) {
|
||||
RecordId recordId = record.getId();
|
||||
RuleDto ruleDto = record.getValue();
|
||||
// 消费消息
|
||||
consume(ruleDto);
|
||||
// 消费完成后,手动确认消费消息[消息消费成功]
|
||||
// 否则就是消费抛出异常,进入pending_ids[消息消费失败]
|
||||
redisStreamUtil.ack(streamKey, groupName, recordId.getValue());
|
||||
// 手动删除已消费消息
|
||||
redisStreamUtil.del(streamKey, recordId.getValue());
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void consume(RuleDto ruleDto){
|
||||
String stationId = ruleDto.getStationId();
|
||||
Map<String, String> nuclides = ruleDto.getNuclides();
|
||||
if (StrUtil.isBlank(stationId)) return;
|
||||
if (MapUtil.isEmpty(nuclides)) return;
|
||||
List<AlarmAnalysisRule> rules = ruleService.allAnalysisRule();
|
||||
for (AlarmAnalysisRule rule : rules) {
|
||||
String conditionStr = rule.getConditions();
|
||||
if (StrUtil.isBlank(conditionStr)) continue;
|
||||
String stations = rule.getStations();
|
||||
boolean shot = StrUtil.contains(stations, stationId);
|
||||
if (!shot) continue;
|
||||
Set<String> names = nuclides.keySet();
|
||||
String nuclidesStr = rule.getNuclides();
|
||||
if (StrUtil.isBlank(nuclidesStr)) continue;
|
||||
List<String> follow = ListUtil.toList(nuclidesStr.split(comma));
|
||||
// 推送过来的核素集合与所关注核素集合取交集
|
||||
Collection<String> cross = CollectionUtil.intersection(names, follow);
|
||||
if (CollUtil.isEmpty(cross)) continue;
|
||||
Map<String, String> nuclidesCross = nuclides.entrySet().stream()
|
||||
.filter(entry -> cross.contains(entry.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
// 开始对交集中的核素进行条件判断
|
||||
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void judge(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
List<String> conditions,
|
||||
Map<String,String> nuclides){
|
||||
String ONE = "1";String TWO = "2";String THREE = "3";
|
||||
Set<String> nuclideNames = nuclides.keySet();
|
||||
List<String> firstDetected;
|
||||
List<NuclideInfo> moreThanAvg;
|
||||
List<String> twoOrMore;
|
||||
for (String con : conditions) {
|
||||
if (ONE.equals(con)){ // 首次发现该元素
|
||||
firstDetected = firstDetected(betaOrGamma,dataSourceType,nuclideNames);
|
||||
if (CollUtil.isNotEmpty(firstDetected)){
|
||||
String message = "核素:["+StrUtil.join(comma,firstDetected)+"]首次发现";
|
||||
|
||||
}
|
||||
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
||||
moreThanAvg = moreThanAvg(dataSourceType,nuclides);
|
||||
if (CollUtil.isNotEmpty(moreThanAvg)){
|
||||
|
||||
}
|
||||
} else if (THREE.equals(con)) { // 发现两种及以上核素
|
||||
twoOrMore = twoOrMore(betaOrGamma,dataSourceType,nuclideNames);
|
||||
if (twoOrMore.size() >= 2){
|
||||
String message = "同时检测到核素:["+StrUtil.join(comma,twoOrMore)+"]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次发现该核素
|
||||
*/
|
||||
private List<String> firstDetected(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
Set<String> nuclideNames){
|
||||
Set<String> existNames = analysisResultService
|
||||
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
||||
// 两个集合元素相减
|
||||
List<String> differ = CollUtil.subtractToList(nuclideNames, existNames);
|
||||
return differ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核素值大于历史浓度均值
|
||||
*/
|
||||
private List<NuclideInfo> moreThanAvg(String dataSourceType,
|
||||
Map<String,String> nuclides){
|
||||
List<NuclideInfo> nuclideInfos = new ArrayList<>();
|
||||
Set<String> nuclideNames = nuclides.keySet();
|
||||
Map<String, String> nuclideAvgs = nuclideAvgService
|
||||
.list(nuclideNames, dataSourceType).stream()
|
||||
.collect(Collectors.toMap(AlarmAnalysisNuclideAvg::getNuclide,
|
||||
AlarmAnalysisNuclideAvg::getVal));
|
||||
for (Map.Entry<String, String> nuclide : nuclides.entrySet()) {
|
||||
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);
|
||||
BigDecimal avg = new BigDecimal(avgValue);
|
||||
// 如果核素浓度值小于均值,继续判断下一个核素
|
||||
if (NumberUtil.isLessOrEqual(conc, avg))
|
||||
continue;
|
||||
NuclideInfo nuclideInfo = new NuclideInfo();
|
||||
nuclideInfo.setNuclide(nuclideName);
|
||||
nuclideInfo.setThreshold(avgValue);
|
||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
||||
nuclideInfo.setArmdarr(concValue);
|
||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
||||
nuclideInfo.setArmdrrr(concValue);
|
||||
}
|
||||
nuclideInfos.add(nuclideInfo);
|
||||
}
|
||||
return nuclideInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同时检测到两种或以上核素
|
||||
*/
|
||||
private List<String> twoOrMore(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
Set<String> nuclideNames){
|
||||
Set<String> existNames = analysisResultService
|
||||
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
|
||||
return ListUtil.toList(existNames);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
|
||||
ruleService = SpringContextUtils.getBean(IAlarmAnalysisRuleService.class);
|
||||
analysisResultService = SpringContextUtils.getBean(AnalysisResultService.class);
|
||||
nuclideAvgService = SpringContextUtils.getBean(IAlarmAnalysisNuclideAvgService.class);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package org.jeecg.modules.redisStream;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.exception.StreamErrorHandler;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.modules.base.dto.RuleDto;
|
||||
|
@ -32,14 +32,13 @@ public class RedisStreamConfig {
|
|||
// 每次轮询取几条消息
|
||||
private final Integer maxMsg = 10;
|
||||
|
||||
// Stream Key
|
||||
private final String warnKey = CommonConstant.STREAM_ALARM;
|
||||
private final String alarmKey = RedisConstant.STREAM_ALARM;
|
||||
private final String alarmGroup = RedisConstant.GROUP_ALARM;
|
||||
private final String alarmConsumer = RedisConstant.CONSUMER_ALARM;
|
||||
|
||||
// 消费组名
|
||||
private final String groupWarnA = CommonConstant.GROUP_WARN_A;
|
||||
|
||||
// 消费者名
|
||||
private final String consumerWarnA1 = CommonConstant.CONSUMERWARNA1;
|
||||
private final String analysisKey = RedisConstant.STREAM_ANALYSIS;
|
||||
private final String analysisGroup = RedisConstant.GROUP_ANALYSIS;
|
||||
private final String analysisConsumer = RedisConstant.CONSUMER_ANALYSIS;
|
||||
|
||||
@Resource
|
||||
private RedisConnectionFactory redisConnectionFactory;
|
||||
|
@ -48,9 +47,10 @@ public class RedisStreamConfig {
|
|||
private RedisStreamUtil redisStreamUtil;
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public StreamMessageListenerContainer<String, ObjectRecord<String, RuleDto>> streamMessageListenerContainer() {
|
||||
/* 创建Stream和消费组A */
|
||||
creatGroup(warnKey, groupWarnA);
|
||||
public StreamMessageListenerContainer<String, ObjectRecord<String, RuleDto>> alarmStream() {
|
||||
/* 创建Stream和消费组 */
|
||||
creatGroup(alarmKey, alarmGroup);
|
||||
creatGroup(analysisKey, analysisGroup);
|
||||
// 原子整数,多线程环境下对整数的原子性操作
|
||||
AtomicInteger index = new AtomicInteger(1);
|
||||
// 返回当前系统可用的处理器数量
|
||||
|
@ -70,7 +70,7 @@ public class RedisStreamConfig {
|
|||
new LinkedBlockingDeque<>(),
|
||||
r -> {
|
||||
Thread thread = new Thread(r);
|
||||
thread.setName("Thread-Stream-Consumer-" + index.getAndIncrement());
|
||||
thread.setName("Stream-Thread-" + index.getAndIncrement());
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
|
@ -118,18 +118,16 @@ public class RedisStreamConfig {
|
|||
.build();
|
||||
ConsumeA1 consumeA1 = new ConsumeA1(groupWarnA, consumerWarnA1);
|
||||
streamMessageListenerContainer.register(readA1, consumeA1);*/
|
||||
ConsumeA1 consumeA1 = new ConsumeA1(groupWarnA, consumerWarnA1);
|
||||
streamMessageListenerContainer.receive(Consumer.from(groupWarnA, consumerWarnA1),
|
||||
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), consumeA1);
|
||||
AlarmConsumer alarm = new AlarmConsumer(alarmGroup, alarmConsumer);
|
||||
streamMessageListenerContainer.receive(Consumer.from(alarmGroup, alarmConsumer),
|
||||
StreamOffset.create(alarmKey, ReadOffset.lastConsumed()), alarm);
|
||||
AnalysisConsumer analysis = new AnalysisConsumer(analysisGroup,analysisConsumer);
|
||||
streamMessageListenerContainer.receive(Consumer.from(analysisGroup, analysisConsumer),
|
||||
StreamOffset.create(analysisKey, ReadOffset.lastConsumed()), analysis);
|
||||
// 创建消费组A中的消费者A2,自动ACK
|
||||
/* ConsumeA2 consumeA2 = new ConsumeA2(consumerWarnA2);
|
||||
streamMessageListenerContainer.receiveAutoAck(Consumer.from(groupWarnA, consumerWarnA2),
|
||||
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), consumeA2);*/
|
||||
|
||||
// 注册消费组B中的消费者B1,自动ACK
|
||||
/*streamMessageListenerContainer.receiveAutoAck(Consumer.from(groupWarnB, consumerWarnB1),
|
||||
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), new ConsumeListenerB());*/
|
||||
|
||||
return streamMessageListenerContainer;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface AnalysisResultService {
|
||||
|
||||
Set<String> nuclideNames(String betaOrGamma,
|
||||
String dataSourceType,
|
||||
Set<String> nuclideNames);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CalculateConcService {
|
||||
|
||||
void calcAndSave();
|
||||
|
||||
Map<String,String> calculate(List<ConcDto> concDtos, BigDecimal index);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
import org.jeecg.modules.base.vo.AnalysisLogVo;
|
||||
|
||||
public interface IAlarmAnalysisLogService extends IService<AlarmAnalysisLog> {
|
||||
|
||||
Result findPage(AnalysisLogVo analysisLogVo);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IAlarmAnalysisNuclideAvgService extends IService<AlarmAnalysisNuclideAvg> {
|
||||
|
||||
List<AlarmAnalysisNuclideAvg> list(Set<String> nuclideNames,String dataSourceType);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface IAlarmAnalysisNuclideParamService extends IService<AlarmAnalysisNuclideParam> {
|
||||
|
||||
AlarmAnalysisNuclideParam getLatest();
|
||||
|
||||
boolean refresh();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.base.vo.AnalysisRuleVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAlarmAnalysisRuleService extends IService<AlarmAnalysisRule> {
|
||||
|
||||
Result page(AnalysisRuleVo analysisRuleVo);
|
||||
|
||||
Result add(AlarmAnalysisRule alarmAnalysisRule);
|
||||
|
||||
Result edit(AlarmAnalysisRule alarmAnalysisRule);
|
||||
|
||||
Result findInfo(String id);
|
||||
|
||||
AlarmAnalysisRule getByName(String name);
|
||||
|
||||
Result updateStatus(String id, Integer enabled);
|
||||
|
||||
Result delete(String id);
|
||||
|
||||
Result deleteBatch(List<String> ids);
|
||||
|
||||
List<AlarmAnalysisRule> allAnalysisRule();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IGardsNuclIdedAutoService extends IService<GardsNuclIded> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
|
||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IGardsNuclIdedManService extends IService<GardsNuclIded> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
|
||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IGardsNuclLibService extends IService<GardsNuclLib> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
|
||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IGardsXeResultsManService extends IService<GardsXeResults> {
|
||||
|
||||
List<ConcDto> getConc(Map<String,Object> params);
|
||||
|
||||
Set<String> nuclideNames(Set<String> nuclideNames);
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.DictConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.modules.base.dto.AlarmAnalysisRuleDto;
|
||||
import org.jeecg.modules.base.dto.AnalysisLogDto;
|
||||
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
|
||||
import org.jeecg.modules.base.vo.AnalysisLogVo;
|
||||
import org.jeecg.modules.feignclient.SystemClient;
|
||||
import org.jeecg.modules.mapper.AlarmAnalysisLogMapper;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AlarmAnalysisLogServiceImpl extends ServiceImpl<AlarmAnalysisLogMapper, AlarmAnalysisLog> implements IAlarmAnalysisLogService {
|
||||
|
||||
@Autowired
|
||||
private SystemClient systemClient;
|
||||
|
||||
@Override
|
||||
public Result findPage(AnalysisLogVo analysisLogVo) {
|
||||
String startDate = analysisLogVo.getStartDate();
|
||||
String endDate = analysisLogVo.getEndDate();
|
||||
if (StrUtil.isNotBlank(startDate))
|
||||
startDate += DateConstant.TIME_START;
|
||||
if (StrUtil.isNotBlank(endDate))
|
||||
endDate += DateConstant.TIME_END;
|
||||
List<AnalysisLogDto> result = baseMapper.findPage(startDate, endDate);
|
||||
List<String> source = analysisLogVo.getSource();
|
||||
List<String> stations = analysisLogVo.getStations();
|
||||
List<String> nuclides = analysisLogVo.getNuclides();
|
||||
String comma = SymbolConstant.COMMA;
|
||||
// 条件过滤
|
||||
if (CollUtil.isNotEmpty(source)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> sourceIds = ListUtil
|
||||
.toList(item.getSource().split(comma));
|
||||
return CollUtil.containsAny(sourceIds,source);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(stations)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> stationIds = ListUtil
|
||||
.toList(item.getStations().split(comma));
|
||||
return CollUtil.containsAny(stationIds,stations);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(nuclides)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> nuclideList = ListUtil
|
||||
.toList(item.getNuclides().split(comma));
|
||||
return CollUtil.containsAny(nuclideList,nuclides);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 数据字典
|
||||
List<DictModel> sourceDict = systemClient.getItems(DictConstant.ANALYSE_SOURCE);
|
||||
// 封装Source和Station
|
||||
for (AnalysisLogDto logDto : result) {
|
||||
// 数据源
|
||||
String sources = logDto.getSource();
|
||||
List<String> sourceList = getShow(sourceDict, sources);
|
||||
logDto.setSourceList(sourceList);
|
||||
// 台站
|
||||
String stationIds = logDto.getStations();
|
||||
if (StrUtil.isNotBlank(stationIds)){
|
||||
List<String> stationList = systemClient.stationCodes(stationIds);
|
||||
logDto.setStationList(stationList);
|
||||
}
|
||||
// 将nuclide的json串转换为对象集合
|
||||
String nuclideInfo = logDto.getNuclideInfo();
|
||||
if (StrUtil.isNotBlank(nuclideInfo)){
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<NuclideInfo> nuclideInfos = mapper.readValue(nuclideInfo,
|
||||
new TypeReference<List<NuclideInfo>>() {
|
||||
});
|
||||
logDto.setNuclideList(nuclideInfos);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 封装分页
|
||||
Integer pageNo = analysisLogVo.getPageNo();
|
||||
Integer pageSize = analysisLogVo.getPageSize();
|
||||
int total = result.size();
|
||||
int start = (pageNo - 1) * pageSize;
|
||||
int end = Math.min(start + pageSize, total);
|
||||
List<AnalysisLogDto> records = result.subList(start,end);
|
||||
Page<AnalysisLogDto> page = new Page<>(pageNo,pageSize,total);
|
||||
page.setRecords(records);
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
private List<String> getShow(List<DictModel> dictModels,String dict){
|
||||
List<String> show = new ArrayList<>();
|
||||
if (StrUtil.isBlank(dict))
|
||||
return null;
|
||||
List<String> dictList = ListUtil.toList(dict.split(SymbolConstant.COMMA));
|
||||
Map<String, String> dictMap = dictModels.stream().collect(Collectors
|
||||
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
|
||||
for (String key : dictList) {
|
||||
show.add(dictMap.get(key));
|
||||
}
|
||||
return show;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import org.jeecg.modules.mapper.AlarmAnalysisNuclideAvgMapper;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class AlarmAnalysisNuclideAvgServiceImpl extends ServiceImpl<AlarmAnalysisNuclideAvgMapper, AlarmAnalysisNuclideAvg> implements IAlarmAnalysisNuclideAvgService {
|
||||
|
||||
@Override
|
||||
public List<AlarmAnalysisNuclideAvg> list(Set<String> nuclideNames,String dataSourceType) {
|
||||
LocalDate dayAgo = LocalDate.now().minusDays(1);
|
||||
LambdaQueryWrapper<AlarmAnalysisNuclideAvg> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmAnalysisNuclideAvg::getDataSourceType,dataSourceType);
|
||||
wrapper.eq(AlarmAnalysisNuclideAvg::getCaclDate,dayAgo);
|
||||
wrapper.in(AlarmAnalysisNuclideAvg::getNuclide,nuclideNames);
|
||||
return list(wrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||
import org.jeecg.modules.mapper.AlarmAnalysisNuclideParamMapper;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@Service
|
||||
public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnalysisNuclideParamMapper, AlarmAnalysisNuclideParam> implements IAlarmAnalysisNuclideParamService {
|
||||
|
||||
@Override
|
||||
public AlarmAnalysisNuclideParam getLatest() {
|
||||
LambdaQueryWrapper<AlarmAnalysisNuclideParam> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByDesc(AlarmAnalysisNuclideParam::getCreateTime).last("LIMIT 1");
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean refresh() {
|
||||
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
|
||||
CopyOptions options = CopyOptions.create()
|
||||
.setIgnoreProperties("id","create_time");
|
||||
BeanUtil.copyProperties(getLatest(),nuclideParam,options);
|
||||
return save(nuclideParam);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,270 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
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.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.*;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.dto.AlarmAnalysisRuleDto;
|
||||
import org.jeecg.modules.base.dto.AlarmAnalysisRuleInfo;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.base.vo.AnalysisRuleVo;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupAbnormal;
|
||||
import org.jeecg.modules.feignclient.SystemClient;
|
||||
import org.jeecg.modules.mapper.AlarmAnalysisRuleMapper;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
||||
import org.jeecg.modules.service.IAlarmContactGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleMapper, AlarmAnalysisRule> implements IAlarmAnalysisRuleService {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private SystemClient systemClient;
|
||||
|
||||
@Autowired
|
||||
private IAlarmContactGroupService alarmContactGroupService;
|
||||
|
||||
@Override
|
||||
public Result page(AnalysisRuleVo analysisRuleVo) {
|
||||
Integer pageNo = analysisRuleVo.getPageNo();
|
||||
Integer pageSize = analysisRuleVo.getPageSize();
|
||||
List<String> source = analysisRuleVo.getSource();
|
||||
List<String> stations = analysisRuleVo.getStations();
|
||||
List<String> nuclide = analysisRuleVo.getNuclides();
|
||||
// 根据enabled和create_time进行降序排序
|
||||
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByDesc(AlarmAnalysisRule::getEnabled);
|
||||
wrapper.orderByDesc(AlarmAnalysisRule::getCreateTime);
|
||||
List<AlarmAnalysisRule> result = list(wrapper);
|
||||
String comma = SymbolConstant.COMMA;
|
||||
// 条件过滤
|
||||
if (CollUtil.isNotEmpty(source)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> sourceIds = ListUtil
|
||||
.toList(item.getSource().split(comma));
|
||||
return CollUtil.containsAny(sourceIds,source);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(stations)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> stationIds = ListUtil
|
||||
.toList(item.getStations().split(comma));
|
||||
return CollUtil.containsAny(stationIds,stations);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(nuclide)){
|
||||
result = result.stream().filter(item -> {
|
||||
List<String> nuclideList = ListUtil
|
||||
.toList(item.getNuclides().split(comma));
|
||||
return CollUtil.containsAny(nuclideList,nuclide);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
// 查询数据字典
|
||||
List<DictModel> conditionDict = systemClient.getItems(DictConstant.ANALYSE_CONDITION);
|
||||
List<DictModel> qualifierDict = systemClient.getItems(DictConstant.SPECTRAL_QUALIFIER);
|
||||
List<DictModel> sourceDict = systemClient.getItems(DictConstant.ANALYSE_SOURCE);
|
||||
|
||||
// 封装DTO
|
||||
List<AlarmAnalysisRuleDto> dtos = new ArrayList<>();
|
||||
String[] ignore = new String[]{"source","stations","nuclides",
|
||||
"spectralQualifier","conditions"};
|
||||
CopyOptions options = CopyOptions.create().setIgnoreProperties(ignore);
|
||||
for (AlarmAnalysisRule analysisRule : result) {
|
||||
AlarmAnalysisRuleDto analysisRuleDto = new AlarmAnalysisRuleDto();
|
||||
BeanUtil.copyProperties(analysisRule,analysisRuleDto,options);
|
||||
// 数据源
|
||||
String sources = analysisRule.getSource();
|
||||
List<String> sourceShow = getShow(sourceDict, sources);
|
||||
analysisRuleDto.setSource(sourceShow);
|
||||
// 台站
|
||||
String stationIds = analysisRule.getStations();
|
||||
if (StrUtil.isNotBlank(stationIds)){
|
||||
List<String> stationCodes = systemClient.stationCodes(stationIds);
|
||||
analysisRuleDto.setStations(stationCodes);
|
||||
}
|
||||
// 核素
|
||||
String nuclides = analysisRule.getNuclides();
|
||||
if (StrUtil.isNotBlank(nuclides))
|
||||
analysisRuleDto.setNuclides(ListUtil
|
||||
.toList(nuclides.split(comma)));
|
||||
// 谱类型
|
||||
String spectralQualifier = analysisRule.getSpectralQualifier();
|
||||
List<String> qualifierShow = getShow(qualifierDict, spectralQualifier);
|
||||
analysisRuleDto.setSpectralQualifier(qualifierShow);
|
||||
// 触发条件
|
||||
String conditions = analysisRule.getConditions();
|
||||
List<String> conditionShow = getShow(conditionDict, conditions);
|
||||
analysisRuleDto.setConditions(conditionShow);
|
||||
// 联系组组名
|
||||
String groupId = analysisRule.getContactGroup();
|
||||
if (StrUtil.isNotBlank(groupId)){
|
||||
AlarmContactGroupAbnormal group = alarmContactGroupService.getById(groupId);
|
||||
if (ObjectUtil.isNotNull(group))
|
||||
analysisRuleDto.setGroupName(group.getName());
|
||||
}
|
||||
dtos.add(analysisRuleDto);
|
||||
}
|
||||
// 封装分页
|
||||
int total = dtos.size();
|
||||
int start = (pageNo - 1) * pageSize;
|
||||
int end = Math.min(start + pageSize, total);
|
||||
|
||||
List<AlarmAnalysisRuleDto> records = dtos.subList(start, end);
|
||||
Page<AlarmAnalysisRuleDto> page = new Page<>(pageNo,pageSize,total);
|
||||
page.setRecords(records);
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result add(AlarmAnalysisRule alarmAnalysisRule) {
|
||||
String name = alarmAnalysisRule.getName();
|
||||
if (ObjectUtil.isNotNull(getByName(name)))
|
||||
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
|
||||
boolean success = save(alarmAnalysisRule);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.ADD_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.ADD_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result edit(AlarmAnalysisRule alarmAnalysisRule) {
|
||||
String id = alarmAnalysisRule.getId();
|
||||
String name = alarmAnalysisRule.getName();
|
||||
String original = getById(id).getName();
|
||||
if (!StrUtil.equalsIgnoreCase(name,original)){
|
||||
if (ObjectUtil.isNotNull(getByName(name)))
|
||||
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
|
||||
}
|
||||
boolean success = updateById(alarmAnalysisRule);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.UPDATE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.UPDATE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findInfo(String id) {
|
||||
AlarmAnalysisRuleInfo analysisRuleInfo = new AlarmAnalysisRuleInfo();
|
||||
AlarmAnalysisRule analysisRule = getById(id);
|
||||
BeanUtil.copyProperties(analysisRule,analysisRuleInfo);
|
||||
String comma = SymbolConstant.COMMA;
|
||||
List<String> sourceChecked = ListUtil
|
||||
.toList(analysisRule.getSource().split(comma));
|
||||
analysisRuleInfo.setSourceChecked(sourceChecked);
|
||||
List<String> stationChecked = ListUtil
|
||||
.toList(analysisRule.getStations().split(comma));
|
||||
analysisRuleInfo.setStationChecked(stationChecked);
|
||||
List<String> nuclidesChecked = ListUtil
|
||||
.toList(analysisRule.getNuclides().split(comma));
|
||||
analysisRuleInfo.setNuclidesChecked(nuclidesChecked);
|
||||
List<String> qualifierChecked = ListUtil
|
||||
.toList(analysisRule.getSpectralQualifier().split(comma));
|
||||
analysisRuleInfo.setQualifierChecked(qualifierChecked);
|
||||
List<String> conditionChecked = ListUtil
|
||||
.toList(analysisRule.getConditions().split(comma));
|
||||
analysisRuleInfo.setConditionChecked(conditionChecked);
|
||||
return Result.OK(analysisRuleInfo);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AlarmAnalysisRule getByName(String name) {
|
||||
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmAnalysisRule::getName, name);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateStatus(String id, Integer enabled) {
|
||||
AlarmAnalysisRule analysisRule = new AlarmAnalysisRule();
|
||||
analysisRule.setId(id);
|
||||
analysisRule.setEnabled(enabled);
|
||||
if (updateById(analysisRule)){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.UPDATE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.UPDATE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result delete(String id) {
|
||||
boolean success = removeById(id);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.DELETE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.DELETE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteBatch(List<String> ids) {
|
||||
if (CollUtil.isEmpty(ids))
|
||||
return Result.error(Prompt.PARAM_NOT_EMPTY);
|
||||
boolean success = removeByIds(ids);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.DELETE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.DELETE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlarmAnalysisRule> allAnalysisRule() {
|
||||
String key = RedisConstant.ANALYSIS_RULE;
|
||||
List<AlarmAnalysisRule> all;
|
||||
if (redisUtil.hasKey(key)){
|
||||
all = (List<AlarmAnalysisRule>)redisUtil.get(key);
|
||||
}else {
|
||||
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmAnalysisRule::getEnabled,CommonConstant.ENABLED);
|
||||
all = list(wrapper);
|
||||
redisUtil.set(key,all);
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
private List<String> getShow(List<DictModel> dictModels,String dict){
|
||||
List<String> show = new ArrayList<>();
|
||||
if (StrUtil.isBlank(dict))
|
||||
return null;
|
||||
List<String> dictList = ListUtil.toList(dict.split(SymbolConstant.COMMA));
|
||||
Map<String, String> dictMap = dictModels.stream().collect(Collectors
|
||||
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
|
||||
for (String key : dictList) {
|
||||
show.add(dictMap.get(key));
|
||||
}
|
||||
return show;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void rule2Redis(){
|
||||
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmAnalysisRule::getEnabled,CommonConstant.ENABLED);
|
||||
List<AlarmAnalysisRule> analysisRules = list(wrapper);
|
||||
String key = RedisConstant.ANALYSIS_RULE;
|
||||
redisUtil.set(key,analysisRules);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.modules.base.dto.AlarmRuleDto;
|
||||
|
@ -140,8 +141,8 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
@PostConstruct
|
||||
public void rule2Redis(){
|
||||
String colon = SymbolConstant.COLON;
|
||||
String prefixRule = CommonConstant.PREFIX_RULE;
|
||||
String prefixSilence = CommonConstant.PREFIX_SILENCE;
|
||||
String prefixRule = RedisConstant.PREFIX_RULE;
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmRule::getEnabled,1);
|
||||
List<AlarmRule> alarmRules = this.list(wrapper);
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class AnalysisResultServiceImpl implements AnalysisResultService {
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclIdedAutoService nuclIdedAutoService; // Auto Gamma
|
||||
|
||||
@Autowired
|
||||
private IGardsXeResultsAutoService xeResultsAutoService; // Auto Beta
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclIdedManService nuclIdedManService; // Man Gamma
|
||||
|
||||
@Autowired
|
||||
private IGardsXeResultsManService xeResultsManService; // Man Gamma
|
||||
|
||||
|
||||
@Override
|
||||
public Set<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
|
||||
if (CommonConstant.ARMDARR.equals(dataSourceType)){
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsAutoService.nuclideNames(nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedAutoService.nuclideNames(nuclideNames);
|
||||
}else {
|
||||
return nuclideNames;
|
||||
}
|
||||
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
|
||||
if (CommonConstant.BETA.equals(betaOrGamma)){
|
||||
return xeResultsManService.nuclideNames(nuclideNames);
|
||||
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
|
||||
return nuclIdedManService.nuclideNames(nuclideNames);
|
||||
}else {
|
||||
return nuclideNames;
|
||||
}
|
||||
}else {
|
||||
return nuclideNames;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CalculateConcServiceImpl implements CalculateConcService {
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclIdedAutoService nuclIdedAutoService;
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclIdedManService nuclIdedManService;
|
||||
|
||||
@Autowired
|
||||
private IGardsXeResultsAutoService xeResultsAutoService;
|
||||
|
||||
@Autowired
|
||||
private IGardsXeResultsManService xeResultsManService;
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisRuleService analysisRuleService;
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisNuclideParamService nuclideParamService;
|
||||
|
||||
@Override
|
||||
public void calcAndSave() {
|
||||
String comma = SymbolConstant.COMMA;
|
||||
List<AlarmAnalysisRule> analysisRules = analysisRuleService.allAnalysisRule();
|
||||
Set<String> nuclideNames = analysisRules.stream()
|
||||
.filter(rule -> StrUtil.isNotBlank(rule.getNuclides()))
|
||||
.map(AlarmAnalysisRule::getNuclides)
|
||||
.flatMap(nuclides -> ListUtil.toList(nuclides.split(comma)).stream())
|
||||
.collect(Collectors.toSet());
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("nuclideName",nuclideNames);
|
||||
AlarmAnalysisNuclideParam paramLatest = nuclideParamService.getLatest();
|
||||
BigDecimal index = paramLatest.getIndex();
|
||||
Integer days = paramLatest.getDays();
|
||||
LocalDate dayAgo = LocalDate.now().minusDays(1);
|
||||
LocalDate daysAgo = dayAgo.minusDays(days);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateConstant.DATE);
|
||||
String startDate = daysAgo.format(formatter);
|
||||
String endDate = dayAgo.format(formatter);
|
||||
params.put("startDate",startDate + DateConstant.TIME_START);
|
||||
params.put("endDate",endDate + DateConstant.TIME_END);
|
||||
/* Auto自动处理 */
|
||||
// beta-gamma
|
||||
List<ConcDto> xeConcAuto = xeResultsAutoService.getConc(params);
|
||||
// gamma
|
||||
List<ConcDto> nuclConcAuto = nuclIdedAutoService.getConc(params);
|
||||
Map<String,String> autoResult = new HashMap<>();
|
||||
autoResult.putAll(calculate(xeConcAuto,index));
|
||||
autoResult.putAll(calculate(nuclConcAuto,index));
|
||||
List<AlarmAnalysisNuclideAvg> autoAvgs = autoResult.entrySet().stream()
|
||||
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
autoAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDARR));
|
||||
/* Man人工交互 */
|
||||
// beta-gamma
|
||||
List<ConcDto> xeConcMan = xeResultsManService.getConc(params);
|
||||
// gamma
|
||||
List<ConcDto> nuclConcMan = nuclIdedManService.getConc(params);
|
||||
Map<String,String> manResult = new HashMap<>();
|
||||
manResult.putAll(calculate(xeConcMan,index));
|
||||
manResult.putAll(calculate(nuclConcMan,index));
|
||||
List<AlarmAnalysisNuclideAvg> manAvgs = manResult.entrySet().stream()
|
||||
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
manAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDRRR));
|
||||
manAvgs.addAll(autoAvgs);
|
||||
String cycle = startDate + SymbolConstant.WELL_NUMBER + endDate;
|
||||
manAvgs.forEach(item -> item.setCycle(cycle).setCaclDate(dayAgo));
|
||||
nuclideAvgService.saveBatch(manAvgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> calculate(List<ConcDto> concDtos, BigDecimal index) {
|
||||
Map<String,String> result = new HashMap<>();
|
||||
// 按照核素名进行分组
|
||||
Map<String, List<ConcDto>> concDtoMap = concDtos.stream()
|
||||
.collect(Collectors.groupingBy(ConcDto::getNuclideName));
|
||||
// 对每个核素进行计算
|
||||
for (Map.Entry<String, List<ConcDto>> entry : concDtoMap.entrySet()) {
|
||||
String nuclide = entry.getKey();
|
||||
// 核素的感兴趣浓度值列表,根据分析时间升序排列
|
||||
List<ConcDto> values = entry.getValue().stream()
|
||||
.sorted(Comparator.comparing(ConcDto::getAnalysisBegin))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(values)) continue;
|
||||
int baseLine = values.size();
|
||||
BigDecimal line = new BigDecimal(baseLine);
|
||||
int i = line.multiply(index).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
int j = Math.max(i - 1, 0);
|
||||
result.put(nuclide,values.get(j).getConc());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
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.entity.rnauto.GardsNuclIded;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;
|
||||
import org.jeecg.modules.service.IGardsNuclIdedAutoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsNuclIdedAutoServiceImpl extends ServiceImpl<GardsNuclIdedAutoMapper, GardsNuclIded> implements IGardsNuclIdedAutoService {
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
|
||||
Set<String> result = list(wrapper).stream()
|
||||
.map(GardsNuclIded::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
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.entity.rnman.GardsNuclIded;
|
||||
import org.jeecg.modules.mapper.GardsNuclIdedManMapper;
|
||||
import org.jeecg.modules.service.IGardsNuclIdedManService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsNuclIdedManServiceImpl extends ServiceImpl<GardsNuclIdedManMapper, GardsNuclIded> implements IGardsNuclIdedManService {
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
|
||||
Set<String> result = list(wrapper).stream()
|
||||
.map(GardsNuclIded::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.mapper.GardsNuclLibMapper;
|
||||
import org.jeecg.modules.service.IGardsNuclLibService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, GardsNuclLib> implements IGardsNuclLibService {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
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.entity.rnauto.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsXeResultsAutoMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsAutoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAutoMapper, GardsXeResults> implements IGardsXeResultsAutoService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
|
||||
Set<String> result = list(wrapper).stream()
|
||||
.map(GardsXeResults::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
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.rnman.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsXeResultsManMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsManService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManMapper, GardsXeResults> implements IGardsXeResultsManService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> nuclideNames(Set<String> nuclideNames) {
|
||||
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
|
||||
Set<String> result = list(wrapper).stream()
|
||||
.map(GardsXeResults::getNuclideName)
|
||||
.collect(Collectors.toSet());
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.DictConstant;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.modules.base.dto.DatabaseDto;
|
||||
import org.jeecg.modules.base.dto.SourceDto;
|
||||
import org.jeecg.modules.base.entity.postgre.SysDatabase;
|
||||
|
@ -27,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("sysDatabaseService")
|
||||
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
|
||||
|
@ -50,10 +53,12 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
|
|||
params.put("startDate",startDate);
|
||||
params.put("endDate",endDate);
|
||||
List<DatabaseDto> databaseDtos = baseMapper.findPage(params);
|
||||
Map<String, String> dataBaseMap = systemClient.dataBaseType();
|
||||
List<DictModel> items = systemClient.getItems(DictConstant.DATASOURCE_TYPE);
|
||||
Map<String, String> dataSourceMap = items.stream().collect(Collectors
|
||||
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
|
||||
for (DatabaseDto databaseDto : databaseDtos) {
|
||||
String type = databaseDto.getType();
|
||||
String dataBaseType = dataBaseMap.get(type);
|
||||
String dataBaseType = dataSourceMap.get(type);
|
||||
databaseDto.setDataBaseType(dataBaseType)
|
||||
.setOnline(true).setSlowQuery("328/s")
|
||||
.setAlarmRed(true).setCpuUutilzation("35.8%")
|
||||
|
@ -143,7 +148,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
|
|||
if (StrUtil.isNotBlank(startDate))
|
||||
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
|
||||
if (StrUtil.isNotBlank(endDate))
|
||||
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
|
||||
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
|
||||
Integer pageNo = sourceVo.getPageNo();
|
||||
Integer pageSize = sourceVo.getPageSize();
|
||||
Integer pageStart = (pageNo - 1) * pageSize;
|
||||
|
|
|
@ -125,7 +125,7 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
|
|||
if (StrUtil.isNotBlank(startDate))
|
||||
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
|
||||
if (StrUtil.isNotBlank(endDate))
|
||||
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
|
||||
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
|
||||
Integer pageNo = sourceVo.getPageNo();
|
||||
Integer pageSize = sourceVo.getPageSize();
|
||||
Integer pageStart = (pageNo - 1) * pageSize;
|
||||
|
|
|
@ -139,7 +139,7 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
|||
if (StrUtil.isNotBlank(startDate))
|
||||
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
|
||||
if (StrUtil.isNotBlank(endDate))
|
||||
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
|
||||
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
|
||||
Integer pageNo = sourceVo.getPageNo();
|
||||
Integer pageSize = sourceVo.getPageSize();
|
||||
Integer pageStart = (pageNo - 1) * pageSize;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
||||
import org.jeecg.modules.base.entity.postgre.SysEmail;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
@ -27,4 +28,6 @@ public interface AbnormalAlarmClient {
|
|||
/* AlarmLogController下相关接口 */
|
||||
@PostMapping("/alarmLog/create")
|
||||
Result create(@RequestBody AlarmLog alarmLog);
|
||||
|
||||
/* AlarmAnalysisRuleController下相关接口 */
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||
|
@ -28,9 +29,10 @@ import static org.jeecg.common.util.TokenUtils.getTempToken;
|
|||
@Component
|
||||
public class SendMessage {
|
||||
|
||||
private final String System = "Username";
|
||||
private final String Email = "Email";
|
||||
private final String Sms = "Phone";
|
||||
private final String Email = "Email";
|
||||
private final String System = "Username";
|
||||
private final String comma = SymbolConstant.COMMA;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
@ -55,7 +57,7 @@ public class SendMessage {
|
|||
|
||||
Map<String, String> contact = getContact(groupId);
|
||||
if (StrUtil.isBlank(notific))return;
|
||||
List<String> ways = ListUtil.toList(notific.split(","));
|
||||
List<String> ways = ListUtil.toList(notific.split(comma));
|
||||
if (ways.contains(ALL.getValue())){
|
||||
ways = ListUtil.toList(XT.getValue(), YJ.getValue(),SMS.getValue());
|
||||
}
|
||||
|
@ -100,17 +102,17 @@ public class SendMessage {
|
|||
String usernameList = sysUsers.stream()
|
||||
.filter(user -> StrUtil.isNotBlank(user.getUsername()))
|
||||
.map(SysUser::getUsername)
|
||||
.collect(Collectors.joining(","));
|
||||
.collect(Collectors.joining(comma));
|
||||
// 邮箱
|
||||
String emailList = sysUsers.stream()
|
||||
.filter(user -> StrUtil.isNotBlank(user.getEmail()))
|
||||
.map(SysUser::getEmail)
|
||||
.collect(Collectors.joining(","));
|
||||
.collect(Collectors.joining(comma));
|
||||
// 手机号码
|
||||
String phoneList = sysUsers.stream()
|
||||
.filter(user -> StrUtil.isNotBlank(user.getPhone()))
|
||||
.map(SysUser::getPhone)
|
||||
.collect(Collectors.joining(","));
|
||||
.collect(Collectors.joining(comma));
|
||||
Map<String,String> result = new HashMap<>();
|
||||
result.put(System,usernameList);
|
||||
result.put(Email,emailList);
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.message.handle.impl.EmailPushMsgHandle;
|
||||
import org.quartz.*;
|
||||
|
||||
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||
/**
|
||||
* @Description: 同步定时任务测试
|
||||
*
|
||||
* 此处的同步是指 当定时任务的执行时间大于任务的时间间隔时
|
||||
* 会等待第一个任务执行完成才会走第二个任务
|
||||
*
|
||||
*
|
||||
* @author: taoyan
|
||||
* @date: 2020年06月19日
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
@PersistJobDataAfterExecution
|
||||
public class AsyncJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
// start:生成临时Token到线程中
|
||||
UserTokenContext.setToken(getTempToken());
|
||||
|
||||
EmailPushMsgHandle emailPushMsgHandle = SpringContextUtils.getBean(EmailPushMsgHandle.class);
|
||||
emailPushMsgHandle.sendMessage(new MessageDTO("xiao","nzyone@qq.com","测试邮件","这是一封测试邮件"));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
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(){
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class DatabaseJob implements Job {
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@ import lombok.Data;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.util.RedisStreamUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.base.entity.Rule;
|
||||
|
@ -48,7 +50,7 @@ public class SysInfoJob implements Job {
|
|||
AbnormalAlarmClient alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||
|
||||
// 查询所有报警规则,根据报警规则查询监控项数据
|
||||
String pattern = CommonConstant.PREFIX_RULE;
|
||||
String pattern = RedisConstant.PREFIX_RULE;
|
||||
Set<String> keys = redisStreamUtil.keys(pattern);
|
||||
if (CollUtil.isEmpty(keys)) {
|
||||
log.error("当前没有需要监控的预警规则!");
|
||||
|
@ -61,11 +63,11 @@ public class SysInfoJob implements Job {
|
|||
.withNano(0);
|
||||
LocalDateTime beforeMin = now.minusMinutes(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter
|
||||
.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
.ofPattern(DateConstant.DATE_TIME);
|
||||
String start = beforeMin.format(formatter);
|
||||
String end = now.format(formatter);
|
||||
|
||||
String prefixSilence = CommonConstant.PREFIX_SILENCE;
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
for (String ruleKey : keys) {
|
||||
String operator = "";
|
||||
try {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package org.jeecg.modules.redisStream;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.dto.RuleDto;
|
||||
import org.jeecg.modules.base.enums.SourceType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.stream.ObjectRecord;
|
||||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.stream.StreamListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
@Data
|
||||
@Slf4j
|
||||
@Component
|
||||
@NoArgsConstructor
|
||||
public class ConsumeA2 implements StreamListener<String, ObjectRecord<String, RuleDto>> {
|
||||
|
||||
private String consumerName;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Override
|
||||
public void onMessage(ObjectRecord<String, RuleDto> message) {
|
||||
String streamKey = message.getStream();
|
||||
RecordId recordId = message.getId();
|
||||
RuleDto msg = message.getValue();
|
||||
String prefix = CommonConstant.PREFIX_RULE;
|
||||
SourceType sourceType = msg.getSourceType();
|
||||
String key = prefix + sourceType + "_";
|
||||
|
||||
log.info("[自动ACK][name:"+consumerName+"][streamKey:{}][id:{}][message:{}]", streamKey, recordId, msg);
|
||||
// redisStreamUtil.del(streamKey, id.getValue());
|
||||
}
|
||||
|
||||
public ConsumeA2(String consumerName) {
|
||||
this.consumerName = consumerName;
|
||||
}
|
||||
}
|
|
@ -93,4 +93,9 @@ public class GardsStationsController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("getCodes")
|
||||
@ApiOperation(value = "获取台站Code", notes = "获取台站Code")
|
||||
public List<String> getCodes(@RequestParam String stationIds){
|
||||
return gardsStationsService.getCodeByIds(stationIds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.jeecg.modules.base.entity.postgre.SysDataSource;
|
|||
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||
import org.jeecg.modules.system.service.ISysDataSourceService;
|
||||
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -22,27 +23,32 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "核素默认配置")
|
||||
@Api(value = "核素默认配置管理",tags = "核素默认配置管理")
|
||||
@RestController
|
||||
@RequestMapping("sys/defaultNuclide")
|
||||
@RequestMapping("/sys/defaultNuclide")
|
||||
public class SysDefaultNuclideController extends JeecgController<SysDefaultNuclide, ISysDefaultNuclideService> {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ISysDefaultNuclideService sysDefaultNuclideService;
|
||||
|
||||
@AutoLog(value = "核素默认配置-获取全部数据")
|
||||
@ApiOperation(value = "核素默认配置-获取全部数据", notes = "核素默认配置-获取全部数据")
|
||||
@ApiOperation(value = "核素配置信息分页查询", notes = "核素配置信息分页查询")
|
||||
@GetMapping(value = "/findPage")
|
||||
public Result<?> findPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req, Integer useType) {
|
||||
@RequestParam Integer useType) {
|
||||
Result<IPage<SysDefaultNuclide>> iPageResult = sysDefaultNuclideService.queryNuclideByType(pageNo, pageSize, useType);
|
||||
return Result.ok(iPageResult);
|
||||
}
|
||||
|
||||
@AutoLog(value = "核素默认配置-添加")
|
||||
@ApiOperation(value = "核素默认配置-添加", notes = "核素默认配置-添加")
|
||||
@ApiOperation(value = "核素名称列表", notes = "核素名称列表")
|
||||
@GetMapping(value = "/allName")
|
||||
public Result<?> allName(@RequestParam Integer useType) {
|
||||
return sysDefaultNuclideService.allName(useType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "添加核素配置信息", notes = "核素默认配置-添加添加核素配置信息")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add() {
|
||||
String path = "/Users/later/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/1cbf41e7428fb5b814d0c66ac2155730/Message/MessageTemp/7a75277a2ac9468655241c0718e9804e/OpenData/P_default.nuclide";
|
||||
|
|
|
@ -706,14 +706,8 @@ public class SysDictController {
|
|||
return sysDictService.findStationListByMenuName(menuName);
|
||||
}
|
||||
|
||||
@GetMapping("dataBaseType")
|
||||
public Map<String,String> dataBaseType(){
|
||||
List<DatabaseTypeDto> databaseTypeDtos = sysDictService.dataBaseType();
|
||||
Map<String, String> dataBaseMap = databaseTypeDtos.stream()
|
||||
.collect(Collectors.toMap(
|
||||
DatabaseTypeDto::getValue,
|
||||
DatabaseTypeDto::getText,
|
||||
(oldValue, newValue) -> newValue));
|
||||
return dataBaseMap;
|
||||
@GetMapping("getItems")
|
||||
public List<DictModel> getItems(@RequestParam String dictCode){
|
||||
return sysDictService.getItems(dictCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||
|
||||
@Mapper
|
||||
public interface SysDefaultNuclideMapper extends BaseMapper<SysDefaultNuclide> {
|
||||
|
||||
}
|
||||
|
|
|
@ -275,5 +275,4 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
|
||||
|
||||
List<DatabaseTypeDto> dataBaseType();
|
||||
}
|
||||
|
|
|
@ -229,14 +229,4 @@
|
|||
and low_app_id = #{lowAppId}
|
||||
and tenant_id = #{tenantId}
|
||||
</select>
|
||||
|
||||
<select id="dataBaseType" resultType="org.jeecg.modules.system.dto.DatabaseTypeDto">
|
||||
SELECT
|
||||
item_value AS VALUE,
|
||||
item_text AS TEXT
|
||||
FROM
|
||||
sys_dict_item di
|
||||
INNER JOIN sys_dict d ON di.dict_id = d.id
|
||||
WHERE d.dict_code = 'database_type'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -61,4 +61,5 @@ public interface IGardsStationsService extends IService<GardsStations> {
|
|||
*/
|
||||
List<GardsStations> getGardsStations();
|
||||
|
||||
List<String> getCodeByIds(String stationIds);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 核素默认配置
|
||||
|
@ -19,4 +21,5 @@ public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> {
|
|||
|
||||
Result<IPage<SysDefaultNuclide>> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType);
|
||||
|
||||
Result<?> allName(Integer useType);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.DictQuery;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
||||
|
@ -279,5 +280,5 @@ public interface ISysDictService extends IService<SysDict> {
|
|||
|
||||
List<GardsStations> findStationListByMenuName(String menuName);
|
||||
|
||||
List<DatabaseTypeDto> dataBaseType();
|
||||
List<DictModel> getItems(String dictCode);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -9,6 +11,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
||||
import org.jeecg.modules.system.mapper.GardsStationsMapper;
|
||||
|
@ -180,4 +185,25 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
|
|||
redisUtil.set("stationInfoMap",stationInfoMap);
|
||||
return gardsStations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCodeByIds(String stationIds) {
|
||||
List<String> stationCodes = new ArrayList<>();
|
||||
Map<String, String> stationCodeMap;
|
||||
List<String> idList = ListUtil.toList(stationIds.split(SymbolConstant.COMMA));
|
||||
String key = RedisConstant.STATION_CODE_MAP;
|
||||
if (redisUtil.hasKey(key)){
|
||||
stationCodeMap = (Map<String, String>) redisUtil.get(key);
|
||||
}else {
|
||||
List<GardsStations> gardsStations = list();
|
||||
stationCodeMap = gardsStations.stream().collect(Collectors.toMap(
|
||||
station -> String.valueOf(station.getStationId()),
|
||||
GardsStations::getStationCode));
|
||||
redisUtil.set(key,stationCodeMap);
|
||||
}
|
||||
for (String stationId : idList) {
|
||||
stationCodes.add(stationCodeMap.get(stationId));
|
||||
}
|
||||
return stationCodes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ import org.jeecg.modules.system.mapper.SysDefaultNuclideMapper;
|
|||
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideMapper, SysDefaultNuclide> implements ISysDefaultNuclideService {
|
||||
|
@ -25,4 +28,14 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
|
|||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> allName(Integer useType) {
|
||||
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(SysDefaultNuclide::getUseType,useType);
|
||||
List<String> allName = list(wrapper).stream()
|
||||
.map(SysDefaultNuclide::getNuclideName)
|
||||
.collect(Collectors.toList());
|
||||
return Result.OK(allName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -571,8 +572,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DatabaseTypeDto> dataBaseType() {
|
||||
return baseMapper.dataBaseType();
|
||||
public List<DictModel> getItems(String dictCode) {
|
||||
return baseMapper.queryDictItemsByCode(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#code_generate_project_path
|
||||
project_path=C:\\Users\\a\\Desktop
|
||||
#bussi_package[User defined]
|
||||
bussi_package=org.jeecg.modules.demo
|
||||
bussi_package=org.jeecg
|
||||
#bussi_package=org.jeecg.modules
|
||||
|
||||
|
||||
#default code path
|
||||
|
|
|
@ -12,6 +12,18 @@
|
|||
#password=123456
|
||||
#database_name=original
|
||||
|
||||
#diver_name=oracle.jdbc.driver.OracleDriver
|
||||
#url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
|
||||
#username=configuration
|
||||
#password=123456
|
||||
#database_name=configuration
|
||||
|
||||
#diver_name=oracle.jdbc.driver.OracleDriver
|
||||
#url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
|
||||
#username=rnauto
|
||||
#password=123456
|
||||
#database_name=rnauto
|
||||
|
||||
#postgre
|
||||
diver_name=org.postgresql.Driver
|
||||
url=jdbc:postgresql://182.92.183.230:5432/jeecg-boot
|
||||
|
|
|
@ -210,7 +210,6 @@ public class ReadLineUtil {
|
|||
|
||||
// 获取文件名
|
||||
String fileName = FileUtil.getName(filePath);
|
||||
if (!fileName.endsWith(txt.getType()))fileName += txt.getType();
|
||||
|
||||
// 在当前工作路径下读取文件
|
||||
ftpClient.enterLocalPassiveMode();
|
||||
|
|
|
@ -23,6 +23,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jeecg.common.constant.enums.FileTypeEnum.txt;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("webStatistics")
|
||||
@Api(value = "统计分析管理", tags = "统计分析管理")
|
||||
|
@ -75,6 +77,7 @@ public class WebStatisticsController {
|
|||
}
|
||||
|
||||
@GetMapping("findAlertSohPage")
|
||||
@ApiOperation(value = "台站报警数据分页查询", notes = "台站报警数据分页查询")
|
||||
public Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
|
||||
return gardsSohDataService.findAlertSohPage(queryRequest, stationIds, startTime, endTime);
|
||||
}
|
||||
|
@ -85,6 +88,12 @@ public class WebStatisticsController {
|
|||
return gardsSampleDataWebService.findGeneratedReport(sampleId);
|
||||
}
|
||||
|
||||
@GetMapping("sampleInfo")
|
||||
@ApiOperation(value = "查看谱的详细信息", notes = "查看谱的详细信息")
|
||||
public Result sampleInfo(@RequestParam Integer sampleId){
|
||||
return gardsSampleDataWebService.sampleInfo(sampleId);
|
||||
}
|
||||
|
||||
@GetMapping("radionuclideFile")
|
||||
@ApiOperation("查看Radionuclide的文件")
|
||||
public Result radionuclideFile(@RequestParam Integer sampleId,
|
||||
|
@ -121,6 +130,8 @@ public class WebStatisticsController {
|
|||
if (StrUtil.isBlank(reportPath))
|
||||
return Result.error(Prompt.FILE_NOT_EXITS);
|
||||
// 将FTP上的文件转为文件流返回到前端
|
||||
if (!reportPath.endsWith(txt.getType()))
|
||||
reportPath += txt.getType();
|
||||
return readLineUtil.readFtpFile(reportPath,response);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user