|
|
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
@@ -77,10 +78,10 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
Date now = new Date();
|
|
|
//判断是否有绑定规则
|
|
|
QueryWrapper<IotAlarmRuleSource> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(IotAlarmRuleSource::getValue,iotSensor.getDeviceCode())
|
|
|
- .eq(IotAlarmRuleSource::getOrgId,iotSensor.getOrgId());
|
|
|
+ qw.lambda().eq(IotAlarmRuleSource::getValue, iotSensor.getDeviceCode())
|
|
|
+ .eq(IotAlarmRuleSource::getOrgId, iotSensor.getOrgId());
|
|
|
IotAlarmRuleSource iotAlarmRuleSource = iotAlarmRuleSourceMapper.selectOne(qw);
|
|
|
- if(iotAlarmRuleSource == null){
|
|
|
+ if (iotAlarmRuleSource == null) {
|
|
|
//设备未绑定规则,不做处理
|
|
|
return;
|
|
|
}
|
|
|
@@ -90,9 +91,9 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
int weekDay = DateUtil.thisDayOfWeek() - 1;
|
|
|
System.out.println(weekDay);
|
|
|
QueryWrapper<IotAlarmRuleExpress> ruleExpress = new QueryWrapper<>();
|
|
|
- ruleExpress.lambda().eq(IotAlarmRuleExpress::getRuleId,iotAlarmRuleSource.getRuleId())
|
|
|
- .eq(IotAlarmRuleExpress::getSourceType,iotAlarmRuleSource.getSourceType())
|
|
|
- .eq(IotAlarmRuleExpress::getWeekDay,weekDay);
|
|
|
+ ruleExpress.lambda().eq(IotAlarmRuleExpress::getRuleId, iotAlarmRuleSource.getRuleId())
|
|
|
+ .eq(IotAlarmRuleExpress::getSourceType, iotAlarmRuleSource.getSourceType())
|
|
|
+ .eq(IotAlarmRuleExpress::getWeekDay, weekDay);
|
|
|
List<IotAlarmRuleExpress> iotAlarmRuleExpresses = iotAlarmRuleExpressMapper.selectList(ruleExpress);
|
|
|
|
|
|
List<IotAlarmSystemField> fields = iotAlarmSystemFieldMapper.selectList(null);
|
|
|
@@ -102,14 +103,14 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
boolean isExpress = false;
|
|
|
List<IotAlarmData> list = new ArrayList<>();
|
|
|
for (IotAlarmRuleExpress express : iotAlarmRuleExpresses) {
|
|
|
- boolean isOk = comparetoTime(express, dateStr, now);
|
|
|
- if(!isOk){
|
|
|
+ boolean isOk = compareTime(express, dateStr, now);
|
|
|
+ if (!isOk) {
|
|
|
//不在时间段内
|
|
|
continue;
|
|
|
}
|
|
|
isExpress = true;
|
|
|
IotAlarmData alarmData = createAlarmData(iotSensor, express, fieldMap);
|
|
|
- if(alarmData != null){
|
|
|
+ if (alarmData != null) {
|
|
|
isAlarm = true;
|
|
|
list.add(alarmData);
|
|
|
}
|
|
|
@@ -117,18 +118,18 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
|
|
|
String deviceCode = iotSensor.getDeviceCode();
|
|
|
QueryWrapper<IotAlarmData> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(IotAlarmData::getDeviceId,deviceCode)
|
|
|
- .eq(IotAlarmData::getOrgId,iotSensor.getOrgId())
|
|
|
+ queryWrapper.lambda().eq(IotAlarmData::getDeviceId, deviceCode)
|
|
|
+ .eq(IotAlarmData::getOrgId, iotSensor.getOrgId())
|
|
|
.isNull(IotAlarmData::getEndTime);
|
|
|
List<IotAlarmData> alarms = baseMapper.selectList(queryWrapper);
|
|
|
- if(isAlarm && alarms.size() == 0){
|
|
|
+ if (isAlarm && alarms.size() == 0) {
|
|
|
//报警中,且表中没有告警数据,则插入数据
|
|
|
this.saveBatch(list);
|
|
|
iotSensor.setState(1);
|
|
|
iotSensor.setStateStartTime(LocalDateTime.now());
|
|
|
iotSensorMapper.updateById(iotSensor);
|
|
|
}
|
|
|
- if(isExpress && !isAlarm && alarms.size() != 0){
|
|
|
+ if (isExpress && !isAlarm && alarms.size() != 0) {
|
|
|
//报警恢复
|
|
|
IotAlarmData iotAlarmData = alarms.get(0);
|
|
|
iotAlarmData.setEndTime(LocalDateTime.now());
|
|
|
@@ -143,7 +144,7 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void dealSensorListData(List<IotSensor> iotSensor) throws Exception {
|
|
|
- if(ObjectUtil.isEmpty(iotSensor)){
|
|
|
+ if (ObjectUtil.isEmpty(iotSensor)) {
|
|
|
return;
|
|
|
}
|
|
|
for (IotSensor sensor : iotSensor) {
|
|
|
@@ -165,35 +166,35 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
|
|
|
//信号丢失 0: 正常 | 1:异常 1001
|
|
|
Integer signalLost = videoDiagnosis.getSignalLost();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.SIGNALLOST.getValue(),signalLost,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.SIGNALLOST.getValue(), signalLost, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//遮挡 0: 正常 | 1:异常 1002
|
|
|
Integer occlude = videoDiagnosis.getOcclude();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.OCCLUDE.getValue(),occlude,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.OCCLUDE.getValue(), occlude, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//亮度 0: 正常 | 1:异常 1003
|
|
|
Integer brightness = videoDiagnosis.getBrightness();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.BRIGHTNESS.getValue(),brightness,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.BRIGHTNESS.getValue(), brightness, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//偏色 0: 正常 | 1:异常 1004
|
|
|
Integer colorCast = videoDiagnosis.getColorCast();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.COLORCAST.getValue(),colorCast,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.COLORCAST.getValue(), colorCast, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//雪花 0: 正常 | 1:异常 1005
|
|
|
Integer snowflake = videoDiagnosis.getSnowflake();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.SNOWFLAKE.getValue(),snowflake,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.SNOWFLAKE.getValue(), snowflake, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//条纹 0: 正常 | 1:异常 1006
|
|
|
Integer stripe = videoDiagnosis.getStripe();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.STRIPE.getValue(),stripe,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.STRIPE.getValue(), stripe, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//对比度 0: 正常 | 1:异常 1007
|
|
|
Integer contrast = videoDiagnosis.getContrast();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.CONTRAST.getValue(),contrast,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.CONTRAST.getValue(), contrast, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
//模糊 0: 正常 | 1:异常 1008
|
|
|
Integer blurry = videoDiagnosis.getBlurry();
|
|
|
- dealAlarmVideo(AlarmVideoTypeEnum.BLURRY.getValue(),blurry,deviceName,channelName,deviceId,orgId);
|
|
|
+ dealAlarmVideo(AlarmVideoTypeEnum.BLURRY.getValue(), blurry, deviceName, channelName, deviceId, orgId);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -205,7 +206,7 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
* [{"index":8,"name":"DISK8","state":0},{"index":3,"name":"DISK3","state":0},{"index":1,"name":"DISK1","state":0}]
|
|
|
*/
|
|
|
String detailInfo = iotDvrDisk.getDetailInfo();
|
|
|
- if(StringUtils.isEmpty(detailInfo)){
|
|
|
+ if (StringUtils.isEmpty(detailInfo)) {
|
|
|
return;
|
|
|
}
|
|
|
Long orgId = iotDvrDisk.getOrgId();
|
|
|
@@ -216,20 +217,20 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
for (DiskVo diskVo : diskVos) {
|
|
|
//硬盘状态。0:正常,1:异常
|
|
|
Integer state = diskVo.getState();
|
|
|
- hostCode = hostCode + "__" +diskVo.getIndex();
|
|
|
+ hostCode = hostCode + "__" + diskVo.getIndex();
|
|
|
|
|
|
QueryWrapper<IotAlarmData> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(IotAlarmData::getOrgId,orgId).eq(IotAlarmData::getDeviceId,hostCode).isNull(IotAlarmData::getEndTime);
|
|
|
+ qw.lambda().eq(IotAlarmData::getOrgId, orgId).eq(IotAlarmData::getDeviceId, hostCode).isNull(IotAlarmData::getEndTime);
|
|
|
List<IotAlarmData> datas = baseMapper.selectList(qw);
|
|
|
|
|
|
|
|
|
- if(state ==1 && datas.size() == 0){
|
|
|
+ if (state == 1 && datas.size() == 0) {
|
|
|
//报警,且没有告警数据
|
|
|
IotAlarmData alarmDisk = createAlarmDisk(equipmentName, diskVo.getName(), orgId, hostCode);
|
|
|
this.save(alarmDisk);
|
|
|
}
|
|
|
|
|
|
- if(state == 0 && datas.size() > 0){
|
|
|
+ if (state == 0 && datas.size() > 0) {
|
|
|
IotAlarmData iotAlarmData = datas.get(0);
|
|
|
iotAlarmData.setEndTime(LocalDateTime.now());
|
|
|
this.updateById(iotAlarmData);
|
|
|
@@ -240,14 +241,14 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
|
|
|
}
|
|
|
|
|
|
- private IotAlarmData createAlarmDisk(String equipmentName,String diskName, long orgId, String hostCode){
|
|
|
+ private IotAlarmData createAlarmDisk(String equipmentName, String diskName, long orgId, String hostCode) {
|
|
|
IotAlarmData iotAlarmData = new IotAlarmData();
|
|
|
iotAlarmData.setAlarmValue("异常");
|
|
|
iotAlarmData.setTime(LocalDateTime.now());
|
|
|
iotAlarmData.setDeviceName(equipmentName + "-" + diskName);
|
|
|
iotAlarmData.setRuleId(1L);
|
|
|
iotAlarmData.setSourceType(AlarmVideoTypeEnum.DVRDISK.getValue());
|
|
|
- iotAlarmData.setSourceTypeDes(AlarmVideoTypeEnum.getTextByValue(AlarmVideoTypeEnum.DVRDISK.getValue())+"告警");
|
|
|
+ iotAlarmData.setSourceTypeDes(AlarmVideoTypeEnum.getTextByValue(AlarmVideoTypeEnum.DVRDISK.getValue()) + "告警");
|
|
|
iotAlarmData.setFieldCode(AlarmVideoTypeEnum.DVRDISK.getValue() + "");
|
|
|
iotAlarmData.setOperator("EQUALS");
|
|
|
iotAlarmData.setValue("1");
|
|
|
@@ -259,14 +260,14 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
return iotAlarmData;
|
|
|
}
|
|
|
|
|
|
- private void dealAlarmVideo(int diagnosisType ,Integer diagnosisValue,String deviceName,String channelName,String deviceId,Long orgId){
|
|
|
+ private void dealAlarmVideo(int diagnosisType, Integer diagnosisValue, String deviceName, String channelName, String deviceId, Long orgId) {
|
|
|
|
|
|
QueryWrapper<IotAlarmData> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(IotAlarmData::getDeviceId,deviceId).eq(IotAlarmData::getOrgId,orgId)
|
|
|
- .eq(IotAlarmData::getSourceType,diagnosisType).isNull(IotAlarmData::getEndTime);
|
|
|
+ qw.lambda().eq(IotAlarmData::getDeviceId, deviceId).eq(IotAlarmData::getOrgId, orgId)
|
|
|
+ .eq(IotAlarmData::getSourceType, diagnosisType).isNull(IotAlarmData::getEndTime);
|
|
|
List<IotAlarmData> iots = baseMapper.selectList(qw);
|
|
|
|
|
|
- if(diagnosisValue == 1 && iots.size() == 0){
|
|
|
+ if (diagnosisValue == 1 && iots.size() == 0) {
|
|
|
/**
|
|
|
* 报警处理逻辑
|
|
|
* 1、判断报警表中是否有该类报警的数据;
|
|
|
@@ -274,12 +275,12 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
* 3、有,这不做处理
|
|
|
*/
|
|
|
//不存在告警,创建告警数据
|
|
|
- IotAlarmData iotAlarmData = builderAlarmVideo(deviceName,channelName,diagnosisType,orgId,deviceId);
|
|
|
+ IotAlarmData iotAlarmData = builderAlarmVideo(deviceName, channelName, diagnosisType, orgId, deviceId);
|
|
|
this.save(iotAlarmData);
|
|
|
|
|
|
|
|
|
}
|
|
|
- if(diagnosisValue == 0 && iots.size() > 0){
|
|
|
+ if (diagnosisValue == 0 && iots.size() > 0) {
|
|
|
IotAlarmData iotAlarmData = iots.get(0);
|
|
|
iotAlarmData.setEndTime(LocalDateTime.now());
|
|
|
this.updateById(iotAlarmData);
|
|
|
@@ -287,60 +288,70 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
|
|
|
}
|
|
|
|
|
|
- private IotAlarmData createAlarmData(IotSensor iotSensor,IotAlarmRuleExpress express,Map<String, IotAlarmSystemField> fieldMap){
|
|
|
+ private IotAlarmData createAlarmData(IotSensor iotSensor, IotAlarmRuleExpress express, Map<String, IotAlarmSystemField> fieldMap) {
|
|
|
IotAlarmData iotAlarmData = null;
|
|
|
String operator = express.getOperator();
|
|
|
- String value = express.getValue();
|
|
|
+ String settingValue = express.getValue();
|
|
|
String infos = iotSensor.getInfos();
|
|
|
Map<String, String> dataMap = dealInfos(infos);
|
|
|
IotAlarmSystemField field = fieldMap.get(express.getFieldcode());
|
|
|
String sensorValue = dataMap.get(field.getName());
|
|
|
- if(AlarmRuleExpressOperateEnum.EQUALS.getText().equals(operator)){
|
|
|
- if(sensorValue.equals(value)){
|
|
|
+ //此处认为大于,大于等于,小于,小于等于 规则中传感器上报值与规则中的设定值皆为数字,
|
|
|
+ //所以在判断此类规则的时候将值转为了BigDecimal进行判断; parseInt会在有小数的时候报错
|
|
|
+ if (AlarmRuleExpressOperateEnum.EQUALS.getText().equals(operator)) {
|
|
|
+ if (sensorValue.equals(settingValue)) {
|
|
|
//对上了
|
|
|
- iotAlarmData = builderAlarm(sensorValue,field,express,iotSensor);
|
|
|
+ iotAlarmData = builderAlarm(sensorValue, field, express, iotSensor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(AlarmRuleExpressOperateEnum.GT.getText().equals(operator)){
|
|
|
- if(Integer.parseInt(sensorValue) > Integer.parseInt(value)){
|
|
|
+ if (AlarmRuleExpressOperateEnum.GT.getText().equals(operator)) {
|
|
|
+ final BigDecimal curValue = new BigDecimal(sensorValue);
|
|
|
+ final BigDecimal setValue = new BigDecimal(settingValue);
|
|
|
+ if (curValue.compareTo(setValue) > 0) {
|
|
|
//对上了
|
|
|
- iotAlarmData = builderAlarm(sensorValue,field,express,iotSensor);
|
|
|
+ iotAlarmData = builderAlarm(sensorValue, field, express, iotSensor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(AlarmRuleExpressOperateEnum.GTE.getText().equals(operator)){
|
|
|
- if(Integer.parseInt(sensorValue) >= Integer.parseInt(value)){
|
|
|
+ if (AlarmRuleExpressOperateEnum.GTE.getText().equals(operator)) {
|
|
|
+ final BigDecimal curValue = new BigDecimal(sensorValue);
|
|
|
+ final BigDecimal setValue = new BigDecimal(settingValue);
|
|
|
+ if (curValue.compareTo(setValue) > 0 || curValue.equals(setValue)) {
|
|
|
//对上了
|
|
|
- iotAlarmData = builderAlarm(sensorValue,field,express,iotSensor);
|
|
|
+ iotAlarmData = builderAlarm(sensorValue, field, express, iotSensor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(AlarmRuleExpressOperateEnum.LT.getText().equals(operator)){
|
|
|
- if(Integer.parseInt(sensorValue) < Integer.parseInt(value)){
|
|
|
+ if (AlarmRuleExpressOperateEnum.LT.getText().equals(operator)) {
|
|
|
+ final BigDecimal curValue = new BigDecimal(sensorValue);
|
|
|
+ final BigDecimal setValue = new BigDecimal(settingValue);
|
|
|
+ if (curValue.compareTo(setValue) < 0) {
|
|
|
//对上了
|
|
|
- iotAlarmData = builderAlarm(sensorValue,field,express,iotSensor);
|
|
|
+ iotAlarmData = builderAlarm(sensorValue, field, express, iotSensor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(AlarmRuleExpressOperateEnum.LTE.getText().equals(operator)){
|
|
|
- if(Integer.parseInt(sensorValue) <= Integer.parseInt(value)){
|
|
|
+ if (AlarmRuleExpressOperateEnum.LTE.getText().equals(operator)) {
|
|
|
+ final BigDecimal curValue = new BigDecimal(sensorValue);
|
|
|
+ final BigDecimal setValue = new BigDecimal(settingValue);
|
|
|
+ if (curValue.compareTo(setValue) < 0 || curValue.equals(setValue)) {
|
|
|
//对上了
|
|
|
- iotAlarmData = builderAlarm(sensorValue,field,express,iotSensor);
|
|
|
+ iotAlarmData = builderAlarm(sensorValue, field, express, iotSensor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return iotAlarmData;
|
|
|
}
|
|
|
|
|
|
- private IotAlarmData builderAlarmVideo(String deviceName,String channelName,int diagnosisType, long orgId,String deviceId){
|
|
|
+ private IotAlarmData builderAlarmVideo(String deviceName, String channelName, int diagnosisType, long orgId, String deviceId) {
|
|
|
IotAlarmData iotAlarmData = new IotAlarmData();
|
|
|
iotAlarmData.setAlarmValue("异常");
|
|
|
iotAlarmData.setTime(LocalDateTime.now());
|
|
|
iotAlarmData.setDeviceName(deviceName + "-" + channelName);
|
|
|
iotAlarmData.setRuleId(1L);
|
|
|
iotAlarmData.setSourceType(diagnosisType);
|
|
|
- iotAlarmData.setSourceTypeDes(AlarmVideoTypeEnum.getTextByValue(diagnosisType)+"告警");
|
|
|
+ iotAlarmData.setSourceTypeDes(AlarmVideoTypeEnum.getTextByValue(diagnosisType) + "告警");
|
|
|
iotAlarmData.setFieldCode(diagnosisType + "");
|
|
|
iotAlarmData.setOperator("EQUALS");
|
|
|
iotAlarmData.setValue("1");
|
|
|
@@ -352,14 +363,14 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
return iotAlarmData;
|
|
|
}
|
|
|
|
|
|
- private IotAlarmData builderAlarm(String sensorValue,IotAlarmSystemField field,IotAlarmRuleExpress express,IotSensor iotSensor){
|
|
|
+ private IotAlarmData builderAlarm(String sensorValue, IotAlarmSystemField field, IotAlarmRuleExpress express, IotSensor iotSensor) {
|
|
|
IotAlarmData iotAlarmData = new IotAlarmData();
|
|
|
iotAlarmData.setAlarmValue(sensorValue + field.getUnit() == null ? "" : field.getUnit());
|
|
|
iotAlarmData.setTime(LocalDateTime.now());
|
|
|
iotAlarmData.setDeviceName(iotSensor.getDeviceName());
|
|
|
iotAlarmData.setRuleId(express.getRuleId());
|
|
|
iotAlarmData.setSourceType(field.getSourceType());
|
|
|
- iotAlarmData.setSourceTypeDes(field.getSourceTypeDes()+"告警");
|
|
|
+ iotAlarmData.setSourceTypeDes(field.getSourceTypeDes() + "告警");
|
|
|
iotAlarmData.setFieldCode(field.getSysFieldCode());
|
|
|
iotAlarmData.setOperator(express.getOperator());
|
|
|
iotAlarmData.setValue(express.getValue());
|
|
|
@@ -371,17 +382,17 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
return iotAlarmData;
|
|
|
}
|
|
|
|
|
|
- private Map<String,String> dealInfos(String infos){
|
|
|
+ private Map<String, String> dealInfos(String infos) {
|
|
|
JSONArray objects = JSONArray.parseArray(infos);
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
for (Object object : objects) {
|
|
|
JSONObject data = (JSONObject) object;
|
|
|
- map.put(data.getString("name"),data.getString("val"));
|
|
|
+ map.put(data.getString("name"), data.getString("val"));
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- private boolean comparetoTime(IotAlarmRuleExpress express,String dateStr,Date now){
|
|
|
+ private boolean compareTime(IotAlarmRuleExpress express, String dateStr, Date now) {
|
|
|
//判断是否在规则时间段内
|
|
|
String format = "yyyy-MM-dd HH:mm:ss";
|
|
|
String start = dateStr + " " + express.getStartTime();
|
|
|
@@ -391,7 +402,7 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
Date endTime = DateUtils.dateTime(format, end);
|
|
|
|
|
|
boolean isOk = false;
|
|
|
- if(now.after(startTime) && now.before(endTime)){
|
|
|
+ if (now.after(startTime) && now.before(endTime)) {
|
|
|
isOk = true;
|
|
|
}
|
|
|
return isOk;
|
|
|
@@ -403,7 +414,7 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
|
|
|
@Data
|
|
|
@AllArgsConstructor
|
|
|
@NoArgsConstructor
|
|
|
-class DiskVo{
|
|
|
+class DiskVo {
|
|
|
private String index;
|
|
|
|
|
|
private String name;
|