|
@@ -39,6 +39,8 @@ import org.springframework.util.concurrent.ListenableFuture;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
@@ -487,9 +489,25 @@ public class GisSurveyThirdImporter {
|
|
|
String templateName = propertyTemplate.getName();
|
|
|
//获取值
|
|
|
String value = data.get(templateName);
|
|
|
- //构建dto,并将值长度64截断
|
|
|
- if (StringUtils.isNotBlank(value)) return new GisSurveyPropertyValueThirdCopy(params.getJobId()
|
|
|
- , layerApply.getCode(), propertyTemplate.getKey(), StringUtils.substring(value, 0, 64));
|
|
|
+ //构建dto
|
|
|
+ if (StringUtils.isNotBlank(value)) {
|
|
|
+ //double按数字处理,否则按字符串处理
|
|
|
+ if (propertyTemplate.getType().equals(GisSurveyExcelDefine.DATA_TYPE.DOUBLE)
|
|
|
+ && NumberUtils.isParsable(value)
|
|
|
+ && propertyTemplate.getPrecisions() != null) {
|
|
|
+ //值按精度设置小数位,并抹去0
|
|
|
+ value = new BigDecimal(value)
|
|
|
+ .setScale(propertyTemplate.getPrecisions(), RoundingMode.HALF_UP)
|
|
|
+ .stripTrailingZeros()
|
|
|
+ .toPlainString();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //值长度64截断
|
|
|
+ value = StringUtils.substring(value, 0, 64);
|
|
|
+ }
|
|
|
+ return new GisSurveyPropertyValueThirdCopy(params.getJobId()
|
|
|
+ , layerApply.getCode(), propertyTemplate.getKey(), value);
|
|
|
+ }
|
|
|
|
|
|
return null;
|
|
|
}
|