From a9015e429e40f83afdffd43552d34b82e67a75ff Mon Sep 17 00:00:00 2001
From: JYW <2013732181@qq.com>
Date: 星期一, 29 四月 2024 17:34:10 +0800
Subject: [PATCH] 2024-04-29 自定义注解,给每个接口加上自定义注解

---
 inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java |   72 ++++++++++++++++++++++++++++++++---
 1 files changed, 65 insertions(+), 7 deletions(-)

diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
index 718bf4a..96621d7 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
@@ -1,29 +1,36 @@
 package com.yuanchu.mom.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yuanchu.mom.annotation.ValueAuth;
+import com.yuanchu.mom.annotation.ValueClassify;
 import com.yuanchu.mom.dto.ReportPageDto;
-import com.yuanchu.mom.dto.SampleOrderDto;
+import com.yuanchu.mom.exception.ErrorException;
 import com.yuanchu.mom.service.InsReportService;
 import com.yuanchu.mom.utils.JackSonUtil;
 import com.yuanchu.mom.vo.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import lombok.AllArgsConstructor;
-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;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.Map;
 
-@AllArgsConstructor
 @RestController
 @RequestMapping("/insReport")
 @Api("妫�楠屾姤鍛�")
 public class InsReportController {
 
+    @Resource
     private InsReportService insReportService;
 
+    @Value("${wordUrl}")
+    private String wordUrl;
+    @ValueClassify("鎶ュ憡缂栧埗")
     @ApiOperation(value = "鏌ヨ妫�楠屾姤鍛婃暟鎹�")
     @PostMapping("/pageInsReport")
     public Result pageInsReport(@RequestBody Map<String, Object> data) throws Exception {
@@ -32,4 +39,55 @@
         return Result.success(insReportService.pageInsReport(page, reportPageDto));
     }
 
+    @ApiOperation(value = "鎶ュ憡涓婁紶")
+    @PostMapping("/inReport")
+    @ValueAuth
+    public Result inReport(MultipartFile file, Integer id) {
+        String urlString;
+        String pathName;
+        try {
+            String path = wordUrl;
+            File realpath = new File(path);
+            if (!realpath.exists()) {
+                realpath.mkdirs();
+            }
+            pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + file.getOriginalFilename();
+            urlString = realpath + "/" + pathName;
+            file.transferTo(new File(urlString));
+            return Result.success(insReportService.inReport("/word/"+pathName, id));
+        } catch (Exception e) {
+            throw new ErrorException("鏂囦欢涓婁紶澶辫触");
+        }
+    }
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "鎶ュ憡杩樺師")
+    @PostMapping("/upReportUrl")
+    public Result upReportUrl(Integer id) {
+        return Result.success(insReportService.upReportUrl(id));
+    }
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "鎶ュ憡鍦ㄧ嚎缂栧埗")
+    @GetMapping("/upReportFile")
+    public Result upReportFile() {
+        return Result.success();
+    }
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "鎻愪氦")
+    @PostMapping("/writeReport")
+    public Result writeReport(Integer id) {
+        return Result.success(insReportService.writeReport(id));
+    }
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "瀹℃牳")
+    @PostMapping("/examineReport")
+    public Result examineReport(Integer id, Integer isExamine, String examineTell) {
+        return Result.success(insReportService.examineReport(id, isExamine, examineTell));
+    }
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "鎵瑰噯")
+    @PostMapping("/ratifyReport")
+    public Result ratifyReport(Integer id, Integer isRatify, String ratifyTell) {
+        return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell));
+    }
+
 }

--
Gitblit v1.9.3