feat:Beta RLR
This commit is contained in:
parent
3707146ad2
commit
78d14289f4
|
@ -18,6 +18,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class RedisStreamUtil {
|
public class RedisStreamUtil {
|
||||||
|
@ -46,6 +47,30 @@ public class RedisStreamUtil {
|
||||||
return redisTemplate.opsForValue().get(key);
|
return redisTemplate.opsForValue().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean set(String key, Object value) {
|
||||||
|
try {
|
||||||
|
this.redisTemplate.opsForValue().set(key, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception var4) {
|
||||||
|
var4.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean set(String key, Object value, long time) {
|
||||||
|
try {
|
||||||
|
if (time > 0L) {
|
||||||
|
this.redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||||
|
} else {
|
||||||
|
this.set(key, value);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception var6) {
|
||||||
|
var6.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据streamKey获取所有消费组
|
* 根据streamKey获取所有消费组
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package org.jeecg.modules.base.bizVo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jeecg.modules.entity.vo.Nuclides;
|
||||||
|
import org.jeecg.modules.entity.vo.Ratios;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BetaRLR implements Serializable {
|
||||||
|
|
||||||
|
// #General-Infomation
|
||||||
|
private String laboratory;
|
||||||
|
private String srid;
|
||||||
|
private String colloct_start_date;
|
||||||
|
private String colloct_start_time;
|
||||||
|
private String colloct_stop_date;
|
||||||
|
private String colloct_stop_time;
|
||||||
|
private String receiptDate;
|
||||||
|
private String receiptTime;
|
||||||
|
private String reportTransmissionDate;
|
||||||
|
private String reportTransmissionTime;
|
||||||
|
|
||||||
|
// #Transport-Infomation
|
||||||
|
private String comments;
|
||||||
|
private String otherComments;
|
||||||
|
|
||||||
|
// #Analysis Results
|
||||||
|
private String pressureInTheArchiveBottle;
|
||||||
|
private String volumeOfArchiveBottle;
|
||||||
|
private String gasComposition;
|
||||||
|
private String stableXeMeasStartDate;
|
||||||
|
private String stableXeMeasStartTime;
|
||||||
|
private String stableXenonVolumeInTheArchiveBottle;
|
||||||
|
private String uncertaintyOfStableXenonVolume;
|
||||||
|
private String stableXenonVolumeInTheMeasurementCell;
|
||||||
|
private String uncertaintyOfStableXenonVolume2;
|
||||||
|
private String acq_start_date;
|
||||||
|
private String acq_start_time;
|
||||||
|
private String acq_live_time;
|
||||||
|
|
||||||
|
// #Nuclides
|
||||||
|
private List<Nuclides> nuclides;
|
||||||
|
|
||||||
|
// #Ratios
|
||||||
|
private List<Ratios> ratios;
|
||||||
|
|
||||||
|
// #Methods
|
||||||
|
private String samplingHandling;
|
||||||
|
private String equipmentUsed;
|
||||||
|
private String softwareUsed;
|
||||||
|
|
||||||
|
// #Additional Info
|
||||||
|
private String xeTransfer;
|
||||||
|
private String uncertaintyOfXe;
|
||||||
|
private String commentsInfo;
|
||||||
|
private String detailedDescriptionM;
|
||||||
|
private String detailedDescriptionS;
|
||||||
|
private String uncertaintyBudget;
|
||||||
|
private String informationOn;
|
||||||
|
private String ysical;
|
||||||
|
|
||||||
|
public BetaRLR() {
|
||||||
|
this.nuclides = new ArrayList<>();
|
||||||
|
this.ratios = new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.base.bizVo;
|
package org.jeecg.modules.base.bizVo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
|
|
||||||
|
@ -21,8 +22,11 @@ public class GammaRLR {
|
||||||
private String header_transmission;
|
private String header_transmission;
|
||||||
|
|
||||||
// #objective
|
// #objective
|
||||||
|
@JsonProperty("Obj_purpose")
|
||||||
private String Obj_purpose;
|
private String Obj_purpose;
|
||||||
|
@JsonProperty("Obj_authorized")
|
||||||
private String Obj_authorized;
|
private String Obj_authorized;
|
||||||
|
@JsonProperty("Obj_instruction")
|
||||||
private String Obj_instruction;
|
private String Obj_instruction;
|
||||||
|
|
||||||
// #collection
|
// #collection
|
||||||
|
@ -31,47 +35,72 @@ public class GammaRLR {
|
||||||
private Double collect_airVolume;
|
private Double collect_airVolume;
|
||||||
|
|
||||||
// #sampleReceipt
|
// #sampleReceipt
|
||||||
|
@JsonProperty("Receipt_srid")
|
||||||
private String Receipt_srid;
|
private String Receipt_srid;
|
||||||
|
@JsonProperty("Receipt_sealNum")
|
||||||
private String Receipt_sealNum;
|
private String Receipt_sealNum;
|
||||||
|
@JsonProperty("Receipt_sample_dateTime")
|
||||||
private String Receipt_sample_dateTime;
|
private String Receipt_sample_dateTime;
|
||||||
|
@JsonProperty("Receipt_package")
|
||||||
private String Receipt_package;
|
private String Receipt_package;
|
||||||
|
@JsonProperty("Receipt_seal")
|
||||||
private String Receipt_seal;
|
private String Receipt_seal;
|
||||||
|
@JsonProperty("Receipt_sample")
|
||||||
private String Receipt_sample;
|
private String Receipt_sample;
|
||||||
|
|
||||||
// #test
|
// #test
|
||||||
|
@JsonProperty("Test_type")
|
||||||
private String Test_type;
|
private String Test_type;
|
||||||
|
@JsonProperty("Test_completion")
|
||||||
private String Test_completion;
|
private String Test_completion;
|
||||||
|
@JsonProperty("Test_person")
|
||||||
private String Test_person;
|
private String Test_person;
|
||||||
|
@JsonProperty("Test_purpose")
|
||||||
private String Test_purpose;
|
private String Test_purpose;
|
||||||
|
|
||||||
// #peakMethond
|
// #peakMethond
|
||||||
|
@JsonProperty("PeakMethod_software")
|
||||||
private String PeakMethod_software;
|
private String PeakMethod_software;
|
||||||
|
@JsonProperty("PeakMethod_location")
|
||||||
private String PeakMethod_location;
|
private String PeakMethod_location;
|
||||||
|
|
||||||
// #peakFit
|
// #peakFit
|
||||||
private List<TablePeakFit> peakFit;
|
private List<TablePeakFit> peakFit;
|
||||||
|
|
||||||
// #g_AnalysisMethods
|
// #g_AnalysisMethods
|
||||||
|
@JsonProperty("AnalyMethod_software")
|
||||||
private String AnalyMethod_software;
|
private String AnalyMethod_software;
|
||||||
|
@JsonProperty("AnalyMethod_nuclide")
|
||||||
private String AnalyMethod_nuclide;
|
private String AnalyMethod_nuclide;
|
||||||
|
@JsonProperty("AnalyMethod_baseline")
|
||||||
private String AnalyMethod_baseline;
|
private String AnalyMethod_baseline;
|
||||||
|
@JsonProperty("AnalyMethod_lc")
|
||||||
private String AnalyMethod_lc;
|
private String AnalyMethod_lc;
|
||||||
|
@JsonProperty("AnalyMethod_calib")
|
||||||
private String AnalyMethod_calib;
|
private String AnalyMethod_calib;
|
||||||
|
|
||||||
// #peakAssociation
|
// #peakAssociation
|
||||||
|
@JsonProperty("Association")
|
||||||
private List<TableAssociation> Association;
|
private List<TableAssociation> Association;
|
||||||
|
|
||||||
// #References
|
// #References
|
||||||
|
@JsonProperty("Reference_samplePHD")
|
||||||
private String Reference_samplePHD;
|
private String Reference_samplePHD;
|
||||||
|
@JsonProperty("Reference_CalibPHD")
|
||||||
private String Reference_CalibPHD;
|
private String Reference_CalibPHD;
|
||||||
|
@JsonProperty("Reference_physical")
|
||||||
private String Reference_physical;
|
private String Reference_physical;
|
||||||
|
|
||||||
// #Results
|
// #Results
|
||||||
|
@JsonProperty("Result_act_ref")
|
||||||
private String Result_act_ref;
|
private String Result_act_ref;
|
||||||
|
@JsonProperty("Result_conc_ref")
|
||||||
private String Result_conc_ref;
|
private String Result_conc_ref;
|
||||||
|
@JsonProperty("Result")
|
||||||
private List<TableResult> Result;
|
private List<TableResult> Result;
|
||||||
|
|
||||||
// #NuclideRatios
|
// #NuclideRatios
|
||||||
|
@JsonProperty("NuclideRatios")
|
||||||
private List<NuclideRatios> NuclideRatios;
|
private List<NuclideRatios> NuclideRatios;
|
||||||
|
|
||||||
// #g_CoincidenceCorrection
|
// #g_CoincidenceCorrection
|
||||||
|
@ -82,11 +111,15 @@ public class GammaRLR {
|
||||||
|
|
||||||
// #Conclusions
|
// #Conclusions
|
||||||
private String conclusion_person;
|
private String conclusion_person;
|
||||||
|
@JsonProperty("Conclusion_IDC")
|
||||||
private String Conclusion_IDC;
|
private String Conclusion_IDC;
|
||||||
|
@JsonProperty("Conclusion_Lab")
|
||||||
private String Conclusion_Lab;
|
private String Conclusion_Lab;
|
||||||
|
@JsonProperty("Conclusion_Res")
|
||||||
private String Conclusion_Res;
|
private String Conclusion_Res;
|
||||||
|
|
||||||
// #Comment
|
// #Comment
|
||||||
|
@JsonProperty("Comment")
|
||||||
private String Comment;
|
private String Comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.jeecg.modules.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Nuclides implements Serializable {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String activity;
|
||||||
|
|
||||||
|
private String uncertActivity;
|
||||||
|
|
||||||
|
private String mda;
|
||||||
|
|
||||||
|
private String concentration;
|
||||||
|
|
||||||
|
private String uncertConcentration;
|
||||||
|
|
||||||
|
private String mdc;
|
||||||
|
|
||||||
|
private String lc;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.jeecg.modules.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Ratios implements Serializable {
|
||||||
|
|
||||||
|
private String nuclide1;
|
||||||
|
|
||||||
|
private String nuclide2;
|
||||||
|
|
||||||
|
private String isotopeRatio;
|
||||||
|
|
||||||
|
private String uncertRatio;
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
|
@ -7,17 +7,17 @@ import org.jeecg.modules.base.bizVo.AlarmRuleVo;
|
||||||
|
|
||||||
public interface IAlarmRuleService extends IService<AlarmRule> {
|
public interface IAlarmRuleService extends IService<AlarmRule> {
|
||||||
|
|
||||||
Result findPage(AlarmRuleVo alarmRuleVo);
|
Result<?> findPage(AlarmRuleVo alarmRuleVo);
|
||||||
|
|
||||||
Result findInfo(String alarmRuleId);
|
Result<?> findInfo(String alarmRuleId);
|
||||||
|
|
||||||
Result create(AlarmRule alarmRule);
|
Result<?> create(AlarmRule alarmRule);
|
||||||
|
|
||||||
Result update(AlarmRule alarmRule);
|
Result<?> update(AlarmRule alarmRule);
|
||||||
|
|
||||||
Result deleteById(String alarmRuleId);
|
Result<?> deleteById(String alarmRuleId);
|
||||||
|
|
||||||
Result getSourceByType(String sourceType);
|
Result<?> getSourceByType(String sourceType);
|
||||||
|
|
||||||
Result updateStatus(String alarmRuleId,Integer enabled);
|
Result<?> updateStatus(String alarmRuleId,Integer enabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.jeecg.common.constant.Prompt;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.util.RedisStreamUtil;
|
import org.jeecg.common.util.RedisStreamUtil;
|
||||||
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.base.dto.AlarmRuleDto;
|
import org.jeecg.modules.base.dto.AlarmRuleDto;
|
||||||
import org.jeecg.modules.base.dto.AlarmRuleInfo;
|
import org.jeecg.modules.base.dto.AlarmRuleInfo;
|
||||||
import org.jeecg.modules.base.dto.SourceDto;
|
import org.jeecg.modules.base.dto.SourceDto;
|
||||||
|
@ -36,6 +37,9 @@ import static org.jeecg.modules.base.enums.SourceType.*;
|
||||||
@Service("alarmRuleService")
|
@Service("alarmRuleService")
|
||||||
public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule> implements IAlarmRuleService {
|
public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule> implements IAlarmRuleService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisStreamUtil redisStreamUtil;
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
|
||||||
|
@ -49,7 +53,7 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
||||||
private ISysDatabaseService databaseService;
|
private ISysDatabaseService databaseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findPage(AlarmRuleVo alarmRuleVo) {
|
public Result<?> findPage(AlarmRuleVo alarmRuleVo) {
|
||||||
Integer pageNo = alarmRuleVo.getPageNo();
|
Integer pageNo = alarmRuleVo.getPageNo();
|
||||||
Integer pageSize = alarmRuleVo.getPageSize();
|
Integer pageSize = alarmRuleVo.getPageSize();
|
||||||
Page<AlarmRuleDto> page = new Page<>(pageNo,pageSize);
|
Page<AlarmRuleDto> page = new Page<>(pageNo,pageSize);
|
||||||
|
@ -61,31 +65,34 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
||||||
page.setRecords(alarmHistories);
|
page.setRecords(alarmHistories);
|
||||||
// 获取数据总条数(经过查询条件过滤后的)
|
// 获取数据总条数(经过查询条件过滤后的)
|
||||||
params.put("pageFlag","noPage");
|
params.put("pageFlag","noPage");
|
||||||
Integer total = baseMapper.findPage(params).size();
|
int total = baseMapper.findPage(params).size();
|
||||||
page.setTotal(total);
|
page.setTotal(total);
|
||||||
return Result.OK(page);
|
return Result.OK(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findInfo(String alarmRuleId) {
|
public Result<?> findInfo(String alarmRuleId) {
|
||||||
AlarmRuleInfo alarmRuleInfo = baseMapper.findInfo(alarmRuleId);
|
AlarmRuleInfo alarmRuleInfo = baseMapper.findInfo(alarmRuleId);
|
||||||
return Result.OK(alarmRuleInfo);
|
return Result.OK(alarmRuleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result create(AlarmRule alarmRule) {
|
public Result<?> create(AlarmRule alarmRule) {
|
||||||
Rule rule = alarmRule.getRule();
|
Rule rule = alarmRule.getRule();
|
||||||
if (ObjectUtil.isNotNull(rule)){
|
if (ObjectUtil.isNotNull(rule)){
|
||||||
String operator = JSON.toJSONString(rule);
|
String operator = JSON.toJSONString(rule);
|
||||||
alarmRule.setOperator(operator);
|
alarmRule.setOperator(operator);
|
||||||
}
|
}
|
||||||
this.baseMapper.insert(alarmRule);
|
boolean success = save(alarmRule);
|
||||||
rule2Redis();
|
if (success){
|
||||||
return Result.OK(Prompt.ADD_SUCC);
|
rule2Redis();
|
||||||
|
return Result.OK(Prompt.ADD_SUCC);
|
||||||
|
}
|
||||||
|
return Result.error(Prompt.ADD_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result update(AlarmRule alarmRule) {
|
public Result<?> update(AlarmRule alarmRule) {
|
||||||
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(AlarmRule::getId, alarmRule.getId());
|
wrapper.eq(AlarmRule::getId, alarmRule.getId());
|
||||||
AlarmRule alarmRuleOld = this.baseMapper.selectOne(wrapper);
|
AlarmRule alarmRuleOld = this.baseMapper.selectOne(wrapper);
|
||||||
|
@ -97,20 +104,26 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
||||||
String operator = JSON.toJSONString(rule);
|
String operator = JSON.toJSONString(rule);
|
||||||
alarmRule.setOperator(operator);
|
alarmRule.setOperator(operator);
|
||||||
}
|
}
|
||||||
this.baseMapper.updateById(alarmRule);
|
boolean success = updateById(alarmRule);
|
||||||
rule2Redis();
|
if (success){
|
||||||
return Result.OK(Prompt.UPDATE_SUCC);
|
rule2Redis();
|
||||||
|
return Result.OK(Prompt.UPDATE_SUCC);
|
||||||
|
}
|
||||||
|
return Result.error(Prompt.UPDATE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result deleteById(String alarmRuleId) {
|
public Result<?> deleteById(String alarmRuleId) {
|
||||||
this.baseMapper.deleteById(alarmRuleId);
|
boolean success = removeById(alarmRuleId);
|
||||||
rule2Redis();
|
if (success){
|
||||||
return Result.OK(Prompt.DELETE_SUCC);
|
rule2Redis();
|
||||||
|
return Result.OK(Prompt.DELETE_SUCC);
|
||||||
|
}
|
||||||
|
return Result.error(Prompt.DELETE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getSourceByType(String sourceType) {
|
public Result<?> getSourceByType(String sourceType) {
|
||||||
List<SourceDto> sourceDtos = new ArrayList<>();
|
List<SourceDto> sourceDtos = new ArrayList<>();
|
||||||
if (EMAIL.getType().equals(sourceType)){
|
if (EMAIL.getType().equals(sourceType)){
|
||||||
sourceDtos = emailService.listAll();
|
sourceDtos = emailService.listAll();
|
||||||
|
@ -123,12 +136,14 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result updateStatus(String alarmRuleId,Integer enabled) {
|
public Result<?> updateStatus(String alarmRuleId,Integer enabled) {
|
||||||
AlarmRule alarmRule = new AlarmRule();
|
AlarmRule alarmRule = new AlarmRule();
|
||||||
alarmRule.setId(alarmRuleId);
|
alarmRule.setId(alarmRuleId);
|
||||||
alarmRule.setEnabled(enabled);
|
alarmRule.setEnabled(enabled);
|
||||||
if (updateById(alarmRule))
|
if (updateById(alarmRule)){
|
||||||
|
rule2Redis();
|
||||||
return Result.OK(Prompt.UPDATE_SUCC);
|
return Result.OK(Prompt.UPDATE_SUCC);
|
||||||
|
}
|
||||||
return Result.error(Prompt.UPDATE_ERR);
|
return Result.error(Prompt.UPDATE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,25 +156,16 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
||||||
public void rule2Redis(){
|
public void rule2Redis(){
|
||||||
String colon = SymbolConstant.COLON;
|
String colon = SymbolConstant.COLON;
|
||||||
String prefixRule = RedisConstant.PREFIX_RULE;
|
String prefixRule = RedisConstant.PREFIX_RULE;
|
||||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
|
||||||
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(AlarmRule::getEnabled,1);
|
wrapper.eq(AlarmRule::getEnabled,1);
|
||||||
List<AlarmRule> alarmRules = this.list(wrapper);
|
List<AlarmRule> alarmRules = this.list(wrapper);
|
||||||
Map<String, AlarmRule> ruleMap = new HashMap<>();
|
Map<String, AlarmRule> ruleMap = new HashMap<>();
|
||||||
Map<String, Long> silenceMap = new HashMap<>();
|
|
||||||
for (AlarmRule alarmRule : alarmRules) {
|
for (AlarmRule alarmRule : alarmRules) {
|
||||||
String sourceType = alarmRule.getSourceType();
|
String sourceType = alarmRule.getSourceType();
|
||||||
String ruleId = alarmRule.getId();
|
String ruleId = alarmRule.getId();
|
||||||
Long silence = alarmRule.getSilenceCycle();
|
|
||||||
|
|
||||||
String ruleKey = prefixRule + sourceType + colon + ruleId;
|
String ruleKey = prefixRule + sourceType + colon + ruleId;
|
||||||
ruleMap.put(ruleKey,alarmRule);
|
ruleMap.put(ruleKey,alarmRule);
|
||||||
if (ObjectUtil.isNotNull(silence)){
|
|
||||||
String silenceKey = prefixSilence + ruleId;
|
|
||||||
silenceMap.put(silenceKey,silence);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
redisStreamUtil.setRules(ruleMap);
|
redisStreamUtil.setRules(ruleMap);
|
||||||
redisStreamUtil.setSilence(silenceMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
import org.jeecg.modules.base.bizVo.BetaRLR;
|
||||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.service.ISpectrumAnalysisService;
|
import org.jeecg.modules.service.ISpectrumAnalysisService;
|
||||||
|
@ -128,13 +129,10 @@ public class SpectrumAnalysesController {
|
||||||
return spectrumAnalysisService.viewRLR(sampleId, sampleFileName, gasFileName, detFileName, request);
|
return spectrumAnalysisService.viewRLR(sampleId, sampleFileName, gasFileName, detFileName, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("exportRLR")
|
@PostMapping("exportRLR")
|
||||||
@ApiOperation(value = "导出RLR数据", notes = "导出RLR数据")
|
@ApiOperation(value = "导出RLR数据", notes = "导出RLR数据")
|
||||||
public void exportRLR(Integer sampleId, String sampleFileName,
|
public void exportRLR(@RequestBody BetaRLR betaRLR , HttpServletResponse response) {
|
||||||
String gasFileName, String detFileName,
|
spectrumAnalysisService.exportRLR(betaRLR, response);
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
spectrumAnalysisService.exportRLR(sampleId, sampleFileName, gasFileName, detFileName, request, response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("viewGammaDetectorCalibration")
|
@GetMapping("viewGammaDetectorCalibration")
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
||||||
|
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.base.bizVo.BetaRLR;
|
||||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.entity.vo.BgDataAnlyseResultIn;
|
import org.jeecg.modules.entity.vo.BgDataAnlyseResultIn;
|
||||||
|
@ -45,10 +46,7 @@ public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request);
|
Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request);
|
||||||
|
|
||||||
void exportRLR(Integer sampleId, String sampleFileName,
|
void exportRLR(BetaRLR betaRLR, HttpServletResponse response);
|
||||||
String gasFileName, String detFileName,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response);
|
|
||||||
|
|
||||||
Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request);
|
Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
|
import org.jeecg.modules.base.bizVo.BetaRLR;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||||
import org.jeecg.modules.base.entity.original.*;
|
import org.jeecg.modules.base.entity.original.*;
|
||||||
import org.jeecg.modules.base.enums.*;
|
import org.jeecg.modules.base.enums.*;
|
||||||
|
@ -1183,6 +1184,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
QCResult qcResult = result.getResult();
|
QCResult qcResult = result.getResult();
|
||||||
if (ObjectUtil.isNull(qcResult)) return;
|
if (ObjectUtil.isNull(qcResult)) return;
|
||||||
Map<String, Object> dataMap = BeanUtil.beanToMap(qcResult);
|
Map<String, Object> dataMap = BeanUtil.beanToMap(qcResult);
|
||||||
|
boolean gasBg = qcResult.isGasBgValueAndStatus();
|
||||||
|
boolean detBg = qcResult.isDetBgValueAndStatus();
|
||||||
|
dataMap.put("gasEm", gasBg ? "Match" : "");
|
||||||
|
dataMap.put("gasValue", gasBg ? "Match" : "");
|
||||||
|
dataMap.put("gasStatus", gasBg ? "Pass" : "Failed");
|
||||||
|
dataMap.put("detEm", detBg ? "Match" : "");
|
||||||
|
dataMap.put("detValue", detBg ? "Match" : "");
|
||||||
|
dataMap.put("detStatus", detBg ? "Pass" : "Failed");
|
||||||
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
||||||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||||
String export = "QCResult-Beta.xls";
|
String export = "QCResult-Beta.xls";
|
||||||
|
@ -1303,13 +1312,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportRLR(Integer sampleId, String sampleFileName,
|
public void exportRLR(BetaRLR betaRLR, HttpServletResponse response) {
|
||||||
String gasFileName, String detFileName,
|
if (ObjectUtil.isNull(betaRLR)) return;
|
||||||
HttpServletRequest request,
|
Map<String,Object> dataMap = BeanUtil.beanToMap(betaRLR);
|
||||||
HttpServletResponse response) {
|
|
||||||
Result<?> result = viewRLR(sampleId,sampleFileName,gasFileName,detFileName,request);
|
|
||||||
RlrDataValues rlrDataValues = (RlrDataValues)result.getResult();
|
|
||||||
Map<String,Object> dataMap = BeanUtil.beanToMap(rlrDataValues);
|
|
||||||
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
||||||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||||
String export = "RLR-Beta.xls";
|
String export = "RLR-Beta.xls";
|
||||||
|
@ -1317,6 +1322,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ExportUtil.exportXls(response, template, dataMap,export);
|
ExportUtil.exportXls(response, template, dataMap,export);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
BetaRLR betaRLR = new BetaRLR();
|
||||||
|
Map<String,Object> dataMap = BeanUtil.beanToMap(betaRLR);
|
||||||
|
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||||
|
dataMap.forEach((key, value) -> System.out.println(key + "---" + value));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request) {
|
public Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
|
|
@ -70,20 +70,21 @@ public class SysInfoJob implements Job {
|
||||||
String end = now.format(formatter);
|
String end = now.format(formatter);
|
||||||
|
|
||||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||||
|
String operator = null;
|
||||||
for (String ruleKey : keys) {
|
for (String ruleKey : keys) {
|
||||||
String operator = "";
|
|
||||||
try {
|
try {
|
||||||
AlarmRule alarmRule = (AlarmRule) redisStreamUtil.get(ruleKey);
|
AlarmRule alarmRule = (AlarmRule) redisStreamUtil.get(ruleKey);
|
||||||
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
||||||
operator = alarmRule.getOperator();
|
operator = alarmRule.getOperator();
|
||||||
String silenceKey = prefixSilence + alarmRule.getId();
|
String ruleId = alarmRule.getId();
|
||||||
|
String silenceKey = prefixSilence + ruleId;
|
||||||
boolean hasKey = redisStreamUtil.hasKey(silenceKey);
|
boolean hasKey = redisStreamUtil.hasKey(silenceKey);
|
||||||
boolean blank = StrUtil.isBlank(operator);
|
boolean blank = StrUtil.isBlank(operator);
|
||||||
|
|
||||||
if (blank || hasKey)continue;
|
if (blank || hasKey) continue;
|
||||||
|
|
||||||
// 向运管查询监控项数据
|
// 向运管查询监控项数据
|
||||||
String itemId = alarmRule.getItemId().toString();
|
String itemId = alarmRule.getItemId();
|
||||||
Result<ItemHistory> result = monitorSystem.itemBack(itemId, 0, start, end);
|
Result<ItemHistory> result = monitorSystem.itemBack(itemId, 0, start, end);
|
||||||
Double current = result.getResult().getNow();
|
Double current = result.getResult().getNow();
|
||||||
|
|
||||||
|
@ -104,13 +105,18 @@ public class SysInfoJob implements Job {
|
||||||
alarmLog.setAlarmInfo(message);
|
alarmLog.setAlarmInfo(message);
|
||||||
alarmClient.create(alarmLog);
|
alarmClient.create(alarmLog);
|
||||||
|
|
||||||
|
// 规则触发报警后,设置该规则的沉默周期(如果有)
|
||||||
|
// 沉默周期失效之前,该规则不会再次被触发
|
||||||
|
Long silenceCycle = alarmRule.getSilenceCycle();
|
||||||
|
ruleSilence(silenceKey, silenceCycle);
|
||||||
|
|
||||||
// 发送报警信息
|
// 发送报警信息
|
||||||
String groupId = alarmRule.getContactId();
|
String groupId = alarmRule.getContactId();
|
||||||
String notific = alarmRule.getNotification();
|
String notific = alarmRule.getNotification();
|
||||||
sendMessage.send(message,groupId,notific);
|
sendMessage.send(message,groupId,notific);
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
log.error("预警规则{}解析失败!",operator);
|
log.error("预警规则{}解析失败!", operator);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}catch (RuntimeException e){
|
}catch (RuntimeException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -126,7 +132,7 @@ public class SysInfoJob implements Job {
|
||||||
|
|
||||||
boolean cNull = ObjectUtil.isNull(current);
|
boolean cNull = ObjectUtil.isNull(current);
|
||||||
boolean tNull = ObjectUtil.isNull(threshold);
|
boolean tNull = ObjectUtil.isNull(threshold);
|
||||||
if (cNull || tNull)return false;
|
if (cNull || tNull) return false;
|
||||||
|
|
||||||
double currentV = current;
|
double currentV = current;
|
||||||
double thresholdV = threshold;
|
double thresholdV = threshold;
|
||||||
|
@ -145,6 +151,14 @@ public class SysInfoJob implements Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 规则首次触发报警后,设置该规则的沉默周期(如果有)
|
||||||
|
*/
|
||||||
|
private void ruleSilence(String silenceKey ,Long silenceCycle) {
|
||||||
|
if (ObjectUtil.isNotNull(silenceCycle))
|
||||||
|
redisStreamUtil.set(silenceKey, silenceCycle, silenceCycle);
|
||||||
|
}
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
// start:生成临时Token到线程中
|
// start:生成临时Token到线程中
|
||||||
UserTokenContext.setToken(getTempToken());
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user