|
@@ -10,6 +10,7 @@ import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconst
|
|
import com.sooka.sponest.data.housingconstruction.domain.eventEntity.SensorEventVo;
|
|
import com.sooka.sponest.data.housingconstruction.domain.eventEntity.SensorEventVo;
|
|
import com.sooka.sponest.data.housingconstruction.domain.eventEntity.StaticEntity;
|
|
import com.sooka.sponest.data.housingconstruction.domain.eventEntity.StaticEntity;
|
|
import com.sooka.sponest.data.housingconstruction.feignClient.service.RemoteHousingconstructionEventService;
|
|
import com.sooka.sponest.data.housingconstruction.feignClient.service.RemoteHousingconstructionEventService;
|
|
|
|
+import com.sooka.sponest.data.housingconstruction.handler.SendEvent;
|
|
import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionStoragetankLogMapper;
|
|
import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionStoragetankLogMapper;
|
|
import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionStoragetankMapper;
|
|
import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionStoragetankMapper;
|
|
import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionStoragetankLogService;
|
|
import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionStoragetankLogService;
|
|
@@ -34,7 +35,9 @@ public class CenterdataTHousingconstructionStoragetankLogServiceImpl extends Bas
|
|
private CenterdataTHousingconstructionStoragetankMapper storagetankMapper;
|
|
private CenterdataTHousingconstructionStoragetankMapper storagetankMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private RemoteHousingconstructionEventService eventService;
|
|
|
|
|
|
+ private SendEvent sendEvent;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询储罐存储数据日志
|
|
* 查询储罐存储数据日志
|
|
@@ -91,7 +94,8 @@ public class CenterdataTHousingconstructionStoragetankLogServiceImpl extends Bas
|
|
|
|
|
|
//设置基础模板
|
|
//设置基础模板
|
|
StringBuilder template = new StringBuilder();
|
|
StringBuilder template = new StringBuilder();
|
|
- template.append(enterpriseName).append("的").append(storagetankName).append("发生");
|
|
|
|
|
|
+ template.append(enterpriseName).append("的").append(storagetankName).append("发生").append("%s, 设定阈值:%s, 当前值:%s, 请及时处理!");
|
|
|
|
+
|
|
|
|
|
|
//创建事件实体类
|
|
//创建事件实体类
|
|
SensorEventVo sensorEventVo = new SensorEventVo(
|
|
SensorEventVo sensorEventVo = new SensorEventVo(
|
|
@@ -107,35 +111,35 @@ public class CenterdataTHousingconstructionStoragetankLogServiceImpl extends Bas
|
|
if(storagetankLog.getLevel() >= MapUtils.getInteger(storagetank, "levelCeiling")){
|
|
if(storagetankLog.getLevel() >= MapUtils.getInteger(storagetank, "levelCeiling")){
|
|
//当前液位高于上限或低于下限, 触发时间告警
|
|
//当前液位高于上限或低于下限, 触发时间告警
|
|
securityState.append("1").append(",");
|
|
securityState.append("1").append(",");
|
|
- sendEvent(template.toString(), StaticEntity.LEVEL_CEILING_NAME, MapUtils.getString(storagetank, "levelCeiling") + units.get(0), storagetankLog.getLevel() + units.get(0), sensorEventVo, StaticEntity.LEVEL_CEILING_CODE);
|
|
|
|
|
|
+ sendEvent.sendEvent(template.toString(), StaticEntity.LEVEL_CEILING_NAME, MapUtils.getString(storagetank, "levelCeiling") + units.get(0), storagetankLog.getLevel() + units.get(0), sensorEventVo, StaticEntity.LEVEL_CEILING_CODE);
|
|
}
|
|
}
|
|
|
|
|
|
//液位下限
|
|
//液位下限
|
|
if(storagetankLog.getLevel() <= MapUtils.getInteger(storagetank, "levelFloor")){
|
|
if(storagetankLog.getLevel() <= MapUtils.getInteger(storagetank, "levelFloor")){
|
|
//当前液位高于上限或低于下限, 触发时间告警
|
|
//当前液位高于上限或低于下限, 触发时间告警
|
|
securityState.append("1").append(",");
|
|
securityState.append("1").append(",");
|
|
- sendEvent(template.toString(), StaticEntity.LEVEL_FLOOR_NAME, MapUtils.getString(storagetank, "levelFloor") + units.get(0), storagetankLog.getLevel() + units.get(0), sensorEventVo, StaticEntity.LEVEL_FLOOR_CODE);
|
|
|
|
|
|
+ sendEvent.sendEvent(template.toString(), StaticEntity.LEVEL_FLOOR_NAME, MapUtils.getString(storagetank, "levelFloor") + units.get(0), storagetankLog.getLevel() + units.get(0), sensorEventVo, StaticEntity.LEVEL_FLOOR_CODE);
|
|
}
|
|
}
|
|
|
|
|
|
//温度
|
|
//温度
|
|
if(storagetankLog.getHeat() >= MapUtils.getInteger(storagetank, "heat")){
|
|
if(storagetankLog.getHeat() >= MapUtils.getInteger(storagetank, "heat")){
|
|
//当前温度高于设定温度阈值
|
|
//当前温度高于设定温度阈值
|
|
securityState.append("2").append(",");
|
|
securityState.append("2").append(",");
|
|
- sendEvent(template.toString(), StaticEntity.HEAT_NAME, MapUtils.getString(storagetank, "heat") + units.get(1), storagetankLog.getHeat() + units.get(1), sensorEventVo, StaticEntity.HEAT_CODE);
|
|
|
|
|
|
+ sendEvent.sendEvent(template.toString(), StaticEntity.HEAT_NAME, MapUtils.getString(storagetank, "heat") + units.get(1), storagetankLog.getHeat() + units.get(1), sensorEventVo, StaticEntity.HEAT_CODE);
|
|
}
|
|
}
|
|
|
|
|
|
//内部气压
|
|
//内部气压
|
|
if(storagetankLog.getPressure() >= MapUtils.getInteger(storagetank, "pressure")){
|
|
if(storagetankLog.getPressure() >= MapUtils.getInteger(storagetank, "pressure")){
|
|
//当前内部气压高于设定阈值
|
|
//当前内部气压高于设定阈值
|
|
securityState.append("3").append(",");
|
|
securityState.append("3").append(",");
|
|
- sendEvent(template.toString(), StaticEntity.PRESSURE_NAME, MapUtils.getString(storagetank, "pressure") + units.get(2), storagetankLog.getPressure() + units.get(2), sensorEventVo, StaticEntity.PRESSURE_CODE);
|
|
|
|
|
|
+ sendEvent.sendEvent(template.toString(), StaticEntity.PRESSURE_NAME, MapUtils.getString(storagetank, "pressure") + units.get(2), storagetankLog.getPressure() + units.get(2), sensorEventVo, StaticEntity.PRESSURE_CODE);
|
|
}
|
|
}
|
|
|
|
|
|
//可燃气体
|
|
//可燃气体
|
|
if(storagetankLog.getGasLeak() >= MapUtils.getInteger(storagetank, "gasLeak")){
|
|
if(storagetankLog.getGasLeak() >= MapUtils.getInteger(storagetank, "gasLeak")){
|
|
//可燃性气体泄露值高于设定的阈值
|
|
//可燃性气体泄露值高于设定的阈值
|
|
securityState.append("4").append(",");
|
|
securityState.append("4").append(",");
|
|
- sendEvent(template.toString(), StaticEntity.GAS_LEAK_NAME, MapUtils.getString(storagetank, "gasLeak") + units.get(3), storagetankLog.getGasLeak() + units.get(3), sensorEventVo, StaticEntity.GAS_LEAK_CODE);
|
|
|
|
|
|
+ sendEvent.sendEvent(template.toString(), StaticEntity.GAS_LEAK_NAME, MapUtils.getString(storagetank, "gasLeak") + units.get(3), storagetankLog.getGasLeak() + units.get(3), sensorEventVo, StaticEntity.GAS_LEAK_CODE);
|
|
}
|
|
}
|
|
|
|
|
|
// 确保 StringBuilder 不为空
|
|
// 确保 StringBuilder 不为空
|
|
@@ -147,15 +151,6 @@ public class CenterdataTHousingconstructionStoragetankLogServiceImpl extends Bas
|
|
storagetankLog.setDeptName(MapUtils.getString(storagetank, "deptName"));
|
|
storagetankLog.setDeptName(MapUtils.getString(storagetank, "deptName"));
|
|
}
|
|
}
|
|
|
|
|
|
- private void sendEvent(String title, String eventName, String threshold, String current, SensorEventVo eventVo, String eventCode){
|
|
|
|
- String template = "%s%s, 设定阈值:%s, 当前值:%s, 请及时处理!";
|
|
|
|
- String format = String.format(template, title, eventName, threshold, current);
|
|
|
|
- eventVo.setEventTypeXl(eventCode);
|
|
|
|
- eventVo.setEventDescription(format);
|
|
|
|
- //发送事件
|
|
|
|
- eventService.sendEvent(eventVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 修改储罐存储数据日志
|
|
* 修改储罐存储数据日志
|
|
*
|
|
*
|