修改模块映射
This commit is contained in:
@@ -61,6 +61,9 @@ public class MqttMessageHandler {
|
||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}",qos = 1)
|
||||
public void responseTemperData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
List<StatisticalDataDTO> statisticalDataDTOS = temperatureService.queryTemperature(devId);
|
||||
statisticalDataDTOS.stream().forEach(temp->{
|
||||
temp.setClDid(getCldidName(temp.getClDid()));
|
||||
});
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/TemperData/"+devId,gson.toJson(statisticalDataDTOS),1,false);
|
||||
}
|
||||
@@ -172,4 +175,27 @@ public class MqttMessageHandler {
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/devData/"+devId,gson.toJson(result),1,false);
|
||||
}
|
||||
|
||||
public String getCldidName( String cldid) {
|
||||
|
||||
switch (cldid) {
|
||||
case "0":
|
||||
return "主模块";
|
||||
case "1":
|
||||
return "模块1";
|
||||
case "2":
|
||||
return "模块2";
|
||||
case "3":
|
||||
return "模块3";
|
||||
case "4":
|
||||
return "模块4";
|
||||
case "5":
|
||||
return "模块5";
|
||||
case "6":
|
||||
return "模块6";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user