fix(ops): 取消工单接口改用 @RequestBody 接收 JSON 参数
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled

前端以 JSON body 传参,@RequestParam 无法读取导致 400 "请求参数缺失"。
新增 OpsOrderCancelReqDTO,Controller 改为 @RequestBody 风格,
与 create/assign/complete 等接口保持一致。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lzh
2026-02-14 12:33:44 +08:00
parent 8ab7e7cc05
commit abaa737d23
2 changed files with 27 additions and 5 deletions

View File

@@ -132,12 +132,9 @@ public class OpsOrderController {
@PostMapping("/cancel")
@Operation(summary = "取消工单")
@Parameter(name = "id", description = "工单ID", required = true)
@Parameter(name = "reason", description = "取消原因", required = true)
@PreAuthorize("@ss.hasPermission('ops:order:cancel')")
public CommonResult<Boolean> cancelOrder(@RequestParam("id") Long id,
@RequestParam("reason") String reason) {
opsOrderService.cancelOrder(id, reason, OperatorTypeEnum.ADMIN, null);
public CommonResult<Boolean> cancelOrder(@Valid @RequestBody OpsOrderCancelReqDTO cancelReq) {
opsOrderService.cancelOrder(cancelReq.getId(), cancelReq.getReason(), OperatorTypeEnum.ADMIN, null);
return success(true);
}