From 752e00503f672ddfe2066afb6c235721a3a912b5 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 19 十一月 2024 10:25:55 +0800
Subject: [PATCH] 2024.11.19 各项修正

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt
index d9c7558..2e89d21 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/CommitmentController.kt
@@ -1,12 +1,16 @@
 package cn.flightfeather.supervision.lightshare.web
 
 import cn.flightfeather.supervision.lightshare.service.CommitmentService
+import cn.flightfeather.supervision.lightshare.vo.BaseResponse
+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 org.springframework.web.multipart.MultipartHttpServletRequest
+import javax.servlet.http.HttpServletRequest
 import javax.servlet.http.HttpServletResponse
 
 /**
@@ -27,6 +31,12 @@
         response: HttpServletResponse
     ) = commitmentService.getLetterOfCommitment(userId, page, perPage, response)
 
+    @ApiOperation(value = "鑾峰彇鐢ㄦ埛鎵胯涔︽ā鏉�")
+    @GetMapping("/letter/template")
+    fun getTemplateOfCommitment(
+        @ApiParam(value = "鐢ㄦ埛id") @RequestParam("userId") userId: String,
+    ) = commitmentService.getTemplateOfCommitment(userId)
+
     @ApiOperation(value = "涓婁紶鎵胯涔�")
     @PostMapping("/letter/upload")
     fun uploadLetterOfCommitment(
@@ -35,10 +45,16 @@
         @ApiParam(value = "鎵胯涔﹀浘鐗�") @RequestPart("images") files: Array<MultipartFile>
     ) = commitmentService.uploadLetterOfCommitment(userId, commitmentVoList, files)
 
-    @ApiOperation(value = "鐢熶骇鎵胯涔�")
+    @ApiOperation(value = "鐢熸垚鎵胯涔�")
     @PostMapping("/letter/create")
-    fun createLetterOfCommitment(
-        @ApiParam(value = "鐢ㄦ埛id") @RequestParam userId: String,
-        @ApiParam(value = "鎵胯涔﹀弬鏁�") @RequestBody params: MutableMap<String, Any>
-    ) = commitmentService.createLetterOfCommitment(userId, params)
+    fun createLetterOfCommitment(request: HttpServletRequest) = if (request is MultipartHttpServletRequest) {
+        val sign = request.getFile("sign")
+        val seal = request.getFile("seal")
+        val userId = request.getParameter("userId")
+        val vo = request.getParameter("coVo")
+
+        commitmentService.createLetterOfCommitment(userId, vo, sign, seal)
+    } else {
+        BaseResponse(false)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3