添加参数
This commit is contained in:
parent
6950053351
commit
df6487f4fa
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.R;
|
|||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.task.api.domain.TaskStatByMonthVO;
|
||||
import com.ruoyi.task.api.domain.TaskStatQueryVO;
|
||||
import com.ruoyi.task.api.domain.TaskVO;
|
||||
import com.ruoyi.task.api.enums.TaskCategoryEnum;
|
||||
import com.ruoyi.task.api.enums.TaskTypeEnum;
|
||||
import com.ruoyi.task.api.enums.StatusEnum;
|
||||
|
|
@ -35,13 +36,13 @@ public class TaskController extends BaseController
|
|||
* 创建普通-立即任务
|
||||
*/
|
||||
@PostMapping
|
||||
public R<Long> createTaskWithoutPlan(@RequestBody com.ruoyi.task.api.domain.TaskDTO taskDTO)
|
||||
public R<Long> createTaskWithoutPlan(@RequestBody TaskVO taskVO)
|
||||
{
|
||||
taskDTO.setTaskType(TaskTypeEnum.IMMEDIATELY);
|
||||
taskDTO.setTaskCategory(TaskCategoryEnum.NORMAL);
|
||||
log.info("createTaskWithoutPlan {}", JSON.toJSONString(taskDTO));
|
||||
taskVO.setTaskType(TaskTypeEnum.IMMEDIATELY);
|
||||
taskVO.setTaskCategory(TaskCategoryEnum.NORMAL);
|
||||
log.info("createTaskWithoutPlan {}", JSON.toJSONString(taskVO));
|
||||
|
||||
Long taskId = taskService.createTaskWithoutPlan(TaskControllerConvert.to(taskDTO));
|
||||
Long taskId = taskService.createTaskWithoutPlan(TaskControllerConvert.to(taskVO));
|
||||
return R.ok(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ public class TaskController extends BaseController
|
|||
* 获取任务详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{taskId}")
|
||||
public R<com.ruoyi.task.api.domain.TaskDTO> getTaskById(@PathVariable("taskId") Long taskId)
|
||||
public R<TaskVO> getTaskById(@PathVariable("taskId") Long taskId)
|
||||
{
|
||||
return R.ok(TaskControllerConvert.from(taskService.getTaskById(taskId)));
|
||||
}
|
||||
|
|
@ -67,10 +68,10 @@ public class TaskController extends BaseController
|
|||
* 更新任务
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Boolean> updateTask(@RequestBody com.ruoyi.task.api.domain.TaskDTO taskDTO)
|
||||
public R<Boolean> updateTask(@RequestBody TaskVO taskVO)
|
||||
{
|
||||
log.info("updateTask {}", JSON.toJSONString(taskDTO));
|
||||
boolean result = taskService.updateTask(TaskControllerConvert.to(taskDTO));
|
||||
log.info("updateTask {}", JSON.toJSONString(taskVO));
|
||||
boolean result = taskService.updateTask(TaskControllerConvert.to(taskVO));
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +90,7 @@ public class TaskController extends BaseController
|
|||
* 根据无人机ID查询任务列表
|
||||
*/
|
||||
@GetMapping("/uav/{uavId}")
|
||||
public R<List<com.ruoyi.task.api.domain.TaskDTO>> getTaskByUavId(@PathVariable("uavId") String uavId)
|
||||
public R<List<TaskVO>> getTaskByUavId(@PathVariable("uavId") String uavId)
|
||||
{
|
||||
return R.ok(TaskControllerConvert.fromList(taskService.getTaskByUavId(uavId)));
|
||||
}
|
||||
|
|
@ -98,7 +99,7 @@ public class TaskController extends BaseController
|
|||
* 根据无人机ID获取最新的一条任务
|
||||
*/
|
||||
@GetMapping("/uav/current/{uavId}")
|
||||
public R<com.ruoyi.task.api.domain.TaskDTO> getCurrentTaskByUavId(@PathVariable("uavId") String uavId)
|
||||
public R<TaskVO> getCurrentTaskByUavId(@PathVariable("uavId") String uavId)
|
||||
{
|
||||
return R.ok(TaskControllerConvert.from(taskService.getCurrentTaskByUavId(uavId)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.task.controller.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.task.api.domain.TaskVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -10,39 +11,39 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
* @date 2026-03-09
|
||||
*/
|
||||
public class TaskControllerConvert extends BaseConvert<com.ruoyi.task.service.dto.TaskDTO, com.ruoyi.task.api.domain.TaskDTO> {
|
||||
public class TaskControllerConvert extends BaseConvert<com.ruoyi.task.service.dto.TaskDTO, TaskVO> {
|
||||
|
||||
private static final TaskControllerConvert INSTANCE = new TaskControllerConvert();
|
||||
|
||||
private TaskControllerConvert() {
|
||||
super(com.ruoyi.task.service.dto.TaskDTO.class, com.ruoyi.task.api.domain.TaskDTO.class);
|
||||
super(com.ruoyi.task.service.dto.TaskDTO.class, TaskVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务DTO 转 API DTO
|
||||
*/
|
||||
public static com.ruoyi.task.api.domain.TaskDTO from(com.ruoyi.task.service.dto.TaskDTO dto) {
|
||||
public static TaskVO from(com.ruoyi.task.service.dto.TaskDTO dto) {
|
||||
return INSTANCE.innerFrom(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* API DTO 转 服务DTO
|
||||
*/
|
||||
public static com.ruoyi.task.service.dto.TaskDTO to(com.ruoyi.task.api.domain.TaskDTO apiDTO) {
|
||||
public static com.ruoyi.task.service.dto.TaskDTO to(TaskVO apiDTO) {
|
||||
return INSTANCE.innerTo(apiDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务DTO List 转 API DTO List
|
||||
*/
|
||||
public static List<com.ruoyi.task.api.domain.TaskDTO> fromList(List<com.ruoyi.task.service.dto.TaskDTO> dtoList) {
|
||||
public static List<TaskVO> fromList(List<com.ruoyi.task.service.dto.TaskDTO> dtoList) {
|
||||
return INSTANCE.innerFromList(dtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* API DTO List 转 服务DTO List
|
||||
*/
|
||||
public static List<com.ruoyi.task.service.dto.TaskDTO> toList(List<com.ruoyi.task.api.domain.TaskDTO> apiDTOList) {
|
||||
public static List<com.ruoyi.task.service.dto.TaskDTO> toList(List<TaskVO> apiDTOList) {
|
||||
return INSTANCE.innerToList(apiDTOList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ public class Task {
|
|||
/** 状态 */
|
||||
private StatusEnum status;
|
||||
|
||||
/**
|
||||
* 错误是否恢复
|
||||
*/
|
||||
private Boolean recovery ;
|
||||
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
|
|
@ -148,6 +153,14 @@ public class Task {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public Boolean getRecovery() {
|
||||
return recovery;
|
||||
}
|
||||
|
||||
public void setRecovery(Boolean recovery) {
|
||||
this.recovery = recovery;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ public class TaskInfoEntity extends BaseEntity {
|
|||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
/** 错误是否恢复 */
|
||||
private Boolean recovery;
|
||||
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
|
|
@ -131,6 +134,14 @@ public class TaskInfoEntity extends BaseEntity {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public Boolean getRecovery() {
|
||||
return recovery;
|
||||
}
|
||||
|
||||
public void setRecovery(Boolean recovery) {
|
||||
this.recovery = recovery;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public class TaskDTOConvert {
|
|||
dto.setDescription(task.getDescription());
|
||||
dto.setRemark(task.getRemark());
|
||||
dto.setRouteUrl(task.getRouteUrl());
|
||||
dto.setRecovery(task.getRecovery());
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ public class TaskDTO {
|
|||
/** 状态 */
|
||||
private StatusEnum status;
|
||||
|
||||
/** 错误是否恢复 */
|
||||
private Boolean recovery;
|
||||
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
|
|
@ -138,6 +141,14 @@ public class TaskDTO {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public Boolean getRecovery() {
|
||||
return recovery;
|
||||
}
|
||||
|
||||
public void setRecovery(Boolean recovery) {
|
||||
this.recovery = recovery;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
-- 为任务表添加 recovery 字段
|
||||
ALTER TABLE task_info ADD COLUMN recovery BOOLEAN DEFAULT FALSE COMMENT '错误是否恢复';
|
||||
Loading…
Reference in New Issue