opt:1.管理后台系统优化国际化。2.添加巡航模式任务接口。
This commit is contained in:
32
nl-business-externalApi/pom.xml
Normal file
32
nl-business-externalApi/pom.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nl-robot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>nl-business-externalApi</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>
|
||||
外部API模块
|
||||
提供外部访问API
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nl-business-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.externalApi;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: ${DATE}
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.externalApi.task.controller;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.externalApi.task.param.CreateTaskParam;
|
||||
import org.nl.externalApi.task.service.ExternalTaskService;
|
||||
import org.nl.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/2/24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/external/api")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class ExternalTaskController {
|
||||
|
||||
@Resource
|
||||
private ExternalTaskService externalTaskService;
|
||||
|
||||
@PostMapping("/createTask")
|
||||
@Log("外部API:创建任务")
|
||||
public ResponseEntity<Object> createTask(@RequestBody CreateTaskParam createTaskParam){
|
||||
return new ResponseEntity<>(externalTaskService.createTask(createTaskParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cancelTask/{id}")
|
||||
@Log("外部API:取消任务任务")
|
||||
public ResponseEntity<Object> cancelTask(@PathVariable String id){
|
||||
return new ResponseEntity<>(externalTaskService.cancelTask(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTaskInfos")
|
||||
@Log("外部API:查询所有未完成的任务")
|
||||
public ResponseEntity<Object> getTaskInfos(){
|
||||
return new ResponseEntity<>(externalTaskService.getTaskInfos(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTaskInfos/{id}")
|
||||
@Log("外部API:根据任务号查询任务")
|
||||
public ResponseEntity<Object> getTaskInfosById(@PathVariable String id){
|
||||
return new ResponseEntity<>(externalTaskService.getTaskInfosById(id), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.externalApi.task.param;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 外部API创建任务参数
|
||||
* @author dsh
|
||||
* 2026/2/24
|
||||
*/
|
||||
@Data
|
||||
public class CreateTaskParam {
|
||||
|
||||
/**
|
||||
* 目的地
|
||||
*/
|
||||
@NotBlank(message = "目的地不能为空")
|
||||
private String destinations;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
@NotBlank(message = "任务类型不能为空")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private String priority;
|
||||
|
||||
/**
|
||||
* 指定车辆
|
||||
*/
|
||||
private String vehicle_number;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.externalApi.task.service;
|
||||
|
||||
import org.nl.externalApi.task.param.CreateTaskParam;
|
||||
import org.nl.response.WebResponse;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/2/24
|
||||
*/
|
||||
public interface ExternalTaskService {
|
||||
|
||||
/**
|
||||
* 外部API 创建任务
|
||||
* @param createTaskParam
|
||||
* @return WebResponse
|
||||
*/
|
||||
WebResponse createTask(CreateTaskParam createTaskParam);
|
||||
|
||||
/**
|
||||
* 外部API 取消任务
|
||||
* @param task_code
|
||||
* @return WebResponse
|
||||
*/
|
||||
WebResponse cancelTask(String task_code);
|
||||
|
||||
/**
|
||||
* 外部API 查询所有未完成的任务信息
|
||||
* @return WebResponse
|
||||
*/
|
||||
WebResponse getTaskInfos();
|
||||
|
||||
/**
|
||||
* 根据任务号查询任务信息
|
||||
* @param task_code
|
||||
* @return WebResponse
|
||||
*/
|
||||
WebResponse getTaskInfosById(String task_code);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.nl.externalApi.task.service.impl;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.nl.api.task.api.TaskAPI;
|
||||
import org.nl.externalApi.task.param.CreateTaskParam;
|
||||
import org.nl.externalApi.task.service.ExternalTaskService;
|
||||
import org.nl.response.WebResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/2/24
|
||||
*/
|
||||
@Service
|
||||
public class ExternalTaskServiceImpl implements ExternalTaskService {
|
||||
|
||||
@Resource
|
||||
private TaskAPI taskAPI;
|
||||
|
||||
@Override
|
||||
public WebResponse createTask(CreateTaskParam createTaskParam) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebResponse cancelTask(String task_code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebResponse getTaskInfos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebResponse getTaskInfosById(String task_code) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user