add:第一版测试版本,第二次联调。

This commit is contained in:
2025-12-26 15:27:54 +08:00
parent cd483c81d1
commit 6e554b6bf7
32 changed files with 903 additions and 73 deletions

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.api.schedule.map.api.ScheduleMapAPI;
import org.nl.exception.BadRequestException;
import org.nl.util.URLConstant;
import org.springframework.stereotype.Service;
/**
@@ -22,7 +23,7 @@ public class ScheduleMapAPIProvider implements ScheduleMapAPI {
log.info("获取当前地图中的所有POI");
HttpResponse result = null;
try {
result = HttpRequest.get("http://127.0.0.1:8011/api/core/artifact/v1/pois")
result = HttpRequest.get(URLConstant.SCHEDULE_IP_PORT+"/maps/pois")
.execute();
log.info("获取当前地图中的所有POI响应结果:{}",result.body());
}catch (Exception e){

View File

@@ -9,6 +9,7 @@ import org.nl.api.schedule.setting.api.ScheduleSettingAPI;
import org.nl.api.schedule.setting.core.ScheduleAPISettingChargeParam;
import org.nl.api.schedule.setting.core.ScheduleAPISettingSpeedParam;
import org.nl.exception.BadRequestException;
import org.nl.util.URLConstant;
import org.springframework.stereotype.Service;
/**
@@ -27,7 +28,7 @@ public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
log.info("设置调度配送速度参数:{}", scheduleAPISettingSpeedParam);
HttpResponse result = null;
try {
result = HttpRequest.put("http://127.0.0.1:8011/system/motion/speed")
result = HttpRequest.put(URLConstant.SCHEDULE_IP_PORT+"/system/motion/speed")
.body(String.valueOf(JSONObject.toJSON(scheduleAPISettingSpeedParam)))
.execute();
log.info("设置调度配送速度响应结果:{}",result.body());
@@ -45,7 +46,7 @@ public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
log.info("设置调度充电参数:{}", scheduleAPISettingChargeParam);
HttpResponse result = null;
try {
result = HttpRequest.put("http://127.0.0.1:8011/system/charging/auto-threshold")
result = HttpRequest.put(URLConstant.SCHEDULE_IP_PORT+"/system/charging/auto-threshold")
.body(String.valueOf(JSONObject.toJSON(scheduleAPISettingChargeParam)))
.execute();
log.info("设置调度充电响应结果:{}",result.body());

View File

@@ -11,6 +11,7 @@ import org.nl.api.schedule.task.core.ScheduleAPICreateOneClickTaskParam;
import org.nl.api.schedule.task.core.ScheduleAPICreateTaskParam;
import org.nl.exception.BadRequestException;
import org.nl.schedule.core.util.ScheduleUtil;
import org.nl.util.URLConstant;
import org.springframework.stereotype.Service;
/**
@@ -55,7 +56,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
HttpResponse result = null;
try {
result = HttpRequest
.post("http://127.0.0.1:8011/tasks/"+scheduleAPICreateTaskParam.getTask_code())
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+scheduleAPICreateTaskParam.getTask_code())
.body(String.valueOf(request_body))
.execute();
@@ -75,7 +76,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
HttpResponse result = null;
try {
result = HttpRequest
.post("http://127.0.0.1:8011/tasks/"+taskId+"/withdrawl")
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+taskId+"/withdrawl")
.body(String.valueOf(new JSONObject()))
.execute();
@@ -95,7 +96,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
HttpResponse result = null;
try {
result = HttpRequest
.get("http://127.0.0.1:8011/tasks/"+taskId)
.get(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+taskId)
.execute();
log.info("查询调度任务状态响应结果:{}",result.body());
@@ -114,7 +115,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
HttpResponse result = null;
try {
result = HttpRequest
.post("http://127.0.0.1:8011/tasks/"+taskId+"/pause")
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+taskId+"/pause")
.body(String.valueOf(new JSONObject()))
.execute();
@@ -134,7 +135,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
HttpResponse result = null;
try {
result = HttpRequest
.post("http://127.0.0.1:8011/tasks/"+taskId+"/resume")
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+taskId+"/resume")
.body(String.valueOf(new JSONObject()))
.execute();
@@ -162,14 +163,14 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
JSONObject request_body = new JSONObject();
request_body.put("vehicleNumber", vehicleNumber);
request_body.put("taskId",task_code);
// request_body.put("taskId",task_code);
request_body.put("taskType",type);
log.info("下发调度一键任务参数:{}", request_body);
HttpResponse result = null;
try {
result = HttpRequest
.post("http://127.0.0.1:8011/tasks/quick-create")
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/one-click/"+task_code)
.body(String.valueOf(request_body))
.execute();

View File

@@ -12,6 +12,7 @@ import org.nl.response.WebResponse;
import org.nl.schedule.core.websocket.WebSocketVehicleInfoServer;
import org.nl.schedule.modular.vehicle.dto.VehicleInfoDto;
import org.nl.schedule.modular.vehicle.service.VehicleService;
import org.nl.util.URLConstant;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@@ -22,6 +23,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import static org.nl.util.URLConstant.SCHEDULE_IP_PORT;
/**
* @author dsh
* 2025/11/25
@@ -75,10 +78,10 @@ public class VehicleServiceImpl implements VehicleService {
@Override
public List<VehicleInfoDto> getAllVehicles() {
String url = "http://127.0.0.1:8011/schedule/vehicles";
String url = URLConstant.SCHEDULE_IP_PORT+"/vehicles";
List<VehicleInfoDto> vehicles = new ArrayList<>();
try {
try (HttpResponse response = HttpRequest.get("http://127.0.0.1:8011/schedule/vehicles")
try (HttpResponse response = HttpRequest.get(URLConstant.SCHEDULE_IP_PORT+"/vehicles")
.setConnectionTimeout(10000)
.setReadTimeout(10000)
.execute()) {