Commit 3c858ee9 authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_3.7.0.9' into develop_dl_3.7.0.9

parents 63c5c2a8 60e8aa21
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
<artifactId>amos-component-security</artifactId> <artifactId>amos-component-security</artifactId>
<version>1.7.13-SNAPSHOT</version> <version>1.7.13-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-influxdb</artifactId>
<version>1.8.5-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -175,7 +175,7 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS ...@@ -175,7 +175,7 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
EquipmentIndex equipmentIndex = equipmentIndexMapper.getMessage(equipmentSpecificId, pressurePumpStart); EquipmentIndex equipmentIndex = equipmentIndexMapper.getMessage(equipmentSpecificId, pressurePumpStart);
LambdaQueryWrapper<EquipmentSpecificAlarm> lambda = new QueryWrapper<EquipmentSpecificAlarm>().lambda(); LambdaQueryWrapper<EquipmentSpecificAlarm> lambda = new QueryWrapper<EquipmentSpecificAlarm>().lambda();
lambda.eq(EquipmentSpecificAlarm::getEquipmentSpecificId, equipmentSpecific.getId()); lambda.eq(EquipmentSpecificAlarm::getEquipmentSpecificId, equipmentSpecific.getId());
lambda.eq(EquipmentSpecificAlarm::getEquipmentSpecificIndexKey, equipmentSpecific.getRealtimeIotIndexKey()); lambda.eq(EquipmentSpecificAlarm::getEquipmentSpecificIndexKey, pressurePumpStart);
lambda.eq(EquipmentSpecificAlarm::getStatus, AlarmStatusEnum.BJ.getCode()); lambda.eq(EquipmentSpecificAlarm::getStatus, AlarmStatusEnum.BJ.getCode());
lambda.orderByDesc(EquipmentSpecificAlarm::getCreateDate); lambda.orderByDesc(EquipmentSpecificAlarm::getCreateDate);
lambda.last("limit 1"); lambda.last("limit 1");
......
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm; import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm; import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm;
...@@ -111,6 +112,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -111,6 +112,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//消防炮 //消防炮
@Value("${equipment.plan.monitor}") @Value("${equipment.plan.monitor}")
String monitorCodes; String monitorCodes;
@Autowired
private InfluxDbConnection influxDbConnection;
/** /**
* 泡沫罐KEY * 泡沫罐KEY
*/ */
...@@ -601,6 +606,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -601,6 +606,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handlerMqttIotMessage(String topic, String message) { public void handlerMqttIotMessage(String topic, String message) {
//influxdb
Map<String, String> tagsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
Map<String, Object> fieldsStrMap = new HashMap<>();
log.info("接收到iot消息: {}", message); log.info("接收到iot消息: {}", message);
TopicEntityVo topicEntity = new TopicEntityVo(); TopicEntityVo topicEntity = new TopicEntityVo();
topicEntity.setTopic(topic); topicEntity.setTopic(topic);
...@@ -613,9 +623,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -613,9 +623,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String dataType = jsonObject.getString("dataType"); String dataType = jsonObject.getString("dataType");
String indexAddress = jsonObject.getString("address"); String indexAddress = jsonObject.getString("address");
String traceId = jsonObject.getString("traceId"); String traceId = jsonObject.getString("traceId");
String deviceCode = jsonObject.getString("deviceCode");
String gatewayId = jsonObject.getString("gatewayId"); String gatewayId = jsonObject.getString("gatewayId");
String value=jsonObject.getString("value"); String value=jsonObject.getString("value");
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress,gatewayId); EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress,gatewayId);
if (equipmentSpeIndex == null){ if (equipmentSpeIndex == null){
return; return;
...@@ -630,8 +642,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -630,8 +642,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpeIndex.setTraceId(traceId); equipmentSpeIndex.setTraceId(traceId);
equipmentSpeIndex.setUUID(UUIDUtils.getUUID()); equipmentSpeIndex.setUUID(UUIDUtils.getUUID());
//更新装备性能指标 //更新装备性能指标
equipmentSpecificIndexService.updateById(equipmentSpeIndex); //equipmentSpecificIndexService.updateById(equipmentSpeIndex);
tagsMap.put("key", indexAddress+"_"+gatewayId);
fieldsMap.put("traceId", traceId);
fieldsMap.put("address", indexAddress);
fieldsMap.put("value", value);
fieldsMap.put("gatewayId", gatewayId);
fieldsMap.put("dataType", dataType);
fieldsMap.put("equipmentId", equipmentSpeIndex.getEquipmentId());
fieldsMap.put("equipmentIndexName", equipmentSpeIndex.getEquipmentIndexName());
fieldsMap.put("equipmentIndexKey", equipmentSpeIndex.getEquipmentIndexKey());
fieldsMap.put("isAlarm", equipmentSpeIndex.getIsAlarm().toString());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fieldsMap.put("createdTime", simpleDateFormat.format(new Date()));
fieldsMap.put("equipmentIndex", JSON.toJSONString(equipmentSpeIndex));
influxDbConnection.insert("iot_data", tagsMap, fieldsMap);
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", equipmentSpeIndex.getEquipmentSpecificId()); queryWrapper.eq("id", equipmentSpeIndex.getEquipmentSpecificId());
......
...@@ -134,4 +134,14 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel, ...@@ -134,4 +134,14 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,
# 江西电建-车辆里程过滤参数(单位KM) # 江西电建-车辆里程过滤参数(单位KM)
mileage.parameter=0.5 mileage.parameter=0.5
# 江西电建-车辆里程跨天记录切分(每日0点执行) # 江西电建-车辆里程跨天记录切分(每日0点执行)
mileage.segmentation.cron=0 0 0 * * ? mileage.segmentation.cron=0 0 0 * * ?
\ No newline at end of file
# influxDB
spring.influx.url=http://172.16.11.201:8086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=iot_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
\ No newline at end of file
...@@ -9,7 +9,7 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver ...@@ -9,7 +9,7 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#mybatis mapper file #mybatis mapper file
mybatis.mapper-locations=classpath:mapper/*.xml mybatis.mapper-locations=classpath:mapper/*.xml
#mybatis-plus #mybatis-plus
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl
# mybatis entity package # mybatis entity package
mybatis.type-aliases-package=com.yeejoin.equipmanage.common.entity mybatis.type-aliases-package=com.yeejoin.equipmanage.common.entity
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment