新增绿化率、容积率格式话工具类
This commit is contained in:
+70
@@ -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 ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user