Explorar o código

滨江要素一本账,导出shpfile列表

liutao hai 1 mes
pai
achega
223fa78cfc

+ 21 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/controller/rest/YbzBJController.java

@@ -623,6 +623,27 @@ public class YbzBJController extends BaseRestController {
         }
     }
 
+    @GetMapping("/exportShapeList")
+    public Object exportShapeList(CommonDTO dto, HttpServletResponse response) {
+        try {
+            logger.info("/api/ybz-bj/exportOneShape 接口调用~~~");
+            String zipFilePath = service.exportOneShape(dto);
+            InputStream is = new FileInputStream(zipFilePath);
+
+            response.setContentType("multipart/form-data");
+            response.setCharacterEncoding("utf-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("地块", "utf-8") + ".zip");
+            response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+            FileCopyUtils.copy(is, response.getOutputStream());
+            return result(null);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            logger.warn("/api/ybz-bj/exportOneShape 接口异常 -> " + ex.getMessage());
+            return error(ex.getMessage(), ErrorCode.DEFAULT);
+        }
+    }
+
     @PostMapping("/uploadTxt")
     public Object uploadTxt(@RequestParam("file") MultipartFile file) {
         //对file进行校验

+ 22 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/domain/entity/Bjwkfly.java

@@ -0,0 +1,22 @@
+package com.zjugis.ysgzybz.domain.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName(value = "sde.bjwkfly2000")
+public class Bjwkfly {
+
+    private Integer id;
+
+    private String shape;
+    private String dksyh;
+
+    private String dkbh;
+
+    private String gddw;
+    private String dkwz;
+
+}