Browse Source

更改图片路径

gushoubang 9 months ago
parent
commit
83e21b53b0

+ 16 - 6
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/CreateUtilsDBServiceImpl.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.service.impl;
 
 import com.onemap.analyse.mapper.vector.CreateUtilsDBMapper;
 import com.onemap.analyse.service.CreateUtilsDBService;
+import com.onemap.common.core.utils.StringUtils;
 import org.bouncycastle.util.Strings;
 import org.springframework.stereotype.Service;
 
@@ -20,7 +21,8 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         long timestamp = System.currentTimeMillis();
         String[] tableNames = Strings.split(tableName, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
+        String newTableName = StringUtils.getTemporaryTableName();
         createUtilsDBMapper.bufferTable(tableName, radius, newTableName);
         return newTableName;
     }
@@ -30,8 +32,9 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         long timestamp = System.currentTimeMillis();
         String[] tableNames = Strings.split(tableName, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
 
+        String newTableName = StringUtils.getTemporaryTableName();
         createUtilsDBMapper.bufferColumnTable(tableName, column, newTableName);
         return newTableName;
     }
@@ -51,7 +54,8 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         long timestamp = System.currentTimeMillis();
         String[] tableNames = Strings.split(tableName, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_diff_wkt_" + tableNames[tableNames.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_diff_wkt_" + tableNames[tableNames.length - 1];
+        String newTableName = StringUtils.getTemporaryTableName();
         createUtilsDBMapper.differenceTableWkt(tableName, tableIds, ewkt, newTableName);
         return newTableName;
     }
@@ -62,7 +66,10 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         String[] tableNamesA = Strings.split(tableNameA, '_');
         String[] tableNamesB = Strings.split(tableNameB, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_diff_" + tableNamesB[tableNamesB.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_diff_" + tableNamesB[tableNamesB.length - 1];
+        String newTableName = StringUtils.getTemporaryTableName();
+
+
 
         String temporaryTable = "temporaryTable_" + timestamp;
         createUtilsDBMapper.differenceTables(tableNameA, tableIdsA, tableNameB, newTableName, temporaryTable);
@@ -79,7 +86,9 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         long timestamp = System.currentTimeMillis();
         String[] tableNames = Strings.split(tableName, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_inter_wkt_" + tableNames[tableNames.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_inter_wkt_" + tableNames[tableNames.length - 1];
+        String newTableName = StringUtils.getTemporaryTableName();
+
         createUtilsDBMapper.intersectionTableWkt(tableName, tableIds, ewkt, newTableName);
         return newTableName;
     }
@@ -90,7 +99,8 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         String[] tableNamesA = Strings.split(tableNameA, '_');
         String[] tableNamesB = Strings.split(tableNameB, '_');
 
-        String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_inter_table_" + tableNamesB[tableNamesB.length - 1];
+        // String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_inter_table_" + tableNamesB[tableNamesB.length - 1];
+        String newTableName = StringUtils.getTemporaryTableName();
         createUtilsDBMapper.intersectionTables(tableNameA, tableIdsA, tableNameB, newTableName);
         return newTableName;
     }

+ 1 - 1
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/AlgorithmMapper.xml

@@ -7,6 +7,6 @@
         CREATE TABLE if not exists ${tableName} (
                                                        idarray int4[] not null, area float8, feature VARCHAR ,weight float, geom public.geometry null
         );
-        select big_area_block(#{jsonArg}, #{systemArg})
+        select vector.big_area_block(#{jsonArg}, #{systemArg})
     </select>
 </mapper>

+ 9 - 3
onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/impl/ImageServiceImpl.java

@@ -1,5 +1,6 @@
 package com.onemap.spatial.service.impl;
 
+import com.onemap.common.core.utils.StringUtils;
 import com.onemap.spatial.domain.WktsVo;
 import com.onemap.spatial.service.IImageService;
 import org.geotools.coverage.grid.GridCoverage2D;
@@ -52,14 +53,16 @@ public class ImageServiceImpl implements IImageService {
 
     @Override
     public String getSensingImage(WktsVo wktsVo) throws Exception {
-        System.out.println("生成图片");
+        System.out.println("开始生成图片");
         // 图片保存路径
-        String fileDir = rootPath + "/images/" + UUID.randomUUID().toString() + "/";
+        String fileDir = rootPath + "/images/" + StringUtils.getUUID() + "/";
         File dir = new File(fileDir);
         if (!dir.exists()) {
             dir.mkdirs();
         }
-        String filePath=fileDir + System.currentTimeMillis()+".png";
+        String filePath = fileDir + System.currentTimeMillis() + ".png";
+
+        System.out.println("图片地址:" + filePath);
 
         // 创建一个 MapContent 对象
         MapContent mapContent = new MapContent();
@@ -142,8 +145,11 @@ public class ImageServiceImpl implements IImageService {
             renderer.paint(g2d, outputArea, combinedBounds);
             ImageIO.write(bufferedImage, "png", outputImageFile);
         } catch (IOException ex) {
+            System.out.println("生成图片失败");
+            System.out.println(ex);
             ex.printStackTrace();
         }
+        System.out.println("生成图片成功:"+filePath);
         return filePath;
     }