From 35cb086a6e05bf0b6e2a6831330fbcd2c740eba7 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Mon, 01 Apr 2024 20:44:21 +0800
Subject: [PATCH] 修改workspaceId

---
 src/main/java/com/dji/sample/patches/service/impl/ShpToDataSourceServiceImpl.java |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/dji/sample/patches/service/impl/ShpToDataSourceServiceImpl.java b/src/main/java/com/dji/sample/patches/service/impl/ShpToDataSourceServiceImpl.java
index 612246a..30cccc9 100644
--- a/src/main/java/com/dji/sample/patches/service/impl/ShpToDataSourceServiceImpl.java
+++ b/src/main/java/com/dji/sample/patches/service/impl/ShpToDataSourceServiceImpl.java
@@ -9,8 +9,10 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
+
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
@@ -20,32 +22,30 @@
 public class ShpToDataSourceServiceImpl implements ShpToDataSourceService {
     @Autowired
     private ShpToDataSourceMapper mapper;
-
-    private int createTime = 0;
-    private int updateTime = 0;
-
-    String Land="N1C1D";
     String head = POLYGON;
     String json;
-
-    public void insertGeo(MultipartFile file) throws IOException {
-        LotInfo patches = new LotInfo();
+    public List<LotInfo> insertGeo(MultipartFile file ,String workspaceId) throws IOException {
+        List<LotInfo> list=new ArrayList<>();
         MultipartFileTOFileUtil multipartFileTOFileUtil = new MultipartFileTOFileUtil();
         File file1 = multipartFileTOFileUtil.multipartFile2File(file);
         List<String> s = ShapeFileUtil.shpToGeoJson(file1);
         String[] arr1 = FormatConversionUtil.formatConversion(s);
         for (int i = 0; i < arr1.length; i++) {
-            int count=mapper.selectCount(null)+1;
+            LotInfo lotInfo = new LotInfo();
             String temp = arr1[i].trim();
             temp = FormatConversionUtil.modifySpacesAndCommas(temp);
             json = head + temp;
-            patches.setBsm(UUID.randomUUID().toString());
-            patches.setCreateTime(createTime);
-            patches.setUpdateTime(updateTime);
-            patches.setDkfw(json);
-            patches.setDkbh(Land+count);
-            mapper.insert(patches);
+            String uuid = UUID.randomUUID().toString();
+            String bsm = uuid.replaceAll("-", "");
+            lotInfo.setBsm(bsm);
+            lotInfo.setWorkspaceId(workspaceId);
+            lotInfo.setDkfw(json);
+            lotInfo.setDkbh("dkbh"+i);
+            mapper.insert(lotInfo);
+            list.add(lotInfo);
+            System.out.println(lotInfo);
         }
+        return list;
     }
 
 }

--
Gitblit v1.9.3