Commit 02175635 authored by 刘林's avatar 刘林

fix(equip):对接Iot平台透传数据

parent 8196356b
...@@ -203,4 +203,8 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -203,4 +203,8 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty(value = "指标值枚举") @ApiModelProperty(value = "指标值枚举")
@TableField("value_enum") @TableField("value_enum")
private String valueEnum; private String valueEnum;
@ApiModelProperty(value = "网关标识")
@TableField(value = "gateway_id")
private String gatewayId;
} }
...@@ -125,6 +125,7 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -125,6 +125,7 @@ public class EquipmentIotMqttReceiveConfig {
list.add("+/+/property"); // 添加iot車輛裝備數據上報事件监听 list.add("+/+/property"); // 添加iot車輛裝備數據上報事件监听
list.add("+/+/event"); // 添加iot事件监听 list.add("+/+/event"); // 添加iot事件监听
list.add("+/+/transmit"); // 添加交换站事件监听 list.add("+/+/transmit"); // 添加交换站事件监听
list.add("+/+/perspective"); // 添加交换站事件监听
String[] arr = list.toArray(new String[list.size()]); String[] arr = list.toArray(new String[list.size()]);
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr); adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr);
adapter.setCompletionTimeout(completionTimeout); adapter.setCompletionTimeout(completionTimeout);
...@@ -150,6 +151,8 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -150,6 +151,8 @@ public class EquipmentIotMqttReceiveConfig {
mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg); mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg);
}else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){ }else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){
mqttReceiveService.handlerMqttRomaMessage(topic,msg); mqttReceiveService.handlerMqttRomaMessage(topic,msg);
}else if (dataType.equals("perspective") && StringUtil.isNotEmpty(msg)){
mqttReceiveService.handlerMqttIotMessage(topic,msg);
} }
} }
}; };
......
...@@ -114,5 +114,5 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif ...@@ -114,5 +114,5 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex); List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex);
EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress); EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId);
} }
...@@ -40,5 +40,5 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif ...@@ -40,5 +40,5 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif
* @param indexAddress indexAddress * @param indexAddress indexAddress
* @return EquipmentSpecificIndex * @return EquipmentSpecificIndex
*/ */
EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress); EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId);
} }
...@@ -24,4 +24,11 @@ public interface MqttReceiveService { ...@@ -24,4 +24,11 @@ public interface MqttReceiveService {
* @param message 消息内容 * @param message 消息内容
*/ */
void handlerMqttRomaMessage(String topic, String message); void handlerMqttRomaMessage(String topic, String message);
/**
* 处理Iot消息数据
* @param topic 主题
* @param message 消息内容
*/
void handlerMqttIotMessage(String topic, String message);
} }
...@@ -30,7 +30,7 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -30,7 +30,7 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec
} }
@Override @Override
public EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress) { public EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId) {
return this.baseMapper.getEquipmentSpeIndexByIndexAddress(indexAddress); return this.baseMapper.getEquipmentSpeIndexByIndexAddress(indexAddress,gatewayId);
} }
} }
...@@ -904,4 +904,15 @@ ...@@ -904,4 +904,15 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="LiuLin" id="1686650059">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_index" columnName="gateway_id"/>
</not>
</preConditions>
<comment>新增属性字段 gateway_id</comment>
<sql>
alter table `wl_equipment_specific_index` add column `gateway_id` varchar(50) COMMENT '网关标识ID';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -558,6 +558,8 @@ ...@@ -558,6 +558,8 @@
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE WHERE
wesi.index_address = #{indexAddress} wesi.index_address = #{indexAddress}
AND wei.is_iot = true <if test="gatewayId != null">
AND wesi.gateway_id = #{gatewayId}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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