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 index e499d789e..e8a43efdb 100644 --- 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 @@ -10,5 +10,6 @@ class Temp { if (val == 1.0) { println(true) } + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy index 36e9e588f..5d676e7c9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy @@ -96,11 +96,13 @@ class AroundExportByNewWay { Map map = new HashedMap() Integer key = 1; def ret = [] + AtomicInteger totalCount = new AtomicInteger() for (List district : data) { def district_code = district.get(2) def name = district.get(3) if (com.fangjia.script.coredata.util.CollectionUtils.isNotEmpty(resultMap.get(district_code + name))) { + totalCount.incrementAndGet() List currRet = resultMap.get(district_code + name) Collections.sort(currRet) ret.addAll(currRet) @@ -116,6 +118,7 @@ class AroundExportByNewWay { //FileUtils.batchCreateFile(map.get(k), "F:\\数据\\重庆农商行\\周边配套"+ k + ".dat", headArr, "utf-8") EasyExcel.write("F:\\数据\\重庆农商行\\周边配套(文件"+ k + ")V1.xlsx").head(head).sheet("周边配套").doWrite(map.get(k)); } + print(totalCount.get() + " " + (totalCount.get() / data.size())) printUnMatched(unMatchedMap) executorService.shutdown() } @@ -154,19 +157,28 @@ class AroundExportByNewWay { com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套未匹配.xlsx", ret, "周边配套"); } - static String formatType(String type) { - if (type.startsWith("09")) { - return "医院"; - } else if (type.startsWith('1505')) { - return "地铁"; - } else if (type.startsWith('1507')) { - return "公交"; - } else if (type.startsWith("16")) { - return "银行"; - } else if (type.startsWith("14")) { - return "学校"; - } else if (type.startsWith("06")) { - return "商场" + static String formatType(String typeStr) { + def types = [] + if (typeStr.indexOf("|") > -1) { + types = typeStr.split("\\|") + } else { + types =[typeStr] } + for (def type : types) { + if (type.startsWith("09")) { + return "医院"; + } else if (type.startsWith('1505')) { + return "地铁"; + } else if (type.startsWith('1507')) { + return "公交"; + } else if (type.startsWith("16")) { + return "银行"; + } else if (type.startsWith("14")) { + return "学校"; + } else if (type.startsWith("06")) { + return "商场" + } + } + return "未知" } } 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 f910ce590..793ff7840 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 @@ -89,16 +89,7 @@ class SeaweedExport { ret[1] = obj.estate_company ret[2] = SeaweedUtils.formatCubagePercent(obj.cubage_percent) ret[3] = SeaweedUtils.formatVirescencePercent(obj.virescence_percent) - - if (obj.alias) { - // 小区可能存在多个别名 - def temp = [] - for (def a : obj.alias) { - temp.add(a) - } - String als = temp.join(",") - ret[4] = als.length() > 20 ? "" : als - } + ret[4] = SeaweedUtils.formatAlias(obj.alias) ret[5] = SeaweedUtils.formatCarSiteCount(obj.car_site_count) ret[6] = SeaweedUtils.calcCarAndHouseholdRadio(obj.car_site_count, obj.household_count) ret[7] = "" 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 46d7d1f0d..2cb9a61b2 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 @@ -155,4 +155,29 @@ class SeaweedUtils { } return "" } + + /** + * 标准化别名输出 + */ + static formatAlias(def alias) { + if (alias) { + // 小区可能存在多个别名 + def temp = [] + int len = 0 + for (def a : alias) { + len += a.toString().length() + if (len > 20) { + return temp.join(",") + } + temp.add(a) + } + return temp.join(",") + } + return "" + } + + static void main(String[] args) { + def alias = ["金杏一村","金杏一村","金杏一村","金杏一村","金杏一村", "金杏二村"] + println(formatAlias(alias)) + } }