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.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class RedisStreamUtil {
|
||||
|
@ -46,6 +47,30 @@ public class RedisStreamUtil {
|
|||
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获取所有消费组
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
|
||||
|
@ -21,8 +22,11 @@ public class GammaRLR {
|
|||
private String header_transmission;
|
||||
|
||||
// #objective
|
||||
@JsonProperty("Obj_purpose")
|
||||
private String Obj_purpose;
|
||||
@JsonProperty("Obj_authorized")
|
||||
private String Obj_authorized;
|
||||
@JsonProperty("Obj_instruction")
|
||||
private String Obj_instruction;
|
||||
|
||||
// #collection
|
||||
|
@ -31,47 +35,72 @@ public class GammaRLR {
|
|||
private Double collect_airVolume;
|
||||
|
||||
// #sampleReceipt
|
||||
@JsonProperty("Receipt_srid")
|
||||
private String Receipt_srid;
|
||||
@JsonProperty("Receipt_sealNum")
|
||||
private String Receipt_sealNum;
|
||||
@JsonProperty("Receipt_sample_dateTime")
|
||||
private String Receipt_sample_dateTime;
|
||||
@JsonProperty("Receipt_package")
|
||||
private String Receipt_package;
|
||||
@JsonProperty("Receipt_seal")
|
||||
private String Receipt_seal;
|
||||
@JsonProperty("Receipt_sample")
|
||||
private String Receipt_sample;
|
||||
|
||||
// #test
|
||||
@JsonProperty("Test_type")
|
||||
private String Test_type;
|
||||
@JsonProperty("Test_completion")
|
||||
private String Test_completion;
|
||||
@JsonProperty("Test_person")
|
||||
private String Test_person;
|
||||
@JsonProperty("Test_purpose")
|
||||
private String Test_purpose;
|
||||
|
||||
// #peakMethond
|
||||
@JsonProperty("PeakMethod_software")
|
||||
private String PeakMethod_software;
|
||||
@JsonProperty("PeakMethod_location")
|
||||
private String PeakMethod_location;
|
||||
|
||||
// #peakFit
|
||||
private List<TablePeakFit> peakFit;
|
||||
|
||||
// #g_AnalysisMethods
|
||||
@JsonProperty("AnalyMethod_software")
|
||||
private String AnalyMethod_software;
|
||||
@JsonProperty("AnalyMethod_nuclide")
|
||||
private String AnalyMethod_nuclide;
|
||||
@JsonProperty("AnalyMethod_baseline")
|
||||
private String AnalyMethod_baseline;
|
||||
@JsonProperty("AnalyMethod_lc")
|
||||
private String AnalyMethod_lc;
|
||||
@JsonProperty("AnalyMethod_calib")
|
||||
private String AnalyMethod_calib;
|
||||
|
||||
// #peakAssociation
|
||||
@JsonProperty("Association")
|
||||
private List<TableAssociation> Association;
|
||||
|
||||
// #References
|
||||
@JsonProperty("Reference_samplePHD")
|
||||
private String Reference_samplePHD;
|
||||
@JsonProperty("Reference_CalibPHD")
|
||||
private String Reference_CalibPHD;
|
||||
@JsonProperty("Reference_physical")
|
||||
private String Reference_physical;
|
||||
|
||||
// #Results
|
||||
@JsonProperty("Result_act_ref")
|
||||
private String Result_act_ref;
|
||||
@JsonProperty("Result_conc_ref")
|
||||
private String Result_conc_ref;
|
||||
@JsonProperty("Result")
|
||||
private List<TableResult> Result;
|
||||
|
||||
// #NuclideRatios
|
||||
@JsonProperty("NuclideRatios")
|
||||
private List<NuclideRatios> NuclideRatios;
|
||||
|
||||
// #g_CoincidenceCorrection
|
||||
|
@ -82,11 +111,15 @@ public class GammaRLR {
|
|||
|
||||
// #Conclusions
|
||||
private String conclusion_person;
|
||||
@JsonProperty("Conclusion_IDC")
|
||||
private String Conclusion_IDC;
|
||||
@JsonProperty("Conclusion_Lab")
|
||||
private String Conclusion_Lab;
|
||||
@JsonProperty("Conclusion_Res")
|
||||
private String Conclusion_Res;
|
||||
|
||||
// #Comment
|
||||
@JsonProperty("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> {
|
||||
|
||||
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.SymbolConstant;
|
||||
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.AlarmRuleInfo;
|
||||
import org.jeecg.modules.base.dto.SourceDto;
|
||||
|
@ -36,6 +37,9 @@ import static org.jeecg.modules.base.enums.SourceType.*;
|
|||
@Service("alarmRuleService")
|
||||
public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule> implements IAlarmRuleService {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private RedisStreamUtil redisStreamUtil;
|
||||
|
||||
|
@ -49,7 +53,7 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
private ISysDatabaseService databaseService;
|
||||
|
||||
@Override
|
||||
public Result findPage(AlarmRuleVo alarmRuleVo) {
|
||||
public Result<?> findPage(AlarmRuleVo alarmRuleVo) {
|
||||
Integer pageNo = alarmRuleVo.getPageNo();
|
||||
Integer pageSize = alarmRuleVo.getPageSize();
|
||||
Page<AlarmRuleDto> page = new Page<>(pageNo,pageSize);
|
||||
|
@ -61,31 +65,34 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
page.setRecords(alarmHistories);
|
||||
// 获取数据总条数(经过查询条件过滤后的)
|
||||
params.put("pageFlag","noPage");
|
||||
Integer total = baseMapper.findPage(params).size();
|
||||
int total = baseMapper.findPage(params).size();
|
||||
page.setTotal(total);
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findInfo(String alarmRuleId) {
|
||||
public Result<?> findInfo(String alarmRuleId) {
|
||||
AlarmRuleInfo alarmRuleInfo = baseMapper.findInfo(alarmRuleId);
|
||||
return Result.OK(alarmRuleInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result create(AlarmRule alarmRule) {
|
||||
public Result<?> create(AlarmRule alarmRule) {
|
||||
Rule rule = alarmRule.getRule();
|
||||
if (ObjectUtil.isNotNull(rule)){
|
||||
String operator = JSON.toJSONString(rule);
|
||||
alarmRule.setOperator(operator);
|
||||
}
|
||||
this.baseMapper.insert(alarmRule);
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.ADD_SUCC);
|
||||
boolean success = save(alarmRule);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.ADD_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.ADD_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result update(AlarmRule alarmRule) {
|
||||
public Result<?> update(AlarmRule alarmRule) {
|
||||
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AlarmRule::getId, alarmRule.getId());
|
||||
AlarmRule alarmRuleOld = this.baseMapper.selectOne(wrapper);
|
||||
|
@ -97,20 +104,26 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
String operator = JSON.toJSONString(rule);
|
||||
alarmRule.setOperator(operator);
|
||||
}
|
||||
this.baseMapper.updateById(alarmRule);
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.UPDATE_SUCC);
|
||||
boolean success = updateById(alarmRule);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.UPDATE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.UPDATE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteById(String alarmRuleId) {
|
||||
this.baseMapper.deleteById(alarmRuleId);
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.DELETE_SUCC);
|
||||
public Result<?> deleteById(String alarmRuleId) {
|
||||
boolean success = removeById(alarmRuleId);
|
||||
if (success){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.DELETE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.DELETE_ERR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getSourceByType(String sourceType) {
|
||||
public Result<?> getSourceByType(String sourceType) {
|
||||
List<SourceDto> sourceDtos = new ArrayList<>();
|
||||
if (EMAIL.getType().equals(sourceType)){
|
||||
sourceDtos = emailService.listAll();
|
||||
|
@ -123,12 +136,14 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result updateStatus(String alarmRuleId,Integer enabled) {
|
||||
public Result<?> updateStatus(String alarmRuleId,Integer enabled) {
|
||||
AlarmRule alarmRule = new AlarmRule();
|
||||
alarmRule.setId(alarmRuleId);
|
||||
alarmRule.setEnabled(enabled);
|
||||
if (updateById(alarmRule))
|
||||
if (updateById(alarmRule)){
|
||||
rule2Redis();
|
||||
return Result.OK(Prompt.UPDATE_SUCC);
|
||||
}
|
||||
return Result.error(Prompt.UPDATE_ERR);
|
||||
}
|
||||
|
||||
|
@ -141,25 +156,16 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
|
|||
public void rule2Redis(){
|
||||
String colon = SymbolConstant.COLON;
|
||||
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);
|
||||
Map<String, AlarmRule> ruleMap = new HashMap<>();
|
||||
Map<String, Long> silenceMap = new HashMap<>();
|
||||
for (AlarmRule alarmRule : alarmRules) {
|
||||
String sourceType = alarmRule.getSourceType();
|
||||
String ruleId = alarmRule.getId();
|
||||
Long silence = alarmRule.getSilenceCycle();
|
||||
|
||||
String ruleKey = prefixRule + sourceType + colon + ruleId;
|
||||
ruleMap.put(ruleKey,alarmRule);
|
||||
if (ObjectUtil.isNotNull(silence)){
|
||||
String silenceKey = prefixSilence + ruleId;
|
||||
silenceMap.put(silenceKey,silence);
|
||||
}
|
||||
}
|
||||
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.vo.Result;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.modules.base.bizVo.BetaRLR;
|
||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.service.ISpectrumAnalysisService;
|
||||
|
@ -128,13 +129,10 @@ public class SpectrumAnalysesController {
|
|||
return spectrumAnalysisService.viewRLR(sampleId, sampleFileName, gasFileName, detFileName, request);
|
||||
}
|
||||
|
||||
@GetMapping("exportRLR")
|
||||
@PostMapping("exportRLR")
|
||||
@ApiOperation(value = "导出RLR数据", notes = "导出RLR数据")
|
||||
public void exportRLR(Integer sampleId, String sampleFileName,
|
||||
String gasFileName, String detFileName,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
spectrumAnalysisService.exportRLR(sampleId, sampleFileName, gasFileName, detFileName, request, response);
|
||||
public void exportRLR(@RequestBody BetaRLR betaRLR , HttpServletResponse response) {
|
||||
spectrumAnalysisService.exportRLR(betaRLR, response);
|
||||
}
|
||||
|
||||
@GetMapping("viewGammaDetectorCalibration")
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
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.vo.*;
|
||||
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);
|
||||
|
||||
void exportRLR(Integer sampleId, String sampleFileName,
|
||||
String gasFileName, String detFileName,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response);
|
||||
void exportRLR(BetaRLR betaRLR, HttpServletResponse response);
|
||||
|
||||
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.system.util.JwtUtil;
|
||||
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.original.*;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
|
@ -1183,6 +1184,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
QCResult qcResult = result.getResult();
|
||||
if (ObjectUtil.isNull(qcResult)) return;
|
||||
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值替换为"",避免空指针异常(或者在模板中进行判断)
|
||||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||
String export = "QCResult-Beta.xls";
|
||||
|
@ -1303,13 +1312,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void exportRLR(Integer sampleId, String sampleFileName,
|
||||
String gasFileName, String detFileName,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Result<?> result = viewRLR(sampleId,sampleFileName,gasFileName,detFileName,request);
|
||||
RlrDataValues rlrDataValues = (RlrDataValues)result.getResult();
|
||||
Map<String,Object> dataMap = BeanUtil.beanToMap(rlrDataValues);
|
||||
public void exportRLR(BetaRLR betaRLR, HttpServletResponse response) {
|
||||
if (ObjectUtil.isNull(betaRLR)) return;
|
||||
Map<String,Object> dataMap = BeanUtil.beanToMap(betaRLR);
|
||||
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
||||
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||
String export = "RLR-Beta.xls";
|
||||
|
@ -1317,6 +1322,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
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
|
||||
public Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
|
|
@ -70,20 +70,21 @@ public class SysInfoJob implements Job {
|
|||
String end = now.format(formatter);
|
||||
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
String operator = null;
|
||||
for (String ruleKey : keys) {
|
||||
String operator = "";
|
||||
try {
|
||||
AlarmRule alarmRule = (AlarmRule) redisStreamUtil.get(ruleKey);
|
||||
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
||||
operator = alarmRule.getOperator();
|
||||
String silenceKey = prefixSilence + alarmRule.getId();
|
||||
String ruleId = alarmRule.getId();
|
||||
String silenceKey = prefixSilence + ruleId;
|
||||
boolean hasKey = redisStreamUtil.hasKey(silenceKey);
|
||||
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);
|
||||
Double current = result.getResult().getNow();
|
||||
|
||||
|
@ -104,13 +105,18 @@ public class SysInfoJob implements Job {
|
|||
alarmLog.setAlarmInfo(message);
|
||||
alarmClient.create(alarmLog);
|
||||
|
||||
// 规则触发报警后,设置该规则的沉默周期(如果有)
|
||||
// 沉默周期失效之前,该规则不会再次被触发
|
||||
Long silenceCycle = alarmRule.getSilenceCycle();
|
||||
ruleSilence(silenceKey, silenceCycle);
|
||||
|
||||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
sendMessage.send(message,groupId,notific);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("预警规则{}解析失败!",operator);
|
||||
log.error("预警规则{}解析失败!", operator);
|
||||
e.printStackTrace();
|
||||
}catch (RuntimeException e){
|
||||
e.printStackTrace();
|
||||
|
@ -126,7 +132,7 @@ public class SysInfoJob implements Job {
|
|||
|
||||
boolean cNull = ObjectUtil.isNull(current);
|
||||
boolean tNull = ObjectUtil.isNull(threshold);
|
||||
if (cNull || tNull)return false;
|
||||
if (cNull || tNull) return false;
|
||||
|
||||
double currentV = current;
|
||||
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(){
|
||||
// start:生成临时Token到线程中
|
||||
UserTokenContext.setToken(getTempToken());
|
||||
|
|
Loading…
Reference in New Issue
Block a user