瀏覽代碼

兼容byte

chenendian 4 天之前
父節點
當前提交
bcbc956e46

+ 23 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/CadastreManageServiceImpl.java

@@ -722,6 +722,26 @@ public class CadastreManageServiceImpl implements CadastreManageService {
                 String fieldName = feature.GetFieldDefnRef(i).GetName();
                 if (fieldNameAndTypeMap.containsKey(fieldName.toLowerCase())) {
                     String fieldType = fieldNameAndTypeMap.get(fieldName.toLowerCase());
+
+
+/*                    if ("dclxtzm".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, "99");
+                    }
+                    else if ("fwjg".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, null);
+                    }
+                    else if ("jzwgd".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, 1);
+                    }
+                    else if ("ycjzmj".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, 1);
+                    }
+                    else if ("zts".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, 1);
+                    }
+                    else if ("zydmj".equalsIgnoreCase(fieldName)) {
+                        map.put(fieldName, null);
+                    }*/
                     if (StringUtils.containsIgnoreCase(fieldType, "character")) {
                         map.put(fieldName, feature.GetFieldAsString(i));
                     } else if (StringUtils.containsIgnoreCase(fieldType, "integer") || StringUtils.containsIgnoreCase(fieldType, "smallint") || StringUtils.containsIgnoreCase(fieldType, "int2") || StringUtils.containsIgnoreCase(fieldType, "int4")) {
@@ -751,8 +771,9 @@ public class CadastreManageServiceImpl implements CadastreManageService {
                             map.put(fieldName, feature.GetFieldAsDouble(i));
                         }
                     } else if (StringUtils.containsIgnoreCase(fieldType, "bytea") || StringUtils.containsIgnoreCase(fieldType, "blob") || StringUtils.containsIgnoreCase(fieldType, "binary")) {
-                        map.put(fieldName, null);
-                    } else {
+                        map.put(fieldName, new byte[0]);
+                    }
+                    else {
                         map.put(fieldName, feature.GetFieldAsString(i));
                     }
                 } else {
@@ -777,7 +798,6 @@ public class CadastreManageServiceImpl implements CadastreManageService {
     }
 
 
-
     /**
      * 校验当前图层坐标系是否为:CGCS2000
      *

+ 5 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/DealExcelServiceImpl.java

@@ -973,7 +973,7 @@ public class DealExcelServiceImpl {
         nodeAttachmentService.addDefaultAttachment(projectId, nodeId,gdType);
         String fullFilePath ="";
         String innerDirName = getDealFilePath(projectFileName);//找到当前文件
-        if (StringUtils.isNotBlank(fullFilePath)) {
+        if (StringUtils.isNotBlank(innerDirName)) {
             fullFilePath = copyFileToDirectory(rootPathAll +"\\" + innerDirName + "\\" + projectFileName, targectDir + "\\" + projectFileName, nodeFileName);
         }
         if (StringUtils.isNotBlank(fullFilePath)) {
@@ -998,7 +998,8 @@ public class DealExcelServiceImpl {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            //e.printStackTrace();
+            log.warn("查找文件{}时发生异常: {}", projectFileName, e.getMessage());
             return "";
         }
         return fullFilePath;
@@ -1065,7 +1066,8 @@ public class DealExcelServiceImpl {
             fullTargetFilePath = Paths.get(targetDirectoryPath, FileName).toString();
 
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            log.error("文件复制失败:source={}, node={}, 原因={}", sourceFilePath, FileName, e.getMessage());
+            return "";
         }
 
         return fullTargetFilePath;