方便测试,增加默认分区
parent
a9246688b2
commit
c438b54222
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
* @date 2023/11/9
|
* @date 2023/11/9
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequestMapping("/vehicle")
|
||||||
public class VehicleController {
|
public class VehicleController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/instance")
|
@RequestMapping("/vehicle/instance")
|
||||||
public class VehicleInstanceController {
|
public class VehicleInstanceController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||||
* @Date 2023-11-27 上午 10:50
|
* @Date 2023-11-27 上午 10:50
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/position")
|
@RequestMapping("/vehicle/position")
|
||||||
public class VehiclePositionController {
|
public class VehiclePositionController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.Result;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 车辆上线默认类
|
||||||
|
* @Date 2023-11-30 下午 02:59
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/verify")
|
||||||
|
public class VerifyController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆默认上线主题
|
||||||
|
* @return 默认返回test
|
||||||
|
*/
|
||||||
|
@PostMapping("/vehicleConnection")
|
||||||
|
public Result<String> vehicleConnection(){
|
||||||
|
return Result.success("test");
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.muyu.vehicle;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.model.PositionModel;
|
import com.muyu.domain.model.PositionModel;
|
||||||
|
import com.muyu.utils.VehicleUtils;
|
||||||
import com.muyu.vehicle.core.LocalContainer;
|
import com.muyu.vehicle.core.LocalContainer;
|
||||||
import com.muyu.vehicle.model.VehicleData;
|
import com.muyu.vehicle.model.VehicleData;
|
||||||
import com.muyu.vehicle.model.properties.MqttProperties;
|
import com.muyu.vehicle.model.properties.MqttProperties;
|
||||||
|
@ -27,7 +28,7 @@ public class Test {
|
||||||
|
|
||||||
private static MqttProperties mqttProperties = MqttProperties.builder()
|
private static MqttProperties mqttProperties = MqttProperties.builder()
|
||||||
.broker("tcp://fluxmq.muyu.icu:1883")
|
.broker("tcp://fluxmq.muyu.icu:1883")
|
||||||
.topic("test")
|
.topic("mqttAA")
|
||||||
.username("123456")
|
.username("123456")
|
||||||
.password("AJLJWIEJLASDJOWQES")
|
.password("AJLJWIEJLASDJOWQES")
|
||||||
.build();
|
.build();
|
||||||
|
@ -36,10 +37,10 @@ public class Test {
|
||||||
log.info("开始生成VIN");
|
log.info("开始生成VIN");
|
||||||
long genVinStartTime = System.currentTimeMillis();
|
long genVinStartTime = System.currentTimeMillis();
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
list.add("VIN12345678912345");
|
// list.add("VIN12345678912345");
|
||||||
// for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
// list.add(VehicleUtils.genVin());
|
list.add(VehicleUtils.genVin());
|
||||||
// }
|
}
|
||||||
log.info("生成VIN结束:[{}MS]", System.currentTimeMillis()-genVinStartTime);
|
log.info("生成VIN结束:[{}MS]", System.currentTimeMillis()-genVinStartTime);
|
||||||
log.info("开始创建车辆");
|
log.info("开始创建车辆");
|
||||||
long initVehicleStartTime = System.currentTimeMillis();
|
long initVehicleStartTime = System.currentTimeMillis();
|
||||||
|
@ -47,6 +48,7 @@ public class Test {
|
||||||
log.info("创建车辆结束:[{}MS]", System.currentTimeMillis()-initVehicleStartTime);
|
log.info("创建车辆结束:[{}MS]", System.currentTimeMillis()-initVehicleStartTime);
|
||||||
list.forEach(vin -> {
|
list.forEach(vin -> {
|
||||||
VehicleInstance vehicleIns = LocalContainer.getVehicleInstance(vin);
|
VehicleInstance vehicleIns = LocalContainer.getVehicleInstance(vin);
|
||||||
|
vehicleIns.setPositionCode("123");
|
||||||
vehicleIns.initVehicleThread();
|
vehicleIns.initVehicleThread();
|
||||||
vehicleIns.startSend();
|
vehicleIns.startSend();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
server:
|
server:
|
||||||
port: 81
|
port: 81
|
||||||
servlet:
|
|
||||||
context-path: /vehicle
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
username: muyu
|
username: muyu
|
||||||
|
@ -76,11 +74,11 @@ forest:
|
||||||
variables:
|
variables:
|
||||||
adminHost: ${mqtt.admin.host}
|
adminHost: ${mqtt.admin.host}
|
||||||
adminTopicUri: ${mqtt.admin.topic-uri}
|
adminTopicUri: ${mqtt.admin.topic-uri}
|
||||||
|
|
||||||
# 服务器配置
|
# 服务器配置
|
||||||
mqtt:
|
mqtt:
|
||||||
server:
|
server:
|
||||||
host: tcp://47.99.149.28:1883
|
host: tcp://fluxmq.muyu.icu:1883
|
||||||
admin:
|
admin:
|
||||||
host: http://47.120.48.139:9000
|
host: http://127.0.0.1:${server.port}
|
||||||
topic-uri: /verify/vehicleConnection
|
topic-uri: /verify/vehicleConnection
|
||||||
|
|
Loading…
Reference in New Issue