|
|
@ -0,0 +1,46 @@ |
|
|
|
package com.iflytop.gd.monitor.controller; |
|
|
|
|
|
|
|
import com.iflytop.gd.app.model.vo.CraftStatusVO; |
|
|
|
import com.iflytop.gd.app.service.CraftsService; |
|
|
|
import com.iflytop.gd.common.result.Result; |
|
|
|
import com.iflytop.gd.common.result.ResultCode; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import jakarta.validation.constraints.NotNull; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Tag(name = "工艺监控") |
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/monitor/crafts") |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Slf4j |
|
|
|
@Validated |
|
|
|
public class CraftsMonitorController { |
|
|
|
private final CraftsService craftsService; |
|
|
|
|
|
|
|
@Operation(summary = "获取某个加热区工艺状态") |
|
|
|
@GetMapping("/status/{heatId}") |
|
|
|
public Result<CraftStatusVO> getStatus( |
|
|
|
@NotNull @PathVariable String heatId) { |
|
|
|
CraftStatusVO vo = craftsService.getStatus(heatId); |
|
|
|
if (vo == null) { |
|
|
|
return Result.failed(ResultCode.NOT_FOUND, "未找到执行任务"); |
|
|
|
} |
|
|
|
return Result.success(vo); |
|
|
|
} |
|
|
|
|
|
|
|
@Operation(summary = "获取所有加热区工艺状态列表") |
|
|
|
@GetMapping("/status") |
|
|
|
public Result<List<CraftStatusVO>> getAllStatuses() { |
|
|
|
List<CraftStatusVO> list = craftsService.getAllStatuses(); |
|
|
|
return Result.success(list); |
|
|
|
} |
|
|
|
} |