diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/Temp.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/Temp.groovy new file mode 100644 index 000000000..e499d789e --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/Temp.groovy @@ -0,0 +1,14 @@ +package com.fangjia.script.temp.shenjian + +/** + * @author shenjian* @since 2021/5/18 + */ +class Temp { + + static void main(String[] args) { + double val = 1.0 + if (val == 1.0) { + println(true) + } + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy index 5deadb989..2c5f787b2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy @@ -65,6 +65,7 @@ class POIRule { //db.getCollection('gaode_address_poi').update({'name': /摄影/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); //db.getCollection('gaode_address_poi').update({'typecode': '141204', 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); //db.getCollection('gaode_address_poi').update({'typecode': /1412/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); -// +//db.getCollection('gaode_address_poi').update({'type': /专科医院/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); //db.getCollection('gaode_address_poi').update({'name': '西南大学'}, {$set: {'status': NumberInt(0)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /诊所/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy index 66703a1f0..f910ce590 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.temp.shenjian.cqrcb import com.fangjia.core.util.DateUtil import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.datastore.FieldValidatorUtils +import com.fangjia.script.temp.shenjian.util.SeaweedUtils import com.fangjia.script.util.DbUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils @@ -86,8 +87,8 @@ class SeaweedExport { DbUtils.seaweed.find(query).limit(1).each { obj -> ret[0] = obj.developer ret[1] = obj.estate_company - ret[2] = obj.cubage_percent - ret[3] = virescencePercentValidator(obj.virescence_percent) + ret[2] = SeaweedUtils.formatCubagePercent(obj.cubage_percent) + ret[3] = SeaweedUtils.formatVirescencePercent(obj.virescence_percent) if (obj.alias) { // 小区可能存在多个别名 @@ -98,22 +99,12 @@ class SeaweedExport { String als = temp.join(",") ret[4] = als.length() > 20 ? "" : als } - ret[5] = obj.car_site_count - if (com.fangjia.script.datastore.FieldValidatorUtils.householdCountValidator(obj.household_count) - && FieldValidatorUtils.carSiteValidator(obj.car_site_count)) { - double val = DataHandleUtils.getDoubleRound(1, (Double.valueOf(obj.car_site_count) / Double.valueOf(obj.household_count))) - if (val == 0.0) { - val = DataHandleUtils.getDoubleRound(2, (Double.valueOf(obj.car_site_count) / Double.valueOf(obj.household_count))) - } - if (val == 0.0) { - val = DataHandleUtils.getDoubleRound(3, (Double.valueOf(obj.car_site_count) / Double.valueOf(obj.household_count))) - } - ret[6] = "1:" + val - } + ret[5] = SeaweedUtils.formatCarSiteCount(obj.car_site_count) + ret[6] = SeaweedUtils.calcCarAndHouseholdRadio(obj.car_site_count, obj.household_count) ret[7] = "" - ret[8] = obj.all_area + ret[8] = SeaweedUtils.formatAllArea(obj.all_area) ret[9] = obj.loudong_count - ret[10] = obj.household_count + ret[10] = SeaweedUtils.formatHouseholdCount(obj.household_count) ret[11] = "" ret[12] = obj.estate_charge ret[13] = DateUtil.formatToYYYYMMDD(obj.open_date) @@ -133,37 +124,13 @@ class SeaweedExport { }; latch.await(); def ret = []; - ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"] + ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"]; for (List district : data) { def district_code = district.get(2) def name = district.get(3) ret << resultMap.get(district_code + name) - } - com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\开发商物业公司.xlsx", ret, "项目统计"); + }; + com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\开发商及物业信息.xlsx", ret, "开发商及物业信息"); executorService.shutdown() } - - /** - * string - * 绿化率 仅限数字,包括(小数)数字范围:10-100 - * @param virescence_percent - * @return - */ - private static def virescencePercentValidator(def virescence_percent){ - if(virescence_percent=="null"){ - return ""; - } - def value = com.fangjia.script.datastore.DistrictFieldNumberic.checkValue(virescence_percent); - if(value){ - if(value>=10 && value<=100){ - return com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, Double.valueOf(value)) - } else if (value > 0 && value < 1) { - return com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, Double.valueOf(value) * 100) - } else{ - return ""; - } - } - return ""; - } - } 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 22969a8c8..46d7d1f0d 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 @@ -1,9 +1,10 @@ package com.fangjia.script.temp.shenjian.util +import com.fangjia.script.common.DataHandleUtils +import com.fangjia.script.datastore.FieldValidatorUtils 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 @@ -30,33 +31,33 @@ class SeaweedUtils { } return region } - + /** * 标准化输出绿化率 */ static formatVirescencePercent(def virescence_percent) { // 绿化率 - if (virescence_percent && NumberUtils.isDigits(virescence_percent)) { + if (virescence_percent && FieldValidatorUtils.checkValue(virescence_percent)) { double val = Double.valueOf(virescence_percent) if (val < 1) { return val * 100 } - if (virescence_percent == 1) { - return virescence_percent * 10 + if (val == 1) { + return val * 10 } - if (virescence_percent >= 70) { + if (val >= 70) { return 65 } - return virescence_percent + return val } return "" } /** - * 标准化绿化率输出 + * 标准化容积率输出 */ static formatCubagePercent(def cubage_percent) { - if (cubage_percent && NumberUtils.isDigits(cubage_percent)) { + if (cubage_percent && FieldValidatorUtils.checkValue(cubage_percent)) { double val = Double.valueOf(cubage_percent) if (val >= 7 && val < 8) { return 6.2 @@ -67,9 +68,10 @@ class SeaweedUtils { if (val >= 9 && val < 10) { return 6.5 } - if (cubage_percent && val >= 10) { + if (val >= 10) { return 6.7 } + return val } return "" } @@ -78,11 +80,12 @@ class SeaweedUtils { * 标准化车位输出 */ static formatCarSiteCount(def car_site_count) { - if (car_site_count && NumberUtils.isDigits(car_site_count)) { - long val = Long.valueOf("car_site_count") + if (car_site_count && FieldValidatorUtils.checkValue(car_site_count)) { + long val = Long.valueOf(car_site_count) if (val > 2000 || val < 100) { return "" } + return val; } return "" } @@ -91,7 +94,7 @@ class SeaweedUtils { * 标准化建筑面积输出 */ static formatBuildArea(def build_area) { - if (build_area && NumberUtils.isDigits(build_area)) { + if (build_area && FieldValidatorUtils.checkValue(build_area)) { double val = build_area if (val > 1000) { return val @@ -99,4 +102,57 @@ class SeaweedUtils { } return "" } + + /** + * 标准化总占地面积输出 + */ + static formatAllArea(def all_area) { + if (all_area) { + Double formattedVal = 0.0; + if (all_area.toString().indexOf("公顷") != -1) { + def val = all_area.toString() + formattedVal = (Double.valueOf(val.substring(0, val.indexOf("公顷"))) * 10000) + } else if(FieldValidatorUtils.checkValue(all_area)) { + formattedVal = Double.valueOf(all_area) + } + if (formattedVal > 100000 || formattedVal == 0.0) { + return "" + } + return formattedVal + } + } + + /** + * 标准化户数输出 + */ + static formatHouseholdCount(def household_count) { + if (household_count && FieldValidatorUtils.checkValue(household_count) ) { + if (Long.valueOf(household_count) < 50) { + return "" // 户数 + } + return household_count + } + } + + /** + * 计算车位比 + */ + static calcCarAndHouseholdRadio(def car_site_count, def household_count) { + if (SeaweedUtils.formatCarSiteCount(car_site_count) && SeaweedUtils.formatHouseholdCount(household_count)) { + long formattedCarSiteCount = SeaweedUtils.formatCarSiteCount(car_site_count) + long formattedHouseholdCount = SeaweedUtils.formatHouseholdCount(household_count) + double val = DataHandleUtils.getDoubleRound(1, (Double.valueOf(formattedCarSiteCount) / Double.valueOf(formattedHouseholdCount))) + if (val == 0.0) { + val = DataHandleUtils.getDoubleRound(2, (Double.valueOf(formattedCarSiteCount) / Double.valueOf(formattedHouseholdCount))) + } + if (val == 0.0) { + val = DataHandleUtils.getDoubleRound(3, (Double.valueOf(formattedCarSiteCount) / Double.valueOf(formattedHouseholdCount))) + } + if (val == 1.0) { + return "1:1" + } + return "1:" + val + } + return "" + } }