修改代码字符编码
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>fangjia-core</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>GBK</project.build.sourceEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>fangjia-core</finalName>
|
||||
@@ -19,7 +19,7 @@
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
<encoding>GBK</encoding>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BaseConfiguration extends ConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在开发环境中运行
|
||||
* 是否在开发环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ public class BaseConfiguration extends ConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在测试环境中运行
|
||||
* 是否在测试环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public class BaseConfiguration extends ConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在生产环境中运行
|
||||
* 是否在生产环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ public class BaseConfiguration extends ConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否禁用cache,默认为true
|
||||
* 判断是否禁用cache,默认为true
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ public class BaseConfiguration extends ConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否禁用本地缓存cache,默认为true
|
||||
* 判断是否禁用本地缓存cache,默认为true
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -128,14 +128,14 @@ public class BlockData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据别名匹配板块
|
||||
* 根据别名匹配板块
|
||||
*/
|
||||
private static String format(Map<String, List<String>> regionBlockMap, String block) {
|
||||
if (regionBlockMap.containsKey(block)) {
|
||||
return block;
|
||||
}
|
||||
|
||||
// 遍历所有板块的别名
|
||||
// 遍历所有板块的别名
|
||||
Set<String> nameSet = regionBlockMap.keySet();
|
||||
for (String key : nameSet) {
|
||||
List<String> alias = regionBlockMap.get(key);
|
||||
@@ -151,7 +151,7 @@ public class BlockData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.print(formatBlock("上海", "宝山", "高境"));
|
||||
System.out.print(formatBlock("上海", "宝山", "高境"));
|
||||
}
|
||||
|
||||
public static Map<String, Map<String, List<String>>> getAllBlocks(String city) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在开发环境中运行
|
||||
* 是否在开发环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在测试环境中运行
|
||||
* 是否在测试环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在生产环境中运行
|
||||
* 是否在生产环境中运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类可以重写这个方法,如果需要做一些自定义的操作
|
||||
* 子类可以重写这个方法,如果需要做一些自定义的操作
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
@@ -136,7 +136,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否禁用cache,默认为true
|
||||
* 判断是否禁用cache,默认为true
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -145,7 +145,7 @@ public class Configuration extends PropertiesConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否禁用本地缓存cache,默认为true
|
||||
* 判断是否禁用本地缓存cache,默认为true
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.fangjia.core;
|
||||
|
||||
/**
|
||||
* CPC房源类型,移植自goojia
|
||||
* CPC房源类型,移植自goojia
|
||||
*
|
||||
* @author yukai
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.fangjia.core;
|
||||
|
||||
public enum DistrictKindEnum {
|
||||
gongyu("公寓", "小区"), bieshu("别墅", "别墅"), shangpu("商铺", "商铺"), xiezilou("写字楼", "写字楼"), all("公寓,别墅", "小区,别墅");
|
||||
gongyu("公寓", "小区"), bieshu("别墅", "别墅"), shangpu("商铺", "商铺"), xiezilou("写字楼", "写字楼"), all("公寓,别墅", "小区,别墅");
|
||||
|
||||
private final String display;
|
||||
private final String value;
|
||||
@@ -12,7 +12,7 @@ public enum DistrictKindEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据display获取对应的value
|
||||
* 根据display获取对应的value
|
||||
*
|
||||
* @param display
|
||||
* @return
|
||||
@@ -28,7 +28,7 @@ public enum DistrictKindEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于显示
|
||||
* 用于显示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public enum DistrictKindEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于查询
|
||||
* 用于查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* 全国省份简称 全称数据
|
||||
* 全国省份简称 全称数据
|
||||
* @author wenyan
|
||||
*/
|
||||
public class ProvinceData {
|
||||
@@ -18,64 +18,64 @@ public class ProvinceData {
|
||||
final static Logger logger = Logger.getLogger(ProvinceData.class);
|
||||
|
||||
static final Map<String, List<String>> data = new HashMap<String, List<String>>() {{
|
||||
put("河北", Arrays.asList(new String[]{"河北省", "冀"}));
|
||||
put("河南", Arrays.asList(new String[]{"河南省", "豫"}));
|
||||
put("云南", Arrays.asList(new String[]{"云南省", "滇"}));
|
||||
put("辽宁", Arrays.asList(new String[]{"辽宁省", "辽"}));
|
||||
put("黑龙江", Arrays.asList(new String[]{"黑龙江省", "黑"}));
|
||||
put("湖南", Arrays.asList(new String[]{"湖南省", "湘"}));
|
||||
put("湖北", Arrays.asList(new String[]{"湖北省", "鄂"}));
|
||||
put("安徽", Arrays.asList(new String[]{"安徽省", "皖"}));
|
||||
put("山东", Arrays.asList(new String[]{"山东省", "鲁"}));
|
||||
put("新疆", Arrays.asList(new String[]{"新疆维吾尔自治区", "新疆省","新"}));
|
||||
put("江苏", Arrays.asList(new String[]{"江苏省", "苏"}));
|
||||
put("浙江", Arrays.asList(new String[]{"浙江省", "浙"}));
|
||||
put("江西", Arrays.asList(new String[]{"江西省", "赣"}));
|
||||
put("广西", Arrays.asList(new String[]{"广西省","广西壮族自治区", "桂"}));
|
||||
put("甘肃", Arrays.asList(new String[]{"甘肃省", "甘"}));
|
||||
put("山西", Arrays.asList(new String[]{"山西省", "晋"}));
|
||||
put("内蒙古", Arrays.asList(new String[]{"内蒙古自治区", "内蒙古省","蒙"}));
|
||||
put("陕西", Arrays.asList(new String[]{"陕西省", "陜西", "陜西省", "陕"}));
|
||||
put("吉林", Arrays.asList(new String[]{"吉林省", "吉"}));
|
||||
put("福建", Arrays.asList(new String[]{"福建省", "褔建省", "闽"}));
|
||||
put("贵州", Arrays.asList(new String[]{"贵州省", "黔"}));
|
||||
put("广东", Arrays.asList(new String[]{"广东省", "粤"}));
|
||||
put("青海", Arrays.asList(new String[]{"青海省", "青"}));
|
||||
put("西藏", Arrays.asList(new String[]{"西藏自治区", "藏"}));
|
||||
put("四川", Arrays.asList(new String[]{"四川省", "川"}));
|
||||
put("宁夏", Arrays.asList(new String[]{"宁夏回族自治区", "宁夏省", "宁"}));
|
||||
put("海南", Arrays.asList(new String[]{"海南省", "琼"}));
|
||||
put("台湾", Arrays.asList(new String[]{"台湾省", "台"}));
|
||||
put("河北", Arrays.asList(new String[]{"河北省", "冀"}));
|
||||
put("河南", Arrays.asList(new String[]{"河南省", "豫"}));
|
||||
put("云南", Arrays.asList(new String[]{"云南省", "滇"}));
|
||||
put("辽宁", Arrays.asList(new String[]{"辽宁省", "辽"}));
|
||||
put("黑龙江", Arrays.asList(new String[]{"黑龙江省", "黑"}));
|
||||
put("湖南", Arrays.asList(new String[]{"湖南省", "湘"}));
|
||||
put("湖北", Arrays.asList(new String[]{"湖北省", "鄂"}));
|
||||
put("安徽", Arrays.asList(new String[]{"安徽省", "皖"}));
|
||||
put("山东", Arrays.asList(new String[]{"山东省", "鲁"}));
|
||||
put("新疆", Arrays.asList(new String[]{"新疆维吾尔自治区", "新疆省","新"}));
|
||||
put("江苏", Arrays.asList(new String[]{"江苏省", "苏"}));
|
||||
put("浙江", Arrays.asList(new String[]{"浙江省", "浙"}));
|
||||
put("江西", Arrays.asList(new String[]{"江西省", "赣"}));
|
||||
put("广西", Arrays.asList(new String[]{"广西省","广西壮族自治区", "桂"}));
|
||||
put("甘肃", Arrays.asList(new String[]{"甘肃省", "甘"}));
|
||||
put("山西", Arrays.asList(new String[]{"山西省", "晋"}));
|
||||
put("内蒙古", Arrays.asList(new String[]{"内蒙古自治区", "内蒙古省","蒙"}));
|
||||
put("陕西", Arrays.asList(new String[]{"陕西省", "陜西", "陜西省", "陕"}));
|
||||
put("吉林", Arrays.asList(new String[]{"吉林省", "吉"}));
|
||||
put("福建", Arrays.asList(new String[]{"福建省", "褔建省", "闽"}));
|
||||
put("贵州", Arrays.asList(new String[]{"贵州省", "黔"}));
|
||||
put("广东", Arrays.asList(new String[]{"广东省", "粤"}));
|
||||
put("青海", Arrays.asList(new String[]{"青海省", "青"}));
|
||||
put("西藏", Arrays.asList(new String[]{"西藏自治区", "藏"}));
|
||||
put("四川", Arrays.asList(new String[]{"四川省", "川"}));
|
||||
put("宁夏", Arrays.asList(new String[]{"宁夏回族自治区", "宁夏省", "宁"}));
|
||||
put("海南", Arrays.asList(new String[]{"海南省", "琼"}));
|
||||
put("台湾", Arrays.asList(new String[]{"台湾省", "台"}));
|
||||
|
||||
}};
|
||||
|
||||
static final Map<String, List<String>> GOVERNMENT_CITY_LIST = new HashMap<String, List<String>>(){{
|
||||
put("上海", Arrays.asList(new String[]{"上海市", "沪"}));
|
||||
put("北京", Arrays.asList(new String[]{"北京市", "京"}));
|
||||
put("天津", Arrays.asList(new String[]{"天津市", "津"}));
|
||||
put("重庆", Arrays.asList(new String[]{"重庆市", "渝"}));
|
||||
put("上海", Arrays.asList(new String[]{"上海市", "沪"}));
|
||||
put("北京", Arrays.asList(new String[]{"北京市", "京"}));
|
||||
put("天津", Arrays.asList(new String[]{"天津市", "津"}));
|
||||
put("重庆", Arrays.asList(new String[]{"重庆市", "渝"}));
|
||||
}};
|
||||
|
||||
static final Map<String,List<String>> SPECIAL_ADMIN_REGION = new HashMap<String, List<String>>(){{
|
||||
put("香港",new ArrayList<String>() {{add("港");add("香港特别行政区");add("Hong Kong");add("HK");add("HKSAR");}});
|
||||
put("澳门",new ArrayList<String>() {{add("澳");add("澳门特别行政区");add("Macao");add("Macau");}});
|
||||
put("香港",new ArrayList<String>() {{add("港");add("香港特别行政区");add("Hong Kong");add("HK");add("HKSAR");}});
|
||||
put("澳门",new ArrayList<String>() {{add("澳");add("澳门特别行政区");add("Macao");add("Macau");}});
|
||||
}};
|
||||
|
||||
/**城市:省份*/
|
||||
/**城市:省份*/
|
||||
public static Map<String, String> CITY_PROVINCE_MAP = new HashMap<String, String>();
|
||||
static DBCollection SERVER_AREA = MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, "fangjia", "server_area");
|
||||
|
||||
static {
|
||||
logger.info("开始加载省份信息");
|
||||
logger.info("开始加载省份信息");
|
||||
DBCursor cursor = SERVER_AREA.find(new BasicDBObject(), new BasicDBObject("province", 1).append("display", 1)).batchSize(300);
|
||||
BasicDBObject dbo;
|
||||
while(cursor.hasNext()){
|
||||
dbo = (BasicDBObject)cursor.next();
|
||||
if(!"全国".equals(dbo.getString("display"))){
|
||||
if(!"全国".equals(dbo.getString("display"))){
|
||||
CITY_PROVINCE_MAP.put(dbo.getString("display"),dbo.getString("province"));
|
||||
}
|
||||
}
|
||||
logger.info("省份信息加载结束");
|
||||
logger.info("省份信息加载结束");
|
||||
}
|
||||
|
||||
private ProvinceData(){}
|
||||
@@ -93,7 +93,7 @@ public class ProvinceData {
|
||||
|
||||
|
||||
/**
|
||||
* 判断城市是不是直辖市
|
||||
* 判断城市是不是直辖市
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ public class ProvinceData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得城市所在的省份
|
||||
* 获得城市所在的省份
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
@@ -130,7 +130,7 @@ public class ProvinceData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省份下的所有城市
|
||||
* 获取省份下的所有城市
|
||||
* @param province
|
||||
* @return
|
||||
*/
|
||||
@@ -145,7 +145,7 @@ public class ProvinceData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的兄弟城市
|
||||
* 获取所有的兄弟城市
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
@@ -159,7 +159,7 @@ public class ProvinceData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取城市列表
|
||||
* 获取城市列表
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getAllCity(){
|
||||
|
||||
@@ -30,7 +30,7 @@ public class RegionData implements PriorityOrdered {
|
||||
private static Map<String,List<String>> cityAndAliasMap = new HashMap<String,List<String>>();
|
||||
|
||||
/**
|
||||
* 城市对应级别Map
|
||||
* 城市对应级别Map
|
||||
*/
|
||||
private static Map<String, Integer> cityGradeMap = new HashMap<String, Integer>();
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RegionData implements PriorityOrdered {
|
||||
BasicDBObject dbo;
|
||||
while(cursor.hasNext()){
|
||||
dbo = (BasicDBObject) cursor.next();
|
||||
if(!"全国".equals(dbo.getString("display"))){
|
||||
if(!"全国".equals(dbo.getString("display"))){
|
||||
ALL_CITY.add(dbo.getString("display"));
|
||||
cityGradeMap.put(dbo.getString("display"), dbo.getInt("city_grade"));
|
||||
Object object = dbo.get("alias");
|
||||
@@ -191,7 +191,7 @@ public class RegionData implements PriorityOrdered {
|
||||
try {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (nextScheduleHour == cal.get(Calendar.HOUR_OF_DAY)) {
|
||||
if(cal.get(Calendar.HOUR_OF_DAY) % 8 == 0) {//每8个小时执行一次
|
||||
if(cal.get(Calendar.HOUR_OF_DAY) % 8 == 0) {//每8个小时执行一次
|
||||
LOGGER.info("RegionData reload runing");
|
||||
RegionData.reload();
|
||||
LOGGER.info("RegionData reload success");
|
||||
@@ -356,14 +356,14 @@ public class RegionData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据别名匹配区域
|
||||
* 根据别名匹配区域
|
||||
*/
|
||||
private static String format(Map<String, List<String>> cityRegionMap, String region) {
|
||||
if (cityRegionMap.containsKey(region)) {
|
||||
return region;
|
||||
}
|
||||
|
||||
// 遍历所有区域的别名
|
||||
// 遍历所有区域的别名
|
||||
Set<String> nameSet = cityRegionMap.keySet();
|
||||
for (String key : nameSet) {
|
||||
List<String> alias = cityRegionMap.get(key);
|
||||
@@ -379,7 +379,7 @@ public class RegionData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化城市名称
|
||||
* 格式化城市名称
|
||||
* @param cityName
|
||||
* @return
|
||||
*/
|
||||
@@ -401,7 +401,7 @@ public class RegionData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个城市名称是否是一个标准的城市名称
|
||||
* 判断一个城市名称是否是一个标准的城市名称
|
||||
* @param cityName
|
||||
* @return
|
||||
*/
|
||||
@@ -442,7 +442,7 @@ public class RegionData implements PriorityOrdered {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从地址中解析城市
|
||||
* 从地址中解析城市
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
@@ -454,7 +454,7 @@ public class RegionData implements PriorityOrdered {
|
||||
Set<String> cities = RegionData.getAllCity();
|
||||
Map<String, Integer> cityScoreMap = new HashMap<String, Integer>();
|
||||
for (String city : cities) {
|
||||
if (address.contains(city + "市")) {
|
||||
if (address.contains(city + "市")) {
|
||||
if(cityScoreMap.containsKey(city)){
|
||||
cityScoreMap.put(city, cityScoreMap.get(city) + 1);
|
||||
}else{
|
||||
@@ -483,7 +483,7 @@ public class RegionData implements PriorityOrdered {
|
||||
List<String> cityAlias = RegionData.getCityAlias(city);
|
||||
if(cityAlias != null){
|
||||
for(String alia : cityAlias){
|
||||
if(alia != null && (alia.endsWith("市") || alia.endsWith("区") || alia.endsWith("县"))
|
||||
if(alia != null && (alia.endsWith("市") || alia.endsWith("区") || alia.endsWith("县"))
|
||||
&& address.contains(alia)){
|
||||
if(cityScoreMap.containsKey(city)){
|
||||
cityScoreMap.put(city, cityScoreMap.get(city) + 1);
|
||||
@@ -543,7 +543,7 @@ public class RegionData implements PriorityOrdered {
|
||||
}
|
||||
Map<String, List<String>> regionMap = RegionData.getAllRegions(city);
|
||||
for(String region : regionMap.keySet()){
|
||||
if(address.contains(region + "区") || address.contains(region + "县") || address.contains(region + "市")){
|
||||
if(address.contains(region + "区") || address.contains(region + "县") || address.contains(region + "市")){
|
||||
if(cityScoreMap.containsKey(city)){
|
||||
cityScoreMap.put(city, cityScoreMap.get(city) + 1);
|
||||
}else{
|
||||
|
||||
@@ -13,171 +13,171 @@ import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author ralphj
|
||||
* @deprecated 请使用com.fangjia.dal.mongo.fangjia.model.ServerArea
|
||||
* @deprecated 请使用com.fangjia.dal.mongo.fangjia.model.ServerArea
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated()
|
||||
public enum ServerAreaEnum {
|
||||
/**
|
||||
* 上海
|
||||
* 上海
|
||||
*/
|
||||
sh("上海", "shanghai", "021", 121.4759159000, 31.2243531000),
|
||||
sh("上海", "shanghai", "021", 121.4759159000, 31.2243531000),
|
||||
|
||||
/**
|
||||
* 上海
|
||||
* 上海
|
||||
*/
|
||||
bj("北京", "beijing", "010", false, true, 116.4071200000, 39.9063400000),
|
||||
bj("北京", "beijing", "010", false, true, 116.4071200000, 39.9063400000),
|
||||
|
||||
/**
|
||||
* 广州
|
||||
* 广州
|
||||
*/
|
||||
gz("广州", "guangzhou", "020", false, true, 113.2661500000, 23.1335800000),
|
||||
gz("广州", "guangzhou", "020", false, true, 113.2661500000, 23.1335800000),
|
||||
|
||||
/**
|
||||
* 杭州
|
||||
* 杭州
|
||||
*/
|
||||
hz("杭州", "hangzhou", "0571", false, false, 120.1557400000, 30.2730400000),
|
||||
hz("杭州", "hangzhou", "0571", false, false, 120.1557400000, 30.2730400000),
|
||||
|
||||
/**
|
||||
* 深圳
|
||||
* 深圳
|
||||
*/
|
||||
sz("深圳", "shenzhen", "0755", false, true, 114.07, 22.33),
|
||||
sz("深圳", "shenzhen", "0755", false, true, 114.07, 22.33),
|
||||
|
||||
/**
|
||||
* 扬州
|
||||
* 扬州
|
||||
*/
|
||||
yz("扬州", "yangzhou", "0514", false, false, 119.26, 32.23),
|
||||
yz("扬州", "yangzhou", "0514", false, false, 119.26, 32.23),
|
||||
|
||||
/**
|
||||
* 南京
|
||||
* 南京
|
||||
*/
|
||||
nj("南京", "nanjing", "025", false, true, 118.7963900000, 32.0583600000),
|
||||
nj("南京", "nanjing", "025", false, true, 118.7963900000, 32.0583600000),
|
||||
|
||||
/**
|
||||
* 天津
|
||||
* 天津
|
||||
*/
|
||||
tj("天津", "tianjin", "022", false, true, 117.2142500000, 39.1213000000),
|
||||
tj("天津", "tianjin", "022", false, true, 117.2142500000, 39.1213000000),
|
||||
|
||||
/**
|
||||
* 成都
|
||||
* 成都
|
||||
*/
|
||||
cd("成都", "chengdu", "028", false, true, 104.0646800000, 30.6585800000),
|
||||
cd("成都", "chengdu", "028", false, true, 104.0646800000, 30.6585800000),
|
||||
|
||||
/**
|
||||
* 西安
|
||||
* 西安
|
||||
*/
|
||||
xa("西安", "xian", "029", false, false, 108.9442900000, 34.2647700000),
|
||||
xa("西安", "xian", "029", false, false, 108.9442900000, 34.2647700000),
|
||||
|
||||
/**
|
||||
* 沈阳
|
||||
* 沈阳
|
||||
*/
|
||||
sy("沈阳", "shenyang", "024", false, true, 123.4321800000, 41.8062600000),
|
||||
sy("沈阳", "shenyang", "024", false, true, 123.4321800000, 41.8062600000),
|
||||
|
||||
/**
|
||||
* 重庆
|
||||
* 重庆
|
||||
*/
|
||||
cq("重庆", "chongqing", "023", false, true, 106.5522700000, 29.5632900000),
|
||||
cq("重庆", "chongqing", "023", false, true, 106.5522700000, 29.5632900000),
|
||||
|
||||
/**
|
||||
* 苏州
|
||||
* 苏州
|
||||
*/
|
||||
suz("苏州", "suzhou", "0512", false, false, 120.5865600000, 31.2976400000),
|
||||
suz("苏州", "suzhou", "0512", false, false, 120.5865600000, 31.2976400000),
|
||||
|
||||
/**
|
||||
* 武汉
|
||||
* 武汉
|
||||
*/
|
||||
wh("武汉", "wuhan", "027", false, true, 114.3054200000, 30.5927300000),
|
||||
wh("武汉", "wuhan", "027", false, true, 114.3054200000, 30.5927300000),
|
||||
|
||||
/**
|
||||
* 长沙
|
||||
* 长沙
|
||||
*/
|
||||
cs("长沙", "changsha", "0731", false, false, 112.9389100000, 28.2280500000),
|
||||
cs("长沙", "changsha", "0731", false, false, 112.9389100000, 28.2280500000),
|
||||
|
||||
/**
|
||||
* 石家庄
|
||||
* 石家庄
|
||||
*/
|
||||
sjz("石家庄", "shijiazhuang", "0311", false, false, 114.5144300000, 38.0428500000),
|
||||
sjz("石家庄", "shijiazhuang", "0311", false, false, 114.5144300000, 38.0428500000),
|
||||
|
||||
/**
|
||||
* 青岛
|
||||
* 青岛
|
||||
*/
|
||||
qd("青岛", "qingdao", "0532", false, false, 120.3830400000, 36.0662400000),
|
||||
qd("青岛", "qingdao", "0532", false, false, 120.3830400000, 36.0662400000),
|
||||
|
||||
/**
|
||||
* 福州
|
||||
* 福州
|
||||
*/
|
||||
fz("福州", "fuzhou", "0591", false, false, 119.2962600000, 26.0741000000),
|
||||
fz("福州", "fuzhou", "0591", false, false, 119.2962600000, 26.0741000000),
|
||||
|
||||
/**
|
||||
* 济南
|
||||
* 济南
|
||||
*/
|
||||
jn("济南", "jinan", "0531", false, false, 117.0420100000, 36.7277800000),
|
||||
jn("济南", "jinan", "0531", false, false, 117.0420100000, 36.7277800000),
|
||||
|
||||
/**
|
||||
* 厦门
|
||||
* 厦门
|
||||
*/
|
||||
xm("厦门", "xiamen", "0592", false, false, 118.10000, 24.46667),
|
||||
xm("厦门", "xiamen", "0592", false, false, 118.10000, 24.46667),
|
||||
|
||||
/**
|
||||
* 宁波
|
||||
* 宁波
|
||||
*/
|
||||
nb("宁波", "ningbo", "0574", false, false, 121.5504100000, 29.8736300000),
|
||||
nb("宁波", "ningbo", "0574", false, false, 121.5504100000, 29.8736300000),
|
||||
|
||||
/**
|
||||
* 大连
|
||||
* 大连
|
||||
*/
|
||||
dl("大连", "dalian", "0411", false, true, 121.6143400000, 38.9142900000),
|
||||
dl("大连", "dalian", "0411", false, true, 121.6143400000, 38.9142900000),
|
||||
|
||||
/**
|
||||
* 无锡
|
||||
* 无锡
|
||||
*/
|
||||
wx("无锡", "wuxi", "0510", false, false, 120.3028100000, 31.5660400000),
|
||||
wx("无锡", "wuxi", "0510", false, false, 120.3028100000, 31.5660400000),
|
||||
|
||||
/**
|
||||
* 三亚
|
||||
* 三亚
|
||||
*/
|
||||
sanya("三亚", "sanya", "0899", true, false, 109.50000, 18.20000),
|
||||
sanya("三亚", "sanya", "0899", true, false, 109.50000, 18.20000),
|
||||
|
||||
/**
|
||||
* 太原
|
||||
* 太原
|
||||
*/
|
||||
ty("太原", "taiyuan", "0351", false, false, 112.53333, 37.86667),
|
||||
ty("太原", "taiyuan", "0351", false, false, 112.53333, 37.86667),
|
||||
|
||||
/**
|
||||
* 福州
|
||||
* 福州
|
||||
*/
|
||||
wz("温州", "wenzhou", "0577", false, false, 120.38, 28.00),
|
||||
wz("温州", "wenzhou", "0577", false, false, 120.38, 28.00),
|
||||
|
||||
/**
|
||||
* 佛山
|
||||
* 佛山
|
||||
*/
|
||||
fs("佛山", "foshan", "0757", true, false, 113.1214160000, 23.0215480000),
|
||||
fs("佛山", "foshan", "0757", true, false, 113.1214160000, 23.0215480000),
|
||||
|
||||
/**
|
||||
* 郑州
|
||||
* 郑州
|
||||
*/
|
||||
zz("郑州", "zhengzhou", "0371", true, false, 113.65000, 34.76667);
|
||||
zz("郑州", "zhengzhou", "0371", true, false, 113.65000, 34.76667);
|
||||
|
||||
// dg("东莞", "dongguan", false),
|
||||
// hrb("哈尔滨", "haerbin", false),
|
||||
// dg("东莞", "dongguan", false),
|
||||
// hrb("哈尔滨", "haerbin", false),
|
||||
|
||||
// hf("合肥", "hefei", false),
|
||||
// km("昆明", "kunming", false),
|
||||
// nc("南昌", "nanchang", false),
|
||||
// nn("南宁", "nanning", false),
|
||||
// lz("兰州", "lanzhou", false);
|
||||
// hf("合肥", "hefei", false),
|
||||
// km("昆明", "kunming", false),
|
||||
// nc("南昌", "nanchang", false),
|
||||
// nn("南宁", "nanning", false),
|
||||
// lz("兰州", "lanzhou", false);
|
||||
private final String display;
|
||||
private final String spell;
|
||||
/**
|
||||
* 是否启用
|
||||
* 是否启用
|
||||
*/
|
||||
private final boolean enabled;
|
||||
/**
|
||||
* 是否支持板块
|
||||
* 是否支持板块
|
||||
*/
|
||||
private final boolean supportBlock;
|
||||
/**
|
||||
* 是否支持地铁找房
|
||||
* 是否支持地铁找房
|
||||
*/
|
||||
private final boolean supportMetro;
|
||||
|
||||
@@ -185,11 +185,11 @@ public enum ServerAreaEnum {
|
||||
private final double lng;
|
||||
private final double lat;
|
||||
/**
|
||||
* 首页地图所用城市(排序后)
|
||||
* 首页地图所用城市(排序后)
|
||||
*/
|
||||
public static final Map<Integer, ServerAreaEnum> homeMapCities;
|
||||
/**
|
||||
* 区与城市列表的映射
|
||||
* 区与城市列表的映射
|
||||
*/
|
||||
public final static Map<String, List<ServerAreaEnum>> sectionMap;
|
||||
private final static Map<String, ServerAreaEnum> nameMap;
|
||||
@@ -238,7 +238,7 @@ public enum ServerAreaEnum {
|
||||
citys.add(ServerAreaEnum.dl);
|
||||
citys.add(ServerAreaEnum.ty);
|
||||
citys.add(ServerAreaEnum.zz);
|
||||
sectionMap.put("华北东北", citys);
|
||||
sectionMap.put("华北东北", citys);
|
||||
citys = new ArrayList<ServerAreaEnum>();
|
||||
citys.add(ServerAreaEnum.sh);
|
||||
citys.add(ServerAreaEnum.hz);
|
||||
@@ -248,7 +248,7 @@ public enum ServerAreaEnum {
|
||||
citys.add(ServerAreaEnum.wx);
|
||||
citys.add(ServerAreaEnum.wz);
|
||||
citys.add(ServerAreaEnum.yz);
|
||||
sectionMap.put("华东城市", citys);
|
||||
sectionMap.put("华东城市", citys);
|
||||
citys = new ArrayList<ServerAreaEnum>();
|
||||
citys.add(ServerAreaEnum.gz);
|
||||
citys.add(ServerAreaEnum.sz);
|
||||
@@ -258,12 +258,12 @@ public enum ServerAreaEnum {
|
||||
citys.add(ServerAreaEnum.xm);
|
||||
citys.add(ServerAreaEnum.sanya);
|
||||
citys.add(ServerAreaEnum.fs);
|
||||
sectionMap.put("华南华中", citys);
|
||||
sectionMap.put("华南华中", citys);
|
||||
citys = new ArrayList<ServerAreaEnum>();
|
||||
citys.add(ServerAreaEnum.cd);
|
||||
citys.add(ServerAreaEnum.xa);
|
||||
citys.add(ServerAreaEnum.cq);
|
||||
sectionMap.put("西部城市", citys);
|
||||
sectionMap.put("西部城市", citys);
|
||||
|
||||
ServerAreaEnum[] values = ServerAreaEnum.getEnabledCity();
|
||||
nameMap = new HashMap<String, ServerAreaEnum>(values.length);
|
||||
@@ -373,7 +373,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SPELL得到ENUM对象
|
||||
* 通过SPELL得到ENUM对象
|
||||
*
|
||||
* @param spell
|
||||
* @return
|
||||
@@ -387,7 +387,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SPELL得到ENUM对象
|
||||
* 通过SPELL得到ENUM对象
|
||||
*
|
||||
* @param spell
|
||||
* @return
|
||||
@@ -397,10 +397,10 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据name或spell获取ENUM对象
|
||||
* 根据name或spell获取ENUM对象
|
||||
*
|
||||
* <p>
|
||||
* 若name匹配到,则返回ENUM对象,否则返回spell匹配到的ENUM对象
|
||||
* 若name匹配到,则返回ENUM对象,否则返回spell匹配到的ENUM对象
|
||||
* </p>
|
||||
*
|
||||
* @param str
|
||||
@@ -415,7 +415,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过display得到ENUM对象
|
||||
* 通过display得到ENUM对象
|
||||
*
|
||||
* @param spell
|
||||
* @return
|
||||
@@ -429,7 +429,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过display得到ENUM对象,找不到返回null
|
||||
* 通过display得到ENUM对象,找不到返回null
|
||||
*
|
||||
* @param display
|
||||
* @return
|
||||
@@ -439,7 +439,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过name得到ENUM对象,找不到返回null
|
||||
* 通过name得到ENUM对象,找不到返回null
|
||||
*
|
||||
* @param display
|
||||
* @return
|
||||
@@ -449,7 +449,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据输入的字符串中包含某个城市名称就认为就是那个城市的 比如输入的字符串为浙江省杭州市就认为是杭州市的 如果没有找到某个城市则返回null
|
||||
* 根据输入的字符串中包含某个城市名称就认为就是那个城市的 比如输入的字符串为浙江省杭州市就认为是杭州市的 如果没有找到某个城市则返回null
|
||||
*
|
||||
* @param s
|
||||
* @return
|
||||
@@ -467,7 +467,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回区与城市列表的映射
|
||||
* 返回区与城市列表的映射
|
||||
*/
|
||||
public static Map<String, List<ServerAreaEnum>> getSectionMap() {
|
||||
return sectionMap;
|
||||
@@ -486,7 +486,7 @@ public enum ServerAreaEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到各个城市的400号
|
||||
* 得到各个城市的400号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ public abstract class MemCachedManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对当前线程的数据库访问进行计数
|
||||
* 对当前线程的数据库访问进行计数
|
||||
*/
|
||||
protected final void increaseExecuteCounter(String operation, long time) {
|
||||
ExecuteCounter.getThreadLocalInstance(ThreadLocalKey.DaoExecuteCounter).increase(this.getClass().getSimpleName(),
|
||||
@@ -166,7 +166,7 @@ public abstract class MemCachedManager {
|
||||
* @param key
|
||||
* @param value
|
||||
* @param milliseconds
|
||||
* (毫秒级)
|
||||
* (毫秒级)
|
||||
* @return
|
||||
*/
|
||||
abstract public boolean set(String key, Serializable value, long milliseconds);
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ public class MemcachedController {
|
||||
private final static InetAddress LOCAL_ADDRESS = getLocalNetworkAddress();
|
||||
|
||||
/**
|
||||
* ²é¿´memcachedµÄmissͳ¼Æ
|
||||
* 查看memcached的miss统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -25,8 +25,8 @@ public class ReponseData<T> implements Serializable {
|
||||
}
|
||||
|
||||
private void setSuccess() {
|
||||
this.code = 200;// ĬÈϲÙ×÷³É¹¦
|
||||
this.msg = "³É¹¦";
|
||||
this.code = 200;// 默认操作成功
|
||||
this.msg = "成功";
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.fangjia.core.seabridformat;
|
||||
|
||||
public enum DirectionType {
|
||||
|
||||
DONG("¶«"), NAN("ÄÏ"), XI("Î÷"), BEI("±±"), DONG_NAN("¶«ÄÏ"), NAN_BEI("Äϱ±"), XI_NAN("Î÷ÄÏ"), DONG_BEI("¶«±±"), XI_BEI("Î÷±±"), DONG_XI("¶«Î÷");
|
||||
DONG("东"), NAN("南"), XI("西"), BEI("北"), DONG_NAN("东南"), NAN_BEI("南北"), XI_NAN("西南"), DONG_BEI("东北"), XI_BEI("西北"), DONG_XI("东西");
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.fangjia.core.seabridformat;
|
||||
/**
|
||||
* ×°ÐÞÀàÐͶ¨Òå
|
||||
* 装修类型定义
|
||||
* @author yinjihuan
|
||||
*
|
||||
*/
|
||||
public enum FitmentType {
|
||||
|
||||
HAO_ZHUANG("ºÀ×°"), JING_ZHUANG("¾«×°"), JIAN_ZHUANG("¼ò×°"), MAO_PI("ëÅ÷");
|
||||
HAO_ZHUANG("豪装"), JING_ZHUANG("精装"), JIAN_ZHUANG("简装"), MAO_PI("毛坯");
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
+73
-73
@@ -13,63 +13,63 @@ import com.mongodb.BasicDBObject;
|
||||
|
||||
|
||||
/**
|
||||
* 房源标准化工具类
|
||||
* 房源标准化工具类
|
||||
* @author yinjihuan
|
||||
*
|
||||
*/
|
||||
public class SeabirdFormatUtils {
|
||||
|
||||
/**
|
||||
* 装修关键词<br>
|
||||
* key:装修 value:关键词
|
||||
* 装修关键词<br>
|
||||
* key:装修 value:关键词
|
||||
*/
|
||||
static Map<String, List<String>> fitmentKeywordMap = new HashMap<String, List<String>>();
|
||||
|
||||
/**
|
||||
* 朝向关键词等于处理<br>
|
||||
* key:朝向 value:关键词
|
||||
* 朝向关键词等于处理<br>
|
||||
* key:朝向 value:关键词
|
||||
*/
|
||||
static Map<String, List<String>> directionEqualsKeywordMap = new HashMap<String, List<String>>();
|
||||
|
||||
/**
|
||||
* 朝向关键词包含处理<br>
|
||||
* key:朝向 value:关键词
|
||||
* 朝向关键词包含处理<br>
|
||||
* key:朝向 value:关键词
|
||||
*/
|
||||
static Map<String, List<String>> directionContainsKeywordMap = new HashMap<String, List<String>>();
|
||||
|
||||
/**
|
||||
* 普通关键词包含处理<br>
|
||||
* key:朝向 value:关键词
|
||||
* 普通关键词包含处理<br>
|
||||
* key:朝向 value:关键词
|
||||
*/
|
||||
static Map<String, List<String>> estateTypeKeywordMap = new HashMap<String, List<String>>();
|
||||
|
||||
static List<String> ZhuanXiuNullKeys = Arrays.asList("暂无", "-", "其他", "0", "不限");
|
||||
static List<String> ZhuanXiuNullKeys = Arrays.asList("暂无", "-", "其他", "0", "不限");
|
||||
|
||||
static {
|
||||
fitmentKeywordMap.put(FitmentType.HAO_ZHUANG.getType(), Arrays.asList("豪", "高档", "顶级"));
|
||||
fitmentKeywordMap.put(FitmentType.JING_ZHUANG.getType(), Arrays.asList("中档", "中等", "中修", "中装", "精", "全装修", "新装修"));
|
||||
fitmentKeywordMap.put(FitmentType.JIAN_ZHUANG.getType(), Arrays.asList("简", "普通", "一般", "局部"));
|
||||
fitmentKeywordMap.put(FitmentType.MAO_PI.getType(), Arrays.asList("毛坯", "无装", "清水", "未装"));
|
||||
fitmentKeywordMap.put(FitmentType.HAO_ZHUANG.getType(), Arrays.asList("豪", "高档", "顶级"));
|
||||
fitmentKeywordMap.put(FitmentType.JING_ZHUANG.getType(), Arrays.asList("中档", "中等", "中修", "中装", "精", "全装修", "新装修"));
|
||||
fitmentKeywordMap.put(FitmentType.JIAN_ZHUANG.getType(), Arrays.asList("简", "普通", "一般", "局部"));
|
||||
fitmentKeywordMap.put(FitmentType.MAO_PI.getType(), Arrays.asList("毛坯", "无装", "清水", "未装"));
|
||||
|
||||
directionEqualsKeywordMap.put(DirectionType.DONG.getType(), Arrays.asList(DirectionType.DONG.getType()));
|
||||
directionEqualsKeywordMap.put(DirectionType.NAN.getType(), Arrays.asList(DirectionType.NAN.getType()));
|
||||
directionEqualsKeywordMap.put(DirectionType.XI.getType(), Arrays.asList(DirectionType.XI.getType()));
|
||||
directionEqualsKeywordMap.put(DirectionType.BEI.getType(), Arrays.asList(DirectionType.BEI.getType()));
|
||||
|
||||
directionContainsKeywordMap.put("东南", Arrays.asList("东南"));
|
||||
directionContainsKeywordMap.put("南北", Arrays.asList("南北"));
|
||||
directionContainsKeywordMap.put("西南", Arrays.asList("西南"));
|
||||
directionContainsKeywordMap.put("东北", Arrays.asList("东北"));
|
||||
directionContainsKeywordMap.put("西北", Arrays.asList("西北"));
|
||||
directionContainsKeywordMap.put("东西", Arrays.asList("东西"));
|
||||
directionContainsKeywordMap.put("东南", Arrays.asList("东南"));
|
||||
directionContainsKeywordMap.put("南北", Arrays.asList("南北"));
|
||||
directionContainsKeywordMap.put("西南", Arrays.asList("西南"));
|
||||
directionContainsKeywordMap.put("东北", Arrays.asList("东北"));
|
||||
directionContainsKeywordMap.put("西北", Arrays.asList("西北"));
|
||||
directionContainsKeywordMap.put("东西", Arrays.asList("东西"));
|
||||
|
||||
estateTypeKeywordMap.put("普通住宅", Arrays.asList("住宅", "酒店式公寓"));
|
||||
estateTypeKeywordMap.put("别墅", Arrays.asList("别墅", "独栋", "双拼", "联排", "叠加"));
|
||||
estateTypeKeywordMap.put("普通住宅", Arrays.asList("住宅", "酒店式公寓"));
|
||||
estateTypeKeywordMap.put("别墅", Arrays.asList("别墅", "独栋", "双拼", "联排", "叠加"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化装修字段
|
||||
* @param fitment 装修
|
||||
* 格式化装修字段
|
||||
* @param fitment 装修
|
||||
* @return
|
||||
*/
|
||||
public static String formatFitment(String fitment) {
|
||||
@@ -91,8 +91,8 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化朝向字段
|
||||
* @param direction 朝向
|
||||
* 格式化朝向字段
|
||||
* @param direction 朝向
|
||||
* @return
|
||||
*/
|
||||
public static String formatDirection(String direction) {
|
||||
@@ -107,8 +107,8 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化物业类型
|
||||
* @param estate_type 物业类型
|
||||
* 格式化物业类型
|
||||
* @param estate_type 物业类型
|
||||
* @return
|
||||
*/
|
||||
public static String formatEstateType(String estate_type) {
|
||||
@@ -123,7 +123,7 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化楼层
|
||||
* 格式化楼层
|
||||
* @return
|
||||
*/
|
||||
public static Integer formatFloor(int floor) {
|
||||
@@ -134,10 +134,10 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取格式化之后的值
|
||||
* @param keywords 关键词Map
|
||||
* @param str 格式化内容
|
||||
* @param opType 操作类型(equals,contains)
|
||||
* 获取格式化之后的值
|
||||
* @param keywords 关键词Map
|
||||
* @param str 格式化内容
|
||||
* @param opType 操作类型(equals,contains)
|
||||
*/
|
||||
private static String getFormatValue(Map<String, List<String>> keywords, String str, String opType) {
|
||||
Set<String> keys = keywords.keySet();
|
||||
@@ -159,22 +159,22 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按面积判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param room 室
|
||||
* @param area 面积
|
||||
* @return true表示要过滤,false不过滤
|
||||
* 按面积判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param room 室
|
||||
* @param area 面积
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterBySize(String estate_type, int room, double area) {
|
||||
int size = 10;
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (area > 700 || area < size * room) {
|
||||
return true;
|
||||
}
|
||||
if (room < 1 && area < 10) {
|
||||
return true;
|
||||
}
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
if (area < 50) {
|
||||
return true;
|
||||
}
|
||||
@@ -183,19 +183,19 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据房型判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param room 室
|
||||
* @param hall 厅
|
||||
* @param toilet 卫
|
||||
* @return true表示要过滤,false不过滤
|
||||
* 根据房型判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param room 室
|
||||
* @param hall 厅
|
||||
* @param toilet 卫
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterByFangXin(String estate_type, int room, int hall, int toilet) {
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (room >= 1 && room <= 6 && hall >= 0 && hall <= 3 && toilet >= 0 && toilet <= 5 && toilet <= room) {
|
||||
return false;
|
||||
}
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
if (room >= 3 && hall >= 2 && hall <= 4 && toilet <= room) {
|
||||
return false;
|
||||
}
|
||||
@@ -204,11 +204,11 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据总价判断是否要过滤
|
||||
* @param city 城市
|
||||
* @param total_price 总价
|
||||
* @param area 面积
|
||||
* @return true表示要过滤,false不过滤
|
||||
* 根据总价判断是否要过滤
|
||||
* @param city 城市
|
||||
* @param total_price 总价
|
||||
* @param area 面积
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterByTotalPrice(String city, int total_price, double area) {
|
||||
Integer grade = RegionData.getCityGrade(city);
|
||||
@@ -245,9 +245,9 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据建造年代判断是否要过滤
|
||||
* @param build_date 建造年代
|
||||
* @return true表示要过滤,false不过滤
|
||||
* 根据建造年代判断是否要过滤
|
||||
* @param build_date 建造年代
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterBybuildDate(int build_date) {
|
||||
if (build_date == 0) {
|
||||
@@ -260,11 +260,11 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据楼层判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param floor 所在楼层
|
||||
* @param height 楼高
|
||||
* @return true表示要过滤,false不过滤
|
||||
* 根据楼层判断是否要过滤
|
||||
* @param estate_type 物业类型
|
||||
* @param floor 所在楼层
|
||||
* @param height 楼高
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterByFloor(String estate_type, int floor, int height) {
|
||||
if (height == 0) {
|
||||
@@ -273,11 +273,11 @@ public class SeabirdFormatUtils {
|
||||
if (floor > height) {
|
||||
return true;
|
||||
}
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (!StringUtils.hasText(estate_type) || estate_type.equals("普通住宅")) {
|
||||
if (height >= 3 && height <= 62) {
|
||||
return false;
|
||||
}
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
} else if (estate_type.equals("别墅")) {
|
||||
if (height >= 1 && height <= 6) {
|
||||
return false;
|
||||
}
|
||||
@@ -286,9 +286,9 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据楼层判断有无电梯
|
||||
* @param floor 楼层
|
||||
* @return true表示有电梯 false表示无电梯
|
||||
* 根据楼层判断有无电梯
|
||||
* @param floor 楼层
|
||||
* @return true表示有电梯 false表示无电梯
|
||||
*/
|
||||
public static boolean checkIsElevator(int floor) {
|
||||
if (floor > 7) {
|
||||
@@ -298,9 +298,9 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否要过滤房源
|
||||
* 是否要过滤房源
|
||||
* @param data
|
||||
* @return true表示要过滤,false不过滤
|
||||
* @return true表示要过滤,false不过滤
|
||||
*/
|
||||
public static boolean filterAll(BasicDBObject data) {
|
||||
String estate_type = data.getString("estate_type");
|
||||
@@ -328,9 +328,9 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤以及格式化
|
||||
* @param data 房源对象
|
||||
* @return 符合房源则返回格式化后的数据,不符合则返回null
|
||||
* 过滤以及格式化
|
||||
* @param data 房源对象
|
||||
* @return 符合房源则返回格式化后的数据,不符合则返回null
|
||||
*/
|
||||
public static BasicDBObject filterAllByForamt(BasicDBObject data) {
|
||||
data = formatAll(data);
|
||||
@@ -341,8 +341,8 @@ public class SeabirdFormatUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化房源<br>
|
||||
* 装修,朝向,区域
|
||||
* 格式化房源<br>
|
||||
* 装修,朝向,区域
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AddressLatlng {
|
||||
|
||||
|
||||
public static void main(String[] args){
|
||||
AddressLatlng.getLngLatByAddress("ÉϺ£", "½ðº£Â·Õ¾");
|
||||
AddressLatlng.getLngLatByAddress("上海", "金海路站");
|
||||
}
|
||||
|
||||
public static Map<String, Object> getLngLatByAddress(String city, String address){
|
||||
|
||||
@@ -17,51 +17,51 @@ import java.util.regex.Pattern;
|
||||
public class AddressParser {
|
||||
|
||||
|
||||
static Pattern regExp_checkRoad1=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)$");
|
||||
static Pattern regExp_checkRoad2=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04$");
|
||||
static Pattern regExp_checkRoad3=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7?\\-[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad4=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7?\\-[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad5=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+$");
|
||||
static Pattern regExp_checkRoad6=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad7=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad8=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?\\-[0-9]+(\u5F04|\u53F7)$");
|
||||
static Pattern regExp_checkRoad1=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)$");
|
||||
static Pattern regExp_checkRoad2=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04$");
|
||||
static Pattern regExp_checkRoad3=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7?\\-[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad4=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7?\\-[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad5=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+$");
|
||||
static Pattern regExp_checkRoad6=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad7=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7$");
|
||||
static Pattern regExp_checkRoad8=Pattern.compile("^[\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?\\-[0-9]+(\u5F04|\u53F7)$");
|
||||
|
||||
static Pattern invalidAddrStartRegx=Pattern.compile("^[,\\(\\)\\-\\.\\&\\/\"\']");
|
||||
static Pattern invalidAddrNotationRegx=Pattern.compile("[^一-龥\\w#\\/\\-\\\\]+");
|
||||
static Pattern invalidAddrNotationRegx=Pattern.compile("[^一-龥\\w#\\/\\-\\\\]+");
|
||||
|
||||
static Pattern regExp_splitAddress1=Pattern.compile("\\s+|\u3000|\u3001|\uFF0C|,|/|;");
|
||||
static Pattern regExp_splitAddress2=Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?)");
|
||||
static Pattern regExp_splitAddress2=Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?)");
|
||||
|
||||
static Pattern regExp_checkRoadNo1=Pattern.compile("^[0-9]+(\u5F04|\u53F7)$");
|
||||
static Pattern regExp_replaceRoadNo1=Pattern.compile("[0-9]+(\u53F7)");
|
||||
static Pattern regExp_replaceRoadNo2=Pattern.compile("[0-9]+(\u5F04)");
|
||||
|
||||
static Pattern[] address_regExp_arr=new Pattern[]{
|
||||
Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?\\-[0-9]+(\u5F04|\u53F7))")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7?\\-[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7?\\-[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7))")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+)")
|
||||
Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)?\\-[0-9]+(\u5F04|\u53F7))")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04[0-9]+\u53F7?\\-[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7?\\-[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u652F\u5F04)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7)[0-9]+\u53F7)")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+(\u5F04|\u53F7))")
|
||||
, Pattern.compile("^([\u4e00-\u9fa5]{2,15}(\u9053|\u8DEF|\u8857)[一二三四五六七八九十\\d]+)")
|
||||
};
|
||||
|
||||
static Pattern address_regExp_1=Pattern.compile("^(([\u4e00-\u9fa5]{2,30}(\u5927\u9053|\u8DEF|街|道)([一二三四五六七八九十\\d]+(\u5F04|\u53F7))?)+)([\u4e00-\u9fa5\\.·]{3,15})([\\w]+.*)");
|
||||
static Pattern address_regExp_2=Pattern.compile("^([\u4e00-\u9fa5]{2,30}(\u5927\u9053|\u8DEF|街|道)([一二三四五六七八九十\\d]+(\u5F04|\u53F7)))(.*)");
|
||||
static Pattern address_regExp_3=Pattern.compile("^([\u4e00-\u9fa5\\.·]{4,30})([第一二三四五六七八九十\\w东南西北甲乙丙]+(房|单元|侧|区|#|栋|幢|座|号|楼).*)");
|
||||
static Pattern address_regExp_4=Pattern.compile("^(([\u4e00-\u9fa5]{4,30}([\\d]+米)?)+)([第一二三四五六七八九十\\w东南西北甲乙丙]+(房|单元|侧|区|#|栋|幢|座|号|楼).*)");
|
||||
static Pattern address_regExp_5=Pattern.compile("^([\u4e00-\u9fa5\\.·]{4,30})([\\w\\-]+.*)");
|
||||
static Pattern address_regExp_1=Pattern.compile("^(([\u4e00-\u9fa5]{2,30}(\u5927\u9053|\u8DEF|街|道)([一二三四五六七八九十\\d]+(\u5F04|\u53F7))?)+)([\u4e00-\u9fa5\\.·]{3,15})([\\w]+.*)");
|
||||
static Pattern address_regExp_2=Pattern.compile("^([\u4e00-\u9fa5]{2,30}(\u5927\u9053|\u8DEF|街|道)([一二三四五六七八九十\\d]+(\u5F04|\u53F7)))(.*)");
|
||||
static Pattern address_regExp_3=Pattern.compile("^([\u4e00-\u9fa5\\.·]{4,30})([第一二三四五六七八九十\\w东南西北甲乙丙]+(房|单元|侧|区|#|栋|幢|座|号|楼).*)");
|
||||
static Pattern address_regExp_4=Pattern.compile("^(([\u4e00-\u9fa5]{4,30}([\\d]+米)?)+)([第一二三四五六七八九十\\w东南西北甲乙丙]+(房|单元|侧|区|#|栋|幢|座|号|楼).*)");
|
||||
static Pattern address_regExp_5=Pattern.compile("^([\u4e00-\u9fa5\\.·]{4,30})([\\w\\-]+.*)");
|
||||
|
||||
static String room_houseSuffix="[幢号座楼栋#]+";
|
||||
static String room_unitSuffix="[单元梯座]+";
|
||||
static String room_numSuffix="[房室号]{0,2}";
|
||||
static String room_houseSuffix="[幢号座楼栋#]+";
|
||||
static String room_unitSuffix="[单元梯座]+";
|
||||
static String room_numSuffix="[房室号]{0,2}";
|
||||
|
||||
static Pattern[] room_regExp_arr2=new Pattern[]{
|
||||
Pattern.compile(String.format("([\\w]+)%s([\\w]+)%s[\\d]+层([\\w]+)%s$", room_houseSuffix, room_unitSuffix, room_numSuffix))
|
||||
Pattern.compile(String.format("([\\w]+)%s([\\w]+)%s[\\d]+层([\\w]+)%s$", room_houseSuffix, room_unitSuffix, room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)%s([\\w]+)%s([\\w]+)%s$", room_houseSuffix, room_unitSuffix, room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)%s([\\w]+)\\-([\\w]+)%s$", room_houseSuffix, room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)%s()[\\d]+层([\\w]+)%s$", room_houseSuffix, room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)%s()[\\d]+层([\\w]+)%s$", room_houseSuffix, room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)\\-([\\w]+)\\-([\\w]+)%s$", room_numSuffix))
|
||||
, Pattern.compile(String.format("([\\w]+)\\\\([\\w]+)\\\\([\\w]+)$"))
|
||||
, Pattern.compile(String.format("()([\\w]+)\\/([\\w]+)$"))
|
||||
@@ -78,9 +78,9 @@ public class AddressParser {
|
||||
};
|
||||
|
||||
|
||||
//替换重复的镇名或路名: 千灯镇千灯镇黄浦路
|
||||
//替换重复的镇名或路名: 千灯镇千灯镇黄浦路
|
||||
static String replaceRepeatAddr(String address){
|
||||
Pattern placeRegx=Pattern.compile("([^镇.]{2,5}镇)");
|
||||
Pattern placeRegx=Pattern.compile("([^镇.]{2,5}镇)");
|
||||
Matcher matcher=placeRegx.matcher(address);
|
||||
if(matcher.find()){
|
||||
String place=matcher.group(1);
|
||||
@@ -94,7 +94,7 @@ public class AddressParser {
|
||||
}
|
||||
}
|
||||
|
||||
placeRegx=Pattern.compile("([^路.]{2,5}路)");
|
||||
placeRegx=Pattern.compile("([^路.]{2,5}路)");
|
||||
matcher=placeRegx.matcher(address);
|
||||
if(matcher.find()){
|
||||
String place=matcher.group(1);
|
||||
@@ -139,7 +139,7 @@ public class AddressParser {
|
||||
if(cityParents!=null){
|
||||
for(int k=0; k<cityParents.length; k++){
|
||||
if(isEmpty(cityParents[k]))continue;
|
||||
Pattern cityParentRegx=Pattern.compile("^"+cityParents[k]+"(省|市|县)?");
|
||||
Pattern cityParentRegx=Pattern.compile("^"+cityParents[k]+"(省|市|县)?");
|
||||
Matcher matcher=cityParentRegx.matcher(address);
|
||||
while(matcher.find()){
|
||||
|
||||
@@ -155,7 +155,7 @@ public class AddressParser {
|
||||
|
||||
for(int k=0; k<cityParents.length; k++){
|
||||
if(isEmpty(cityParents[k]))continue;
|
||||
Pattern cityParentRegx=Pattern.compile(cityParents[k]+"(省|市|县)");
|
||||
Pattern cityParentRegx=Pattern.compile(cityParents[k]+"(省|市|县)");
|
||||
Matcher matcher=cityParentRegx.matcher(address);
|
||||
while(matcher.find()){
|
||||
String address2=address.substring(matcher.start());
|
||||
@@ -194,10 +194,10 @@ public class AddressParser {
|
||||
if(districts!=null){
|
||||
for(int i=0; i<districts.length; i++){
|
||||
if(isEmpty(districts[i]))continue;
|
||||
Pattern districtRoadRegx=Pattern.compile("^"+districts[i]+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
Pattern districtRoadRegx=Pattern.compile("^"+districts[i]+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
if(districtRoadRegx.matcher(address).find())continue;
|
||||
|
||||
Pattern districtSuffixRegx=Pattern.compile("^"+districts[i]+"(区|县|市)?");
|
||||
Pattern districtSuffixRegx=Pattern.compile("^"+districts[i]+"(区|县|市)?");
|
||||
matcher=districtSuffixRegx.matcher(address);
|
||||
if(matcher.find()){
|
||||
rt[0]=districts[i];
|
||||
@@ -231,10 +231,10 @@ public class AddressParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
//替换省市的名称,如:上海市上海青浦区黄浦路34弄2号,返回:黄浦路34弄2号
|
||||
//替换省市的名称,如:上海市上海青浦区黄浦路34弄2号,返回:黄浦路34弄2号
|
||||
/**
|
||||
* rt[0]: 区域
|
||||
* rt[1]: 地址
|
||||
* rt[0]: 区域
|
||||
* rt[1]: 地址
|
||||
* @param city
|
||||
* @param origAddress
|
||||
* @return
|
||||
@@ -245,7 +245,7 @@ public class AddressParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配多个地址
|
||||
* 匹配多个地址
|
||||
* @param city
|
||||
*/
|
||||
static List<String> splitMutilAddr(String city, String address){
|
||||
@@ -358,7 +358,7 @@ public class AddressParser {
|
||||
addresses.add(address);
|
||||
}else{
|
||||
/**
|
||||
* 匹配多个地址
|
||||
* 匹配多个地址
|
||||
*/
|
||||
addresses=splitMutilAddr(city, address1);
|
||||
if(addresses.size()==0){
|
||||
@@ -369,11 +369,11 @@ public class AddressParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* result[0]: 城市
|
||||
* result[1]: 区域
|
||||
* result[2]: 地址
|
||||
* result[3]: 小区名
|
||||
* result[4]: 楼号室号
|
||||
* result[0]: 城市
|
||||
* result[1]: 区域
|
||||
* result[2]: 地址
|
||||
* result[3]: 小区名
|
||||
* result[4]: 楼号室号
|
||||
*
|
||||
* @param city
|
||||
* @param origAddress
|
||||
@@ -395,19 +395,19 @@ public class AddressParser {
|
||||
String address=null;
|
||||
String name=null;
|
||||
String restAddr=null;
|
||||
//提取城市
|
||||
//提取城市
|
||||
String[] rt=parseCity(origAddress);
|
||||
origAddress=rt[1];
|
||||
if(!isEmpty(rt[0])){
|
||||
city=rt[0];
|
||||
}
|
||||
//去除省名城市名区等
|
||||
//去除省名城市名区等
|
||||
String[] rt2=doReplaceDistrict(city, origAddress, true);
|
||||
if(rt2!=null){
|
||||
addressResult.region=rt2[0];
|
||||
origAddress=rt2[1];
|
||||
}else if(isEmpty(city)){
|
||||
//提取区域
|
||||
//提取区域
|
||||
rt2=parseRegion(origAddress);
|
||||
if(rt2!=null){
|
||||
city=rt2[0];
|
||||
@@ -416,7 +416,7 @@ public class AddressParser {
|
||||
}
|
||||
if(!isEmpty(addressResult.region)){
|
||||
|
||||
Pattern regionRegx=Pattern.compile("^"+addressResult.region+"(区|县|市)?(房价|均价)?$");
|
||||
Pattern regionRegx=Pattern.compile("^"+addressResult.region+"(区|县|市)?(房价|均价)?$");
|
||||
matcher=regionRegx.matcher(origAddress);
|
||||
if(matcher.find()){
|
||||
addressResult.city=city;
|
||||
@@ -427,7 +427,7 @@ public class AddressParser {
|
||||
int matchType=0;
|
||||
|
||||
/**
|
||||
* 解析室号
|
||||
* 解析室号
|
||||
*/
|
||||
for(int k=0; k<room_regExp_arr1.length; k++){
|
||||
Pattern pattern=room_regExp_arr1[k];
|
||||
@@ -466,10 +466,10 @@ public class AddressParser {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 如果室号解析失败,解析地址
|
||||
* 如果室号解析失败,解析地址
|
||||
*/
|
||||
if(matchType==0){
|
||||
//解析标准地址带路号弄
|
||||
//解析标准地址带路号弄
|
||||
for(Pattern pattern: address_regExp_arr){
|
||||
matcher=pattern.matcher(origAddress);
|
||||
if(matcher.find()){
|
||||
@@ -481,7 +481,7 @@ public class AddressParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果标准地址解析失败,用非标准地址继续解析地址
|
||||
* 如果标准地址解析失败,用非标准地址继续解析地址
|
||||
*/
|
||||
if(matchType==0){
|
||||
|
||||
@@ -550,7 +550,7 @@ public class AddressParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查地址中是否带城市名的小区名
|
||||
* 检查地址中是否带城市名的小区名
|
||||
*
|
||||
* @param preCity
|
||||
* @param address
|
||||
@@ -584,11 +584,11 @@ public class AddressParser {
|
||||
String[] districts=city_districts.get(city);
|
||||
for(String district: districts){
|
||||
if(isEmpty(district))continue;
|
||||
Pattern districtRoadRegx=Pattern.compile("^"+district+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
Pattern districtRoadRegx=Pattern.compile("^"+district+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
|
||||
if(districtRoadRegx.matcher(address).find())continue;
|
||||
|
||||
Pattern districtSuffixRegx=Pattern.compile("^"+district+"(区|县|市)?(房价|均价)?$");
|
||||
Pattern districtSuffixRegx=Pattern.compile("^"+district+"(区|县|市)?(房价|均价)?$");
|
||||
Matcher matcher=districtSuffixRegx.matcher(address);
|
||||
if(matcher.find()){
|
||||
rt=new String[2];
|
||||
@@ -608,19 +608,19 @@ public class AddressParser {
|
||||
String address=origAddress;
|
||||
for(int k=0; k<provinces.length; k++){
|
||||
if(isEmpty(provinces[k]))continue;
|
||||
Pattern provinceRegx=Pattern.compile("^"+provinces[k]+"(省|回族自治区|自治区|维吾尔自治区)?");
|
||||
Pattern notProvinceRegx=Pattern.compile("^"+provinces[k]+"[^省市]{0,1}(路|街|大道|镇|道|市)");
|
||||
Pattern provinceRegx=Pattern.compile("^"+provinces[k]+"(省|回族自治区|自治区|维吾尔自治区)?");
|
||||
Pattern notProvinceRegx=Pattern.compile("^"+provinces[k]+"[^省市]{0,1}(路|街|大道|镇|道|市)");
|
||||
Matcher notMatcher=notProvinceRegx.matcher(address);
|
||||
Matcher matcher=provinceRegx.matcher(address);
|
||||
|
||||
if(matcher.find() && !notMatcher.find()){
|
||||
province=provinces[k];
|
||||
if(province.equals("上海")
|
||||
||province.equals("北京")
|
||||
||province.equals("天津")
|
||||
||province.equals("重庆")
|
||||
||province.equals("香港")
|
||||
||province.equals("澳门")
|
||||
if(province.equals("上海")
|
||||
||province.equals("北京")
|
||||
||province.equals("天津")
|
||||
||province.equals("重庆")
|
||||
||province.equals("香港")
|
||||
||province.equals("澳门")
|
||||
){
|
||||
break;
|
||||
}
|
||||
@@ -636,17 +636,17 @@ public class AddressParser {
|
||||
if(province==null){
|
||||
for(int k=0; k<provinces.length; k++){
|
||||
if(isEmpty(provinces[k]))continue;
|
||||
Pattern provinceRegx=Pattern.compile(provinces[k]+"(省|回族自治区|自治区|维吾尔自治区)");
|
||||
Pattern provinceRegx=Pattern.compile(provinces[k]+"(省|回族自治区|自治区|维吾尔自治区)");
|
||||
Matcher matcher=provinceRegx.matcher(address);
|
||||
|
||||
if(matcher.find()){
|
||||
province=provinces[k];
|
||||
if(province.equals("上海")
|
||||
||province.equals("北京")
|
||||
||province.equals("天津")
|
||||
||province.equals("重庆")
|
||||
||province.equals("香港")
|
||||
||province.equals("澳门")
|
||||
if(province.equals("上海")
|
||||
||province.equals("北京")
|
||||
||province.equals("天津")
|
||||
||province.equals("重庆")
|
||||
||province.equals("香港")
|
||||
||province.equals("澳门")
|
||||
){
|
||||
break;
|
||||
}
|
||||
@@ -699,8 +699,8 @@ public class AddressParser {
|
||||
private static String matchCity(String city, String address){
|
||||
if(isEmpty(city))return null;
|
||||
boolean matched=false;
|
||||
Pattern cityParentRegx=Pattern.compile("^"+city+"(市|县)?");
|
||||
Pattern notCityParentRegx=Pattern.compile("^"+city+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
Pattern cityParentRegx=Pattern.compile("^"+city+"(市|县)?");
|
||||
Pattern notCityParentRegx=Pattern.compile("^"+city+"[^区县市]{0,1}(路|街|大道|镇|道)");
|
||||
Matcher notMatcher=notCityParentRegx.matcher(address);
|
||||
Matcher matcher=cityParentRegx.matcher(address);
|
||||
if(matcher.find() && !notMatcher.find()){
|
||||
@@ -708,7 +708,7 @@ public class AddressParser {
|
||||
matched=true;
|
||||
}
|
||||
if(!matched){
|
||||
cityParentRegx=Pattern.compile(city+"(市|县)");
|
||||
cityParentRegx=Pattern.compile(city+"(市|县)");
|
||||
matcher=cityParentRegx.matcher(address);
|
||||
if(matcher.find()){
|
||||
address=matcher.replaceAll("").trim();
|
||||
@@ -730,37 +730,37 @@ public class AddressParser {
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
String address="广州市增城市石滩镇碧桂园豪园湖心苑十二街10号";
|
||||
String address="广州市增城市石滩镇碧桂园豪园湖心苑十二街10号";
|
||||
long startTime=System.currentTimeMillis();
|
||||
AddressResult rt=parseAddressWithRoom("广州", address);
|
||||
AddressResult rt=parseAddressWithRoom("广州", address);
|
||||
System.out.println(rt);
|
||||
System.out.println("time: "+(System.currentTimeMillis()-startTime));
|
||||
|
||||
startTime=System.currentTimeMillis();
|
||||
address="浙江嘉兴市南湖区新丰工业区";
|
||||
address="浙江嘉兴市南湖区新丰工业区";
|
||||
rt=parseAddressWithRoom(null, address);
|
||||
System.out.println(rt);
|
||||
System.out.println("time: "+(System.currentTimeMillis()-startTime));
|
||||
|
||||
|
||||
/*
|
||||
address="浙江省宁波松江沪松公路18弄公册公园";
|
||||
address="浙江省宁波松江沪松公路18弄公册公园";
|
||||
rt=parseAddressWithRoom(null, address);
|
||||
System.out.println(rt);
|
||||
|
||||
address="浙江省宁波市松江沪松公公册公园A区18号a18-202";
|
||||
address="浙江省宁波市松江沪松公公册公园A区18号a18-202";
|
||||
rt=parseAddressWithRoom(null, address);
|
||||
System.out.println(rt);
|
||||
|
||||
address="浙江省宁波市松江沪松公公册公园a18-202";
|
||||
address="浙江省宁波市松江沪松公公册公园a18-202";
|
||||
rt=parseAddressWithRoom(null, address);
|
||||
System.out.println(rt);
|
||||
|
||||
address="浙江省宁波市松江路A区18号a18-202";
|
||||
address="浙江省宁波市松江路A区18号a18-202";
|
||||
rt=parseAddressWithRoom(null, address);
|
||||
System.out.println(rt);
|
||||
startTime=System.currentTimeMillis();
|
||||
System.out.println( AddressParser.parseAddressWithRoom(null,"上海市松江沪松公路1138号、\"99弄、.#106弄"));
|
||||
System.out.println( AddressParser.parseAddressWithRoom(null,"上海市松江沪松公路1138号、\"99弄、.#106弄"));
|
||||
System.out.println("time: "+(System.currentTimeMillis()-startTime));*/
|
||||
|
||||
}
|
||||
|
||||
+5109
-5109
File diff suppressed because it is too large
Load Diff
+192
-192
@@ -13,7 +13,7 @@ public class AddressParserUtils {
|
||||
|
||||
public static String filteSpecialChar(String address){
|
||||
if(null != address && StringUtils.isNotBlank(address)){
|
||||
address = address.replace("#", "#").replaceAll(",", "、").replace("●", "·").replace(",", "、").replace(" ", "").replace("()", "");
|
||||
address = address.replace("#", "#").replaceAll(",", "、").replace("●", "·").replace(",", "、").replace(" ", "").replace("()", "");
|
||||
address = removeInvalidChar(address);
|
||||
}
|
||||
return address;
|
||||
@@ -22,8 +22,8 @@ public class AddressParserUtils {
|
||||
private static String removeInvalidChar(String s) {
|
||||
s = DataUtil.removeHtml(DataUtil.balanceTags(s));
|
||||
s = s.replace(" ", "").replace("·", "").replace("??", "").replace("\u000b", "");
|
||||
if(s.indexOf("本段合作编辑者") > -1) {
|
||||
s = StringUtils.substringBeforeLast(s, "本段合作编辑者");
|
||||
if(s.indexOf("本段合作编辑者") > -1) {
|
||||
s = StringUtils.substringBeforeLast(s, "本段合作编辑者");
|
||||
}
|
||||
s = decode(s);
|
||||
s = s.replace(" ", "").replace("·", "").replace("??", "");
|
||||
@@ -54,7 +54,7 @@ public class AddressParserUtils {
|
||||
public static String filterCity(String city, String address){
|
||||
if (StringUtils.isNotBlank(city) && address.indexOf(city)!=-1){
|
||||
address = address.substring(city.length());
|
||||
if (address.startsWith("市")){
|
||||
if (address.startsWith("市")){
|
||||
address = address.substring(1);
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,11 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
public static String filteLoopInfo(String address){
|
||||
Map<String, String> ret = findPattern(address, "[\u4E00-\u9FFF]{1}环[到|至]+[\u4E00-\u9FFF]{1}环[内|之]?间?", 0);
|
||||
Map<String, String> ret = findPattern(address, "[\u4E00-\u9FFF]{1}环[到|至]+[\u4E00-\u9FFF]{1}环[内|之]?间?", 0);
|
||||
if(ret.size() ==0){
|
||||
ret = findPattern(address, "[\u4E00-\u9FFF]{1}环(以)?[内|外]", 0);
|
||||
ret = findPattern(address, "[\u4E00-\u9FFF]{1}环(以)?[内|外]", 0);
|
||||
if(ret.size() == 0){
|
||||
ret = findPattern(address, "[\u4E00-\u9FFF]{1}环与[\u4E00-\u9FFF]{1,3}环线之间", 0);
|
||||
ret = findPattern(address, "[\u4E00-\u9FFF]{1}环与[\u4E00-\u9FFF]{1,3}环线之间", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ public class AddressParserUtils {
|
||||
|
||||
public static String filterZhen(String address){
|
||||
if(StringUtils.isNotBlank(address)){
|
||||
int index = address.indexOf("镇");
|
||||
int spIndex = address.indexOf("小镇");
|
||||
int roadIndex = address.indexOf("镇路");
|
||||
int index = address.indexOf("镇");
|
||||
int spIndex = address.indexOf("小镇");
|
||||
int roadIndex = address.indexOf("镇路");
|
||||
if (index > 0 && spIndex==-1 && roadIndex ==-1){
|
||||
address = address.substring(index+1);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class AddressParserUtils {
|
||||
}
|
||||
if(tempIndex > index){
|
||||
String s = address.substring(tempIndex);
|
||||
if(!s.startsWith("坊")){
|
||||
if(!s.startsWith("坊")){
|
||||
index = tempIndex;
|
||||
keywordIndex = i;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class AddressParserUtils {
|
||||
|
||||
String keyword = keywords[keywordIndex];
|
||||
Map<String, String> loadret = findPattern(address, "("+keyword+")+\\d+",0);
|
||||
if(loadret.size()==0 && keyword!="镇"){
|
||||
if(loadret.size()==0 && keyword!="镇"){
|
||||
loadret = findPattern(address, "(.*?)("+keyword+")+",0);
|
||||
}
|
||||
return loadret;
|
||||
@@ -132,42 +132,42 @@ public class AddressParserUtils {
|
||||
String s3 = null;
|
||||
String s1 = null;
|
||||
Map<String, String> ret = null;
|
||||
//// Map<String, String> loadret = findPattern(address, "(东侧|南段|中段|以东|以西|西侧|东段)+(\\d+)?",0);
|
||||
//// Map<String, String> loadret = findPattern(address, "(东侧|南段|中段|以东|以西|西侧|东段)+(\\d+)?",0);
|
||||
//// if(loadret.size()==0){
|
||||
//// loadret = findPattern(address, "(路北|街道|大道北|大道中|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁|东侧|南段|中段|以东|以西|西侧|东段)+\\d+",0);
|
||||
//// loadret = findPattern(address, "(路北|街道|大道北|大道中|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁|东侧|南段|中段|以东|以西|西侧|东段)+\\d+",0);
|
||||
//// }
|
||||
//
|
||||
//// if(loadret.size()==0){
|
||||
//// loadret = findPattern(address, "(.*?)(路北|街道|大道北|大道中|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁|东侧|南段|中段|以东|以西|西侧|东段)+",0);
|
||||
//// loadret = findPattern(address, "(.*?)(路北|街道|大道北|大道中|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁|东侧|南段|中段|以东|以西|西侧|东段)+",0);
|
||||
//// }
|
||||
String[] keywords = {"东侧","南段","中段","以东","以西","西侧","东段","路北","街道","大道北","大道中","交界处","交界","办事处","地块","片区","大道","路南","路东","路北","路西","路","街","道","巷","组","旁"};
|
||||
String[] keywords = {"东侧","南段","中段","以东","以西","西侧","东段","路北","街道","大道北","大道中","交界处","交界","办事处","地块","片区","大道","路南","路东","路北","路西","路","街","道","巷","组","旁"};
|
||||
Map<String, String> loadret = selectRoad(keywords, address);
|
||||
s1 = loadret.get("match");
|
||||
|
||||
if(null != s1){
|
||||
s1 = address.substring(0, address.indexOf(s1)+s1.length());
|
||||
s3 = address.substring(address.indexOf(s1)+s1.length());
|
||||
if(s3.startsWith("号")||s3.startsWith("-")){
|
||||
s1 = s1 + "号";
|
||||
if(s3.startsWith("号")||s3.startsWith("-")){
|
||||
s1 = s1 + "号";
|
||||
s3 = s3.substring(1);
|
||||
}else if(s3.startsWith("栋")){
|
||||
Map<String,String> m = findPattern(s1, "[路北|街道|大道北|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁]+(\\d+)",0);
|
||||
}else if(s3.startsWith("栋")){
|
||||
Map<String,String> m = findPattern(s1, "[路北|街道|大道北|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁]+(\\d+)",0);
|
||||
String num = m.get("num1");
|
||||
if(StringUtils.isNotBlank(num)){
|
||||
s1 = s1.substring(0, s1.indexOf(num));
|
||||
s3 = num + s3;
|
||||
}
|
||||
}else if(s3.startsWith("弄")){
|
||||
s1 = s1 + "弄";
|
||||
}else if(s3.startsWith("弄")){
|
||||
s1 = s1 + "弄";
|
||||
s3 = s3.substring(1);
|
||||
}else if(s3.startsWith("组")){
|
||||
s1 = s1 + "组";
|
||||
}else if(s3.startsWith("组")){
|
||||
s1 = s1 + "组";
|
||||
s3 = s3.substring(1);
|
||||
}else{
|
||||
Map<String,String> m = findPattern(s1, ".*(\\d+)",0);
|
||||
String num = m.get("num1");
|
||||
if(num!=null&&s1.endsWith(num)){
|
||||
s1 = s1 + "号";
|
||||
s1 = s1 + "号";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,144 +179,144 @@ public class AddressParserUtils {
|
||||
|
||||
|
||||
if(s3 != null){
|
||||
if(s3.startsWith("栋")){
|
||||
ret = findPattern(s3, "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
if(s3.startsWith("栋")){
|
||||
ret = findPattern(s3, "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num3");
|
||||
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(\\d+|\\w+|\\S)单元(.*?)层(\\d{1,5})号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(\\d+|\\w+|\\S)单元(.*?)层(\\d{1,5})号", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(\\d+|\\w+|\\S)单元(.*?)层(\\d{1,5})号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(\\d+|\\w+|\\S)单元(.*?)层(\\d{1,5})号", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num4");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)+[号楼|栋|幢](.*?)层(\\d+|\\w+|\\S)单元(\\d{1,5})号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(.*?)层(\\d+|\\w+|\\S)单元(\\d{1,5})号", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)+[号楼|栋|幢](.*?)层(\\d+|\\w+|\\S)单元(\\d{1,5})号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|栋|幢]+(.*?)层(\\d+|\\w+|\\S)单元(\\d{1,5})号", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num3");
|
||||
roomNum = ret.get("num4");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+|\\w+|\\S|.*)单元(\\d+)层(西\\w{0,1}|东\\w{0,1}|南\\w{0,1}|北\\w{0,1}|\\d+)[号|户]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+|\\w+|\\S|.*)单元(\\d+)层(西\\w{0,1}|东\\w{0,1}|南\\w{0,1}|北\\w{0,1}|\\d+)[号|户]?", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+|\\w+|\\S|.*)单元(\\d+)层(西\\w{0,1}|东\\w{0,1}|南\\w{0,1}|北\\w{0,1}|\\d+)[号|户]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+|\\w+|\\S|.*)单元(\\d+)层(西\\w{0,1}|东\\w{0,1}|南\\w{0,1}|北\\w{0,1}|\\d+)[号|户]?", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num4");
|
||||
}else if(findPattern(s3, "(\\d+)[号楼|幢]+(\\d+)单元(\\d+)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[号楼|幢]+(\\d+)单元(\\d+)[号|户]", 0);
|
||||
}else if(findPattern(s3, "(\\d+)[号楼|幢]+(\\d+)单元(\\d+)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[号楼|幢]+(\\d+)单元(\\d+)[号|户]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+[东|南|西|北]?(\\d+)单元(西|东|南|北|\\d+)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+[东|南|西|北]?(\\d+)单元(西|东|南|北|\\d+)[号|户]", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+[东|南|西|北]?(\\d+)单元(西|东|南|北|\\d+)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+[东|南|西|北]?(\\d+)单元(西|东|南|北|\\d+)[号|户]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(.*?)单元(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(.*?)单元(\\d{3,5})", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(.*?)单元(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(.*?)单元(\\d{3,5})", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+)层(\\d{1,5}|南|西|北|东)[号|户|室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+)层(\\d{1,5}|南|西|北|东)[号|户|室]", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+)层(\\d{1,5}|南|西|北|东)[号|户|室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[号楼|幢]+(\\d+)层(\\d{1,5}|南|西|北|东)[号|户|室]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\w+)[号楼|幢|栋](\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[号楼|幢|栋](\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0);
|
||||
}else if(findPattern(s3, "(\\w+)[号楼|幢|栋](\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[号楼|幢|栋](\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0);
|
||||
unitNum = ret.get("num3");
|
||||
roomNum = ret.get("num4");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[#|幢|栋|号|#楼]+(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[#|幢|栋|号|#楼]+(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[#|幢|栋|号|#楼]+(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[#|幢|栋|号|#楼]+(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0);
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\d+)幢(\\d+|\\w+)号(.*)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)幢(\\d+|\\w+)号(.*)?[室]", 0);
|
||||
}else if(findPattern(s3, "(\\d+)幢(\\d+|\\w+)号(.*)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)幢(\\d+|\\w+)号(.*)?[室]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5}[、|,|,]?\\d{3,5}?)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5}[、|,|,]?\\d{3,5}?)?[室]", 0);
|
||||
}else if(findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5}[、|,|,]?\\d{3,5}?)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5}[、|,|,]?\\d{3,5}?)?[室]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5})[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5})[室]", 0);
|
||||
}else if(findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5})[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)[#|幢|-](\\d{3,5})[室]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)号(.*)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)号(.*)?[室]", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)号(.*)?[室]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)号(.*)?[室]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[#楼|号楼]+(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[#楼|号楼]+(\\d{3,5})", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+)[#楼|号楼]+(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+)[#楼|号楼]+(\\d{3,5})", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\w+)[组团|组]+(\\d+)[#|幢|-](\\d{3,5})[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[组团|组]+(\\d+)[#|幢|-](\\d{3,5})[室]?", 0);
|
||||
}else if(findPattern(s3, "(\\w+)[组团|组]+(\\d+)[#|幢|-](\\d{3,5})[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[组团|组]+(\\d+)[#|幢|-](\\d{3,5})[室]?", 0);
|
||||
houseNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+\\S{1}\\d+)[#|幢](\\d{3,5})[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+\\S{1}\\d+)[#|幢](\\d{3,5})[室]?", 0);
|
||||
}else if(findPattern(s3, "(\\d+\\S{1}\\d+)[#|幢](\\d{3,5})[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+\\S{1}\\d+)[#|幢](\\d{3,5})[室]?", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\w+)座(\\d+)单元(\\d+)层(南|西|北|东)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)座(\\d+)单元(\\d+)层(南|西|北|东)[号|户]", 0);
|
||||
}else if(findPattern(s3, "(\\w+)座(\\d+)单元(\\d+)层(南|西|北|东)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)座(\\d+)单元(\\d+)层(南|西|北|东)[号|户]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num4");
|
||||
}else if(findPattern(s3, "(\\w+)座(\\d+)层(南|西|北|东)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)座(\\d+)层(南|西|北|东)[号|户]", 0);
|
||||
}else if(findPattern(s3, "(\\w+)座(\\d+)层(南|西|北|东)[号|户]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)座(\\d+)层(南|西|北|东)[号|户]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+)座(\\d+|\\w+|\\S)单元", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)座(\\d+|\\w+|\\S)单元", 0);
|
||||
}else if(findPattern(s3, "(\\d+)座(\\d+|\\w+|\\S)单元", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)座(\\d+|\\w+|\\S)单元", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)单元((\\d+)层\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d+)层(\\d+)号", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)单元((\\d+)层\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d+)层(\\d+)号", 0);
|
||||
unitNum = ret.get("num1");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)单元(\\d{1,5})[室|号]", 0);
|
||||
unitNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d+)-(\\d{3,5})[室|号]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d+)-(\\d{3,5})[室|号]?", 0);
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d+)-(\\d{3,5})[室|号]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d+)-(\\d{3,5})[室|号]?", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d+|\\w+|\\S)单元(.*?)室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d+|\\w+|\\S)单元(.*?)室",0);
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d+|\\w+|\\S)单元(.*?)室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d+|\\w+|\\S)单元(.*?)室",0);
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(s3,"(\\d+|\\w+|甲\\d+|甲-\\d+)[#|幢|栋|号](\\d{3,5}[、|,]?\\d{3,5}?)?[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|甲\\d+|甲-\\d+)[#|幢|栋|号](\\d{3,5}[、|,]?\\d{3,5}?)?[室]?", 0);
|
||||
}else if(findPattern(s3,"(\\d+|\\w+|甲\\d+|甲-\\d+)[#|幢|栋|号](\\d{3,5}[、|,]?\\d{3,5}?)?[室]?", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|甲\\d+|甲-\\d+)[#|幢|栋|号](\\d{3,5}[、|,]?\\d{3,5}?)?[室]?", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d{3,5}[、|,]?\\d{3,5}?)?室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d{3,5}[、|,]?\\d{3,5}?)?室",0);
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d{3,5}[、|,]?\\d{3,5}?)?室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d{3,5}[、|,]?\\d{3,5}?)?室",0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d{3,5})室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d{3,5})室",0);
|
||||
}else if(findPattern(s3, "(\\w+)幢(\\d{3,5})室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)幢(\\d{3,5})室",0);
|
||||
roomNum = ret.get("num2");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\w+)号(.*?)室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)号(.*?)室",0);
|
||||
}else if(findPattern(s3, "(\\w+)号(.*?)室",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)号(.*?)室",0);
|
||||
roomNum = ret.get("num2");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\w+)[#楼|座]+(.*?)单元",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#楼|座]+(.*?)单元",0);
|
||||
}else if(findPattern(s3, "(\\w+)[#楼|座]+(.*?)单元",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#楼|座]+(.*?)单元",0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0);
|
||||
}else if(findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元(\\d+)号", 0);
|
||||
unitNum = ret.get("num2");
|
||||
roomNum = ret.get("num3");
|
||||
}else if(findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元", 0);
|
||||
}else if(findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+)层(\\d+|\\w+|\\S)单元", 0);
|
||||
unitNum = ret.get("num2");
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)[单元|座]+", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)[单元|座]+", 0);
|
||||
}else if(findPattern(s3, "(\\d+|\\w+|\\S)[单元|座]+", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|\\w+|\\S)[单元|座]+", 0);
|
||||
unitNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\w{1,3})-(\\w{1,3})-(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w{1,3})-(\\w{1,3})-(\\d{3,5})", 0);
|
||||
@@ -328,11 +328,11 @@ public class AddressParserUtils {
|
||||
ret = findPattern(s3, "(\\w{1,3})-(\\d{3,5})", 0);
|
||||
roomNum = ret.get("num2");
|
||||
houseNum = ret.get("num1");
|
||||
}else if(findPattern(address, "(\\w{3,5}[、|,]?\\d{3,5}?)室", 0).size()>0){
|
||||
ret = findPattern(address, "(\\w{3,5}[、|,]?\\d{3,5}?)室", 0);
|
||||
}else if(findPattern(address, "(\\w{3,5}[、|,]?\\d{3,5}?)室", 0).size()>0){
|
||||
ret = findPattern(address, "(\\w{3,5}[、|,]?\\d{3,5}?)室", 0);
|
||||
roomNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\d{3,5})室", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d{3,5})室", 0);
|
||||
}else if(findPattern(s3, "(\\d{3,5})室", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d{3,5})室", 0);
|
||||
roomNum = ret.get("num1");
|
||||
}else if(findPattern(s3, "(\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\d{3,5})", 0);
|
||||
@@ -347,15 +347,15 @@ public class AddressParserUtils {
|
||||
String s4 = ret.get("match");
|
||||
if(StringUtils.isNotBlank(s4)){
|
||||
String s = s3.substring(0, s3.indexOf(s4));
|
||||
if(s.indexOf("号")!=-1){
|
||||
if(s.indexOf("号")!=-1){
|
||||
if(s1==null){
|
||||
s1 = s.substring(0, s.indexOf("号")+1);
|
||||
s2 = s.substring(s.indexOf("号")+1);
|
||||
s1 = s.substring(0, s.indexOf("号")+1);
|
||||
s2 = s.substring(s.indexOf("号")+1);
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
s2 = s.replace("(", "").replace(")", "");
|
||||
s2 = s.replace("(", "").replace(")", "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -368,8 +368,8 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(roomNum)&&roomNum.indexOf("室")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("室"));
|
||||
if(StringUtils.isNotBlank(roomNum)&&roomNum.indexOf("室")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("室"));
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(s1)&&StringUtils.isBlank(s2)){
|
||||
@@ -419,46 +419,46 @@ public class AddressParserUtils {
|
||||
|
||||
String floorNum = null;
|
||||
Map<String, String> ret = null;
|
||||
String[] keywords = {"东侧","西侧","南侧","北侧","南段","东段","中段","西段","五段","以东","以西","街道","大道北","大道西","大道中","交界处","交界","办事处","片区","大道","交口","夜市","对面","后面","路","街","道","巷","旁","米","镇"};
|
||||
String[] keywords = {"东侧","西侧","南侧","北侧","南段","东段","中段","西段","五段","以东","以西","街道","大道北","大道西","大道中","交界处","交界","办事处","片区","大道","交口","夜市","对面","后面","路","街","道","巷","旁","米","镇"};
|
||||
|
||||
Map<String, String> loadret = selectRoad(keywords, address);
|
||||
s1 = loadret.get("match");
|
||||
int prefixIndex = 1000;
|
||||
|
||||
if(null != s1){
|
||||
if(address.indexOf("支弄")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("支弄") + 2);
|
||||
s3 = address.substring(address.indexOf("支弄") + 2);
|
||||
if(address.indexOf("支弄")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("支弄") + 2);
|
||||
s3 = address.substring(address.indexOf("支弄") + 2);
|
||||
}else{
|
||||
s1 = address.substring(0, address.indexOf(s1)+s1.length());
|
||||
s3 = address.substring(address.lastIndexOf(s1)+s1.length());
|
||||
if(s3.startsWith("号院")||s3.startsWith("号大院")){
|
||||
s1 = s1 + "号院";
|
||||
if(s3.startsWith("号院")||s3.startsWith("号大院")){
|
||||
s1 = s1 + "号院";
|
||||
s3 = s3.substring(2);
|
||||
}else if(s3.startsWith("号")||s3.startsWith("-")){
|
||||
s1 = s1 + "号";
|
||||
}else if(s3.startsWith("号")||s3.startsWith("-")){
|
||||
s1 = s1 + "号";
|
||||
s3 = s3.substring(1);
|
||||
}else if(s3.startsWith("栋")){
|
||||
Map<String,String> m = findPattern(s1, "[路北|街道|大道北|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁]+(\\d+)",0);
|
||||
}else if(s3.startsWith("栋")){
|
||||
Map<String,String> m = findPattern(s1, "[路北|街道|大道北|交界处|交界|办事处|地块|片区|大道|路|街|道|巷|组|旁]+(\\d+)",0);
|
||||
String num = m.get("num1");
|
||||
if(StringUtils.isNotBlank(num)){
|
||||
s1 = s1.substring(0, s1.indexOf(num));
|
||||
s3 = num + s3;
|
||||
}
|
||||
}else if(s3.startsWith("弄")){
|
||||
s1 = s1 + "弄";
|
||||
}else if(s3.startsWith("弄")){
|
||||
s1 = s1 + "弄";
|
||||
s3 = s3.substring(1);
|
||||
}else if(s3.startsWith("组")){
|
||||
s1 = s1 + "组";
|
||||
}else if(s3.startsWith("组")){
|
||||
s1 = s1 + "组";
|
||||
s3 = s3.substring(1);
|
||||
}else if(s3.startsWith("区")){
|
||||
s1 = s1 + "区";
|
||||
}else if(s3.startsWith("区")){
|
||||
s1 = s1 + "区";
|
||||
s3 = s3.substring(1);
|
||||
}else{
|
||||
Map<String,String> m = findPattern(s1, ".*(\\d+)",0);
|
||||
String num = m.get("num1");
|
||||
if(!s1.endsWith("米") && num!=null && s1.endsWith(num)){
|
||||
s1 = s1 + "号";
|
||||
if(!s1.endsWith("米") && num!=null && s1.endsWith(num)){
|
||||
s1 = s1 + "号";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,38 +466,38 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
if(s3 == null){
|
||||
if(address.indexOf("号大院")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("号大院")+3);
|
||||
s3 = address.substring(address.indexOf("号大院")+3);
|
||||
}else if (address.indexOf("号院")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("号院")+2);
|
||||
s3 = address.substring(address.indexOf("号院")+2);
|
||||
if(address.indexOf("号大院")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("号大院")+3);
|
||||
s3 = address.substring(address.indexOf("号大院")+3);
|
||||
}else if (address.indexOf("号院")!=-1){
|
||||
s1 = address.substring(0, address.indexOf("号院")+2);
|
||||
s3 = address.substring(address.indexOf("号院")+2);
|
||||
}else{
|
||||
s3 = address;
|
||||
}
|
||||
}
|
||||
|
||||
if(s3 != null){
|
||||
if(s3.startsWith("栋")){
|
||||
// TODO 这里好像有问题
|
||||
ret = findPattern(s3, "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
houseNum = ret.get("num1"); // num1是楼层?
|
||||
unitNum = ret.get("num3"); // num3是房号?
|
||||
if(s3.startsWith("栋")){
|
||||
// TODO 这里好像有问题
|
||||
ret = findPattern(s3, "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
houseNum = ret.get("num1"); // num1是楼层?
|
||||
unitNum = ret.get("num3"); // num3是房号?
|
||||
}else{
|
||||
|
||||
//栋号
|
||||
//栋号
|
||||
|
||||
// TODO ? \\w 改成\\S
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)号?楼",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)号?楼", 0);
|
||||
// TODO ? \\w 改成\\S
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)号?楼",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)号?楼", 0);
|
||||
houseNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
if(findPattern(s3, "第(.*?)[幢|栋]",0).size()>0){
|
||||
ret = findPattern(s3, "第(.*?)[幢|栋]", 0);
|
||||
if(findPattern(s3, "第(.*?)[幢|栋]",0).size()>0){
|
||||
ret = findPattern(s3, "第(.*?)[幢|栋]", 0);
|
||||
houseNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -505,8 +505,8 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)[#|栋|幢|棟]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)[#|栋|幢|棟]+", 0);
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)[#|栋|幢|棟]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)[#|栋|幢|棟]+", 0);
|
||||
houseNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -514,41 +514,41 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(findPattern(s3, "(\\d+|一|二|三|四|五|六|七|八|九|十)楼",0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|一|二|三|四|五|六|七|八|九|十)楼", 0);
|
||||
if(findPattern(s3, "(\\d+|一|二|三|四|五|六|七|八|九|十)楼",0).size()>0){
|
||||
ret = findPattern(s3, "(\\d+|一|二|三|四|五|六|七|八|九|十)楼", 0);
|
||||
floorNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
//室号
|
||||
if(findPattern(s3, "(\\w+|东|南|西|北)[室|房|户]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|东|南|西|北)[室|房|户]+", 0);
|
||||
//室号
|
||||
if(findPattern(s3, "(\\w+|东|南|西|北)[室|房|户]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|东|南|西|北)[室|房|户]+", 0);
|
||||
roomNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
if(findPattern(s3, "(\\w+)[门|梯]",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "(\\w+)[门|梯]", 0);
|
||||
if(findPattern(s3, "(\\w+)[门|梯]",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "(\\w+)[门|梯]", 0);
|
||||
unitNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
if(findPattern(s3, "(\\w+)组",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "(\\w+)组", 0);
|
||||
if(findPattern(s3, "(\\w+)组",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "(\\w+)组", 0);
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)单元",0).size()>0 ){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)单元", 0);
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)单元",0).size()>0 ){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)单元", 0);
|
||||
String sNum = ret.get("num1");
|
||||
if(isNumber(sNum)){
|
||||
int num = Integer.parseInt(sNum);
|
||||
@@ -564,8 +564,8 @@ public class AddressParserUtils {
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
if(findPattern(s3, "(\\w+|东|南|西|北|一|二|三|四|五|六|七|八|九|十)[幢|座]",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|东|南|西|北|一|二|三|四|五|六|七|八|九|十)[幢|座]", 0);
|
||||
if(findPattern(s3, "(\\w+|东|南|西|北|一|二|三|四|五|六|七|八|九|十)[幢|座]",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|东|南|西|北|一|二|三|四|五|六|七|八|九|十)[幢|座]", 0);
|
||||
|
||||
if(StringUtils.isNotBlank(houseNum)&&StringUtils.isBlank(unitNum)){
|
||||
unitNum = ret.get("num1");
|
||||
@@ -580,8 +580,8 @@ public class AddressParserUtils {
|
||||
|
||||
|
||||
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)层",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)层", 0);
|
||||
if(findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)层",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|一|二|三|四|五|六|七|八|九|十)层", 0);
|
||||
floorNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -597,8 +597,8 @@ public class AddressParserUtils {
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
|
||||
}else if(findPattern(s3, "(\\w{1,3})[-号](\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w{1,3})[-号](\\d{3,5})", 0);
|
||||
}else if(findPattern(s3, "(\\w{1,3})[-号](\\d{3,5})", 0).size()>0){
|
||||
ret = findPattern(s3, "(\\w{1,3})[-号](\\d{3,5})", 0);
|
||||
roomNum = ret.get("num2");
|
||||
if(StringUtils.isNotBlank(houseNum)){
|
||||
unitNum = ret.get("num1");
|
||||
@@ -611,11 +611,11 @@ public class AddressParserUtils {
|
||||
}
|
||||
}
|
||||
|
||||
//单元201
|
||||
if(findPattern(s3, "单元(\\w+)[^层]",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "单元(\\w+)[^层]", 0);
|
||||
roomNum = ret.get("match").replace("单元", "");
|
||||
if(!roomNum.endsWith("至") && !roomNum.endsWith("-") && !roomNum.endsWith("楼")){
|
||||
//单元201
|
||||
if(findPattern(s3, "单元(\\w+)[^层]",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "单元(\\w+)[^层]", 0);
|
||||
roomNum = ret.get("match").replace("单元", "");
|
||||
if(!roomNum.endsWith("至") && !roomNum.endsWith("-") && !roomNum.endsWith("楼")){
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
@@ -625,16 +625,16 @@ public class AddressParserUtils {
|
||||
|
||||
}
|
||||
|
||||
if(findPattern(s3, "楼(\\w+)$",0).size()>0&& s3.indexOf("办公楼")==-1&& s3.indexOf("写字楼")==-1&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "楼(\\w+)$", 0);
|
||||
roomNum = ret.get("match").replace("楼", "");
|
||||
if(findPattern(s3, "楼(\\w+)$",0).size()>0&& s3.indexOf("办公楼")==-1&& s3.indexOf("写字楼")==-1&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "楼(\\w+)$", 0);
|
||||
roomNum = ret.get("match").replace("楼", "");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
|
||||
if(findPattern(s3, "座((\\w+)[^梯|门|层|单])?",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "座((\\w+)[^梯|门|层|单])?", 0);
|
||||
if(findPattern(s3, "座((\\w+)[^梯|门|层|单])?",0).size()>0&& StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "座((\\w+)[^梯|门|层|单])?", 0);
|
||||
roomNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -642,8 +642,8 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(findPattern(s3, "梯(\\d{3,5})",0).size()>0 && StringUtils.isBlank(unitNum)){
|
||||
ret = findPattern(s3, "(\\w+)梯(\\d{3,5})", 0);
|
||||
if(findPattern(s3, "梯(\\d{3,5})",0).size()>0 && StringUtils.isBlank(unitNum)){
|
||||
ret = findPattern(s3, "(\\w+)梯(\\d{3,5})", 0);
|
||||
if(ret.size() >0){
|
||||
unitNum = ret.get("num1");
|
||||
if(StringUtils.isBlank(roomNum)){
|
||||
@@ -656,9 +656,9 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
}
|
||||
//层号
|
||||
if(findPattern(s3, "层(\\w+)",0).size()>0 && StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "层(\\w+)", 0);
|
||||
//层号
|
||||
if(findPattern(s3, "层(\\w+)",0).size()>0 && StringUtils.isBlank(roomNum)){
|
||||
ret = findPattern(s3, "层(\\w+)", 0);
|
||||
roomNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -666,17 +666,17 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(s1) && (s1.indexOf("号")!=-1||s1.endsWith("弄")) && s3.indexOf("号")!=-1 && StringUtils.isBlank(houseNum)){
|
||||
if(findPattern(s3, "(\\w+|甲\\w+)号",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|甲\\w+)号", 0);
|
||||
if(StringUtils.isNotBlank(s1) && (s1.indexOf("号")!=-1||s1.endsWith("弄")) && s3.indexOf("号")!=-1 && StringUtils.isBlank(houseNum)){
|
||||
if(findPattern(s3, "(\\w+|甲\\w+)号",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+|甲\\w+)号", 0);
|
||||
houseNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(findPattern(s3, "(\\w+)号",0).size()>0 && StringUtils.isBlank(houseNum)){
|
||||
ret = findPattern(s3, "(\\w+)号", 0);
|
||||
if(findPattern(s3, "(\\w+)号",0).size()>0 && StringUtils.isBlank(houseNum)){
|
||||
ret = findPattern(s3, "(\\w+)号", 0);
|
||||
houseNum = ret.get("num1");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
@@ -685,15 +685,15 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
|
||||
if(findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)[单元|梯|号]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)[单元|梯|号]+", 0);
|
||||
if(findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)[单元|梯|号]+",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)[单元|梯|号]+", 0);
|
||||
houseNum = ret.get("num1");
|
||||
unitNum = ret.get("num2");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
prefixIndex = s3.indexOf(ret.get("match"));
|
||||
}
|
||||
}else if(findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)", 0);
|
||||
}else if(findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)",0).size()>0){
|
||||
ret = findPattern(s3, "(\\w+)[#|栋|幢]+(\\d{3,5}|\\w+)", 0);
|
||||
houseNum = ret.get("num1");
|
||||
roomNum = ret.get("num2");
|
||||
if(s3.indexOf(ret.get("match"))<prefixIndex){
|
||||
@@ -701,11 +701,11 @@ public class AddressParserUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// 奉贤区南桥镇古华A区20幢407号401室
|
||||
// 奉贤区南桥镇古华A区20幢407号401室
|
||||
if(prefixIndex != 1000){
|
||||
s2 = s3.substring(0, prefixIndex);
|
||||
if(findPattern(s2, "(\\w+)[号|街坊]+",0).size()>0){
|
||||
ret = findPattern(s2, "(\\w+)[号|街坊]+",0);
|
||||
if(findPattern(s2, "(\\w+)[号|街坊]+",0).size()>0){
|
||||
ret = findPattern(s2, "(\\w+)[号|街坊]+",0);
|
||||
String match = ret.get("match");
|
||||
if(StringUtils.isBlank(s1)){
|
||||
s1 = s2.substring(0, s2.indexOf(match)+match.length());
|
||||
@@ -723,11 +723,11 @@ public class AddressParserUtils {
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(roomNum)){
|
||||
if(roomNum.indexOf("室")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("室"));
|
||||
if(roomNum.indexOf("室")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("室"));
|
||||
}
|
||||
if(roomNum.indexOf("号")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("号"));
|
||||
if(roomNum.indexOf("号")!=-1){
|
||||
roomNum = roomNum.substring(0, roomNum.indexOf("号"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -750,7 +750,7 @@ public class AddressParserUtils {
|
||||
|
||||
if(StringUtils.isBlank(s2) && prefixIndex != 0 && StringUtils.isNotBlank(s3)){
|
||||
ret = findPattern(s3, "[\u4E00-\u9FFF]+(\\w+)", 0);
|
||||
if(ret.size()>0 && !ret.get("match").startsWith("号")){
|
||||
if(ret.size()>0 && !ret.get("match").startsWith("号")){
|
||||
String ma = ret.get("num1");
|
||||
s2 = s3.substring(0, s3.indexOf(ma));
|
||||
}else{
|
||||
@@ -761,7 +761,7 @@ public class AddressParserUtils {
|
||||
s2 = filterName(s2);
|
||||
|
||||
if(StringUtils.isNotBlank(s2)){
|
||||
s2 = s2.replace(")", "").replace("(", "").replace("【", "").replace("】", "");
|
||||
s2 = s2.replace(")", "").replace("(", "").replace("【", "").replace("】", "");
|
||||
if(s2.length()<=2||s2.length()>15){
|
||||
s2 = "";
|
||||
}
|
||||
@@ -792,7 +792,7 @@ public class AddressParserUtils {
|
||||
public static String filterName(String s){
|
||||
if(StringUtils.isNotBlank(s)){
|
||||
|
||||
String[] words = {"小区","厦","期","苑","花园","家园","广场","公寓","宿舍","家属院","号院","居","阳光","城"};
|
||||
String[] words = {"小区","厦","期","苑","花园","家园","广场","公寓","宿舍","家属院","号院","居","阳光","城"};
|
||||
for(String word : words){
|
||||
if(s.indexOf(word)!=-1){
|
||||
s = s.substring(0, s.indexOf(word)+word.length());
|
||||
@@ -800,7 +800,7 @@ public class AddressParserUtils {
|
||||
}
|
||||
}
|
||||
|
||||
String[] names = {"综合楼", "综合","之一", "之二","小区"};
|
||||
String[] names = {"综合楼", "综合","之一", "之二","小区"};
|
||||
for(String name : names){
|
||||
if(s.equals(name)){
|
||||
s = "";
|
||||
@@ -879,12 +879,12 @@ public class AddressParserUtils {
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//selectUnitNum("福州市鼓楼区温泉街道树汤路60号蔚蓝雅园(原盛亚豪苑)3#楼702单元");
|
||||
// System.out.println(filteLoopInfo("南京市白下区苜蓿园东街4号06幢504室"));
|
||||
//selectUnitNum("福州市鼓楼区温泉街道树汤路60号蔚蓝雅园(原盛亚豪苑)3#楼702单元");
|
||||
// System.out.println(filteLoopInfo("南京市白下区苜蓿园东街4号06幢504室"));
|
||||
//
|
||||
// System.out.println(selectHouseNumAndRoom2(filteSpecialChar("南京市白下区苜蓿园东街4号06幢504室")));
|
||||
// System.out.println(selectHouseNumAndRoom2(filteSpecialChar("南京市白下区苜蓿园东街4号06幢504室")));
|
||||
|
||||
Map<String, String> ret = findPattern("栋12层5单元102号", "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
Map<String, String> ret = findPattern("栋12层5单元102号", "栋(\\d+)层(\\d+)单元(\\d+)号", 0);
|
||||
|
||||
for (String k : ret.keySet()) {
|
||||
System.out.println(k + ": " + ret.get(k));
|
||||
|
||||
@@ -10,154 +10,154 @@ public class AnalyTitleUtil {
|
||||
// public static String getTitle(String cat) {
|
||||
// String name = "";
|
||||
// if ("sell".equals(cat)) {
|
||||
// name = "二手房总量";
|
||||
// name = "二手房总量";
|
||||
// } else if ("rent".equals(cat)) {
|
||||
// name = "租房总量";
|
||||
// name = "租房总量";
|
||||
// } else if ("sellSuc".equals(cat)) {
|
||||
// name = "二手房成功量";
|
||||
// name = "二手房成功量";
|
||||
// } else if ("sellSave".equals(cat)) {
|
||||
// name = "二手房新增量";
|
||||
// name = "二手房新增量";
|
||||
// } else if ("sellUpdate".equals(cat)) {
|
||||
// name = "二手房更新量";
|
||||
// name = "二手房更新量";
|
||||
// } else if ("sellGiveUp".equals(cat)) {
|
||||
// name = "二手房放弃量";
|
||||
// name = "二手房放弃量";
|
||||
// } else if ("rentSuc".equals(cat)) {
|
||||
// name = "租房成功量";
|
||||
// name = "租房成功量";
|
||||
// } else if ("rentSave".equals(cat)) {
|
||||
// name = "租房新增量";
|
||||
// name = "租房新增量";
|
||||
// } else if ("rentUpdate".equals(cat)) {
|
||||
// name = "租房更新量";
|
||||
// name = "租房更新量";
|
||||
// } else if ("rentGiveUp".equals(cat)) {
|
||||
// name = "租房放弃量";
|
||||
// name = "租房放弃量";
|
||||
// } else if ("officeSell".equals(cat)) {
|
||||
// name = "写字楼出售总量";
|
||||
// name = "写字楼出售总量";
|
||||
// } else if ("officeRent".equals(cat)) {
|
||||
// name = "写字楼出租总量";
|
||||
// name = "写字楼出租总量";
|
||||
// } else if ("shopSell".equals(cat)) {
|
||||
// name = "商铺出售总量";
|
||||
// name = "商铺出售总量";
|
||||
// } else if ("shopRent".equals(cat)) {
|
||||
// name = "商铺出租总量";
|
||||
// name = "商铺出租总量";
|
||||
// } else if ("officeSellSuc".equals(cat)) {
|
||||
// name = "写字楼出售成功量";
|
||||
// name = "写字楼出售成功量";
|
||||
// } else if ("officeSellSave".equals(cat)) {
|
||||
// name = "写字楼出售新增量";
|
||||
// name = "写字楼出售新增量";
|
||||
// } else if ("officeSellUpdate".equals(cat)) {
|
||||
// name = "写字楼出售更新量";
|
||||
// name = "写字楼出售更新量";
|
||||
// } else if ("officeSellGiveUp".equals(cat)) {
|
||||
// name = "写字楼出售放弃量";
|
||||
// name = "写字楼出售放弃量";
|
||||
// } else if ("shopSellSuc".equals(cat)) {
|
||||
// name = "商铺出售成功量";
|
||||
// name = "商铺出售成功量";
|
||||
// } else if ("shopSellSave".equals(cat)) {
|
||||
// name = "商铺出售新增量";
|
||||
// name = "商铺出售新增量";
|
||||
// } else if ("shopSellUpdate".equals(cat)) {
|
||||
// name = "商铺出售更新量";
|
||||
// name = "商铺出售更新量";
|
||||
// } else if ("shopSellGiveUp".equals(cat)) {
|
||||
// name = "商铺出售放弃量";
|
||||
// name = "商铺出售放弃量";
|
||||
// } else if ("officeRentSuc".equals(cat)) {
|
||||
// name = "写字楼出租成功量";
|
||||
// name = "写字楼出租成功量";
|
||||
// } else if ("officeRentSave".equals(cat)) {
|
||||
// name = "写字楼出租新增量";
|
||||
// name = "写字楼出租新增量";
|
||||
// } else if ("officeRentUpdate".equals(cat)) {
|
||||
// name = "写字楼出租更新量";
|
||||
// name = "写字楼出租更新量";
|
||||
// } else if ("officeRentGiveUp".equals(cat)) {
|
||||
// name = "写字楼出租放弃量";
|
||||
// name = "写字楼出租放弃量";
|
||||
// } else if ("shopRentSuc".equals(cat)) {
|
||||
// name = "商铺出租成功量";
|
||||
// name = "商铺出租成功量";
|
||||
// } else if ("shopRentSave".equals(cat)) {
|
||||
// name = "商铺出租新增量";
|
||||
// name = "商铺出租新增量";
|
||||
// } else if ("shopRentUpdate".equals(cat)) {
|
||||
// name = "商铺出租更新量";
|
||||
// name = "商铺出租更新量";
|
||||
// } else if ("shopRentGiveUp".equals(cat)) {
|
||||
// name = "商铺出租放弃量";
|
||||
// name = "商铺出租放弃量";
|
||||
// } else if ("sellFail".equals(cat)) {
|
||||
// name = "二手房错误总量";
|
||||
// name = "二手房错误总量";
|
||||
// } else if ("sellError".equals(cat)) {
|
||||
// name = "二手房解析错误量";
|
||||
// name = "二手房解析错误量";
|
||||
// } else if ("sellFilter".equals(cat)) {
|
||||
// name = "二手房规则过滤量";
|
||||
// name = "二手房规则过滤量";
|
||||
// } else if ("rentFail".equals(cat)) {
|
||||
// name = "租房错误总量";
|
||||
// name = "租房错误总量";
|
||||
// } else if ("rentError".equals(cat)) {
|
||||
// name = "租房解析错误量";
|
||||
// name = "租房解析错误量";
|
||||
// } else if ("rentFilter".equals(cat)) {
|
||||
// name = "租房规则过滤量";
|
||||
// name = "租房规则过滤量";
|
||||
// } else if ("officeSellFail".equals(cat)) {
|
||||
// name = "写字楼出售错误总量";
|
||||
// name = "写字楼出售错误总量";
|
||||
// } else if ("officeSellError".equals(cat)) {
|
||||
// name = "写字楼出售解析错误量";
|
||||
// name = "写字楼出售解析错误量";
|
||||
// } else if ("officeSellFilter".equals(cat)) {
|
||||
// name = "写字楼出售规则过滤量";
|
||||
// name = "写字楼出售规则过滤量";
|
||||
// } else if ("shopSellFail".equals(cat)) {
|
||||
// name = "商铺出售错误总量";
|
||||
// name = "商铺出售错误总量";
|
||||
// } else if ("shopSellError".equals(cat)) {
|
||||
// name = "商铺出售解析错误量";
|
||||
// name = "商铺出售解析错误量";
|
||||
// } else if ("shopSellFilter".equals(cat)) {
|
||||
// name = "商铺出售规则过滤量";
|
||||
// name = "商铺出售规则过滤量";
|
||||
// } else if ("officeRentFail".equals(cat)) {
|
||||
// name = "写字楼出租错误总量";
|
||||
// name = "写字楼出租错误总量";
|
||||
// } else if ("officeRentError".equals(cat)) {
|
||||
// name = "写字楼出租解析错误量";
|
||||
// name = "写字楼出租解析错误量";
|
||||
// } else if ("officeRentFilter".equals(cat)) {
|
||||
// name = "写字楼出租规则过滤量";
|
||||
// name = "写字楼出租规则过滤量";
|
||||
// } else if ("shopRentFail".equals(cat)) {
|
||||
// name = "商铺出租错误总量";
|
||||
// name = "商铺出租错误总量";
|
||||
// } else if ("shopRentError".equals(cat)) {
|
||||
// name = "商铺出租解析错误量";
|
||||
// name = "商铺出租解析错误量";
|
||||
// } else if ("shopRentFilter".equals(cat)) {
|
||||
// name = "商铺出租规则过滤量";
|
||||
// name = "商铺出租规则过滤量";
|
||||
// }
|
||||
// return name;
|
||||
// }
|
||||
|
||||
static {
|
||||
TITLE_MAP.put("sell", "二手房总量");
|
||||
TITLE_MAP.put("rent", "租房总量");
|
||||
TITLE_MAP.put("sellSuc", "二手房成功量");
|
||||
TITLE_MAP.put("sellSave", "二手房新增量");
|
||||
TITLE_MAP.put("sellUpdate", "二手房更新量");
|
||||
TITLE_MAP.put("sellGiveUp", "二手房放弃量");
|
||||
TITLE_MAP.put("rentSuc", "租房成功量");
|
||||
TITLE_MAP.put("rentSave", "租房新增量");
|
||||
TITLE_MAP.put("rentUpdate", "租房更新量");
|
||||
TITLE_MAP.put("rentGiveUp", "租房放弃量");
|
||||
TITLE_MAP.put("officeSell", "写字楼出售总量");
|
||||
TITLE_MAP.put("officeRent", "写字楼出租总量");
|
||||
TITLE_MAP.put("shopSell", "商铺出售总量");
|
||||
TITLE_MAP.put("shopRent", "商铺出租总量");
|
||||
TITLE_MAP.put("officeSellSuc", "写字楼出售成功量");
|
||||
TITLE_MAP.put("officeSellSave", "写字楼出售新增量");
|
||||
TITLE_MAP.put("officeSellUpdate", "写字楼出售更新量");
|
||||
TITLE_MAP.put("officeSellGiveUp", "写字楼出售放弃量");
|
||||
TITLE_MAP.put("shopSellSuc", "商铺出售成功量");
|
||||
TITLE_MAP.put("shopSellSave", "商铺出售新增量");
|
||||
TITLE_MAP.put("shopSellUpdate", "商铺出售更新量");
|
||||
TITLE_MAP.put("shopSellGiveUp", "商铺出售放弃量");
|
||||
TITLE_MAP.put("officeRentSuc", "写字楼出租成功量");
|
||||
TITLE_MAP.put("officeRentSave", "写字楼出租新增量");
|
||||
TITLE_MAP.put("officeRentUpdate", "写字楼出租更新量");
|
||||
TITLE_MAP.put("officeRentGiveUp", "写字楼出租放弃量");
|
||||
TITLE_MAP.put("shopRentSuc", "商铺出租成功量");
|
||||
TITLE_MAP.put("shopRentSave", "商铺出租新增量");
|
||||
TITLE_MAP.put("shopRentUpdate", "商铺出租更新量");
|
||||
TITLE_MAP.put("shopRentGiveUp", "商铺出租放弃量");
|
||||
TITLE_MAP.put("sellFail", "二手房错误总量");
|
||||
TITLE_MAP.put("sellError", "二手房解析错误量");
|
||||
TITLE_MAP.put("sellFilter", "二手房规则过滤量");
|
||||
TITLE_MAP.put("rentFail", "租房错误总量");
|
||||
TITLE_MAP.put("rentError", "租房解析错误量");
|
||||
TITLE_MAP.put("rentFilter", "租房规则过滤量");
|
||||
TITLE_MAP.put("officeSellFail", "写字楼出售错误总量");
|
||||
TITLE_MAP.put("officeSellError", "写字楼出售解析错误量");
|
||||
TITLE_MAP.put("officeSellFilter", "写字楼出售规则过滤量");
|
||||
TITLE_MAP.put("shopSellFail", "商铺出售错误总量");
|
||||
TITLE_MAP.put("shopSellError", "商铺出售解析错误量");
|
||||
TITLE_MAP.put("shopSellFilter", "商铺出售规则过滤量");
|
||||
TITLE_MAP.put("officeRentFail", "写字楼出租错误总量");
|
||||
TITLE_MAP.put("officeRentError", "写字楼出租解析错误量");
|
||||
TITLE_MAP.put("officeRentFilter", "写字楼出租规则过滤量");
|
||||
TITLE_MAP.put("shopRentFail", "商铺出租错误总量");
|
||||
TITLE_MAP.put("shopRentError", "商铺出租解析错误量");
|
||||
TITLE_MAP.put("shopRentFilter", "商铺出租规则过滤量");
|
||||
TITLE_MAP.put("sell", "二手房总量");
|
||||
TITLE_MAP.put("rent", "租房总量");
|
||||
TITLE_MAP.put("sellSuc", "二手房成功量");
|
||||
TITLE_MAP.put("sellSave", "二手房新增量");
|
||||
TITLE_MAP.put("sellUpdate", "二手房更新量");
|
||||
TITLE_MAP.put("sellGiveUp", "二手房放弃量");
|
||||
TITLE_MAP.put("rentSuc", "租房成功量");
|
||||
TITLE_MAP.put("rentSave", "租房新增量");
|
||||
TITLE_MAP.put("rentUpdate", "租房更新量");
|
||||
TITLE_MAP.put("rentGiveUp", "租房放弃量");
|
||||
TITLE_MAP.put("officeSell", "写字楼出售总量");
|
||||
TITLE_MAP.put("officeRent", "写字楼出租总量");
|
||||
TITLE_MAP.put("shopSell", "商铺出售总量");
|
||||
TITLE_MAP.put("shopRent", "商铺出租总量");
|
||||
TITLE_MAP.put("officeSellSuc", "写字楼出售成功量");
|
||||
TITLE_MAP.put("officeSellSave", "写字楼出售新增量");
|
||||
TITLE_MAP.put("officeSellUpdate", "写字楼出售更新量");
|
||||
TITLE_MAP.put("officeSellGiveUp", "写字楼出售放弃量");
|
||||
TITLE_MAP.put("shopSellSuc", "商铺出售成功量");
|
||||
TITLE_MAP.put("shopSellSave", "商铺出售新增量");
|
||||
TITLE_MAP.put("shopSellUpdate", "商铺出售更新量");
|
||||
TITLE_MAP.put("shopSellGiveUp", "商铺出售放弃量");
|
||||
TITLE_MAP.put("officeRentSuc", "写字楼出租成功量");
|
||||
TITLE_MAP.put("officeRentSave", "写字楼出租新增量");
|
||||
TITLE_MAP.put("officeRentUpdate", "写字楼出租更新量");
|
||||
TITLE_MAP.put("officeRentGiveUp", "写字楼出租放弃量");
|
||||
TITLE_MAP.put("shopRentSuc", "商铺出租成功量");
|
||||
TITLE_MAP.put("shopRentSave", "商铺出租新增量");
|
||||
TITLE_MAP.put("shopRentUpdate", "商铺出租更新量");
|
||||
TITLE_MAP.put("shopRentGiveUp", "商铺出租放弃量");
|
||||
TITLE_MAP.put("sellFail", "二手房错误总量");
|
||||
TITLE_MAP.put("sellError", "二手房解析错误量");
|
||||
TITLE_MAP.put("sellFilter", "二手房规则过滤量");
|
||||
TITLE_MAP.put("rentFail", "租房错误总量");
|
||||
TITLE_MAP.put("rentError", "租房解析错误量");
|
||||
TITLE_MAP.put("rentFilter", "租房规则过滤量");
|
||||
TITLE_MAP.put("officeSellFail", "写字楼出售错误总量");
|
||||
TITLE_MAP.put("officeSellError", "写字楼出售解析错误量");
|
||||
TITLE_MAP.put("officeSellFilter", "写字楼出售规则过滤量");
|
||||
TITLE_MAP.put("shopSellFail", "商铺出售错误总量");
|
||||
TITLE_MAP.put("shopSellError", "商铺出售解析错误量");
|
||||
TITLE_MAP.put("shopSellFilter", "商铺出售规则过滤量");
|
||||
TITLE_MAP.put("officeRentFail", "写字楼出租错误总量");
|
||||
TITLE_MAP.put("officeRentError", "写字楼出租解析错误量");
|
||||
TITLE_MAP.put("officeRentFilter", "写字楼出租规则过滤量");
|
||||
TITLE_MAP.put("shopRentFail", "商铺出租错误总量");
|
||||
TITLE_MAP.put("shopRentError", "商铺出租解析错误量");
|
||||
TITLE_MAP.put("shopRentFilter", "商铺出租规则过滤量");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class AnalyticsUtil {
|
||||
private static final Logger LOG = Logger.getLogger(AnalyticsUtil.class.getPackage().getName());
|
||||
|
||||
/**
|
||||
* 增加跟踪信息数据
|
||||
* 增加跟踪信息数据
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
@@ -40,7 +40,7 @@ public class AnalyticsUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 在通过Apache,Squid等反向代理软件时获得用户的真实IP.
|
||||
* 在通过Apache,Squid等反向代理软件时获得用户的真实IP.
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
@@ -83,7 +83,7 @@ public class AnalyticsUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是需要被忽略的IP
|
||||
* 是否是需要被忽略的IP
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ public class AnalyticsUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到本地机器名
|
||||
* 得到本地机器名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -113,7 +113,7 @@ public class AnalyticsUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数对应的Cookie值
|
||||
* 获取参数对应的Cookie值
|
||||
*
|
||||
* @param httpRequest
|
||||
* @param parameter
|
||||
@@ -156,7 +156,7 @@ public class AnalyticsUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到编码过的URI 把URI从iso-8859-1转换成UTF-8
|
||||
* 得到编码过的URI 把URI从iso-8859-1转换成UTF-8
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 异步运行线程
|
||||
* 异步运行线程
|
||||
*
|
||||
* @author xiaoyu
|
||||
*
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.fangjia.core.util;
|
||||
|
||||
public class AvmUrls {
|
||||
/**
|
||||
* 商铺出售评估及样例房源
|
||||
* 商铺出售评估及样例房源
|
||||
*/
|
||||
public static final String SHOPSELL_EVALUATE = "/avmWeb/shopSell";
|
||||
|
||||
|
||||
/**
|
||||
* 商铺出租评估及样例房源
|
||||
* 商铺出租评估及样例房源
|
||||
*/
|
||||
public static final String SHOPRENT_EVALUATE = "/avmWeb/shopRent";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 百度API服务调用工具类
|
||||
* 百度API服务调用工具类
|
||||
* Created by wenyan on 2015/4/15.
|
||||
*/
|
||||
public class BaiDuApiUtils {
|
||||
@@ -27,13 +27,13 @@ public class BaiDuApiUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 区域检索POI服务
|
||||
* @param region 城市或者区域
|
||||
* @param query 检索关键字
|
||||
* @param tag 标签项 例如:住宅区,小区,别墅,别墅,写字楼
|
||||
* @param scope 检索结果详细程度 1:基本信息 2:详细信息
|
||||
* @param pageSize 每页最大记录数
|
||||
* @param pageNum 分页页码 0 1 2 ...
|
||||
* 区域检索POI服务
|
||||
* @param region 城市或者区域
|
||||
* @param query 检索关键字
|
||||
* @param tag 标签项 例如:住宅区,小区,别墅,别墅,写字楼
|
||||
* @param scope 检索结果详细程度 1:基本信息 2:详细信息
|
||||
* @param pageSize 每页最大记录数
|
||||
* @param pageNum 分页页码 0 1 2 ...
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject search(String region,String query,String tag ,int scope,Integer pageSize,Integer pageNum){
|
||||
@@ -99,7 +99,7 @@ public class BaiDuApiUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务
|
||||
* 提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务
|
||||
* @param location
|
||||
* @param address
|
||||
* @return
|
||||
@@ -164,7 +164,7 @@ public class BaiDuApiUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该城市范围内经纬度所在的区域
|
||||
* 获取该城市范围内经纬度所在的区域
|
||||
* @param city
|
||||
* @param lng
|
||||
* @param lat
|
||||
@@ -189,7 +189,7 @@ public class BaiDuApiUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取经纬度所在的城市
|
||||
* 获取经纬度所在的城市
|
||||
* @param lng
|
||||
* @param lat
|
||||
* @return
|
||||
@@ -201,7 +201,7 @@ public class BaiDuApiUtils {
|
||||
if(geoResult.containsKey("addressComponent")){
|
||||
String city = geoResult.getJSONObject("addressComponent").getString("city");
|
||||
if(StringUtils.isNotBlank(city)) {
|
||||
if(city.endsWith("市")) {
|
||||
if(city.endsWith("市")) {
|
||||
return city.substring(0, city.length() - 1);
|
||||
}else {
|
||||
return city;
|
||||
@@ -274,7 +274,7 @@ public class BaiDuApiUtils {
|
||||
}
|
||||
return json.getJSONArray("result").getJSONObject(0);
|
||||
}catch (Exception e){
|
||||
System.out.println("错误:"+result);
|
||||
System.out.println("错误:"+result);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
@@ -343,14 +343,14 @@ public class BaiDuApiUtils {
|
||||
|
||||
public synchronized static void changeAK(){
|
||||
if(!HAS_AVAILABLE_AK){
|
||||
throw new RuntimeException("无可用百度AK");
|
||||
throw new RuntimeException("无可用百度AK");
|
||||
}
|
||||
System.out.println("更换AK");
|
||||
System.out.println("更换AK");
|
||||
for(int i = 0 ;i < AKS.length; i++){
|
||||
if(i == AKS.length - 1){
|
||||
AK = AKS[0];
|
||||
HAS_AVAILABLE_AK = false;
|
||||
throw new RuntimeException("无可用百度AK");
|
||||
throw new RuntimeException("无可用百度AK");
|
||||
}else{
|
||||
if(AK.equals(AKS[i])){
|
||||
AK = AKS[i + 1];
|
||||
@@ -415,10 +415,10 @@ public class BaiDuApiUtils {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// System.out.println(getRegionByGeo("上海",121.43163,31.341042));
|
||||
// System.out.println(getRegionByGeo("北京",121.402336,31.254335));
|
||||
// System.out.println(geocode("北京", "方恒国际中心A座").toString());
|
||||
// System.out.println(geocoder(null, "上海市辖区场北张异宅15号"));
|
||||
// System.out.println(getRegionByGeo("上海",121.43163,31.341042));
|
||||
// System.out.println(getRegionByGeo("北京",121.402336,31.254335));
|
||||
// System.out.println(geocode("北京", "方恒国际中心A座").toString());
|
||||
// System.out.println(geocoder(null, "上海市辖区场北张异宅15号"));
|
||||
// System.out.println(getCityByGeo(118.36335,34.04937));
|
||||
System.out.println(getAddressByKeyword(34.04937,118.36335));
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ public class BeanUtils {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(BeanUtils.class);
|
||||
|
||||
/**
|
||||
* 复制 source 属性 到 target
|
||||
* 复制 source 属性 到 target
|
||||
*
|
||||
* 数据类型 参数名 不同 忽略
|
||||
* 数据类型 参数名 不同 忽略
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
@@ -52,7 +52,7 @@ public class BeanUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制JSON对象属性到target
|
||||
* 复制JSON对象属性到target
|
||||
*
|
||||
* @param source
|
||||
* @param target
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.fangjia.core.util.AsyncThread.Call;
|
||||
|
||||
|
||||
/**
|
||||
* 布隆过滤器
|
||||
* 布隆过滤器
|
||||
*
|
||||
* @author xiaoyu
|
||||
*
|
||||
@@ -34,7 +34,7 @@ public class BloomFilter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 每隔一分钟保存
|
||||
// 每隔一分钟保存
|
||||
new AsyncThread(30 * 1000, new Call() {
|
||||
public void invoke() {
|
||||
saveBit();
|
||||
@@ -131,7 +131,7 @@ public class BloomFilter {
|
||||
bits = (BitSet) ois.readObject();
|
||||
ois.close();
|
||||
|
||||
// 合并文件中已有的记录和新记录
|
||||
// 合并文件中已有的记录和新记录
|
||||
this.bits.or(bits);
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
|
||||
@@ -13,16 +13,16 @@ import java.util.regex.Pattern;
|
||||
public class CNNMFilter {
|
||||
|
||||
private static final Character[] CN_NUMERIC = {
|
||||
'一', '二', '三', '四', '五', '六', '七', '八', '九',
|
||||
'壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖',
|
||||
'十', '百', '千', '拾', '佰', '仟', '万', '亿', '○', 'O', '零'};
|
||||
'一', '二', '三', '四', '五', '六', '七', '八', '九',
|
||||
'壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖',
|
||||
'十', '百', '千', '拾', '佰', '仟', '万', '亿', '○', 'O', '零'};
|
||||
|
||||
private static final List<Character> CM_NUMERICS = Arrays.asList(CN_NUMERIC);
|
||||
|
||||
private static Map<Character, Integer> cnNumeric = null;
|
||||
private static final String[] digits = new String[]{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
|
||||
private static final String[] radices = new String[]{"", "十", "百", "千"};
|
||||
private static final String[] bigRadices = new String[]{"", "万", "亿", "万"};
|
||||
private static final String[] digits = new String[]{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
|
||||
private static final String[] radices = new String[]{"", "十", "百", "千"};
|
||||
private static final String[] bigRadices = new String[]{"", "万", "亿", "万"};
|
||||
private static final Pattern NUMERIC_PATTERN = Pattern.compile("\\d+(\\.\\d+)?");
|
||||
|
||||
|
||||
@@ -32,33 +32,33 @@ public class CNNMFilter {
|
||||
cnNumeric.put(CN_NUMERIC[j], j + 1);
|
||||
for (int j = 9; j < 18; j++)
|
||||
cnNumeric.put(CN_NUMERIC[j], j - 8);
|
||||
cnNumeric.put('两', 2);
|
||||
cnNumeric.put('十', 10);
|
||||
cnNumeric.put('拾', 10);
|
||||
cnNumeric.put('百', 100);
|
||||
cnNumeric.put('佰', 100);
|
||||
cnNumeric.put('千', 1000);
|
||||
cnNumeric.put('仟', 1000);
|
||||
cnNumeric.put('万', 10000);
|
||||
cnNumeric.put('亿', 100000000);
|
||||
cnNumeric.put('两', 2);
|
||||
cnNumeric.put('十', 10);
|
||||
cnNumeric.put('拾', 10);
|
||||
cnNumeric.put('百', 100);
|
||||
cnNumeric.put('佰', 100);
|
||||
cnNumeric.put('千', 1000);
|
||||
cnNumeric.put('仟', 1000);
|
||||
cnNumeric.put('万', 10000);
|
||||
cnNumeric.put('亿', 100000000);
|
||||
}
|
||||
|
||||
public static String convert(String currencyDigits) {
|
||||
if(currencyDigits.length() > 11){
|
||||
return currencyDigits;
|
||||
}
|
||||
String integral; // 整数部分
|
||||
String decimal; // 小数部分
|
||||
String outputCharacters; // 最终转换输出结果
|
||||
String integral; // 整数部分
|
||||
String decimal; // 小数部分
|
||||
String outputCharacters; // 最终转换输出结果
|
||||
String d;
|
||||
int zeroCount = 0, p = 0, quotient = 0, modulus = 0;
|
||||
currencyDigits = currencyDigits.replace("/,/g", ""); // 删除数字中的逗号,
|
||||
currencyDigits = currencyDigits.replace("/^0+/", ""); // 删除数字左边的0
|
||||
String[] parts = currencyDigits.split("\\."); // 拆分数字中的整数与小数部分
|
||||
currencyDigits = currencyDigits.replace("/,/g", ""); // 删除数字中的逗号,
|
||||
currencyDigits = currencyDigits.replace("/^0+/", ""); // 删除数字左边的0
|
||||
String[] parts = currencyDigits.split("\\."); // 拆分数字中的整数与小数部分
|
||||
if (parts.length > 1) {
|
||||
integral = parts[0];
|
||||
decimal = parts[1];
|
||||
if (decimal.length() > 2) { // 如果小数部分长度大于2,四舍五入,保留两位小数
|
||||
if (decimal.length() > 2) { // 如果小数部分长度大于2,四舍五入,保留两位小数
|
||||
long dd = Math.round(Double.parseDouble("0." + decimal) * 100);
|
||||
decimal = Long.toString(dd);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class CNNMFilter {
|
||||
}
|
||||
}
|
||||
if (Double.parseDouble(decimal) > 0) for (int i = 0; i < decimal.length(); i++) d = decimal.substring(i, i + 1);
|
||||
if(outputCharacters.startsWith("一十")) {
|
||||
if(outputCharacters.startsWith("一十")) {
|
||||
outputCharacters = outputCharacters.substring(1);
|
||||
}
|
||||
return outputCharacters;
|
||||
@@ -129,12 +129,12 @@ public class CNNMFilter {
|
||||
if (cnn.length() == 1)
|
||||
return isCNNumeric(cnn.charAt(0));
|
||||
|
||||
if (flag) cnn = cnn.replace('佰', '百')
|
||||
.replace('仟', '千').replace('拾', '十').replace('零', ' ');
|
||||
if (flag) cnn = cnn.replace('佰', '百')
|
||||
.replace('仟', '千').replace('拾', '十').replace('零', ' ');
|
||||
//System.out.println(cnn);
|
||||
int yi = -1, wan = -1, qian = -1, bai = -1, shi = -1;
|
||||
int val = 0;
|
||||
yi = cnn.lastIndexOf('亿');
|
||||
yi = cnn.lastIndexOf('亿');
|
||||
if (yi > -1) {
|
||||
val += cnNumericToArabic(cnn.substring(0, yi), false) * 100000000;
|
||||
if (yi < cnn.length() - 1)
|
||||
@@ -150,7 +150,7 @@ public class CNNMFilter {
|
||||
}
|
||||
}
|
||||
|
||||
wan = cnn.lastIndexOf('万');
|
||||
wan = cnn.lastIndexOf('万');
|
||||
if (wan > -1) {
|
||||
val += cnNumericToArabic(cnn.substring(0, wan), false) * 10000;
|
||||
if (wan < cnn.length() - 1)
|
||||
@@ -165,7 +165,7 @@ public class CNNMFilter {
|
||||
}
|
||||
}
|
||||
|
||||
qian = cnn.lastIndexOf('千');
|
||||
qian = cnn.lastIndexOf('千');
|
||||
if (qian > -1) {
|
||||
val += cnNumericToArabic(cnn.substring(0, qian), false) * 1000;
|
||||
if (qian < cnn.length() - 1)
|
||||
@@ -180,7 +180,7 @@ public class CNNMFilter {
|
||||
}
|
||||
}
|
||||
|
||||
bai = cnn.lastIndexOf('百');
|
||||
bai = cnn.lastIndexOf('百');
|
||||
if (bai > -1) {
|
||||
val += cnNumericToArabic(cnn.substring(0, bai), false) * 100;
|
||||
if (bai < cnn.length() - 1)
|
||||
@@ -195,7 +195,7 @@ public class CNNMFilter {
|
||||
}
|
||||
}
|
||||
|
||||
shi = cnn.lastIndexOf('十');
|
||||
shi = cnn.lastIndexOf('十');
|
||||
if (shi > -1) {
|
||||
if (shi == 0)
|
||||
val += 1 * 10;
|
||||
@@ -243,8 +243,8 @@ public class CNNMFilter {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(convertCnNumber("1111-156号"));
|
||||
System.out.println(convertArabicToCnNumeric("申滨路1051弄1-156号"));
|
||||
System.out.println(convertCnNumber("1111-156号"));
|
||||
System.out.println(convertArabicToCnNumeric("申滨路1051弄1-156号"));
|
||||
}
|
||||
|
||||
public static int qCNNumericToArabic(String cnn) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.common.base.Function;
|
||||
import com.google.common.collect.MapMaker;
|
||||
|
||||
/**
|
||||
* 主要使用如下两个方法对cache进行处理 public static Object getValue(CachePolicyEnum
|
||||
* 主要使用如下两个方法对cache进行处理 public static Object getValue(CachePolicyEnum
|
||||
* cachePolicy, Class keyClass, String extraKey)<br>
|
||||
* public static boolean putValue(CachePolicyEnum cachePolicy, Class keyClass,
|
||||
* String extraKey, Object value)
|
||||
@@ -81,7 +81,7 @@ public class CacheUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 见 {@link #getValue(Class, Collection, CachePolicyEnum, Closure)}方法
|
||||
* 见 {@link #getValue(Class, Collection, CachePolicyEnum, Closure)}方法
|
||||
*
|
||||
* @param <V>
|
||||
* @param <K>
|
||||
@@ -198,25 +198,25 @@ public class CacheUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据region和keyList批量从缓存中取数据。<br>
|
||||
* 对于缓存中不存在的key,会调用closure的execute方法来生成数据并放入缓存中,execute方法的参数是缓存所对于的key,
|
||||
* 返回key所对应的数据。
|
||||
* 根据region和keyList批量从缓存中取数据。<br>
|
||||
* 对于缓存中不存在的key,会调用closure的execute方法来生成数据并放入缓存中,execute方法的参数是缓存所对于的key,
|
||||
* 返回key所对应的数据。
|
||||
*
|
||||
* @param <K>
|
||||
* 缓存中的key
|
||||
* 缓存中的key
|
||||
* @param <V>
|
||||
* 缓存中的数据
|
||||
* 缓存中的数据
|
||||
* @param region
|
||||
* 缓存区域
|
||||
* 缓存区域
|
||||
* @param extraKey
|
||||
* 调用处的方法名
|
||||
* 调用处的方法名
|
||||
* @param keyList
|
||||
* 缓存key列表
|
||||
* 缓存key列表
|
||||
* @param cachePolicy
|
||||
* 缓存策略
|
||||
* 缓存策略
|
||||
* @param closure
|
||||
* 对于缓存中不存在的key,会调用closure的execute方法来生成数据并放入缓存中,
|
||||
* execute方法的参数是缓存所对于的key,返回key所对应的数据。
|
||||
* 对于缓存中不存在的key,会调用closure的execute方法来生成数据并放入缓存中,
|
||||
* execute方法的参数是缓存所对于的key,返回key所对应的数据。
|
||||
* @return
|
||||
*/
|
||||
public static <K, V> Map<K, V> getValues(Class<?> region, String extraKey, Collection<K> keyList,
|
||||
@@ -272,7 +272,7 @@ public class CacheUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// 缓存中没有的数据,调用方法获取
|
||||
// 缓存中没有的数据,调用方法获取
|
||||
if (!nullValueKeys.isEmpty()) {
|
||||
Map<K, V> exeRet = closure.execute(nullValueKeys);
|
||||
if (null != exeRet) {
|
||||
@@ -308,7 +308,7 @@ public class CacheUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 供CacheThread调用
|
||||
* 供CacheThread调用
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
@@ -374,7 +374,7 @@ public class CacheUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装memcache key 组装规则:region+"_" +city + "_" + key
|
||||
* 组装memcache key 组装规则:region+"_" +city + "_" + key
|
||||
*
|
||||
* @param regionName
|
||||
* @param key
|
||||
@@ -396,31 +396,31 @@ public class CacheUtils {
|
||||
|
||||
public static enum CachePolicyEnum {
|
||||
/**
|
||||
* 10秒
|
||||
* 10秒
|
||||
*/
|
||||
SECOND(TimeUnit.SECONDS.toMillis(10)),
|
||||
/**
|
||||
* 1分钟
|
||||
* 1分钟
|
||||
*/
|
||||
SMALL(TimeUnit.MINUTES.toMillis(1)),
|
||||
/**
|
||||
* 5分钟
|
||||
* 5分钟
|
||||
*/
|
||||
TINY(TimeUnit.MINUTES.toMillis(5)),
|
||||
/**
|
||||
* 30分钟
|
||||
* 30分钟
|
||||
*/
|
||||
SHORT(TimeUnit.MINUTES.toMillis(30)),
|
||||
/**
|
||||
* 1天
|
||||
* 1天
|
||||
*/
|
||||
MIDDLE(TimeUnit.DAYS.toMillis(1)),
|
||||
/**
|
||||
* 7天
|
||||
* 7天
|
||||
*/
|
||||
LONG(TimeUnit.DAYS.toMillis(7)),
|
||||
/**
|
||||
* 有效期为当天,过了24点后过期
|
||||
* 有效期为当天,过了24点后过期
|
||||
*/
|
||||
TODAY(0) {
|
||||
public long getCacheTime() {
|
||||
@@ -429,7 +429,7 @@ public class CacheUtils {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 本周日24点后过期
|
||||
* 本周日24点后过期
|
||||
*/
|
||||
NEXT_SUNDAY(0) {
|
||||
public long getCacheTime() {
|
||||
@@ -438,7 +438,7 @@ public class CacheUtils {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 本月底24点后过期
|
||||
* 本月底24点后过期
|
||||
*/
|
||||
NEXT_MONTH(0) {
|
||||
public long getCacheTime() {
|
||||
@@ -447,7 +447,7 @@ public class CacheUtils {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 本周六24点后过期
|
||||
* 本周六24点后过期
|
||||
*/
|
||||
NEXT_SATURDAY(0) {
|
||||
public long getCacheTime() {
|
||||
@@ -456,7 +456,7 @@ public class CacheUtils {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 有效期为当前这一小时,过了整点后过期
|
||||
* 有效期为当前这一小时,过了整点后过期
|
||||
*/
|
||||
HOUR(0) {
|
||||
public long getCacheTime() {
|
||||
@@ -465,19 +465,19 @@ public class CacheUtils {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 2个小时
|
||||
* 2个小时
|
||||
*/
|
||||
TWOHOURS(TimeUnit.HOURS.toMillis(2)),
|
||||
/**
|
||||
* 4个小时
|
||||
* 4个小时
|
||||
*/
|
||||
FOURHOURS(TimeUnit.HOURS.toMillis(4)),
|
||||
/**
|
||||
* 一个月(按30天计)
|
||||
* 一个月(按30天计)
|
||||
*/
|
||||
MONTH(TimeUnit.DAYS.toMillis(30)),
|
||||
/**
|
||||
* 5秒钟
|
||||
* 5秒钟
|
||||
*/
|
||||
MOMENT(1000 * 5);
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 聚类结果定义
|
||||
* 聚类结果定义
|
||||
*
|
||||
* @author dxy
|
||||
* @value 表示主要的聚类值
|
||||
* @secondaryValue 如果这个值存在,说明这些样本有两组相对较大的聚类,样本意见分歧较大
|
||||
* @mean 加权平均值
|
||||
* @median 中位数
|
||||
* @value 表示主要的聚类值
|
||||
* @secondaryValue 如果这个值存在,说明这些样本有两组相对较大的聚类,样本意见分歧较大
|
||||
* @mean 加权平均值
|
||||
* @median 中位数
|
||||
*/
|
||||
public final class Cluster {
|
||||
private int value;
|
||||
@@ -18,7 +18,7 @@ public final class Cluster {
|
||||
private int median;
|
||||
private Integer secondaryValue;
|
||||
|
||||
private int sampleSize; // 样本数量
|
||||
private int sampleSize; // 样本数量
|
||||
private double[][] cluters;
|
||||
|
||||
public Cluster(double[][] cluters) {
|
||||
@@ -46,7 +46,7 @@ public final class Cluster {
|
||||
mean = (int) (total / sampleSize);
|
||||
|
||||
List<Double> list = new ArrayList<Double>();
|
||||
// 如果第一个聚类超过一半,就使用这个聚类
|
||||
// 如果第一个聚类超过一半,就使用这个聚类
|
||||
if (cluters[0].length >= sampleSize * 0.5) {
|
||||
for (int i = 0; i < cluters[0].length; i++) {
|
||||
list.add(cluters[0][i]);
|
||||
@@ -59,7 +59,7 @@ public final class Cluster {
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有两个以上的聚簇,并且第二个聚簇的占比超过35%,说明改聚类有较大的分歧,所以需要把第二聚簇作为次要值考虑
|
||||
// 如果有两个以上的聚簇,并且第二个聚簇的占比超过35%,说明改聚类有较大的分歧,所以需要把第二聚簇作为次要值考虑
|
||||
if (cluters.length >= 2) {
|
||||
if (cluters[1].length >= sampleSize * 0.35) {
|
||||
long stc = 0;
|
||||
@@ -83,7 +83,7 @@ public final class Cluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 参与聚类的样本量
|
||||
* 参与聚类的样本量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -92,7 +92,7 @@ public final class Cluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 主要类簇的值的平均值
|
||||
* 主要类簇的值的平均值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ public final class Cluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有点加权平均
|
||||
* 所有点加权平均
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ public final class Cluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚类详细数据
|
||||
* 聚类详细数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -119,7 +119,7 @@ public final class Cluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 最大类簇的中位数
|
||||
* 最大类簇的中位数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -7,33 +7,33 @@ public class CodeDictionary {
|
||||
|
||||
public static final Map<Integer, String> FITMENT_CODE_MAP = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(1, "ц╚еВ");
|
||||
put(2, "╪Рв╟");
|
||||
put(3, "╬╚в╟");
|
||||
put(4, "╨юв╟");
|
||||
put(1, "毛坯");
|
||||
put(2, "简装");
|
||||
put(3, "精装");
|
||||
put(4, "豪装");
|
||||
}
|
||||
};
|
||||
|
||||
public static final Map<Integer, String> PROPERTY_TYPE_CODE_MAP = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(0, "фум╗в║у╛");
|
||||
put(1, "╠ПйШ");
|
||||
put(2, "илв║");
|
||||
put(0, "普通住宅");
|
||||
put(1, "别墅");
|
||||
put(2, "商住");
|
||||
}
|
||||
};
|
||||
|
||||
public static final Map<Integer, String> DIRECTION_CODE_MAP = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(1, "нВдо");
|
||||
put(2, "╤╚до");
|
||||
put(3, "до");
|
||||
put(4, "нВ╠╠");
|
||||
put(5, "╤╚╠╠");
|
||||
put(6, "╤╚");
|
||||
put(7, "нВ");
|
||||
put(8, "╠╠");
|
||||
put(9, "╤╚нВ");
|
||||
put(10, "до╠╠");
|
||||
put(1, "西南");
|
||||
put(2, "东南");
|
||||
put(3, "南");
|
||||
put(4, "西北");
|
||||
put(5, "东北");
|
||||
put(6, "东");
|
||||
put(7, "西");
|
||||
put(8, "北");
|
||||
put(9, "东西");
|
||||
put(10, "南北");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.fangjia.core.util;
|
||||
|
||||
public class CoordPoint {
|
||||
|
||||
private double lat;// γ¶È
|
||||
private double lng;// ¾¶È
|
||||
private double lat;// 纬度
|
||||
private double lng;// 经度
|
||||
public CoordPoint() {
|
||||
|
||||
}
|
||||
|
||||
+11
-11
@@ -8,10 +8,10 @@ public class CoordinateConversion {
|
||||
private static final double ee = 0.00669342162296594323;
|
||||
|
||||
/**
|
||||
* gg_lat 帠僅
|
||||
* gg_lon 冪僅
|
||||
* GCJ-02蛌遙BD-09
|
||||
* Google華芞冪帠僅蛌啃僅華芞冪帠僅
|
||||
* gg_lat 纬度
|
||||
* gg_lon 经度
|
||||
* GCJ-02转换BD-09
|
||||
* Google地图经纬度转百度地图经纬度
|
||||
* */
|
||||
public static CoordPoint google_bd_encrypt(double gg_lat, double gg_lon){
|
||||
CoordPoint point= new CoordPoint();
|
||||
@@ -26,10 +26,10 @@ public class CoordinateConversion {
|
||||
}
|
||||
|
||||
/**
|
||||
* wgLat 帠僅
|
||||
* wgLon 冪僅
|
||||
* BD-09蛌遙GCJ-02
|
||||
* 啃僅蛌google
|
||||
* wgLat 纬度
|
||||
* wgLon 经度
|
||||
* BD-09转换GCJ-02
|
||||
* 百度转google
|
||||
* */
|
||||
public static CoordPoint bd_google_encrypt(double bd_lat, double bd_lon){
|
||||
CoordPoint point=new CoordPoint();
|
||||
@@ -46,9 +46,9 @@ public class CoordinateConversion {
|
||||
|
||||
|
||||
/**
|
||||
* wgLat 帠僅
|
||||
* wgLon 冪僅
|
||||
* WGS-84 善 GCJ-02 腔蛌遙ㄗ撈 GPS 樓⑴ㄘ
|
||||
* wgLat 纬度
|
||||
* wgLon 经度
|
||||
* WGS-84 到 GCJ-02 的转换(即 GPS 加偏)
|
||||
* */
|
||||
public static CoordPoint wgs_gcj_encrypts(double wgLat, double wgLon) {
|
||||
CoordPoint point=new CoordPoint();
|
||||
|
||||
+20
-20
@@ -17,7 +17,7 @@ public class CosineSimilarAlgorithm {
|
||||
if (doc1.trim().length() > 0 && doc2.trim().length() > 0) {
|
||||
Map<Integer, int[]> AlgorithmMap = new HashMap<Integer, int[]>();
|
||||
|
||||
//将两个字符串中的中文字符以及出现的总数封装到,AlgorithmMap中
|
||||
//将两个字符串中的中文字符以及出现的总数封装到,AlgorithmMap中
|
||||
for (int i = 0; i < doc1.length(); i++) {
|
||||
char d1 = doc1.charAt(i);
|
||||
if(isHanZi(d1)){
|
||||
@@ -76,26 +76,26 @@ public class CosineSimilarAlgorithm {
|
||||
}
|
||||
|
||||
public static boolean isHanZi(char ch) {
|
||||
// 判断是否汉字
|
||||
// 判断是否汉字
|
||||
return (ch >= 0x4E00 && ch <= 0x9FA5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据输入的Unicode字符,获取它的GB2312编码或者ascii编码,
|
||||
* 根据输入的Unicode字符,获取它的GB2312编码或者ascii编码,
|
||||
*
|
||||
* @param ch
|
||||
* 输入的GB2312中文字符或者ASCII字符(128个)
|
||||
* @return ch在GB2312中的位置,-1表示该字符不认识
|
||||
* 输入的GB2312中文字符或者ASCII字符(128个)
|
||||
* @return ch在GB2312中的位置,-1表示该字符不认识
|
||||
*/
|
||||
public static short getGB2312Id(char ch) {
|
||||
try {
|
||||
byte[] buffer = Character.toString(ch).getBytes("GB2312");
|
||||
if (buffer.length != 2) {
|
||||
// 正常情况下buffer应该是两个字节,否则说明ch不属于GB2312编码,故返回'?',此时说明不认识该字符
|
||||
// 正常情况下buffer应该是两个字节,否则说明ch不属于GB2312编码,故返回'?',此时说明不认识该字符
|
||||
return -1;
|
||||
}
|
||||
int b0 = (int) (buffer[0] & 0x0FF) - 161; // 编码从A1开始,因此减去0xA1=161
|
||||
int b1 = (int) (buffer[1] & 0x0FF) - 161; // 第一个字符和最后一个字符没有汉字,因此每个区只收16*6-2=94个汉字
|
||||
int b0 = (int) (buffer[0] & 0x0FF) - 161; // 编码从A1开始,因此减去0xA1=161
|
||||
int b1 = (int) (buffer[1] & 0x0FF) - 161; // 第一个字符和最后一个字符没有汉字,因此每个区只收16*6-2=94个汉字
|
||||
return (short) (b0 * 94 + b1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
@@ -107,14 +107,14 @@ public class CosineSimilarAlgorithm {
|
||||
|
||||
|
||||
private static int compare(String str, String target) {
|
||||
int[][] d; // 矩阵
|
||||
int[][] d; // 矩阵
|
||||
int n = str.length();
|
||||
int m = target.length();
|
||||
int i; // 遍历str的
|
||||
int j; // 遍历target的
|
||||
char ch1; // str的
|
||||
char ch2; // target的
|
||||
int temp; // 记录相同字符,在某个矩阵位置值的增量,不是0就是1
|
||||
int i; // 遍历str的
|
||||
int j; // 遍历target的
|
||||
char ch1; // str的
|
||||
char ch2; // target的
|
||||
int temp; // 记录相同字符,在某个矩阵位置值的增量,不是0就是1
|
||||
if (n == 0) {
|
||||
return m;
|
||||
}
|
||||
@@ -122,16 +122,16 @@ public class CosineSimilarAlgorithm {
|
||||
return n;
|
||||
}
|
||||
d = new int[n + 1][m + 1];
|
||||
for (i = 0; i <= n; i++) { // 初始化第一列
|
||||
for (i = 0; i <= n; i++) { // 初始化第一列
|
||||
d[i][0] = i;
|
||||
}
|
||||
|
||||
for (j = 0; j <= m; j++) { // 初始化第一行
|
||||
for (j = 0; j <= m; j++) { // 初始化第一行
|
||||
d[0][j] = j;
|
||||
}
|
||||
for (i = 1; i <= n; i++) { // 遍历str
|
||||
for (i = 1; i <= n; i++) { // 遍历str
|
||||
ch1 = str.charAt(i - 1);
|
||||
// 去匹配target
|
||||
// 去匹配target
|
||||
for (j = 1; j <= m; j++) {
|
||||
ch2 = target.charAt(j - 1);
|
||||
if (ch1 == ch2) {
|
||||
@@ -139,7 +139,7 @@ public class CosineSimilarAlgorithm {
|
||||
} else {
|
||||
temp = 1;
|
||||
}
|
||||
// 左边+1,上边+1, 左上角+temp取最小
|
||||
// 左边+1,上边+1, 左上角+temp取最小
|
||||
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + temp);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class CosineSimilarAlgorithm {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两字符串的相似度
|
||||
* 获取两字符串的相似度
|
||||
*
|
||||
* @param str
|
||||
* @param target
|
||||
|
||||
@@ -4,20 +4,20 @@ import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
* 货币转换
|
||||
* 货币转换
|
||||
*
|
||||
*/
|
||||
public class CurrencyConverter {
|
||||
|
||||
/** 大写数字 */
|
||||
private static final String[] NUMBERS = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
|
||||
/** 整数部分的单位 */
|
||||
private static final String[] IUNIT = { "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };
|
||||
/** 小数部分的单位 */
|
||||
private static final String[] DUNIT = { "角", "分", "厘" };
|
||||
/** 大写数字 */
|
||||
private static final String[] NUMBERS = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
|
||||
/** 整数部分的单位 */
|
||||
private static final String[] IUNIT = { "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };
|
||||
/** 小数部分的单位 */
|
||||
private static final String[] DUNIT = { "角", "分", "厘" };
|
||||
|
||||
/**
|
||||
* 得到大写金额。
|
||||
* 得到大写金额。
|
||||
*/
|
||||
public static String toChinese(String str) {
|
||||
str = str.replaceAll(",", "");
|
||||
@@ -40,18 +40,18 @@ public class CurrencyConverter {
|
||||
}
|
||||
}
|
||||
if (integerStr.length() > IUNIT.length) {
|
||||
System.out.println(str + ":超出处理能力");
|
||||
System.out.println(str + ":超出处理能力");
|
||||
return str;
|
||||
}
|
||||
|
||||
int[] integers = toArray(integerStr);// 整数部分数字
|
||||
boolean isMust5 = isMust5(integerStr);// 设置万单位
|
||||
int[] decimals = toArray(decimalStr);// 小数部分数字
|
||||
int[] integers = toArray(integerStr);// 整数部分数字
|
||||
boolean isMust5 = isMust5(integerStr);// 设置万单位
|
||||
int[] decimals = toArray(decimalStr);// 小数部分数字
|
||||
return getChineseInteger(integers, isMust5) + getChineseDecimal(decimals);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整数部分和小数部分转换为数组,从高位至低位
|
||||
* 整数部分和小数部分转换为数组,从高位至低位
|
||||
*/
|
||||
private static int[] toArray(String number) {
|
||||
int[] array = new int[number.length()];
|
||||
@@ -62,25 +62,25 @@ public class CurrencyConverter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的整数部分。
|
||||
* 得到中文金额的整数部分。
|
||||
*/
|
||||
private static String getChineseInteger(int[] integers, boolean isMust5) {
|
||||
StringBuffer chineseInteger = new StringBuffer("");
|
||||
int length = integers.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
// 0出现在关键位置:1234(万)5678(亿)9012(万)3456(元)
|
||||
// 特殊情况:10(拾元、壹拾元、壹拾万元、拾万元)
|
||||
// 0出现在关键位置:1234(万)5678(亿)9012(万)3456(元)
|
||||
// 特殊情况:10(拾元、壹拾元、壹拾万元、拾万元)
|
||||
String key = "";
|
||||
if (integers[i] == 0) {
|
||||
if ((length - i) == 13)// 万(亿)(必填)
|
||||
if ((length - i) == 13)// 万(亿)(必填)
|
||||
key = IUNIT[4];
|
||||
else if ((length - i) == 9)// 亿(必填)
|
||||
else if ((length - i) == 9)// 亿(必填)
|
||||
key = IUNIT[8];
|
||||
else if ((length - i) == 5 && isMust5)// 万(不必填)
|
||||
else if ((length - i) == 5 && isMust5)// 万(不必填)
|
||||
key = IUNIT[4];
|
||||
else if ((length - i) == 1)// 元(必填)
|
||||
else if ((length - i) == 1)// 元(必填)
|
||||
key = IUNIT[0];
|
||||
// 0遇非0时补零,不包含最后一位
|
||||
// 0遇非0时补零,不包含最后一位
|
||||
if ((length - i) > 1 && integers[i + 1] != 0)
|
||||
key += NUMBERS[0];
|
||||
}
|
||||
@@ -90,12 +90,12 @@ public class CurrencyConverter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的小数部分。
|
||||
* 得到中文金额的小数部分。
|
||||
*/
|
||||
private static String getChineseDecimal(int[] decimals) {
|
||||
StringBuffer chineseDecimal = new StringBuffer("");
|
||||
for (int i = 0; i < decimals.length; i++) {
|
||||
// 舍去3位小数之后的
|
||||
// 舍去3位小数之后的
|
||||
if (i == 3)
|
||||
break;
|
||||
chineseDecimal.append(decimals[i] == 0 ? "" : (NUMBERS[decimals[i]] + DUNIT[i]));
|
||||
@@ -104,14 +104,14 @@ public class CurrencyConverter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断第5位数字的单位"万"是否应加。
|
||||
* 判断第5位数字的单位"万"是否应加。
|
||||
*/
|
||||
private static boolean isMust5(String integerStr) {
|
||||
int length = integerStr.length();
|
||||
if (length > 4) {
|
||||
String subInteger = "";
|
||||
if (length > 8) {
|
||||
// 取得从低位数,第5到第8位的字串
|
||||
// 取得从低位数,第5到第8位的字串
|
||||
subInteger = integerStr.substring(length - 8, length - 4);
|
||||
} else {
|
||||
subInteger = integerStr.substring(0, length - 4);
|
||||
@@ -123,7 +123,7 @@ public class CurrencyConverter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化数字为千分位显示
|
||||
* 格式化数字为千分位显示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -5,20 +5,20 @@ import java.util.*;
|
||||
|
||||
public class DataCluster {
|
||||
|
||||
// 聚类桶宽百分比
|
||||
// 聚类桶宽百分比
|
||||
public static final int CLUSTER_PERCENT = 5;
|
||||
// 聚类中最小的成员数
|
||||
// 聚类中最小的成员数
|
||||
public static final int MIN_SUPPORT_COUNT = 3;
|
||||
// 聚类中最大值与最小值的比差
|
||||
// 聚类中最大值与最小值的比差
|
||||
public static final double HIGH_DIFFERENCE_PERCENT = 1.2;
|
||||
// 小区聚类的最小聚类簇个数
|
||||
// 小区聚类的最小聚类簇个数
|
||||
public static final int MIN_CLUSTER_COUNT = 1;
|
||||
// 区域聚类的聚类簇个数
|
||||
// 区域聚类的聚类簇个数
|
||||
public static final int REGION_CLUSTER_SIZE = 3;
|
||||
|
||||
|
||||
/**
|
||||
* 聚类算法
|
||||
* 聚类算法
|
||||
*
|
||||
* @param values
|
||||
* @return List<Cluster>
|
||||
@@ -45,16 +45,16 @@ public class DataCluster {
|
||||
/**
|
||||
*
|
||||
* @param allAvgs
|
||||
* 数值列表
|
||||
* 数值列表
|
||||
* @param minCluster
|
||||
* 最少聚出的类个数
|
||||
* 最少聚出的类个数
|
||||
* @param percent
|
||||
* 聚类间距
|
||||
* 聚类间距
|
||||
* @param minSize
|
||||
* 聚类中最小的成员数
|
||||
* 聚类中最小的成员数
|
||||
* @param heightDifferencePercent
|
||||
* 如果聚类中最大值与最小值的比差,只在聚出一个类,并且最小聚类大于一的情况下使用
|
||||
* @return 聚类列表
|
||||
* 如果聚类中最大值与最小值的比差,只在聚出一个类,并且最小聚类大于一的情况下使用
|
||||
* @return 聚类列表
|
||||
*/
|
||||
private static double[][] cluster(List<Integer> allAvgs, int minCluster, int percent, int minSize,
|
||||
double heightDifferencePercent) {
|
||||
@@ -79,10 +79,10 @@ public class DataCluster {
|
||||
allClusterSep += allAvgs.get(i);
|
||||
}
|
||||
|
||||
int clusterSep = round(allClusterSep * percent * 1.0d / (100 * (allAvgs.size() - startfrom)));// 平均数量大小,总值
|
||||
compStep = round(clusterSep * 0.5);// 增量
|
||||
compAvg = allAvgs.get(startfrom) + compStep;// 初始均价大小
|
||||
startfrom_temp = startfrom;// 起始点
|
||||
int clusterSep = round(allClusterSep * percent * 1.0d / (100 * (allAvgs.size() - startfrom)));// 平均数量大小,总值
|
||||
compStep = round(clusterSep * 0.5);// 增量
|
||||
compAvg = allAvgs.get(startfrom) + compStep;// 初始均价大小
|
||||
startfrom_temp = startfrom;// 起始点
|
||||
|
||||
ArrayList<int[]> clusters = new ArrayList<int[]>();
|
||||
ArrayList<int[]> historyClusters = new ArrayList<int[]>();
|
||||
@@ -107,14 +107,14 @@ public class DataCluster {
|
||||
}
|
||||
if (end - start + 1 >= minSize) {
|
||||
historyClusters.add(new int[] { start, end });
|
||||
if (clusters.isEmpty()) {// 新加组
|
||||
if (clusters.isEmpty()) {// 新加组
|
||||
clusters.add(new int[] { start, end });
|
||||
} else {
|
||||
int[] before = clusters.get(clusters.size() - 1);
|
||||
|
||||
if (start <= before[1]) {// 合并
|
||||
if (start <= before[1]) {// 合并
|
||||
before[1] = end;
|
||||
} else {// 新加组
|
||||
} else {// 新加组
|
||||
clusters.add(new int[] { start, end });
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class DataCluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对大簇进行划分
|
||||
* 对大簇进行划分
|
||||
*
|
||||
* @param cluster
|
||||
* @param minCluster
|
||||
@@ -199,7 +199,7 @@ public class DataCluster {
|
||||
|
||||
int clusterLength = cluster.length;
|
||||
|
||||
int compStep = round(clusterSep * 0.5);// 增量
|
||||
int compStep = round(clusterSep * 0.5);// 增量
|
||||
int compAvg = allAvgs.get(cluster[0]) + compStep;
|
||||
|
||||
while (compAvg <= allAvgs.get(cluster[clusterLength - 1])) {
|
||||
@@ -245,7 +245,7 @@ public class DataCluster {
|
||||
int bs = b[1] - b[0];
|
||||
int cs = c[1] - c[0];
|
||||
|
||||
if (bs > as && bs > cs) {// 波峰
|
||||
if (bs > as && bs > cs) {// 波峰
|
||||
int avg = 0;
|
||||
for (int k = b[0]; k <= b[1]; k++) {
|
||||
avg += allAvgs.get(k);
|
||||
@@ -255,17 +255,17 @@ public class DataCluster {
|
||||
topWaveMarkCount++;
|
||||
flag = 0;
|
||||
|
||||
} else if (bs < as && bs < cs) {// 波谷
|
||||
} else if (bs < as && bs < cs) {// 波谷
|
||||
waveMark.add(new int[] { i * -1, 0 });
|
||||
bottomWaveMarkCount++;
|
||||
flag = 0;
|
||||
|
||||
} else if (bs > as && bs == cs) {// 波峰开始
|
||||
} else if (bs > as && bs == cs) {// 波峰开始
|
||||
flag = 1;
|
||||
} else if (bs < as && bs == cs) {// 波谷开始
|
||||
} else if (bs < as && bs == cs) {// 波谷开始
|
||||
flag = -1;
|
||||
} else if (flag == 1 && (bs == as && bs > cs)) {// 波峰
|
||||
// 下降通道
|
||||
} else if (flag == 1 && (bs == as && bs > cs)) {// 波峰
|
||||
// 下降通道
|
||||
int avg = 0;
|
||||
for (int k = b[0]; k <= b[1]; k++) {
|
||||
avg += allAvgs.get(k);
|
||||
@@ -275,13 +275,13 @@ public class DataCluster {
|
||||
topWaveMarkCount++;
|
||||
flag = 0;
|
||||
|
||||
} else if (flag == -1 && (bs == as && bs < cs)) {// 波谷
|
||||
// 上升通道
|
||||
} else if (flag == -1 && (bs == as && bs < cs)) {// 波谷
|
||||
// 上升通道
|
||||
waveMark.add(new int[] { i * -1, 0 });
|
||||
bottomWaveMarkCount++;
|
||||
flag = 0;
|
||||
|
||||
} else if (bs == as && bs == cs) {// 平滑区
|
||||
} else if (bs == as && bs == cs) {// 平滑区
|
||||
|
||||
} else {
|
||||
flag = 0;
|
||||
@@ -291,11 +291,11 @@ public class DataCluster {
|
||||
|
||||
List<Integer> bottomMark = new ArrayList<Integer>();
|
||||
|
||||
// 取出(minCluster-1)个波谷,断裂
|
||||
// 取出(minCluster-1)个波谷,断裂
|
||||
if (bottomWaveMarkCount > 0) {
|
||||
clusters.clear();
|
||||
|
||||
if (topWaveMarkCount > minCluster) {// 按波峰之间的距离选取聚类
|
||||
if (topWaveMarkCount > minCluster) {// 按波峰之间的距离选取聚类
|
||||
|
||||
int startIndex = 2;
|
||||
|
||||
@@ -307,12 +307,12 @@ public class DataCluster {
|
||||
int count = 0;
|
||||
for (int i = startIndex; i < waveMark.size(); i += 2) {
|
||||
|
||||
x[count][0] = waveMark.get(i)[1] - waveMark.get(i - 2)[1]; // 均价间距
|
||||
x[count][1] = i - 1; // 记录波谷位置
|
||||
x[count][0] = waveMark.get(i)[1] - waveMark.get(i - 2)[1]; // 均价间距
|
||||
x[count][1] = i - 1; // 记录波谷位置
|
||||
count++;
|
||||
}
|
||||
|
||||
// 按间距排序
|
||||
// 按间距排序
|
||||
|
||||
Arrays.sort(x, new Comparator<int[]>() {
|
||||
public int compare(int[] o1, int[] o2) {
|
||||
@@ -339,14 +339,14 @@ public class DataCluster {
|
||||
|
||||
Collections.sort(bottomMark);
|
||||
|
||||
// 合并
|
||||
// 合并
|
||||
int lastIndex = 0;
|
||||
for (int i = 0; i <= bottomMark.size(); i++) {
|
||||
|
||||
int start = Integer.MAX_VALUE;
|
||||
int end = 0;
|
||||
|
||||
// 求峰值的平均值,往两边扩散
|
||||
// 求峰值的平均值,往两边扩散
|
||||
int bottomIndex = 0;
|
||||
if (i == bottomMark.size())
|
||||
bottomIndex = waveMark.size();
|
||||
@@ -386,7 +386,7 @@ public class DataCluster {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是正数
|
||||
* 判断是否是正数
|
||||
* @return
|
||||
*/
|
||||
private static boolean isPositive(Number num) {
|
||||
|
||||
@@ -38,20 +38,20 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class DataUtil {
|
||||
public static Pattern cellPhonePattern = Pattern.compile("^(1[23456789][0-9]{1})(-)?([0-9]{8})$");// 判断是否手机号码
|
||||
public static Pattern cellPhonePattern = Pattern.compile("^(1[23456789][0-9]{1})(-)?([0-9]{8})$");// 判断是否手机号码
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(DataUtil.class);
|
||||
|
||||
public static Pattern LINK = Pattern.compile("[a-zA-z]+://[a-zA-Z0-9./%?=&-]*"); // 网址
|
||||
public static Pattern LINK = Pattern.compile("[a-zA-z]+://[a-zA-Z0-9./%?=&-]*"); // 网址
|
||||
// public static Pattern MOBILE_344 =
|
||||
// Pattern.compile("(\\d{3}-\\d{4}-\\d{4})");
|
||||
public static Pattern NUM_SERIES = Pattern.compile("(?:\\d[\\s-]*){7}");// ;连续数字
|
||||
public static Pattern NUM_SERIES = Pattern.compile("(?:\\d[\\s-]*){7}");// ;连续数字
|
||||
public static Pattern URL_SUFFIX = Pattern
|
||||
.compile("[a-zA-Z0-9.]*\\.((?:com)|(?:COM)|(?:cn)|(?:CN)|(?:net)|(?:NET))"); // 后缀
|
||||
public static Pattern IMG = Pattern.compile("<img.*src=(.*?)[^>]*?>"); // 图片链接地址
|
||||
public static Pattern OUT_TAG = Pattern.compile("</?[a-zA-Z0-9]+:[a-zA-Z0-9]+[^>]*>"); // 外部标签
|
||||
public static final Pattern WORDS = Pattern.compile(".*[a-zA-Z].*");// 是否包含字母
|
||||
.compile("[a-zA-Z0-9.]*\\.((?:com)|(?:COM)|(?:cn)|(?:CN)|(?:net)|(?:NET))"); // 后缀
|
||||
public static Pattern IMG = Pattern.compile("<img.*src=(.*?)[^>]*?>"); // 图片链接地址
|
||||
public static Pattern OUT_TAG = Pattern.compile("</?[a-zA-Z0-9]+:[a-zA-Z0-9]+[^>]*>"); // 外部标签
|
||||
public static final Pattern WORDS = Pattern.compile(".*[a-zA-Z].*");// 是否包含字母
|
||||
public static final Pattern NO_WORDS = Pattern.compile(".*[^a-zA-Z].*");
|
||||
public static String SPACIAL_PATTERN = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
|
||||
public static String SPACIAL_PATTERN = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
|
||||
public static final HanyuPinyinOutputFormat pinyinFormat = new HanyuPinyinOutputFormat();
|
||||
public static final Pattern PRICE_PATT = Pattern.compile("(\\d+)");
|
||||
public static final Pattern NUMBER = Pattern.compile("^\\d*(.\\d*)?$");
|
||||
@@ -61,7 +61,7 @@ public class DataUtil {
|
||||
|
||||
private static final String hanziReg = "[\\u4e00-\\u9fa5]";
|
||||
private static final String englishReg = "[A-Za-z]";
|
||||
public static String[] TAGS =new String[]{"独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"};
|
||||
public static String[] TAGS =new String[]{"独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"};
|
||||
|
||||
public static String replaceAll(String original, String with, Pattern... pattern) {
|
||||
if (StringUtils.isNotBlank(original)) {
|
||||
@@ -75,11 +75,11 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理指定字符串中的特殊字符
|
||||
* 清理指定字符串中的特殊字符
|
||||
*
|
||||
* 目前清理特殊字符有:手机、电话、QQ、邮箱、MSN
|
||||
* 目前清理特殊字符有:手机、电话、QQ、邮箱、MSN
|
||||
*
|
||||
* 例: 联系电话:13569335693 清理后: 联系电话:******5693
|
||||
* 例: 联系电话:13569335693 清理后: 联系电话:******5693
|
||||
*
|
||||
* @author liupei
|
||||
*/
|
||||
@@ -105,7 +105,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 产生num个[0,maxBound)区间范围内的数字
|
||||
* 产生num个[0,maxBound)区间范围内的数字
|
||||
*
|
||||
* @param num
|
||||
* @param maxBound
|
||||
@@ -127,18 +127,18 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串
|
||||
* 截取字符串
|
||||
*
|
||||
* 若原始字符串的长度小于最大截取长度,则直接返回原始字符串
|
||||
* 若原始字符串的长度小于最大截取长度,则直接返回原始字符串
|
||||
*
|
||||
* @param targetString
|
||||
* 原始字符串
|
||||
* 原始字符串
|
||||
* @param targetLength
|
||||
* 最大长度
|
||||
* 最大长度
|
||||
* @param tailLength
|
||||
* 尾巴长度
|
||||
* 尾巴长度
|
||||
* @param tailString
|
||||
* 结尾字符串
|
||||
* 结尾字符串
|
||||
* @return
|
||||
*/
|
||||
public static String cutString(String targetString, int targetLength, int tailLength, String tailString) {
|
||||
@@ -153,12 +153,12 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按字节截取字符串
|
||||
* 按字节截取字符串
|
||||
*
|
||||
* @param targetString
|
||||
* 原始字符串
|
||||
* 原始字符串
|
||||
* @param length
|
||||
* 截取长度
|
||||
* 截取长度
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
@@ -171,14 +171,14 @@ public class DataUtil {
|
||||
if (bytes.length <= length) {
|
||||
return targetString;
|
||||
} else {
|
||||
int n = 0; // 表示当前的字节数
|
||||
int i = 2; // 要截取的字节数,从第3个字节开始
|
||||
int n = 0; // 表示当前的字节数
|
||||
int i = 2; // 要截取的字节数,从第3个字节开始
|
||||
for (; i < bytes.length && n < length; i++) {
|
||||
// 奇数位置,如3、5、7等,为UCS2编码中两个字节的第二个字节
|
||||
// 奇数位置,如3、5、7等,为UCS2编码中两个字节的第二个字节
|
||||
if (i % 2 == 1) {
|
||||
n++; // 在UCS2第二个字节时n加1
|
||||
n++; // 在UCS2第二个字节时n加1
|
||||
} else {
|
||||
// 当UCS2编码的第一个字节不等于0时,该UCS2字符为汉字,一个汉字算两个字节
|
||||
// 当UCS2编码的第一个字节不等于0时,该UCS2字符为汉字,一个汉字算两个字节
|
||||
if (bytes[i] != 0) {
|
||||
n++;
|
||||
}
|
||||
@@ -186,12 +186,12 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
if (i % 2 == 1) {
|
||||
// 如果i为奇数时,处理成偶数
|
||||
// 如果i为奇数时,处理成偶数
|
||||
if (bytes[i - 1] != 0) {
|
||||
// 该UCS2字符是汉字时,去掉这个截一半的汉字
|
||||
// 该UCS2字符是汉字时,去掉这个截一半的汉字
|
||||
i = i - 1;
|
||||
} else {
|
||||
// 该UCS2字符是字母或数字,则保留该字符
|
||||
// 该UCS2字符是字母或数字,则保留该字符
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
@@ -201,9 +201,9 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化均价
|
||||
* 格式化均价
|
||||
*
|
||||
* 将个位和十位直接变为0
|
||||
* 将个位和十位直接变为0
|
||||
*
|
||||
* @param avgPirce
|
||||
* @return
|
||||
@@ -217,7 +217,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全角转半角
|
||||
* 全角转半角
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
@@ -237,7 +237,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断文本中的链接是否是fangjia,如果不是就删除
|
||||
* 判断文本中的链接是否是fangjia,如果不是就删除
|
||||
*
|
||||
* @param htmlDes
|
||||
* @return
|
||||
@@ -305,7 +305,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把字符串以16进制数值显示出来
|
||||
* 把字符串以16进制数值显示出来
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
@@ -320,7 +320,7 @@ public class DataUtil {
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
// 字节码转换成16进制字符串
|
||||
// 字节码转换成16进制字符串
|
||||
public static String byte2hex(byte bytes[]) {
|
||||
StringBuffer retString = new StringBuffer();
|
||||
for (int i = 0; i < bytes.length; ++i) {
|
||||
@@ -329,7 +329,7 @@ public class DataUtil {
|
||||
return retString.toString();
|
||||
}
|
||||
|
||||
// 将16进制字符串转换成字节码
|
||||
// 将16进制字符串转换成字节码
|
||||
public static byte[] hex2byte(String hex) {
|
||||
byte[] bts = new byte[hex.length() / 2];
|
||||
for (int i = 0; i < bts.length; i++) {
|
||||
@@ -339,7 +339,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是标准的手机号码
|
||||
* 判断是否是标准的手机号码
|
||||
*
|
||||
* @param phoneNum
|
||||
* @return
|
||||
@@ -401,7 +401,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉str中的html标记
|
||||
* 去掉str中的html标记
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
@@ -415,10 +415,10 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除特殊字符串
|
||||
* 去除特殊字符串
|
||||
*
|
||||
* <p>
|
||||
* 特殊字符串定义:html,&*;,\[a-z]
|
||||
* 特殊字符串定义:html,&*;,\[a-z]
|
||||
* </p>
|
||||
*
|
||||
* @param str
|
||||
@@ -437,7 +437,7 @@ public class DataUtil {
|
||||
public static Pattern nameTags = Pattern.compile("</?([^>]*)(\\s|$|>)");
|
||||
|
||||
/**
|
||||
* 去除html中不完整的标签
|
||||
* 去除html中不完整的标签
|
||||
*
|
||||
* @param html
|
||||
* @return
|
||||
@@ -519,10 +519,10 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 四舍五入
|
||||
* 四舍五入
|
||||
*
|
||||
* @param dSource
|
||||
* 浮点数
|
||||
* 浮点数
|
||||
* @return
|
||||
*/
|
||||
public static int getRound(double dSource) {
|
||||
@@ -550,8 +550,8 @@ public class DataUtil {
|
||||
return decimalFormat.parse(decimalFormat.format(n)).doubleValue();
|
||||
}
|
||||
|
||||
public static List<String> SENSITIVE_WORDS = Arrays.asList("上门服务", "小姐", "冰毒", "手枪", "疏通", "掏粪", "污水", "办证", "公务员",
|
||||
"汽狗");
|
||||
public static List<String> SENSITIVE_WORDS = Arrays.asList("上门服务", "小姐", "冰毒", "手枪", "疏通", "掏粪", "污水", "办证", "公务员",
|
||||
"汽狗");
|
||||
|
||||
public static List<String> getSensitiveWords() {
|
||||
return SENSITIVE_WORDS;
|
||||
@@ -608,7 +608,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 将集合反向排序
|
||||
* 将集合反向排序
|
||||
*
|
||||
* @param <V>
|
||||
* @param col
|
||||
@@ -626,12 +626,12 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Value对Map进行排序
|
||||
* 根据Value对Map进行排序
|
||||
*
|
||||
* @param targetMap
|
||||
* key:Object value:Number
|
||||
* @param asc
|
||||
* true:升序 false:降序
|
||||
* true:升序 false:降序
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -690,7 +690,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取url的主域名
|
||||
* 获取url的主域名
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
@@ -711,34 +711,34 @@ public class DataUtil {
|
||||
|
||||
switch (Integer.parseInt(ca)) {
|
||||
case 0:
|
||||
ret.append("零");
|
||||
ret.append("零");
|
||||
break;
|
||||
case 1:
|
||||
ret.append("壹");
|
||||
ret.append("壹");
|
||||
break;
|
||||
case 2:
|
||||
ret.append("贰");
|
||||
ret.append("贰");
|
||||
break;
|
||||
case 3:
|
||||
ret.append("叁");
|
||||
ret.append("叁");
|
||||
break;
|
||||
case 4:
|
||||
ret.append("肆");
|
||||
ret.append("肆");
|
||||
break;
|
||||
case 5:
|
||||
ret.append("伍");
|
||||
ret.append("伍");
|
||||
break;
|
||||
case 6:
|
||||
ret.append("陆");
|
||||
ret.append("陆");
|
||||
break;
|
||||
case 7:
|
||||
ret.append("柒");
|
||||
ret.append("柒");
|
||||
break;
|
||||
case 8:
|
||||
ret.append("捌");
|
||||
ret.append("捌");
|
||||
break;
|
||||
case 9:
|
||||
ret.append("玖");
|
||||
ret.append("玖");
|
||||
break;
|
||||
default:
|
||||
ret.append(ca);
|
||||
@@ -765,31 +765,31 @@ public class DataUtil {
|
||||
ret.append("0");
|
||||
break;
|
||||
case 1:
|
||||
ret.append("一");
|
||||
ret.append("一");
|
||||
break;
|
||||
case 2:
|
||||
ret.append("二");
|
||||
ret.append("二");
|
||||
break;
|
||||
case 3:
|
||||
ret.append("三");
|
||||
ret.append("三");
|
||||
break;
|
||||
case 4:
|
||||
ret.append("四");
|
||||
ret.append("四");
|
||||
break;
|
||||
case 5:
|
||||
ret.append("五");
|
||||
ret.append("五");
|
||||
break;
|
||||
case 6:
|
||||
ret.append("六");
|
||||
ret.append("六");
|
||||
break;
|
||||
case 7:
|
||||
ret.append("七");
|
||||
ret.append("七");
|
||||
break;
|
||||
case 8:
|
||||
ret.append("八");
|
||||
ret.append("八");
|
||||
break;
|
||||
case 9:
|
||||
ret.append("九");
|
||||
ret.append("九");
|
||||
break;
|
||||
default:
|
||||
ret.append(ca);
|
||||
@@ -807,25 +807,25 @@ public class DataUtil {
|
||||
for (int i = 0; i < charArray.length; i++) {
|
||||
String ca = String.valueOf(charArray[i]);
|
||||
|
||||
if (ca.equals("零")) {
|
||||
if (ca.equals("零")) {
|
||||
ret.append("0");
|
||||
} else if (ca.equals("壹")) {
|
||||
} else if (ca.equals("壹")) {
|
||||
ret.append("1");
|
||||
} else if (ca.equals("贰")) {
|
||||
} else if (ca.equals("贰")) {
|
||||
ret.append("2");
|
||||
} else if (ca.equals("叁")) {
|
||||
} else if (ca.equals("叁")) {
|
||||
ret.append("3");
|
||||
} else if (ca.equals("肆")) {
|
||||
} else if (ca.equals("肆")) {
|
||||
ret.append("4");
|
||||
} else if (ca.equals("伍")) {
|
||||
} else if (ca.equals("伍")) {
|
||||
ret.append("5");
|
||||
} else if (ca.equals("陆")) {
|
||||
} else if (ca.equals("陆")) {
|
||||
ret.append("6");
|
||||
} else if (ca.equals("柒")) {
|
||||
} else if (ca.equals("柒")) {
|
||||
ret.append("7");
|
||||
} else if (ca.equals("捌")) {
|
||||
} else if (ca.equals("捌")) {
|
||||
ret.append("8");
|
||||
} else if (ca.equals("玖")) {
|
||||
} else if (ca.equals("玖")) {
|
||||
ret.append("9");
|
||||
} else {
|
||||
ret.append(ca);
|
||||
@@ -841,25 +841,25 @@ public class DataUtil {
|
||||
for (int i = 0; i < charArray.length; i++) {
|
||||
String ca = String.valueOf(charArray[i]);
|
||||
|
||||
if (ca.equals("零")) {
|
||||
if (ca.equals("零")) {
|
||||
ret.append("0");
|
||||
} else if (ca.equals("一")) {
|
||||
} else if (ca.equals("一")) {
|
||||
ret.append("1");
|
||||
} else if (ca.equals("二")) {
|
||||
} else if (ca.equals("二")) {
|
||||
ret.append("2");
|
||||
} else if (ca.equals("三")) {
|
||||
} else if (ca.equals("三")) {
|
||||
ret.append("3");
|
||||
} else if (ca.equals("四")) {
|
||||
} else if (ca.equals("四")) {
|
||||
ret.append("4");
|
||||
} else if (ca.equals("五")) {
|
||||
} else if (ca.equals("五")) {
|
||||
ret.append("5");
|
||||
} else if (ca.equals("六")) {
|
||||
} else if (ca.equals("六")) {
|
||||
ret.append("6");
|
||||
} else if (ca.equals("七")) {
|
||||
} else if (ca.equals("七")) {
|
||||
ret.append("7");
|
||||
} else if (ca.equals("八")) {
|
||||
} else if (ca.equals("八")) {
|
||||
ret.append("8");
|
||||
} else if (ca.equals("九")) {
|
||||
} else if (ca.equals("九")) {
|
||||
ret.append("9");
|
||||
} else {
|
||||
ret.append(ca);
|
||||
@@ -874,27 +874,27 @@ public class DataUtil {
|
||||
// return 0;
|
||||
// }
|
||||
// int result = 0;
|
||||
// int temp = 1;//存放一个单位的数字如:十万
|
||||
// int count = 0;//判断是否有chArr
|
||||
// char[] cnArr = new char[]{'一','二','三','四','五','六','七','八','九'};
|
||||
// char[] chArr = new char[]{'十','百','千','万','亿'};
|
||||
// int temp = 1;//存放一个单位的数字如:十万
|
||||
// int count = 0;//判断是否有chArr
|
||||
// char[] cnArr = new char[]{'一','二','三','四','五','六','七','八','九'};
|
||||
// char[] chArr = new char[]{'十','百','千','万','亿'};
|
||||
// for (int i = 0; i < input.length(); i++) {
|
||||
// boolean b = true;//判断是否是chArr
|
||||
// boolean b = true;//判断是否是chArr
|
||||
// char c = input.charAt(i);
|
||||
// for (int j = 0; j < cnArr.length; j++) {//非单位,即数字
|
||||
// for (int j = 0; j < cnArr.length; j++) {//非单位,即数字
|
||||
// if (c == cnArr[j]) {
|
||||
// if(0 != count){//添加下一个单位之前,先把上一个单位值添加到结果中
|
||||
// if(0 != count){//添加下一个单位之前,先把上一个单位值添加到结果中
|
||||
// result += temp;
|
||||
// temp = 1;
|
||||
// count = 0;
|
||||
// }
|
||||
// // 下标+1,就是对应的值
|
||||
// // 下标+1,就是对应的值
|
||||
// temp = j + 1;
|
||||
// b = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(b){//单位{'十','百','千','万','亿'}
|
||||
// if(b){//单位{'十','百','千','万','亿'}
|
||||
// for (int j = 0; j < chArr.length; j++) {
|
||||
// if (c == chArr[j]) {
|
||||
// switch (j) {
|
||||
@@ -920,7 +920,7 @@ public class DataUtil {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (i == input.length() - 1) {//遍历到最后一个字符
|
||||
// if (i == input.length() - 1) {//遍历到最后一个字符
|
||||
// result += temp;
|
||||
// }
|
||||
// }
|
||||
@@ -988,7 +988,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含字母
|
||||
* 是否包含字母
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
@@ -1003,7 +1003,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含非字母
|
||||
* 是否包含非字母
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
@@ -1017,7 +1017,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 避免solr中的特殊符号
|
||||
* 避免solr中的特殊符号
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
@@ -1028,7 +1028,7 @@ public class DataUtil {
|
||||
}
|
||||
keyword = encoding(keyword);
|
||||
keyword = keyword.replace("-", "");
|
||||
keyword = keyword.replace("-", "");
|
||||
keyword = keyword.replace("-", "");
|
||||
keyword = keyword.replace("\"", "");
|
||||
keyword = keyword.replaceAll(SPACIAL_PATTERN, "");
|
||||
keyword = keyword.replace("\\", " ");
|
||||
@@ -1053,7 +1053,7 @@ public class DataUtil {
|
||||
}
|
||||
s = encoding(s);
|
||||
s = s.replace("-", "");
|
||||
s = s.replace("-", "");
|
||||
s = s.replace("-", "");
|
||||
s = s.replace("\"", "");
|
||||
s = s.replaceAll(SPACIAL_PATTERN, "");
|
||||
s = s.replace("\\", " ");
|
||||
@@ -1122,7 +1122,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉语全拼
|
||||
* 汉语全拼
|
||||
*
|
||||
* @param keyword
|
||||
* @param separator
|
||||
@@ -1148,7 +1148,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉语全拼
|
||||
* 汉语全拼
|
||||
*
|
||||
* @param keyword
|
||||
* @param separator
|
||||
@@ -1200,7 +1200,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉语简拼
|
||||
* 汉语简拼
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
@@ -1222,20 +1222,20 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化板块,将"板块"字符串去掉
|
||||
* 格式化板块,将"板块"字符串去掉
|
||||
*
|
||||
* @param block
|
||||
* @return
|
||||
*/
|
||||
public static String formatBlock(String block) {
|
||||
if (StringUtils.isNotBlank(block)) {
|
||||
return block.replace("板块", "");
|
||||
return block.replace("板块", "");
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符串中汉字部分
|
||||
* 获取字符串中汉字部分
|
||||
*
|
||||
* @param s
|
||||
* @return
|
||||
@@ -1268,12 +1268,12 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查经纬度是否合法
|
||||
* 检查经纬度是否合法
|
||||
*
|
||||
* @param lat
|
||||
* 纬度为正负900000000000
|
||||
* 纬度为正负900000000000
|
||||
* @param lng
|
||||
* 经度为正负1800000000000
|
||||
* 经度为正负1800000000000
|
||||
* @return
|
||||
*/
|
||||
public static boolean verifyLatLng(Long lat, Long lng) {
|
||||
@@ -1285,12 +1285,12 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查经纬度是否合法
|
||||
* 检查经纬度是否合法
|
||||
*
|
||||
* @param lat
|
||||
* 纬度为正负90
|
||||
* 纬度为正负90
|
||||
* @param lng
|
||||
* 经度为正负180
|
||||
* 经度为正负180
|
||||
* @return
|
||||
*/
|
||||
public static boolean verifyLatLng(Double lat, Double lng) {
|
||||
@@ -1312,7 +1312,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩
|
||||
* 压缩
|
||||
*
|
||||
* @param content
|
||||
* @return
|
||||
@@ -1340,7 +1340,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压
|
||||
* 解压
|
||||
*
|
||||
* @param content
|
||||
* @return
|
||||
@@ -1410,11 +1410,11 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
public static String trim(String str) {
|
||||
return null == str ? null : str.replaceAll("^[\\s ]*|[\\s ]*$", "").replaceAll((char) 160 + "", "");
|
||||
return null == str ? null : str.replaceAll("^[\\s ]*|[\\s ]*$", "").replaceAll((char) 160 + "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配符合条件的字符串
|
||||
* 匹配符合条件的字符串
|
||||
*
|
||||
* @param str
|
||||
* @param pattern
|
||||
@@ -1432,7 +1432,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配符合条件的字符串
|
||||
* 匹配符合条件的字符串
|
||||
*
|
||||
* @param str
|
||||
* @param pattern
|
||||
@@ -1488,7 +1488,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断短字符串中的字符是否按照顺序出现在长字符串中
|
||||
* 判断短字符串中的字符是否按照顺序出现在长字符串中
|
||||
*
|
||||
* @param str1
|
||||
* @param str2
|
||||
@@ -1522,7 +1522,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行linux命令
|
||||
* 运行linux命令
|
||||
*
|
||||
* @param cmd
|
||||
* @return
|
||||
@@ -1598,7 +1598,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是正数
|
||||
* 判断是否是正数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -1683,11 +1683,11 @@ public class DataUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
static final Pattern NUMERICAL_STAGE_PATTERN = Pattern.compile("\\d+(期|区)");
|
||||
static final Pattern LETTER_STAGE_PATTERN = Pattern.compile("[A-Za-z]+\\d+(期|区)");
|
||||
static final Pattern NUMERICAL_STAGE_PATTERN = Pattern.compile("\\d+(期|区)");
|
||||
static final Pattern LETTER_STAGE_PATTERN = Pattern.compile("[A-Za-z]+\\d+(期|区)");
|
||||
|
||||
/**
|
||||
* 格式化要入库的小区名
|
||||
* 格式化要入库的小区名
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
@@ -1703,33 +1703,33 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把自己大小转成人性化的描述
|
||||
* 把自己大小转成人性化的描述
|
||||
*
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
public static String getHumanSize(long size) {
|
||||
// 如果字节数少于1024,则直接以B为单位,否则先除于1024,后3位因太少无意义
|
||||
// 如果字节数少于1024,则直接以B为单位,否则先除于1024,后3位因太少无意义
|
||||
if (size < 1024) {
|
||||
return String.valueOf(size) + "B";
|
||||
} else {
|
||||
size = size / 1024;
|
||||
}
|
||||
// 如果原字节数除于1024之后,少于1024,则可以直接以KB作为单位
|
||||
// 因为还没有到达要使用另一个单位的时候
|
||||
// 接下去以此类推
|
||||
// 如果原字节数除于1024之后,少于1024,则可以直接以KB作为单位
|
||||
// 因为还没有到达要使用另一个单位的时候
|
||||
// 接下去以此类推
|
||||
if (size < 1024) {
|
||||
return String.valueOf(size) + "KB";
|
||||
} else {
|
||||
size = size / 1024;
|
||||
}
|
||||
if (size < 1024) {
|
||||
// 因为如果以MB为单位的话,要保留最后1位小数,
|
||||
// 因此,把此数乘以100之后再取余
|
||||
// 因为如果以MB为单位的话,要保留最后1位小数,
|
||||
// 因此,把此数乘以100之后再取余
|
||||
size = size * 100;
|
||||
return String.valueOf((size / 100)) + "." + String.valueOf((size % 100)) + "MB";
|
||||
} else {
|
||||
// 否则如果要以GB为单位的,先除于1024再作同样的处理
|
||||
// 否则如果要以GB为单位的,先除于1024再作同样的处理
|
||||
size = size * 100 / 1024;
|
||||
return String.valueOf((size / 100)) + "." + String.valueOf((size % 100)) + "GB";
|
||||
}
|
||||
@@ -1739,8 +1739,8 @@ public class DataUtil {
|
||||
if (str1 == null || str2 == null) {
|
||||
return false;
|
||||
}
|
||||
str1 = DataUtil.toDBCcase(str1).replace("·", "");
|
||||
str2 = DataUtil.toDBCcase(str2).replace("·", "");
|
||||
str1 = DataUtil.toDBCcase(str1).replace("·", "");
|
||||
str2 = DataUtil.toDBCcase(str2).replace("·", "");
|
||||
if (str1.contains(str2)) {
|
||||
return true;
|
||||
}
|
||||
@@ -1753,8 +1753,8 @@ public class DataUtil {
|
||||
if (str1 == null || str2 == null) {
|
||||
return false;
|
||||
}
|
||||
str1 = convertNumberToCn(str1).replace("·", "").toUpperCase();
|
||||
str2 = convertNumberToCn(str2).replace("·", "").toUpperCase();
|
||||
str1 = convertNumberToCn(str1).replace("·", "").toUpperCase();
|
||||
str2 = convertNumberToCn(str2).replace("·", "").toUpperCase();
|
||||
return str1.contains(str2);
|
||||
}
|
||||
|
||||
@@ -1774,7 +1774,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回首字母,如果是汉语,则返回首个汉字拼音的首字母
|
||||
* 返回首字母,如果是汉语,则返回首个汉字拼音的首字母
|
||||
*
|
||||
* @param word
|
||||
* @return
|
||||
@@ -1809,7 +1809,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密图片url
|
||||
* 加密图片url
|
||||
*
|
||||
* @param u
|
||||
* @param s
|
||||
@@ -1838,7 +1838,7 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是别墅
|
||||
* 是否是别墅
|
||||
* @return
|
||||
*/
|
||||
public static boolean isVilla(Double area, String name, Integer height, Integer room) {
|
||||
@@ -1877,20 +1877,20 @@ public class DataUtil {
|
||||
|
||||
|
||||
public static int generateRandomNumber(String address) {
|
||||
// 使用地址的哈希值作为随机种子
|
||||
// 使用地址的哈希值作为随机种子
|
||||
long seed = address.hashCode();
|
||||
Random random = new Random(seed);
|
||||
|
||||
// 生成一个初始随机数来决定范围
|
||||
// 生成一个初始随机数来决定范围
|
||||
int initialRandom = random.nextInt();
|
||||
|
||||
int result;
|
||||
if (initialRandom > 0) {
|
||||
// 生成2到10之间的随机数(包含2和10)
|
||||
result = random.nextInt(9) + 2; // nextInt(9) 生成 0-8,+2 后得到 2-10
|
||||
// 生成2到10之间的随机数(包含2和10)
|
||||
result = random.nextInt(9) + 2; // nextInt(9) 生成 0-8,+2 后得到 2-10
|
||||
} else {
|
||||
// 生成-5到-2之间的随机数(包含-5和-2)
|
||||
result = random.nextInt(4) - 5; // nextInt(4) 生成 0-3,-5 后得到 -5到-2
|
||||
// 生成-5到-2之间的随机数(包含-5和-2)
|
||||
result = random.nextInt(4) - 5; // nextInt(4) 生成 0-3,-5 后得到 -5到-2
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1898,8 +1898,8 @@ public class DataUtil {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(isChineseChar("6文怡a花园"));
|
||||
// System.out.println(getFirstChar("文怡花园"));
|
||||
System.out.println(isChineseChar("6文怡a花园"));
|
||||
// System.out.println(getFirstChar("文怡花园"));
|
||||
//
|
||||
// System.out.println(FourUpSixInto("258.393", 2));
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取去年同期的一个星期日
|
||||
* 获取去年同期的一个星期日
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上个月同期的一个星期日
|
||||
* 获取上个月同期的一个星期日
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -98,7 +98,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取半年前同期的一个星期日
|
||||
* 获取半年前同期的一个星期日
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -111,7 +111,7 @@ public class DateUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 去年同月的第一天
|
||||
* 去年同月的第一天
|
||||
*/
|
||||
public static Date getThisMonthInLastYear(Date date) {
|
||||
date = getDateOfLastMonth(null == date ? new Date() : date, -12);
|
||||
@@ -120,7 +120,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上个月第一天
|
||||
* 上个月第一天
|
||||
*/
|
||||
public static Date getFirstDayOfLastMonth(Date date) {
|
||||
date = getDateOfLastMonth(date, -1);
|
||||
@@ -129,7 +129,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 当月第一天
|
||||
* 当月第一天
|
||||
*/
|
||||
public static Date getFirstDayOfCurrentMonth(Date date) {
|
||||
date = getDateOfLastMonth(date, 0);
|
||||
@@ -166,7 +166,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日历得到那一天的星期天是哪天 注意:输入的calendar最后的值同返回值一样
|
||||
* 根据日历得到那一天的星期天是哪天 注意:输入的calendar最后的值同返回值一样
|
||||
*
|
||||
* @param calendar
|
||||
* @return
|
||||
@@ -315,7 +315,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把date truncate到日期为止,去掉时分秒
|
||||
* 把date truncate到日期为止,去掉时分秒
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -325,7 +325,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到这一天的范围.比如如果输入的是2007-12-12 12:36:40,则返回的是2007-12-12 00:00:00和2007-12-13
|
||||
* 得到这一天的范围.比如如果输入的是2007-12-12 12:36:40,则返回的是2007-12-12 00:00:00和2007-12-13
|
||||
* 0:0:0
|
||||
*
|
||||
* @param date
|
||||
@@ -339,7 +339,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yyyy-mm-dd的String格式
|
||||
* 转化日期成yyyy-mm-dd的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -373,7 +373,7 @@ public class DateUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 转化日期成yyyy-mm-dd hh:mm:ss的String格式
|
||||
* 转化日期成yyyy-mm-dd hh:mm:ss的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -429,7 +429,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yyyymmddhhmmss的String格式
|
||||
* 转化日期成yyyymmddhhmmss的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -448,7 +448,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yyyymmdd的String格式
|
||||
* 转化日期成yyyymmdd的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -467,7 +467,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期HHmmss的String格式
|
||||
* 转化日期HHmmss的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -486,7 +486,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yymmdd的String格式
|
||||
* 转化日期成yymmdd的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -505,7 +505,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yy-mm-dd的String格式
|
||||
* 转化日期成yy-mm-dd的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -524,7 +524,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* 返回之前几个月或之后几个月的今天
|
||||
* 返回之前几个月或之后几个月的今天
|
||||
*
|
||||
* @param date
|
||||
* @param num
|
||||
@@ -548,8 +548,8 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* 根据传入的日期以及数字获得当前日期之前或者之后月份的起始日期 如传入2007-06-21,6返回 日期为2007-12-1的date
|
||||
* 如传入2007-06-21,-6返回 日期为2006-12-1的date
|
||||
* 根据传入的日期以及数字获得当前日期之前或者之后月份的起始日期 如传入2007-06-21,6返回 日期为2007-12-1的date
|
||||
* 如传入2007-06-21,-6返回 日期为2006-12-1的date
|
||||
*
|
||||
* @param date
|
||||
* @param num
|
||||
@@ -605,8 +605,8 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定日期date向后推算num天的日期列表<br>
|
||||
* <b>注意:此时包含传入的date, 否则可设置第三个参数为false</b>
|
||||
* 获取给定日期date向后推算num天的日期列表<br>
|
||||
* <b>注意:此时包含传入的date, 否则可设置第三个参数为false</b>
|
||||
*
|
||||
* @param date
|
||||
* @param num
|
||||
@@ -617,12 +617,12 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定日期date向后推算num天的日期列表
|
||||
* 获取给定日期date向后推算num天的日期列表
|
||||
*
|
||||
* @param date
|
||||
* @param num
|
||||
* @param contains
|
||||
* 是否包含date
|
||||
* 是否包含date
|
||||
* @return
|
||||
*/
|
||||
public static List<Date> getBeforeDates(Date date, int num, boolean contains) {
|
||||
@@ -791,7 +791,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取与dete之前或后的第num个整点
|
||||
* 获取与dete之前或后的第num个整点
|
||||
*/
|
||||
public static Date getHour(Date date, int num) {
|
||||
date = DateUtils.addHours(date, num);
|
||||
@@ -825,7 +825,7 @@ public class DateUtil {
|
||||
/**
|
||||
* @param endDate
|
||||
* @param count
|
||||
* @return 自endDate始,共count个weekend的列表
|
||||
* @return 自endDate始,共count个weekend的列表
|
||||
*/
|
||||
public static List<Date> getWeekendList(Date endDate, int count) {
|
||||
if (count < 1)
|
||||
@@ -853,7 +853,7 @@ public class DateUtil {
|
||||
* @param dates
|
||||
* @param pattern
|
||||
* @param pattern
|
||||
* @return 到endMonth为止,共count个月,用pattern进行格式化
|
||||
* @return 到endMonth为止,共count个月,用pattern进行格式化
|
||||
*/
|
||||
public static List<String> formatDates(List<Date> dates, String pattern) {
|
||||
List<String> ret = new ArrayList<String>(dates.size());
|
||||
@@ -868,7 +868,7 @@ public class DateUtil {
|
||||
*
|
||||
* @param endMonth
|
||||
* @param count
|
||||
* @return 到endMonth为止,共count个月
|
||||
* @return 到endMonth为止,共count个月
|
||||
*/
|
||||
public static List<Date> getMonthList(Date endMonth, int count) {
|
||||
if (count < 1)
|
||||
@@ -922,7 +922,7 @@ public class DateUtil {
|
||||
*
|
||||
* @param endMonth
|
||||
* @param count
|
||||
* @return 自endMonth起,count个月的weekend列表
|
||||
* @return 自endMonth起,count个月的weekend列表
|
||||
*/
|
||||
public static List<Date> getWeekendListByMonth(Date endMonth, int count) {
|
||||
if (count < 1)
|
||||
@@ -983,7 +983,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到两个日期的差值<br>
|
||||
* 得到两个日期的差值<br>
|
||||
* between('2009-11-10', '2008-12-12', Calendar.YEAR) == 1<br>
|
||||
* between('2009-11-10', '2008-12-12', Calendar.MONTH) == 11<br>
|
||||
* between('2009-11-10', '2008-12-12', Calendar.WEEK_OF_YEAR) == 47<br>
|
||||
@@ -1074,7 +1074,7 @@ public class DateUtil {
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
// yyyy-MM-dd HH:mm:ss 24小时
|
||||
// yyyy-MM-dd HH:mm:ss 24小时
|
||||
|
||||
public static List<String> getDateByInterval(Date startDate, Date endDate, int interval, int calendarField, String switching,
|
||||
String pattern) {
|
||||
@@ -1129,7 +1129,7 @@ public class DateUtil {
|
||||
}
|
||||
}
|
||||
|
||||
// 推荐使用
|
||||
// 推荐使用
|
||||
public static List<Date> getDateByIntervalL(Date startDate, Date endDate, int interval, int calendarField, String switching) {
|
||||
Date _startDate = DateUtils.truncate(startDate, calendarField);
|
||||
Date _endDate = DateUtils.truncate(endDate, calendarField);
|
||||
@@ -1185,7 +1185,7 @@ public class DateUtil {
|
||||
private static long YEAR_SEC = MONTH_SEC * 12;
|
||||
|
||||
/**
|
||||
* 获取时间与日期时间的文字描述
|
||||
* 获取时间与日期时间的文字描述
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -1200,23 +1200,23 @@ public class DateUtil {
|
||||
long diffSec = (msNow - msInput) / 1000;
|
||||
if (diffSec < DAY_SEC) {
|
||||
if (diffSec >= HOUR_SEC) {
|
||||
return (diffSec / HOUR_SEC) + "小时前";
|
||||
return (diffSec / HOUR_SEC) + "小时前";
|
||||
} else if (diffSec >= MINU_SEC) {
|
||||
return (diffSec / MINU_SEC) + "分钟前";
|
||||
return (diffSec / MINU_SEC) + "分钟前";
|
||||
} else {
|
||||
return "刚刚";
|
||||
return "刚刚";
|
||||
}
|
||||
} else if (diffSec < MONTH_SEC) {
|
||||
return (diffSec / DAY_SEC) + "天前";
|
||||
return (diffSec / DAY_SEC) + "天前";
|
||||
} else if (diffSec < YEAR_SEC) {
|
||||
return ((int) (diffSec / MONTH_SEC)) + "月前";
|
||||
return ((int) (diffSec / MONTH_SEC)) + "月前";
|
||||
} else {
|
||||
int yearInput = inputCalendar.get(Calendar.YEAR);
|
||||
int yearNow = systemCalendar.get(Calendar.YEAR);
|
||||
return (yearNow - yearInput) + "年前";
|
||||
return (yearNow - yearInput) + "年前";
|
||||
}
|
||||
} else {
|
||||
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚"
|
||||
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1232,39 +1232,39 @@ public class DateUtil {
|
||||
long diffSec = (msNow - msInput) / 1000;
|
||||
if (diffSec < DAY_SEC) {
|
||||
if (diffSec >= HOUR_SEC) {
|
||||
return (diffSec / HOUR_SEC) + "小时前";
|
||||
return (diffSec / HOUR_SEC) + "小时前";
|
||||
} else if (diffSec >= MINU_SEC) {
|
||||
return (diffSec / MINU_SEC) + "分钟前";
|
||||
return (diffSec / MINU_SEC) + "分钟前";
|
||||
} else {
|
||||
return "刚刚";
|
||||
return "刚刚";
|
||||
}
|
||||
} else if (diffSec < MONTH_SEC) {
|
||||
return (diffSec / DAY_SEC) + "天前";
|
||||
return (diffSec / DAY_SEC) + "天前";
|
||||
} else if (diffSec < YEAR_SEC) {
|
||||
return ((int) (diffSec / MONTH_SEC)) + "月前";
|
||||
return ((int) (diffSec / MONTH_SEC)) + "月前";
|
||||
} else {
|
||||
int yearInput = inputCalendar.get(Calendar.YEAR);
|
||||
int yearNow = systemCalendar.get(Calendar.YEAR);
|
||||
return (yearNow - yearInput) + "年前";
|
||||
return (yearNow - yearInput) + "年前";
|
||||
}
|
||||
} else {
|
||||
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚"
|
||||
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取距离系统时间的数字型
|
||||
* FIXME:该代码有bug,(例如:2012年1月1日-2011年12月30日返回的是1年前),推荐使用getShortDateText(Date
|
||||
* 获取距离系统时间的数字型
|
||||
* FIXME:该代码有bug,(例如:2012年1月1日-2011年12月30日返回的是1年前),推荐使用getShortDateText(Date
|
||||
* date)
|
||||
*/
|
||||
public static String getDaysBeforeNow(Date date) {
|
||||
long sysTime = Long.parseLong(formatToYYYYMMDDhhmmss(new Date()));
|
||||
long ymdhms = Long.parseLong(formatToYYYYMMDDhhmmss(date));
|
||||
String strYear = "年前";
|
||||
String strMonth = "月前";
|
||||
String strDay = "天前";
|
||||
String strHour = "小时前";
|
||||
String strMinute = "分钟前";
|
||||
String strYear = "年前";
|
||||
String strMonth = "月前";
|
||||
String strDay = "天前";
|
||||
String strHour = "小时前";
|
||||
String strMinute = "分钟前";
|
||||
try {
|
||||
if (ymdhms == 0) {
|
||||
return "";
|
||||
@@ -1296,7 +1296,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取大概小时差
|
||||
* 获取大概小时差
|
||||
*
|
||||
* @param publishDate
|
||||
* @param strFormatter
|
||||
@@ -1307,7 +1307,7 @@ public class DateUtil {
|
||||
if (null != publishDate) {
|
||||
if (publishDate.after(range[0]) && publishDate.before(range[1])) {
|
||||
int dateDiff = DateUtil.getHour(new Date()) - DateUtil.getHour(publishDate);
|
||||
return dateDiff > 0 ? dateDiff + "小时前" : "1小时内";
|
||||
return dateDiff > 0 ? dateDiff + "小时前" : "1小时内";
|
||||
} else {
|
||||
return (DateUtil.formatByPattern(publishDate, strFormatter));
|
||||
}
|
||||
@@ -1317,7 +1317,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定日期的本周星期天
|
||||
* 获取给定日期的本周星期天
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -1331,7 +1331,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定日期的下一个星期天
|
||||
* 获取给定日期的下一个星期天
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -1341,7 +1341,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定日期的上一个星期天
|
||||
* 获取给定日期的上一个星期天
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -1352,7 +1352,7 @@ public class DateUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 将任意字符串将成date
|
||||
* 将任意字符串将成date
|
||||
* @param date
|
||||
* @return
|
||||
* @throws ParseException
|
||||
@@ -1363,10 +1363,10 @@ public class DateUtil {
|
||||
}
|
||||
Date result = null;
|
||||
String parse = null;
|
||||
//parse=parse.replaceFirst("^.*?[0-9]{4}(年)?([^0-9]?)", "yyyy$1");
|
||||
//parse=parse.replaceFirst("([^0-9]?)[0-9]{1,2}(月)?([^0-9]?)", "$1MM$2");
|
||||
//parse=parse.replaceFirst("^.*?[0-9]{4}(年)?([^0-9]?)", "yyyy$1");
|
||||
//parse=parse.replaceFirst("([^0-9]?)[0-9]{1,2}(月)?([^0-9]?)", "$1MM$2");
|
||||
//parse=parse.replaceFirst("([^0-9]?)[0-9]{1,2}( ?)", "$1dd$2");
|
||||
Pattern p=Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?");
|
||||
Pattern p=Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?");
|
||||
Matcher m=p.matcher(date);
|
||||
|
||||
if(m.find()){
|
||||
@@ -1401,7 +1401,7 @@ public class DateUtil {
|
||||
if(dateStr == null){
|
||||
return null;
|
||||
}
|
||||
Pattern p=Pattern.compile("(\\d{1,4})[-|年|/|.]?(\\d{1,2})?[-|月|/|.]?(\\d{1,2})?日?");
|
||||
Pattern p=Pattern.compile("(\\d{1,4})[-|年|/|.]?(\\d{1,2})?[-|月|/|.]?(\\d{1,2})?日?");
|
||||
Matcher m=p.matcher(dateStr);
|
||||
String finalPattern = "yyyy";
|
||||
String pattern = "";
|
||||
@@ -1462,7 +1462,7 @@ public class DateUtil {
|
||||
if(dateStr == null){
|
||||
return null;
|
||||
}
|
||||
Pattern p=Pattern.compile("(\\d{1,4})[-|年|/|.]?(\\d{1,2})?[-|月|/|.]?(\\d{1,2})?日?");
|
||||
Pattern p=Pattern.compile("(\\d{1,4})[-|年|/|.]?(\\d{1,2})?[-|月|/|.]?(\\d{1,2})?日?");
|
||||
Matcher m=p.matcher(dateStr);
|
||||
String finalPattern = "yyyy";
|
||||
String pattern = "";
|
||||
@@ -1557,15 +1557,15 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加日期的天数
|
||||
* 此方法用于给定一个日期后,增加指定数量的天数
|
||||
* 增加日期的天数
|
||||
* 此方法用于给定一个日期后,增加指定数量的天数
|
||||
*
|
||||
* @param date 原始日期
|
||||
* @param amount 要增加的天数,正数表示未来日期,负数表示过去日期
|
||||
* @return 增加天数后的日期
|
||||
* @param date 原始日期
|
||||
* @param amount 要增加的天数,正数表示未来日期,负数表示过去日期
|
||||
* @return 增加天数后的日期
|
||||
*/
|
||||
public static Date add(Date date,int amount){
|
||||
// 调用另一个重载的add方法,将Calendar.DATE作为参数,表示按天数增加
|
||||
// 调用另一个重载的add方法,将Calendar.DATE作为参数,表示按天数增加
|
||||
return add(date,Calendar.DATE,amount);
|
||||
}
|
||||
|
||||
@@ -1631,7 +1631,7 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化日期成yy-mm的String格式
|
||||
* 转化日期成yy-mm的String格式
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
@@ -1661,7 +1661,7 @@ public class DateUtil {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
||||
String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
@@ -1686,18 +1686,18 @@ public class DateUtil {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH, -1);
|
||||
// 得到前一个月的第一天
|
||||
// 得到前一个月的第一天
|
||||
cal.set(Calendar.DAY_OF_MONTH,
|
||||
cal.getActualMinimum(Calendar.DAY_OF_MONTH));
|
||||
map.put("first", cal.getTime());
|
||||
// 得到前一个月的最后一天
|
||||
// 得到前一个月的最后一天
|
||||
cal.set(Calendar.DAY_OF_MONTH,
|
||||
cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
map.put("last", cal.getTime());
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 根据传入的date得到days天之后的时间,days<0则取之前
|
||||
* 根据传入的date得到days天之后的时间,days<0则取之前
|
||||
*
|
||||
* @param date
|
||||
* @param days
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
|
||||
/**
|
||||
* 词典准入规则
|
||||
* 词典准入规则
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
@@ -19,20 +19,20 @@ import com.fangjia.core.util.DataUtil;
|
||||
public class DictAccessUtil {
|
||||
private static Pattern PATT1 = Pattern.compile(".+[0-9A-Za-z]$");
|
||||
private static Pattern PATT2 = Pattern.compile("^[0-9].+");
|
||||
private static Pattern PATT3 = Pattern.compile("(.+)([0-9|一|二|三|四|五|六|七|八|九|十]期)$");
|
||||
private static Pattern PATT4 = Pattern.compile("(.+)([0-9A-Za-z|一|二|三|四|五|六|七|八|九|十]区)$");
|
||||
private static Pattern PATT5 = Pattern.compile("【.+】(.+)");
|
||||
private static final List<String> LEFT_SYMBOLS = Arrays.asList("(","户型");
|
||||
private static final List<String> SPLIT_SYMBOLS = Arrays.asList("·", ".", "?", "·", "-", "、", ",");
|
||||
private static final List<String> ILLEGAL_SYMBOLS = Arrays.asList("底商", "社区", "酒店", "项目", "供销楼", "站", "平楼","宿舍","回迁房","本案","贵宾楼");
|
||||
private static Pattern PATT3 = Pattern.compile("(.+)([0-9|一|二|三|四|五|六|七|八|九|十]期)$");
|
||||
private static Pattern PATT4 = Pattern.compile("(.+)([0-9A-Za-z|一|二|三|四|五|六|七|八|九|十]区)$");
|
||||
private static Pattern PATT5 = Pattern.compile("【.+】(.+)");
|
||||
private static final List<String> LEFT_SYMBOLS = Arrays.asList("(","户型");
|
||||
private static final List<String> SPLIT_SYMBOLS = Arrays.asList("·", ".", "?", "·", "-", "、", ",");
|
||||
private static final List<String> ILLEGAL_SYMBOLS = Arrays.asList("底商", "社区", "酒店", "项目", "供销楼", "站", "平楼","宿舍","回迁房","本案","贵宾楼");
|
||||
|
||||
private static Pattern ROAD1 = Pattern.compile("(.{2,7}[路|街|巷|巷子|大道|干道|南侧|北侧|东侧|西侧|南边|北边|东边|西边|旁|旁边|对面])(.*)");
|
||||
private static Pattern ROAD2 = Pattern.compile("([紧邻|毗邻](.){2,7})(.*)");
|
||||
private static Pattern ROAD1 = Pattern.compile("(.{2,7}[路|街|巷|巷子|大道|干道|南侧|北侧|东侧|西侧|南边|北边|东边|西边|旁|旁边|对面])(.*)");
|
||||
private static Pattern ROAD2 = Pattern.compile("([紧邻|毗邻](.){2,7})(.*)");
|
||||
|
||||
private static Pattern SPLIT1 = Pattern.compile("(.{2,})[和|与](.{2,})");
|
||||
private static Pattern SPLIT1 = Pattern.compile("(.{2,})[和|与](.{2,})");
|
||||
|
||||
public static void main(String[] args) {
|
||||
// String s = "白沙路仪化游泳馆旁";
|
||||
// String s = "白沙路仪化游泳馆旁";
|
||||
// Matcher m = ROAD1.matcher(s);
|
||||
// if (m.matches()) {
|
||||
// System.out.println("------------------");
|
||||
@@ -40,7 +40,7 @@ public class DictAccessUtil {
|
||||
// System.out.println(m.group(1));
|
||||
// System.out.println(m.group(2));
|
||||
// }
|
||||
String s = "continuity(延平425)";//【南京】德国新城
|
||||
String s = "continuity(延平425)";//【南京】德国新城
|
||||
districtNameAccess(s);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DictAccessUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 小区类型词典
|
||||
* 小区类型词典
|
||||
*
|
||||
* @param p
|
||||
* @return
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* 钉钉机器人发送消息
|
||||
* 钉钉机器人发送消息
|
||||
* https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.karFPe&treeId=257&articleId=105735&docType=1
|
||||
*
|
||||
* @author yinjihuan
|
||||
@@ -22,7 +22,7 @@ public class DingDingMessageUtil {
|
||||
message.setMsgtype("text");
|
||||
message.setText(new MessageInfo(msg));
|
||||
URL url = new URL("https://oapi.dingtalk.com/robot/send?access_token=" + token);
|
||||
// 建立http连接
|
||||
// 建立http连接
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
+676
-676
File diff suppressed because it is too large
Load Diff
@@ -26,9 +26,9 @@ public class ExcelUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 写Excel数据
|
||||
* @param fileName 文件名
|
||||
* @param data 将要写入的数据 第一列为标题
|
||||
* 写Excel数据
|
||||
* @param fileName 文件名
|
||||
* @param data 将要写入的数据 第一列为标题
|
||||
* @param sheetName
|
||||
*/
|
||||
public static String write(String fileName ,List<List<String>> data,String sheetName) throws Exception{
|
||||
@@ -53,16 +53,16 @@ public class ExcelUtil {
|
||||
}
|
||||
mainSheet.createFreezePane( 1, 1);
|
||||
mainSheet.setDefaultRowHeightInPoints(30);
|
||||
//生成第一行标题
|
||||
//生成第一行标题
|
||||
Row row = mainSheet.createRow(0);
|
||||
row.setHeightInPoints(35);
|
||||
Font font = workBook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setFontName("宋体");
|
||||
// font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
CellStyle cellStyle = workBook.createCellStyle();
|
||||
cellStyle.setFont(font);
|
||||
cellStyle.setAlignment(CellStyle.ALIGN_CENTER); //水平布局:居中
|
||||
cellStyle.setAlignment(CellStyle.ALIGN_CENTER); //水平布局:居中
|
||||
cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
|
||||
int maxColumnNum = 0;
|
||||
@@ -77,9 +77,9 @@ public class ExcelUtil {
|
||||
}
|
||||
maxColumnNum = headDataList.size();
|
||||
}
|
||||
//设置内容格式
|
||||
//设置内容格式
|
||||
font = workBook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setFontName("宋体");
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
cellStyle = workBook.createCellStyle();
|
||||
cellStyle.setFont(font);
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* 执行计数器,可以用来对当前线程下的某些方法进行计数统计
|
||||
* 执行计数器,可以用来对当前线程下的某些方法进行计数统计
|
||||
*
|
||||
* @author velna
|
||||
*
|
||||
@@ -61,7 +61,7 @@ public class ExecuteCounter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对指定的key进行1次计数
|
||||
* 对指定的key进行1次计数
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
@@ -78,7 +78,7 @@ public class ExecuteCounter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到一个基于thread local的实例
|
||||
* 得到一个基于thread local的实例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -3,17 +3,17 @@ package com.fangjia.core.util;
|
||||
|
||||
public class FSHConstant {
|
||||
public static final Double ZERO = 0.0;
|
||||
public static final Double CITY_UNUSUAL_FACTOR = 0.4;//城市平稳度指数
|
||||
public static final Double REGION_UNUSUAL_FACTOR = 0.6;//区域平稳度指数
|
||||
public static final Double HOUSE_QUOTE_FACTOR = 0.4;//小区同类型挂牌房源量
|
||||
public static final Double HOUSE_SELL_FACTOR = 0.1;//小区成交量
|
||||
public static final Double SEE_TIME_FACTOR = 0.1;//房源带看数
|
||||
public static final Double AGENCY_COUNT_FACTOR = 0.3;//中介数
|
||||
public static final Double HOUSE_HOLD_FACTOR = 0.1;//户数
|
||||
public static final Double PRICE_STABILITY_FACTOR = 0.2;//价格异常指数
|
||||
public static final Double HANDLE_DEGREESCORE_FACTOR = 0.3;//处置难易度指数
|
||||
public static final Double PRICE_SCORE_FACTOR = 0.3;//价格指数
|
||||
public static final Double INCREASE_SCORE_FACTOR = 0.2;//年涨跌幅
|
||||
public static final Double CITY_UNUSUAL_FACTOR = 0.4;//城市平稳度指数
|
||||
public static final Double REGION_UNUSUAL_FACTOR = 0.6;//区域平稳度指数
|
||||
public static final Double HOUSE_QUOTE_FACTOR = 0.4;//小区同类型挂牌房源量
|
||||
public static final Double HOUSE_SELL_FACTOR = 0.1;//小区成交量
|
||||
public static final Double SEE_TIME_FACTOR = 0.1;//房源带看数
|
||||
public static final Double AGENCY_COUNT_FACTOR = 0.3;//中介数
|
||||
public static final Double HOUSE_HOLD_FACTOR = 0.1;//户数
|
||||
public static final Double PRICE_STABILITY_FACTOR = 0.2;//价格异常指数
|
||||
public static final Double HANDLE_DEGREESCORE_FACTOR = 0.3;//处置难易度指数
|
||||
public static final Double PRICE_SCORE_FACTOR = 0.3;//价格指数
|
||||
public static final Double INCREASE_SCORE_FACTOR = 0.2;//年涨跌幅
|
||||
|
||||
public static final Double MAX_COLLATERAL_RATE1 = 1.0;//90-100
|
||||
public static final Double MAX_COLLATERAL_RATE2 = 0.97;//80-90
|
||||
@@ -22,49 +22,49 @@ public class FSHConstant {
|
||||
public static final Double MAX_COLLATERAL_RATE5 = 0.8;//50-60
|
||||
public static final Double MAX_COLLATERAL_RATE6 = 0.0;//40-50
|
||||
|
||||
public static final Double CONSUME_FACTOR = 0.6;//消费
|
||||
public static final Double MANAGE_FACTOR = 0.7;//经营
|
||||
public static final String NO_DATA_MSG = "未知";
|
||||
public static final Double CONSUME_FACTOR = 0.6;//消费
|
||||
public static final Double MANAGE_FACTOR = 0.7;//经营
|
||||
public static final String NO_DATA_MSG = "未知";
|
||||
|
||||
|
||||
//pds1.3相关默认参数
|
||||
//pds1.3相关默认参数
|
||||
public static final Double ABSD_LINE = -1.3d;//
|
||||
public static final Double ABSC_LINE = 1d;//
|
||||
|
||||
public static final Double AGENCY_MAX = 90d;//中介最大数
|
||||
public static final Double AGENCY_MIN = 0d;//中介最小值
|
||||
public static final Double AGENCY_SCALE = 0.2d;//中介得分比例
|
||||
public static final Double AGENCY_MAX = 90d;//中介最大数
|
||||
public static final Double AGENCY_MIN = 0d;//中介最小值
|
||||
public static final Double AGENCY_SCALE = 0.2d;//中介得分比例
|
||||
|
||||
public static final Double TOTALPRICE_SCOREA = 270d;//总价A值
|
||||
public static final Double TOTALPRICE_SCOREB = 18d;//总价B值
|
||||
public static final Double TOTALPRICE_SCOREE = 54d;//总价E值
|
||||
public static final Double TOTALPRICE_SCOREF = 72d;//总价F值
|
||||
public static final Double TOTALPRICE_SCALE = 0.2d;//房屋总价权重
|
||||
public static final Double TOTALPRICE_SCOREA = 270d;//总价A值
|
||||
public static final Double TOTALPRICE_SCOREB = 18d;//总价B值
|
||||
public static final Double TOTALPRICE_SCOREE = 54d;//总价E值
|
||||
public static final Double TOTALPRICE_SCOREF = 72d;//总价F值
|
||||
public static final Double TOTALPRICE_SCALE = 0.2d;//房屋总价权重
|
||||
|
||||
public static final Double QUOTE_SCALE = 0.3d;//发布量权重
|
||||
public static final Double QUOTE_MAX = 900d;//发布量max值
|
||||
public static final Double QUOTE_MIN = 0d;//发布量min值
|
||||
public static final Double QUOTE_SCALE = 0.3d;//发布量权重
|
||||
public static final Double QUOTE_MAX = 900d;//发布量max值
|
||||
public static final Double QUOTE_MIN = 0d;//发布量min值
|
||||
|
||||
public static final Double TRAFFIC_SCALE = 0.2d;//交通权重
|
||||
public static final Double BUS_SCALE = 0.6d;//公交权重
|
||||
public static final Double METRO_SCALE = 0.4d;//地铁权重
|
||||
public static final Double BUS_MAX = 48d;//公交数量max值
|
||||
public static final Double BUS_MIN = 0d;//公交数量min值
|
||||
public static final Double METRO_MAX = 5d;//地铁数量max值
|
||||
public static final Double METRO_MIN = 0d;//地铁数量min值
|
||||
public static final Double TRAFFIC_SCALE = 0.2d;//交通权重
|
||||
public static final Double BUS_SCALE = 0.6d;//公交权重
|
||||
public static final Double METRO_SCALE = 0.4d;//地铁权重
|
||||
public static final Double BUS_MAX = 48d;//公交数量max值
|
||||
public static final Double BUS_MIN = 0d;//公交数量min值
|
||||
public static final Double METRO_MAX = 5d;//地铁数量max值
|
||||
public static final Double METRO_MIN = 0d;//地铁数量min值
|
||||
|
||||
public static final Double DENSITY_SCALE = 0.1d;//小区密度权重
|
||||
public static final Double DENSITY_MAX = 400d;//小区密度max值
|
||||
public static final Double DENSITY_MIN = 10d;//小区密度min值
|
||||
public static final Double DENSITY_RADIUS = 1.0d;//小区密度取值半径范围
|
||||
public static final Double QUOTE_A = 850d;//发布量A值
|
||||
public static final Double DENSITY_SCALE = 0.1d;//小区密度权重
|
||||
public static final Double DENSITY_MAX = 400d;//小区密度max值
|
||||
public static final Double DENSITY_MIN = 10d;//小区密度min值
|
||||
public static final Double DENSITY_RADIUS = 1.0d;//小区密度取值半径范围
|
||||
public static final Double QUOTE_A = 850d;//发布量A值
|
||||
public static final Double QUOTE_B = 200d;//
|
||||
|
||||
public static final Double PRICE_STABILITY_SCALE = 0.2d;//价格异常指数权重
|
||||
public static final Double PRICE_STABILITY_SCALE = 0.2d;//价格异常指数权重
|
||||
|
||||
public static final Double HANDLE_STABILITY_SCALE = 0.8d;//押品处置风险权重
|
||||
public static final Double HANDLE_STABILITY_SCALE = 0.8d;//押品处置风险权重
|
||||
|
||||
public static final Double DEAL_COUNT_SCORE = 0.3d;//交易量评分权重
|
||||
public static final Double DEAL_COUNT_SCORE = 0.3d;//交易量评分权重
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 查看URL防止重复抓取
|
||||
* 查看URL防止重复抓取
|
||||
*
|
||||
* @author xiaoyu
|
||||
*
|
||||
@@ -43,7 +43,7 @@ public class Footprint {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在该任务中已经存在或处理过
|
||||
* 是否在该任务中已经存在或处理过
|
||||
*
|
||||
* @param url
|
||||
* @param jobId
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param raidus 单位米
|
||||
* @param raidus 单位米
|
||||
* @return minLat, maxLat, minLng,maxLng
|
||||
*/
|
||||
public static double[] getAround(double lat, double lng, double radius) {
|
||||
@@ -62,11 +62,11 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据给定的经纬度、距离、角度,计算对应的经纬度
|
||||
* 根据给定的经纬度、距离、角度,计算对应的经纬度
|
||||
*
|
||||
* @param Lat 原始纬度
|
||||
* @param Lon 原始精度
|
||||
* @param distance 距离(米)
|
||||
* @param Lat 原始纬度
|
||||
* @param Lon 原始精度
|
||||
* @param distance 距离(米)
|
||||
* @param angle , 90: right, 180: down
|
||||
* @return
|
||||
*/
|
||||
@@ -81,14 +81,14 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 纬度的弧度
|
||||
* 纬度的弧度
|
||||
*/
|
||||
public static double radLat(double Lat) {
|
||||
return Lat * Math.PI / 180;
|
||||
}
|
||||
|
||||
/**
|
||||
* 经度的弧度
|
||||
* 经度的弧度
|
||||
*/
|
||||
public static double eadLon(double Lon) {
|
||||
return Lon * Math.PI / 180;
|
||||
@@ -100,8 +100,8 @@ public class GeoUtils {
|
||||
return ec * Math.cos(radLat);
|
||||
}
|
||||
|
||||
final static int EARTH_RADIUS = 6378137;// 赤道半径 earth radius
|
||||
final static int POLAR_RADIUS = 6356725;// 极半径 polar radius
|
||||
final static int EARTH_RADIUS = 6378137;// 赤道半径 earth radius
|
||||
final static int POLAR_RADIUS = 6356725;// 极半径 polar radius
|
||||
|
||||
public static double ecc(double Lat) {
|
||||
return POLAR_RADIUS + (EARTH_RADIUS - POLAR_RADIUS) * (90 - Lat) / 90;
|
||||
@@ -121,7 +121,7 @@ public class GeoUtils {
|
||||
public static double ee = 0.00669342162296594323;
|
||||
|
||||
/**
|
||||
* 百度转 wgs84
|
||||
* 百度转 wgs84
|
||||
*
|
||||
* @param bd_lat
|
||||
* @param bd_lng
|
||||
@@ -133,7 +133,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* wgs84 转百度
|
||||
* wgs84 转百度
|
||||
*
|
||||
* @param bd_lat
|
||||
* @param bd_lng
|
||||
@@ -145,7 +145,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 BD-09 坐标转换成GCJ-02 坐标
|
||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 BD-09 坐标转换成GCJ-02 坐标
|
||||
*/
|
||||
public static Map<String, Double> bd09ToGcj02(double bd_lat, double bd_lng) {
|
||||
double x = bd_lng - 0.0065, y = bd_lat - 0.006;
|
||||
@@ -160,7 +160,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
|
||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
|
||||
*/
|
||||
public static Map<String, Double> gcj02ToBd09(double gg_lat, double gg_lng) {
|
||||
double x = gg_lng, y = gg_lat;
|
||||
@@ -175,7 +175,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 WGS84 坐标转换成 GCJ-02 坐标
|
||||
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 WGS84 坐标转换成 GCJ-02 坐标
|
||||
*/
|
||||
public static Map<String, Double> gps84ToGcj02(double lat, double lng) {
|
||||
if (outOfChina(lat, lng)) {
|
||||
@@ -201,7 +201,7 @@ public class GeoUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 GCJ-02 坐标转换成 WGS84 坐标
|
||||
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 GCJ-02 坐标转换成 WGS84 坐标
|
||||
*/
|
||||
public static Map<String, Double> gcjToGps84(double lat, double lng) {
|
||||
Map<String, Double> gps = transform(lat, lng);
|
||||
@@ -305,22 +305,22 @@ public class GeoUtils {
|
||||
} else if (json != null && "10044".equals(json.optString("infocode"))) {
|
||||
System.exit(1);
|
||||
} else if (json != null && "10004".equals(json.optString("infocode"))) {
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
try {
|
||||
Thread.sleep(60000);
|
||||
} catch (InterruptedException ie) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} else if (json != null && "10017".equals(json.optString("infocode"))) {
|
||||
// 所请求的资源不可用
|
||||
// 所请求的资源不可用
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
return null; // 如果没有返回值,可以根据需要处理
|
||||
return null; // 如果没有返回值,可以根据需要处理
|
||||
}
|
||||
|
||||
private static String getGaodeKey(String endpoint) {
|
||||
// 实现获取高德 API key 的逻辑
|
||||
// 实现获取高德 API key 的逻辑
|
||||
return "8796b9dfb3889b57c38e2fff1b7e51bd";
|
||||
|
||||
}
|
||||
@@ -328,7 +328,7 @@ public class GeoUtils {
|
||||
public static void main(String[] args) {
|
||||
// Map<String, Double> location = gps84ToGcj02(31.218024629574998,121.36562884455);
|
||||
// System.out.println(location.toString());
|
||||
Map<String, String> result = parserByGaode("上海", "新泾三村");
|
||||
Map<String, String> result = parserByGaode("上海", "新泾三村");
|
||||
System.out.println(result.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,47 +7,47 @@ import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* 说明:房源字段验证器
|
||||
* 说明:房源字段验证器
|
||||
*
|
||||
* @author 王文艳
|
||||
* @author 王文艳
|
||||
*
|
||||
*/
|
||||
public class HouseValidator {
|
||||
|
||||
private static final List<String> ESTATE_TYPES = Arrays
|
||||
.asList(new String[] { "普通住宅", "别墅", "商住" });
|
||||
private static final List<String> FITMENTS = Arrays.asList(new String[] {"毛坯", "精装", "简装", "中装", "豪装", "清水", "全装修", "初装修", "普通装修", "精装修","豪华装修", "简装修", "中等装修", "中装修" });
|
||||
.asList(new String[] { "普通住宅", "别墅", "商住" });
|
||||
private static final List<String> FITMENTS = Arrays.asList(new String[] {"毛坯", "精装", "简装", "中装", "豪装", "清水", "全装修", "初装修", "普通装修", "精装修","豪华装修", "简装修", "中等装修", "中装修" });
|
||||
|
||||
private static final HashMap<String, List<String>> BUILDING_TYPES = new HashMap<String, List<String>>();
|
||||
private static final HashMap<String, List<String>> FITMENTS_TYPES_MAPS = new HashMap<String, List<String>>();
|
||||
private static final List<String> DIRECTIONS = Arrays.asList(new String[] {"东北", "西北", "东南", "西南","南北","东西","东", "南", "西", "北" });
|
||||
private static final List<String> DIRECTIONS = Arrays.asList(new String[] {"东北", "西北", "东南", "西南","南北","东西","东", "南", "西", "北" });
|
||||
private static final Map<String, Integer> FITMENTS_CODE_MAPS = new HashMap<String, Integer>();
|
||||
private static final Map<String, Integer> DIRECTION_CODE_MAPS = new HashMap<String, Integer>();
|
||||
static {
|
||||
BUILDING_TYPES.put("普通住宅",Arrays.asList(new String[] { "多层", "小高层", "超高层", "高层", "花园洋房","老洋房", "四合院" }));
|
||||
BUILDING_TYPES.put("别墅",Arrays.asList(new String[] { "独栋", "双拼", "联排", "叠加" }));
|
||||
BUILDING_TYPES.put("商住",Arrays.asList(new String[] { "多层", "小高层", "超高层", "高层" }));
|
||||
BUILDING_TYPES.put("普通住宅",Arrays.asList(new String[] { "多层", "小高层", "超高层", "高层", "花园洋房","老洋房", "四合院" }));
|
||||
BUILDING_TYPES.put("别墅",Arrays.asList(new String[] { "独栋", "双拼", "联排", "叠加" }));
|
||||
BUILDING_TYPES.put("商住",Arrays.asList(new String[] { "多层", "小高层", "超高层", "高层" }));
|
||||
|
||||
FITMENTS_TYPES_MAPS.put("毛坯", Arrays.asList(new String[] { "毛坯", "清水", "无装修", "独栋毛坯","毛胚", "白坯", "旧装", "坯", "原房", "毛坏"}));
|
||||
FITMENTS_TYPES_MAPS.put("简装", Arrays.asList(new String[] { "简装", "普通装修", "普通","简单装修","简易装修","普装", "一般装修", "一般", "简", "粗装修"}));
|
||||
FITMENTS_TYPES_MAPS.put("精装", Arrays.asList(new String[] { "精装","全装修", "全装", "中等装修", "中装","中档装修","精致装修", "中档", "中等", "精", "中修", "优质装修", "时尚装修", "良装", "中高挡"}));
|
||||
FITMENTS_TYPES_MAPS.put("豪装", Arrays.asList(new String[] { "豪华装修","高档","豪华","豪装", "高级装修", "高装","奢侈"}));
|
||||
FITMENTS_TYPES_MAPS.put("毛坯", Arrays.asList(new String[] { "毛坯", "清水", "无装修", "独栋毛坯","毛胚", "白坯", "旧装", "坯", "原房", "毛坏"}));
|
||||
FITMENTS_TYPES_MAPS.put("简装", Arrays.asList(new String[] { "简装", "普通装修", "普通","简单装修","简易装修","普装", "一般装修", "一般", "简", "粗装修"}));
|
||||
FITMENTS_TYPES_MAPS.put("精装", Arrays.asList(new String[] { "精装","全装修", "全装", "中等装修", "中装","中档装修","精致装修", "中档", "中等", "精", "中修", "优质装修", "时尚装修", "良装", "中高挡"}));
|
||||
FITMENTS_TYPES_MAPS.put("豪装", Arrays.asList(new String[] { "豪华装修","高档","豪华","豪装", "高级装修", "高装","奢侈"}));
|
||||
|
||||
DIRECTION_CODE_MAPS.put("西南", 1);
|
||||
DIRECTION_CODE_MAPS.put("东南", 2);
|
||||
DIRECTION_CODE_MAPS.put("南", 3);
|
||||
DIRECTION_CODE_MAPS.put("西北", 4);
|
||||
DIRECTION_CODE_MAPS.put("东北", 5);
|
||||
DIRECTION_CODE_MAPS.put("东", 6);
|
||||
DIRECTION_CODE_MAPS.put("西", 7);
|
||||
DIRECTION_CODE_MAPS.put("北", 8);
|
||||
DIRECTION_CODE_MAPS.put("东西", 9);
|
||||
DIRECTION_CODE_MAPS.put("南北", 10);
|
||||
DIRECTION_CODE_MAPS.put("西南", 1);
|
||||
DIRECTION_CODE_MAPS.put("东南", 2);
|
||||
DIRECTION_CODE_MAPS.put("南", 3);
|
||||
DIRECTION_CODE_MAPS.put("西北", 4);
|
||||
DIRECTION_CODE_MAPS.put("东北", 5);
|
||||
DIRECTION_CODE_MAPS.put("东", 6);
|
||||
DIRECTION_CODE_MAPS.put("西", 7);
|
||||
DIRECTION_CODE_MAPS.put("北", 8);
|
||||
DIRECTION_CODE_MAPS.put("东西", 9);
|
||||
DIRECTION_CODE_MAPS.put("南北", 10);
|
||||
|
||||
FITMENTS_CODE_MAPS.put("毛坯", 1);
|
||||
FITMENTS_CODE_MAPS.put("简装", 2);
|
||||
FITMENTS_CODE_MAPS.put("精装", 3);
|
||||
FITMENTS_CODE_MAPS.put("豪装", 4);
|
||||
FITMENTS_CODE_MAPS.put("毛坯", 1);
|
||||
FITMENTS_CODE_MAPS.put("简装", 2);
|
||||
FITMENTS_CODE_MAPS.put("精装", 3);
|
||||
FITMENTS_CODE_MAPS.put("豪装", 4);
|
||||
}
|
||||
|
||||
public static boolean validateArea(double area) {
|
||||
@@ -70,7 +70,7 @@ public class HouseValidator {
|
||||
return false;
|
||||
}
|
||||
List<String> buildingTypes = BUILDING_TYPES.get(eatateType);
|
||||
String[] bTypes = buildingType.split(",|,");
|
||||
String[] bTypes = buildingType.split(",|,");
|
||||
for (String bType : bTypes) {
|
||||
if(!buildingTypes.contains(bType)){
|
||||
return false;
|
||||
@@ -82,7 +82,7 @@ public class HouseValidator {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把装修信息映射成装修编码
|
||||
* 把装修信息映射成装修编码
|
||||
* @param fitmentDesc
|
||||
* @return
|
||||
*/
|
||||
@@ -92,7 +92,7 @@ public class HouseValidator {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把朝向信息映射成朝向编码
|
||||
* 把朝向信息映射成朝向编码
|
||||
* @param direction
|
||||
* @return
|
||||
*/
|
||||
@@ -105,7 +105,7 @@ public class HouseValidator {
|
||||
if(buildingType == null){
|
||||
return false;
|
||||
}
|
||||
String[] builds = buildingType.split(",|,");
|
||||
String[] builds = buildingType.split(",|,");
|
||||
for (String build : builds) {
|
||||
for (List<String> types : BUILDING_TYPES.values()) {
|
||||
if (types.contains(build)) {
|
||||
@@ -128,7 +128,7 @@ public class HouseValidator {
|
||||
return null;
|
||||
}
|
||||
fitmentDesc = fitmentDesc.replaceAll("[\\s ]+", "");
|
||||
if(fitmentDesc.equals("非毛坯")){
|
||||
if(fitmentDesc.equals("非毛坯")){
|
||||
return null;
|
||||
}
|
||||
Iterator<Entry<String, List<String>>> it = FITMENTS_TYPES_MAPS
|
||||
@@ -154,7 +154,7 @@ public class HouseValidator {
|
||||
if (directionDesc == null) {
|
||||
return null;
|
||||
}
|
||||
directionDesc = directionDesc.replaceAll("(\\(|(|《|\"|“|【|〔).+?(\\)|》|)|\"|”|】|〕)", "#_#");
|
||||
directionDesc = directionDesc.replaceAll("(\\(|(|《|\"|“|【|〔).+?(\\)|》|)|\"|”|】|〕)", "#_#");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < directionDesc.length(); i++) {
|
||||
char c = directionDesc.charAt(i);
|
||||
@@ -181,7 +181,7 @@ public class HouseValidator {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(fetchDirectionInfo("南北【好美嘉园】属鼠的选择哪种朝向的房子最好?2018-01-19"));
|
||||
System.out.println(fetchDirectionInfo("南北【好美嘉园】属鼠的选择哪种朝向的房子最好?2018-01-19"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class HttpRequest {
|
||||
String rt = EntityUtils.toString(response.getEntity(), charset);
|
||||
return rt;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("请求异常:" + url, e);
|
||||
LOGGER.error("请求异常:" + url, e);
|
||||
throw new HttpRequestException(e);
|
||||
}finally {
|
||||
if(httpClient.getConnectionManager() != null){
|
||||
@@ -387,11 +387,11 @@ public class HttpRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* 小神鱼post请求封装
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
* 小神鱼post请求封装
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPostTwo(String url, String param,Map<String,String> headers) {
|
||||
PrintWriter out = null;
|
||||
@@ -399,9 +399,9 @@ public class HttpRequest {
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent",
|
||||
@@ -410,16 +410,16 @@ public class HttpRequest {
|
||||
String value = headers.get(key);
|
||||
conn.setRequestProperty(key,value);
|
||||
}
|
||||
// 发送POST请求必须设置如下两行
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
@@ -427,10 +427,10 @@ public class HttpRequest {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!"+e);
|
||||
System.out.println("发送 POST 请求出现异常!"+e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally{
|
||||
try{
|
||||
if(out!=null){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 将XML转JSON String、将JSON转Map
|
||||
* 将XML转JSON String、将JSON转Map
|
||||
*/
|
||||
package com.fangjia.core.util;
|
||||
import java.util.ArrayList;
|
||||
@@ -16,7 +16,7 @@ import net.sf.json.xml.XMLSerializer;
|
||||
public class JXMConvertUtil{
|
||||
|
||||
/**
|
||||
* 将XML String转成JSON String
|
||||
* 将XML String转成JSON String
|
||||
*
|
||||
* @param XMLString
|
||||
* @return
|
||||
@@ -31,7 +31,7 @@ public class JXMConvertUtil{
|
||||
}
|
||||
|
||||
/**
|
||||
* 将JSON转换成Map
|
||||
* 将JSON转换成Map
|
||||
* @param object
|
||||
* @return
|
||||
*
|
||||
@@ -40,7 +40,7 @@ public class JXMConvertUtil{
|
||||
public static Map<String, Object> JsonConvertHashMap(Object object)
|
||||
{
|
||||
Map<String, Object> RMap = new HashMap<String, Object>();
|
||||
// 将json字符串转换成jsonObject
|
||||
// 将json字符串转换成jsonObject
|
||||
JSONObject jsonObject = JSONObject.fromObject(object);
|
||||
RMap=IteratorHash(jsonObject);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class JXMConvertUtil{
|
||||
|
||||
|
||||
/**
|
||||
* 递归遍历JSON对象。
|
||||
* 递归遍历JSON对象。
|
||||
*
|
||||
* @param JsonToMap
|
||||
* @return
|
||||
@@ -61,9 +61,9 @@ public class JXMConvertUtil{
|
||||
HashMap<String, Object> RMap = new HashMap<String, Object>();
|
||||
while(it.hasNext()){
|
||||
String key = String.valueOf(it.next());
|
||||
if(JsonToMap.get(key).getClass() == JSONArray.class){//判是否为列表
|
||||
if(JsonToMap.get(key).getClass() == JSONArray.class){//判是否为列表
|
||||
|
||||
if(JsonToMap.getJSONArray(key).isEmpty()){//判列表是否为空
|
||||
if(JsonToMap.getJSONArray(key).isEmpty()){//判列表是否为空
|
||||
RMap.put(key,null);
|
||||
}else{
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* JSON 转换工具类
|
||||
* JSON 转换工具类
|
||||
*/
|
||||
public class JsonUtils {
|
||||
|
||||
@@ -21,12 +21,12 @@ public class JsonUtils {
|
||||
mapper.writeValue(writer, obj);
|
||||
return writer.toString();
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException("序列化对象【"+obj+"】时出错", e);
|
||||
throw new RuntimeException("序列化对象【"+obj+"】时出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把JSON字符串装换成JAVA对象
|
||||
* 把JSON字符串装换成JAVA对象
|
||||
* @param jsonObject
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
@@ -37,7 +37,7 @@ public class JsonUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把JSON字符串装换成JAVA对象
|
||||
* 把JSON字符串装换成JAVA对象
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
*
|
||||
* @author JENIS
|
||||
*
|
||||
* 2018年5月21日 下午17:29:28
|
||||
* 2018年5月21日 下午17:29:28
|
||||
*/
|
||||
public class MD5Util {
|
||||
|
||||
@@ -17,12 +17,12 @@ public class MD5Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* MD5加密
|
||||
* MD5加密
|
||||
*
|
||||
* @param msg
|
||||
* 密文
|
||||
* 密文
|
||||
* @param charset
|
||||
* 字符集
|
||||
* 字符集
|
||||
* @return String e
|
||||
*/
|
||||
public static String encrypt(String msg, String charset) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有计算排名
|
||||
* 所有计算排名
|
||||
* @param cityRank
|
||||
* @param cityTotal
|
||||
* @return
|
||||
@@ -37,7 +37,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//押品综合评分
|
||||
//押品综合评分
|
||||
public static double calTotalScore(Double handleDegreeScore,Double priceStability,Double rate,Double handleRate){
|
||||
double score = 0d;
|
||||
score = (double)((handleDegreeScore*handleRate)+(priceStability*rate));
|
||||
@@ -45,7 +45,7 @@ public class MathUtils {
|
||||
double f1 = b.setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
return f1;
|
||||
}
|
||||
//处置难易度
|
||||
//处置难易度
|
||||
public static double calHandleDegreeScore(Double agencyScore,Double quoteScore,Double trafficScore,Double distirctDensityScore,Double totalPriceScore ,Double agencyScale ,Double quoteScale ,Double trafficScale ,Double densityScale,Double totalPriceScale){
|
||||
double score = 0d;
|
||||
score = (double)((agencyScore*agencyScale)+(quoteScore*quoteScale)+(trafficScore*trafficScale)+(distirctDensityScore*densityScale)+(totalPriceScore*totalPriceScale));
|
||||
@@ -53,7 +53,7 @@ public class MathUtils {
|
||||
double f1 = b.setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
return f1;
|
||||
}
|
||||
//小区密度小于max的时候
|
||||
//小区密度小于max的时候
|
||||
public static double calDensityScoreLessThanMax(Integer quoteHouseSix,Double quoteA,Double quoteB){
|
||||
double fenmu = quoteA-quoteB;
|
||||
if(fenmu==0){
|
||||
@@ -66,7 +66,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//小区密度大于max的时候
|
||||
//小区密度大于max的时候
|
||||
public static double calDensityScoreBigThanMax(Integer quoteHouseSix,Double quoteA,Double quoteB){
|
||||
double fenmu = quoteA-quoteB;
|
||||
if(fenmu==0){
|
||||
@@ -79,7 +79,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//小区密度在中间的时候公式
|
||||
//小区密度在中间的时候公式
|
||||
public static double calDensityScoreBetween(Integer districtCount,Double densityMin,Double densityMax){
|
||||
double fenmu = densityMax-densityMin;
|
||||
if(fenmu==0){
|
||||
@@ -92,7 +92,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//交通得分
|
||||
//交通得分
|
||||
public static double calTrafficScore(Double metroScore,Double busScore,Double metroScale,Double busScale){
|
||||
double score = 0d;
|
||||
score = (metroScore*metroScale)+(busScore*busScale);
|
||||
@@ -100,7 +100,7 @@ public class MathUtils {
|
||||
double f1 = b.setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
return f1;
|
||||
}
|
||||
//地铁数量在中间的时候公式
|
||||
//地铁数量在中间的时候公式
|
||||
public static double calBusScoreBetween(Integer busCount,Double busMax,Double busMin){
|
||||
double fenmu = busMax-busMin;
|
||||
if(fenmu==0){
|
||||
@@ -113,7 +113,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//地铁数量在中间的时候公式
|
||||
//地铁数量在中间的时候公式
|
||||
public static double calMetroScoreBetween(Integer metroCount,Double metroMax,Double metroMin){
|
||||
double fenmu = metroMax-metroMin;
|
||||
if(fenmu==0){
|
||||
@@ -126,7 +126,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//挂牌量在中间的时候公式
|
||||
//挂牌量在中间的时候公式
|
||||
public static double calQuoteScoreBetween(Double quoteMax,Double quoteMin,long quoteHouseSix){
|
||||
double fenmu = quoteMax-quoteMin;
|
||||
if(fenmu==0){
|
||||
@@ -139,7 +139,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//城市均价*F<总价<城市均价*A
|
||||
//城市均价*F<总价<城市均价*A
|
||||
public static double calTotalPriceScoreLessThanA(Integer cityAvgPrice,Integer totalPrice,Double totalPriceA,Double totalPriceF){
|
||||
double fenmu = (cityAvgPrice*totalPriceA)-(cityAvgPrice*totalPriceF);
|
||||
if(fenmu==0){
|
||||
@@ -152,7 +152,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//城市均价*B<总价<城市均价*E
|
||||
//城市均价*B<总价<城市均价*E
|
||||
public static double calTotalPriceScoreLessThanE(Integer cityAvgPrice,Integer totalPrice,Double totalPriceE,Double totalPriceB){
|
||||
double fenmu = (cityAvgPrice*totalPriceE)-(cityAvgPrice*totalPriceB);
|
||||
if(fenmu==0){
|
||||
@@ -166,7 +166,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
|
||||
//中介数得分算法
|
||||
//中介数得分算法
|
||||
public static double calAgencyScore(int allAgency,Double agencyMax,Double agencyMin){
|
||||
if(agencyMax==0){
|
||||
return 0d;
|
||||
@@ -178,7 +178,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//小于一年的时候 差比小于D
|
||||
//小于一年的时候 差比小于D
|
||||
public static double absBigThanLineHigh(Double yoy,Double absDLine){
|
||||
double score = 0d;
|
||||
yoy = Math.abs(yoy);
|
||||
@@ -188,7 +188,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//小于一年的时候 差比小于c
|
||||
//小于一年的时候 差比小于c
|
||||
public static double absBigThanLineLess(Double yoy,Double absCLine){
|
||||
|
||||
double score = 0d;
|
||||
@@ -198,7 +198,7 @@ public class MathUtils {
|
||||
return f1;
|
||||
}
|
||||
|
||||
//差比小于c值得时候
|
||||
//差比小于c值得时候
|
||||
public static double absLessThanC(Double regionAbs,Double absCLine){
|
||||
if(absCLine==0){
|
||||
return 0d;
|
||||
@@ -211,7 +211,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
|
||||
//yoy>0且当小于D的时候 价格稳定指数
|
||||
//yoy>0且当小于D的时候 价格稳定指数
|
||||
public static double absLessThanZero(Double abs){
|
||||
double score = 0d;
|
||||
score = 55d+((abs+1d)*45d);
|
||||
@@ -221,20 +221,20 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
|
||||
//yoy<0且当小于D的时候 价格稳定指数
|
||||
//yoy<0且当小于D的时候 价格稳定指数
|
||||
public static double absBigThanLine(Double abs,Double absLine){
|
||||
if(absLine == 1){
|
||||
return 0d;
|
||||
}
|
||||
double score = 0d;
|
||||
//得分=10+(D-|差比|)*45/D
|
||||
//得分=10+(D-|差比|)*45/D
|
||||
score = 10d+((45d*(absLine-Math.abs(abs)))/(absLine));
|
||||
BigDecimal b = new BigDecimal(score);
|
||||
double f1 = b.setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
return f1;
|
||||
}
|
||||
|
||||
//区域涨跌幅差比
|
||||
//区域涨跌幅差比
|
||||
public static double yoyAbs(double disYoy,double regionYoy){
|
||||
double abs = (disYoy-regionYoy)/regionYoy;
|
||||
BigDecimal b = new BigDecimal(abs);
|
||||
@@ -243,7 +243,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
|
||||
//±5 ±10范围内的均价
|
||||
//±5 ±10范围内的均价
|
||||
public static Map<String,Integer> getAvgPriceChange(Integer avgPrice,Double range){
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
double minPrice = 0d;
|
||||
@@ -257,8 +257,8 @@ public class MathUtils {
|
||||
|
||||
|
||||
/**
|
||||
* yinjihuan:2017-10-13修改默认值为-1,改之前是1
|
||||
* 改为-1时房生活均价排名隐藏掉
|
||||
* yinjihuan:2017-10-13修改默认值为-1,改之前是1
|
||||
* 改为-1时房生活均价排名隐藏掉
|
||||
* @param cityLevel
|
||||
* @param citySize
|
||||
* @return
|
||||
@@ -290,10 +290,10 @@ public class MathUtils {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
// 计算最高抵押率
|
||||
// 计算最高抵押率
|
||||
public static Double getMaxCollateralRate(Double collateralTotalScore,String usage) {
|
||||
Double maxCollateralRate = 0.0;
|
||||
if(StringUtils.isNotBlank(usage)&&usage.equals("消费")){
|
||||
if(StringUtils.isNotBlank(usage)&&usage.equals("消费")){
|
||||
if (collateralTotalScore <= 100 && collateralTotalScore > 80) {
|
||||
maxCollateralRate = mul(PDSConstant.CONSUME_FACTOR,
|
||||
PDSConstant.MAX_COLLATERAL_RATE1);
|
||||
@@ -348,7 +348,7 @@ public class MathUtils {
|
||||
return maxCollateralRate;
|
||||
}
|
||||
|
||||
// 押品综合得分
|
||||
// 押品综合得分
|
||||
public static Double getCollateralTotalScore(Double priceStability,
|
||||
Double handleDegreeScore, Double priceScore, Double increaseScore) {
|
||||
Double collateralTotalScore = add(
|
||||
@@ -360,7 +360,7 @@ public class MathUtils {
|
||||
return collateralTotalScore;
|
||||
}
|
||||
|
||||
// 押品综合得分
|
||||
// 押品综合得分
|
||||
public static Double getNewCollateralTotalScore(Double priceStability,
|
||||
Double handleDegreeScore, Double priceScore, Double increaseScore) {
|
||||
Double collateralTotalScore = add(
|
||||
@@ -371,7 +371,7 @@ public class MathUtils {
|
||||
return collateralTotalScore;
|
||||
}
|
||||
|
||||
// 处理难易度指数
|
||||
// 处理难易度指数
|
||||
public static Double getHandleDegreeScore(Double houseQuoteScore,
|
||||
Double houseSellScore, Double seeTimeScore, Double agencyScore,
|
||||
Double houseHoldScore) {
|
||||
@@ -409,7 +409,7 @@ public class MathUtils {
|
||||
if (momCityLevel == 0) {
|
||||
momCityLevel = 1;
|
||||
}
|
||||
// 得分=100-100/(总名次数-1)*(A-1)
|
||||
// 得分=100-100/(总名次数-1)*(A-1)
|
||||
Double sub1 = sub((double) momCityLevel, 1.0);
|
||||
Double sub2 = sub((double) citySize, 1.0);
|
||||
Double mul = mul(sub1, 100.0);
|
||||
@@ -420,7 +420,7 @@ public class MathUtils {
|
||||
|
||||
public static Double getHouseQuoteScore(Integer citySize,
|
||||
Integer momCityLevel) {
|
||||
// 挂牌房源量得分=100-100/(总名次数-1)*(A-1)
|
||||
// 挂牌房源量得分=100-100/(总名次数-1)*(A-1)
|
||||
if(citySize>1&&momCityLevel>=1){
|
||||
Double sub1 = sub((double) momCityLevel, 1.0);
|
||||
Double sub2 = sub((double) citySize, 1.0);
|
||||
@@ -436,7 +436,7 @@ public class MathUtils {
|
||||
public static Double getPriceScore(Integer cityRank, Integer cityRankTotal) {
|
||||
if (cityRank != null && cityRankTotal != null) {
|
||||
|
||||
// 价格指数=100-100/(总名次数-1)*(A-1)
|
||||
// 价格指数=100-100/(总名次数-1)*(A-1)
|
||||
Double sub1 = sub((double) cityRank, 1.0);
|
||||
Double sub2 = sub((double) cityRankTotal, 1.0);
|
||||
Double mul = mul(100.0, sub1);
|
||||
@@ -448,7 +448,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
public static Double getIncreaseScore(int allSize, int levelInCity) {
|
||||
// 得分=100+(-1)*100/(总名次数-1)*(年涨幅城市排名-1)
|
||||
// 得分=100+(-1)*100/(总名次数-1)*(年涨幅城市排名-1)
|
||||
Double sub1 = sub((double) allSize, 1.0);
|
||||
Double sub2 = sub((double) levelInCity, 1.0);
|
||||
Double mul = mul(sub2, 100.0);
|
||||
@@ -458,7 +458,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 价格平稳度
|
||||
* 价格平稳度
|
||||
*
|
||||
* @param cityPriceStability
|
||||
* @param regionPriceStability
|
||||
@@ -473,7 +473,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 价格异常指数
|
||||
* 价格异常指数
|
||||
*/
|
||||
public static Double getPriceStability(Integer allMinusDivideSize,
|
||||
Integer minusDivideLevel) {
|
||||
@@ -491,7 +491,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得差绝对值
|
||||
* 获得差绝对值
|
||||
*
|
||||
* @param districtYearIn
|
||||
* @param cityYearIn
|
||||
@@ -503,7 +503,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加
|
||||
* 加
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
@@ -516,7 +516,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 减
|
||||
* 减
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
@@ -529,7 +529,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 乘
|
||||
* 乘
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
@@ -542,7 +542,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 除
|
||||
* 除
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
@@ -584,7 +584,7 @@ public class MathUtils {
|
||||
return found;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
System.out.println(patternCompile("1234我是","\\d+"));
|
||||
System.out.println(patternCompile("1234我是","\\d+"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Mongo3Utils {
|
||||
|
||||
|
||||
/**
|
||||
* 获取MongoServer
|
||||
* 获取MongoServer
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
@@ -47,8 +47,8 @@ public class Mongo3Utils {
|
||||
/**
|
||||
* MongoCollection
|
||||
* @param uri uri
|
||||
* @param db 数据库
|
||||
* @param name 集合
|
||||
* @param db 数据库
|
||||
* @param name 集合
|
||||
* @return
|
||||
*/
|
||||
public static MongoCollection<Document> getDbCollection(String uri, String db, String name) {
|
||||
@@ -56,9 +56,9 @@ public class Mongo3Utils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主数据库 MongoCollection
|
||||
* @param db 数据库
|
||||
* @param name 集合
|
||||
* 获取主数据库 MongoCollection
|
||||
* @param db 数据库
|
||||
* @param name 集合
|
||||
* @return
|
||||
*/
|
||||
public static MongoCollection<Document> getDbCollection(String db, String name) {
|
||||
|
||||
@@ -454,12 +454,12 @@ public abstract class NumberText {
|
||||
static enum Type { Simplified, Traditional; }
|
||||
|
||||
static enum Connect {
|
||||
Di ("第", "第"),
|
||||
Fu ("负", "負"),
|
||||
Ling ("零", "零"),
|
||||
Shi ("十", "拾"),
|
||||
Bai ("百", "佰"),
|
||||
Qian ("千", "仟"),
|
||||
Di ("第", "第"),
|
||||
Fu ("负", "負"),
|
||||
Ling ("零", "零"),
|
||||
Shi ("十", "拾"),
|
||||
Bai ("百", "佰"),
|
||||
Qian ("千", "仟"),
|
||||
;
|
||||
|
||||
final String display, displayTraditional;
|
||||
@@ -471,17 +471,17 @@ public abstract class NumberText {
|
||||
|
||||
static enum Power {
|
||||
|
||||
Wan ("万", "萬"), // 10^4
|
||||
Yi ("亿", "億"), // 10^8
|
||||
Zhao ("兆", "兆"), // 10^12
|
||||
Jing ("京", "京"), // 10^16 (enough for Long.MAX_VALUE)
|
||||
Gai ("垓", "垓"), // 10^20
|
||||
Zi ("秭", "秭"), // 10^24
|
||||
Rang ("穰", "穰"), // 10^28
|
||||
Gou ("沟", "溝"), // 10^32
|
||||
Jian ("涧", "澗"), // 10^36
|
||||
Zheng ("正", "正"), // 10^40
|
||||
Zai ("载", "載"), // 10^44
|
||||
Wan ("万", "萬"), // 10^4
|
||||
Yi ("亿", "億"), // 10^8
|
||||
Zhao ("兆", "兆"), // 10^12
|
||||
Jing ("京", "京"), // 10^16 (enough for Long.MAX_VALUE)
|
||||
Gai ("垓", "垓"), // 10^20
|
||||
Zi ("秭", "秭"), // 10^24
|
||||
Rang ("穰", "穰"), // 10^28
|
||||
Gou ("沟", "溝"), // 10^32
|
||||
Jian ("涧", "澗"), // 10^36
|
||||
Zheng ("正", "正"), // 10^40
|
||||
Zai ("载", "載"), // 10^44
|
||||
;
|
||||
|
||||
final String display, displayTraditional;
|
||||
@@ -493,16 +493,16 @@ public abstract class NumberText {
|
||||
|
||||
static enum Digit {
|
||||
|
||||
Ling ("零", "零"), // just to occupy this position
|
||||
Yi ("一", "壹"),
|
||||
Er ("二", "贰"),
|
||||
San ("三", "叁"),
|
||||
Si ("四", "肆"),
|
||||
Wu ("五", "伍"),
|
||||
Liu ("六", "陆"),
|
||||
Qi ("七", "柒"),
|
||||
Ba ("八", "捌"),
|
||||
Jiu ("九", "玖"),
|
||||
Ling ("零", "零"), // just to occupy this position
|
||||
Yi ("一", "壹"),
|
||||
Er ("二", "贰"),
|
||||
San ("三", "叁"),
|
||||
Si ("四", "肆"),
|
||||
Wu ("五", "伍"),
|
||||
Liu ("六", "陆"),
|
||||
Qi ("七", "柒"),
|
||||
Ba ("八", "捌"),
|
||||
Jiu ("九", "玖"),
|
||||
;
|
||||
|
||||
final String display, displayTraditional;
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
public class Numeric2Chinese {
|
||||
static String[] units = new String[] { "十", "百", "千", "万", "十", "百", "千",
|
||||
"亿" };
|
||||
static String[] numeric = new String[] { "零", "一", "二", "三", "四", "五", "六",
|
||||
"七", "八", "九" };
|
||||
static String[] units = new String[] { "十", "百", "千", "万", "十", "百", "千",
|
||||
"亿" };
|
||||
static String[] numeric = new String[] { "零", "一", "二", "三", "四", "五", "六",
|
||||
"七", "八", "九" };
|
||||
|
||||
static String numeric2Chinese(String s) {
|
||||
String res = "";
|
||||
for (int k = -1; s.length() > 0; k++) {
|
||||
// 解析最后一位
|
||||
// 解析最后一位
|
||||
int j = Integer.parseInt(s.substring(s.length() - 1, s.length()));
|
||||
String rtemp = numeric[j];
|
||||
|
||||
// 数值不是0且不是个位 或者是万位或者是亿位 则去取单位
|
||||
// 数值不是0且不是个位 或者是万位或者是亿位 则去取单位
|
||||
if (j != 0 && k != -1 || k % 8 == 3 || k % 8 == 7) {
|
||||
rtemp += units[k % 8];
|
||||
}
|
||||
|
||||
// 拼在之前的前面
|
||||
// 拼在之前的前面
|
||||
res = rtemp + res;
|
||||
|
||||
// 去除最后一位
|
||||
// 去除最后一位
|
||||
s = s.substring(0, s.length() - 1);
|
||||
}
|
||||
|
||||
// 去除后面连续的零零..
|
||||
// 去除后面连续的零零..
|
||||
while (res.endsWith(numeric[0])) {
|
||||
res = res.substring(0, res.lastIndexOf(numeric[0]));
|
||||
}
|
||||
|
||||
// 将零零替换成零
|
||||
// 将零零替换成零
|
||||
while (res.indexOf(numeric[0] + numeric[0]) != -1) {
|
||||
res = res.replaceAll(numeric[0] + numeric[0], numeric[0]);
|
||||
}
|
||||
|
||||
// 将 零+某个单位 这样的窜替换成 该单位 去掉单位前面的零
|
||||
// 将 零+某个单位 这样的窜替换成 该单位 去掉单位前面的零
|
||||
for (int m = 1; m < units.length; m++) {
|
||||
res = res.replaceAll(numeric[0] + units[m], units[m]);
|
||||
}
|
||||
|
||||
@@ -3,17 +3,17 @@ package com.fangjia.core.util;
|
||||
|
||||
public class PDSConstant {
|
||||
public static final Double ZERO = 0.0;
|
||||
public static final Double CITY_UNUSUAL_FACTOR = 0.4;//城市平稳度指数
|
||||
public static final Double REGION_UNUSUAL_FACTOR = 0.6;//区域平稳度指数
|
||||
public static final Double HOUSE_QUOTE_FACTOR = 0.4;//小区同类型挂牌房源量
|
||||
public static final Double HOUSE_SELL_FACTOR = 0.1;//小区成交量
|
||||
public static final Double SEE_TIME_FACTOR = 0.1;//房源带看数
|
||||
public static final Double AGENCY_COUNT_FACTOR = 0.3;//中介数
|
||||
public static final Double HOUSE_HOLD_FACTOR = 0.1;//户数
|
||||
public static final Double PRICE_STABILITY_FACTOR = 0.2;//价格异常指数
|
||||
public static final Double HANDLE_DEGREESCORE_FACTOR = 0.3;//处置难易度指数
|
||||
public static final Double PRICE_SCORE_FACTOR = 0.3;//价格指数
|
||||
public static final Double INCREASE_SCORE_FACTOR = 0.2;//年涨跌幅
|
||||
public static final Double CITY_UNUSUAL_FACTOR = 0.4;//城市平稳度指数
|
||||
public static final Double REGION_UNUSUAL_FACTOR = 0.6;//区域平稳度指数
|
||||
public static final Double HOUSE_QUOTE_FACTOR = 0.4;//小区同类型挂牌房源量
|
||||
public static final Double HOUSE_SELL_FACTOR = 0.1;//小区成交量
|
||||
public static final Double SEE_TIME_FACTOR = 0.1;//房源带看数
|
||||
public static final Double AGENCY_COUNT_FACTOR = 0.3;//中介数
|
||||
public static final Double HOUSE_HOLD_FACTOR = 0.1;//户数
|
||||
public static final Double PRICE_STABILITY_FACTOR = 0.2;//价格异常指数
|
||||
public static final Double HANDLE_DEGREESCORE_FACTOR = 0.3;//处置难易度指数
|
||||
public static final Double PRICE_SCORE_FACTOR = 0.3;//价格指数
|
||||
public static final Double INCREASE_SCORE_FACTOR = 0.2;//年涨跌幅
|
||||
|
||||
public static final Double MAX_COLLATERAL_RATE1 = 1.0;//90-100
|
||||
public static final Double MAX_COLLATERAL_RATE2 = 0.97;//80-90
|
||||
@@ -22,47 +22,47 @@ public class PDSConstant {
|
||||
public static final Double MAX_COLLATERAL_RATE5 = 0.8;//50-60
|
||||
public static final Double MAX_COLLATERAL_RATE6 = 0.0;//40-50
|
||||
|
||||
public static final Double CONSUME_FACTOR = 0.6;//消费
|
||||
public static final Double MANAGE_FACTOR = 0.7;//经营
|
||||
public static final String NO_DATA_MSG = "未知";
|
||||
public static final Double CONSUME_FACTOR = 0.6;//消费
|
||||
public static final Double MANAGE_FACTOR = 0.7;//经营
|
||||
public static final String NO_DATA_MSG = "未知";
|
||||
|
||||
|
||||
//pds1.3相关默认参数
|
||||
//pds1.3相关默认参数
|
||||
public static final Double ABSD_LINE = -1.3d;//
|
||||
public static final Double ABSC_LINE = 1d;//
|
||||
|
||||
public static final Double AGENCY_MAX = 90d;//中介最大数
|
||||
public static final Double AGENCY_MIN = 0d;//中介最小值
|
||||
public static final Double AGENCY_SCALE = 0.2d;//中介得分比例
|
||||
public static final Double AGENCY_MAX = 90d;//中介最大数
|
||||
public static final Double AGENCY_MIN = 0d;//中介最小值
|
||||
public static final Double AGENCY_SCALE = 0.2d;//中介得分比例
|
||||
|
||||
public static final Double TOTALPRICE_SCOREA = 270d;//总价A值
|
||||
public static final Double TOTALPRICE_SCOREB = 18d;//总价B值
|
||||
public static final Double TOTALPRICE_SCOREE = 54d;//总价E值
|
||||
public static final Double TOTALPRICE_SCOREF = 72d;//总价F值
|
||||
public static final Double TOTALPRICE_SCALE = 0.2d;//房屋总价权重
|
||||
public static final Double TOTALPRICE_SCOREA = 270d;//总价A值
|
||||
public static final Double TOTALPRICE_SCOREB = 18d;//总价B值
|
||||
public static final Double TOTALPRICE_SCOREE = 54d;//总价E值
|
||||
public static final Double TOTALPRICE_SCOREF = 72d;//总价F值
|
||||
public static final Double TOTALPRICE_SCALE = 0.2d;//房屋总价权重
|
||||
|
||||
public static final Double QUOTE_SCALE = 0.3d;//发布量权重
|
||||
public static final Double QUOTE_MAX = 900d;//发布量max值
|
||||
public static final Double QUOTE_MIN = 0d;//发布量min值
|
||||
public static final Double QUOTE_SCALE = 0.3d;//发布量权重
|
||||
public static final Double QUOTE_MAX = 900d;//发布量max值
|
||||
public static final Double QUOTE_MIN = 0d;//发布量min值
|
||||
|
||||
public static final Double TRAFFIC_SCALE = 0.2d;//交通权重
|
||||
public static final Double BUS_SCALE = 0.6d;//公交权重
|
||||
public static final Double METRO_SCALE = 0.4d;//地铁权重
|
||||
public static final Double BUS_MAX = 48d;//公交数量max值
|
||||
public static final Double BUS_MIN = 0d;//公交数量min值
|
||||
public static final Double METRO_MAX = 5d;//地铁数量max值
|
||||
public static final Double METRO_MIN = 0d;//地铁数量min值
|
||||
public static final Double TRAFFIC_SCALE = 0.2d;//交通权重
|
||||
public static final Double BUS_SCALE = 0.6d;//公交权重
|
||||
public static final Double METRO_SCALE = 0.4d;//地铁权重
|
||||
public static final Double BUS_MAX = 48d;//公交数量max值
|
||||
public static final Double BUS_MIN = 0d;//公交数量min值
|
||||
public static final Double METRO_MAX = 5d;//地铁数量max值
|
||||
public static final Double METRO_MIN = 0d;//地铁数量min值
|
||||
|
||||
public static final Double DENSITY_SCALE = 0.1d;//小区密度权重
|
||||
public static final Double DENSITY_MAX = 400d;//小区密度max值
|
||||
public static final Double DENSITY_MIN = 10d;//小区密度min值
|
||||
public static final Double DENSITY_RADIUS = 1.0d;//小区密度取值半径范围
|
||||
public static final Double QUOTE_A = 850d;//发布量A值
|
||||
public static final Double DENSITY_SCALE = 0.1d;//小区密度权重
|
||||
public static final Double DENSITY_MAX = 400d;//小区密度max值
|
||||
public static final Double DENSITY_MIN = 10d;//小区密度min值
|
||||
public static final Double DENSITY_RADIUS = 1.0d;//小区密度取值半径范围
|
||||
public static final Double QUOTE_A = 850d;//发布量A值
|
||||
public static final Double QUOTE_B = 200d;//
|
||||
|
||||
public static final Double PRICE_STABILITY_SCALE = 0.2d;//价格异常指数权重
|
||||
public static final Double PRICE_STABILITY_SCALE = 0.2d;//价格异常指数权重
|
||||
|
||||
public static final Double HANDLE_STABILITY_SCALE = 0.8d;//押品处置风险权重
|
||||
public static final Double HANDLE_STABILITY_SCALE = 0.8d;//押品处置风险权重
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,23 +4,23 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页查询值对象
|
||||
* 分页查询值对象
|
||||
* @author yinjihuan
|
||||
* @param <E> 返回数据类型
|
||||
* @param <E> 返回数据类型
|
||||
*/
|
||||
public class PageBean<E> {
|
||||
|
||||
private int start;//起始记录数
|
||||
private int start;//起始记录数
|
||||
|
||||
private int limit;//最大记录数
|
||||
private int limit;//最大记录数
|
||||
|
||||
private long totalRecords;//总记录数
|
||||
private long totalRecords;//总记录数
|
||||
|
||||
private int currentPage;//当前页
|
||||
private int currentPage;//当前页
|
||||
|
||||
private int totalPages;//总页数
|
||||
private int totalPages;//总页数
|
||||
|
||||
private List<E> list;//查询数据对象
|
||||
private List<E> list;//查询数据对象
|
||||
|
||||
public static int page2Start(int page, int limit){
|
||||
return page * limit - limit;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Random;
|
||||
public class PriceData {
|
||||
private String yearmonth;
|
||||
private Double price;
|
||||
private Double volume; // 新增成交量字段
|
||||
private Double volume; // 新增成交量字段
|
||||
|
||||
public PriceData() {}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.apache.commons.lang.math.RandomUtils;
|
||||
|
||||
public final class RandomUtil extends RandomUtils {
|
||||
/**
|
||||
* 随机得到两个Long类型数字间任意数字
|
||||
* 随机得到两个Long类型数字间任意数字
|
||||
*
|
||||
* @param l1
|
||||
* @param l2
|
||||
@@ -17,7 +17,7 @@ public final class RandomUtil extends RandomUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机得到两个Long类型数字间任意数字
|
||||
* 随机得到两个Long类型数字间任意数字
|
||||
*
|
||||
* @param i1
|
||||
* @param i2
|
||||
|
||||
@@ -13,10 +13,10 @@ public class SeaweedUtils {
|
||||
System.out.println(formatVirescencePercent("1"));
|
||||
}
|
||||
/**
|
||||
* 标准化输出绿化率
|
||||
* 标准化输出绿化率
|
||||
*/
|
||||
public static String formatVirescencePercent(String virescence_percent) {
|
||||
// 绿化率
|
||||
// 绿化率
|
||||
if (StringUtils.isNotBlank(virescence_percent) && checkValue(virescence_percent)!=null) {
|
||||
double val = Double.valueOf(virescence_percent);
|
||||
if (val < 1) {
|
||||
@@ -34,7 +34,7 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化容积率输出
|
||||
* 标准化容积率输出
|
||||
*/
|
||||
public static String formatCubagePercent(String cubage_percent) {
|
||||
if (StringUtils.isNotBlank(cubage_percent) && checkValue(cubage_percent)!=null) {
|
||||
@@ -57,7 +57,7 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化车位输出
|
||||
* 标准化车位输出
|
||||
*/
|
||||
public static String formatCarSiteCount(String car_site_count) {
|
||||
if (StringUtils.isNotBlank(car_site_count) && checkValue(car_site_count)!=null) {
|
||||
@@ -71,12 +71,12 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化户数输出
|
||||
* 标准化户数输出
|
||||
*/
|
||||
public static String formatHouseholdCount(String household_count) {
|
||||
if (StringUtils.isNotBlank(household_count) && checkValue(household_count)!=null ) {
|
||||
if (Integer.valueOf(household_count) < 50) {
|
||||
return null; // 户数
|
||||
return null; // 户数
|
||||
}
|
||||
return household_count;
|
||||
}
|
||||
@@ -84,14 +84,14 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化总占地面积输出
|
||||
* 标准化总占地面积输出
|
||||
*/
|
||||
public static String formatAllArea(String all_area) {
|
||||
if (StringUtils.isNotBlank(all_area)) {
|
||||
Double formattedVal = 0.0;
|
||||
if (all_area.toString().indexOf("公顷") != -1) {
|
||||
if (all_area.toString().indexOf("公顷") != -1) {
|
||||
String val = all_area.toString();
|
||||
formattedVal = (Double.valueOf(val.substring(0, val.indexOf("公顷"))) * 10000);
|
||||
formattedVal = (Double.valueOf(val.substring(0, val.indexOf("公顷"))) * 10000);
|
||||
} else if(checkValue(all_area)!=null) {
|
||||
formattedVal = Double.valueOf(all_area);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取浮点数与整数
|
||||
* 提取浮点数与整数
|
||||
*/
|
||||
static String getNumber(String input) {
|
||||
Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?");
|
||||
@@ -168,7 +168,7 @@ public class SeaweedUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 正则表达式去掉多余的.与0
|
||||
* 正则表达式去掉多余的.与0
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SecurityUtil {
|
||||
Security.addProvider(new com.sun.crypto.provider.SunJCE());
|
||||
}
|
||||
|
||||
private static String Algorithm = "DES"; // 定义 加密算法,可用 DES,DESede,Blowfish
|
||||
private static String Algorithm = "DES"; // 定义 加密算法,可用 DES,DESede,Blowfish
|
||||
private static String PK = "525E9DC4D0382C4C";
|
||||
private static byte[] PK_BYTES = DataUtil.hex2byte(PK);
|
||||
private static final Pattern TOKEN_PATTERN = Pattern.compile("[A-Fa-f0-9]+");
|
||||
@@ -30,7 +30,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* 加密
|
||||
*
|
||||
* @throws NoSuchPaddingException
|
||||
* @throws NoSuchAlgorithmException
|
||||
@@ -44,7 +44,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* 解密
|
||||
*/
|
||||
public static byte[] decode(byte[] input, byte[] key) throws Exception {
|
||||
SecretKey deskey = new javax.crypto.spec.SecretKeySpec(key, Algorithm);
|
||||
@@ -55,7 +55,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成密钥, 注意此步骤时间比较长
|
||||
* 生成密钥, 注意此步骤时间比较长
|
||||
*/
|
||||
public static byte[] getKey() throws Exception {
|
||||
KeyGenerator keygen = KeyGenerator.getInstance(Algorithm);
|
||||
@@ -64,7 +64,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对输入字符串进行加密
|
||||
* 对输入字符串进行加密
|
||||
*
|
||||
* @param s
|
||||
* @return
|
||||
@@ -88,7 +88,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对输入的加密参数进行解密
|
||||
* 对输入的加密参数进行解密
|
||||
*
|
||||
* @param s
|
||||
* @return
|
||||
@@ -108,7 +108,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据tokenString得到实际的值
|
||||
* 根据tokenString得到实际的值
|
||||
*
|
||||
* @param tokenString
|
||||
* @return
|
||||
@@ -125,7 +125,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到随机的数值
|
||||
* 得到随机的数值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ public class SecurityUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是有效的验证码
|
||||
* 是否是有效的验证码
|
||||
*
|
||||
* @param tokenString
|
||||
* @param sand
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取第一个字符
|
||||
* 截取第一个字符
|
||||
*
|
||||
* @param spell
|
||||
* @return
|
||||
@@ -109,11 +109,11 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全角字符串转化成半角
|
||||
* 全角字符串转化成半角
|
||||
*
|
||||
* @param value
|
||||
* 全角字符串
|
||||
* @return 转化后的半角字符串
|
||||
* 全角字符串
|
||||
* @return 转化后的半角字符串
|
||||
*/
|
||||
public static final String sbcChange(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
@@ -183,7 +183,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 求2个字符串的最大连续子集
|
||||
* 求2个字符串的最大连续子集
|
||||
*
|
||||
* @param str1
|
||||
* @param str2
|
||||
@@ -219,12 +219,12 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页输入框中的字符串解析
|
||||
* 首页输入框中的字符串解析
|
||||
*
|
||||
* @param str
|
||||
* 需要被解析的字符串
|
||||
* @return map对象的key分别为keyword,houseNum,roomNum
|
||||
* map对象的value对应为解析出的keyword,houseNum,roomNum,如果没有解析到返回为 null;
|
||||
* 需要被解析的字符串
|
||||
* @return map对象的key分别为keyword,houseNum,roomNum
|
||||
* map对象的value对应为解析出的keyword,houseNum,roomNum,如果没有解析到返回为 null;
|
||||
*/
|
||||
public static Map<String, String> shouYeAnalyticsString(String str) {
|
||||
if (StringUtils.isBlank(str)) {
|
||||
@@ -253,17 +253,17 @@ public class StringUtil {
|
||||
|
||||
if (m != null) {
|
||||
try {
|
||||
if (tmpKey != null && tmpKey.startsWith("10")) {// 只输入"号"
|
||||
houseNum = m.group(1).replace("号", "").replace("幢", "").replace("栋", "").replace("座", "").replace("坐", "");
|
||||
} else if (tmpKey != null && tmpKey.startsWith("20")) {// 只输入"室"
|
||||
roomNum = m.group(1).replace("室", "").replace("层", "");
|
||||
if (tmpKey != null && tmpKey.startsWith("10")) {// 只输入"号"
|
||||
houseNum = m.group(1).replace("号", "").replace("幢", "").replace("栋", "").replace("座", "").replace("坐", "");
|
||||
} else if (tmpKey != null && tmpKey.startsWith("20")) {// 只输入"室"
|
||||
roomNum = m.group(1).replace("室", "").replace("层", "");
|
||||
} else {
|
||||
if (m.group(1) != null) {
|
||||
houseNum = m.group(1).replace("号", "").replace("幢", "").replace("栋", "").replace("座", "")
|
||||
.replace("坐", "");
|
||||
houseNum = m.group(1).replace("号", "").replace("幢", "").replace("栋", "").replace("座", "")
|
||||
.replace("坐", "");
|
||||
}
|
||||
if (m.group(2) != null) {
|
||||
roomNum = m.group(2).replace("室", "").replace("层", "");
|
||||
roomNum = m.group(2).replace("室", "").replace("层", "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -294,7 +294,7 @@ public class StringUtil {
|
||||
ret.put("roomNum", roomNum);
|
||||
ret.put("houseNum", houseNum);
|
||||
ret.put("keyword", bak.substring(0, index).trim());
|
||||
ret.put("rule", rule); // 调试使用
|
||||
ret.put("rule", rule); // 调试使用
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,10 +302,10 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到匹配规则 map : key小于100的为号,室都输入 100-199的为只输入"号" 200-299的为只输入"室"
|
||||
* 300-399什么都没有输入
|
||||
* 得到匹配规则 map : key小于100的为号,室都输入 100-199的为只输入"号" 200-299的为只输入"室"
|
||||
* 300-399什么都没有输入
|
||||
*
|
||||
* value为对应的匹配规则
|
||||
* value为对应的匹配规则
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -320,30 +320,30 @@ public class StringUtil {
|
||||
map.put("004", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)\\s+([0-9A-Za-z]+)$")); // ##
|
||||
// X
|
||||
// X
|
||||
map.put("005", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+[室|层])$")); // ##X号X室
|
||||
map.put("006", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X号X室
|
||||
map.put("007", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])\\s([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X号
|
||||
// X室
|
||||
map.put("008", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+)$")); // ##
|
||||
// X号X
|
||||
map.put("009", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+)$")); // ##X号X
|
||||
map.put("010", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])\\s([0-9A-Za-z]+)$")); // ##
|
||||
// X号
|
||||
map.put("005", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+[室|层])$")); // ##X号X室
|
||||
map.put("006", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X号X室
|
||||
map.put("007", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])\\s([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X号
|
||||
// X室
|
||||
map.put("008", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+)$")); // ##
|
||||
// X号X
|
||||
map.put("009", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+[号|栋|幢|坐|座])([0-9A-Za-z]+)$")); // ##X号X
|
||||
map.put("010", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])\\s([0-9A-Za-z]+)$")); // ##
|
||||
// X号
|
||||
// X
|
||||
map.put("011", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])-([0-9A-Za-z]+)$")); // ##
|
||||
// X号-X
|
||||
map.put("012", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+)-([0-9A-Za-z]+[室|层])$")); // ##X-X室
|
||||
map.put("013", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)-([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X-X室
|
||||
// map.put("14", Pattern.compile("")); //##X号 X号 X室
|
||||
// 只输入一个数字时
|
||||
map.put("101", Pattern.compile("[^0-9A-Za-z]+([0-9A-Za-z]+)号$"));
|
||||
map.put("102", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)号$"));
|
||||
map.put("011", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+[号|栋|幢|坐|座])-([0-9A-Za-z]+)$")); // ##
|
||||
// X号-X
|
||||
map.put("012", Pattern.compile("[^0-9A-Za-z\\s]+([0-9A-Za-z]+)-([0-9A-Za-z]+[室|层])$")); // ##X-X室
|
||||
map.put("013", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)-([0-9A-Za-z]+[室|层])$")); // ##
|
||||
// X-X室
|
||||
// map.put("14", Pattern.compile("")); //##X号 X号 X室
|
||||
// 只输入一个数字时
|
||||
map.put("101", Pattern.compile("[^0-9A-Za-z]+([0-9A-Za-z]+)号$"));
|
||||
map.put("102", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)号$"));
|
||||
|
||||
map.put("201", Pattern.compile("[^0-9A-Za-z]+([0-9A-Za-z]+)室$"));
|
||||
map.put("202", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)室$"));
|
||||
map.put("201", Pattern.compile("[^0-9A-Za-z]+([0-9A-Za-z]+)室$"));
|
||||
map.put("202", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)室$"));
|
||||
|
||||
map.put("301", Pattern.compile("[^0-9A-Za-z]+\\s([0-9A-Za-z]+)$"));
|
||||
|
||||
@@ -366,7 +366,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含屏蔽字 返回所包含的第一个屏蔽字 如果不是屏蔽字,返回null
|
||||
* 是否包含屏蔽字 返回所包含的第一个屏蔽字 如果不是屏蔽字,返回null
|
||||
*/
|
||||
public static String isDirtyWord(String word) {
|
||||
String wd = StringUtils.deleteWhitespace(word);
|
||||
@@ -384,7 +384,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取fileName.properties文件中属性为name的值
|
||||
* 读取fileName.properties文件中属性为name的值
|
||||
*
|
||||
* @param name
|
||||
* @param fileName
|
||||
@@ -412,7 +412,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 把字符串按","或","分隔,返回List
|
||||
* 把字符串按","或","分隔,返回List
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
@@ -423,7 +423,7 @@ public class StringUtil {
|
||||
if (StringUtils.isEmpty(strWithOutSpace)) {
|
||||
return null;
|
||||
}
|
||||
String[] arrWithOutSpace = StringUtils.split(strWithOutSpace, ",|,");
|
||||
String[] arrWithOutSpace = StringUtils.split(strWithOutSpace, ",|,");
|
||||
List<String> result = Arrays.asList(arrWithOutSpace);
|
||||
return result;
|
||||
}
|
||||
@@ -443,24 +443,24 @@ public class StringUtil {
|
||||
if (bytes.length > length) {
|
||||
nFill = true;
|
||||
}
|
||||
int n = 0; // 表示当前的字节数
|
||||
int i = 2; // 要截取的字节数,从第3个字节开始
|
||||
int n = 0; // 表示当前的字节数
|
||||
int i = 2; // 要截取的字节数,从第3个字节开始
|
||||
for (; i < bytes.length && n < length; i++) {
|
||||
// 奇数位置,如3、5、7等,为UCS2编码中两个字节的第二个字节
|
||||
// 奇数位置,如3、5、7等,为UCS2编码中两个字节的第二个字节
|
||||
if (i % 2 == 1) {
|
||||
n++; // 在UCS2第二个字节时n加1
|
||||
n++; // 在UCS2第二个字节时n加1
|
||||
} else {
|
||||
// 当UCS2编码的第一个字节不等于0时,该UCS2字符为汉字,一个汉字算两个字节
|
||||
// 当UCS2编码的第一个字节不等于0时,该UCS2字符为汉字,一个汉字算两个字节
|
||||
if (bytes[i] != 0) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果i为奇数时,处理成偶数
|
||||
// 如果i为奇数时,处理成偶数
|
||||
if (i % 2 == 1) {
|
||||
// 该UCS2字符是汉字时,去掉这个截一半的汉字
|
||||
// 该UCS2字符是汉字时,去掉这个截一半的汉字
|
||||
if (bytes[i - 1] != 0) {
|
||||
i = i - 1;// 该UCS2字符是字母或数字,则保留该字符
|
||||
i = i - 1;// 该UCS2字符是字母或数字,则保留该字符
|
||||
} else {
|
||||
i = i + 1;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割字符串
|
||||
* 分割字符串
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
@@ -484,7 +484,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符串中数字
|
||||
* 获取字符串中数字
|
||||
*
|
||||
* @param in
|
||||
* @return
|
||||
|
||||
@@ -11,29 +11,29 @@ import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* SVG工具类,用于生成价格趋势的SVG图表
|
||||
* SVG工具类,用于生成价格趋势的SVG图表
|
||||
*/
|
||||
|
||||
public class SvgUtils {
|
||||
|
||||
// SVG画布尺寸
|
||||
// SVG画布尺寸
|
||||
private static final int WIDTH = 800;
|
||||
private static final int HEIGHT = 500;
|
||||
private static final int PADDING = 60;
|
||||
|
||||
// 生成SVG折线图(支持多条线),新增decimalPlaces参数控制Y轴小数位
|
||||
// 生成SVG折线图(支持多条线),新增decimalPlaces参数控制Y轴小数位
|
||||
public static String generatePriceTrendSvg(List<List<PriceData>> dataSets, List<String> labels, String title, String subtitle, int decimalPlaces) {
|
||||
if (dataSets.isEmpty() || dataSets.get(0).isEmpty()) {
|
||||
return "<svg xmlns='http://www.w3.org/2000/svg' width='" + WIDTH + "' height='" + HEIGHT + "'></svg>";
|
||||
}
|
||||
// 过滤为空的数据
|
||||
// 过滤为空的数据
|
||||
dataSets = dataSets.stream()
|
||||
.map(innerList -> innerList.stream()
|
||||
.filter(priceData -> priceData != null && priceData.getPrice() != null)
|
||||
.collect(Collectors.toList()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 计算价格和时间的范围
|
||||
// 计算价格和时间的范围
|
||||
double minPrice = dataSets.stream()
|
||||
.flatMap(List::stream)
|
||||
.filter((p) -> p != null && p.getPrice() != null)
|
||||
@@ -50,14 +50,14 @@ public class SvgUtils {
|
||||
minPrice = minPrice * (1 - buffer);
|
||||
maxPrice = maxPrice * (1 + buffer);
|
||||
|
||||
// 如果decimalPlaces为0,调整minPrice和maxPrice为整数等差
|
||||
// 如果decimalPlaces为0,调整minPrice和maxPrice为整数等差
|
||||
// if (decimalPlaces == 0) {
|
||||
// long step = calculateStep((long) Math.ceil(maxPrice) - (long) Math.floor(minPrice));
|
||||
// minPrice = Math.floor(minPrice / step) * step;
|
||||
// maxPrice = Math.ceil(maxPrice / step) * step;
|
||||
// }
|
||||
|
||||
// 解析最小和最大日期
|
||||
// 解析最小和最大日期
|
||||
String minYearMonth = dataSets.stream()
|
||||
.flatMap(List::stream)
|
||||
.map(PriceData::getYearmonth)
|
||||
@@ -69,22 +69,22 @@ public class SvgUtils {
|
||||
.max(String::compareTo)
|
||||
.orElse("2025-01");
|
||||
|
||||
// 构建SVG内容
|
||||
// 构建SVG内容
|
||||
StringBuilder svg = new StringBuilder();
|
||||
svg.append(String.format("<svg xmlns='http://www.w3.org/2000/svg' width='%d' height='%d'>", WIDTH, HEIGHT));
|
||||
svg.append(String.format("<rect width='%d' height='%d' fill='#ffffff'/>", WIDTH, HEIGHT));
|
||||
|
||||
// 添加标题和副标题
|
||||
// 添加标题和副标题
|
||||
svg.append(String.format("<text x='%d' y='%d' font-size='20' font-family='Arial' fill='#333333' font-weight='bold' text-anchor='middle'>%s</text>",
|
||||
WIDTH / 2, 30, title));
|
||||
svg.append(String.format("<text x='%d' y='%d' font-size='14' font-family='Arial' fill='#666666' text-anchor='middle'>%s</text>",
|
||||
WIDTH / 2, 50, subtitle));
|
||||
|
||||
// 画虚线网格线和坐标轴
|
||||
// 画虚线网格线和坐标轴
|
||||
svg.append(drawGrid(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces));
|
||||
svg.append(drawAxis(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces));
|
||||
|
||||
// 画多条折线和图例
|
||||
// 画多条折线和图例
|
||||
String[] colors = {"#66B3FF", "#FF6666", "#FFA500", "#8A2BE2"};
|
||||
for (int i = 0; i < dataSets.size(); i++) {
|
||||
svg.append(drawSmoothLine(dataSets.get(i), minYearMonth, maxYearMonth, minPrice, maxPrice, colors[i % colors.length], decimalPlaces));
|
||||
@@ -96,14 +96,14 @@ public class SvgUtils {
|
||||
return svg.toString();
|
||||
}
|
||||
|
||||
// 绘制平滑折线
|
||||
// 绘制平滑折线
|
||||
private static String drawSmoothLine(List<PriceData> data, String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, String color, int decimalPlaces) {
|
||||
// if (data.size() < 2) return "";
|
||||
StringBuilder path = new StringBuilder("<path d='M");
|
||||
StringBuilder pointsAndLabels = new StringBuilder();
|
||||
int totalMonths = getMonthIndex(maxYearMonth) - getMonthIndex(minYearMonth) + 1;
|
||||
if (data.size() == 1) {
|
||||
// 处理只有一个数据点的情况
|
||||
// 处理只有一个数据点的情况
|
||||
PriceData point = data.get(0);
|
||||
int monthIndex = Math.max(0, Math.min(totalMonths - 1, getMonthIndex(point.getYearmonth()) - getMonthIndex(minYearMonth)));
|
||||
int x = WIDTH / 2;
|
||||
@@ -153,7 +153,7 @@ public class SvgUtils {
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
// 绘制网格线
|
||||
// 绘制网格线
|
||||
private static String drawGrid(String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, int decimalPlaces) {
|
||||
StringBuilder grid = new StringBuilder();
|
||||
double step = calculateYStep(minPrice, maxPrice, decimalPlaces);
|
||||
@@ -169,22 +169,22 @@ public class SvgUtils {
|
||||
return grid.toString();
|
||||
}
|
||||
|
||||
// 绘制坐标轴
|
||||
// 绘制坐标轴
|
||||
private static String drawAxis(String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, int decimalPlaces) {
|
||||
StringBuilder axis = new StringBuilder();
|
||||
|
||||
// X轴
|
||||
// X轴
|
||||
axis.append(String.format("<line x1='%d' y1='%d' x2='%d' y2='%d' stroke='#333333' stroke-width='2'/>",
|
||||
PADDING, HEIGHT - PADDING, WIDTH - PADDING, HEIGHT - PADDING));
|
||||
axis.append(String.format("<line x1='%d' y1='%d' x2='%d' y2='%d' stroke='#333333' stroke-width='2'/>",
|
||||
PADDING, PADDING, PADDING, HEIGHT - PADDING));
|
||||
|
||||
// X轴刻度
|
||||
// X轴刻度
|
||||
int totalMonths = getMonthIndex(maxYearMonth) - getMonthIndex(minYearMonth) + 1;
|
||||
for (int i = 0; i < totalMonths; i++) {
|
||||
int x;
|
||||
if (totalMonths == 1) {
|
||||
// 当只有一个月时,将刻度放在中间位置
|
||||
// 当只有一个月时,将刻度放在中间位置
|
||||
x = PADDING + (WIDTH - 2 * PADDING) / 2;
|
||||
} else {
|
||||
x = PADDING + i * (WIDTH - 2 * PADDING) / (totalMonths - 1);
|
||||
@@ -196,7 +196,7 @@ public class SvgUtils {
|
||||
x, HEIGHT - PADDING + 20, monthLabel));
|
||||
}
|
||||
|
||||
// Y轴刻度
|
||||
// Y轴刻度
|
||||
double step = calculateYStep(minPrice, maxPrice, decimalPlaces);
|
||||
int numSteps = (int) ((maxPrice - minPrice) / step) + 1;
|
||||
for (int i = 0; i < numSteps; i++) {
|
||||
@@ -211,18 +211,18 @@ public class SvgUtils {
|
||||
return axis.toString();
|
||||
}
|
||||
|
||||
// 计算Y轴步长
|
||||
// 计算Y轴步长
|
||||
private static double calculateYStep(double minPrice, double maxPrice, int decimalPlaces) {
|
||||
double range = maxPrice - minPrice;
|
||||
if (decimalPlaces == 0) {
|
||||
return calculateStep((long) range);
|
||||
}
|
||||
double step = range / 10.0; // 默认10个间隔
|
||||
double step = range / 10.0; // 默认10个间隔
|
||||
double scale = Math.pow(10, decimalPlaces);
|
||||
return Math.round(step * scale) / scale;
|
||||
}
|
||||
|
||||
// 计算整数步长
|
||||
// 计算整数步长
|
||||
private static long calculateStep(long range) {
|
||||
long step = (long) Math.pow(10, Math.floor(Math.log10(range)));
|
||||
if (range / step < 4) step /= 2;
|
||||
@@ -230,7 +230,7 @@ public class SvgUtils {
|
||||
return step;
|
||||
}
|
||||
|
||||
// 获取月份标签和索引(保持不变)
|
||||
// 获取月份标签和索引(保持不变)
|
||||
private static String getMonthLabel(String minYearMonth, int offset) {
|
||||
int totalMonths = getMonthIndex(minYearMonth);
|
||||
int targetMonthIndex = totalMonths + offset;
|
||||
@@ -255,44 +255,44 @@ public class SvgUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对齐已有系列数据与新的时间轴
|
||||
* 对齐已有系列数据与新的时间轴
|
||||
*/
|
||||
public static void alignSeriesData(List<String> newCategories, List<PriceDto.DoubleSeries> series, PriceDto.PriceTrend rentTrend) {
|
||||
for (PriceDto.DoubleSeries s : series) {
|
||||
List<Double> originalData = s.getData();
|
||||
List<String> originalCategories = new ArrayList<>(rentTrend.getCategories()); // 假设原始时间轴可从别处获取
|
||||
List<String> originalCategories = new ArrayList<>(rentTrend.getCategories()); // 假设原始时间轴可从别处获取
|
||||
List<Double> alignedData = new ArrayList<>();
|
||||
|
||||
// 根据新的时间轴对齐数据
|
||||
// 根据新的时间轴对齐数据
|
||||
for (String date : newCategories) {
|
||||
int index = originalCategories.indexOf(date);
|
||||
if (index >= 0 && index < originalData.size()) {
|
||||
alignedData.add(originalData.get(index));
|
||||
} else {
|
||||
alignedData.add(null); // 日期不存在时补 null
|
||||
alignedData.add(null); // 日期不存在时补 null
|
||||
}
|
||||
}
|
||||
s.setData(alignedData);
|
||||
}
|
||||
}
|
||||
|
||||
// 测试方法
|
||||
// 测试方法
|
||||
public static void main(String[] args) {
|
||||
List<PriceData> data1 = PriceData.getSampleData(5200);
|
||||
List<List<PriceData>> dataSets = new ArrayList<>();
|
||||
dataSets.add(data1);
|
||||
String name = "新世纪大厦";
|
||||
String name = "新世纪大厦";
|
||||
List<String> labels = Arrays.asList(name);
|
||||
|
||||
String title = "价格走势图";
|
||||
String subtitle = "2024-12 至 2025-11";
|
||||
String title = "价格走势图";
|
||||
String subtitle = "2024-12 至 2025-11";
|
||||
|
||||
// // 测试小数位为2
|
||||
// // 测试小数位为2
|
||||
// String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 2);
|
||||
// System.out.println("With 2 decimal places:");
|
||||
// System.out.println(svgWithoutDecimals);
|
||||
|
||||
// 测试小数位为0(整数等差)
|
||||
// 测试小数位为0(整数等差)
|
||||
String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 0);
|
||||
System.out.println("With 0 decimal places (integer steps):");
|
||||
System.out.println(svgWithoutDecimals);
|
||||
|
||||
@@ -6,23 +6,23 @@ import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* 用来检查浏览器及浏览器所在操作系统工具类
|
||||
* 用来检查浏览器及浏览器所在操作系统工具类
|
||||
*
|
||||
* @author liupei
|
||||
*/
|
||||
public final class SystemUtils {
|
||||
/**
|
||||
* uc开放的固定参数
|
||||
* uc开放的固定参数
|
||||
*/
|
||||
public final static String UC_OPEN_PARAM = "uc_param_str";
|
||||
|
||||
/**
|
||||
* uc开放固定的参数对应的值
|
||||
* uc开放固定的参数对应的值
|
||||
*/
|
||||
public final static String UC_OPEN_VALUE = "up";
|
||||
|
||||
/**
|
||||
* 判断是否为UC浏览器
|
||||
* 判断是否为UC浏览器
|
||||
*
|
||||
* @param userAgent
|
||||
* @return
|
||||
@@ -37,18 +37,18 @@ public final class SystemUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据UA检查是否为平板(简单判断)
|
||||
* 根据UA检查是否为平板(简单判断)
|
||||
*
|
||||
* @param userAgent
|
||||
* @return
|
||||
*/
|
||||
public final static boolean isTablet(String userAgent) {
|
||||
if (StringUtils.isNotBlank(userAgent)) {
|
||||
// 是否为ipad
|
||||
// 是否为ipad
|
||||
if (userAgent.toLowerCase().contains("ipad")) {
|
||||
return true;
|
||||
}
|
||||
// 是否android 3.*系统
|
||||
// 是否android 3.*系统
|
||||
String info = StringUtils.substringBetween(userAgent.toLowerCase(), "(", ")");
|
||||
if (StringUtils.isNotBlank(info)) {
|
||||
String system = StringUtils.substringBetween(info.toLowerCase(), "android", ";");
|
||||
@@ -66,7 +66,7 @@ public final class SystemUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据UA检查是否为移动设备
|
||||
* 根据UA检查是否为移动设备
|
||||
*
|
||||
* @param userAgent
|
||||
* @return
|
||||
@@ -80,15 +80,15 @@ public final class SystemUtils {
|
||||
if (StringUtils.isBlank(info)) {
|
||||
return false;
|
||||
}
|
||||
// 是否为iphone或者ipad
|
||||
// 是否为iphone或者ipad
|
||||
if (info.contains("ipad") || info.contains("iphone")) {
|
||||
return true;
|
||||
}
|
||||
// 是否为android系统
|
||||
// 是否为android系统
|
||||
if (info.contains("linux") && info.contains("android")) {
|
||||
return true;
|
||||
}
|
||||
// 是否使用uc浏览器
|
||||
// 是否使用uc浏览器
|
||||
if (userAgent.contains("ucweb")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
|
||||
/**
|
||||
* 适用于word 2007
|
||||
* poi 版本 3.7
|
||||
* 适用于word 2007
|
||||
* poi 版本 3.7
|
||||
*/
|
||||
public class WordUtil {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class WordUtil {
|
||||
}
|
||||
for (XWPFRun run : runs1) {
|
||||
String text = run.getText(0);
|
||||
System.out.println("text【"+text+"】");
|
||||
System.out.println("text【"+text+"】");
|
||||
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
@@ -93,7 +93,7 @@ public class WordUtil {
|
||||
}
|
||||
for (XWPFRun run : runs1) {
|
||||
String text = run.getText(0);
|
||||
System.out.println("text【"+text+"】");
|
||||
System.out.println("text【"+text+"】");
|
||||
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
@@ -113,9 +113,9 @@ public class WordUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的参数值、模板,生成 word 文档
|
||||
* @param param 需要替换的变量
|
||||
* @param template 模板
|
||||
* 根据指定的参数值、模板,生成 word 文档
|
||||
* @param param 需要替换的变量
|
||||
* @param template 模板
|
||||
*/
|
||||
public static XWPFDocument generateWord(Map<String, Object> param, String template) {
|
||||
XWPFDocument doc = null;
|
||||
@@ -125,7 +125,7 @@ public class WordUtil {
|
||||
// doc = new XWPFDocument(is);
|
||||
doc = new XWPFDocument(POIXMLDocument.openPackage(template));
|
||||
if (param != null && param.size() > 0) {
|
||||
//处理段落
|
||||
//处理段落
|
||||
List<XWPFParagraph> paragraphList = doc.getParagraphs();
|
||||
processParagraphs(paragraphList, param, doc);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public class WordUtil {
|
||||
return runs;
|
||||
}
|
||||
/**
|
||||
* 处理段落
|
||||
* 处理段落
|
||||
* @param paragraphList
|
||||
* @throws InvalidFormatException
|
||||
* @throws IOException
|
||||
@@ -225,14 +225,14 @@ public class WordUtil {
|
||||
XWPFRun run = uninList.get(i);
|
||||
String text = run.getText(0);
|
||||
|
||||
System.out.println("text【"+text+"】");
|
||||
if (text != null && text.indexOf("评估表格") > -1) {
|
||||
System.out.println("text【"+text+"】");
|
||||
if (text != null && text.indexOf("评估表格") > -1) {
|
||||
addTable(doc, paragraph, param);
|
||||
run.setText("", 0);
|
||||
}
|
||||
if(text != null && text.indexOf("${")>-1) {
|
||||
|
||||
if (text.equals("${项目地址}")) {
|
||||
if (text.equals("${项目地址}")) {
|
||||
contentFm = run.getFontFamily();
|
||||
contentFs = run.getFontSize();
|
||||
contentTp = run.getTextPosition();
|
||||
@@ -243,7 +243,7 @@ public class WordUtil {
|
||||
if (text.indexOf(key) != -1) {
|
||||
isSetText = true;
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {//文本替换
|
||||
if (value instanceof String) {//文本替换
|
||||
System.out.println("key==" + key);
|
||||
text = text.replace(key, value.toString());
|
||||
|
||||
@@ -267,7 +267,7 @@ public class WordUtil {
|
||||
// paragraph.insertNewRun(i).setText(text);
|
||||
// }
|
||||
|
||||
} else if (value instanceof Map) { //图片替换
|
||||
} else if (value instanceof Map) { //图片替换
|
||||
text = text.replace(key, "");
|
||||
Map pic = (Map) value;
|
||||
int width = Integer.parseInt(pic.get("width").toString());
|
||||
@@ -317,7 +317,7 @@ public class WordUtil {
|
||||
|
||||
public static void addTable(XWPFDocument doc, XWPFParagraph paragraph, Map params){
|
||||
XmlCursor cursor = paragraph.getCTP().newCursor();
|
||||
// 在指定游标位置插入表格
|
||||
// 在指定游标位置插入表格
|
||||
XWPFTable table = doc.insertNewTbl(cursor);
|
||||
|
||||
CTTblPr tablePr = table.getCTTbl().getTblPr();
|
||||
@@ -329,23 +329,23 @@ public class WordUtil {
|
||||
XWPFTableCell cell = row.createCell();
|
||||
CTTcPr tcpr = cell.getCTTc().addNewTcPr();
|
||||
|
||||
row.getCell(0).setText("评估地址");
|
||||
row.getCell(0).setText("评估地址");
|
||||
row.getCell(1).setText(params.get("${address}").toString());
|
||||
|
||||
XWPFTableRow row1 = table.createRow();
|
||||
row1.getCell(0).setText("评估面积");
|
||||
row1.getCell(1).setText(params.get("${area}")+"㎡");
|
||||
row1.getCell(0).setText("评估面积");
|
||||
row1.getCell(1).setText(params.get("${area}")+"㎡");
|
||||
|
||||
XWPFTableRow row2 = table.createRow();
|
||||
row2.getCell(0).setText("评估单价");
|
||||
row2.getCell(1).setText(params.get("${avg_price}")+"元/㎡("+params.get("${ch_avg_price}")+"每平方米)");
|
||||
row2.getCell(0).setText("评估单价");
|
||||
row2.getCell(1).setText(params.get("${avg_price}")+"元/㎡("+params.get("${ch_avg_price}")+"每平方米)");
|
||||
|
||||
XWPFTableRow row3= table.createRow();
|
||||
row3.getCell(0).setText("评估总价");
|
||||
row3.getCell(1).setText(params.get("${total_price}")+"元("+params.get("${ch_total_price}")+"人民币)");
|
||||
row3.getCell(0).setText("评估总价");
|
||||
row3.getCell(1).setText(params.get("${total_price}")+"元("+params.get("${ch_total_price}")+"人民币)");
|
||||
|
||||
XWPFTableRow row4= table.createRow();
|
||||
row4.getCell(0).setText("评估时点");
|
||||
row4.getCell(0).setText("评估时点");
|
||||
row4.getCell(1).setText(params.get("${date}").toString());
|
||||
|
||||
List<XWPFTableRow> totalRows = table.getRows();
|
||||
@@ -362,11 +362,11 @@ public class WordUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格水平位置和垂直位置
|
||||
* 设置单元格水平位置和垂直位置
|
||||
*
|
||||
* @param xwpfTable
|
||||
* @param verticalLoction 单元格中内容垂直上TOP,下BOTTOM,居中CENTER,BOTH两端对齐
|
||||
* @param horizontalLocation 单元格中内容水平居中center,left居左,right居右,both两端对齐
|
||||
* @param verticalLoction 单元格中内容垂直上TOP,下BOTTOM,居中CENTER,BOTH两端对齐
|
||||
* @param horizontalLocation 单元格中内容水平居中center,left居左,right居右,both两端对齐
|
||||
*/
|
||||
public static void setCellLocation(XWPFTable xwpfTable, String verticalLoction, String horizontalLocation) {
|
||||
List<XWPFTableRow> rows = xwpfTable.getRows();
|
||||
@@ -383,17 +383,17 @@ public class WordUtil {
|
||||
// if (ctjc == null) {
|
||||
// ctjc = ctppr.addNewJc();
|
||||
// }
|
||||
//ctjc.setVal(STJc.Enum.forString(horizontalLocation)); //水平居中
|
||||
cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.valueOf(verticalLoction));//垂直居中
|
||||
//ctjc.setVal(STJc.Enum.forString(horizontalLocation)); //水平居中
|
||||
cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.valueOf(verticalLoction));//垂直居中
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置表格位置
|
||||
* 设置表格位置
|
||||
*
|
||||
* @param xwpfTable
|
||||
* @param location 整个表格居中center,left居左,right居右,both两端对齐
|
||||
* @param location 整个表格居中center,left居左,right居右,both两端对齐
|
||||
*/
|
||||
public static void setTableLocation(XWPFTable xwpfTable, String location) {
|
||||
CTTbl cttbl = xwpfTable.getCTTbl();
|
||||
@@ -402,7 +402,7 @@ public class WordUtil {
|
||||
cTJc.setVal(STJc.Enum.forString(location));
|
||||
}
|
||||
/**
|
||||
* 根据图片类型,取得对应的图片类型代码
|
||||
* 根据图片类型,取得对应的图片类型代码
|
||||
* @param picType
|
||||
* @return int
|
||||
*/
|
||||
@@ -424,7 +424,7 @@ public class WordUtil {
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* 将输入流中的数据写入字节数组
|
||||
* 将输入流中的数据写入字节数组
|
||||
* @param in
|
||||
* @return
|
||||
*/
|
||||
@@ -441,7 +441,7 @@ public class WordUtil {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e2) {
|
||||
System.out.println("关闭流失败");
|
||||
System.out.println("关闭流失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
public class XCXConstant {
|
||||
public static final String APP_ID = "wx2e8d1c72a7c7c940";//小程序appId
|
||||
public static final String SECRET = "5696f147a330bbc8543e6d4319984a1a";//小程序开发平台secret
|
||||
public static final String APP_ID = "wx2e8d1c72a7c7c940";//小程序appId
|
||||
public static final String SECRET = "5696f147a330bbc8543e6d4319984a1a";//小程序开发平台secret
|
||||
public static final String GRANT_TYPE = "authorization_code";
|
||||
public static final String OPENID_URL = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* XStream 日期转换器
|
||||
* XStream 日期转换器
|
||||
*/
|
||||
public class XStreamDateConverter implements SingleValueConverter {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user