优化类型判断
This commit is contained in:
@@ -10,5 +10,6 @@ class Temp {
|
|||||||
if (val == 1.0) {
|
if (val == 1.0) {
|
||||||
println(true)
|
println(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-13
@@ -96,11 +96,13 @@ class AroundExportByNewWay {
|
|||||||
Map<Integer, List> map = new HashedMap()
|
Map<Integer, List> map = new HashedMap()
|
||||||
Integer key = 1;
|
Integer key = 1;
|
||||||
def ret = []
|
def ret = []
|
||||||
|
AtomicInteger totalCount = new AtomicInteger()
|
||||||
for (List<Object> district : data) {
|
for (List<Object> district : data) {
|
||||||
|
|
||||||
def district_code = district.get(2)
|
def district_code = district.get(2)
|
||||||
def name = district.get(3)
|
def name = district.get(3)
|
||||||
if (com.fangjia.script.coredata.util.CollectionUtils.isNotEmpty(resultMap.get(district_code + name))) {
|
if (com.fangjia.script.coredata.util.CollectionUtils.isNotEmpty(resultMap.get(district_code + name))) {
|
||||||
|
totalCount.incrementAndGet()
|
||||||
List currRet = resultMap.get(district_code + name)
|
List currRet = resultMap.get(district_code + name)
|
||||||
Collections.sort(currRet)
|
Collections.sort(currRet)
|
||||||
ret.addAll(currRet)
|
ret.addAll(currRet)
|
||||||
@@ -116,6 +118,7 @@ class AroundExportByNewWay {
|
|||||||
//FileUtils.batchCreateFile(map.get(k), "F:\\数据\\重庆农商行\\周边配套"+ k + ".dat", headArr, "utf-8")
|
//FileUtils.batchCreateFile(map.get(k), "F:\\数据\\重庆农商行\\周边配套"+ k + ".dat", headArr, "utf-8")
|
||||||
EasyExcel.write("F:\\数据\\重庆农商行\\周边配套(文件"+ k + ")V1.xlsx").head(head).sheet("周边配套").doWrite(map.get(k));
|
EasyExcel.write("F:\\数据\\重庆农商行\\周边配套(文件"+ k + ")V1.xlsx").head(head).sheet("周边配套").doWrite(map.get(k));
|
||||||
}
|
}
|
||||||
|
print(totalCount.get() + " " + (totalCount.get() / data.size()))
|
||||||
printUnMatched(unMatchedMap)
|
printUnMatched(unMatchedMap)
|
||||||
executorService.shutdown()
|
executorService.shutdown()
|
||||||
}
|
}
|
||||||
@@ -154,19 +157,28 @@ class AroundExportByNewWay {
|
|||||||
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套未匹配.xlsx", ret, "周边配套");
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套未匹配.xlsx", ret, "周边配套");
|
||||||
}
|
}
|
||||||
|
|
||||||
static String formatType(String type) {
|
static String formatType(String typeStr) {
|
||||||
if (type.startsWith("09")) {
|
def types = []
|
||||||
return "医院";
|
if (typeStr.indexOf("|") > -1) {
|
||||||
} else if (type.startsWith('1505')) {
|
types = typeStr.split("\\|")
|
||||||
return "地铁";
|
} else {
|
||||||
} else if (type.startsWith('1507')) {
|
types =[typeStr]
|
||||||
return "公交";
|
|
||||||
} else if (type.startsWith("16")) {
|
|
||||||
return "银行";
|
|
||||||
} else if (type.startsWith("14")) {
|
|
||||||
return "学校";
|
|
||||||
} else if (type.startsWith("06")) {
|
|
||||||
return "商场"
|
|
||||||
}
|
}
|
||||||
|
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 "未知"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-10
@@ -89,16 +89,7 @@ class SeaweedExport {
|
|||||||
ret[1] = obj.estate_company
|
ret[1] = obj.estate_company
|
||||||
ret[2] = SeaweedUtils.formatCubagePercent(obj.cubage_percent)
|
ret[2] = SeaweedUtils.formatCubagePercent(obj.cubage_percent)
|
||||||
ret[3] = SeaweedUtils.formatVirescencePercent(obj.virescence_percent)
|
ret[3] = SeaweedUtils.formatVirescencePercent(obj.virescence_percent)
|
||||||
|
ret[4] = SeaweedUtils.formatAlias(obj.alias)
|
||||||
if (obj.alias) {
|
|
||||||
// 小区可能存在多个别名
|
|
||||||
def temp = []
|
|
||||||
for (def a : obj.alias) {
|
|
||||||
temp.add(a)
|
|
||||||
}
|
|
||||||
String als = temp.join(",")
|
|
||||||
ret[4] = als.length() > 20 ? "" : als
|
|
||||||
}
|
|
||||||
ret[5] = SeaweedUtils.formatCarSiteCount(obj.car_site_count)
|
ret[5] = SeaweedUtils.formatCarSiteCount(obj.car_site_count)
|
||||||
ret[6] = SeaweedUtils.calcCarAndHouseholdRadio(obj.car_site_count, obj.household_count)
|
ret[6] = SeaweedUtils.calcCarAndHouseholdRadio(obj.car_site_count, obj.household_count)
|
||||||
ret[7] = ""
|
ret[7] = ""
|
||||||
|
|||||||
+25
@@ -155,4 +155,29 @@ class SeaweedUtils {
|
|||||||
}
|
}
|
||||||
return ""
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user