package com.isu.gaswellwatch.controller; import com.isu.gaswellwatch.annotation.OperationLog; import com.isu.gaswellwatch.entity.Response; import com.isu.gaswellwatch.enums.LogType; import com.isu.gaswellwatch.modbus.CommandService; import com.isu.gaswellwatch.vo.command.CollectCommand; import com.isu.gaswellwatch.vo.command.Command; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author 王仕龙 * 2024/11/27 0:23 */ @RestController @RequiredArgsConstructor @RequestMapping("/command") public class CommandController { private final CommandService commandService; @PostMapping(value = "/control") @OperationLog(description = "下发控制指令", type = LogType.ADD) public Response control(@RequestBody @Validated Command command) { return this.commandService.control(command); } @PostMapping(value = "/collect") @OperationLog(description = "下发采集指令", type = LogType.ADD) public Response collect(@RequestBody @Validated CollectCommand command) { return this.commandService.collect(command); } }