From b4c7f8ff1a9824291bdd3d20aa2c019f323d233f Mon Sep 17 00:00:00 2001 From: sjshenjian Date: Mon, 17 May 2021 21:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=BF=E5=8C=96=E7=8E=87?= =?UTF-8?q?=E3=80=81=E5=AE=B9=E7=A7=AF=E7=8E=87=E6=A0=BC=E5=BC=8F=E8=AF=9D?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/util/SeaweedUtils.groovy | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy index 2f93a62e2..22969a8c8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.temp.shenjian.util import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import org.apache.commons.lang.math.NumberUtils import java.util.concurrent.ConcurrentHashMap @@ -29,4 +30,73 @@ class SeaweedUtils { } return region } + + /** + * 标准化输出绿化率 + */ + static formatVirescencePercent(def virescence_percent) { + // 绿化率 + if (virescence_percent && NumberUtils.isDigits(virescence_percent)) { + double val = Double.valueOf(virescence_percent) + if (val < 1) { + return val * 100 + } + if (virescence_percent == 1) { + return virescence_percent * 10 + } + if (virescence_percent >= 70) { + return 65 + } + return virescence_percent + } + return "" + } + + /** + * 标准化绿化率输出 + */ + static formatCubagePercent(def cubage_percent) { + if (cubage_percent && NumberUtils.isDigits(cubage_percent)) { + double val = Double.valueOf(cubage_percent) + if (val >= 7 && val < 8) { + return 6.2 + } + if (val >= 8 && val < 9) { + return 6.3 + } + if (val >= 9 && val < 10) { + return 6.5 + } + if (cubage_percent && val >= 10) { + return 6.7 + } + } + return "" + } + + /** + * 标准化车位输出 + */ + static formatCarSiteCount(def car_site_count) { + if (car_site_count && NumberUtils.isDigits(car_site_count)) { + long val = Long.valueOf("car_site_count") + if (val > 2000 || val < 100) { + return "" + } + } + return "" + } + + /** + * 标准化建筑面积输出 + */ + static formatBuildArea(def build_area) { + if (build_area && NumberUtils.isDigits(build_area)) { + double val = build_area + if (val > 1000) { + return val + } + } + return "" + } }