Sfoglia il codice sorgente

增加字符串超长截断

欧阳劲驰 2 mesi fa
parent
commit
8fc31bd786

+ 4 - 3
src/main/java/com/shkpr/service/alambizplugin/components/GisSurveyThirdImporter.java

@@ -396,8 +396,8 @@ public class GisSurveyThirdImporter {
         String depthStr = point.get(GisSurveyImportDefine.POINT.DEPTH);
         if (NumberUtils.isParsable(depthStr))
             layerApply.setDepth(Double.parseDouble(depthStr));
-        //点号
-        layerApply.setNo(point.get(GisSurveyImportDefine.POINT.NO));
+        //点号(长度64截断)
+        layerApply.setNo(StringUtils.substring(point.get(GisSurveyImportDefine.POINT.NO), 0, 64));
         //遍历属性模版
         List<GisSurveyPropertyValueThirdCopy> propertyValueList = new ArrayList<>();
         for (GisMetadataPropertyTemplate propertyTemplate : layerTemplate.getPropertyTemplates()) {
@@ -483,8 +483,9 @@ public class GisSurveyThirdImporter {
             }
         //获取值
         String value = data.get(templateName);
+        //构建dto,并将值长度64截断
         if (StringUtils.isNotBlank(value)) return new GisSurveyPropertyValueThirdCopy(params.getJobId()
-                , layerApply.getCode(), propertyTemplate.getKey(), value);
+                , layerApply.getCode(), propertyTemplate.getKey(), StringUtils.substring(value, 0, 64));
 
         return null;
     }

+ 3 - 5
src/main/java/com/shkpr/service/alambizplugin/components/checker/InvalidPropertiesFinder.java

@@ -219,16 +219,14 @@ public class InvalidPropertiesFinder {
                         templateName,
                         layerType
                 ));
-            else if ((propertyTemplate.getType().equals("float") || propertyTemplate.getType().equals("int"))
+            else if ((GisSurveyImportDefine.DATA_TYPE.INT.equals(propertyTemplate.getType()) ||
+                    GisSurveyImportDefine.DATA_TYPE.FLOAT.equals(propertyTemplate.getType()))
                     && !NumberUtils.isParsable(data.get(templateName)))
-                //存在且类型为数字则判断数字类型
+                //存在且类型为数字,则判断数字类型
                 invalidTypesResult.add(GisSurveyThirdImportElement.create(data,
                         data.get(templateName),
                         layerType
                 ));
         }
-
     }
-
-
 }

+ 8 - 0
src/main/java/com/shkpr/service/alambizplugin/constants/GisSurveyImportDefine.java

@@ -48,6 +48,14 @@ public interface GisSurveyImportDefine {
     }
 
     /**
+     * 数据类型
+     */
+    interface DATA_TYPE {
+        String FLOAT = "float";
+        String INT = "int";
+    }
+
+    /**
      * 入库默认值
      */
     interface DEFAULT_VALUE {

+ 3 - 3
src/main/java/com/shkpr/service/alambizplugin/controller/ApiGisSurveyController.java

@@ -235,7 +235,7 @@ public class ApiGisSurveyController {
         final String URI_PATH = request.getRequestURI();
         final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
         final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
-        if (StringUtils.isAnyBlank(operator, jobId, nature) || CollectionUtils.isEmpty(files)) {
+        if (StringUtils.isAnyBlank(operator, jobId, nature) || StringUtils.length(jobId) > 64 || CollectionUtils.isEmpty(files)) {
             throw new SelfException(ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrCode()
                     , String.format(ApiURI.EXCEPTION_FORMAT
                     , strPlatform
@@ -309,7 +309,7 @@ public class ApiGisSurveyController {
         final String URI_PATH = request.getRequestURI();
         final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
         final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
-        if (StringUtils.isBlank(jobId)) {
+        if (StringUtils.isBlank(jobId) || StringUtils.length(jobId) > 64) {
             throw new SelfException(ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrCode()
                     , String.format(ApiURI.EXCEPTION_FORMAT
                     , strPlatform
@@ -373,7 +373,7 @@ public class ApiGisSurveyController {
         final String URI_PATH = request.getRequestURI();
         final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
         final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
-        if (StringUtils.isBlank(jobId)) {
+        if (StringUtils.isBlank(jobId) || StringUtils.length(jobId) > 64) {
             throw new SelfException(ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrCode()
                     , String.format(ApiURI.EXCEPTION_FORMAT
                     , strPlatform

+ 0 - 1
src/main/java/com/shkpr/service/alambizplugin/dbdao/services/GisSurveyLayerApplyServiceImpl.java

@@ -276,7 +276,6 @@ public class GisSurveyLayerApplyServiceImpl implements GisSurveyLayerApplyServic
 
                 //更新刷新时间
                 long timestamp = System.currentTimeMillis();
-                System.out.println(timestamp);
                 projectInfoMapper.updateRefreshTimeByUid(jobId, timestamp);
                 jobInfoMapper.updateRefreshTimeByUid(jobId, timestamp);