feiyu02
2022-07-28 237d7c42498806a3ca205f63d151671a45304854
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt
@@ -1,8 +1,11 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.lightshare.service.CommitmentService
import cn.flightfeather.supervision.lightshare.vo.CommitmentVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import io.swagger.annotations.ApiResponse
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import javax.servlet.http.HttpServletResponse
@@ -19,16 +22,26 @@
    @ApiOperation(value = "获取用户承诺书")
    @GetMapping("/letter")
    fun getLetterOfCommitment(
            @RequestParam("userId") userId: String,
            @RequestParam("page") page: Int,
            @RequestParam("per_page") perPage: Int,
            response: HttpServletResponse
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam(value = "页码") @RequestParam("page") page: Int,
        @ApiParam(value = "单页数据量") @RequestParam("per_page") perPage: Int,
        response: HttpServletResponse
    ) = commitmentService.getLetterOfCommitment(userId, page, perPage, response)
    @ApiOperation(value = "上传承诺书")
    @PostMapping("/letter/upload")
    fun uploadLetterOfCommitment(
            @RequestParam userId: String,
            @RequestParam("params") commitmentVoList: String,
            @RequestPart("images") files: Array<MultipartFile>
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "承诺书信息json") @RequestParam("params") commitmentVoList: String,
        @ApiParam(value = "承诺书图片") @RequestPart("images") files: Array<MultipartFile>
    ) = commitmentService.uploadLetterOfCommitment(userId, commitmentVoList, files)
    @ApiOperation(value = "生成承诺书")
    @PostMapping("/letter/create")
    fun createLetterOfCommitment(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "承诺书参数") @RequestBody vo: CommitmentVo,
        @ApiParam(value = "承诺书签名") @RequestPart("sign") sign: MultipartFile,
        @ApiParam(value = "承诺书盖章", required = false) @RequestPart("seal") seal: MultipartFile?
    ) = commitmentService.createLetterOfCommitment(userId, vo, sign, seal)
}