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