feiyu02
2024-11-19 752e00503f672ddfe2066afb6c235721a3a912b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.lightshare.service.OperationService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["实操事务API接口"])
@RestController
@RequestMapping("/operation")
class OperationController(private val operationService: OperationService){
 
    @ApiOperation(value = "获取用户的实操事务")
    @GetMapping("/get")
    fun getOperations(@ApiParam("用户id") @RequestParam userId: String) =
        resPack { operationService.getOperations(userId) }
 
    @ApiOperation(value = "获取用户的实操事务以及最新执行记录")
    @GetMapping("/get/record")
    fun getOperationRecord(@ApiParam("用户id") @RequestParam userId: String) =
        resPack { operationService.getOperationRecord(userId) }
 
    @ApiOperation(value = "用户完成某项事务")
    @PostMapping("/execute")
    fun executeOperation(
        @ApiParam("用户id") @RequestParam userId: String,
        @ApiParam("实操事务id") @RequestParam operationId: Int,
        @ApiParam("实操事务状态id") @RequestParam stateId: String,
    ) = resPack { operationService.executeOperation(userId, operationId, stateId) }
}