package com.klp.aps.controller; import com.klp.common.core.controller.BaseController; import com.klp.common.core.domain.R; import com.klp.aps.domain.dto.ApsLockReq; import com.klp.aps.service.ApsLockService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; 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; /** * APS 锁定/解锁 */ @Validated @RequiredArgsConstructor @RestController @RequestMapping("/aps") public class ApsLockController extends BaseController { private final ApsLockService apsLockService; /** * POST /aps/lock */ @PostMapping("/lock") public R lock(@Validated @RequestBody ApsLockReq req) { Long lockId = apsLockService.createLock(req, getUsername()); return R.ok(lockId); } /** * POST /aps/lock/release/{lockId} */ @PostMapping("/lock/release/{lockId}") public R release(@PathVariable Long lockId) { apsLockService.releaseLock(lockId, getUsername()); return R.ok(); } }