From 17c7e460e0664ef30b34b6a6af8ad72a075d401c Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期一, 24 三月 2025 15:05:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java |   92 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 82 insertions(+), 10 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 6a40450..17be7bb 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,8 +1,12 @@
 package com.yuanchu.mom.controller;
 
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONObject;
 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.InsReportDto;
 import com.yuanchu.mom.dto.ReportPageDto;
 import com.yuanchu.mom.exception.ErrorException;
 import com.yuanchu.mom.service.InsReportService;
@@ -10,21 +14,25 @@
 import com.yuanchu.mom.vo.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Map;
+import java.util.Objects;
+import java.util.Scanner;
 
 @RestController
 @RequestMapping("/insReport")
-@AllArgsConstructor
-@Api("妫�楠屾姤鍛�")
+@Api(tags = "妫�楠屾姤鍛�")
 public class InsReportController {
 
     @Resource
@@ -32,7 +40,8 @@
 
     @Value("${wordUrl}")
     private String wordUrl;
-    @ValueAuth
+
+    @ValueClassify("鎶ュ憡缂栧埗")
     @ApiOperation(value = "鏌ヨ妫�楠屾姤鍛婃暟鎹�")
     @PostMapping("/pageInsReport")
     public Result pageInsReport(@RequestBody Map<String, Object> data) throws Exception {
@@ -41,9 +50,9 @@
         return Result.success(insReportService.pageInsReport(page, reportPageDto));
     }
 
+    @ValueClassify("鎶ュ憡缂栧埗")
     @ApiOperation(value = "鎶ュ憡涓婁紶")
     @PostMapping("/inReport")
-    @ValueAuth
     public Result inReport(MultipartFile file, Integer id) {
         String urlString;
         String pathName;
@@ -56,40 +65,103 @@
             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));
+            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("鎶ュ憡缂栧埗")
+
+    /*@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));
+    public Result ratifyReport(Integer id, Integer isRatify, String ratifyTell,String sealUrl) {
+        return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell,sealUrl));
     }
 
+    @RequestMapping("/onlyOffice/save")
+    @ValueAuth
+    public void saveFile(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
+        PrintWriter writer = null;
+        try {
+            writer = response.getWriter();
+            // 鑾峰彇浼犺緭鐨刯son鏁版嵁
+            Scanner scanner = new Scanner(request.getInputStream()).useDelimiter("\\A");
+            String body = scanner.hasNext() ? scanner.next() : "";
+            JSONObject jsonObject = JSONObject.parseObject(body);
+
+            if (jsonObject.containsKey("url")) {
+                String jsonArray = jsonObject.get("lastsave").toString(); // 鏇存柊鏃堕棿
+                String fileUrl = jsonObject.get("url").toString(); // 鏇存柊鏂囦欢url
+                HttpUtil.downloadFile(fileUrl, FileUtil.file(wordUrl + "/" + fileName));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            writer.write("{\"error\":-1}");
+            return;
+        }
+        /*
+         * status = 1锛屾垜浠粰onlyOffice鐨勬湇鍔¤繑鍥瀧"error":"0"}鐨勪俊鎭��
+         * 杩欐牱onlyOffice浼氳涓哄洖璋冩帴鍙f槸娌¢棶棰樼殑锛岃繖鏍峰氨鍙互鍦ㄧ嚎缂栬緫鏂囨。浜嗭紝鍚﹀垯鐨勮瘽浼氬脊鍑虹獥鍙h鏄�
+         */
+        if (Objects.nonNull(writer)) {
+            writer.write("{\"error\":0}");
+        }
+    }
+
+    @ValueAuth
+    @ApiOperation(value = "鎶ュ憡鎵归噺涓嬭浇")
+    @GetMapping("/downAll")
+    public Result downAll(String ids) {
+        return Result.success(insReportService.downAll(ids));
+    }
+
+    @ValueAuth
+    @ApiOperation(value = "鎶ュ憡鎵归噺涓婁紶")
+    @PostMapping("/upAll")
+    public Result upAll(MultipartFile file) throws IOException {
+        return Result.success(insReportService.upAll(file));
+    }
+
+    @ValueAuth
+    @ApiOperation(value = "鏌ュ嚭璇ヨ鍗曚笅姣忎釜鏍峰搧涓嬫瘡涓珯鐐圭殑妫�楠屾鏁�")
+    @GetMapping("/getInsOrderStateCount")
+    public Result getInsOrderStateCount(Integer id){
+        return Result.success(insReportService.getInsOrderStateCount(id));
+    }
+
+    //鍙栨秷2.26
+    @ValueClassify("鎶ュ憡缂栧埗")
+    @ApiOperation(value = "鍒ゆ柇鏄惁鐢熸垚鎬绘姤鍛�")
+    @PostMapping("/isReport")
+    public Result isReport(@RequestBody InsReportDto insReportDto) {
+        return Result.success(insReportService.isReport(insReportDto));
+    }
 }

--
Gitblit v1.9.3