From 657bac701c88d7aee9a3906721dd4218c9baa166 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 11 十一月 2022 13:22:08 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/show/ExportController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/show/ExportController.java b/src/main/java/com/lf/server/controller/show/ExportController.java
index b3f1d5f..210abe8 100644
--- a/src/main/java/com/lf/server/controller/show/ExportController.java
+++ b/src/main/java/com/lf/server/controller/show/ExportController.java
@@ -4,14 +4,20 @@
 import com.lf.server.controller.all.BaseController;
 import com.lf.server.entity.all.ResponseMsg;
 import com.lf.server.entity.data.DictEntity;
+import com.lf.server.entity.show.ExportEntity;
+import com.lf.server.entity.sys.UserEntity;
+import com.lf.server.helper.StringHelper;
+import com.lf.server.service.data.DownloadService;
+import com.lf.server.service.show.ExportService;
+import com.lf.server.service.sys.TokenService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -22,6 +28,15 @@
 @RestController
 @RequestMapping("/export")
 public class ExportController  extends BaseController {
+    @Autowired
+    ExportService exportService;
+
+    @Autowired
+    TokenService tokenService;
+
+    @Autowired
+    DownloadService downloadService;
+
     @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ")
     @ApiImplicitParams({
@@ -45,13 +60,37 @@
         }
     }
 
-    public ResponseMsg<String> upload() {
+    @SysLog()
+    @ApiOperation(value = "鏂板缓鍑哄浘")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "entity", value = "鍦ㄧ嚎鍒跺浘瀹炰綋绫�", dataType = "ExportEntity", paramType = "body")
+    })
+    @ResponseBody
+    @PostMapping(value = "/insertMap", produces = "application/json; charset=UTF-8")
+    public ResponseMsg<String> insertMap(@RequestBody ExportEntity entity, HttpServletRequest req) {
         try {
+            if (entity == null ||
+                    StringHelper.isEmpty(entity.getLayers()) ||
+                    StringHelper.isEmpty(entity.getToken()) ||
+                    (entity.getXmin() == 0 && entity.getYmin() == 0 && entity.getXmax() == 0 && entity.getYmax() == 0)) {
+                return fail("鍙傛暟涓嶅畬鏁�");
+            }
 
+            UserEntity ue = tokenService.getCurrentUser(req);
+            if (ue == null) {
+                return fail("鐢ㄦ埛鏈櫥褰�");
+            }
 
-            return success(null);
+            String str = exportService.post(entity);
+            if (StringHelper.isNull(str)) {
+                return fail("鍑哄浘澶辫触");
+            }
+
+            //
+
+            return success(str);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex.getMessage());
         }
     }
 }

--
Gitblit v1.9.3