Merge remote-tracking branch 'Vechicle/master'
commit
7e14155c64
|
@ -65,7 +65,6 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
* 车辆结果对象
|
||||
*
|
||||
* @param vehicleInstanceListReq 车辆查询
|
||||
*
|
||||
* @return 车辆对象
|
||||
*/
|
||||
@Override
|
||||
|
@ -113,11 +112,15 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
.nonce(MD5Util.encrypted(UUID.randomUUID().toString().replace("-", "")))
|
||||
.build();
|
||||
Result<MqttServerModel> result = clientAdmin.vehicleConnection(connectionReq);
|
||||
log.info(result);
|
||||
// Result<MqttServerModel> result = clientAdmin.getIp(connectionReq);
|
||||
if (result.getCode() != 200) {
|
||||
log.error("车辆:[{}],申请上线异常:[{}]", vin, result.getMsg());
|
||||
throw new RuntimeException("远程服务器没有【" + vin + "】车辆");
|
||||
}
|
||||
MqttServerModel mqttServerModel = result.getData();
|
||||
// broker:39.98.38.57 topic:0
|
||||
// broker:39.98.50.223 topic:1
|
||||
MqttProperties mqttProperties = MqttProperties.builder()
|
||||
.broker("tcp://"+mqttServerModel.getBroker()+":1883")
|
||||
.topic(mqttServerModel.getTopic())
|
||||
|
@ -127,12 +130,12 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
.build();
|
||||
vehicleInstance.setMqttProperties(mqttProperties);
|
||||
vehicleInstance.initClient();
|
||||
|
||||
log.info("vin[{}],上线成功", vin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆客户端关闭
|
||||
*
|
||||
* @param vin vin
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -12,13 +12,16 @@ import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
|||
* @description: 客户端的管理
|
||||
* @Date 2023-11-28 上午 10:20
|
||||
*/
|
||||
@BaseRequest(baseURL = "${adminHost}")
|
||||
@BaseRequest(
|
||||
baseURL = "${adminHost}"
|
||||
)
|
||||
public interface ClientAdmin {
|
||||
|
||||
@Post("${adminTopicUri}")
|
||||
public Result<MqttServerModel> vehicleConnection(@JSONBody VehicleConnectionReq vehicleConnectionReq);
|
||||
//
|
||||
// @Post("/fluxmq/getIp")
|
||||
// public String getIp();
|
||||
|
||||
// @Post(url = "${adminTopicUri}", headers = "Content-Type=application/json")
|
||||
// public Result<MqttServerModel> getIp(@JSONBody VehicleConnectionReq vehicleConnectionReq);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ logging:
|
|||
# http调用框架
|
||||
forest:
|
||||
max-connections: 1000 # 连接池最大连接数
|
||||
connect-timeout: 3000 # 连接超时时间,单位为毫秒
|
||||
read-timeout: 3000 # 数据读取超时时间,单位为毫秒
|
||||
connect-timeout: 30000 # 连接超时时间,单位为毫秒
|
||||
read-timeout: 30000 # 数据读取超时时间,单位为毫秒
|
||||
variables:
|
||||
adminHost: ${mqtt.admin.host}
|
||||
adminTopicUri: ${mqtt.admin.topic-uri}
|
||||
|
@ -87,8 +87,8 @@ forest:
|
|||
mqtt:
|
||||
server:
|
||||
host: tcp://39.98.45.160:1883
|
||||
topic: test1
|
||||
topic: topic1
|
||||
admin:
|
||||
host: http://127.0.0.1:8081
|
||||
topic-uri: /fluxmq/getIp
|
||||
host: http://127.0.0.1:8081/
|
||||
topic-uri: fluxmq/getIp
|
||||
|
||||
|
|
Loading…
Reference in New Issue