修改代码字符编码

This commit is contained in:
2026-02-24 17:53:50 +08:00
parent 2495fe5f6d
commit c8418c7d4b
5195 changed files with 121754 additions and 121754 deletions
@@ -93,7 +93,7 @@ public class BkoffConfig extends BaseConfiguration {
}
/**
* µÃµ½ÍøÕ¾¸ùÓòÃû
* 得到网站根域名
*
* @return
*/
@@ -18,17 +18,17 @@ import java.util.*;
*/
public class Test {
List<String> CITIES = Arrays.asList(
"广州","深圳","天津","成都","西安","杭州","武汉","南京","沈阳","福州","贵阳","宁波","石家庄","大连","昆明","苏州",
"长沙","太原","厦门","无锡","郑州","呼和浩特","兰州","济南","佛山","长春","青岛","东莞","合肥",
"泉州","包头","常德","哈尔滨","乌鲁木齐","烟台","南昌","大同","温州","银川","西宁","扬州","威海","邯郸","中山","秦皇岛","常州","湛江",
"保定","吉林","绵阳","宜昌","嘉兴","镇江","芜湖","南通","泰州","洛阳","台州","赣州","大庆","徐州","株洲","鞍山","潍坊","惠州","湖州","江门","绍兴","海口","珠海","马鞍山","柳州",
"淄博","汕头","盐城","金华","连云港", "桂林","衡阳","揭阳","茂名","平顶山","安阳","四平","漳州","上饶","宜春","德阳","东营","德州","永州",
"娄底","荆州","商丘","长治","楚雄","凉山州","迪庆州","邵阳","荆门","西双版纳州","九江","许昌","临沂", "咸阳","唐山","三亚","沧州","黔东南",
"岳阳","新余","蚌埠","嘉峪关","周口","益阳","郴州","漯河","鄂州","十堰","晋中","承德","宝鸡","怀化","日照","衡水","景德镇","开封","龙岩",
"滨州","达州","内江","三明","海东","南阳","海西州","济宁","邢台","淮安","泸州","南充","临汾","自贡","安庆","廊坊","张家口","玉林","莆田",
"北海","乌兰察布","黄山","南宁","拉萨","汉中","黄冈","河源","南平","榆林","梧州","乐山","丽水","泰安","韶关","阳江","梅州","焦作","黄石",
"潮州","新乡","肇庆","玉溪","宿迁","衢州","广元","遵义","湘潭",
"清远","丽江","昌吉","大理","襄阳","哈密","鄂尔多斯","赤峰","巴音郭楞"
"广州","深圳","天津","成都","西安","杭州","武汉","南京","沈阳","福州","贵阳","宁波","石家庄","大连","昆明","苏州",
"长沙","太原","厦门","无锡","郑州","呼和浩特","兰州","济南","佛山","长春","青岛","东莞","合肥",
"泉州","包头","常德","哈尔滨","乌鲁木齐","烟台","南昌","大同","温州","银川","西宁","扬州","威海","邯郸","中山","秦皇岛","常州","湛江",
"保定","吉林","绵阳","宜昌","嘉兴","镇江","芜湖","南通","泰州","洛阳","台州","赣州","大庆","徐州","株洲","鞍山","潍坊","惠州","湖州","江门","绍兴","海口","珠海","马鞍山","柳州",
"淄博","汕头","盐城","金华","连云港", "桂林","衡阳","揭阳","茂名","平顶山","安阳","四平","漳州","上饶","宜春","德阳","东营","德州","永州",
"娄底","荆州","商丘","长治","楚雄","凉山州","迪庆州","邵阳","荆门","西双版纳州","九江","许昌","临沂", "咸阳","唐山","三亚","沧州","黔东南",
"岳阳","新余","蚌埠","嘉峪关","周口","益阳","郴州","漯河","鄂州","十堰","晋中","承德","宝鸡","怀化","日照","衡水","景德镇","开封","龙岩",
"滨州","达州","内江","三明","海东","南阳","海西州","济宁","邢台","淮安","泸州","南充","临汾","自贡","安庆","廊坊","张家口","玉林","莆田",
"北海","乌兰察布","黄山","南宁","拉萨","汉中","黄冈","河源","南平","榆林","梧州","乐山","丽水","泰安","韶关","阳江","梅州","焦作","黄石",
"潮州","新乡","肇庆","玉溪","宿迁","衢州","广元","遵义","湘潭",
"清远","丽江","昌吉","大理","襄阳","哈密","鄂尔多斯","赤峰","巴音郭楞"
);
public static void main(String[] args) throws IOException {
@@ -104,7 +104,7 @@ public class Test {
headRow.createCell(4).setCellValue("City_CH");
headRow.createCell(5).setCellValue("Grid_SW_Lat_WGS84");
headRow.createCell(6).setCellValue("Grid_SW_Lon_WGS84");
headRow.createCell(7).setCellValue("均价");
headRow.createCell(7).setCellValue("均价");
int tc = 0;
int fc = 0;
@@ -177,7 +177,7 @@ public class Test {
}
}
String fileName = city + "-价格数据";
String fileName = city + "-价格数据";
if(skip > 0 || limit > 0) {
if(skip == 0) {
fileName = fileName + "-part1";
@@ -190,7 +190,7 @@ public class Test {
}
}
fileName = fileName + ".xls";
// File outFlie = new File("D:\\工作文档\\Exprian\\城市导出\\" + fileName);
// File outFlie = new File("D:\\工作文档\\Exprian\\城市导出\\" + fileName);
// if(outFlie.exists()) {
// outFlie.delete();
// }
@@ -25,7 +25,7 @@ public class AddressInfoController {
public Object indexAction(AddressInfoModel model) {
if(model.getCity()==null){
model.setCity("È«¹ú");
model.setCity("全国");
}
if(model.getStype()==null){
model.setStype(1);
@@ -88,7 +88,7 @@ public class AddressInfoController {
Set<Double> set = new HashSet<Double>();
if(diss!=null&&diss.size()>0){
for (DistrictStatistics dis : diss) {
if(!dis.getCity().equals("È«¹ú")){
if(!dis.getCity().equals("全国")){
if(dis.getCityScore()!=null){
set.add(dis.getCityScore());
map.put(dis.getCity(), dis.getCityScore());
@@ -30,7 +30,7 @@ import com.fangjia.coredata.price.util.InvokeShell;
import com.mongodb.BasicDBObject;
/**
* 地址处理脚本控制器
* 地址处理脚本控制器
* @author yinjihuan
*
*/
@@ -42,8 +42,8 @@ public class AddressScriptController {
/**
* 执行脚本
* @param id 脚本ID
* 执行脚本
* @param id 脚本ID
* @return
*/
public Object runAction(AddressScript script) {
@@ -53,10 +53,10 @@ public class AddressScriptController {
content = addressScript.getScript();
}
if (StringUtils.isBlank(content)) {
return new JsonResultModel(false, "脚本找不到");
return new JsonResultModel(false, "脚本找不到");
}
if (!InvokeShell.precompiler(content)) {
return new JsonResultModel(false, "脚本代码编译有问题,请仔细检查!");
return new JsonResultModel(false, "脚本代码编译有问题,请仔细检查!");
}
List<FileDetailData> datas = fileDetailDataService.find(script.getFileId());
for (FileDetailData data : datas) {
@@ -65,7 +65,7 @@ public class AddressScriptController {
newData = addressScriptService.execScript(script.getId(), data);
} catch (Exception e) {
}
//有修改需要进行重新评级操作
//有修改需要进行重新评级操作
String rating = AddressAnalyUtils.addressRate(newData);
newData.setRating(rating);
fileDetailDataService.udpate(newData);
@@ -74,25 +74,25 @@ public class AddressScriptController {
}
/**
* 新增脚本
* @param id 脚本ID
* 新增脚本
* @param id 脚本ID
* @return
*/
public Object addOrUpdateScriptAction(HttpServletRequest request,AddressScript addressScript){
String userName = SessionContent.getLoginUsername(request);
if(StringUtils.isBlank(addressScript.getName())){
return new JsonResultModel(false, "脚本名称必须填写!");
return new JsonResultModel(false, "脚本名称必须填写!");
}
if(StringUtils.isBlank(addressScript.getScript())){
return new JsonResultModel(false, "脚本内容必须填写!");
return new JsonResultModel(false, "脚本内容必须填写!");
}
List<AddressScript> addressList = addressScriptService.findByName(addressScript.getName());
if (!InvokeShell.precompiler(addressScript.getScript())) {
return new JsonResultModel(false, "脚本代码编译有问题,请仔细检查!");
return new JsonResultModel(false, "脚本代码编译有问题,请仔细检查!");
}
if(StringUtils.isBlank(addressScript.getId())){
if(addressList.size()>0){
return new JsonResultModel(false, "该脚本名称已经存在!");
return new JsonResultModel(false, "该脚本名称已经存在!");
}
addressScript.setId(null);
addressScript.setCreateUser(userName);
@@ -103,7 +103,7 @@ public class AddressScriptController {
return new JsonResultModel(true);
}else{
if(addressList.size()>1){
return new JsonResultModel(false, "该脚本名称已经存在!");
return new JsonResultModel(false, "该脚本名称已经存在!");
}
BasicDBObject data = new BasicDBObject();
data.append("name", addressScript.getName());
@@ -116,7 +116,7 @@ public class AddressScriptController {
}
/**
* 根据文件id获取脚本列表
* 根据文件id获取脚本列表
* @param fileId
* @return
*/
@@ -128,7 +128,7 @@ public class AddressScriptController {
}
/**
* 根据脚本名称获取脚本内容
* 根据脚本名称获取脚本内容
* @param fileId
* @return
*/
@@ -145,14 +145,14 @@ public class AddressScriptController {
}
/**
* 删除脚本
* @param id 脚本ID
* 删除脚本
* @param id 脚本ID
* @return
*/
public Object deleteScriptAction(HttpServletRequest request,AddressScript addressScript){
String userName = SessionContent.getLoginUsername(request);
if(StringUtils.isBlank(addressScript.getId())){
return new JsonResultModel(false, "删除失败!");
return new JsonResultModel(false, "删除失败!");
}
BasicDBObject data = new BasicDBObject();
data.append("status",1);
@@ -92,14 +92,14 @@ public class AnalyController {
private MetadataDao metadataDao = MetadataDao.getInstance();
private SeaweedDao seaweedDao = SeaweedDao.getInstance();
private RegExDao regExDao = RegExDao.getInstance();
static final List<String> SHANG_ZHU = Arrays.asList(new String[]{"商住", "SOHO"});
static final List<String> BIE_SHU = Arrays.asList(new String[]{"叠联", "叠拼", "叠墅", "叠墅", "花墅", "联排", "联院", "平墅", "独栋", "独院", "别墅", "双拼", "庄园", "MINI墅", "mini墅"});
static final List<String> ZHU_ZHAI = Arrays.asList(new String[]{"安置房", "板楼", "公房", "公寓", "公租房", "回迁房", "经济适用房", "经适房", "精装房", "居民小区", "老公房", "廉租房", "两限房",
"毛坯房", "民宅", "平房", "商品房", "多层", "高层", "小高层", "塔楼", "租赁房", "自住房", "自住型商品房", "大院","小区", "动迁房", "住宅", "四合院", "四仔屋", "现房", "限价房", "洋房", "洋楼", "大宅"});
static final List<String> SHANG_ZHU = Arrays.asList(new String[]{"商住", "SOHO"});
static final List<String> BIE_SHU = Arrays.asList(new String[]{"叠联", "叠拼", "叠墅", "叠墅", "花墅", "联排", "联院", "平墅", "独栋", "独院", "别墅", "双拼", "庄园", "MINI墅", "mini墅"});
static final List<String> ZHU_ZHAI = Arrays.asList(new String[]{"安置房", "板楼", "公房", "公寓", "公租房", "回迁房", "经济适用房", "经适房", "精装房", "居民小区", "老公房", "廉租房", "两限房",
"毛坯房", "民宅", "平房", "商品房", "多层", "高层", "小高层", "塔楼", "租赁房", "自住房", "自住型商品房", "大院","小区", "动迁房", "住宅", "四合院", "四仔屋", "现房", "限价房", "洋房", "洋楼", "大宅"});
static final Map<String, List<String>> ESTYPE_BUILD_TYPE_MAP = 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[]{"多层", "小高层", "高层", "超高层", "独栋", "双拼", "叠加", "联排"}));
}};
@@ -128,14 +128,14 @@ public class AnalyController {
resultMap.put("region", region);
}
resultMap.putAll(Analyzer.getInstance().analy(content, fieldRuleList));
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
// 把字段标准化
Analyzer.getInstance().formatToStandardValue(resultMap, city, model.getCategory(), definedFields);
// 根据数据库规则验证字段
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, city,
model.getCategory());
model.setAnalyResultMap(resultMap);
@@ -159,17 +159,17 @@ public class AnalyController {
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("city", webpage.getCity());
resultMap.putAll(Analyzer.getInstance().analy(webpage.getContent(), fieldRuleList));
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
// 把字段标准化
Analyzer.getInstance()
.formatToStandardValue(resultMap, webpage.getCity(), model.getCategory(), definedFields);
// 删除无效字段
// 删除无效字段
Analyzer.getInstance().removeInvalidValueField(resultMap, webpage.getCategory());
// 根据数据库规则验证字段
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, webpage.getCity(),
webpage.getCategory());
model.setResultExceptionMap(resultExceptionMap);
@@ -194,7 +194,7 @@ public class AnalyController {
}
/**
* 批量解析测试
* 批量解析测试
* @param model
* @return
*/
@@ -207,7 +207,7 @@ public class AnalyController {
List<AnalyListModel> analyListModels = new ArrayList<AnalyListModel>();
Map<String, Map<String, FieldType>> fieldTypeMap = new HashMap<String, Map<String, FieldType>>();
Map<String, String> fieldTypes = new HashMap<String, String>();//总的字段map
Map<String, String> fieldTypes = new HashMap<String, String>();//总的字段map
for(String id : ids) {
AnalyListModel analyListModel = parsePage(model.getCatType(), id, model.getCategory(), model.getSiteName(), model.getPageName());
String category = analyListModel.getCategory();
@@ -247,15 +247,15 @@ public class AnalyController {
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("city", city);
resultMap.putAll(Analyzer.getInstance().analy(content, fieldRuleList));
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
// 把字段标准化
Analyzer.getInstance().formatToStandardValue(resultMap, city, category, definedFields);
// 根据数据库规则验证字段
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, city, category);
model.setAnalyResultMap(resultMap);
model.setResultExceptionMap(resultExceptionMap);
@@ -278,17 +278,17 @@ public class AnalyController {
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("city", webpage.getCity());
resultMap.putAll(Analyzer.getInstance().analy(webpage.getContent(), fieldRuleList));
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
// 把字段标准化
Analyzer.getInstance()
.formatToStandardValue(resultMap, webpage.getCity(), webpage.getCategory(), definedFields);
// 删除无效字段
// 删除无效字段
Analyzer.getInstance().removeInvalidValueField(resultMap, webpage.getCategory());
// 根据数据库规则验证字段
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, webpage.getCity(),
webpage.getCategory());
model.setResultExceptionMap(resultExceptionMap);
@@ -370,18 +370,18 @@ public class AnalyController {
private void parseData(String url, Map<String, Object> anaMap, List<FieldType> definedFields, AnalyModel model) {
try {
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("city", "测试");
resultMap.put("city", "测试");
resultMap.putAll(anaMap);
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
Analyzer.getInstance().formatToStandardValue(resultMap, "测试", model.getCategory(), definedFields);
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, "测试",
// 把字段标准化
Analyzer.getInstance().formatToStandardValue(resultMap, "测试", model.getCategory(), definedFields);
// 根据数据库规则验证字段
Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, "测试",
model.getCategory());
model.setAnalyResultMap(resultMap);
model.setResultExceptionMap(resultExceptionMap);
@@ -442,9 +442,9 @@ public class AnalyController {
List<BasicDBObject> baiduSearch(String city,String name) {
List<BasicDBObject> dbObjects = new ArrayList<BasicDBObject>();
String orgName= name;
name = name.toString().replace("小区","").replace("住宅","");
if("延边".equals(city)){
city = "延边朝鲜族自治州";
name = name.toString().replace("小区","").replace("住宅","");
if("延边".equals(city)){
city = "延边朝鲜族自治州";
}
JSONObject resp = BaiDuApiUtils.search(city, name, null, 2, 10, 0);
boolean isFound = false;
@@ -487,7 +487,7 @@ public class AnalyController {
dbo.append("tag",detailInfo.get("tag"));
dbo.append("detailUrl",detailInfo.get("detail_url"));
}
String itemName = dbo.getString("name").replace(".","").replace("·","");
String itemName = dbo.getString("name").replace(".","").replace("·","");
if(!isFound){
dbObjects.add(dbo);
}else if(isFound && name.equals(itemName)){
@@ -592,7 +592,7 @@ public class AnalyController {
|| StringUtils.isBlank(model.getPageName())
|| model.getCities() == null
|| model.getCities().size() == 0) {
dataMap.put("err", "参数不能为空");
dataMap.put("err", "参数不能为空");
ret.setJsonModel(dataMap);
return ret;
}
@@ -600,14 +600,14 @@ public class AnalyController {
Website website = websiteDao.findWebsite(model.getCategory(), model.getSiteName());
if (website == null) {
dataMap.put("err", "没有定义该网站");
dataMap.put("err", "没有定义该网站");
ret.setJsonModel(dataMap);
return ret;
}
List<Map<String, Object>> relatedJobs = website.getRelatedJobs();
if (relatedJobs == null) {
dataMap.put("err", "该网站没有与任务页面进行关联");
dataMap.put("err", "该网站没有与任务页面进行关联");
ret.setJsonModel(dataMap);
return ret;
}
@@ -620,17 +620,17 @@ public class AnalyController {
}
if (!bool) {
dataMap.put("err", "该网站没有此页面");
dataMap.put("err", "该网站没有此页面");
ret.setJsonModel(dataMap);
return ret;
}
if (StringUtils.isBlank(model.getSelector()) || TypeEnum.parseType(model.getType()) == null) {
dataMap.put("err", "选择器错误");
dataMap.put("err", "选择器错误");
ret.setJsonModel(dataMap);
return ret;
} else if (TypeEnum.ATTR.getType().equals(model.getType()) && StringUtils.isBlank(model.getAttr())) {
dataMap.put("err", "选择器错误");
dataMap.put("err", "选择器错误");
ret.setJsonModel(dataMap);
return ret;
}
@@ -643,14 +643,14 @@ public class AnalyController {
}
for (String s : selector.getSelector().split(",")) {
if (!JQueryUtil.isValidSeletor(s)) {
dataMap.put("err", s + " 不能被jsoup支持!");
dataMap.put("err", s + " 不能被jsoup支持!");
ret.setJsonModel(dataMap);
return ret;
}
}
if (!InvokeShell.precompiler(model.getScript())) {
dataMap.put("err", "脚本代码编译有问题,请仔细检查!");
dataMap.put("err", "脚本代码编译有问题,请仔细检查!");
ret.setJsonModel(dataMap);
return ret;
}
@@ -664,7 +664,7 @@ public class AnalyController {
long count = fieldRuleDao.findCount(q);
if (count > 0) {
dataMap.put("err", "该字段已存在!");
dataMap.put("err", "该字段已存在!");
ret.setJsonModel(dataMap);
return ret;
} else {
@@ -817,7 +817,7 @@ public class AnalyController {
HSSFWorkbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
String[] headers = new String[]{"序号", "城市", "区域", "名称", "网站量", "CPDB库", "数据状态", "审核状态", "审核时间", "更新时间", "住宅比","地图库对比结果"};
String[] headers = new String[]{"序号", "城市", "区域", "名称", "网站量", "CPDB库", "数据状态", "审核状态", "审核时间", "更新时间", "住宅比","地图库对比结果"};
for(int i = 0; i < headers.length; i++){
row.createCell(i).setCellValue(headers[i]);
}
@@ -830,60 +830,60 @@ public class AnalyController {
row.createCell(3).setCellValue(analySite.getDistrictName());
row.createCell(4).setCellValue(analySite.getSiteCount());
if(analySite.getExists() == 1){
row.createCell(5).setCellValue("存在");
row.createCell(5).setCellValue("存在");
}else{
row.createCell(5).setCellValue("不存在");
row.createCell(5).setCellValue("不存在");
}
String dataStatus;
switch (analySite.getDataStatus()){
case 0:dataStatus = "正常";break;
case 1:dataStatus = "人工删除";break;
case 2:dataStatus = "区域错误";break;
case 3:dataStatus = "被别名关联";break;
case 4:dataStatus = "名称错误";break;
case 5:dataStatus = "百度判定删除";break;
case 6:dataStatus = "CPDB删除";break;
case 7:dataStatus = "物业不匹配删除";break;
default:dataStatus ="未知";
case 0:dataStatus = "正常";break;
case 1:dataStatus = "人工删除";break;
case 2:dataStatus = "区域错误";break;
case 3:dataStatus = "被别名关联";break;
case 4:dataStatus = "名称错误";break;
case 5:dataStatus = "百度判定删除";break;
case 6:dataStatus = "CPDB删除";break;
case 7:dataStatus = "物业不匹配删除";break;
default:dataStatus ="未知";
}
row.createCell(6).setCellValue(dataStatus);
if(analySite.getAuditStatus() == 0){
row.createCell(7).setCellValue("未审核");
row.createCell(7).setCellValue("未审核");
}else if(analySite.getAuditStatus() == 1){
row.createCell(7).setCellValue("已审核");
row.createCell(7).setCellValue("已审核");
}else if(analySite.getAuditStatus() == 4){
row.createCell(7).setCellValue("已审阅");
row.createCell(7).setCellValue("已审阅");
}
if(analySite.getAuditDate() != null){
row.createCell(8).setCellValue(DateUtil.formatByPattern(analySite.getAuditDate(),"yyyy年MM月dd日"));
row.createCell(8).setCellValue(DateUtil.formatByPattern(analySite.getAuditDate(),"yyyy年MM月dd日"));
}
if(analySite.getModifiedDate() != null){
row.createCell(9).setCellValue(DateUtil.formatByPattern(analySite.getModifiedDate(),"yyyy年MM月dd日"));
row.createCell(9).setCellValue(DateUtil.formatByPattern(analySite.getModifiedDate(),"yyyy年MM月dd日"));
}
row.createCell(10).setCellValue(analySite.getDistrictRatio() + "%");
if(analySite.getCompareResult() != null){
if("exist".equals(analySite.getCompareResult())){
row.createCell(11).setCellValue("地图库存在");
row.createCell(11).setCellValue("地图库存在");
}else if("not_exist".equals(analySite.getCompareResult())){
row.createCell(11).setCellValue("地图库不存在");
row.createCell(11).setCellValue("地图库不存在");
}else if("diff_region".equals(analySite.getCompareResult())){
row.createCell(11).setCellValue("区域不一致"+ analySite.getDiffRegion());
row.createCell(11).setCellValue("区域不一致"+ analySite.getDiffRegion());
}else if("alias_exist".equals(analySite.getCompareResult())){
row.createCell(11).setCellValue("是"+ analySite.getAliasName() +"的别名");
row.createCell(11).setCellValue("是"+ analySite.getAliasName() +"的别名");
}
}
}
String fileName = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss") + ".xls";
try {
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -1111,7 +1111,7 @@ public class AnalyController {
// map.put(bo.getSiteName(), bo);
// analyRoadBoList.add(bo);
// } else {
// // 别名网站
// // 别名网站
// if (bo.getStatus() == AnalyRoad.StatusEnum.SUC.getValue() &&
// model.getCategory().equals(bo.getCategory())
// && !bo.getDistrictName().equals(model.getDistrictName())) {
@@ -1588,7 +1588,7 @@ public class AnalyController {
}
}
//整合排序功能
//整合排序功能
List<Webpage> webpages = new ArrayList<Webpage>();
if (StringUtils.isNotBlank(model.getUrl())) {
model.setUrl(model.getUrl().trim());
@@ -1645,7 +1645,7 @@ public class AnalyController {
if (StringUtils.isBlank(model.getCategory()) || StringUtils.isBlank(model.getSiteName())
|| StringUtils.isBlank(model.getPageName()) || CollectionUtils.isEmpty(model.getAnalyFields())
|| CollectionUtils.isEmpty(model.getCities())) {
dataMap.put("err", "缺失必填字段");
dataMap.put("err", "缺失必填字段");
ret.setJsonModel(dataMap);
return ret;
}
@@ -1655,7 +1655,7 @@ public class AnalyController {
List<FieldRule> fieldRuleList = fieldRuleDao.findAllFieldRule(model.getCategory(), model.getSiteName(),
model.getPageName());
if (fieldRuleList.size() == 0) {
dataMap.put("err", "该类型的网站和页面无解析规则");
dataMap.put("err", "该类型的网站和页面无解析规则");
ret.setJsonModel(dataMap);
return ret;
}
@@ -1673,7 +1673,7 @@ public class AnalyController {
if (errCities.size() > 5) {
errCities = errCities.subList(0, 5);
}
dataMap.put("err", StringUtils.join(errCities, ",") + "等" + c + "个城市无解析规则");
dataMap.put("err", StringUtils.join(errCities, ",") + "等" + c + "个城市无解析规则");
ret.setJsonModel(dataMap);
return ret;
}
@@ -1690,7 +1690,7 @@ public class AnalyController {
}
int ignoreCount = model.getCities().size() - targetCities.size();
dataMap.put("msg", "忽略" + ignoreCount + "个无网页城市," + targetCities.size() + "个城市的任务加入解析队列");
dataMap.put("msg", "忽略" + ignoreCount + "个无网页城市," + targetCities.size() + "个城市的任务加入解析队列");
ret.setJsonModel(dataMap);
return ret;
}
@@ -1795,7 +1795,7 @@ public class AnalyController {
udata.put("audit_status", 1);
udata.put("data_status", 1);
analySiteDao.updateById(udata, id);
// 删除
// 删除
if (status == 3) {
AnalySite analySite = analySiteDao.findById(id);
if (analySite.getExists() == 1) {
@@ -1823,7 +1823,7 @@ public class AnalyController {
Map<String, Object> dataMap = new HashMap<String, Object>();
ret.setJsonModel(dataMap);
if(null == model.getIds() || model.getIds().isEmpty()){
dataMap.put("msg", "请选择数据");
dataMap.put("msg", "请选择数据");
}else{
int count = 0;
List<AnalySite> analySiteList = analySiteDao.findAllByIds(model.getIds());
@@ -1837,7 +1837,7 @@ public class AnalyController {
}
}
}
dataMap.put("msg", "入库成功!总共入库" + count + "个小区");
dataMap.put("msg", "入库成功!总共入库" + count + "个小区");
}
return ret;
}
@@ -1859,11 +1859,11 @@ public class AnalyController {
if(estateTypes.size() == 1){
seaweed.setAlias(new ArrayList<String>(Arrays.asList(new String[]{orgName})));
}else{
if(estateType.contains("商住") && orgName.contains("商住")){
if(estateType.contains("商住") && orgName.contains("商住")){
seaweed.setAlias(new ArrayList<String>(Arrays.asList(new String[]{orgName})));
}else if(estateType.contains("别墅") && orgName.contains("别墅")){
}else if(estateType.contains("别墅") && orgName.contains("别墅")){
seaweed.setAlias(new ArrayList<String>(Arrays.asList(new String[]{orgName})));
}else if("普通住宅".equals(estateType) && !orgName.contains("别墅") && !orgName.contains("商住")){
}else if("普通住宅".equals(estateType) && !orgName.contains("别墅") && !orgName.contains("商住")){
seaweed.setAlias(new ArrayList<String>(Arrays.asList(new String[]{orgName})));
}
}
@@ -1879,16 +1879,16 @@ public class AnalyController {
}
seaweed.setAddress(getOptimalAddress(analySite.getCity(), analySite.getRegion(), orgName));
for(String alia : alias){
if("别墅".equals(estateType)){
if(alia.contains("别墅") && !seaweed.getAlias().contains(alia)){
if("别墅".equals(estateType)){
if(alia.contains("别墅") && !seaweed.getAlias().contains(alia)){
seaweed.getAlias().add(alia);
}
}else if("商住".equals(estateType)){
if(alia.contains("商住") && !seaweed.getAlias().contains(alia)){
}else if("商住".equals(estateType)){
if(alia.contains("商住") && !seaweed.getAlias().contains(alia)){
seaweed.getAlias().add(alia);
}
}else{
if("普通住宅".equals(estateType) && !seaweed.getAlias().contains(alia) && !alia.contains("商住") && !alia.contains("别墅")){
if("普通住宅".equals(estateType) && !seaweed.getAlias().contains(alia) && !alia.contains("商住") && !alia.contains("别墅")){
seaweed.getAlias().add(alia);
}
}
@@ -1903,7 +1903,7 @@ public class AnalyController {
return seaweeds;
}
static Pattern FULL_ADDRESS = Pattern.compile("^.+(路|街道|街|大道|巷|道|里|((一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)线))(交汇|.*段)?(((\\d+号*(~|-|~|、|,|-))*\\d+(号))|((\\d+弄))).*");
static Pattern FULL_ADDRESS = Pattern.compile("^.+(路|街道|街|大道|巷|道|里|((一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)线))(交汇|.*段)?(((\\d+号*(~|-|~|、|,|-))*\\d+(号))|((\\d+弄))).*");
boolean isStandardAddress(String addr){
return FULL_ADDRESS.matcher(addr).find();
}
@@ -1933,7 +1933,7 @@ public class AnalyController {
if (betterAddress == null) {
for (Object address : fetchList) {
if (address.toString().contains("交汇") || address.toString().contains("交口") || address.toString().contains("交叉")) {
if (address.toString().contains("交汇") || address.toString().contains("交口") || address.toString().contains("交叉")) {
if (betterAddress == null || address.toString().length() < betterAddress.length()) {
betterAddress = address.toString();
}
@@ -1950,7 +1950,7 @@ public class AnalyController {
}
if (betterAddress != null) {
betterAddress = betterAddress.replaceAll("(\\(|().*(\\)|))", "");
betterAddress = betterAddress.replaceAll("(\\(|().*(\\)|))", "");
betterAddress = DataUtil.removeHtml(betterAddress);
betterAddress = OpenApiClient.formateAddress(city, betterAddress);
}
@@ -1965,9 +1965,9 @@ public class AnalyController {
for (Object b : crawlerBuildingTypes) {
String bStr = b.toString();
for (String s : standardBuildTypes) {
if ("高层".equals(s) && bStr.contains(s)) {
int idx1 = bStr.indexOf("高层");
int idx2 = bStr.indexOf("小高层");
if ("高层".equals(s) && bStr.contains(s)) {
int idx1 = bStr.indexOf("高层");
int idx2 = bStr.indexOf("小高层");
if (idx2 == -1 || idx2 != idx1 - 1) {
if(!buildingTypes.contains(s)){
buildingTypes.add(s);
@@ -1983,19 +1983,19 @@ public class AnalyController {
return buildingTypes;
}
static Pattern ROAD_PATTERN = Pattern.compile("^.+(路|街道|街|大道|巷|道|里|((一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)线))(\\d+(号|弄))+$");
static Pattern ROAD_PATTERN = Pattern.compile("^.+(路|街道|街|大道|巷|道|里|((一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)线))(\\d+(号|弄))+$");
String formateDistrictName(String city, String region, String name, String estateType){
String formateName = name;
if("别墅".equals(estateType) && !name.contains("别墅")){
formateName = formateName + "别墅";
if("别墅".equals(estateType) && !name.contains("别墅")){
formateName = formateName + "别墅";
}
if("商住".equals(estateType) && !name.contains("商住")){
formateName = formateName + "商住楼";
if("商住".equals(estateType) && !name.contains("商住")){
formateName = formateName + "商住楼";
}
if(ROAD_PATTERN.matcher(name).find()){
formateName = formateName + "小区";
formateName = formateName + "小区";
}
if(name.startsWith(city) && name.length() - city.length() > 2){
formateName = name.replaceFirst(city, "");
@@ -2003,7 +2003,7 @@ public class AnalyController {
if(formateName.startsWith(region) && formateName.length() - region.length() > 2){
formateName = formateName.replaceFirst(region, "");
}
formateName = formateName.replace("。", "").replace("\"", "").replace("·","").replace(".", "");
formateName = formateName.replace("。", "").replace("\"", "").replace("·","").replace(".", "");
return formateName;
}
@@ -2012,8 +2012,8 @@ public class AnalyController {
List<String> getEstateType(String city, String region, String name) {
Set<String> estateTypes = new HashSet<String>();
if(name.contains("别墅")){
estateTypes.add("别墅");
if(name.contains("别墅")){
estateTypes.add("别墅");
return new ArrayList<String>(estateTypes);
}
boolean isShangZhu = false;
@@ -2024,7 +2024,7 @@ public class AnalyController {
}
}
if(isShangZhu){
estateTypes.add("商住");
estateTypes.add("商住");
return new ArrayList<String>(estateTypes);
}
@@ -2034,25 +2034,25 @@ public class AnalyController {
String t = type.toString();
for (String bieShu : BIE_SHU) {
if (t.contains(bieShu)) {
estateTypes.add("别墅");
estateTypes.add("别墅");
break;
}
}
for (String shangZhu : SHANG_ZHU) {
if (t.contains(shangZhu)) {
estateTypes.add("商住");
estateTypes.add("商住");
break;
}
}
for (String zhuZhai : ZHU_ZHAI) {
if (t.contains(zhuZhai)) {
estateTypes.add("普通住宅");
estateTypes.add("普通住宅");
break;
}
}
}
if(estateTypes.isEmpty()){
estateTypes.add("普通住宅");
estateTypes.add("普通住宅");
}
return new ArrayList<String>(estateTypes);
}
@@ -2224,7 +2224,7 @@ public class AnalyController {
}
Map<String, String> allFieldsMap = new LinkedHashMap<String, String>();
allFieldsMap.put("creationDate", "时间");
allFieldsMap.put("creationDate", "时间");
List<FieldType> fieldTypeList = FieldTypeDao.getInstance().findByCategory(category);
for (FieldType ft : fieldTypeList) {
allFieldsMap.put(ft.getName(), ft.getDisplay());
@@ -2232,10 +2232,10 @@ public class AnalyController {
List<List<Info>> detais = new ArrayList<List<Info>>();
// 添加第一行
// 添加第一行
List<Info> fisteRow = new ArrayList<Info>();
fisteRow.add(new Info("", false));
fisteRow.add(new Info("数据库", false));
fisteRow.add(new Info("数据库", false));
for (Map.Entry<String, Float> map : scoreMapList) {
String key = map.getKey();
@@ -2351,7 +2351,7 @@ public class AnalyController {
Pattern pattern = Pattern.compile("^[0-9]*[1-9][0-9]*$");
Map<String, String> allFieldsMap = new LinkedHashMap<String, String>();
allFieldsMap.put("creationDate", "时间");
allFieldsMap.put("creationDate", "时间");
// allFieldsMap.putAll(BkoffConfig.getConfig().getDistrictRequiredFields());
// if (category.equals("shop")) {
// allFieldsMap.putAll(BkoffConfig.getConfig().getShopOptionalFields());
@@ -2367,7 +2367,7 @@ public class AnalyController {
}
List<Map<String, Object>> detais = new ArrayList<Map<String, Object>>();
// 数据库
// 数据库
Map<String, Object> ret = new HashMap<String, Object>();
for (String field : allFieldsMap.keySet()) {
@@ -2406,7 +2406,7 @@ public class AnalyController {
String key = map.getKey();
Float score = map.getValue();
String url = "";
// 抓取结果
// 抓取结果
for (int i = 0; i < analyRoadBoList.size(); i++) {
AnalyRoadBo analyRoadBo = analyRoadBoList.get(i);
if (analyRoadBo.getResults() == null || analyRoadBo.getResults().size() == 0) {
@@ -2459,7 +2459,7 @@ public class AnalyController {
if(StringUtils.isBlank(s)){
String car_site = (String) analyRoadBo.getResults().get("car_site");
if (StringUtils.isNotBlank(car_site)) {
if(car_site.length()>2 && car_site.indexOf("个")==(car_site.length()-1)){
if(car_site.length()>2 && car_site.indexOf("个")==(car_site.length()-1)){
car_site = car_site.substring(0, car_site.length()-1);
if(pattern.matcher(car_site).find()){
s = car_site;
@@ -2635,7 +2635,7 @@ public class AnalyController {
return ret;
}
//查询小区方法
//查询小区方法
public Object districtSearchAction(AnalyModel model) {
if (StringUtils.isBlank(model.getCity()) && StringUtils.isBlank(model.getKeyword())) {
return model;
@@ -2695,7 +2695,7 @@ public class AnalyController {
return model;
}
//更新别名
//更新别名
public Object updateAliasAction(AnalyModel model){
DBObject obj = new BasicDBObject();
if(StringUtils.isNotBlank(model.getId())){
@@ -2717,7 +2717,7 @@ public class AnalyController {
return "success";
}
//更新地址
//更新地址
public Object updateAddressAction(AnalyModel model){
DBObject obj = new BasicDBObject();
if(StringUtils.isNotBlank(model.getId())){
@@ -2731,7 +2731,7 @@ public class AnalyController {
return "success";
}
//查询小区
//查询小区
public Object districtSearchResultAction(AnalyModel model){
if (StringUtils.isBlank(model.getCity()) && StringUtils.isBlank(model.getKeyword())) {
return model;
@@ -2789,8 +2789,8 @@ public class AnalyController {
/* public enum AnaMode {
COMMON("common", "普通模式"),
LIST("list", "列表模式");
COMMON("common", "普通模式"),
LIST("list", "列表模式");
private String mode;
private String desc;
@@ -35,18 +35,18 @@ public class ApiController {
private FieldTypeDao fieldTypeDao = FieldTypeDao.getInstance();
public Object analyDistrictsAction(ApiModel model) throws Exception {
//校验参数
//校验参数
if(StringUtils.isBlank(model.getVars()) || StringUtils.isBlank(model.getConditions())) {
Map<String, Object> exceptionMap = new HashMap<String, Object>();
exceptionMap.put("exception", "参数不足");
exceptionMap.put("exception", "参数不足");
return exceptionMap;
}
//拼接请求抓取系统的参数
//拼接请求抓取系统的参数
Map<String, String> params = new HashMap<String, String>();
params.put("vars", model.getVars());
params.put("conditions", model.getConditions());
List<String> jobList = new ArrayList<String>();
//没有传jobId,则抓取所有jobId相关的页面;否则,只抓对应jobId的页面
//没有传jobId,则抓取所有jobId相关的页面;否则,只抓对应jobId的页面
if(StringUtils.isBlank(model.getJobId())) {
List<CrawlTemplate> crawlTemplates = CrawlTemplateDao.getInstance().findWithCategory("sell");
for(CrawlTemplate crawlTemplate : crawlTemplates) {
@@ -56,12 +56,12 @@ public class ApiController {
jobList.add(model.getJobId());
}
params.put("jobList", JSONArray.fromObject(jobList).toString());
//请求抓取系统,以获取每个jobId所对应的抓取页面
//请求抓取系统,以获取每个jobId所对应的抓取页面
HttpRequest httpRequest = new HttpRequest();
String postResp = httpRequest.post(bkoffConfig.getCrawlApiUrl(), params, bkoffConfig.getCrawlApiEncoding());
if(postResp == null) {
Map<String, Object> exceptionMap = new HashMap<String, Object>();
exceptionMap.put("exception", "抓取失败");
exceptionMap.put("exception", "抓取失败");
return exceptionMap;
}
JSONObject jsonObject = JSONObject.fromObject(postResp);
@@ -72,7 +72,7 @@ public class ApiController {
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
for(Object key : metadatas.keySet()) {
String jobId = (String)key;
String pageName = "详情";
String pageName = "详情";
Website website = websiteDao.findOne(new BasicDBObject("related_jobs.job_id", jobId));
if(website == null) {
continue;
@@ -112,15 +112,15 @@ public class ApiController {
try {
resultMap.put("city", city);
resultMap.putAll(Analyzer.getInstance().analy(content, fieldRuleList));
// 是否有未定义字段
// 是否有未定义字段
String undefinedField = Analyzer.getInstance().getUndefinedField(definedFields, resultMap);
if (undefinedField != null) {
throw new Exception(undefinedField + "未定义");
throw new Exception(undefinedField + "未定义");
}
// 把字段标准化
// 把字段标准化
Analyzer.getInstance().formatToStandardValue(resultMap, city, category, definedFields);
// 根据数据库规则验证字段
// 根据数据库规则验证字段
//Map<String, Exception> resultExceptionMap = Analyzer.getInstance().validatorAll(resultMap, city, category);
// result.put("resultMap", resultMap);
@@ -78,18 +78,18 @@ public class AvgPriceAnalyController {
HSSFWorkbook wb = createSimpleExcel();
//Date weekend = DateUtil.getFirstDayOfWeek(new Date());
String fileName = "样本.xls";
String fileName = "样本.xls";
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -113,14 +113,14 @@ public class AvgPriceAnalyController {
if(StringUtils.isBlank(model.getFileName())){
System.out.println("请选择文件");
System.out.println("请选择文件");
return null;
}
Map<String, Object> fileMap = getFileName(request);
List<String> fileNames = (List<String>) fileMap.get("fileNames");
if(!fileNames.contains(model.getFileName())){
System.out.println("上传文件不存在,请重新上传!");
System.out.println("上传文件不存在,请重新上传!");
return null;
}
@@ -148,14 +148,14 @@ public class AvgPriceAnalyController {
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -195,7 +195,7 @@ public class AvgPriceAnalyController {
JsonModel ret = new JsonModel();
Map<String, Object> data = new HashMap<String, Object>();
if(StringUtils.isBlank(model.getFileName())){
data.put("info", "请选择文件");
data.put("info", "请选择文件");
ret.setJsonModel(data);
return ret;
}
@@ -203,7 +203,7 @@ public class AvgPriceAnalyController {
Map<String, Object> fileMap = getFileName(request);
List<String> fileNames = (List<String>) fileMap.get("fileNames");
if(!fileNames.contains(model.getFileName())){
data.put("info", "上传文件不存在,请重新上传!");
data.put("info", "上传文件不存在,请重新上传!");
ret.setJsonModel(data);
return ret;
}
@@ -235,7 +235,7 @@ public class AvgPriceAnalyController {
private Map<String, Object> getFileName(HttpServletRequest request){
String uploadFilePath = request.getSession().getServletContext().getRealPath("/WEB-INF/upload");
System.out.println("controller: "+uploadFilePath);
List<String> fileNames = listfile(new File(uploadFilePath));//File既可以代表一个文件也可以代
List<String> fileNames = listfile(new File(uploadFilePath));//File既可以代表一个文件也可以代
Map<String, Object> map = new HashMap<String, Object>();
map.put("uploadPath", uploadFilePath);
map.put("fileNames", fileNames);
@@ -244,7 +244,7 @@ public class AvgPriceAnalyController {
private List<Map<String, Object>> readUploadFile(String uploadPath, String fileName) throws InvalidFormatException, IOException{
//读取要下载的文件,保存到文件输入流
//读取要下载的文件,保存到文件输入流
FileInputStream in = new FileInputStream(uploadPath + "/" + fileName);
List<Map<String, Object>> lists = parseData(in, fileName);
@@ -255,14 +255,14 @@ public class AvgPriceAnalyController {
public List<String> listfile(File file){
//列出该目录下的所有文件和目录
//列出该目录下的所有文件和目录
File files[] = file.listFiles();
if(files == null){
return null;
}
//遍历files[]数组
//遍历files[]数组
List<String> fileNames = new ArrayList<String>();
for(File f : files){
if(f.isFile()){
@@ -278,25 +278,25 @@ public class AvgPriceAnalyController {
private HSSFWorkbook createSimpleExcel(){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
wb.setSheetName(0, "样本");
wb.setSheetName(0, "样本");
HSSFRow onerow = s.createRow(0);
onerow.createCell(0).setCellValue("城市");
onerow.createCell(1).setCellValue("区域");
onerow.createCell(2).setCellValue("楼盘名称");
onerow.createCell(3).setCellValue("调查价格");
onerow.createCell(0).setCellValue("城市");
onerow.createCell(1).setCellValue("区域");
onerow.createCell(2).setCellValue("楼盘名称");
onerow.createCell(3).setCellValue("调查价格");
HSSFRow row1 = s.createRow(1);
row1.createCell(0).setCellValue("上海");
row1.createCell(1).setCellValue("长宁");
row1.createCell(2).setCellValue("新泾三村");
row1.createCell(0).setCellValue("上海");
row1.createCell(1).setCellValue("长宁");
row1.createCell(2).setCellValue("新泾三村");
row1.createCell(3).setCellValue("45000");
return wb;
}
private HSSFWorkbook createExcel(List<PriceAnalyBo> bos){
HSSFWorkbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("数据");
Sheet sheet = wb.createSheet("数据");
setHeader(sheet, wb);
for(PriceAnalyBo bo : bos){
@@ -359,86 +359,86 @@ public class AvgPriceAnalyController {
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
HSSFCell cell = row.createCell(0);
cell.setCellValue("城市");
cell.setCellValue("城市");
cell.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
HSSFCell cell0_1 = row.createCell(1);
cell0_1.setCellValue("区域");
cell0_1.setCellValue("区域");
cell0_1.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
HSSFCell cell0 = row.createCell(2);
cell0.setCellValue("楼盘名称");
cell0.setCellValue("楼盘名称");
cell0.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
HSSFCell cell1 = row.createCell(3);
cell1.setCellValue("人工调查价格");
cell1.setCellValue("人工调查价格");
cell1.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
HSSFCell cell2 = row.createCell(4);
cell2.setCellValue("系统计算价格");
cell2.setCellValue("系统计算价格");
cell2.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 5, 7));
HSSFCell cell3 = row.createCell(5);
cell3.setCellValue("近一个月");
cell3.setCellValue("近一个月");
cell3.setCellStyle(cellStyle);
HSSFRow row1 = (HSSFRow) sheet.createRow(1);
HSSFCell cell31 = row1.createCell(5);
cell31.setCellValue("样本量");
cell31.setCellValue("样本量");
cell31.setCellStyle(cellStyle);
HSSFCell cell32 = row1.createCell(6);
cell32.setCellValue("人工调查分析(%)");
cell32.setCellValue("人工调查分析(%)");
cell32.setCellStyle(cellStyle);
HSSFCell cell33 = row1.createCell(7);
cell33.setCellValue("系统计算分析(%)");
cell33.setCellValue("系统计算分析(%)");
cell33.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 8, 10));
HSSFCell cell4 = row.createCell(8);
cell4.setCellValue("近6个月");
cell4.setCellValue("近6个月");
cell4.setCellStyle(cellStyle);
HSSFCell cell41 = row1.createCell(8);
cell41.setCellValue("样本量");
cell41.setCellValue("样本量");
cell41.setCellStyle(cellStyle);
HSSFCell cell42 = row1.createCell(9);
cell42.setCellValue("人工调查分析(%)");
cell42.setCellValue("人工调查分析(%)");
cell42.setCellStyle(cellStyle);
HSSFCell cell43 = row1.createCell(10);
cell43.setCellValue("系统计算分析(%)");
cell43.setCellValue("系统计算分析(%)");
cell43.setCellStyle(cellStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 11, 13));
HSSFCell cell6 = row.createCell(11);
cell6.setCellValue("历史所有");
cell6.setCellValue("历史所有");
cell6.setCellStyle(cellStyle);
HSSFCell cell61 = row1.createCell(11);
cell61.setCellValue("样本量");
cell61.setCellValue("样本量");
cell61.setCellStyle(cellStyle);
HSSFCell cell62 = row1.createCell(12);
cell62.setCellValue("人工调查分析(%)");
cell62.setCellValue("人工调查分析(%)");
cell62.setCellStyle(cellStyle);
HSSFCell cell63 = row1.createCell(13);
cell63.setCellValue("系统计算分析(%)");
cell63.setCellValue("系统计算分析(%)");
cell63.setCellStyle(cellStyle);
}
@@ -581,7 +581,7 @@ public class AvgPriceAnalyController {
if (POIXMLDocument.hasOOXMLHeader(inp)) {
return new XSSFWorkbook(OPCPackage.open(inp));
}
throw new IllegalArgumentException("你的excel版本目前poi解析不了");
throw new IllegalArgumentException("你的excel版本目前poi解析不了");
}
}
@@ -20,7 +20,7 @@ import com.fangjia.bkoff.service.address.RoleService;
import com.fangjia.bkoff.service.address.RoleServiceImpl;
import com.fangjia.core.util.PageBean;
/**
* 后台角色管理控制器
* 后台角色管理控制器
* @author yinjihuan
*
*/
@@ -34,18 +34,18 @@ public class BkoffRoleController {
private AuthorityService authorityService = new AuthorityServiceImpl();
/**
* 角色管理页面
* 角色管理页面
* @param model
* @return
*/
public Object indexAction(RoleModel model) {
try {
//角色信息
//角色信息
PageBean<Role> pageBean = roleService.queryRolesByPage(model.getPageBean().getCurrentPage(), 10);
List<Role> roles = pageBean.getList();
model.setPageBean(new PageBean<Role>(pageBean.getStart(), pageBean.getLimit(), roles, pageBean.getTotalRecords()));
//设置权限信息
//设置权限信息
List<AuthorityGroupInfo> groupInfos = new ArrayList<AuthorityGroupInfo>();
List<AuthorityGroup> groups = authorityGroupService.queryGroups();
for (AuthorityGroup group : groups) {
@@ -56,13 +56,13 @@ public class BkoffRoleController {
}
model.setGroupInfos(groupInfos);
} catch (Exception e) {
LOGGER.error("角色管理页面查询异常", e);
LOGGER.error("角色管理页面查询异常", e);
}
return model;
}
/**
* 查询角色信息
* 查询角色信息
* @param role
* @return
*/
@@ -71,13 +71,13 @@ public class BkoffRoleController {
List<Role> roles = roleService.queryAllRole();
return new JsonResultModel(true, roles);
} catch (Exception e) {
LOGGER.error("查询的角色信息异常", e);
LOGGER.error("查询的角色信息异常", e);
return new JsonResultModel(false, e.getMessage());
}
}
/**
* 保存角色
* 保存角色
* @param role
* @return
*/
@@ -86,14 +86,14 @@ public class BkoffRoleController {
role.setCreateDate(new Date());
roleService.saveRole(role);
} catch (Exception e) {
LOGGER.error("保存角色异常", e);
LOGGER.error("保存角色异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
}
/**
* 修改角色
* 修改角色
* @param role
* @return
*/
@@ -101,19 +101,19 @@ public class BkoffRoleController {
try {
Role old = roleService.getRole(role.getId());
if (old == null) {
return new JsonResultModel(false, "要修改的角色不存在");
return new JsonResultModel(false, "要修改的角色不存在");
}
role.setCreateDate(old.getCreateDate());
roleService.updateRole(role);
} catch (Exception e) {
LOGGER.error("修改角色异常", e);
LOGGER.error("修改角色异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
}
/**
* 查询角色下的权限
* 查询角色下的权限
* @param role
* @return
*/
@@ -121,11 +121,11 @@ public class BkoffRoleController {
try {
Role old = roleService.getRole(role.getId());
if (old == null) {
return new JsonResultModel(false, "角色不存在");
return new JsonResultModel(false, "角色不存在");
}
return new JsonResultModel(true, authorityService.queryAuthoritys(old.getAuthoritys()));
} catch (Exception e) {
LOGGER.error("查询角色下的权限异常", e);
LOGGER.error("查询角色下的权限异常", e);
return new JsonResultModel(false, e.getMessage());
}
}
@@ -20,7 +20,7 @@ import com.fangjia.bkoff.service.address.UserServiceImpl;
import com.fangjia.core.util.PageBean;
/**
* 后台用户管理控制器
* 后台用户管理控制器
* @author yinjihuan
*
*/
@@ -33,7 +33,7 @@ public class BkoffUserController {
/**
* 进入登录页面
* 进入登录页面
* @return
*/
public Object loginAction() {
@@ -41,16 +41,16 @@ public class BkoffUserController {
}
/**
* 用户登录后台
* 用户登录后台
* @param user
* @return
*/
public Object userLoginAction(User user, HttpServletRequest request) {
if (StringUtils.isBlank(user.getUsername())) {
return new JsonResultModel(false, "用户名不能为空");
return new JsonResultModel(false, "用户名不能为空");
}
if (StringUtils.isBlank(user.getPass())) {
return new JsonResultModel(false, "密码不能为空");
return new JsonResultModel(false, "密码不能为空");
}
//goojia goojia123456
if (user.getUsername().equals("goojia") && user.getPass().equals("9b6a4eb49d1f33c59dc7a3918fc6ef57")) {
@@ -58,11 +58,11 @@ public class BkoffUserController {
request.getSession().setAttribute("login_name", "goojia");
return new JsonResultModel(true);
}
return new JsonResultModel(false, "用户名密码错误");
return new JsonResultModel(false, "用户名密码错误");
}
/**
* 用户管理页面
* 用户管理页面
* @param model
* @return
*/
@@ -81,36 +81,36 @@ public class BkoffUserController {
model.setRoles(roleService.queryAllRole());
model.setPageBean(new PageBean<UserInfo>(pageBean.getStart(), pageBean.getLimit(), list, pageBean.getTotalRecords()));
} catch (Exception e) {
LOGGER.error("用户管理页面查询异常", e);
LOGGER.error("用户管理页面查询异常", e);
}
return model;
}
/**
* 删除用户
* 删除用户
* @param user
* @return
*/
public Object removeAction(User user) {
if (StringUtils.isBlank(user.getId())) {
return new JsonResultModel(false, "id不能为空");
return new JsonResultModel(false, "id不能为空");
}
try {
User old = userService.getUser(user.getId());
if (old == null) {
return new JsonResultModel(false, "要删除的用户不存在");
return new JsonResultModel(false, "要删除的用户不存在");
}
userService.removeUser(user.getId());
LOGGER.info("删除用户:" + old.getUsername());
LOGGER.info("删除用户:" + old.getUsername());
} catch (Exception e) {
LOGGER.error("删除用户异常", e);
LOGGER.error("删除用户异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
}
/**
* 添加用户
* 添加用户
* @param user
* @return
*/
@@ -118,26 +118,26 @@ public class BkoffUserController {
try {
User old = userService.getUserByUsername(user.getUsername());
if (old != null) {
return new JsonResultModel(false, "用户名已存在");
return new JsonResultModel(false, "用户名已存在");
}
if(user.getRoles() == null) {
return new JsonResultModel(false, "角色不能为空");
return new JsonResultModel(false, "角色不能为空");
}
Date date = new Date();
user.setCreateDate(date);
user.setUpdateDate(date);
//默认密码为123456
//默认密码为123456
user.setPass("e10adc3949ba59abbe56e057f20f883e");
userService.saveUser(user);
} catch (Exception e) {
LOGGER.error("添加用户异常", e);
LOGGER.error("添加用户异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
}
/**
* 修改用户
* 修改用户
* @param user
* @return
*/
@@ -145,10 +145,10 @@ public class BkoffUserController {
try {
User old = userService.getUser(user.getId());
if (old == null) {
return new JsonResultModel(false, "此用户不存在");
return new JsonResultModel(false, "此用户不存在");
}
if(user.getRoles() == null) {
return new JsonResultModel(false, "角色不能为空");
return new JsonResultModel(false, "角色不能为空");
}
Date date = new Date();
user.setUpdateDate(date);
@@ -158,14 +158,14 @@ public class BkoffUserController {
}
userService.updateUser(user);
} catch (Exception e) {
LOGGER.error("修改用户异常", e);
LOGGER.error("修改用户异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
}
/**
* 退出系统
* 退出系统
* @param request
* @param model
* @return
@@ -177,7 +177,7 @@ public class BkoffUserController {
}
/**
* 检测城市是否被别人使用中
* 检测城市是否被别人使用中
* @param user
* @return
*/
@@ -212,9 +212,9 @@ public class CalcController {
}
public static void main(String[] args) throws MongoException, IOException {
BasicDBObject q = new BasicDBObject("city", "昆明");
q.put("region", "盘龙");
q.put("district_name", "MOMA艺术造城");
BasicDBObject q = new BasicDBObject("city", "昆明");
q.put("region", "盘龙");
q.put("district_name", "MOMA艺术造城");
DBIterator<DBObject> iter = StorehouseDB.getInstance().iteratorSell(q, DateUtil.parseDate("2011-01-01", "yyyy-MM-dd"),
new Date());
while (iter != null && iter.hasNext()) {
@@ -225,7 +225,7 @@ public class CalcController {
}
/**
* 删除样本
* 删除样本
*
* @param model
* @return
@@ -263,7 +263,7 @@ public class CalcController {
aliasNames.addAll(district.getAlias());
}
Map<String, Date> idDateMap = new LinkedHashMap<String, Date>();
// 如果是县级市,则不考虑区域
// 如果是县级市,则不考虑区域
if (serverAreaDao.isCountyLevelCity(city)) {
for (String districtName : aliasNames) {
BasicDBObject q = new BasicDBObject("city", districtKey.getCity());
@@ -90,7 +90,7 @@ public class DistrictController {
// districtDao.saveDistrict(udata);
seaweedDao.saveData(udata);
} else {
dataMap.put("err", "该小区已存在!");
dataMap.put("err", "该小区已存在!");
ret.setJsonModel(dataMap);
}
@@ -107,19 +107,19 @@ public class DistrictController {
BasicDBObject obj = new BasicDBObject();
obj.put("audit_date", new Date());
if("districtFound".equals(model.getFrom())){
obj.put("audit_status", 2);//状态修改为已审核 小区发现后台
obj.put("audit_status", 2);//状态修改为已审核 小区发现后台
String ip = (String) ThreadLocalData.getInstance().get(ThreadLocalKey.Ip);
obj.put("ip",ip);
foundDistrictDao.update(Arrays.asList(new String[]{model.getFoundId()}), obj);
FoundDistrict foundDistrict = foundDistrictDao.findById(model.getFoundId());
if(foundDistrict != null && foundDistrict.getAnalySiteId() != null){
obj.remove("ip");
obj.put("audit_status", 1);//状态修改为已审核 对比后台
obj.put("audit_status", 1);//状态修改为已审核 对比后台
analySiteDao.updateById(obj, analySite.getId());
}
}else if(analySite != null){
obj.put("audit_status", 1);//状态修改为已审核
obj.put("audit_status", 1);//状态修改为已审核
analySiteDao.updateById(obj, analySite.getId());
}
@@ -366,7 +366,7 @@ public class DistrictController {
}
/**
* name 小区名称 去除首尾空格
* name 小区名称 去除首尾空格
*/
private String NameValidator(String name) {
if (StringUtils.isNotBlank(name)) {
@@ -75,7 +75,7 @@ public class DynamicController {
}else{
date = DateUtil.formatToYYYYMMDD(model.getQueryDate());
}
//二手房源总体情况
//二手房源总体情况
AnalyTotalResult sellResult = analyTotalResultDao.findTotalResult("sell", date);
if(sellResult!=null){
model.setSellTotal(sellResult.getTotal());
@@ -87,7 +87,7 @@ public class DynamicController {
model.setSellGiveUpNum(sellResult.getGiveupNum());
model.setSellAnalyErrorNum(sellResult.getAnalyErrorNum());
}
//租房总体情况
//租房总体情况
AnalyTotalResult rentResult = analyTotalResultDao.findTotalResult("rent", date);
if(rentResult!=null){
model.setRentTotal(rentResult.getTotal());
@@ -210,7 +210,7 @@ public class DynamicController {
model.setSiteList(analySiteList);
//二手房
//二手房
model.setSellTotal(sellTotal);
String ratio = "0";
if(sellTotal>0){
@@ -223,7 +223,7 @@ public class DynamicController {
model.setSellUpDateNum(sellUpdateNum);
model.setSellGiveUpNum(sellGiveUpNum);
model.setSellAnalyErrorNum(sellAnalyErrorNum);
//租房总体情况
//租房总体情况
model.setRentTotal(rentTotal);
String ratio2 = "0";
if(rentTotal>0){
@@ -240,7 +240,7 @@ public class DynamicController {
}
/**
* 总的解析结果详细
* 总的解析结果详细
* @param model
* @return
*/
@@ -270,7 +270,7 @@ public class DynamicController {
}
/**
* 错误信息详细页面
* 错误信息详细页面
* @param model
* @return
*/
@@ -281,7 +281,7 @@ public class DynamicController {
}
/**
* 错误信息详细页面
* 错误信息详细页面
* @param model
* @return
*/
@@ -292,7 +292,7 @@ public class DynamicController {
}
/**
* 获取错误信息的url链接
* 获取错误信息的url链接
* @param model
* @return
*/
@@ -333,7 +333,7 @@ public class DynamicController {
}
/**
* 获取解析错误的内容
* 获取解析错误的内容
* @param model
* @return
*/
@@ -22,7 +22,7 @@ import java.util.*;
/**
* 客户导出数据临时验证使用,数据验证后,可以删除
* 客户导出数据临时验证使用,数据验证后,可以删除
*/
public class ExperianController {
@@ -166,12 +166,12 @@ public class ExperianController {
headRow.createCell(5).setCellValue("Grid_SW_Lat_WGS84");
headRow.createCell(6).setCellValue("Grid_SW_Lon_WGS84");
headRow.createCell(7).setCellValue("format_city");
headRow.createCell(8).setCellValue("百度经度");
headRow.createCell(9).setCellValue("百度纬度");
headRow.createCell(10).setCellValue("格子价格");
headRow.createCell(11).setCellValue("价格类型");
headRow.createCell(12).setCellValue("格子内小区");
headRow.createCell(13).setCellValue("价格小区");
headRow.createCell(8).setCellValue("百度经度");
headRow.createCell(9).setCellValue("百度纬度");
headRow.createCell(10).setCellValue("格子价格");
headRow.createCell(11).setCellValue("价格类型");
headRow.createCell(12).setCellValue("格子内小区");
headRow.createCell(13).setCellValue("价格小区");
int c = 0;
while(cur.hasNext()) {
@@ -260,7 +260,7 @@ public class ExperianController {
OutputStream os = null;
BufferedOutputStream fos = null;
String fileName = model.getCity() + "价格数据";
String fileName = model.getCity() + "价格数据";
if(model.getSkip() > 0 || model.getLimit() > 0) {
if(model.getSkip() == 0) {
fileName = fileName + "-part1";
@@ -280,7 +280,7 @@ public class ExperianController {
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -48,18 +48,18 @@ import java.util.*;
public class FileReportController {
private static final String[] columns = {"城市", "区域", "小区名称","地址", "面积"};
private static final String[] columns = {"城市", "区域", "小区名称","地址", "面积"};
private static final String[] titles = {
"城市", "区域", "小区名称", "地址", "面积", "地址评级", "匹配城市", "匹配区域", "匹配小区名", "小区均价", "均价计算方式",
"周涨跌幅", "是否有经纬度", "物业类型", "总价", "未匹配原因", "小区编号", "均价可信度",
"房估估均价", "云估价均价", "链家均价", "安居客均价", "赶集网均价", "搜房网均价", "兔博士均价", "价格对比","最终价格"
"城市", "区域", "小区名称", "地址", "面积", "地址评级", "匹配城市", "匹配区域", "匹配小区名", "小区均价", "均价计算方式",
"周涨跌幅", "是否有经纬度", "物业类型", "总价", "未匹配原因", "小区编号", "均价可信度",
"房估估均价", "云估价均价", "链家均价", "安居客均价", "赶集网均价", "搜房网均价", "兔博士均价", "价格对比","最终价格"
};
private FileDatasTotalityService fileDatasTotalityService = FileDatasTotalityServiceImpl.getInstance();
private UserService userService = new UserServiceImpl();
private FileDetailDataService fileDetailDataService = new FileDetailDataServiceImpl();
private AddressScriptService addressScriptService = new AddressScriptServiceImpl();
//列表页
//列表页
public Object indexAction(FileReportModel model){
Pager pager = model.getPager(10);
pager.setTotalRows(fileDatasTotalityService.findCountByParams(model.getCategory(), model.getStartDate(), model.getEndDate(), model.getStatus(), model.getFileName(), model.getOldFileName()));
@@ -89,7 +89,7 @@ public class FileReportController {
return model;
}
//详情页
//详情页
public Object showAction(FileReportModel model){
Pager pager = model.getPager(10);
FileDatasTotality fileDatasTotality = fileDatasTotalityService.findFileDatasTotalityById(model.getFileId());
@@ -161,7 +161,7 @@ public class FileReportController {
}
/**
* 人工修改数据
* 人工修改数据
* @param model
* @param request
* @return
@@ -175,28 +175,28 @@ public class FileReportController {
public Object analyAction(FileReportModel model){
FileDatasTotality fileDatasTotality = fileDatasTotalityService.findFileDatasTotalityById(model.getId());
//地址未匹配原因分布数据
//地址未匹配原因分布数据
Map<String, Long> noMatchReasonData = new HashMap<String, Long>();
for (int i = 1; i < 9; i++) {
String desc = FileDetailData.NoMatchReasonEnum.parse(i).getReasonDesc();
noMatchReasonData.put(desc, fileDatasTotalityService.findNoMatchCount(model.getId(), i));
}
//最终匹配率
//最终匹配率
model.setOverMatchRate(fileDatasTotalityService.getOverMatchRate(model.getId()));
model.setNoMatchReasonData(noMatchReasonData);
//周涨跌幅区间数据
//周涨跌幅区间数据
model.setWeekMarkUpData(fileDatasTotalityService.getWeekMarkUpData(model.getId()));
model.setFileDatasTotality(fileDatasTotality);
//均价与调查价差比分布
//均价与调查价差比分布
model.setAvgAndRealPriceMarkUp(fileDatasTotalityService.getAvgAndRealPriceMarkUpData(model.getId()));
model.setChatTitle(ChatConfig.WEEKTITILE);
return model;
}
/**
* 柱形图详情数据查看
* 柱形图详情数据查看
* @param model
* @return
*/
@@ -214,14 +214,14 @@ public class FileReportController {
PageBean<FileDetailData> page = fileDatasTotalityService.finAvgAndRealPriceDataDetails(model.getId(), model.getQueryIndex(), pager.getStartRow(), pager.getPageSize());
pager.setTotalRows((int)page.getTotalRecords());
datas = page.getList();
model.setNoMatchReasonText("均价与调查价差比" + ChatConfig.WEEKTITILE.get(model.getQueryIndex()));
model.setNoMatchReasonText("均价与调查价差比" + ChatConfig.WEEKTITILE.get(model.getQueryIndex()));
}
if(model.getQueryType() == 1) {
PageBean<FileDetailData> page = fileDatasTotalityService.findWeekMarkUpFileDataDetails(model.getId(), model.getQueryIndex(), pager.getStartRow(), pager.getPageSize());
pager.setTotalRows((int)page.getTotalRecords());
datas = page.getList();
model.setNoMatchReasonText("周涨跌幅" + ChatConfig.WEEKTITILE.get(model.getQueryIndex()));
model.setNoMatchReasonText("周涨跌幅" + ChatConfig.WEEKTITILE.get(model.getQueryIndex()));
}
model.setDetailDatas(datas);
return model;
@@ -236,19 +236,19 @@ public class FileReportController {
String fileName = fileDatasTotality.getOldFileName();
Workbook wb = createExcel(datas,fileDatasTotality.getOldFileName());
if(fileDatasTotality.getStatus()!=6){
fileDatasTotality.setStatus(4);//设置成人工调查
fileDatasTotality.setStatus(4);//设置成人工调查
}
fileDatasTotalityService.saveToData(fileDatasTotality);
try {
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
@@ -275,7 +275,7 @@ public class FileReportController {
Map<String, String> msgMap = new HashMap<String, String>();
if(StringUtils.isNotBlank(model.getId())){
FileDatasTotality fileDatasTotality = fileDatasTotalityService.findFileDatasTotalityById(model.getId());
fileDatasTotality.setStatus(4);//设置成人工调查
fileDatasTotality.setStatus(4);//设置成人工调查
fileDatasTotalityService.saveToData(fileDatasTotality);
msgMap.put("status", "0");
}else{
@@ -287,7 +287,7 @@ public class FileReportController {
public Object updateFileStatusToFinishAction(FileReportModel model,HttpServletRequest request){
FileDatasTotality fileDatasTotality = fileDatasTotalityService.findFileDatasTotalityById(model.getId());
fileDatasTotality.setStatus(6);//设置成人工调查
fileDatasTotality.setStatus(6);//设置成人工调查
fileDatasTotalityService.saveToData(fileDatasTotality);
model.redirect(request.getHeader("Referer"));
return model;
@@ -313,7 +313,7 @@ public class FileReportController {
}
//删除
//删除
public Object deleteDataAction(FileReportModel model){
if(StringUtils.isNotBlank(model.getId())){
fileDatasTotalityService.deleteFileDatasTotality(model.getId());
@@ -334,8 +334,8 @@ public class FileReportController {
CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
DataValidationConstraint constraint = helper.createExplicitListConstraint(values);
DataValidation dataValidation = helper.createValidation(constraint, addressList);
dataValidation.createErrorBox("输入值有误", "请从下拉框中选择");
//处理Excel兼容性问题
dataValidation.createErrorBox("输入值有误", "请从下拉框中选择");
//处理Excel兼容性问题
if(dataValidation instanceof XSSFDataValidation) {
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
@@ -349,15 +349,15 @@ public class FileReportController {
private void setDataTypeToExcel(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol){
if(sheet instanceof HSSFSheet){
// 创建一个规则:1-100的数字
// 创建一个规则:1-100的数字
DVConstraint constraint = DVConstraint.createNumericConstraint(
DVConstraint.ValidationType.INTEGER,
DVConstraint.OperatorType.GREATER_THAN, "100", null);
// 设定在哪个单元格生效
// 设定在哪个单元格生效
CellRangeAddressList regions = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
// 创建规则对象
// 创建规则对象
DataValidation dataValidation = new HSSFDataValidation(regions, constraint);
dataValidation.createErrorBox("输入值有误", "请设置合理的值");
dataValidation.createErrorBox("输入值有误", "请设置合理的值");
sheet.addValidationData(dataValidation);
// XSSFDataValidationConstraint constraint = new XSSFDataValidationConstraint()
//
@@ -377,25 +377,25 @@ public class FileReportController {
wb = new XSSFWorkbook();
}
Sheet sheet = wb.createSheet();
wb.setSheetName(0, "数据");
//创建表头
wb.setSheetName(0, "数据");
//创建表头
createHeader(sheet);
//是否抽查列值设置
String[] checkStatuses = {"是","否"};
//是否抽查列值设置
String[] checkStatuses = {"是","否"};
addSelectToExcel(sheet, 1, datas.size(), 16, 16, checkStatuses);
//匹配原因列设置
String[] errors = {"匹配逻辑问题","原始地址/区域错误","名称/别名错误","库中地址错误","库中区域错误","库中无此小区","无效地址","其他原因"};
//匹配原因列设置
String[] errors = {"匹配逻辑问题","原始地址/区域错误","名称/别名错误","库中地址错误","库中区域错误","库中无此小区","无效地址","其他原因"};
addSelectToExcel(sheet, 1, datas.size(), 18, 18, errors);
setDataTypeToExcel(sheet, 1, datas.size(), 19, 19);
//创建数据
//创建数据
if(null != datas && datas.size()>0){
for(FileDetailData datailData : datas){
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
row.createCell(0).setCellValue(datailData.getCity());
row.createCell(1).setCellValue(datailData.getRegion());
row.createCell(2).setCellValue(datailData.getDistrictName());//小区先留着为空
row.createCell(2).setCellValue(datailData.getDistrictName());//小区先留着为空
row.createCell(3).setCellValue(datailData.getAddress());
if (datailData.getOriArea() != null) {
row.createCell(4).setCellValue(datailData.getOriArea());
@@ -410,17 +410,17 @@ public class FileReportController {
if(null != datailData.getValueType()){
if(datailData.getValueType()==1){
row.createCell(10).setCellValue("指导价");
row.createCell(10).setCellValue("指导价");
}else if(datailData.getValueType()==2){
row.createCell(10).setCellValue("自身样本");
row.createCell(10).setCellValue("自身样本");
}else if(datailData.getValueType()==3){
row.createCell(10).setCellValue("第三方");
row.createCell(10).setCellValue("第三方");
}else if(datailData.getValueType()==4){
row.createCell(10).setCellValue("交易数据");
row.createCell(10).setCellValue("交易数据");
}else if(datailData.getValueType()==5){
row.createCell(10).setCellValue("周边楼盘");
row.createCell(10).setCellValue("周边楼盘");
}else if(datailData.getValueType()==6){
row.createCell(10).setCellValue("推导");
row.createCell(10).setCellValue("推导");
}
}
@@ -429,9 +429,9 @@ public class FileReportController {
}
if(datailData.getLat()!=null && datailData.getLat()>0){
row.createCell(12).setCellValue("有");
row.createCell(12).setCellValue("有");
}else{
row.createCell(12).setCellValue("无");
row.createCell(12).setCellValue("无");
}
/*if(null != datailData.getAddrCheckLevel()){
@@ -460,9 +460,9 @@ public class FileReportController {
/*if(null != datailData.getCheckStatus()){
if(datailData.getCheckStatus() == 0){
row.createCell(16).setCellValue("否");
row.createCell(16).setCellValue("否");
}else if(datailData.getCheckStatus() == 1){
row.createCell(16).setCellValue("是");
row.createCell(16).setCellValue("是");
}
}
@@ -534,7 +534,7 @@ public class FileReportController {
}
}
// excel导入
// excel导入
public Object importExcelAction(FileReportModel model, HttpServletRequest request) {
JsonModel ret = new JsonModel();
try {
@@ -553,7 +553,7 @@ public class FileReportController {
if(null != fileDatasTotalityService.findByFileName(name)){
Map<String, Object> msgMap = new HashMap<String, Object>();
msgMap.put("error", "error");
msgMap.put("msg", "该文件名已经存在,只能用于更新!");
msgMap.put("msg", "该文件名已经存在,只能用于更新!");
ret.setJsonModel(msgMap);
return ret;
}
@@ -581,20 +581,20 @@ public class FileReportController {
}
private Map<String, String> checkDatas(Workbook wb, Integer category, String userId, String oldFileName){
List<List<String>> resultList = new ArrayList<List<String>>();
Sheet sheet = wb.getSheetAt(0); // 获得第一个表单
Iterator<Row> rows = sheet.rowIterator(); //获得第一个表单的迭代器
Sheet sheet = wb.getSheetAt(0); // 获得第一个表单
Iterator<Row> rows = sheet.rowIterator(); //获得第一个表单的迭代器
int totalCount = 0;
int line = 0;
Map<String, String> msgMap = new HashMap<String, String>();
while (rows.hasNext()) {
Row row = rows.next(); // 获得行数据
Row row = rows.next(); // 获得行数据
line++;
boolean isBlankRow = true;
boolean errorFlag = false;
String errorFiled = null;
List<String> rowDatas = new ArrayList<String>();
if (row.getRowNum() == 0) {//判断表头
if (row.getRowNum() == 0) {//判断表头
for (int i = 0; i < 5; i++) {
Cell cell = row.getCell(i);
String value = cell.getStringCellValue();
@@ -605,7 +605,7 @@ public class FileReportController {
break;
}
}
} else {//内容判断
} else {//内容判断
for (int i = 0; i < 5; i++) {
Cell cell = row.getCell(i);
String value = null;
@@ -620,7 +620,7 @@ public class FileReportController {
}
if((i==3) && StringUtils.isBlank(value)){
errorFlag = true;
errorFiled = columns[i] + "不能为空!";
errorFiled = columns[i] + "不能为空!";
break;
}
if((i==4) && StringUtils.isNotBlank(value)){
@@ -628,7 +628,7 @@ public class FileReportController {
Double.parseDouble(value);
} catch (NumberFormatException e) {
errorFlag = true;
errorFiled = columns[i] + "不能为非数字";
errorFiled = columns[i] + "不能为非数字";
break;
}
}
@@ -642,7 +642,7 @@ public class FileReportController {
msgMap.put("msg", errorFiled);
break;
}else{
if(!isBlankRow){//不是空白行
if(!isBlankRow){//不是空白行
totalCount++;
resultList.add(rowDatas);
}
@@ -654,7 +654,7 @@ public class FileReportController {
if(msgMap.containsKey("error")){
return msgMap;
}else{
//保存总体情况
//保存总体情况
FileDatasTotality fileDatasTotality = new FileDatasTotality();
fileDatasTotality.setCategory(category);
fileDatasTotality.setOldFileName(oldFileName);
@@ -668,7 +668,7 @@ public class FileReportController {
fileDatasTotalityService.saveToData(fileDatasTotality);
String fileId = fileDatasTotality.getId();
//保存详情
//保存详情
List<FileDetailData> datas = new ArrayList<FileDetailData>();
int serial = 0;
String userName = getUserName(userId);
@@ -767,14 +767,14 @@ public class FileReportController {
private void updateFileDatas(Workbook wb, String fileId){
Sheet sheet = wb.getSheetAt(0); // 获得第一个表单
Iterator<Row> rows = sheet.rowIterator(); //获得第一个表单的迭代器
Sheet sheet = wb.getSheetAt(0); // 获得第一个表单
Iterator<Row> rows = sheet.rowIterator(); //获得第一个表单的迭代器
Map<String, String> msgMap = new HashMap<String, String>();
while (rows.hasNext()) {
Row row = rows.next(); // 获得行数据
Row row = rows.next(); // 获得行数据
List<String> rowDatas = new ArrayList<String>();
if (row.getRowNum() == 0) {//判断表头
if (row.getRowNum() == 0) {//判断表头
for (int i = 0; i < 3; i++) {
}
@@ -796,9 +796,9 @@ public class FileReportController {
udata.put("real_district_name", (String)realName);
}
if(checkStatus!=null){
if(checkStatus.equals("是")){
if(checkStatus.equals("是")){
udata.put("check_status", 1);
}else if(checkStatus.equals("否")){
}else if(checkStatus.equals("否")){
udata.put("check_status", 0);
}
@@ -925,17 +925,17 @@ public class FileReportController {
}
/**
* 获取详情数据
* 获取详情数据
* @param model
* @return
*/
public Object fileDetailAction(FileReportModel model) {
if (!ObjectId.isValid(model.getId())) {
return new JsonResultModel(false, "非法ID");
return new JsonResultModel(false, "非法ID");
}
FileDetailData detail = fileDetailDataService.get(model.getId());
if (detail == null) {
return new JsonResultModel(false, "数据不存在");
return new JsonResultModel(false, "数据不存在");
}
return new JsonResultModel(true, detail);
}
@@ -116,7 +116,7 @@ public class FoundDistrictController {
HSSFWorkbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
String[] headers = new String[]{"序号", "城市", "区域", "名称", "地址", "CPDB库", "网站量","审核状态", "审核时间", "来源", "住宅比","地图库对比结果"};
String[] headers = new String[]{"序号", "城市", "区域", "名称", "地址", "CPDB库", "网站量","审核状态", "审核时间", "来源", "住宅比","地图库对比结果"};
for(int i = 0; i < headers.length; i++){
row.createCell(i).setCellValue(headers[i]);
}
@@ -131,24 +131,24 @@ public class FoundDistrictController {
row.createCell(4).setCellValue(foundDistrict.getAddress());
}
if(foundDistrict.getExist() == 1){
row.createCell(5).setCellValue("存在");
row.createCell(5).setCellValue("存在");
}else{
row.createCell(5).setCellValue("不存在");
row.createCell(5).setCellValue("不存在");
}
if(foundDistrict.getSiteCount() != null){
row.createCell(6).setCellValue(foundDistrict.getSiteCount());
}
if(foundDistrict.getAuditStatus() == 0){
row.createCell(7).setCellValue("未审核");
row.createCell(7).setCellValue("未审核");
}else if(foundDistrict.getAuditStatus() == 1){
row.createCell(7).setCellValue("已审核");
row.createCell(7).setCellValue("已审核");
}else if(foundDistrict.getAuditStatus() == 2){
row.createCell(7).setCellValue("已审阅");
row.createCell(7).setCellValue("已审阅");
}else if(foundDistrict.getAuditStatus() == -1){
row.createCell(7).setCellValue("已删除");
row.createCell(7).setCellValue("已删除");
}
if(foundDistrict.getAuditDate() != null){
row.createCell(8).setCellValue(DateUtil.formatByPattern(foundDistrict.getAuditDate(),"yyyy年MM月dd日"));
row.createCell(8).setCellValue(DateUtil.formatByPattern(foundDistrict.getAuditDate(),"yyyy年MM月dd日"));
}
if(foundDistrict.getSource() != null){
row.createCell(9).setCellValue(foundDistrict.getSource());
@@ -158,27 +158,27 @@ public class FoundDistrictController {
}
if(foundDistrict.getCompareResult() != null){
if("exist".equals(foundDistrict.getCompareResult())){
row.createCell(11).setCellValue("地图库存在");
row.createCell(11).setCellValue("地图库存在");
}else if("not_exist".equals(foundDistrict.getCompareResult())){
row.createCell(11).setCellValue("地图库不存在");
row.createCell(11).setCellValue("地图库不存在");
}else if("diff_region".equals(foundDistrict.getCompareResult())){
row.createCell(11).setCellValue("区域不一致"+ foundDistrict.getDiffRegion());
row.createCell(11).setCellValue("区域不一致"+ foundDistrict.getDiffRegion());
}else if("alias_exist".equals(foundDistrict.getCompareResult())){
row.createCell(11).setCellValue("是"+ foundDistrict.getAliasName() +"的别名");
row.createCell(11).setCellValue("是"+ foundDistrict.getAliasName() +"的别名");
}
}
}
String fileName = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss") + ".xls";
try {
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -19,7 +19,7 @@ import com.fangjia.coredata.mongo.dao.WebpageAnalyLogDao;
import com.fangjia.coredata.mongo.model.WebpageAnalyLog;
/**
* 房源解析
* 房源解析
* @author gaojuan
*
*/
@@ -40,9 +40,9 @@ public class HouseAnalyController {
List<WebpageAnalyLog> webpageAnalyLogs = webpageAnalyLogDao.findWebpageAnalyLogs(model.getCity(), model.getCategory(), model.getSiteName(), model.getStartDate(), model.getEndDate());
//总览及网站统计中按网站选择
//总览及网站统计中按网站选择
if(StringUtils.isBlank(model.getGroupby()) || (StringUtils.isNotBlank(model.getGroupby()) && model.getGroupby().equals("website") && StringUtils.isNotBlank(model.getSiteName()))){
//网站总量在所有总量中的占比
//网站总量在所有总量中的占比
if(StringUtils.isNotBlank(model.getMode()) && (model.getMode().equals("websiteAll") || model.getMode().equals("cityAll"))){
Map<String, Map<String, Double>> retMap = null;
Map<String, Map<String, Integer>> oldRetMap = null;
@@ -59,7 +59,7 @@ public class HouseAnalyController {
model.setFilterChartSeries(toChartString(retMap, "filter_count"));
model.setLostChartSeries(toChartString(retMap, "lost_count"));
model.setTotalErrorChartSeries(toChartString(retMap, "total_error_count"));
}else{//总览走势
}else{//总览走势
if(StringUtils.isBlank(model.getGroupby()) && StringUtils.isBlank(model.getMode())){
model.setMode("all");
}
@@ -82,7 +82,7 @@ public class HouseAnalyController {
model.setTotalErrorChartSeries(createSeriesByCat(retMap, dates, "total_error_count", model.getCity()));
}else{
//按网站或城市统计
//按网站或城市统计
Map<String, Map<String, Double>> retMap = null;
Map<String, Map<String, Integer>> oldRetMap = null;
if(StringUtils.isNotBlank(model.getGroupby()) && model.getGroupby().equals("city")){
@@ -182,43 +182,43 @@ public class HouseAnalyController {
}
JSONObject jo = new JSONObject();
jo.put("name", "总量");
jo.put("name", "总量");
jo.put("data", totalDatas);
jo.put("visible", true);
jo.put("selected", true);
JSONObject jo1 = new JSONObject();
jo1.put("name", "异常量");
jo1.put("name", "异常量");
jo1.put("data", errorDatas);
jo1.put("visible", false);
jo1.put("selected", false);
JSONObject jo2 = new JSONObject();
jo2.put("name", "保存量");
jo2.put("name", "保存量");
jo2.put("data", addDatas);
jo2.put("visible", false);
jo2.put("selected", false);
JSONObject jo3 = new JSONObject();
jo3.put("name", "更新量");
jo3.put("name", "更新量");
jo3.put("data", updateDatas);
jo3.put("visible", false);
jo3.put("selected", false);
JSONObject jo4 = new JSONObject();
jo4.put("name", "过滤量");
jo4.put("name", "过滤量");
jo4.put("data", fiterDatas);
jo4.put("visible", false);
jo4.put("selected", false);
JSONObject jo5 = new JSONObject();
jo5.put("name", "放弃量");
jo5.put("name", "放弃量");
jo5.put("data", lostDatas);
jo5.put("visible", false);
jo5.put("selected", false);
JSONObject jo6 = new JSONObject();
jo6.put("name", "失败率");
jo6.put("name", "失败率");
jo6.put("data", failDatas);
jo6.put("visible", false);
jo6.put("selected", false);
@@ -30,7 +30,7 @@ public class LogAnalysisController {
Map<String, RegionStat> regionStatMap = regionStatDao.findAllCityRegionStats(weekend);
List<List<String>> datas = new ArrayList<List<String>>();
for(ServerArea serverArea : serverAreas) {
if("şŁÄĎ".equals(serverArea.getProvince())) {
if("海南".equals(serverArea.getProvince())) {
continue;
}
if(serverArea.getLat() > 0 && serverArea.getLng() > 0 && regionStatMap.containsKey(serverArea.getDisplay())) {
@@ -164,7 +164,7 @@ public class ModeAnalyController {
if (null == str)
return null;
str = str.replaceAll("^[\\s ]*|[\\s ]*$", "");
str = str.replaceAll("^[\\s ]*|[\\s ]*$", "");
str = str.replaceAll("&nbsp;", "");
str = DataUtil.encoding(str).replaceAll("^\\?*|\\?*$", "");
return str;
@@ -190,7 +190,7 @@ public class ModeAnalyController {
}
/**
* 测试房源自动解析
* 测试房源自动解析
* @param model
* @return
* @throws UnsupportedEncodingException
@@ -211,7 +211,7 @@ public class ModeAnalyController {
}
/**
* 保存规则更改
* 保存规则更改
* @param model
* @return
*/
@@ -221,7 +221,7 @@ public class ModeAnalyController {
}
/**
* 删除规则
* 删除规则
* @param model
* @return
*/
@@ -48,7 +48,7 @@ public class TestReportController {
}
/**
* 测试报告-城市得分排行
* 测试报告-城市得分排行
* @param model
* @return
*/
@@ -58,15 +58,15 @@ public class TestReportController {
initDateRange(model);
//城市得分列表
//城市得分列表
List<DistrictStatistics> districtStatisticses = districtStatisticsService.findByTime(model.getStart(), model.getEnd(), scorePager);
model.setDistrictStatisticses(districtStatisticses);
//负责人得分排行
//负责人得分排行
List<RankingModel> personRankingList = districtStatisticsService.personRankingList(model.getStart(), model.getEnd(), personPager);
model.setPersonRankings(personRankingList);
//涨幅(城市得分涨幅)
//涨幅(城市得分涨幅)
List<RiseRateModel> cityScoreUps = districtStatisticsService.getCityScoreUpList(model.getStart(), model.getEnd(), 10);
model.setCityScoreUps(cityScoreUps);
@@ -77,7 +77,7 @@ public class TestReportController {
}
public Object exportAction(TestReportModel model, HttpServletResponse response) {
String fileName = "全国城市得分列表.xls";
String fileName = "全国城市得分列表.xls";
OutputStream os = null;
BufferedOutputStream fos = null;
@@ -85,14 +85,14 @@ public class TestReportController {
HSSFWorkbook wb = createExcel(datas);
try {
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -114,15 +114,15 @@ public class TestReportController {
private HSSFWorkbook createExcel(List<DistrictStatistics> datas){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
wb.setSheetName(0, "数据");
List<String> headers = ImmutableList.of("城市", "城市等级", "城市得分", "负责人", "负责人得分");
//创建表头
wb.setSheetName(0, "数据");
List<String> headers = ImmutableList.of("城市", "城市等级", "城市得分", "负责人", "负责人得分");
//创建表头
HSSFRow headerRow = sheet.createRow(0);
for(int i = 0; i < headers.size(); ++i) {
headerRow.createCell(i).setCellValue(headers.get(i));
}
//创建数据
//创建数据
if(CollectionUtils.isNotEmpty(datas)){
for(DistrictStatistics districtStatistics : datas){
HSSFRow row = sheet.createRow(sheet.getPhysicalNumberOfRows());
@@ -150,7 +150,7 @@ public class TestReportController {
}
/**
* 测试统计报告数据查询
* 测试统计报告数据查询
* @param model
* @return
*/
@@ -167,19 +167,19 @@ public class TestReportController {
model.setStart(calendar.getTime());
model.setEnd(DateUtil.getLastDayOfMonth(new Date()));*/
//测试抽样
//测试抽样
List<FileDatasTotality> stRestuls = fileDatasTotalityService.findAll(1, model.getStart(), model.getEnd(), 6);
List<FileDetailData> stDetailResults = getDetailResults(stRestuls);
removeDuplicateDate(stDetailResults);
TestReportModel stResultModel = completeResult(stRestuls, stDetailResults);
//项目数据
//项目数据
List<FileDatasTotality> ptResults = fileDatasTotalityService.findAll(2, model.getStart(), model.getEnd(), 6);
List<FileDetailData> ptDetailResults = getDetailResults(ptResults);
removeDuplicateDate(ptDetailResults);
TestReportModel ptResultModel = completeResult(ptResults, ptDetailResults);
//总数
//总数
List<FileDatasTotality> ttResults = new ArrayList<FileDatasTotality>();
List<FileDetailData> ttDetailResults = new ArrayList<FileDetailData>();
ttResults.addAll(stRestuls);
@@ -189,7 +189,7 @@ public class TestReportController {
removeDuplicateDate(ttDetailResults);
TestReportModel ttResultModel = completeResult(ttResults, ttDetailResults);
//走势图
//走势图
Map<String, Map<String, Double>> trendMap = getTrendMap(ttResults, ttDetailResults, model.getStart(), model.getEnd());
Map<String, Object> resultModel = Maps.newHashMap();
@@ -202,7 +202,7 @@ public class TestReportController {
}
/**
* 根据查询到的文件,获取所有文件数据:只获取抽样过的数据
* 根据查询到的文件,获取所有文件数据:只获取抽样过的数据
* @param stRestuls
* @return
*/
@@ -222,7 +222,7 @@ public class TestReportController {
}
/**
* 根据城市、区域、小区名去除重复数据
* 根据城市、区域、小区名去除重复数据
* @param results
*/
private void removeDuplicateDate(List<FileDetailData> results) {
@@ -241,7 +241,7 @@ public class TestReportController {
}
/**
* 测试统计报告页走势图
* 测试统计报告页走势图
* @return
* @param datas
* @param start
@@ -251,9 +251,9 @@ public class TestReportController {
long diffDays = (end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24);
Map<String, List<FileDatasTotality>> trendDatas = Maps.newHashMap();
//周期为【年】
//周期为【年】
if(diffDays > 31) {
//按月分组
//按月分组
for(FileDatasTotality fileDatasTotality : datas) {
String month = DateUtil.formatByPattern(fileDatasTotality.getModificationDate(), "yyyy/MM");
List<FileDatasTotality> fileDatasTotalities = trendDatas.get(month);
@@ -263,10 +263,10 @@ public class TestReportController {
fileDatasTotalities.add(fileDatasTotality);
trendDatas.put(month, fileDatasTotalities);
}
} else if(diffDays > 7) {//周期为月
//从1号开始,以7天为单位,显示4个周
} else if(diffDays > 7) {//周期为月
//从1号开始,以7天为单位,显示4个周
Map<Integer, String> weekMap = getWeekMap(start);
//按7天分组
//按7天分组
for(FileDatasTotality fileDatasTotality : datas) {
Date mDate = fileDatasTotality.getModificationDate();
int monthIndex = (int)Math.ceil((mDate.getTime() - start.getTime()) / (1000 * 3600 * 24 * 7 * 1.0));
@@ -278,8 +278,8 @@ public class TestReportController {
fileDatasTotalities.add(fileDatasTotality);
trendDatas.put(key, fileDatasTotalities);
}
} else {//周期为一周,则按天显示
//周期为周,不显示走势图
} else {//周期为一周,则按天显示
//周期为周,不显示走势图
/*for(FileDatasTotality fileDatasTotality : datas) {
String key = DateUtil.formatByPattern(fileDatasTotality.getModificationDate(), "MM/dd");
trendDatas.put(key, ImmutableList.of(fileDatasTotality));
@@ -289,7 +289,7 @@ public class TestReportController {
}
/**
* 填充走势图数据
* 填充走势图数据
* @param datas
* @return
*/
@@ -317,7 +317,7 @@ public class TestReportController {
}
/**
* 根据给定时间,得出未来四个周的日期范围。其中key为基于1的下标,value为日期范围
* 根据给定时间,得出未来四个周的日期范围。其中key为基于1的下标,value为日期范围
* @param start
* @return
*/
@@ -345,7 +345,7 @@ public class TestReportController {
}
/**
* 数据填充
* 数据填充
* @param results
* @param detailResults
* @return
@@ -360,7 +360,7 @@ public class TestReportController {
}
if(CollectionUtils.isNotEmpty(detailResults)) {
model.setCount(detailResults.size());
//城市个数
//城市个数
Set<String> cities = Sets.newHashSet();
int matchCount = 0;
int avgPriceMatchCount = 0;
@@ -403,7 +403,7 @@ public class TestReportController {
/**
* 找出比例最高的原因
* 找出比例最高的原因
* @param reasonCountMap
* @return
*/
@@ -421,8 +421,8 @@ public class TestReportController {
}
/**
* 库中存储的“原因”为数值型,需要转换为对应的字符串描述
* @param reasonInteger 对应的数字描述
* 库中存储的“原因”为数值型,需要转换为对应的字符串描述
* @param reasonInteger 对应的数字描述
* @return
*/
private String getReason(Integer reasonInteger) {
@@ -437,7 +437,7 @@ public class TestReportController {
initDateRange(model);
String cityName = model.getCityName();
if("全国".equals(cityName)) {
if("全国".equals(cityName)) {
cityName = null;
}
/*if(model.getEnd()!=null){
@@ -505,7 +505,7 @@ public class TestReportController {
}
/**
* 初始化时间范围
* 初始化时间范围
* @param model
*/
private void initDateRange(TestReportModel model) {
@@ -552,7 +552,7 @@ public class TestReportController {
if(StringUtils.isNotBlank(model.getCityName()) && StringUtils.isNotBlank(model.getRegion())
&& StringUtils.isNotBlank(model.getDistrictName()) && model.getReason() != null) {
if(model.getReason()==8&&StringUtils.isBlank(model.getOtherReason())){
data.put("msg", "请输入问题原因");
data.put("msg", "请输入问题原因");
return ret;
}
String cityName = model.getCityName();
@@ -596,7 +596,7 @@ public class TestReportController {
fileDatasTotalityService.updateFileDetailData(model.getId(), udata);
}
}else {
data.put("msg", "参数输入不完整");
data.put("msg", "参数输入不完整");
}
return ret;
}
@@ -39,16 +39,16 @@ public class UserController {
}
/**
* 用户登录
* 用户登录
* @param user
* @return
*/
public Object userLoginAction(User user, HttpServletRequest request) {
if (StringUtils.isBlank(user.getUsername())) {
return new JsonResultModel(false, "用户名不能为空");
return new JsonResultModel(false, "用户名不能为空");
}
if (StringUtils.isBlank(user.getPass())) {
return new JsonResultModel(false, "密码不能为空");
return new JsonResultModel(false, "密码不能为空");
}
try {
@@ -62,7 +62,7 @@ public class UserController {
List<String> authoritys = authorityService.queryAuthoritysByUser(old.getId());
session.setAttribute("authoritys", authoritys);
} catch (Exception e) {
LOGGER.error("查询用户权限异常", e);
LOGGER.error("查询用户权限异常", e);
}
return new JsonResultModel(true);
@@ -71,11 +71,11 @@ public class UserController {
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(false, "用户名密码错误");
return new JsonResultModel(false, "用户名密码错误");
}
/**
* 链接请求直接登录(新需求)
* 链接请求直接登录(新需求)
* @param model
* @param req
* @param response
@@ -100,7 +100,7 @@ public class UserController {
List<String> authoritys = authorityService.queryAuthoritysByUser(old.getId());
session.setAttribute("authoritys", authoritys);
} catch (Exception e) {
LOGGER.error("查询用户权限异常", e);
LOGGER.error("查询用户权限异常", e);
}
return model.redirect("/addressInfo/index");
}
@@ -113,7 +113,7 @@ public class UserController {
/**
* 退出系统
* 退出系统
* @param request
* @param model
* @return
@@ -125,7 +125,7 @@ public class UserController {
}
/**
* 修改密码页面
* 修改密码页面
* @param request
* @param model
* @return
@@ -135,19 +135,19 @@ public class UserController {
}
/**
* 修改密码
* 修改密码
* @param user
* @return
*/
public Object updatePassAction(HttpServletRequest request, User user) {
if (user.getPass() == null) {
return new JsonResultModel(false, "密码不能为空");
return new JsonResultModel(false, "密码不能为空");
}
String userId = SessionContent.getLoginUserId(request);
try {
userService.updatePass(userId, user.getPass());
} catch (Exception e) {
LOGGER.error("修改密码异常", e);
LOGGER.error("修改密码异常", e);
return new JsonResultModel(false, e.getMessage());
}
return new JsonResultModel(true);
@@ -84,7 +84,7 @@ public class WebsiteController {
List<Website> websites = WebsiteDao.getInstance().findAll();
int c = 0;
for (Website website : websites) {
if (!"district".equals(website.getCategory()) || website.getScope().indexOf("全国类") == -1) {
if (!"district".equals(website.getCategory()) || website.getScope().indexOf("全国类") == -1) {
continue;
}
c++;
@@ -128,13 +128,13 @@ public class WebsiteController {
model.setViewType("json");
Map<String, Object> dataMap = new HashMap<String, Object>();
if (model.getId() == null || model.getIdList() == null || model.getCategory() == null) {
dataMap.put("err", "信息错误");
dataMap.put("err", "信息错误");
return model;
}
Website website = websiteDao.findById(model.getId());
if (website == null) {
dataMap.put("err", "id无效");
dataMap.put("err", "id无效");
return model;
}
@@ -352,10 +352,10 @@ public class WebsiteController {
websiteBo.setScore(seed.getScore());
// websiteBo.setGrabDate(webpageDao.findGrabDate(seed.getCity(),
// website.getCategory(), website.getPageName(),
// website.getSiteName()));//获取抓取时间);
// website.getSiteName()));//获取抓取时间);
// List<Date> dates = webpageDao.findGrabDate(seed.getCity(),
// website.getCategory(), website.getPageName(),
// website.getSiteName());//获取抓取时间
// website.getSiteName());//获取抓取时间
// if(dates.size() > 0){
// Collections.sort(dates,c);
// System.out.println(dates.get(0));
@@ -391,7 +391,7 @@ public class WebsiteController {
JsonModel ret = new JsonModel();
Map<String, Object> dataMap = new HashMap<String, Object>();
if (model.getCategory() == null || StringUtils.isBlank(model.getSiteName())) {
dataMap.put("err", "必选参数不能为空");
dataMap.put("err", "必选参数不能为空");
ret.setJsonModel(dataMap);
return ret;
}
@@ -400,12 +400,12 @@ public class WebsiteController {
if (obj != null) {
if (model.getId() != null) {
if (!obj.getId().equals(model.getId())) {
dataMap.put("err", "已存在同名类型网站");
dataMap.put("err", "已存在同名类型网站");
ret.setJsonModel(dataMap);
return ret;
}
} else {
dataMap.put("err", "已存在同名类型网站");
dataMap.put("err", "已存在同名类型网站");
ret.setJsonModel(dataMap);
return ret;
}
@@ -414,12 +414,12 @@ public class WebsiteController {
if (obj2 != null) {
if (model.getId() != null) {
if (!obj2.getId().equals(model.getId())) {
dataMap.put("err", "已存在该类型同域名网站");
dataMap.put("err", "已存在该类型同域名网站");
ret.setJsonModel(dataMap);
return ret;
}
} else {
dataMap.put("err", "已存在该类型同域名网站");
dataMap.put("err", "已存在该类型同域名网站");
ret.setJsonModel(dataMap);
return ret;
}
@@ -428,7 +428,7 @@ public class WebsiteController {
if (model.getId() != null) {
Website website = websiteDao.findById(model.getId());
if (website == null) {
dataMap.put("err", "对象不存在");
dataMap.put("err", "对象不存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -445,7 +445,7 @@ public class WebsiteController {
if (seedies.size() > 0) {
for (Seeds seed : seedies) {
if (model.getSeedCity().equals(seed.getCity()) || model.getSeedUrl().equals(seed.getUrl())) {
dataMap.put("err", "链接或城市已经存在");
dataMap.put("err", "链接或城市已经存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -480,7 +480,7 @@ public class WebsiteController {
} else {
Website website = websiteDao.findWebsite(model.getCategory(), model.getSiteName());
if (website != null) {
dataMap.put("err", "该网站已经存在");
dataMap.put("err", "该网站已经存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -511,7 +511,7 @@ public class WebsiteController {
if (seedies.size() > 0) {
for (Seeds seed : seedies) {
if (model.getSeedCity().equals(seed.getCity()) || model.getSeedUrl().equals(seed.getUrl())) {
dataMap.put("err", "链接或城市已经存在");
dataMap.put("err", "链接或城市已经存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -546,7 +546,7 @@ public class WebsiteController {
if (model.getId() != null) {
Website website = websiteDao.findById(model.getId());
if (website == null) {
dataMap.put("err", "对象不存在");
dataMap.put("err", "对象不存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -558,7 +558,7 @@ public class WebsiteController {
continue;
}
if (model.getSeedCity().equals(seed.getCity()) || model.getSeedUrl().equals(seed.getUrl())) {
dataMap.put("err", "链接或城市已经存在");
dataMap.put("err", "链接或城市已经存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -602,7 +602,7 @@ public class WebsiteController {
if (model.getId() != null) {
Website website = websiteDao.findById(model.getId());
if (website == null) {
dataMap.put("err", "对象不存在");
dataMap.put("err", "对象不存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -616,7 +616,7 @@ public class WebsiteController {
continue;
}
if (model.getSeedUrl().equals(seed.getUrl())) {
dataMap.put("err", "该网站已经存在此链接");
dataMap.put("err", "该网站已经存在此链接");
ret.setJsonModel(dataMap);
return ret;
}
@@ -691,7 +691,7 @@ public class WebsiteController {
JsonModel ret = new JsonModel();
if (model.getId() != null) {
DBObject udata = new BasicDBObject();
udata.put("status", 8); //删除
udata.put("status", 8); //删除
seedsDao.updateById(udata, model.getId());
}
return ret;
@@ -738,7 +738,7 @@ public class WebsiteController {
if (model.getId() != null) {
Website website = websiteDao.findById(model.getId());
if (website == null) {
dataMap.put("err", "对象不存在");
dataMap.put("err", "对象不存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -752,7 +752,7 @@ public class WebsiteController {
for (Map<String, Object> relatedJob : website.getRelatedJobs()) {
if (StringUtils.isNotBlank(model.getRelatedJobId())
&& model.getRelatedJobId().equals(relatedJob.get("job_id"))) {
dataMap.put("err", "任务ID已存在");
dataMap.put("err", "任务ID已存在");
ret.setJsonModel(dataMap);
return ret;
}
@@ -12,11 +12,11 @@ import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
/**
* 自定义A标签,控制权限用
* 自定义A标签,控制权限用
* @author yinjihuan
* 用法:<@d_a text="设置" href="/user/info" target="_blank" uri="/user" type="disabled" class="btn" style="color:red;" id="saveBtn"/><br>
* text:显示的文字 <br> href:链接地址 <br>target:打开方式 <br> uri:权限地址 <br>
* type:取值disabled为禁用操作,无权限点击弹出提示框,取值hidden为隐藏
* 用法:<@d_a text="设置" href="/user/info" target="_blank" uri="/user" type="disabled" class="btn" style="color:red;" id="saveBtn"/><br>
* text:显示的文字 <br> href:链接地址 <br>target:打开方式 <br> uri:权限地址 <br>
* type:取值disabled为禁用操作,无权限点击弹出提示框,取值hidden为隐藏
*/
public class AuthorityDirective implements TemplateDirectiveModel {
@@ -24,11 +24,11 @@ public class AuthorityDirective implements TemplateDirectiveModel {
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars,
TemplateDirectiveBody body) throws TemplateException, IOException {
//获取HttpSession
//获取HttpSession
ActionContext actionContext = ActionContext.getContext();
HttpSession session = actionContext.getRequest().getSession();
List<String> authoritys = (List<String>) session.getAttribute("authoritys");
String message = "无权限访问";
String message = "无权限访问";
String content = "";
if (authoritys != null) {
String uri = params.get("uri").toString();
@@ -66,7 +66,7 @@ public class AnalyticsFilter implements Filter {
"error process request: request_url=" + request.getRequestURL().toString() + ", referer="
+ request.getHeader("referer"), rootCause);
}
// 记录运行超过1秒的请求到日志中
// 记录运行超过1秒的请求到日志中
ThreadLocalData.getInstance().clear();
}
}
@@ -14,20 +14,20 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* 权限控制过滤器<br>
* 需要注意的是目前前台和后台读在一个项目里面<br>
* 控制的时候需要对前后台分别控制,目前后台所有的链接都以bkoff开头<br>
* 权限控制过滤器<br>
* 需要注意的是目前前台和后台读在一个项目里面<br>
* 控制的时候需要对前后台分别控制,目前后台所有的链接都以bkoff开头<br>
* @author yinjihuan
*
*/
public class SecurityFilter implements Filter {
//需要拦截的后台URI
//需要拦截的后台URI
private List<String> bkoffUris = Arrays.asList("bkoffrole", "bkoffUser", "bkoffIndex");
//白名单URI,不需要拦截的
//白名单URI,不需要拦截的
private List<String> whiteList = Arrays.asList("/static/", "/js/", "login", "/css/", "logout", "/style/", "/images/");
//需要进行登录拦截,但不需要权限拦截的
//需要进行登录拦截,但不需要权限拦截的
private List<String> noAuthorityList = Arrays.asList("/website/", "/analy/", "/verify/", "/modeAnaly/","/region/",
"/data/", "/dynamic/", "/foundDistrict/", "/districtAlias/", "/houseAnaly/", "/addressInfo/", "updatePass", "/fileReport/fileDetail", "addressScript", "fileReport/debugScript");
@@ -95,14 +95,14 @@ public class SecurityFilter implements Filter {
@SuppressWarnings("unchecked")
List<String> authoritys = (List<String>) session.getAttribute("authoritys");
String loginUrl = basePath + path + "/user/login";
//进行未登录拦截
//进行未登录拦截
if (session.getAttribute("login_user_name") == null || !session.getAttribute("login_user_type").toString().equals("web")) {
if (req.getHeader("x-requested-with") != null && "XMLHttpRequest".equalsIgnoreCase(req.getHeader("x-requested-with"))) {
resp.setHeader("sessionstatus","timeout");
resp.setStatus(401);
return ;
}
//有参数跳转时带上参数
//有参数跳转时带上参数
if (req.getQueryString() != null) {
resp.sendRedirect(loginUrl + "?backUrl="+req.getRequestURL() + "?" + req.getQueryString());
} else {
@@ -111,20 +111,20 @@ public class SecurityFilter implements Filter {
return ;
}
//需要进行权限控制
//需要进行权限控制
if (uri.endsWith("/")) {
uri = uri.substring(0, uri.length() - 1);
}
if (containsBkoff(uri) && authoritys != null && authoritys.contains("bkoffIndex")) {
chain.doFilter(request, response);
} else if (!uri.equals(path) && authoritys != null && !containsAuthority(uri, authoritys)) {
//ajax请求返回状态码,前端统一处理
//ajax请求返回状态码,前端统一处理
if (req.getHeader("x-requested-with") != null && "XMLHttpRequest".equalsIgnoreCase(req.getHeader("x-requested-with"))) {
resp.setHeader("sessionstatus", "authority");
resp.setStatus(403);
return ;
}
//普通请求直接跳转到首页面
//普通请求直接跳转到首页面
resp.sendRedirect(basePath + path + "/addressInfo/index");
} else {
chain.doFilter(request, response);
@@ -9,7 +9,7 @@ import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* 启动地址分析服务
* 启动地址分析服务
*/
public class ContextLoaderListener implements ServletContextListener {
@@ -21,7 +21,7 @@ public class ContextLoaderListener implements ServletContextListener {
if("pro".equals(System.getProperty("env","dev"))){
AddressAnalyzeService addressAnalyzeService = new AddressAnalyzeServiceImpl();
addressAnalyzeService.start();
logger.info("启动地址分析服务");
logger.info("启动地址分析服务");
}
}
@@ -4,22 +4,22 @@ import java.util.HashMap;
import java.util.Map;
/**
* 批量解析所需的model
* 批量解析所需的model
* Created by ideoj on 2016/4/22.
*/
public class AnalyListModel {
/**待解析url对应的id*/
/**待解析url对应的id*/
private String id;
/**待解析的实际url*/
/**待解析的实际url*/
private String url;
private String exception;
private String category;
/**解析结果map*/
/**解析结果map*/
private Map<String, Object> analyResultMap = new HashMap<String, Object>();
/**解析结果对应的字段描述map*/
/**解析结果对应的字段描述map*/
private Map<String, String> analyFieldMap = new HashMap<String, String>();
private Map<String, Exception> resultExceptionMap = new HashMap<String, Exception>();
@@ -97,7 +97,7 @@ public class AnalyModel extends BaseModel {
private String sortWay;
private List<RegionBlock> regionList;
/**解析模式:common:普通 list:列表**/
/**解析模式:common:普通 list:列表**/
private String anaMode;
private int anaType;
private String anaCat;
@@ -146,7 +146,7 @@ public class AnalyModel extends BaseModel {
private String houseNum;
/**列表模式解析结果*/
/**列表模式解析结果*/
private List<AnalyModel> modelList = new ArrayList<AnalyModel>();
public List<AnalyModel> getModelList() {
@@ -125,7 +125,7 @@ public class BaseModel extends ModelAndViewSupport {
ret = new LinkedHashMap<String, List<ServerArea>>();
for (ServerArea sa : serverAreas) {
if (sa.getDisplay().equals("全国")) {
if (sa.getDisplay().equals("全国")) {
continue;
}
String w = String.valueOf(sa.getSpell().charAt(0)).toUpperCase();
@@ -4,5 +4,5 @@ import java.util.Arrays;
import java.util.List;
public class ChatConfig {
public static final List<String> WEEKTITILE = Arrays.asList("-20%以下", "-20% - 10%", "-10% - 0", "0 - 10%", "10% - 20%", "20%以上");
public static final List<String> WEEKTITILE = Arrays.asList("-20%以下", "-20% - 10%", "-10% - 0", "0 - 10%", "10% - 20%", "20%以上");
}
@@ -22,8 +22,8 @@ public class DistrictModel extends BaseModel {
private String addr_alias;
private String description;
private Integer avg_price; // 元/㎡
private Integer total_price; // 万元/套
private Integer avg_price; // 元/㎡
private Integer total_price; // 万元/套
private String mobile;
private String developer;
private String estate_company;
@@ -88,16 +88,16 @@ public class DistrictModel extends BaseModel {
private String foundId;
private String property_status;
//居委会
//居委会
private String committee;
//房屋结构
//房屋结构
private String house_structure;
//土地使用权证号
//土地使用权证号
private String usage_card;
//楼栋数量
//楼栋数量
private String loudong_count;
@@ -37,8 +37,8 @@ public class DynamicModel extends BaseModel{
private String totalId;
private int sellTotal;//二手房源总量
private int rentTotal;//租房房源总量
private int sellTotal;//二手房源总量
private int rentTotal;//租房房源总量
private double sellRatio;
private double rentRatio;
private int sellSuccess;
@@ -43,40 +43,40 @@ public class FileReportModel extends BaseModel {
private Integer realPrice;
private Integer noMatchReason;
private FileDatasTotality fileDatasTotality;
//脚本选择列表
//脚本选择列表
private Map<String,String> scriptMap;
//周涨跌幅区间数据
//周涨跌幅区间数据
private Map<String, Long> weekMarkUpData;
//地址未匹配原因分布数据
//地址未匹配原因分布数据
private Map<String, Long> noMatchReasonData;
//均价与调查价差比分布
//均价与调查价差比分布
private Map<String, Long> avgAndRealPriceMarkUp;
//最终匹配率
//最终匹配率
private Integer overMatchRate;
//查询类型(1:周涨跌幅区间数据 2:均价与调查价差比分布 3:未匹配原因)
//查询类型(1:周涨跌幅区间数据 2:均价与调查价差比分布 3:未匹配原因)
private int queryType;
//查询标识(柱形图的柱子索引)
//查询标识(柱形图的柱子索引)
private int queryIndex;
//没匹配到原因文字描述
//没匹配到原因文字描述
private String noMatchReasonText;
//柱形图标题
//柱形图标题
private List<String> chatTitle;
private String type;//检索
private String rating;//评级
private String show;//需要展示的字段
private String type;//检索
private String rating;//评级
private String show;//需要展示的字段
private Map<String, Integer> ratingGroup;
private Map<String, Integer> typeGroup;
private String matchAddress;//匹配的地址
private String matchDistrictName;//匹配的小区名
private String matchHouseNum;//匹配的楼号
private String matchUnitNum;//匹配的单元号
private String matchRoomNum;//匹配的室号
private String otherReason;//其他原因
private String modifier;//操作人
private String matchAddress;//匹配的地址
private String matchDistrictName;//匹配的小区名
private String matchHouseNum;//匹配的楼号
private String matchUnitNum;//匹配的单元号
private String matchRoomNum;//匹配的室号
private String otherReason;//其他原因
private String modifier;//操作人
private String scriptId;//脚本的ID
private String scriptId;//脚本的ID
public String getModifier() {
@@ -8,28 +8,28 @@ import java.io.Serializable;
public class RankingModel implements Serializable {
private static final long serialVersionUID = 1463707036567549789L;
/**
* 负责人
* 负责人
*/
private String dutyName;
/**
* 得分最高的城市
* 得分最高的城市
*/
private String topScoreCity;
private Double topScore;
/**
* 得分最高的城市对应的负责人得分
* 得分最高的城市对应的负责人得分
*/
private Double topPersonScore;
/**
* 得分最低的城市
* 得分最低的城市
*/
private String lowestScoreCity;
private Double lowestScore;
/**
* 得分最低的城市对应的负责人得分
* 得分最低的城市对应的负责人得分
*/
private Double lowestPersonScore;
@@ -2,37 +2,37 @@ package com.fangjia.bkoff.model;
import java.io.Serializable;
/**涨幅
/**涨幅
* Created by linxsh on 2017/2/14.
*/
public class RiseRateModel implements Serializable {
private static final long serialVersionUID = -1805556458198414417L;
/**
* 城市
* 城市
*/
private String city;
/**
* 城市等级
* 城市等级
*/
private Integer cityLevel;
/**
* 城市得分
* 城市得分
*/
private Double cityScore;
/**
* 城市得分涨幅
* 城市得分涨幅
*/
private Double cityScoreUpRate;
/**
* 责任人
* 责任人
*/
private String dutyName;
/**
* 责任人得分
* 责任人得分
*/
private Double dutyPersonScore;
/**
* 责任人得分涨幅
* 责任人得分涨幅
*/
private Double dutyPersonScoreUpRate;
@@ -10,12 +10,12 @@ public class RoleModel extends BaseModel {
private static final long serialVersionUID = -5724990326450013316L;
/**
* 分页数据对象
* 分页数据对象
*/
private PageBean<Role> pageBean;
/**
* 权限信息
* 权限信息
*/
private List<AuthorityGroupInfo> groupInfos;
@@ -15,42 +15,42 @@ public class TestReportModel extends BaseModel implements Serializable {
private static final long serialVersionUID = -5231521087417248919L;
/**
* 日期范围-start
* 日期范围-start
*/
private Date start;
/**
* 日期范围-end
* 日期范围-end
*/
private Date end;
/**
* 测试次数
* 测试次数
*/
private Integer times;
/**
* 测试数据量
* 测试数据量
*/
private Integer count;
/**
* 测试城市个数
* 测试城市个数
*/
private Integer citiesCount;
/**
* 最终匹配率
* 最终匹配率
*/
private String matchRatio;
/**
* 均价匹配率
* 均价匹配率
*/
private String pricePrecision;
/**
* 未匹配原因
* 未匹配原因
*/
private Integer reason;
private String otherReason;
@@ -59,7 +59,7 @@ public class TestReportModel extends BaseModel implements Serializable {
private String reasonDesc;
/**
* 未匹配原因占比
* 未匹配原因占比
*/
private String reasonRatio;
@@ -76,7 +76,7 @@ public class TestReportModel extends BaseModel implements Serializable {
private String userName;
private String dutyName;
//城市得分列表
//城市得分列表
private List<DistrictStatistics> districtStatisticses = new ArrayList<DistrictStatistics>();
//
private List<RankingModel> personRankings = new ArrayList<RankingModel>();
@@ -12,27 +12,27 @@ public class UserModel extends BaseModel {
private static final long serialVersionUID = 4899071723202633378L;
/**
* 分页数据对象
* 分页数据对象
*/
private PageBean<UserInfo> pageBean;
/**
* 公司
* 公司
*/
private String company;
/**
* 手机
* 手机
*/
private String mobile;
/**
* 企业编号
* 企业编号
*/
private String enterpriseId;
/**
* 角色信息
* 角色信息
*/
private List<Role> roles;
@@ -21,7 +21,7 @@ public class VerifyModel extends BaseModel {
private Integer sequence;
List<VerifyRule> rules;
// 可编辑表格插件的ajax参数
// 可编辑表格插件的ajax参数
private String name;
private String pk;
private String value;
@@ -3,7 +3,7 @@ package com.fangjia.bkoff.service;
import java.util.List;
/**
* 网页解析接口
* 网页解析接口
*
* @author xiaoyu
*/
@@ -1,7 +1,7 @@
package com.fangjia.bkoff.service.address;
/**
* 地址分析服务
* 地址分析服务
*/
public interface AddressAnalyzeService {
@@ -35,7 +35,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* 地址分析服务
* 地址分析服务
*/
public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
@@ -68,7 +68,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
try{
process(fileDatasTotality);
}catch (Exception e){
logger.error(fileDatasTotality.getId() + ":分析出现异常");
logger.error(fileDatasTotality.getId() + ":分析出现异常");
}
}
sleep(5 *1000);
@@ -88,7 +88,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
fileDatasTotality.setStatus(1);
fileDatasTotality.setModificationDate(new Date());
fileDatasTotalityDao.save(fileDatasTotality);
logger.info("开始分析:" + fileDatasTotality.getFileName());
logger.info("开始分析:" + fileDatasTotality.getFileName());
List<FileDetailData> fileDetailDataList = fileDetailDataDao.findAll(new BasicDBObject("file_id", fileDatasTotality.getId()));
ExecutorService executorService = Executors.newFixedThreadPool(10);
for(FileDetailData detailData : fileDetailDataList){
@@ -103,7 +103,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
fileDatasTotality.setStatus(2);
fileDatasTotality.setModificationDate(new Date());
fileDatasTotalityDao.save(fileDatasTotality);
logger.info("分析结束:" + fileDatasTotality.getFileName());
logger.info("分析结束:" + fileDatasTotality.getFileName());
}
@@ -120,7 +120,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
String region = fileDetailData.getRegion();
String districtName = fileDetailData.getDistrictName();
String address = fileDetailData.getAddress();
logger.info("开始分析:"+city +" - "+region+" - " + districtName +" - "+address);
logger.info("开始分析:"+city +" - "+region+" - " + districtName +" - "+address);
JSONObject result = null;
JSONObject addressMatch = null;
@@ -173,7 +173,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
if(searchAddress.containsKey("street")){
fileDetailData.setParseStreet((String) searchAddress.get("street"));
}
logger.info("匹配结果:"+fileDetailData.getMatchCity() +" - "+fileDetailData.getMatchRegion()+" - "+fileDetailData.getMatchDistrictName());
logger.info("匹配结果:"+fileDetailData.getMatchCity() +" - "+fileDetailData.getMatchRegion()+" - "+fileDetailData.getMatchDistrictName());
}
String id = matchResult.getString("id");
Seaweed seaweed = null;
@@ -236,7 +236,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
params.put("size", String.valueOf(fileDetailData.getArea()));
params.put("scope", "1");
params.put("token", TOKEN);
if("别墅".equals(fileDetailData.getEstateType())){
if("别墅".equals(fileDetailData.getEstateType())){
params.put("propertyType", "1");
}else{
params.put("propertyType", "0");
@@ -247,13 +247,13 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
}
}
logger.info("开始查询第三方价格.....");
logger.info("开始查询第三方价格.....");
if(StringUtils.isNotBlank(fileDetailData.getMatchCity()) && StringUtils.isNotBlank(fileDetailData.getMatchDistrictName())){
Date startDate = DateUtil.parseDate(DateUtil.addMonth(new Date(), -6), "yyyy-MM-dd");
//第三方价格
//第三方价格
List<Map<String, Object>> otherPriceRets = averageStatisticsDao.findThirdpartsAveragersByDate(fileDetailData.getMatchCity(), fileDetailData.getMatchRegion(), fileDetailData.getMatchDistrictName(), "district", startDate);
//房估估均价 云估价均价 链家均价 安居客均价 赶集网均价 搜房网均价 兔博士均价
//房估估均价 云估价均价 链家均价 安居客均价 赶集网均价 搜房网均价 兔博士均价
NetworkPrice networkPrice = networkPriceDao.findYungujiaAndPrice(fileDetailData.getMatchCity(), fileDetailData.getMatchRegion(), fileDetailData.getMatchDistrictName());
if(networkPrice!=null){
if(null != networkPrice.getFangguguPrice()){
@@ -264,7 +264,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
}
}
if(otherPriceRets!=null){
logger.info("第三方价格结果:"+otherPriceRets.toString());
logger.info("第三方价格结果:"+otherPriceRets.toString());
for(Map<String, Object> map : otherPriceRets){
if(map.get("name").equals("soufun_esf")){
fileDetailData.setSoufangPrice((Integer) map.get("val"));
@@ -279,7 +279,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
}
}
//评级
//评级
if(null != fileDetailData.getDistrictAvgPrice()){
Map levelMap = getPriceLevel(fileDetailData);
if(null != levelMap){
@@ -289,7 +289,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
getLastPrice(levelMap, fileDetailData);
}
logger.info("价格评级:"+fileDetailData.getPriceLevel());
logger.info("价格评级:"+fileDetailData.getPriceLevel());
}
}
@@ -498,12 +498,12 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
/**
*
* @param city 城市
* @param input 地址
* @param cat 类型:property,office,shop 默认三中都匹配
* @param useMap 是否匹配地图库
* @param suggestDistrict 小区所在的区域
* @param preciseLevel 匹配精度:fuzzy低精度,strict高精度
* @param city 城市
* @param input 地址
* @param cat 类型:property,office,shop 默认三中都匹配
* @param useMap 是否匹配地图库
* @param suggestDistrict 小区所在的区域
* @param preciseLevel 匹配精度:fuzzy低精度,strict高精度
* @return
*/
private JSONObject districtNameMatch(String city, String input, String cat, Boolean useMap, String suggestDistrict, String preciseLevel, boolean verify) {
@@ -530,7 +530,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
String content = new HttpRequest().get("http://open.fangjia.com/address/match", params, "utf-8");
while (content == null) {
content = new HttpRequest().get("http://open.fangjia.com/address/match", params, "utf-8");
System.out.println(city+" "+input+" "+cat+" 程序调用异常");
System.out.println(city+" "+input+" "+cat+" 程序调用异常");
Thread.sleep(6000);
}
JSONObject result = JSONObject.fromObject(content);
@@ -564,7 +564,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
List<List<Integer>> values = new ArrayList<List<Integer>>();
int fjw_price = avgPrice;
//找出最小差
//找出最小差
for(int i=0;i<prices.size()-1;i++){
int a = prices.get(i);
for(int j=i+1;j<prices.size();j++){
@@ -576,7 +576,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
}
}
//根据最小差找出结果
//根据最小差找出结果
for(int i=0;i<prices.size()-1;i++){
int a = prices.get(i);
for(int j=i+1;j<prices.size();j++){
@@ -611,7 +611,7 @@ public class AddressAnalyzeServiceImpl implements AddressAnalyzeService {
}catch (Exception e){
fileDetailData.setStatus(FileDetailData.AnalyStatus.FAILURE.getCode());
fileDetailDataDao.save(fileDetailData);
logger.error(fileDetailData.getFileId() + "分析失败,地址:" + fileDetailData.getAddress(), e);
logger.error(fileDetailData.getFileId() + "分析失败,地址:" + fileDetailData.getAddress(), e);
}
}
@@ -8,42 +8,42 @@ import com.fangjia.coredata.mongo.model.FileDetailData;
import com.mongodb.BasicDBObject;
/**
* 地址处理脚本业务
* 地址处理脚本业务
* @author yinjihuan
*
*/
public interface AddressScriptService {
/**
* 对数据进行脚本处理
* @param scriptId 脚本ID
* @param data 数据对象
* @return 返回null表示执行失败
* 对数据进行脚本处理
* @param scriptId 脚本ID
* @param data 数据对象
* @return 返回null表示执行失败
*/
public FileDetailData execScript(String scriptId, FileDetailData data) throws Exception;
/**
* 获取脚本内容(根据id)
* 获取脚本内容(根据id)
* @param scriptId
* @return
*/
public AddressScript getScriptContent(String scriptId);
/**
* 保存脚本
* 保存脚本
* @param addressScript
*/
public void saveScript(AddressScript addressScript);
/**
* 修改脚本
* 修改脚本
* @param addressScript
*/
public void updateScript(String id, Map<String, Object> udata);
/**
* 查询所有脚本
* 查询所有脚本
* @param fileId
* @param name
* @return
@@ -51,7 +51,7 @@ public interface AddressScriptService {
public List<AddressScript> findAll();
/**
* 根据脚本名称查询是否存在
* 根据脚本名称查询是否存在
* @param name
* @return
*/
@@ -28,12 +28,12 @@ public class AddressScriptServiceImpl implements AddressScriptService {
script = addressScript.getScript();
}
if (StringUtils.isBlank(script)) {
throw new Exception("未找到脚本");
throw new Exception("未找到脚本");
// return null;
}
if (!InvokeShell.precompiler(script)) {
throw new Exception("脚本语法错误");
throw new Exception("脚本语法错误");
// return null;
}
@@ -43,8 +43,8 @@ public class AddressScriptServiceImpl implements AddressScriptService {
FileDetailData detail = BeanUtils.dBObjectToEntity(FileDetailData.class, result);
return detail;
} catch (Exception e) {
logger.error("执行脚本异常", e);
throw new Exception("执行脚本异常");
logger.error("执行脚本异常", e);
throw new Exception("执行脚本异常");
}
// return null;
}
@@ -5,14 +5,14 @@ import java.util.List;
import com.fangjia.address.model.AuthorityGroup;
/**
* 权限组业务
* 权限组业务
* @author yinjihuan
*
*/
public interface AuthorityGroupService {
/**
* 查询所有权限组信息
* 查询所有权限组信息
* @return
* @throws Exception
*/
@@ -4,14 +4,14 @@ import java.util.List;
import com.fangjia.address.model.Authority;
/**
* 权限业务
* 权限业务
* @author yinjihuan
*
*/
public interface AuthorityService {
/**
* 批量查询权限信息
* 批量查询权限信息
* @param ids
* @return
* @throws Exception
@@ -19,7 +19,7 @@ public interface AuthorityService {
public List<Authority> queryAuthoritys(List<String> ids) throws Exception;
/**
* 查询用户的权限
* 查询用户的权限
* @param userId
* @return
* @throws Exception
@@ -11,20 +11,20 @@ import org.sothis.core.util.Pager;
/**
* 小区相关统计
* 小区相关统计
* @author user
*
*/
public interface DistrictStatisticsService {
/**
* 查询是某周的数据
* 查询是某周的数据
* @param date
* @return
*/
public DistrictStatistics getDisStaByTime(int date,String city);
/**
* 获取六个星期的数据
* 获取六个星期的数据
*/
public List<DistrictStatistics> findDisStasByTime(int date,String city);
@@ -33,7 +33,7 @@ public interface DistrictStatisticsService {
public List<DistrictStatistics> findByTime(Date startDate, Date endDate);
/**
* 获取某周所有的城市信息
* 获取某周所有的城市信息
* @param date
* @param city
* @return
@@ -44,7 +44,7 @@ public interface DistrictStatisticsService {
List<RankingModel> personRankingList(Date startDate, Date endDate, Pager pager);
/**
* 根据查询条件查询涨幅前 topNumber 的数据
* 根据查询条件查询涨幅前 topNumber 的数据
* @param startDate
* @param endDate
* @param topNumber
@@ -52,7 +52,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
BasicDBObject query = new BasicDBObject();
query.append("date", new BasicDBObject("$gte", intStartDate).append("$lte", intEndDate));
query.append("city", new BasicDBObject("$ne", "全国"));
query.append("city", new BasicDBObject("$ne", "全国"));
pager.setTotalRows((int)districtStatisticsDao.findCount(query));
return districtStatisticsDao.findAll(query, new BasicDBObject("date", -1), pager.getStartRow(), pager.getPageSize());
}
@@ -65,7 +65,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
BasicDBObject query = new BasicDBObject();
query.append("date", new BasicDBObject("$gte", intStartDate).append("$lte", intEndDate));
query.append("city", new BasicDBObject("$ne", "全国"));
query.append("city", new BasicDBObject("$ne", "全国"));
return districtStatisticsDao.findAll(query);
}
@@ -83,7 +83,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
int intStartDate = NumberUtils.toInt(sdf.format(startDate));
int intEndDate = NumberUtils.toInt(sdf.format(endDate));
//获取所有的负责人
//获取所有的负责人
List<User> users = userDao.findAll();
Iterator<User> userIt = users.iterator();
while (userIt.hasNext()) {
@@ -94,7 +94,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
}
pager.setTotalRows(users.size());
//按负责人进行统计
//按负责人进行统计
List<RankingModel> rankingModels = Lists.newArrayList();
for(int i = pager.getStartRow(); i < users.size() && i < pager.getPageSize(); ++i) {
BasicDBObject query = new BasicDBObject();
@@ -157,7 +157,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
}
});
//删除多余数据
//删除多余数据
if(cityScoreUpList.size() > topNumber) {
return new ArrayList<RiseRateModel>(cityScoreUpList.subList(0, topNumber));
}
@@ -170,7 +170,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
int intStartDate = NumberUtils.toInt(sdf.format(startDate));
int intEndDate = NumberUtils.toInt(sdf.format(endDate));
//获取所有的负责人
//获取所有的负责人
List<User> users = userDao.findAll();
Iterator<User> userIt = users.iterator();
while (userIt.hasNext()) {
@@ -210,7 +210,7 @@ public class DistrictStatisticsServiceImpl implements DistrictStatisticsService
}
});
//删除多余数据
//删除多余数据
if(personScoreUpList.size() > topNumber) {
return new ArrayList<RiseRateModel>(personScoreUpList.subList(0, topNumber));
}
@@ -15,7 +15,7 @@ import java.util.Map;
public interface FileDatasTotalityService {
/**
* 按条件查询所有文件
* 按条件查询所有文件
*
* @param category
* @param startDate
@@ -27,7 +27,7 @@ public interface FileDatasTotalityService {
List<FileDatasTotality> findAll(Integer category, Date startDate, Date endDate, Integer status);
/**
* 按条件查询文件
* 按条件查询文件
*
* @param city
* @param category
@@ -39,7 +39,7 @@ public interface FileDatasTotalityService {
List<FileDatasTotality> findFileDatasTotality(String city, Integer category, Date startDate, Date endDate, int limit);
/**
* 按条件分页查询文件
* 按条件分页查询文件
*
* @param city
* @param category
@@ -52,7 +52,7 @@ public interface FileDatasTotalityService {
List<FileDatasTotality> findFileDatasTotality(String city, Integer category, Date startDate, Date endDate, int skip, int size);
/**
* 查询一个文件的所有记录
* 查询一个文件的所有记录
*
* @param fileId
* @return
@@ -60,7 +60,7 @@ public interface FileDatasTotalityService {
List<FileDetailData> findFileDetailDataByFileId(String fileId);
/**
* 分页查询一个文件的记录
* 分页查询一个文件的记录
*
* @param fileId
* @param skip
@@ -70,7 +70,7 @@ public interface FileDatasTotalityService {
List<FileDetailData> findFileDetailDataByFileId(String fileId, int skip, int size);
/**
* 按条件详细记录
* 按条件详细记录
*
* @param city
* @param category
@@ -84,7 +84,7 @@ public interface FileDatasTotalityService {
/**
* 查询未匹配的记录
* 查询未匹配的记录
* @param city
* @param category
* @param startDate
@@ -96,7 +96,7 @@ public interface FileDatasTotalityService {
List<FileDetailData> findNoMatchFileDetailData(String city, Integer category, Date startDate, Date endDate, int skip, int size);
/**
* 查询未匹配的记录
* 查询未匹配的记录
* @param cityName
* @param dutyName
* @param category
@@ -112,7 +112,7 @@ public interface FileDatasTotalityService {
/**
* 按条件详细记录数量
* 按条件详细记录数量
*
* @param city
* @param category
@@ -124,7 +124,7 @@ public interface FileDatasTotalityService {
/**
* 未匹配的记录数量
* 未匹配的记录数量
*
* @param city
* @param category
@@ -137,19 +137,19 @@ public interface FileDatasTotalityService {
int findNoMatchFileDetailDataCount(String city, String dutyName, Integer category, Date startDate, Date endDate);
/**
* 保存文件记录
* 保存文件记录
* @param fileDatasTotality
*/
void saveToData(FileDatasTotality fileDatasTotality);
/**
* 删除总表数据
* 删除总表数据
* @param id
*/
void deleteFileDatasTotality(String id);
/**
* 按条件查找文件记录获取总数
* 按条件查找文件记录获取总数
* @param category
* @param startDate
* @param endDate
@@ -160,7 +160,7 @@ public interface FileDatasTotalityService {
int findCountByParams(Integer category, Date startDate, Date endDate, Integer status, String fileName, String oldFileName);
/**
* 按条件查找文件记录
* 按条件查找文件记录
* @param category
* @param startDate
* @param endDate
@@ -173,20 +173,20 @@ public interface FileDatasTotalityService {
List<FileDatasTotality> findFileDatasTotalityByParams(Integer category, Date startDate, Date endDate, Integer status, String fileName, String oldFileName, int start, int limit);
/**
* 保存文件记录详情
* 保存文件记录详情
* @param fileDetailDatas
*/
void saveFileDetailDatas(List<FileDetailData> fileDetailDatas);
/**
* 查找某上传文件的总记录
* 查找某上传文件的总记录
* @param fileId
* @return
*/
FileDatasTotality findFileDatasTotalityById(String fileId);
/**
* 修改
* 修改
* @param model
*/
void updateFileDetailData(FileReportModel model);
@@ -194,14 +194,14 @@ public interface FileDatasTotalityService {
/**
* 查询未匹配原因的数量
* 查询未匹配原因的数量
* @param fileId
* @return
*/
long findNoMatchCount(String fileId, Integer type);
/**
* 根据ID更新数据
* 根据ID更新数据
*
* @param id
* @param udata
@@ -209,31 +209,31 @@ public interface FileDatasTotalityService {
void updateFileDetailData(String id, Map<String, Object> udata);
/**
* 保存
* 保存
* @param fileDetailData
*/
void saveFileDetailData(FileDetailData fileDetailData);
/**
* 获取最终匹配率
* 获取最终匹配率
* @return
*/
Integer getOverMatchRate(String fileId);
/**
* 获取最终匹配率修改后
* 获取最终匹配率修改后
* @return
*/
Integer getOverMatchRateLast(String fileId,Integer mount);
/**
* 获取匹配率
* 获取匹配率
* @return
*/
Integer getMatchRato(Integer count, Integer total);
/**
* 获取匹配成功或失败的数量
* 获取匹配成功或失败的数量
* @param fileId
* @param status
* @return
@@ -242,7 +242,7 @@ public interface FileDatasTotalityService {
/**
* 获取调查价与均价的差比范围数量
* 获取调查价与均价的差比范围数量
* @param fileId
* @return
*/
@@ -250,20 +250,20 @@ public interface FileDatasTotalityService {
/**
* 获取调查价格的数量
* 获取调查价格的数量
* @param fileId
* @return
*/
int getCheckAvgPriceCount(String fileId);
/**
* 周涨跌幅区间数据
* 周涨跌幅区间数据
* @param fileId
* @return
*/
Map<String, Long> getWeekMarkUpData(String fileId);
/**
* 根据未匹配原因查询未匹配到的数据
* 根据未匹配原因查询未匹配到的数据
* @param fileId
* @param noMatchReason
* @param start
@@ -273,20 +273,20 @@ public interface FileDatasTotalityService {
List<FileDetailData> findNoMatchFileDataDetails(String fileId, Integer noMatchReason, int start, int limit);
/**
* 删除数据
* 删除数据
* @param id
*/
void deleteFileDetailData(String id);
/**
* 删除数据
* 删除数据
* @param id
*/
void deleteFileDetailDataByFileId(String fileId);
/**
* 根据条件查找详情数据
* 根据条件查找详情数据
* @param city
* @param region
* @param address
@@ -297,7 +297,7 @@ public interface FileDatasTotalityService {
/**
*
* 查询周涨跌幅
* 查询周涨跌幅
* @param fileId
* @param index
* @param start
@@ -307,7 +307,7 @@ public interface FileDatasTotalityService {
PageBean<FileDetailData> findWeekMarkUpFileDataDetails(String fileId, Integer index, int start, int limit);
/**
* 均价与调查价差比分布
* 均价与调查价差比分布
* @param fileId
* @return
*/
@@ -315,7 +315,7 @@ public interface FileDatasTotalityService {
/**
*
* 查询均价与调查价差比分布
* 查询均价与调查价差比分布
* @param fileId
* @param index
* @param start
@@ -325,14 +325,14 @@ public interface FileDatasTotalityService {
PageBean<FileDetailData> finAvgAndRealPriceDataDetails(String fileId, Integer index, int start, int limit);
/**
* 查询详情
* 查询详情
* @param id
* @return
*/
FileDetailData getFileDetailData(String id);
/**
* 根据文件名查找文件数据
* 根据文件名查找文件数据
* @param fileName
* @return
*/
@@ -4,28 +4,28 @@ import java.util.List;
import com.fangjia.coredata.mongo.model.FileDetailData;
/**
* 地址分析结果业务类
* 地址分析结果业务类
* @author yinjihuan
*
*/
public interface FileDetailDataService {
/**
* 主键ID查询
* 主键ID查询
* @param id
* @return
*/
public FileDetailData get(String id);
/**
* 查询文件下面所有的数据
* @param fileId 文件ID
* 查询文件下面所有的数据
* @param fileId 文件ID
* @return
*/
public List<FileDetailData> find(String fileId);
/**
* 修改数据
* 修改数据
* @param data
*/
public void udpate(FileDetailData data);
@@ -6,51 +6,51 @@ import com.fangjia.address.model.Role;
import com.fangjia.core.util.PageBean;
/**
* 角色业务接口
* 角色业务接口
* @author yinjihuan
*
*/
public interface RoleService {
/**
* 获取角色信息
* @param id 角色ID
* 获取角色信息
* @param id 角色ID
* @return
* @throws Exception
*/
public Role getRole(String id) throws Exception;
/**
* 批量获取角色信息
* @param ids 角色ID集合
* 批量获取角色信息
* @param ids 角色ID集合
* @return
* @throws Exception
*/
public List<Role> getRoleByIn(List<String> ids) throws Exception;
/**
* 查询所有角色信息
* 查询所有角色信息
* @return
* @throws Exception
*/
public List<Role> queryAllRole() throws Exception;
/**
* 分页查询角色信息
* 分页查询角色信息
* @return
* @throws Exception
*/
public PageBean<Role> queryRolesByPage(int page, int limit) throws Exception;
/**
* 保存角色
* 保存角色
* @param role
* @throws Exception
*/
public void saveRole(Role role) throws Exception;
/**
* 修改角色
* 修改角色
* @param role
* @throws Exception
*/
@@ -8,44 +8,44 @@ import com.fangjia.core.util.PageBean;
import com.fangjia.mongo.model.ServerArea;
/**
* 用户业务接口
* 用户业务接口
* @author yinjihuan
*
*/
public interface UserService {
/**
* 分页查询用户信息
* @param page 当前查询页数
* @param limit 页数限制大小
* 分页查询用户信息
* @param page 当前查询页数
* @param limit 页数限制大小
* @return
* @throws Exception
*/
public PageBean<User> queryUsersByPage(int page, int limit) throws Exception;
/**
* 删除用户
* 删除用户
* @param id
* @throws Exception
*/
public void removeUser(String id) throws Exception;
/**
* 保存用户
* 保存用户
* @param user
* @throws Exception
*/
public void saveUser(User user) throws Exception;
/**
* 修改用户
* 修改用户
* @param user
* @throws Exception
*/
public void updateUser(User user) throws Exception;
/**
* 查询用户
* 查询用户
* @param id
* @return
* @throws Exception
@@ -53,16 +53,16 @@ public interface UserService {
public User getUser(String id) throws Exception;
/**
* 登录
* @param username 用户名
* @param pass 密码
* 登录
* @param username 用户名
* @param pass 密码
* @return
* @throws Exception
*/
public User login(String username, String pass) throws Exception;
/**
* 根据用户名查询用户
* 根据用户名查询用户
* @param mobile
* @return
* @throws Exception
@@ -70,7 +70,7 @@ public interface UserService {
public User getUserByUsername(String username) throws Exception;
/**
* 随机生成验证码
* 随机生成验证码
* @author yinjihuan
* @return
* @throws Exception
@@ -78,29 +78,29 @@ public interface UserService {
public String randomCode();
/**
* 获取拼音城市列表
* 获取拼音城市列表
* @return
* @throws Exception
*/
public Map<String, List<ServerArea>> getPinYinGroupedCityMap() throws Exception;
/**
* 检查城市是否被使用中
* 检查城市是否被使用中
* @param citys
* @return 无人使用返回null,有则返回提示信息
* @return 无人使用返回null,有则返回提示信息
* @throws Exception
*/
public String checkCityUse(List<String> citys, String id) throws Exception;
/**
* 添加城市之前移除别人中的这些城市
* 添加城市之前移除别人中的这些城市
* @param citys
* @throws Exception
*/
public void pullCity(List<String> citys) throws Exception;
/**
* 修改密码
* 修改密码
* @param useId
* @param newPass
* @throws Exception
@@ -108,7 +108,7 @@ public interface UserService {
public void updatePass(String useId, String newPass) throws Exception;
/**
* 根据城市获取责任人名字
* 根据城市获取责任人名字
* @throws Exception
*/
public String getUserName(String city) throws Exception;
@@ -96,12 +96,12 @@ public class UserServiceImpl implements UserService {
User user = userDao.findOne(new BasicDBObject("citys", city));
if (user != null && !user.getId().equals(id)) {
content.append(city);
content.append("目前是:");
content.append("目前是:");
content.append(user.getUsername());
content.append("在负责。");
content.append("在负责。");
}
}
return content.length() > 0 ? content.append("确定变更这些城市负责人?").toString() : null;
return content.length() > 0 ? content.append("确定变更这些城市负责人?").toString() : null;
}
@Override
@@ -17,8 +17,8 @@ import com.fangjia.mongo.dao.RegionBlockDao;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "安居客")
@PAGENAME(value = "详情页")
@SITENAME(value = "安居客")
@PAGENAME(value = "详情页")
public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -43,35 +43,35 @@ public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
String address = JQueryUtil
.selectText(
new String[] { "#around_search_apf_id_18 table tbody tr:contains(地址)", "#comm-basic li:contains(小区地址)" },
content).replace("小区地址:", "").replace("地址:", "").trim();
new String[] { "#around_search_apf_id_18 table tbody tr:contains(地址)", "#comm-basic li:contains(小区地址)" },
content).replace("小区地址:", "").replace("地址:", "").trim();
String estateType = JQueryUtil
.selectText(new String[] { ".chamber-infolist li:contains(物业类型)", "#comm-basic li:contains(物业类型)" }, content)
.replace("物业类型:", "").trim();
.selectText(new String[] { ".chamber-infolist li:contains(物业类型)", "#comm-basic li:contains(物业类型)" }, content)
.replace("物业类型:", "").trim();
String finishBuildingDate = JQueryUtil
.selectText(new String[] { ".chamber-infolist li:contains(竣工时间)", "#comm-basic li:contains(竣工时间)" }, content)
.replace("竣工时间:", "").trim();
.selectText(new String[] { ".chamber-infolist li:contains(竣工时间)", "#comm-basic li:contains(竣工时间)" }, content)
.replace("竣工时间:", "").trim();
String developer = trimChar(
JQueryUtil.selectText(new String[] { ".chamber-infolist>li:contains(开)", "#comm-basic li:contains(开)" }, content))
.replace("开 发 商:", "").trim();
JQueryUtil.selectText(new String[] { ".chamber-infolist>li:contains(开)", "#comm-basic li:contains(开)" }, content))
.replace("开 发 商:", "").trim();
String estateCharge = trimChar(
JQueryUtil.selectText(new String[] { ".chamber-infolist>li:contains(费)", "#comm-basic li:contains(费)" }, content))
.replace("物 业 费:", "").trim();
JQueryUtil.selectText(new String[] { ".chamber-infolist>li:contains(费)", "#comm-basic li:contains(费)" }, content))
.replace("物 业 费:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(总户数)" }, content)
.replace("总户数:", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(停车位)" }, content).replace("停车位:", "")
String estateCompany = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(总户数)" }, content)
.replace("总户数:", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(停车位)" }, content).replace("停车位:", "")
.trim();
String cubagePercent = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(容积率)" }, content)
.replace("容积率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(绿化率)" }, content)
.replace("绿化率:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(总建筑面积)" }, content)
.replace("总建筑面积:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(容积率)" }, content)
.replace("容积率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(绿化率)" }, content)
.replace("绿化率:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] { ".brief-list>li:contains(总建筑面积)" }, content)
.replace("总建筑面积:", "").trim();
if (buildArea.equals("平方米")) {
if (buildArea.equals("平方米")) {
buildArea = "";
}
if (virescencePercent.equals("%")) {
@@ -86,7 +86,7 @@ public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -114,22 +114,22 @@ public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
otherInfo.put("household_count", householdCount);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -152,7 +152,7 @@ public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -167,7 +167,7 @@ public class AnjukeDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -20,8 +20,8 @@ import com.fangjia.mongo.dao.RegionBlockDao;
import com.mongodb.BasicDBObject;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "带看网")
@PAGENAME(value = "详情页")
@SITENAME(value = "带看网")
@PAGENAME(value = "详情页")
public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -31,7 +31,7 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
String region = "";
String block = "";
String regionBlock = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(区域商圈)" }, content).replace("区域商圈:", "");
String regionBlock = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(区域商圈)" }, content).replace("区域商圈:", "");
Map<String, String> regionBlockMap = getRegionBlocInfo(regionBlock);
if (regionBlockMap.size() > 0) {
region = regionBlockMap.get("region");
@@ -39,29 +39,29 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
}
String name = JQueryUtil.selectText(new String[] { ".lp_xq_tit" }, content);
String address = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(物业地址)" }, content).replace("物业地址:", "");
String estateType = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业类型)" }, content).replace("物业类型:", "")
.replace("物业类型:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(总住户数)" }, content)
.replace("总住户数:", "").replace("总住户数:", "").trim();
String buildDate = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(新建时间)" }, content).replace("新建时间:", "")
String address = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(物业地址)" }, content).replace("物业地址:", "");
String estateType = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业类型)" }, content).replace("物业类型:", "")
.replace("物业类型:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(总住户数)" }, content)
.replace("总住户数:", "").replace("总住户数:", "").trim();
String buildDate = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(新建时间)" }, content).replace("新建时间:", "")
.trim();
String cubagePercent = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(容积率)" }, content).replace("容积率:", "")
.replace("容积率:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业费用)" }, content).replace("物业费用:", "")
String cubagePercent = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(容积率)" }, content).replace("容积率:", "")
.replace("容积率:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业费用)" }, content).replace("物业费用:", "")
.trim();
String virescencePercent = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(绿化率)" }, content)
.replace("绿化率:", "").replace("绿化率", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(车位配置)" }, content).replace("车位配置:", "")
String virescencePercent = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(绿化率)" }, content)
.replace("绿化率:", "").replace("绿化率", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(车位配置)" }, content).replace("车位配置:", "")
.trim();
String estateCompany = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业公司)" }, content).replace("物业公司:", "")
String estateCompany = JQueryUtil.selectText(new String[] { ".lp_x_xq li:contains(物业公司)" }, content).replace("物业公司:", "")
.trim();
if (virescencePercent.equals("%")) {
virescencePercent = "";
}
String traffic = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(地铁线路)" }, content).replace("地铁线路:", "");
String traffic = JQueryUtil.selectText(new String[] { ".lp_xq li:contains(地铁线路)" }, content).replace("地铁线路:", "");
Map<String, Object> ret = new HashMap<String, Object>();
@@ -70,7 +70,7 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -131,9 +131,9 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
if (!s.equals("")) {
s = leftTrim(s);
String arr[] = s.split(" ");
map.put("region", arr[0].replace("【", "").replace("】", ""));
map.put("region", arr[0].replace("【", "").replace("】", ""));
if(arr.length==2){
map.put("block", arr[1].replace("【", "").replace("】", ""));
map.put("block", arr[1].replace("【", "").replace("】", ""));
}
}
return map;
@@ -150,8 +150,8 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
String ret = "";
for (String s : facilitieSpans) {
s = trimChar(s);
if (s.indexOf("·公交") == -1 && s.indexOf("·地铁") == -1) {
s = s.replace("<span>", "").replace("</span>", "").replace("·", "");
if (s.indexOf("·公交") == -1 && s.indexOf("·地铁") == -1) {
s = s.replace("<span>", "").replace("</span>", "").replace("·", "");
if (ret.length() == 0) {
ret = s;
} else {
@@ -180,11 +180,11 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
}
for (String s : trafficeArr) {
s = trimChar(s);
if (s.indexOf("公交") != -1 || s.indexOf("地铁") != -1) {
if (s.indexOf("公交") != -1 || s.indexOf("地铁") != -1) {
if (ret.length() == 0) {
ret = s.replace("·", "");
ret = s.replace("·", "");
} else {
ret = ret + "\r" + s.replace("·", "");
ret = ret + "\r" + s.replace("·", "");
}
}
}
@@ -196,7 +196,7 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -210,7 +210,7 @@ public class DaikanDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -21,8 +21,8 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "焦点")
@PAGENAME(value = "详情页")
@SITENAME(value = "焦点")
@PAGENAME(value = "详情页")
public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -50,15 +50,15 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
String name = JQueryUtil.selectText(new String[] {".main_nav h3" }, content);
String address= JQueryUtil.selectText(new String[] {".house_info li:contains(小区地址)" }, content).replace("小区地址:", "").replace("地图", "").trim();
String estateType = JQueryUtil.selectText(new String[] {".house_info li:contains(物业类型)" }, content).replace("物业类型:", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] {".house_info li:contains(建筑年代)" }, content).replace("建筑年代:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {".house_info li:contains(容积率)" }, content).replace("容积率:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {".house_info li:contains(总户数)"}, content).replace("总户数:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {".house_info li:contains(绿化率:)"}, content).replace("绿化率:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".house_info li:contains(物业费)"}, content).replace("物业费:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {".house_info li:contains(物业公司)" }, content).replace("物业公司:", "").trim();
String developer = JQueryUtil.selectText(new String[] {".house_info li:contains(开发商)"}, content).replace("开发商:", "").trim();
String address= JQueryUtil.selectText(new String[] {".house_info li:contains(小区地址)" }, content).replace("小区地址:", "").replace("地图", "").trim();
String estateType = JQueryUtil.selectText(new String[] {".house_info li:contains(物业类型)" }, content).replace("物业类型:", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] {".house_info li:contains(建筑年代)" }, content).replace("建筑年代:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {".house_info li:contains(容积率)" }, content).replace("容积率:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {".house_info li:contains(总户数)"}, content).replace("总户数:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {".house_info li:contains(绿化率:)"}, content).replace("绿化率:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".house_info li:contains(物业费)"}, content).replace("物业费:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {".house_info li:contains(物业公司)" }, content).replace("物业公司:", "").trim();
String developer = JQueryUtil.selectText(new String[] {".house_info li:contains(开发商)"}, content).replace("开发商:", "").trim();
if(virescencePercent.equals("%")||virescencePercent.equals("0%")){
virescencePercent = "";
@@ -66,7 +66,7 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
if(finishBuildingDate.equals("0")){
finishBuildingDate = "";
}
if(estateCharge.equals("元/平米/月")){
if(estateCharge.equals("元/平米/月")){
estateCharge = "";
}
@@ -83,7 +83,7 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -112,22 +112,22 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
otherInfo.put("household_count", householdCount);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -162,12 +162,12 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
}
Map<String, List<String>> map = new HashMap<String, List<String>>();
for(String s : facilitieSpans){
String title = s.substring(s.indexOf("【"), s.indexOf("】")+1);
String title = s.substring(s.indexOf("【"), s.indexOf("】")+1);
String content = s.replace(title, "");
content = trimChar(content);
content = leftTrim(content);
String[] detail = content.split(" ");
title = title.replace("【", "").replace("】", "");
title = title.replace("【", "").replace("】", "");
List<String> details = map.get(title);
if(null == details){
details = new ArrayList<String>();
@@ -186,9 +186,9 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
String key = (String) it.next();
List<String> values = map.get(key);
if(ret.length() >0){
ret = ret + "\r" + key +" :" + values.toString();
ret = ret + "\r" + key +" :" + values.toString();
}else{
ret = key +" :" + values.toString();
ret = key +" :" + values.toString();
}
}
}
@@ -217,8 +217,8 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
}
for(String s : trafficeArr){
s = trimChar(s);
if(s.indexOf("地铁")!=-1){
s = s.substring(s.indexOf("】")+1, s.length());
if(s.indexOf("地铁")!=-1){
s = s.substring(s.indexOf("】")+1, s.length());
if(ret.length()==0){
ret = s;
}else{
@@ -235,7 +235,7 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -249,7 +249,7 @@ public class FocusDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -17,7 +17,7 @@ import com.fangjia.mongo.dao.RegionBlockDao;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "house365")
@PAGENAME(value = "详情页")
@PAGENAME(value = "详情页")
public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -42,36 +42,36 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
}
String name = JQueryUtil.selectText(new String[] { ".procjet h1" }, content);
String address = JQueryUtil.selectText(new String[] { ".introduce p:contains(小区地址)" }, content).replace("小区地址:", "")
.replace("查看地图", "").trim();
String estateType = JQueryUtil.selectText(new String[] { ".introduce p:contains(物业类型)" }, content).replace("物业类型:", "")
String address = JQueryUtil.selectText(new String[] { ".introduce p:contains(小区地址)" }, content).replace("小区地址:", "")
.replace("查看地图", "").trim();
String estateType = JQueryUtil.selectText(new String[] { ".introduce p:contains(物业类型)" }, content).replace("物业类型:", "")
.trim();
String estateCharge = JQueryUtil.selectText(new String[] { ".introduce p:contains(费)" }, content).replace("物 业 费 :", "")
String estateCharge = JQueryUtil.selectText(new String[] { ".introduce p:contains(费)" }, content).replace("物 业 费 :", "")
.trim();
String estateCompany = JQueryUtil.selectText(new String[] { ".introduce p:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
String developer = JQueryUtil.selectText(new String[] { ".introduce p:contains(商)" }, content).replace("开 发 商 :", "")
String estateCompany = JQueryUtil.selectText(new String[] { ".introduce p:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
String developer = JQueryUtil.selectText(new String[] { ".introduce p:contains(商)" }, content).replace("开 发 商 :", "")
.trim();
String virescencePercent = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(绿化比例) span:eq(3)" }, content)
.replace("绿化比例", "").trim();
String buildArea = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(建筑面积) span:eq(1)" }, content)
.replace("建筑面积", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(停 车 位) span:eq(3)" }, content)
.replace("停 车 位", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(绿化比例) span:eq(3)" }, content)
.replace("绿化比例", "").trim();
String buildArea = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(建筑面积) span:eq(1)" }, content)
.replace("建筑面积", "").trim();
String carSite = JQueryUtil.selectText(new String[] { ".jbxx_cont li:contains(停 车 位) span:eq(3)" }, content)
.replace("停 车 位", "").trim();
if (virescencePercent.equals("%") || virescencePercent.equals("0%")) {
virescencePercent = "";
}
if (estateCharge.equals("元/平米/月")) {
if (estateCharge.equals("元/平米/月")) {
estateCharge = "";
}
String traffic = JQueryUtil.selectText(new String[] { ".jiaotong" }, content).trim();
List<String> info = JQueryUtil.selectText(".box_c p", content);
String description = info.get(0).replace("..详细>>", "").replace("收起", "");
String facilities = info.get(1).replace("..详细>>", "").replace("收起", "").trim();
String description = info.get(0).replace("..详细>>", "").replace("收起", "");
String facilities = info.get(1).replace("..详细>>", "").replace("收起", "").trim();
Map<String, Object> ret = new HashMap<String, Object>();
@@ -80,7 +80,7 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -98,7 +98,7 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("developer", developer);
ret.put("estate_type", trimChar(estateType, " "));
ret.put("virescence_percent", virescencePercent);
ret.put("estate_charge", trimChar(estateCharge, "·"));
ret.put("estate_charge", trimChar(estateCharge, "·"));
ret.put("estate_company", estateCompany);
ret.put("traffic", traffic);
ret.put("facilities", facilities);
@@ -107,22 +107,22 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("car_site", carSite);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -146,7 +146,7 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -160,7 +160,7 @@ public class Home365DistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -24,8 +24,8 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "链家")
@PAGENAME(value = "详情页")
@SITENAME(value = "链家")
@PAGENAME(value = "详情页")
public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -79,10 +79,10 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
if (StringUtils.isNotBlank(finish_building_date)) {
String city = (String) map.get("city");
String region = (String) map.get("region");
if (city.equals("北京") && StringUtils.isNotBlank(region)) {
if (city.equals("北京") && StringUtils.isNotBlank(region)) {
String districtName = (String) map.get("name");
District district = districtDao.findDistrict("北京", region, districtName);
District district = districtDao.findDistrict("北京", region, districtName);
if (null != district) {
DBObject obj = new BasicDBObject();
obj.put("finish_building_date", finish_building_date);
@@ -102,8 +102,8 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
String name = JQueryUtil.selectText(new String[] { ".xtitle h1", ".headline h1" }, content);
String address = JQueryUtil
.selectText(new String[] { ".xtitle samp:contains(地址)", ".parti_nei li:contains(小区地址)" }, content)
.replace("小区地址:", "").replace("地址:", "");
.selectText(new String[] { ".xtitle samp:contains(地址)", ".parti_nei li:contains(小区地址)" }, content)
.replace("小区地址:", "").replace("地址:", "");
String region = "";
String block = "";
Map<String, String> map = parseAddress(address);
@@ -113,36 +113,36 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
address = map.get("address");
}
String estateType = JQueryUtil.selectText(new String[] { ".jiashou .one li:contains(房屋类型)" }, content)
.replace("房屋类型:", "").trim();
String buildType = JQueryUtil.selectText(new String[] { ".jiashou .one li:contains(建筑类型)" }, content)
.replace("建筑类型:", "").trim();
String estateType = JQueryUtil.selectText(new String[] { ".jiashou .one li:contains(房屋类型)" }, content)
.replace("房屋类型:", "").trim();
String buildType = JQueryUtil.selectText(new String[] { ".jiashou .one li:contains(建筑类型)" }, content)
.replace("建筑类型:", "").trim();
String finishBuildingDate = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(建成年代)", ".parti_nei li:contains(竣工时间)" }, content)
.replace("建成年代:", "").replace("竣工时间:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(建成年代)", ".parti_nei li:contains(竣工时间)" }, content)
.replace("建成年代:", "").replace("竣工时间:", "").trim();
String estateCharge = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(物 业 费)", ".parti_nei li:contains(物 业 费)" }, content)
.replace("物 业 费:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(物 业 费)", ".parti_nei li:contains(物 业 费)" }, content)
.replace("物 业 费:", "").trim();
String estateCompany = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(物业公司)", ".parti_nei li:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(物业公司)", ".parti_nei li:contains(物业公司)" }, content)
.replace("物业公司:", "").trim();
String developer = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(商)", ".parti_nei li:contains(开 发 商)" }, content)
.replace("开 发 商:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(商)", ".parti_nei li:contains(开 发 商)" }, content)
.replace("开 发 商:", "").trim();
String cubagePercent = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(容)", ".jiashou dd:contains(容 积 率)" }, content)
.replace("容 积 率:", "").replace("容 积 率", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(容)", ".jiashou dd:contains(容 积 率)" }, content)
.replace("容 积 率:", "").replace("容 积 率", "").trim();
String householdCount = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(房屋总数)", ".jiashou dd:contains(房屋总数)" }, content)
.replace("房屋总数:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(房屋总数)", ".jiashou dd:contains(房屋总数)" }, content)
.replace("房屋总数:", "").trim();
String virescencePercent = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(绿 化 率)", ".jiashou dd:contains(绿 化 率)" }, content)
.replace("绿 化 率:", "").replace("绿 化 率", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(绿 化 率)", ".jiashou dd:contains(绿 化 率)" }, content)
.replace("绿 化 率:", "").replace("绿 化 率", "").trim();
String total_building = JQueryUtil
.selectText(new String[] { ".jiashou .one li:contains(楼栋总数)", ".jiashou dd:contains(楼栋总数)" }, content)
.replace("楼栋总数:", "").trim();
.selectText(new String[] { ".jiashou .one li:contains(楼栋总数)", ".jiashou dd:contains(楼栋总数)" }, content)
.replace("楼栋总数:", "").trim();
if (estateCharge.equals("元/平米/月")) {
if (estateCharge.equals("元/平米/月")) {
estateCharge = "";
}
List<String> baseInfos = JQueryUtil.selectText(".detailed dd", content);
@@ -152,19 +152,19 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
for (int i = 0; i < baseInfos.size() - 1; i = i + 2) {
// String field = baseInfos.get(i);
// String value = baseInfos.get(i + 1);
// if (field.indexOf("建筑面积") != -1) {
// if (field.indexOf("建筑面积") != -1) {
// buildArea = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("占地面积") != -1) {
// } else if (field.indexOf("占地面积") != -1) {
// allArea = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("车位信息") != -1) {
// } else if (field.indexOf("车位信息") != -1) {
// carSite = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("容") != -1) {
// } else if (field.indexOf("容") != -1) {
// cubagePercent = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("绿") != -1) {
// } else if (field.indexOf("绿") != -1) {
// virescencePercent = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("商") != -1) {
// } else if (field.indexOf("商") != -1) {
// developer = trimChar(JQueryUtil.getText(value)).trim();
// } else if (field.indexOf("费") != -1) {
// } else if (field.indexOf("费") != -1) {
// estateCharge = trimChar(JQueryUtil.getText(value)).trim();
// }
}
@@ -181,13 +181,13 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> trafficeArr = JQueryUtil.selectText("#tagContentb0 table .one", content);
String traffic = getTraffic(trafficeArr);
if (traffic.length() == 0) {
String bus = JQueryUtil.selectText(new String[] { ".ditiae ul:contains(公交)" }, content).trim();
String subway = JQueryUtil.selectText(new String[] { ".ditiae ul:contains(地铁)" }, content).trim();
if (!bus.equals("公交:")) {
String bus = JQueryUtil.selectText(new String[] { ".ditiae ul:contains(公交)" }, content).trim();
String subway = JQueryUtil.selectText(new String[] { ".ditiae ul:contains(地铁)" }, content).trim();
if (!bus.equals("公交:")) {
traffic = bus;
}
if (!subway.equals("地铁:")) {
if (!subway.equals("地铁:")) {
if (traffic.length() == 0) {
traffic = bus;
} else {
@@ -212,7 +212,7 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -248,23 +248,23 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
ret = removeInValidField(ret);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(ret);
// return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -296,12 +296,12 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
}
Map<String, List<String>> map = new HashMap<String, List<String>>();
for (String s : facilitieSpans) {
String title = s.substring(s.indexOf("【"), s.indexOf("】") + 1);
String title = s.substring(s.indexOf("【"), s.indexOf("】") + 1);
String content = s.replace(title, "");
content = trimChar(content);
content = leftTrim(content);
String[] detail = content.split(" ");
title = title.replace("【", "").replace("】", "");
title = title.replace("【", "").replace("】", "");
List<String> details = map.get(title);
if (null == details) {
details = new ArrayList<String>();
@@ -320,9 +320,9 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
String key = (String) it.next();
List<String> values = map.get(key);
if (ret.length() > 0) {
ret = ret + "\r" + key + " :" + values.toString();
ret = ret + "\r" + key + " :" + values.toString();
} else {
ret = key + " :" + values.toString();
ret = key + " :" + values.toString();
}
}
}
@@ -336,7 +336,7 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
}
// for (String s : facilitieSpans) {
// s = JQueryUtil.getText(s);
// String prefix = s.substring(0, s.indexOf(":") + 1);
// String prefix = s.substring(0, s.indexOf(":") + 1);
// if (!s.equals(prefix)) {
// s = trimChar(s);
// if (ret.length() > 0) {
@@ -373,8 +373,8 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
}
for (String s : trafficeArr) {
s = trimChar(s);
if (s.indexOf("地铁") != -1) {
s = s.substring(s.indexOf("】") + 1, s.length());
if (s.indexOf("地铁") != -1) {
s = s.substring(s.indexOf("】") + 1, s.length());
if (ret.length() == 0) {
ret = s;
} else {
@@ -392,7 +392,7 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
|| "0.00".equals(s)) {
removeKeys.add(key);
}
@@ -407,7 +407,7 @@ public class HomeLinkDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -17,8 +17,8 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
import com.mongodb.BasicDBObject;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "吉屋网")
@PAGENAME(value = "详情页")
@SITENAME(value = "吉屋网")
@PAGENAME(value = "详情页")
public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -29,31 +29,31 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> positions = JQueryUtil.selectText("#position a", content);
String region = positions.get(1);
String block = "";
if(region.indexOf("二手小区")!=-1){
region = region.replace("二手小区", "");
if(region.indexOf("二手小区")!=-1){
region = region.replace("二手小区", "");
}else{
region = "";
}
String name = JQueryUtil.selectText(new String[] {".zhuti_center h1" }, content);
String address = JQueryUtil.selectText(new String[] {".esfjj div:contains(小区地址)" }, content).replace("小区地址:", "");
String estateType = JQueryUtil.selectText(new String[] {".esfjj div:contains(物业类型)" }, content).replace("物业类型:", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] { ".esfjj div:contains(建造年代)" }, content).replace("建造年代:", "").trim();
String developer = JQueryUtil.selectText(new String[] {".esfjj div:contains(开 发 商)" }, content).replace("开 发 商:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".esfjj div:contains(物 业 费)" }, content).replace("物 业 费:", "").trim();
String address = JQueryUtil.selectText(new String[] {".esfjj div:contains(小区地址)" }, content).replace("小区地址:", "");
String estateType = JQueryUtil.selectText(new String[] {".esfjj div:contains(物业类型)" }, content).replace("物业类型:", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] { ".esfjj div:contains(建造年代)" }, content).replace("建造年代:", "").trim();
String developer = JQueryUtil.selectText(new String[] {".esfjj div:contains(开 发 商)" }, content).replace("开 发 商:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".esfjj div:contains(物 业 费)" }, content).replace("物 业 费:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] {"table tr:contains(建筑面积) td:eq(1)" }, content).replace("建筑面积:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {"table tr:contains(容 积 率) td:eq(1)" }, content).replace("容 积 率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {"table tr:contains( 绿 化 率) td:eq(3)" }, content).replace("绿 化 率:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] {"table tr:contains(建筑面积) td:eq(1)" }, content).replace("建筑面积:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {"table tr:contains(容 积 率) td:eq(1)" }, content).replace("容 积 率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {"table tr:contains( 绿 化 率) td:eq(3)" }, content).replace("绿 化 率:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {"table tr:contains(总 户 数) td:eq(3)"}, content).replace("总 户 数:", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {"table tr:contains(总 户 数) td:eq(3)"}, content).replace("总 户 数:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {"table tr:contains(物业公司) td:eq(1)" }, content).replace("物业公司:", "").trim();
String carSite = JQueryUtil.selectText(new String[] {"table tr:contains(停车位) td:eq(1)"},content).replace("车位信息:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {"table tr:contains(物业公司) td:eq(1)" }, content).replace("物业公司:", "").trim();
String carSite = JQueryUtil.selectText(new String[] {"table tr:contains(停车位) td:eq(1)"},content).replace("车位信息:", "").trim();
if(buildArea.equals("平方米")){
if(buildArea.equals("平方米")){
buildArea = "";
}
if(virescencePercent.equals("%")){
@@ -61,7 +61,7 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
}
String description = JQueryUtil.selectText(new String[] {"#remark" }, content);
String traffic = JQueryUtil.selectText(new String[] {".mapstxt .tong:contains(公交)" }, content).replace("公交:", "");
String traffic = JQueryUtil.selectText(new String[] {".mapstxt .tong:contains(公交)" }, content).replace("公交:", "");
Map<String, Object> ret = new HashMap<String, Object>();
Map<String, Object> otherInfo = new HashMap<String, Object>();
@@ -71,7 +71,7 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -100,22 +100,22 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
otherInfo.put("household_count", householdCount);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -129,7 +129,7 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
|| "0.00".equals(s)) {
removeKeys.add(key);
}
@@ -144,7 +144,7 @@ public class JiwuDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -19,8 +19,8 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
import com.mongodb.BasicDBObject;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "楼盘网")
@PAGENAME(value = "详情页")
@SITENAME(value = "楼盘网")
@PAGENAME(value = "详情页")
public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -30,42 +30,42 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> analyFields) throws Exception {
List<String> errors = new ArrayList<String>();
String block = "";
String region = JQueryUtil.selectText(new String[]{".ui-box-content dl:contains(所在区域)"}, content).replace("所在区域:", "").trim();
String region = JQueryUtil.selectText(new String[]{".ui-box-content dl:contains(所在区域)"}, content).replace("所在区域:", "").trim();
String name = JQueryUtil.selectText(new String[] {".lp-tit-title" }, content);
String estateType = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业类别)" }, content).replace("物业类别:", "").trim();
String buildType = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(建筑类别)" }, content).replace("建筑类别:", "").trim();
String estateType = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业类别)" }, content).replace("物业类别:", "").trim();
String buildType = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(建筑类别)" }, content).replace("建筑类别:", "").trim();
String address = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业地址)" }, content).replace("物业地址:", "");
String address = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业地址)" }, content).replace("物业地址:", "");
String finishBuildingDate = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(入住时间)" }, content).replace("入住时间:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物 业 费)" }, content).replace("物 业 费:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(容 积 率)" }, content).replace("容 积 率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(绿 化 率)" }, content).replace("绿 化 率", "").trim();
String developer = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(开 发 商)" }, content).replace("开 发 商:", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(入住时间)" }, content).replace("入住时间:", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物 业 费)" }, content).replace("物 业 费:", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(容 积 率)" }, content).replace("容 积 率:", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(绿 化 率)" }, content).replace("绿 化 率", "").trim();
String developer = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(开 发 商)" }, content).replace("开 发 商:", "").trim();
String fitment = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(装修状况)" }, content).replace("装修状况:", "").trim();
String licence = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(预售许可证)"}, content).replace("预售许可证:", "").trim();
String propertyLife = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(产权年限)"}, content).replace("产权年限:", "").trim();
String fitment = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(装修状况)" }, content).replace("装修状况:", "").trim();
String licence = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(预售许可证)"}, content).replace("预售许可证:", "").trim();
String propertyLife = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(产权年限)"}, content).replace("产权年限:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业公司)" }, content).replace("物业公司:", "").trim();
String characteristic = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(项目特色)" }, content).replace("项目特色:", "").trim();
String openDate = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(开盘时间)" }, content).replace("开盘时间:", "").trim();
String floorInfo = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(楼层状况)" }, content).replace("楼层状况:", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {".ui-box-content dl:contains(物业公司)" }, content).replace("物业公司:", "").trim();
String characteristic = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(项目特色)" }, content).replace("项目特色:", "").trim();
String openDate = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(开盘时间)" }, content).replace("开盘时间:", "").trim();
String floorInfo = JQueryUtil.selectText(new String[] { ".ui-box-content dl:contains(楼层状况)" }, content).replace("楼层状况:", "").trim();
if(virescencePercent.equals("%")){
virescencePercent = "";
}
String carSite = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(车位信息)"},content).replace("车位信息:", "").trim();
String description = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(项目简介)" }, content).replace("项目简介:", "").trim();
String traffic = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(交通状况)" }, content).replace("交通状况:", "");
String carSite = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(车位信息)"},content).replace("车位信息:", "").trim();
String description = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(项目简介)" }, content).replace("项目简介:", "").trim();
String traffic = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(交通状况)" }, content).replace("交通状况:", "");
String facilities = JQueryUtil.selectText(new String[] {".ui-box-content.fn-clear:eq(2)" }, content);
String payStandard = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(交付标准)" }, content).replace("交付标准", "");
String payStandard = JQueryUtil.selectText(new String[] {".lp-detailed-box:contains(交付标准)" }, content).replace("交付标准", "");
List<String> otherInfos = JQueryUtil.selectText(".lp-detailed-box:contains(开工时间) dl", content);
List<String> otherInfos = JQueryUtil.selectText(".lp-detailed-box:contains(开工时间) dl", content);
Map<String, Object> detail = parseOtherInfo(otherInfos);
Map<String, Object> ret = new HashMap<String, Object>();
@@ -76,7 +76,7 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -115,22 +115,22 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
otherInfo.put("pay_standard", payStandard);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -146,27 +146,27 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
}
for(String s : otherInfos){
// s = JQueryUtil.getText(s);
// String[] array = s.split(":");
// String[] array = s.split(":");
// String key = "";
// String value = "";
// if(array[0].equals("开工时间")){
// if(array[0].equals("开工时间")){
// key = "start_building_date";
// }else if(array[0].equals("竣工时间")){
// }else if(array[0].equals("竣工时间")){
// key = "finish_building_date";
// }else if(array[0].equals("代理公司")){
// }else if(array[0].equals("代理公司")){
// key = "agency_company";
// }else if(array[0].equals("按揭银行")){
// }else if(array[0].equals("按揭银行")){
// key = "mortgage_banks";
// }else if(array[0].equals("用地规划许可证")){
// }else if(array[0].equals("用地规划许可证")){
// key = "land_planning_permit";
// }else if(array[0].equals("工程规划许可证")){
// }else if(array[0].equals("工程规划许可证")){
// key = "project_planning_permit";
// }else if(array[0].equals("国有土地使用证")){
// }else if(array[0].equals("国有土地使用证")){
// key = " land_use_permit";
// }else if(array[0].equals("建设工程开工证")){
// }else if(array[0].equals("建设工程开工证")){
// key = "construction_work_permits";
// }
// if(array.length==2&&array[1].indexOf("暂无")!=-1){
// if(array.length==2&&array[1].indexOf("暂无")!=-1){
// value = array[1];
// }
// if(StringUtils.isNotBlank(value)){
@@ -182,7 +182,7 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无") || "0".equals(s) || "0%".equals(s)
|| "0.00".equals(s)) {
removeKeys.add(key);
}
@@ -197,7 +197,7 @@ public class LoupanDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -19,8 +19,8 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "新浪")
@PAGENAME(value = "详情页")
@SITENAME(value = "新浪")
@PAGENAME(value = "详情页")
public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -42,31 +42,31 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
String name = JQueryUtil.selectText(new String[] {".title .name",".comutiy-header h1" }, content);
String aliasStr = JQueryUtil.selectText(new String[] {".tuiguang_font_2",".comutiy-header strong:contains(推广名)" }, content).replace("推广名:", "");
String aliasStr = JQueryUtil.selectText(new String[] {".tuiguang_font_2",".comutiy-header strong:contains(推广名)" }, content).replace("推广名:", "");
List<String> alias = getAlias(aliasStr);
String address = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(小区地址) td:eq(1)",".comutiy-mod01 li:contains(地址/板块)" }, content);
if(address.indexOf("小区地址")!=-1){
address = address.replace("小区地址", "").trim();
String address = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(小区地址) td:eq(1)",".comutiy-mod01 li:contains(地址/板块)" }, content);
if(address.indexOf("小区地址")!=-1){
address = address.replace("小区地址", "").trim();
}else{
address = address.replace("·地址/板块", "");
address = address.replace("·地址/板块", "");
if(address.length() > 0 && address.indexOf(" ")!=-1){
address = address.substring(0, address.indexOf(" "));
}
}
String estateType = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业类型) td:eq(1)",".comutiy-mod01 li:contains(物业类型)" }, content).replace("·物业类型:", "").replace("物业类型", "").trim();
String buildType = JQueryUtil.selectText(new String[] {".comutiy-mod01 li:contains(建筑类型)" }, content).replace("·建筑类型", "").replace("·建筑类型:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(总建筑面积) td:eq(3)" }, content).replace("总建筑面积", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(竣工日期) td:eq(1)" ,".comutiy-mod01 li:contains(竣工日期)" }, content).replace("·竣工日期:", "").replace("竣工日期", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(总户数) td:eq(3)",".comutiy-mod01 li:contains(总 户 数)" }, content).replace("·总 户 数:", "").replace("总户数", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业管理费) td:eq(1)" }, content).replace("物业管理费", "").trim();
String carSite = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(停车位) td:eq(3)",".comutiy-mod01 li:contains(停 车 位)" }, content).replace("·停 车 位:", "").replace("停车位", "").trim();
String developer = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(开发商) td:eq(1)",".comutiy-mod01 li:contains(开 发 商)" }, content).replace("·开 发 商:", "").replace("开发商", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(容积率) td:eq(3)",".comutiy-mod01 li:contains(容积率)" }, content).replace("·容 积 率:", "").replace("容积率", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业公司) td:eq(1)",".comutiy-mod01 li:contains(物业公司)" }, content).replace("·物业公司:", "").replace("物业公司", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(绿化率) td:eq(3)" ,".comutiy-mod01 li:contains(绿 化 率)"}, content).replace("·绿 化 率:", "").replace("绿化率", "").trim();
String estateType = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业类型) td:eq(1)",".comutiy-mod01 li:contains(物业类型)" }, content).replace("·物业类型:", "").replace("物业类型", "").trim();
String buildType = JQueryUtil.selectText(new String[] {".comutiy-mod01 li:contains(建筑类型)" }, content).replace("·建筑类型", "").replace("·建筑类型:", "").trim();
String buildArea = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(总建筑面积) td:eq(3)" }, content).replace("总建筑面积", "").trim();
String finishBuildingDate = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(竣工日期) td:eq(1)" ,".comutiy-mod01 li:contains(竣工日期)" }, content).replace("·竣工日期:", "").replace("竣工日期", "").trim();
String householdCount = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(总户数) td:eq(3)",".comutiy-mod01 li:contains(总 户 数)" }, content).replace("·总 户 数:", "").replace("总户数", "").trim();
String estateCharge = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业管理费) td:eq(1)" }, content).replace("物业管理费", "").trim();
String carSite = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(停车位) td:eq(3)",".comutiy-mod01 li:contains(停 车 位)" }, content).replace("·停 车 位:", "").replace("停车位", "").trim();
String developer = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(开发商) td:eq(1)",".comutiy-mod01 li:contains(开 发 商)" }, content).replace("·开 发 商:", "").replace("开发商", "").trim();
String cubagePercent = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(容积率) td:eq(3)",".comutiy-mod01 li:contains(容积率)" }, content).replace("·容 积 率:", "").replace("容积率", "").trim();
String estateCompany = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(物业公司) td:eq(1)",".comutiy-mod01 li:contains(物业公司)" }, content).replace("·物业公司:", "").replace("物业公司", "").trim();
String virescencePercent = JQueryUtil.selectText(new String[] {"#xiaoqu_intro_table tr:contains(绿化率) td:eq(3)" ,".comutiy-mod01 li:contains(绿 化 率)"}, content).replace("·绿 化 率:", "").replace("绿化率", "").trim();
if(buildArea.equals("平方米")){
if(buildArea.equals("平方米")){
buildArea = "";
}
if(virescencePercent.equals("%")){
@@ -75,16 +75,16 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> trafficeArr = JQueryUtil.selectText(".map_xxdz p", content);
if(null == trafficeArr){
trafficeArr = JQueryUtil.selectText(".comutiy-mod01:contains(周边配套) p", content);
trafficeArr = JQueryUtil.selectText(".comutiy-mod01:contains(周边配套) p", content);
}
String traffic = getTraffic(trafficeArr);
String description = JQueryUtil.selectText(new String[] {"#xiaoqu_baseintro>p",".comutiy-mod01:contains(小区介绍) p" }, content);
String description = JQueryUtil.selectText(new String[] {"#xiaoqu_baseintro>p",".comutiy-mod01:contains(小区介绍) p" }, content);
List<String> facilitieSpans = JQueryUtil.selectText("#xiaoqu_peitao_info p", content);
if(null == facilitieSpans){
facilitieSpans = JQueryUtil.selectText(".comutiy-mod01:contains(周边配套) p", content);
facilitieSpans = JQueryUtil.selectText(".comutiy-mod01:contains(周边配套) p", content);
}
String facilities = findFacilities(facilitieSpans);
@@ -96,7 +96,7 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -132,22 +132,22 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
otherInfo.put("household_count", householdCount);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -160,8 +160,8 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
String ret = "";
for(String s : facilitieSpans){
s = trimChar(s);
if(s.indexOf("·公交")==-1 && s.indexOf("·地铁")==-1){
s = s.replace("<span>", "").replace("</span>", "").replace("·", "");
if(s.indexOf("·公交")==-1 && s.indexOf("·地铁")==-1){
s = s.replace("<span>", "").replace("</span>", "").replace("·", "");
if(ret.length() == 0){
ret = s;
}else{
@@ -189,11 +189,11 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
}
for(String s : trafficeArr){
s = trimChar(s);
if(s.indexOf("公交")!=-1 || s.indexOf("地铁")!=-1){
if(s.indexOf("公交")!=-1 || s.indexOf("地铁")!=-1){
if(ret.length()==0){
ret = s.replace("·", "");
ret = s.replace("·", "");
}else{
ret = ret + "\r" + s.replace("·", "");
ret = ret + "\r" + s.replace("·", "");
}
}
}
@@ -204,7 +204,7 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -218,7 +218,7 @@ public class SinaDistrictDetailAnalyImpl implements AnalyzerInterface{
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -19,30 +19,30 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
/**
* 搜房小区详情页解析
* 搜房小区详情页解析
*
* @author xiaoyu
*
*/
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "搜房")
@PAGENAME(value = "详情页")
@SITENAME(value = "搜房")
@PAGENAME(value = "详情页")
public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@Override
public AnalyResult invoke(String city, String content, List<String> analyFields) throws Exception {
if (CollectionUtils.isEmpty(analyFields)) {
return new AnalyResult("没有输入解析字段");
return new AnalyResult("没有输入解析字段");
}
List<String> errors = new ArrayList<String>();
String name = JQueryUtil.selectText(new String[] { ".ewmBoxTitle .floatl", "h1", "#house_6" }, content)
.replace("小区网", "");
.replace("小区网", "");
String regionBlock = JQueryUtil.selectText(
new String[] { ".leftinfo .lbox dd:contains(所属区域)", ".xiangqing dd:contains(所属区域)",
"#bsif tbody tr:contains(区域) td", "table tbody th:contains(区域)+td" }, content).replace("所属区域:", "");
new String[] { ".leftinfo .lbox dd:contains(所属区域)", ".xiangqing dd:contains(所属区域)",
"#bsif tbody tr:contains(区域) td", "table tbody th:contains(区域)+td" }, content).replace("所属区域:", "");
String[] arrs = regionBlock.split(" ");
String region = null;
String block = null;
@@ -57,129 +57,129 @@ public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
String address = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(小区地址)", ".leftinfo dt:contains(小区地址)",
".xiangqing dd:contains(楼盘地址)", "#bsif tr:contains(地址) td", "table tbody th:contains(地址)+td" },
content).replace("小区地址:", "").replace("楼盘地址:", "").replace("[地图]", "").trim();
new String[] { ".leftinfo dd:contains(小区地址)", ".leftinfo dt:contains(小区地址)",
".xiangqing dd:contains(楼盘地址)", "#bsif tr:contains(地址) td", "table tbody th:contains(地址)+td" },
content).replace("小区地址:", "").replace("楼盘地址:", "").replace("[地图]", "").trim();
if (StringUtils.isBlank(city) || StringUtils.isBlank(region) || StringUtils.isBlank(name) || StringUtils.isBlank(address)) {
errors.add("city||region||name||address解析不到");
errors.add("city||region||name||address解析不到");
return new AnalyResult(errors);
}
String aliasStr = JQueryUtil.selectText(new String[] { ".bm_title span" }, content).replace("别名:", "").trim();
String aliasStr = JQueryUtil.selectText(new String[] { ".bm_title span" }, content).replace("别名:", "").trim();
List<String> alias = getAlias(aliasStr);
String characteristic = JQueryUtil
.selectText(new String[] { ".leftinfo dd:contains(项目特色)", ".xiangqing dd:contains(项目特色)" }, content)
.replace("项目特色:", "").trim();
.selectText(new String[] { ".leftinfo dd:contains(项目特色)", ".xiangqing dd:contains(项目特色)" }, content)
.replace("项目特色:", "").trim();
String developer = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(开 发 商:)", ".xiangqing dd:contains(开 发 商:)",
"#bsif tr:contains(开 发 商:) td" }, content).replace("开 发 商:", "").replace("[相关网站]", "").trim();
new String[] { ".leftinfo dd:contains(开 发 商:)", ".xiangqing dd:contains(开 发 商:)",
"#bsif tr:contains(开 发 商:) td" }, content).replace("开 发 商:", "").replace("[相关网站]", "").trim();
String liveDate = JQueryUtil
.selectText(new String[] { ".leftinfo .lbox dd:contains(竣工时间)", ".xiangqing dd:contains(竣工时间)" }, content)
.replace("竣工时间:", "").replace("[相关网站]", "").trim();
.selectText(new String[] { ".leftinfo .lbox dd:contains(竣工时间)", ".xiangqing dd:contains(竣工时间)" }, content)
.replace("竣工时间:", "").replace("[相关网站]", "").trim();
String estateType = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(物业类别)", ".xiangqing dd:contains(物业类别)",
"#bsif tr:contains(住宅类别) td:eq(1)" }, content).replace("物业类别:", "").replace("住宅类别:", "").trim();
new String[] { ".leftinfo dd:contains(物业类别)", ".xiangqing dd:contains(物业类别)",
"#bsif tr:contains(住宅类别) td:eq(1)" }, content).replace("物业类别:", "").replace("住宅类别:", "").trim();
String buildType = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(建筑类别)", ".xiangqing dd:contains(建筑类别)",
"#bsif tr:contains(建筑类别) td:eq(3)" }, content).replace("建筑类别:", "").trim();
new String[] { ".leftinfo dd:contains(建筑类别)", ".xiangqing dd:contains(建筑类别)",
"#bsif tr:contains(建筑类别) td:eq(3)" }, content).replace("建筑类别:", "").trim();
if (StringUtils.isBlank(buildType)) {
buildType = JQueryUtil.selectText(new String[] { ".xiangxinei th:contains(商铺类型)", ".xiangxinei th:contains(写字楼类型)" },
buildType = JQueryUtil.selectText(new String[] { ".xiangxinei th:contains(商铺类型)", ".xiangxinei th:contains(写字楼类型)" },
content).trim();
if (StringUtils.isNotBlank(buildType)) {
errors.add("类型不正确,不是小区类型");
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
String buildStructure = JQueryUtil
.selectText(new String[] { ".leftinfo dd:contains(建筑结构)", ".xiangqing dd:contains(建筑结构)" }, content)
.replace("建筑结构:", "").trim();
.selectText(new String[] { ".leftinfo dd:contains(建筑结构)", ".xiangqing dd:contains(建筑结构)" }, content)
.replace("建筑结构:", "").trim();
String propertyLife = JQueryUtil
.selectText(new String[] { ".leftinfo dd:contains(产权描述)", ".xiangqing dd:contains(产权描述)" }, content)
.replace("产权描述:", "").trim();
.selectText(new String[] { ".leftinfo dd:contains(产权描述)", ".xiangqing dd:contains(产权描述)" }, content)
.replace("产权描述:", "").trim();
String finishBuildingDate = JQueryUtil
.selectText(new String[] { ".leftinfo .lbox dd:contains(竣工时间)", ".xiangqing dd:contains(竣工时间)" }, content)
.replace("竣工时间:", "").replace("[相关网站]", "").trim();
.selectText(new String[] { ".leftinfo .lbox dd:contains(竣工时间)", ".xiangqing dd:contains(竣工时间)" }, content)
.replace("竣工时间:", "").replace("[相关网站]", "").trim();
String loopLineInfo = JQueryUtil
.selectText(new String[] { ".leftinfo dd:contains(环线位置)", ".xiangqing dd:contains(环线位置)" }, content)
.replace("环线位置:", "").trim();
.selectText(new String[] { ".leftinfo dd:contains(环线位置)", ".xiangqing dd:contains(环线位置)" }, content)
.replace("环线位置:", "").trim();
String cubagePercent = JQueryUtil
.selectText(
new String[] { ".leftinfo .lbox dd:contains(容积率)", ".leftinfo .lbox dd:contains(容 积 率:)",
".xiangqing dd:contains(容积率)", "#bsif tr:contains(容积率) td:eq(1)" }, content)
.replace("容 积 率:", "").replace("[关于容积率]", "").replace("[容积率]", "").trim();
new String[] { ".leftinfo .lbox dd:contains(容积率)", ".leftinfo .lbox dd:contains(容 积 率:)",
".xiangqing dd:contains(容积率)", "#bsif tr:contains(容积率) td:eq(1)" }, content)
.replace("容 积 率:", "").replace("[关于容积率]", "").replace("[容积率]", "").trim();
String virescencePercent = JQueryUtil
.selectText(
new String[] { ".leftinfo .lbox dd:contains(绿化率)", ".leftinfo .lbox dd:contains(绿 化 率:)",
".xiangqing dd:contains(绿化率)", "#bsif tr:contains(绿化率) td:eq(3)" }, content)
.replace("绿 化 率:", "").replace("[关于绿化率]", "").replace("[绿化率]", "").trim();
new String[] { ".leftinfo .lbox dd:contains(绿化率)", ".leftinfo .lbox dd:contains(绿 化 率:)",
".xiangqing dd:contains(绿化率)", "#bsif tr:contains(绿化率) td:eq(3)" }, content)
.replace("绿 化 率:", "").replace("[关于绿化率]", "").replace("[绿化率]", "").trim();
String estateCharge = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(物 业 费:)", ".xiangqing dd:contains(费:)",
"#bsif tr:contains(费:) td:eq(1)" }, content).replace("物 业 费:", "").trim();
new String[] { ".leftinfo dd:contains(物 业 费:)", ".xiangqing dd:contains(费:)",
"#bsif tr:contains(费:) td:eq(1)" }, content).replace("物 业 费:", "").trim();
String estateCharge2 = JQueryUtil
.selectText(new String[] { ".leftinfo dd:contains(物业管理附加信息:)", ".xiangqing dd:contains(物业管理附加信息:)" }, content)
.replace("物业管理附加信息:", "").trim();
.selectText(new String[] { ".leftinfo dd:contains(物业管理附加信息:)", ".xiangqing dd:contains(物业管理附加信息:)" }, content)
.replace("物业管理附加信息:", "").trim();
String estateCompany = JQueryUtil
.selectText(
new String[] { ".leftinfo dd:contains(物业公司:)", ".xiangqing dd:contains(物业公司:)",
"#bsif tr:contains(物业公司) td:eq(3)" }, content).replace("物业公司:", "").trim();
new String[] { ".leftinfo dd:contains(物业公司:)", ".xiangqing dd:contains(物业公司:)",
"#bsif tr:contains(物业公司) td:eq(3)" }, content).replace("物业公司:", "").trim();
String allArea = JQueryUtil
.selectText(
new String[] { ".leftinfo .lbox dd:contains(占地面积:)", ".xiangqing dd:contains(占地面积:)",
"#bsif tr:contains(占地面积) td:eq(1)" }, content).replace("占地面积:", "").trim();
new String[] { ".leftinfo .lbox dd:contains(占地面积:)", ".xiangqing dd:contains(占地面积:)",
"#bsif tr:contains(占地面积) td:eq(1)" }, content).replace("占地面积:", "").trim();
String buildArea = JQueryUtil
.selectText(
new String[] { ".leftinfo .lbox dd:contains(建筑面积:)", ".xiangqing dd:contains(建筑面积:)",
"#bsif tr:contains(建筑面积) td:eq(3)" }, content).replace("建筑面积:", "").trim();
new String[] { ".leftinfo .lbox dd:contains(建筑面积:)", ".xiangqing dd:contains(建筑面积:)",
"#bsif tr:contains(建筑面积) td:eq(3)" }, content).replace("建筑面积:", "").trim();
String householdCount = JQueryUtil
.selectText(new String[] { ".leftinfo .lbox dd:contains(总 户 数:)", ".xiangqing dd:contains(总户数:)" }, content)
.replace("总户数:", "").replace("总 户 数:", "").trim();
.selectText(new String[] { ".leftinfo .lbox dd:contains(总 户 数:)", ".xiangqing dd:contains(总户数:)" }, content)
.replace("总户数:", "").replace("总 户 数:", "").trim();
String currHouseholdCount = JQueryUtil
.selectText(new String[] { ".leftinfo .lbox dd:contains(当期户数:)", ".xiangqing dd:contains(当期户数:)" }, content)
.replace("当期户数:", "").trim();
.selectText(new String[] { ".leftinfo .lbox dd:contains(当期户数:)", ".xiangqing dd:contains(当期户数:)" }, content)
.replace("当期户数:", "").trim();
String carSite = JQueryUtil
.selectText(
new String[] { ".leftinfo dt:contains(停车位:)", ".leftinfo dt:contains(停 车 位:)",
".xiangqing dd:contains(位:)", "#bsif tr:contains(车位信息) td" }, content).replace("停 车 位:", "")
.replace("停车位:", "").trim();
new String[] { ".leftinfo dt:contains(停车位:)", ".leftinfo dt:contains(停 车 位:)",
".xiangqing dd:contains(位:)", "#bsif tr:contains(车位信息) td" }, content).replace("停 车 位:", "")
.replace("停车位:", "").trim();
String description = JQueryUtil.selectText(new String[] { ".leftinfo div:contains(小区简介)+dl", "#dli014" }, content).trim();
String description = JQueryUtil.selectText(new String[] { ".leftinfo div:contains(小区简介)+dl", "#dli014" }, content).trim();
if (StringUtils.isNotBlank(description)) {
description = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--小区简介 begin-->", "<!--小区简介 end-->"))
.replace("小区简介编辑本段", "").replace("\n", "").replace("\t", "").trim();
description = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--小区简介 begin-->", "<!--小区简介 end-->"))
.replace("小区简介编辑本段", "").replace("\n", "").replace("\t", "").trim();
}
// String loudongInfo =
// DataUtil.removeHtml(StringUtils.substringBetween(content,
// "<!--楼座信息 begin-->", "<!--楼座信息 end-->"))
// .replace("楼座信息编辑本段", "").replace("\n", "").replace("\t", "").trim();
String traffic = JQueryUtil.selectText(new String[] { ".leftinfo div:contains(交通状况)+dl", "#dli013" }, content).trim();
// "<!--楼座信息 begin-->", "<!--楼座信息 end-->"))
// .replace("楼座信息编辑本段", "").replace("\n", "").replace("\t", "").trim();
String traffic = JQueryUtil.selectText(new String[] { ".leftinfo div:contains(交通状况)+dl", "#dli013" }, content).trim();
if (StringUtils.isNotBlank(traffic)) {
traffic = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--交通状况 begin-->", "<!--交通状况 end-->"))
.replace("交通状况编辑本段", "").replace("\n", "").replace("\t", "").trim();
traffic = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--交通状况 begin-->", "<!--交通状况 end-->"))
.replace("交通状况编辑本段", "").replace("\n", "").replace("\t", "").trim();
}
String facilities = JQueryUtil
.selectHtml(new String[] { ".leftinfo div:contains(周边信息)+dl", "#dli012 table td" }, content).trim();
.selectHtml(new String[] { ".leftinfo div:contains(周边信息)+dl", "#dli012 table td" }, content).trim();
if (StringUtils.isNotBlank(facilities)) {
facilities = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--周边信息 begin-->", "<!--周边信息 end-->"))
.replace("周边信息编辑本段", "").replace("\n", "").replace("\t", "").trim();
if (facilities.indexOf("本段合作编辑者") > -1) {
facilities = StringUtils.substringBeforeLast(facilities, "本段合作编辑者");
facilities = DataUtil.removeHtml(StringUtils.substringBetween(content, "<!--周边信息 begin-->", "<!--周边信息 end-->"))
.replace("周边信息编辑本段", "").replace("\n", "").replace("\t", "").trim();
if (facilities.indexOf("本段合作编辑者") > -1) {
facilities = StringUtils.substringBeforeLast(facilities, "本段合作编辑者");
}
}
@@ -189,7 +189,7 @@ public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("city", city);
ret.put("name", name);
// 某些城市板块也可能是区域
// 某些城市板块也可能是区域
if (regionBlockDao.isRegion(city, region)) {
ret.put("region", regionBlockDao.formatRegion(city, region));
} else if (regionBlockDao.isRegion(city, block)) {
@@ -245,22 +245,22 @@ public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
ret.put("other_info", otherInfo);
if (estateType != null) {
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1
&& estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
errors.add("类型不正确,不是小区类型");
return new AnalyResult(errors);
}
@@ -275,7 +275,7 @@ public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> removeKeys = new ArrayList<String>();
for (String key : dbo.keySet()) {
Object s = dbo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
removeKeys.add(key);
}
}
@@ -289,7 +289,7 @@ public class SoufunDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> okeys = new ArrayList<String>();
for (String key : otherInfo.keySet()) {
Object s = otherInfo.get(key);
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
if (s == null || "".equals(s) || s.toString().startsWith("暂无资料") || s.equals("暂无")) {
okeys.add(key);
}
}
@@ -17,7 +17,7 @@ import com.fangjia.coredata.util.JQueryUtil;
import com.fangjia.mongo.dao.RegionBlockDao;
/**
* 淘房网详情页解析
* 淘房网详情页解析
*
* @author xiaoyu
*
@@ -25,8 +25,8 @@ import com.fangjia.mongo.dao.RegionBlockDao;
@CATEGORY(value = CategoryEnum.DISTRICT)
@SITENAME(value = "淘房网")
@PAGENAME(value = "详情页")
@SITENAME(value = "淘房网")
@PAGENAME(value = "详情页")
public class TaofangDistrictDetailAnalyImpl implements AnalyzerInterface {
private RegionBlockDao regionBlockDao = RegionBlockDao.getInstance();
@@ -35,9 +35,9 @@ public class TaofangDistrictDetailAnalyImpl implements AnalyzerInterface {
// TaofangDistrictDetailAnalyImpl sd = new TaofangDistrictDetailAnalyImpl();
// AnalyResult res = sd.analy(webpage.getId(), webpage.getCity(), webpage.getContent());
//
// Map<String, Object> poiMap = AddressPOI.parseAddress((String) res.getResults().get("address"), "广州", 3);
// Map<String, Object> poiMap = AddressPOI.parseAddress((String) res.getResults().get("address"), "广州", 3);
// if (poiMap == null || poiMap.size() == 0) {
// poiMap = AddressPOI.parseAddress((String) res.getResults().get("name"), "北京", 3);
// poiMap = AddressPOI.parseAddress((String) res.getResults().get("name"), "北京", 3);
// }
// System.out.println(poiMap);
}
@@ -47,12 +47,12 @@ public class TaofangDistrictDetailAnalyImpl implements AnalyzerInterface {
List<String> errors = new ArrayList<String>();
String name = JQueryUtil.selectText(new String[] { "h1" }, content).trim();
String region = JQueryUtil.selectText(new String[] { ".crumbs a:eq(4)" }, content).replace("小区", "").trim();
String address = JQueryUtil.selectText(new String[] { ".main-left p:contains(查看周边地图)" }, content).replace("(查看周边地图)", "")
.replace("地  址:", "").trim();
String region = JQueryUtil.selectText(new String[] { ".crumbs a:eq(4)" }, content).replace("小区", "").trim();
String address = JQueryUtil.selectText(new String[] { ".main-left p:contains(查看周边地图)" }, content).replace("(查看周边地图)", "")
.replace("地  址:", "").trim();
if (StringUtils.isBlank(city) || StringUtils.isBlank(region) || StringUtils.isBlank(name) || StringUtils.isBlank(address)) {
errors.add("city||region||name||address解析不到");
errors.add("city||region||name||address解析不到");
return new AnalyResult(errors);
}
@@ -4,14 +4,14 @@ import java.util.Date;
public class FileDatasTotalityBo {
private String id;
private Integer category;//类型:1:测试抽样 2:项目数据 3:其它问题
private Integer category;//类型:1:测试抽样 2:项目数据 3:其它问题
private String fileName;
private String oldFileName;//原文件名称
private Date creationDate;// 创建时间
private Date modificationDate;// 更新时间
private Integer status;//处理状态 0:上传成功 1:分析中 2:完成 3:失败 4:人工调查
private Integer total;//总数
private Integer failTotal;//失败总数
private String oldFileName;//原文件名称
private Date creationDate;// 创建时间
private Date modificationDate;// 更新时间
private Integer status;//处理状态 0:上传成功 1:分析中 2:完成 3:失败 4:人工调查
private Integer total;//总数
private Integer failTotal;//失败总数
private String userId;
private Integer mathcPrecent;
@@ -9,15 +9,15 @@ public class PriceAnalyBo {
private Integer avgPrice;
private Integer peoplePrice;
private Integer halfYearCount;//近半年样本量
private double halfYearPeoplePricePecent;//近半年符合人工调查分析样本量
private double halfYearMachinePricePecent;//近半年符合计算分析样本量
private Integer halfYearCount;//近半年样本量
private double halfYearPeoplePricePecent;//近半年符合人工调查分析样本量
private double halfYearMachinePricePecent;//近半年符合计算分析样本量
private Integer historyCount;//历史所有
private Integer historyCount;//历史所有
private double historyPeoplePricePecent;
private double historyMachinePricePecent;
private Integer oneMonthCount;//近一个月
private Integer oneMonthCount;//近一个月
private double oneMonthPeoplePricePecent;
private double oneMonthMachinePricePecent;
public String getCity() {
@@ -7,11 +7,11 @@ public class SeedsBo {
private String url;
private String city;
private int count;
private String parentId;// 关联到website表
private String parentId;// 关联到website表
private double score;
private int status;// 网站完成状态
private Date creationDate;// 创建时间
private Date modificationDate;// 更新时间
private int status;// 网站完成状态
private Date creationDate;// 创建时间
private Date modificationDate;// 更新时间
private String category;
private String scope;
@@ -19,7 +19,7 @@ public class WebsiteBo {
private String remark;
private String pinyin;
private int status;
private double score;//评分
private double score;//评分
private int seedTotalCount;
private int successCount;
private String city;
@@ -10,7 +10,7 @@ import java.util.List;
/**
* 地址分析平台相关工具
* 地址分析平台相关工具
* Created by hubingliang on 2017/1/4.
*/
public class AddressAnalyUtils {
@@ -31,7 +31,7 @@ public class AddressAnalyUtils {
}
/**
* 对地址的完整性以及准确性进行评级
* 对地址的完整性以及准确性进行评级
* @param data
* @return
*/
@@ -29,9 +29,9 @@ public class AddressPOI {
private static Map<String, String> CITY_CODE_MAP = new HashMap<String, String>();
public static void main(String[] args) throws Exception {
// Map<String, Object> ret = parseAddress("中山西路68号", "深圳", 6);
// Map<String, Object> ret = parseAddress("中山西路68号", "深圳", 6);
// System.out.println(ret);
Map<String, Object> res = parseDistrictBaidu("香江公馆", "瑞安", 6);
Map<String, Object> res = parseDistrictBaidu("香江公馆", "瑞安", 6);
if (res != null && res.get("lat") != null) {
String region = parseRegion((Double) res.get("lat"), (Double) res.get("lng"), 6);
System.out.println(region);
@@ -95,7 +95,7 @@ public class AddressPOI {
return null;
}
public static final String[] DISTRICT_TAGS = new String[] { "住宅", "公寓", "别墅", "小区" };
public static final String[] DISTRICT_TAGS = new String[] { "住宅", "公寓", "别墅", "小区" };
@SuppressWarnings("unchecked")
public static Map<String, Object> parseDistrictBaidu(String address, String city, int retryTimes) throws Exception {
@@ -291,389 +291,389 @@ public class AddressPOI {
}
static {
CITY_CODE_MAP.put("北京", "010");
CITY_CODE_MAP.put("广州", "020");
CITY_CODE_MAP.put("重庆", "023");
CITY_CODE_MAP.put("北京", "010");
CITY_CODE_MAP.put("广州", "020");
CITY_CODE_MAP.put("重庆", "023");
CITY_CODE_MAP.put("南京", "025");
CITY_CODE_MAP.put("南京", "025");
CITY_CODE_MAP.put("武汉", "027");
CITY_CODE_MAP.put("武汉", "027");
CITY_CODE_MAP.put("成都", "028");
CITY_CODE_MAP.put("成都", "028");
CITY_CODE_MAP.put("保定", "0312");
CITY_CODE_MAP.put("保定", "0312");
CITY_CODE_MAP.put("承德", "0314");
CITY_CODE_MAP.put("承德", "0314");
CITY_CODE_MAP.put("唐山", "0315");
CITY_CODE_MAP.put("唐山", "0315");
CITY_CODE_MAP.put("廊坊", "0316");
CITY_CODE_MAP.put("廊坊", "0316");
CITY_CODE_MAP.put("秦皇岛", "0335");
CITY_CODE_MAP.put("秦皇岛", "0335");
CITY_CODE_MAP.put("新乡", "0373");
CITY_CODE_MAP.put("新乡", "0373");
CITY_CODE_MAP.put("洛阳", "0379");
CITY_CODE_MAP.put("洛阳", "0379");
CITY_CODE_MAP.put("大连", "0411");
CITY_CODE_MAP.put("大连", "0411");
CITY_CODE_MAP.put("鞍山", "0412");
CITY_CODE_MAP.put("鞍山", "0412");
CITY_CODE_MAP.put("抚顺", "0413");
CITY_CODE_MAP.put("抚顺", "0413");
CITY_CODE_MAP.put("本溪", "0414");
CITY_CODE_MAP.put("丹东", "0415");
CITY_CODE_MAP.put("辽阳", "0419");
CITY_CODE_MAP.put("葫芦岛", "0429");
CITY_CODE_MAP.put("长春", "0431");
CITY_CODE_MAP.put("哈尔滨", "0451");
CITY_CODE_MAP.put("佳木斯", "0454");
CITY_CODE_MAP.put("包头", "0472");
CITY_CODE_MAP.put("镇江", "0511");
CITY_CODE_MAP.put("苏州", "0512");
CITY_CODE_MAP.put("昆山", "0512");
CITY_CODE_MAP.put("南通", "0513");
CITY_CODE_MAP.put("扬州", "0514");
CITY_CODE_MAP.put("徐州", "0516");
CITY_CODE_MAP.put("常州", "0519");
CITY_CODE_MAP.put("济南", "0531");
CITY_CODE_MAP.put("青岛", "0532");
CITY_CODE_MAP.put("蚌埠", "0552");
CITY_CODE_MAP.put("黄山", "0559");
CITY_CODE_MAP.put("杭州", "0571");
CITY_CODE_MAP.put("湖州", "0572");
CITY_CODE_MAP.put("台州", "0576");
CITY_CODE_MAP.put("温州", "0577");
CITY_CODE_MAP.put("福州", "0591");
CITY_CODE_MAP.put("厦门", "0592");
CITY_CODE_MAP.put("宁德", "0593");
CITY_CODE_MAP.put("莆田", "0594");
CITY_CODE_MAP.put("泉州", "0595");
CITY_CODE_MAP.put("漳州", "0596");
CITY_CODE_MAP.put("威海", "0631");
CITY_CODE_MAP.put("汕尾", "0660");
CITY_CODE_MAP.put("汕尾岛", "0660");
CITY_CODE_MAP.put("阳江", "0662");
CITY_CODE_MAP.put("揭阳", "0663");
CITY_CODE_MAP.put("茂名", "0668");
CITY_CODE_MAP.put("襄阳", "0710");
CITY_CODE_MAP.put("黄石", "0714");
CITY_CODE_MAP.put("宜昌", "0717");
CITY_CODE_MAP.put("十堰", "0719");
CITY_CODE_MAP.put("荆门", "0724");
CITY_CODE_MAP.put("岳阳", "0730");
CITY_CODE_MAP.put("长沙", "0731");
CITY_CODE_MAP.put("湘潭", "0732");
CITY_CODE_MAP.put("株洲", "0733");
CITY_CODE_MAP.put("常德", "0736");
CITY_CODE_MAP.put("江门", "0750");
CITY_CODE_MAP.put("汕头", "0754");
CITY_CODE_MAP.put("深圳", "0755");
CITY_CODE_MAP.put("珠海", "0756");
CITY_CODE_MAP.put("湛江", "0759");
CITY_CODE_MAP.put("中山", "0760");
CITY_CODE_MAP.put("防城港", "0770");
CITY_CODE_MAP.put("南宁", "0771");
CITY_CODE_MAP.put("桂林", "0773");
CITY_CODE_MAP.put("北海", "0779");
CITY_CODE_MAP.put("南昌", "0791");
CITY_CODE_MAP.put("九江", "0792");
CITY_CODE_MAP.put("景德镇", "0798");
CITY_CODE_MAP.put("自贡", "0813");
CITY_CODE_MAP.put("泸州", "0830");
CITY_CODE_MAP.put("宜宾", "0831");
CITY_CODE_MAP.put("内江", "01832");
CITY_CODE_MAP.put("眉山", "0833");
CITY_CODE_MAP.put("贵阳", "0851");
CITY_CODE_MAP.put("三亚", "0899");
CITY_CODE_MAP.put("咸阳", "0910");
CITY_CODE_MAP.put("延安", "0911");
CITY_CODE_MAP.put("延边朝鲜族自治州", "0433");
CITY_CODE_MAP.put("七台河", "0464");
CITY_CODE_MAP.put("三明", "0598");
CITY_CODE_MAP.put("三门峡", "0398");
CITY_CODE_MAP.put("上海", "021");
CITY_CODE_MAP.put("上饶", "0793");
CITY_CODE_MAP.put("东莞", "0769");
CITY_CODE_MAP.put("东营", "0546");
CITY_CODE_MAP.put("中卫", "01953");
CITY_CODE_MAP.put("临夏回族自治州", "0930");
CITY_CODE_MAP.put("临汾", "0357");
CITY_CODE_MAP.put("临沂", "0539");
CITY_CODE_MAP.put("丽水", "0578");
CITY_CODE_MAP.put("乌兰察布", "0474");
CITY_CODE_MAP.put("乌海", "0473");
CITY_CODE_MAP.put("乌鲁木齐", "0991");
CITY_CODE_MAP.put("乐山", "0833");
CITY_CODE_MAP.put("云浮", "0766");
CITY_CODE_MAP.put("亳州", "0558");
CITY_CODE_MAP.put("仙桃", "0728");
CITY_CODE_MAP.put("伊春", "0458");
CITY_CODE_MAP.put("伊犁哈萨克自治州", "0999");
CITY_CODE_MAP.put("佛山", "0757");
CITY_CODE_MAP.put("信阳", "0376");
CITY_CODE_MAP.put("克拉玛依", "0990");
CITY_CODE_MAP.put("六安", "0564");
CITY_CODE_MAP.put("兰州", "0931");
CITY_CODE_MAP.put("兴安盟", "0482");
CITY_CODE_MAP.put("凉山彝族自治州", "0834");
CITY_CODE_MAP.put("南充", "0817");
CITY_CODE_MAP.put("南平", "0599");
CITY_CODE_MAP.put("南阳", "0377");
CITY_CODE_MAP.put("博尔塔拉蒙古自治州", "0909");
CITY_CODE_MAP.put("双鸭山", "0469");
CITY_CODE_MAP.put("合肥", "0551");
CITY_CODE_MAP.put("吉安", "0796");
CITY_CODE_MAP.put("吉林", "0432");
CITY_CODE_MAP.put("吐鲁番地区", "0995");
CITY_CODE_MAP.put("吕梁", "0358");
CITY_CODE_MAP.put("吴忠", "0953");
CITY_CODE_MAP.put("周口", "0394");
CITY_CODE_MAP.put("呼伦贝尔", "0470");
CITY_CODE_MAP.put("呼和浩特", "0471");
CITY_CODE_MAP.put("咸宁", "0715");
CITY_CODE_MAP.put("商丘", "0370");
CITY_CODE_MAP.put("商洛", "0914");
CITY_CODE_MAP.put("嘉兴", "0573");
CITY_CODE_MAP.put("四平", "0434");
CITY_CODE_MAP.put("塔城地区", "0901");
CITY_CODE_MAP.put("大兴安岭地区", "0457");
CITY_CODE_MAP.put("大同", "0352");
CITY_CODE_MAP.put("大庆", "0459");
CITY_CODE_MAP.put("大理白族自治州", "0872");
CITY_CODE_MAP.put("天水", "0938");
CITY_CODE_MAP.put("天津", "022");
CITY_CODE_MAP.put("天门", "01728");
CITY_CODE_MAP.put("太原", "0351");
CITY_CODE_MAP.put("娄底", "0738");
CITY_CODE_MAP.put("孝感", "0712");
CITY_CODE_MAP.put("宁波", "0574");
CITY_CODE_MAP.put("安庆", "0556");
CITY_CODE_MAP.put("安康", "0915");
CITY_CODE_MAP.put("安阳", "0372");
CITY_CODE_MAP.put("安顺", "0853");
CITY_CODE_MAP.put("定西", "0932");
CITY_CODE_MAP.put("宜春", "0795");
CITY_CODE_MAP.put("宝鸡", "0917");
CITY_CODE_MAP.put("宣城", "0563");
CITY_CODE_MAP.put("宿州", "0557");
CITY_CODE_MAP.put("宿迁", "0527");
CITY_CODE_MAP.put("山南地区", "0893");
CITY_CODE_MAP.put("崇左", "01771");
CITY_CODE_MAP.put("巢湖", "0565");
CITY_CODE_MAP.put("巴中", "0827");
CITY_CODE_MAP.put("平凉", "0933");
CITY_CODE_MAP.put("平顶山", "0375");
CITY_CODE_MAP.put("广元", "0839");
CITY_CODE_MAP.put("广安", "0826");
CITY_CODE_MAP.put("庆阳", "0934");
CITY_CODE_MAP.put("开封", "0378");
CITY_CODE_MAP.put("张家口", "0313");
CITY_CODE_MAP.put("张家界", "0744");
CITY_CODE_MAP.put("张掖", "0936");
CITY_CODE_MAP.put("德州", "0534");
CITY_CODE_MAP.put("德阳", "0838");
CITY_CODE_MAP.put("忻州", "0350");
CITY_CODE_MAP.put("怀化", "0745");
CITY_CODE_MAP.put("恩施土家族苗族自治州", "0718");
CITY_CODE_MAP.put("惠州", "0752");
CITY_CODE_MAP.put("抚州", "0794");
CITY_CODE_MAP.put("拉萨", "0891");
CITY_CODE_MAP.put("攀枝花", "0812");
CITY_CODE_MAP.put("新余", "0790");
CITY_CODE_MAP.put("无锡", "0510");
CITY_CODE_MAP.put("日喀则地区", "0892");
CITY_CODE_MAP.put("日照", "0633");
CITY_CODE_MAP.put("昆明", "0871");
CITY_CODE_MAP.put("昌吉回族自治州", "0994");
CITY_CODE_MAP.put("昭通", "0870");
CITY_CODE_MAP.put("晋中", "0354");
CITY_CODE_MAP.put("晋城", "0356");
CITY_CODE_MAP.put("曲靖", "0874");
CITY_CODE_MAP.put("朔州", "0349");
CITY_CODE_MAP.put("朝阳", "0421");
CITY_CODE_MAP.put("来宾", "01772");
CITY_CODE_MAP.put("松原", "0438");
CITY_CODE_MAP.put("枣庄", "0632");
CITY_CODE_MAP.put("柳州", "0772");
CITY_CODE_MAP.put("梅州", "0753");
CITY_CODE_MAP.put("梧州", "0774");
CITY_CODE_MAP.put("楚雄彝族自治州", "0878");
CITY_CODE_MAP.put("榆林", "0912");
CITY_CODE_MAP.put("武威", "01935");
CITY_CODE_MAP.put("毕节地区", "0857");
CITY_CODE_MAP.put("永州", "0746");
CITY_CODE_MAP.put("汉中", "0916");
CITY_CODE_MAP.put("池州", "0566");
CITY_CODE_MAP.put("沈阳", "024");
CITY_CODE_MAP.put("沧州", "0317");
CITY_CODE_MAP.put("河池", "0778");
CITY_CODE_MAP.put("河源", "0762");
CITY_CODE_MAP.put("泰安", "0538");
CITY_CODE_MAP.put("泰州", "0523");
CITY_CODE_MAP.put("济宁", "0537");
CITY_CODE_MAP.put("济源", "01391");
CITY_CODE_MAP.put("海东地区", "0972");
CITY_CODE_MAP.put("海北藏族自治州", "0970");
CITY_CODE_MAP.put("海南藏族自治州", "0974");
CITY_CODE_MAP.put("海口", "0898");
CITY_CODE_MAP.put("淄博", "0533");
CITY_CODE_MAP.put("淮北", "0561");
CITY_CODE_MAP.put("淮南", "0554");
CITY_CODE_MAP.put("淮安", "0517");
CITY_CODE_MAP.put("清远", "0763");
CITY_CODE_MAP.put("渭南", "0913");
CITY_CODE_MAP.put("湘西土家族苗族自治州", "0743");
CITY_CODE_MAP.put("滁州", "0550");
CITY_CODE_MAP.put("滨州", "0543");
CITY_CODE_MAP.put("漯河", "0395");
CITY_CODE_MAP.put("潍坊", "0536");
CITY_CODE_MAP.put("潜江", "02728");
CITY_CODE_MAP.put("潮州", "0768");
CITY_CODE_MAP.put("濮阳", "0393");
CITY_CODE_MAP.put("烟台", "0535");
CITY_CODE_MAP.put("焦作", "0391");
CITY_CODE_MAP.put("牡丹江", "0453");
CITY_CODE_MAP.put("玉林", "0775");
CITY_CODE_MAP.put("玉溪", "0877");
CITY_CODE_MAP.put("甘孜藏族自治州", "0836");
CITY_CODE_MAP.put("白城", "0436");
CITY_CODE_MAP.put("白山", "0439");
CITY_CODE_MAP.put("白银", "0943");
CITY_CODE_MAP.put("益阳", "0737");
CITY_CODE_MAP.put("盐城", "0515");
CITY_CODE_MAP.put("盘锦", "0427");
CITY_CODE_MAP.put("石嘴山", "0952");
CITY_CODE_MAP.put("石家庄", "0311");
CITY_CODE_MAP.put("石河子", "0993");
CITY_CODE_MAP.put("神农架林区", "01719");
CITY_CODE_MAP.put("红河哈尼族彝族自治州", "0873");
CITY_CODE_MAP.put("绍兴", "0575");
CITY_CODE_MAP.put("绥化", "0455");
CITY_CODE_MAP.put("绵阳", "0816");
CITY_CODE_MAP.put("聊城", "0635");
CITY_CODE_MAP.put("肇庆", "0758");
CITY_CODE_MAP.put("舟山", "0580");
CITY_CODE_MAP.put("芜湖", "0553");
CITY_CODE_MAP.put("荆州", "0716");
CITY_CODE_MAP.put("莱芜", "0634");
CITY_CODE_MAP.put("菏泽", "0530");
CITY_CODE_MAP.put("萍乡", "0799");
CITY_CODE_MAP.put("营口", "0417");
CITY_CODE_MAP.put("衡水", "0318");
CITY_CODE_MAP.put("衡阳", "0734");
CITY_CODE_MAP.put("衢州", "0570");
CITY_CODE_MAP.put("西双版纳傣族自治州", "0691");
CITY_CODE_MAP.put("西宁", "0971");
CITY_CODE_MAP.put("西安", "029");
CITY_CODE_MAP.put("许昌", "0374");
CITY_CODE_MAP.put("贵港", "01755");
CITY_CODE_MAP.put("贺州", "01774");
CITY_CODE_MAP.put("资阳", "0832");
CITY_CODE_MAP.put("赣州", "0797");
CITY_CODE_MAP.put("赤峰", "0476");
CITY_CODE_MAP.put("辽源", "0437");
CITY_CODE_MAP.put("达州", "0818");
CITY_CODE_MAP.put("运城", "0359");
CITY_CODE_MAP.put("连云港", "0518");
CITY_CODE_MAP.put("通化", "0435");
CITY_CODE_MAP.put("通辽", "0475");
CITY_CODE_MAP.put("遂宁", "0825");
CITY_CODE_MAP.put("遵义", "0852");
CITY_CODE_MAP.put("邢台", "0319");
CITY_CODE_MAP.put("邯郸", "0310");
CITY_CODE_MAP.put("邵阳", "0739");
CITY_CODE_MAP.put("郑州", "0371");
CITY_CODE_MAP.put("郴州", "0735");
CITY_CODE_MAP.put("鄂尔多斯", "0477");
CITY_CODE_MAP.put("鄂州", "0711");
CITY_CODE_MAP.put("酒泉", "0937");
CITY_CODE_MAP.put("金华", "0579");
CITY_CODE_MAP.put("金昌", "0935");
CITY_CODE_MAP.put("钦州", "0777");
CITY_CODE_MAP.put("铁岭", "0410");
CITY_CODE_MAP.put("铜仁地区", "0856");
CITY_CODE_MAP.put("铜川", "0919");
CITY_CODE_MAP.put("铜陵", "0562");
CITY_CODE_MAP.put("银川", "0951");
CITY_CODE_MAP.put("锦州", "0416");
CITY_CODE_MAP.put("长治", "0355");
CITY_CODE_MAP.put("阜新", "0418");
CITY_CODE_MAP.put("阜阳", "01558");
CITY_CODE_MAP.put("阳泉", "0353");
CITY_CODE_MAP.put("阿坝藏族羌族自治州", "0837");
CITY_CODE_MAP.put("陇南", "02935");
CITY_CODE_MAP.put("随州", "0722");
CITY_CODE_MAP.put("雅安", "0835");
CITY_CODE_MAP.put("韶关", "0751");
CITY_CODE_MAP.put("马鞍山", "0555");
CITY_CODE_MAP.put("驻马店", "0396");
CITY_CODE_MAP.put("鸡西", "0467");
CITY_CODE_MAP.put("鹤壁", "0392");
CITY_CODE_MAP.put("鹤岗", "0468");
CITY_CODE_MAP.put("鹰潭", "0701");
CITY_CODE_MAP.put("黄冈", "0713");
CITY_CODE_MAP.put("黑河", "0456");
CITY_CODE_MAP.put("黔东南苗族侗族自治州", "0855");
CITY_CODE_MAP.put("黔南布依族苗族自治州", "0854");
CITY_CODE_MAP.put("齐齐哈尔", "0452");
CITY_CODE_MAP.put("龙岩", "0597");
CITY_CODE_MAP.put("甘南藏族自治州", "0941");
CITY_CODE_MAP.put("嘉峪关", "1937");
CITY_CODE_MAP.put("百色", "0776");
CITY_CODE_MAP.put("六盘水", "0858");
CITY_CODE_MAP.put("黔西南布依族苗族自治州", "0859");
CITY_CODE_MAP.put("白沙黎族自治县", "0802");
CITY_CODE_MAP.put("保亭黎族苗族自治县", "0801");
CITY_CODE_MAP.put("昌江黎族自治县", "0803");
CITY_CODE_MAP.put("澄迈县", "0804");
CITY_CODE_MAP.put("定安县", "0806");
CITY_CODE_MAP.put("东方", "0807");
CITY_CODE_MAP.put("东沙群岛", "0808");
CITY_CODE_MAP.put("乐东黎族自治县", "2802");
CITY_CODE_MAP.put("临高县", "1896");
CITY_CODE_MAP.put("陵水黎族自治县", "0809");
CITY_CODE_MAP.put("南沙群岛", "1891");
CITY_CODE_MAP.put("琼海", "1894");
CITY_CODE_MAP.put("琼中黎族苗族自治县", "1899");
CITY_CODE_MAP.put("屯昌县", "1892");
CITY_CODE_MAP.put("万宁", "1898");
CITY_CODE_MAP.put("文昌", "1893");
CITY_CODE_MAP.put("五指山", "1897");
CITY_CODE_MAP.put("西沙群岛", "1895");
CITY_CODE_MAP.put("中沙群岛", "2801");
CITY_CODE_MAP.put("儋州", "0805");
CITY_CODE_MAP.put("阿拉善盟", "0483");
CITY_CODE_MAP.put("巴彦淖尔市", "0478");
CITY_CODE_MAP.put("锡林郭勒盟", "0479");
CITY_CODE_MAP.put("固原", "0954");
CITY_CODE_MAP.put("果洛藏族自治州", "0975");
CITY_CODE_MAP.put("海西蒙古族藏族自治州", "0977");
CITY_CODE_MAP.put("黄南藏族自治州", "0973");
CITY_CODE_MAP.put("玉树藏族自治州", "0976");
CITY_CODE_MAP.put("阿里地区", "0897");
CITY_CODE_MAP.put("昌都地区", "0895");
CITY_CODE_MAP.put("林芝地区", "0894");
CITY_CODE_MAP.put("那曲地区", "0896");
CITY_CODE_MAP.put("阿克苏地区", "0997");
CITY_CODE_MAP.put("阿勒泰地区", "0906");
CITY_CODE_MAP.put("巴音郭楞蒙古自治州", "0996");
CITY_CODE_MAP.put("哈密地区", "0902");
CITY_CODE_MAP.put("和田地区", "0903");
CITY_CODE_MAP.put("喀什地区", "0998");
CITY_CODE_MAP.put("克孜勒苏柯尔克孜自治州", "0908");
CITY_CODE_MAP.put("保山", "0875");
CITY_CODE_MAP.put("德宏傣族景颇族自治州", "0692");
CITY_CODE_MAP.put("迪庆藏族自治州", "0887");
CITY_CODE_MAP.put("丽江", "0888");
CITY_CODE_MAP.put("临沧市", "0883");
CITY_CODE_MAP.put("怒江傈僳族自治州", "0886");
CITY_CODE_MAP.put("普洱", "0879");
CITY_CODE_MAP.put("文山壮族苗族自治州", "0876");
CITY_CODE_MAP.put("香港", "1852");
CITY_CODE_MAP.put("澳门", "1853");
CITY_CODE_MAP.put("五家渠市", "652300");
CITY_CODE_MAP.put("阿拉尔市", "652900");
CITY_CODE_MAP.put("图木舒克市", "653000");
CITY_CODE_MAP.put("本溪", "0414");
CITY_CODE_MAP.put("丹东", "0415");
CITY_CODE_MAP.put("辽阳", "0419");
CITY_CODE_MAP.put("葫芦岛", "0429");
CITY_CODE_MAP.put("长春", "0431");
CITY_CODE_MAP.put("哈尔滨", "0451");
CITY_CODE_MAP.put("佳木斯", "0454");
CITY_CODE_MAP.put("包头", "0472");
CITY_CODE_MAP.put("镇江", "0511");
CITY_CODE_MAP.put("苏州", "0512");
CITY_CODE_MAP.put("昆山", "0512");
CITY_CODE_MAP.put("南通", "0513");
CITY_CODE_MAP.put("扬州", "0514");
CITY_CODE_MAP.put("徐州", "0516");
CITY_CODE_MAP.put("常州", "0519");
CITY_CODE_MAP.put("济南", "0531");
CITY_CODE_MAP.put("青岛", "0532");
CITY_CODE_MAP.put("蚌埠", "0552");
CITY_CODE_MAP.put("黄山", "0559");
CITY_CODE_MAP.put("杭州", "0571");
CITY_CODE_MAP.put("湖州", "0572");
CITY_CODE_MAP.put("台州", "0576");
CITY_CODE_MAP.put("温州", "0577");
CITY_CODE_MAP.put("福州", "0591");
CITY_CODE_MAP.put("厦门", "0592");
CITY_CODE_MAP.put("宁德", "0593");
CITY_CODE_MAP.put("莆田", "0594");
CITY_CODE_MAP.put("泉州", "0595");
CITY_CODE_MAP.put("漳州", "0596");
CITY_CODE_MAP.put("威海", "0631");
CITY_CODE_MAP.put("汕尾", "0660");
CITY_CODE_MAP.put("汕尾岛", "0660");
CITY_CODE_MAP.put("阳江", "0662");
CITY_CODE_MAP.put("揭阳", "0663");
CITY_CODE_MAP.put("茂名", "0668");
CITY_CODE_MAP.put("襄阳", "0710");
CITY_CODE_MAP.put("黄石", "0714");
CITY_CODE_MAP.put("宜昌", "0717");
CITY_CODE_MAP.put("十堰", "0719");
CITY_CODE_MAP.put("荆门", "0724");
CITY_CODE_MAP.put("岳阳", "0730");
CITY_CODE_MAP.put("长沙", "0731");
CITY_CODE_MAP.put("湘潭", "0732");
CITY_CODE_MAP.put("株洲", "0733");
CITY_CODE_MAP.put("常德", "0736");
CITY_CODE_MAP.put("江门", "0750");
CITY_CODE_MAP.put("汕头", "0754");
CITY_CODE_MAP.put("深圳", "0755");
CITY_CODE_MAP.put("珠海", "0756");
CITY_CODE_MAP.put("湛江", "0759");
CITY_CODE_MAP.put("中山", "0760");
CITY_CODE_MAP.put("防城港", "0770");
CITY_CODE_MAP.put("南宁", "0771");
CITY_CODE_MAP.put("桂林", "0773");
CITY_CODE_MAP.put("北海", "0779");
CITY_CODE_MAP.put("南昌", "0791");
CITY_CODE_MAP.put("九江", "0792");
CITY_CODE_MAP.put("景德镇", "0798");
CITY_CODE_MAP.put("自贡", "0813");
CITY_CODE_MAP.put("泸州", "0830");
CITY_CODE_MAP.put("宜宾", "0831");
CITY_CODE_MAP.put("内江", "01832");
CITY_CODE_MAP.put("眉山", "0833");
CITY_CODE_MAP.put("贵阳", "0851");
CITY_CODE_MAP.put("三亚", "0899");
CITY_CODE_MAP.put("咸阳", "0910");
CITY_CODE_MAP.put("延安", "0911");
CITY_CODE_MAP.put("延边朝鲜族自治州", "0433");
CITY_CODE_MAP.put("七台河", "0464");
CITY_CODE_MAP.put("三明", "0598");
CITY_CODE_MAP.put("三门峡", "0398");
CITY_CODE_MAP.put("上海", "021");
CITY_CODE_MAP.put("上饶", "0793");
CITY_CODE_MAP.put("东莞", "0769");
CITY_CODE_MAP.put("东营", "0546");
CITY_CODE_MAP.put("中卫", "01953");
CITY_CODE_MAP.put("临夏回族自治州", "0930");
CITY_CODE_MAP.put("临汾", "0357");
CITY_CODE_MAP.put("临沂", "0539");
CITY_CODE_MAP.put("丽水", "0578");
CITY_CODE_MAP.put("乌兰察布", "0474");
CITY_CODE_MAP.put("乌海", "0473");
CITY_CODE_MAP.put("乌鲁木齐", "0991");
CITY_CODE_MAP.put("乐山", "0833");
CITY_CODE_MAP.put("云浮", "0766");
CITY_CODE_MAP.put("亳州", "0558");
CITY_CODE_MAP.put("仙桃", "0728");
CITY_CODE_MAP.put("伊春", "0458");
CITY_CODE_MAP.put("伊犁哈萨克自治州", "0999");
CITY_CODE_MAP.put("佛山", "0757");
CITY_CODE_MAP.put("信阳", "0376");
CITY_CODE_MAP.put("克拉玛依", "0990");
CITY_CODE_MAP.put("六安", "0564");
CITY_CODE_MAP.put("兰州", "0931");
CITY_CODE_MAP.put("兴安盟", "0482");
CITY_CODE_MAP.put("凉山彝族自治州", "0834");
CITY_CODE_MAP.put("南充", "0817");
CITY_CODE_MAP.put("南平", "0599");
CITY_CODE_MAP.put("南阳", "0377");
CITY_CODE_MAP.put("博尔塔拉蒙古自治州", "0909");
CITY_CODE_MAP.put("双鸭山", "0469");
CITY_CODE_MAP.put("合肥", "0551");
CITY_CODE_MAP.put("吉安", "0796");
CITY_CODE_MAP.put("吉林", "0432");
CITY_CODE_MAP.put("吐鲁番地区", "0995");
CITY_CODE_MAP.put("吕梁", "0358");
CITY_CODE_MAP.put("吴忠", "0953");
CITY_CODE_MAP.put("周口", "0394");
CITY_CODE_MAP.put("呼伦贝尔", "0470");
CITY_CODE_MAP.put("呼和浩特", "0471");
CITY_CODE_MAP.put("咸宁", "0715");
CITY_CODE_MAP.put("商丘", "0370");
CITY_CODE_MAP.put("商洛", "0914");
CITY_CODE_MAP.put("嘉兴", "0573");
CITY_CODE_MAP.put("四平", "0434");
CITY_CODE_MAP.put("塔城地区", "0901");
CITY_CODE_MAP.put("大兴安岭地区", "0457");
CITY_CODE_MAP.put("大同", "0352");
CITY_CODE_MAP.put("大庆", "0459");
CITY_CODE_MAP.put("大理白族自治州", "0872");
CITY_CODE_MAP.put("天水", "0938");
CITY_CODE_MAP.put("天津", "022");
CITY_CODE_MAP.put("天门", "01728");
CITY_CODE_MAP.put("太原", "0351");
CITY_CODE_MAP.put("娄底", "0738");
CITY_CODE_MAP.put("孝感", "0712");
CITY_CODE_MAP.put("宁波", "0574");
CITY_CODE_MAP.put("安庆", "0556");
CITY_CODE_MAP.put("安康", "0915");
CITY_CODE_MAP.put("安阳", "0372");
CITY_CODE_MAP.put("安顺", "0853");
CITY_CODE_MAP.put("定西", "0932");
CITY_CODE_MAP.put("宜春", "0795");
CITY_CODE_MAP.put("宝鸡", "0917");
CITY_CODE_MAP.put("宣城", "0563");
CITY_CODE_MAP.put("宿州", "0557");
CITY_CODE_MAP.put("宿迁", "0527");
CITY_CODE_MAP.put("山南地区", "0893");
CITY_CODE_MAP.put("崇左", "01771");
CITY_CODE_MAP.put("巢湖", "0565");
CITY_CODE_MAP.put("巴中", "0827");
CITY_CODE_MAP.put("平凉", "0933");
CITY_CODE_MAP.put("平顶山", "0375");
CITY_CODE_MAP.put("广元", "0839");
CITY_CODE_MAP.put("广安", "0826");
CITY_CODE_MAP.put("庆阳", "0934");
CITY_CODE_MAP.put("开封", "0378");
CITY_CODE_MAP.put("张家口", "0313");
CITY_CODE_MAP.put("张家界", "0744");
CITY_CODE_MAP.put("张掖", "0936");
CITY_CODE_MAP.put("德州", "0534");
CITY_CODE_MAP.put("德阳", "0838");
CITY_CODE_MAP.put("忻州", "0350");
CITY_CODE_MAP.put("怀化", "0745");
CITY_CODE_MAP.put("恩施土家族苗族自治州", "0718");
CITY_CODE_MAP.put("惠州", "0752");
CITY_CODE_MAP.put("抚州", "0794");
CITY_CODE_MAP.put("拉萨", "0891");
CITY_CODE_MAP.put("攀枝花", "0812");
CITY_CODE_MAP.put("新余", "0790");
CITY_CODE_MAP.put("无锡", "0510");
CITY_CODE_MAP.put("日喀则地区", "0892");
CITY_CODE_MAP.put("日照", "0633");
CITY_CODE_MAP.put("昆明", "0871");
CITY_CODE_MAP.put("昌吉回族自治州", "0994");
CITY_CODE_MAP.put("昭通", "0870");
CITY_CODE_MAP.put("晋中", "0354");
CITY_CODE_MAP.put("晋城", "0356");
CITY_CODE_MAP.put("曲靖", "0874");
CITY_CODE_MAP.put("朔州", "0349");
CITY_CODE_MAP.put("朝阳", "0421");
CITY_CODE_MAP.put("来宾", "01772");
CITY_CODE_MAP.put("松原", "0438");
CITY_CODE_MAP.put("枣庄", "0632");
CITY_CODE_MAP.put("柳州", "0772");
CITY_CODE_MAP.put("梅州", "0753");
CITY_CODE_MAP.put("梧州", "0774");
CITY_CODE_MAP.put("楚雄彝族自治州", "0878");
CITY_CODE_MAP.put("榆林", "0912");
CITY_CODE_MAP.put("武威", "01935");
CITY_CODE_MAP.put("毕节地区", "0857");
CITY_CODE_MAP.put("永州", "0746");
CITY_CODE_MAP.put("汉中", "0916");
CITY_CODE_MAP.put("池州", "0566");
CITY_CODE_MAP.put("沈阳", "024");
CITY_CODE_MAP.put("沧州", "0317");
CITY_CODE_MAP.put("河池", "0778");
CITY_CODE_MAP.put("河源", "0762");
CITY_CODE_MAP.put("泰安", "0538");
CITY_CODE_MAP.put("泰州", "0523");
CITY_CODE_MAP.put("济宁", "0537");
CITY_CODE_MAP.put("济源", "01391");
CITY_CODE_MAP.put("海东地区", "0972");
CITY_CODE_MAP.put("海北藏族自治州", "0970");
CITY_CODE_MAP.put("海南藏族自治州", "0974");
CITY_CODE_MAP.put("海口", "0898");
CITY_CODE_MAP.put("淄博", "0533");
CITY_CODE_MAP.put("淮北", "0561");
CITY_CODE_MAP.put("淮南", "0554");
CITY_CODE_MAP.put("淮安", "0517");
CITY_CODE_MAP.put("清远", "0763");
CITY_CODE_MAP.put("渭南", "0913");
CITY_CODE_MAP.put("湘西土家族苗族自治州", "0743");
CITY_CODE_MAP.put("滁州", "0550");
CITY_CODE_MAP.put("滨州", "0543");
CITY_CODE_MAP.put("漯河", "0395");
CITY_CODE_MAP.put("潍坊", "0536");
CITY_CODE_MAP.put("潜江", "02728");
CITY_CODE_MAP.put("潮州", "0768");
CITY_CODE_MAP.put("濮阳", "0393");
CITY_CODE_MAP.put("烟台", "0535");
CITY_CODE_MAP.put("焦作", "0391");
CITY_CODE_MAP.put("牡丹江", "0453");
CITY_CODE_MAP.put("玉林", "0775");
CITY_CODE_MAP.put("玉溪", "0877");
CITY_CODE_MAP.put("甘孜藏族自治州", "0836");
CITY_CODE_MAP.put("白城", "0436");
CITY_CODE_MAP.put("白山", "0439");
CITY_CODE_MAP.put("白银", "0943");
CITY_CODE_MAP.put("益阳", "0737");
CITY_CODE_MAP.put("盐城", "0515");
CITY_CODE_MAP.put("盘锦", "0427");
CITY_CODE_MAP.put("石嘴山", "0952");
CITY_CODE_MAP.put("石家庄", "0311");
CITY_CODE_MAP.put("石河子", "0993");
CITY_CODE_MAP.put("神农架林区", "01719");
CITY_CODE_MAP.put("红河哈尼族彝族自治州", "0873");
CITY_CODE_MAP.put("绍兴", "0575");
CITY_CODE_MAP.put("绥化", "0455");
CITY_CODE_MAP.put("绵阳", "0816");
CITY_CODE_MAP.put("聊城", "0635");
CITY_CODE_MAP.put("肇庆", "0758");
CITY_CODE_MAP.put("舟山", "0580");
CITY_CODE_MAP.put("芜湖", "0553");
CITY_CODE_MAP.put("荆州", "0716");
CITY_CODE_MAP.put("莱芜", "0634");
CITY_CODE_MAP.put("菏泽", "0530");
CITY_CODE_MAP.put("萍乡", "0799");
CITY_CODE_MAP.put("营口", "0417");
CITY_CODE_MAP.put("衡水", "0318");
CITY_CODE_MAP.put("衡阳", "0734");
CITY_CODE_MAP.put("衢州", "0570");
CITY_CODE_MAP.put("西双版纳傣族自治州", "0691");
CITY_CODE_MAP.put("西宁", "0971");
CITY_CODE_MAP.put("西安", "029");
CITY_CODE_MAP.put("许昌", "0374");
CITY_CODE_MAP.put("贵港", "01755");
CITY_CODE_MAP.put("贺州", "01774");
CITY_CODE_MAP.put("资阳", "0832");
CITY_CODE_MAP.put("赣州", "0797");
CITY_CODE_MAP.put("赤峰", "0476");
CITY_CODE_MAP.put("辽源", "0437");
CITY_CODE_MAP.put("达州", "0818");
CITY_CODE_MAP.put("运城", "0359");
CITY_CODE_MAP.put("连云港", "0518");
CITY_CODE_MAP.put("通化", "0435");
CITY_CODE_MAP.put("通辽", "0475");
CITY_CODE_MAP.put("遂宁", "0825");
CITY_CODE_MAP.put("遵义", "0852");
CITY_CODE_MAP.put("邢台", "0319");
CITY_CODE_MAP.put("邯郸", "0310");
CITY_CODE_MAP.put("邵阳", "0739");
CITY_CODE_MAP.put("郑州", "0371");
CITY_CODE_MAP.put("郴州", "0735");
CITY_CODE_MAP.put("鄂尔多斯", "0477");
CITY_CODE_MAP.put("鄂州", "0711");
CITY_CODE_MAP.put("酒泉", "0937");
CITY_CODE_MAP.put("金华", "0579");
CITY_CODE_MAP.put("金昌", "0935");
CITY_CODE_MAP.put("钦州", "0777");
CITY_CODE_MAP.put("铁岭", "0410");
CITY_CODE_MAP.put("铜仁地区", "0856");
CITY_CODE_MAP.put("铜川", "0919");
CITY_CODE_MAP.put("铜陵", "0562");
CITY_CODE_MAP.put("银川", "0951");
CITY_CODE_MAP.put("锦州", "0416");
CITY_CODE_MAP.put("长治", "0355");
CITY_CODE_MAP.put("阜新", "0418");
CITY_CODE_MAP.put("阜阳", "01558");
CITY_CODE_MAP.put("阳泉", "0353");
CITY_CODE_MAP.put("阿坝藏族羌族自治州", "0837");
CITY_CODE_MAP.put("陇南", "02935");
CITY_CODE_MAP.put("随州", "0722");
CITY_CODE_MAP.put("雅安", "0835");
CITY_CODE_MAP.put("韶关", "0751");
CITY_CODE_MAP.put("马鞍山", "0555");
CITY_CODE_MAP.put("驻马店", "0396");
CITY_CODE_MAP.put("鸡西", "0467");
CITY_CODE_MAP.put("鹤壁", "0392");
CITY_CODE_MAP.put("鹤岗", "0468");
CITY_CODE_MAP.put("鹰潭", "0701");
CITY_CODE_MAP.put("黄冈", "0713");
CITY_CODE_MAP.put("黑河", "0456");
CITY_CODE_MAP.put("黔东南苗族侗族自治州", "0855");
CITY_CODE_MAP.put("黔南布依族苗族自治州", "0854");
CITY_CODE_MAP.put("齐齐哈尔", "0452");
CITY_CODE_MAP.put("龙岩", "0597");
CITY_CODE_MAP.put("甘南藏族自治州", "0941");
CITY_CODE_MAP.put("嘉峪关", "1937");
CITY_CODE_MAP.put("百色", "0776");
CITY_CODE_MAP.put("六盘水", "0858");
CITY_CODE_MAP.put("黔西南布依族苗族自治州", "0859");
CITY_CODE_MAP.put("白沙黎族自治县", "0802");
CITY_CODE_MAP.put("保亭黎族苗族自治县", "0801");
CITY_CODE_MAP.put("昌江黎族自治县", "0803");
CITY_CODE_MAP.put("澄迈县", "0804");
CITY_CODE_MAP.put("定安县", "0806");
CITY_CODE_MAP.put("东方", "0807");
CITY_CODE_MAP.put("东沙群岛", "0808");
CITY_CODE_MAP.put("乐东黎族自治县", "2802");
CITY_CODE_MAP.put("临高县", "1896");
CITY_CODE_MAP.put("陵水黎族自治县", "0809");
CITY_CODE_MAP.put("南沙群岛", "1891");
CITY_CODE_MAP.put("琼海", "1894");
CITY_CODE_MAP.put("琼中黎族苗族自治县", "1899");
CITY_CODE_MAP.put("屯昌县", "1892");
CITY_CODE_MAP.put("万宁", "1898");
CITY_CODE_MAP.put("文昌", "1893");
CITY_CODE_MAP.put("五指山", "1897");
CITY_CODE_MAP.put("西沙群岛", "1895");
CITY_CODE_MAP.put("中沙群岛", "2801");
CITY_CODE_MAP.put("儋州", "0805");
CITY_CODE_MAP.put("阿拉善盟", "0483");
CITY_CODE_MAP.put("巴彦淖尔市", "0478");
CITY_CODE_MAP.put("锡林郭勒盟", "0479");
CITY_CODE_MAP.put("固原", "0954");
CITY_CODE_MAP.put("果洛藏族自治州", "0975");
CITY_CODE_MAP.put("海西蒙古族藏族自治州", "0977");
CITY_CODE_MAP.put("黄南藏族自治州", "0973");
CITY_CODE_MAP.put("玉树藏族自治州", "0976");
CITY_CODE_MAP.put("阿里地区", "0897");
CITY_CODE_MAP.put("昌都地区", "0895");
CITY_CODE_MAP.put("林芝地区", "0894");
CITY_CODE_MAP.put("那曲地区", "0896");
CITY_CODE_MAP.put("阿克苏地区", "0997");
CITY_CODE_MAP.put("阿勒泰地区", "0906");
CITY_CODE_MAP.put("巴音郭楞蒙古自治州", "0996");
CITY_CODE_MAP.put("哈密地区", "0902");
CITY_CODE_MAP.put("和田地区", "0903");
CITY_CODE_MAP.put("喀什地区", "0998");
CITY_CODE_MAP.put("克孜勒苏柯尔克孜自治州", "0908");
CITY_CODE_MAP.put("保山", "0875");
CITY_CODE_MAP.put("德宏傣族景颇族自治州", "0692");
CITY_CODE_MAP.put("迪庆藏族自治州", "0887");
CITY_CODE_MAP.put("丽江", "0888");
CITY_CODE_MAP.put("临沧市", "0883");
CITY_CODE_MAP.put("怒江傈僳族自治州", "0886");
CITY_CODE_MAP.put("普洱", "0879");
CITY_CODE_MAP.put("文山壮族苗族自治州", "0876");
CITY_CODE_MAP.put("香港", "1852");
CITY_CODE_MAP.put("澳门", "1853");
CITY_CODE_MAP.put("五家渠市", "652300");
CITY_CODE_MAP.put("阿拉尔市", "652900");
CITY_CODE_MAP.put("图木舒克市", "653000");
}
}
@@ -7,7 +7,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* 百度API服务调用工具类
* 百度API服务调用工具类
* Created by wenyan on 2015/4/15.
*/
public class BaiDuApiUtils {
@@ -17,13 +17,13 @@ public class BaiDuApiUtils {
private static final String DOMAIN = "http://api.map.baidu.com/place/v2/";
/**
* 区域检索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){
@@ -57,7 +57,7 @@ public class BaiDuApiUtils {
return null;
}
/**
* 获取该城市范围内经纬度所在的区域
* 获取该城市范围内经纬度所在的区域
* @param city
* @param lng
* @param lat
@@ -88,7 +88,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;
@@ -103,7 +103,7 @@ public class BaiDuApiUtils {
/**
* 提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务
* 提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务
* @param location
* @param address
* @return
@@ -135,7 +135,7 @@ public class BaiDuApiUtils {
}
public static void changeAK(){
System.out.println("更换AK");
System.out.println("更换AK");
for(int i = 0 ;i < AKS.length; i++){
if(i == AKS.length - 1){
AK = AKS[0];
@@ -14,7 +14,7 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
/**
* 工具类 复制属性
* 工具类 复制属性
*
* @author yinjihuan
*
@@ -19,9 +19,9 @@ public class DesUtils {
private final static String DES = "DES";
/**
* Description 根据键值进行加密
* Description 根据键值进行加密
* @param data
* @param key 加密键byte数组
* @param key 加密键byte数组
* @return
* @throws Exception
*/
@@ -32,9 +32,9 @@ public class DesUtils {
}
/**
* Description 根据键值进行解密
* Description 根据键值进行解密
* @param data
* @param key 加密键byte数组
* @param key 加密键byte数组
* @return
* @throws IOException
* @throws Exception
@@ -50,27 +50,27 @@ public class DesUtils {
}
/**
* Description 根据键值进行加密
* Description 根据键值进行加密
* @param data
* @param key 加密键byte数组
* @param key 加密键byte数组
* @return
* @throws Exception
*/
private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源
// 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象
// 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象
// 用密钥初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
return cipher.doFinal(data);
@@ -78,27 +78,27 @@ public class DesUtils {
/**
* Description 根据键值进行解密
* Description 根据键值进行解密
* @param data
* @param key 加密键byte数组
* @param key 加密键byte数组
* @return
* @throws Exception
*/
private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源
// 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象
// 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象
// 用密钥初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
return cipher.doFinal(data);
@@ -106,7 +106,7 @@ public class DesUtils {
/**
* Description 获取字符串MD5值
* Description 获取字符串MD5值
* @param sourceStr
*/
private static String MD5(String sourceStr) {
@@ -137,12 +137,12 @@ public class DesUtils {
public static void main(String[] args) throws Exception {
String data = "18616348076_1234561";
String key = "fangjia_pds_goojia"; //秘钥
String key = "fangjia_pds_goojia"; //秘钥
String encode = encrypt(data, key);
System.err.println("加密:"+encode);
System.err.println("加密encode:"+URLEncoder.encode(encode, "utf-8"));
System.err.println("加密decode:"+URLDecoder.decode(URLEncoder.encode(encode, "utf-8"), "utf-8"));
System.err.println("加密:"+encode);
System.err.println("加密encode:"+URLEncoder.encode(encode, "utf-8"));
System.err.println("加密decode:"+URLDecoder.decode(URLEncoder.encode(encode, "utf-8"), "utf-8"));
String dcode = decrypt(encode, key);
System.err.println("解密:"+dcode);
System.err.println("解密:"+dcode);
}
}
@@ -10,34 +10,34 @@ public class FieldUtils {
if (estateType != null) {
if (estateType.indexOf("购物") > -1) {
map.put("error", "类型不正确,不是小区类型");
if (estateType.indexOf("购物") > -1) {
map.put("error", "类型不正确,不是小区类型");
}
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1 && estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
map.put("error", "类型不正确,不是小区类型");
if (estateType.indexOf("小区") == -1 && estateType.indexOf("别墅") == -1 && estateType.indexOf("公寓") == -1 && estateType.indexOf("住宅") == -1) {
if (estateType.indexOf("写字楼") > -1 || estateType.indexOf("商铺") > -1) {
map.put("error", "类型不正确,不是小区类型");
}
}else{
if (estateType.indexOf("别墅") != -1){
map.put("estate_type", "别墅");
}else if(estateType.indexOf("小区") != -1 || estateType.indexOf("住宅") != -1 || estateType.indexOf("公寓") != -1){
map.put("estate_type", "住宅");
if (estateType.indexOf("别墅") != -1){
map.put("estate_type", "别墅");
}else if(estateType.indexOf("小区") != -1 || estateType.indexOf("住宅") != -1 || estateType.indexOf("公寓") != -1){
map.put("estate_type", "住宅");
}else{
map.put("estate_type", "其它");
map.put("estate_type", "其它");
}
}
}
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
map.put("error", "类型不正确,不是小区类型");
if (name.indexOf("写字楼") > -1 || name.indexOf("商铺") > -1 || name.indexOf("商业广场") > -1) {
map.put("error", "类型不正确,不是小区类型");
}
return map;
}
public static Map<String, String> getBuildTypeStandard(String buildType){
String s = "";
String[] buildTypes = {"多层","小高层","高层","超高层","独栋","双拼","联排","叠加"};
String[] buildTypes = {"多层","小高层","高层","超高层","独栋","双拼","联排","叠加"};
Map<String, String> map = new HashMap<String, String>();
for(String type : buildTypes){
@@ -51,9 +51,9 @@ public class FieldUtils {
buildType = buildType.replace(type, "");
}
}
buildType = buildType.replace(" ", "").replace(",", "");
buildType = buildType.replace(" ", "").replace(",", "");
if(buildType.length() > 0){
map.put("error", "建筑类型不匹配");
map.put("error", "建筑类型不匹配");
}
map.put("build_type", s);
return map;
@@ -62,12 +62,12 @@ public class FieldUtils {
public static Map<String, String> getEstateChargeStandard(String estateCharge){
Map<String, String> map = new HashMap<String, String>();
if(isNumeric(estateCharge)){
estateCharge = estateCharge.trim() + "元/平米/月";
estateCharge = estateCharge.trim() + "元/平米/月";
}else{
if(estateCharge.indexOf("元")!=-1){
estateCharge = estateCharge.substring(0, estateCharge.indexOf("元")).trim() + "元/平米/月";
if(estateCharge.indexOf("元")!=-1){
estateCharge = estateCharge.substring(0, estateCharge.indexOf("元")).trim() + "元/平米/月";
}else{
map.put("error", "物业费用格式不匹配");
map.put("error", "物业费用格式不匹配");
}
}
@@ -90,16 +90,16 @@ public class FieldUtils {
if(isNumeric(area)){
int t_area = Integer.parseInt(area);
float tempArea = t_area/10000;
area = tempArea + "万平方";
area = tempArea + "万平方";
}else{
if(area.indexOf("平方")!=-1){
area = area.substring(0, area.indexOf("万")+1) + "平方";
}else if(area.indexOf("万")!=-1){
if(area.indexOf("平方")!=-1){
area = area.substring(0, area.indexOf("万")+1) + "平方";
}else if(area.indexOf("万")!=-1){
int t_area = Integer.parseInt(area);
float tempArea = t_area/10000;
area = tempArea + "万平方";
area = tempArea + "万平方";
}else{
map.put("error", field.equals("build_area")?"建筑面积":"占地面积" +"格式不匹配");
map.put("error", field.equals("build_area")?"建筑面积":"占地面积" +"格式不匹配");
}
}
@@ -113,7 +113,7 @@ public class FieldUtils {
float percent = Float.parseFloat(cubagePercent);
map.put("cubage_percent", cubagePercent);
}catch(Exception e){
map.put("error", "空积率用格式不匹配");
map.put("error", "空积率用格式不匹配");
}
return map;
@@ -132,7 +132,7 @@ public class FieldUtils {
map.put("virescence_percent", virescencePercent+"%");
}
}else{
map.put("error", "绿化率用格式不匹配");
map.put("error", "绿化率用格式不匹配");
}
return map;
}
@@ -16,40 +16,40 @@ import org.jsoup.nodes.Document;
public class InfoTestUtil {
private final static List<String> fitment = new ArrayList<String>(
Arrays.asList("装修", "装修情况", "装修程度", "房屋情况"));
Arrays.asList("装修", "装修情况", "装修程度", "房屋情况"));
private final static List<String> totalPrice = new ArrayList<String>(
Arrays.asList("总价", "出售价格", "售价", "到手价", "出售总价", "房价", "价格", "房源价格"));
Arrays.asList("总价", "出售价格", "售价", "到手价", "出售总价", "房价", "价格", "房源价格"));
private final static List<String> roomHallToilet = new ArrayList<String>(
Arrays.asList("户型", "房型", "房型面积"));
Arrays.asList("户型", "房型", "房型面积"));
private final static List<String> area = new ArrayList<String>(
Arrays.asList("建筑面积", "面积","产权面积","产证面积"));
Arrays.asList("建筑面积", "面积","产权面积","产证面积"));
private final static List<String> floorHeight = new ArrayList<String>(
Arrays.asList("楼层", "楼栋", "所在楼层", "所在层数", "房屋楼层"));
Arrays.asList("楼层", "楼栋", "所在楼层", "所在层数", "房屋楼层"));
private final static List<String> direction = new ArrayList<String>(
Arrays.asList("朝向", "房屋朝向", "概况"));
Arrays.asList("朝向", "房屋朝向", "概况"));
private final static List<String> fitmentcontent = new ArrayList<String>(
Arrays.asList("毛坯", "简装修", "中装修", "精装修", "豪华装修", "精装", "豪装",
"一般装修", "普通装修", "无装修", "中等装修", "毛坯房", "中装"));
Arrays.asList("毛坯", "简装修", "中装修", "精装修", "豪华装修", "精装", "豪装",
"一般装修", "普通装修", "无装修", "中等装修", "毛坯房", "中装"));
private static Map<String, String> infoMap;
private static String key = "房型面积";
private static String key = "房型面积";
/**
* 关键字
* 关键字
*
* @author yk
*
*/
public enum keyword {
fitment("装修"), area("面积"), floorHeight("楼层"), roomHallToilet("户型"), direction(
"朝向"), totalPrice("总价");
fitment("装修"), area("面积"), floorHeight("楼层"), roomHallToilet("户型"), direction(
"朝向"), totalPrice("总价");
private final String value;
@@ -63,13 +63,13 @@ public class InfoTestUtil {
}
/**
* 室厅卫
* 室厅卫
*
* @author yk
*
*/
public enum roomHallToiletType {
room("室"), room2("房"), hall("厅"), toilet("卫");
room("室"), room2("房"), hall("厅"), toilet("卫");
private final String value;
@@ -93,7 +93,7 @@ public class InfoTestUtil {
byte bytes[] = { (byte) 0xC2, (byte) 0xA0 };
String UTFSpace = new String(bytes, "utf-8");
arr[i] = arr[i].replaceAll(UTFSpace, "");
arr[i].replaceAll(" | | ", "");
arr[i].replaceAll(" | | ", "");
if (arr[i].contains("[")) {
arr[i] = "";
}
@@ -112,7 +112,7 @@ public class InfoTestUtil {
}
/**
* 最后处理数据
* 最后处理数据
* @param infoMap2
*/
private static void dealMap(Map<String, String> infoMap2) {
@@ -175,7 +175,7 @@ public class InfoTestUtil {
Matcher matcher = pattern.matcher(text1);
while (matcher.find()) {
infoMap.put("floor", matcher.group(0));
System.out.print("所在楼层:" + matcher.group(0) + "\n");
System.out.print("所在楼层:" + matcher.group(0) + "\n");
}
String text2 = floorHeightStr.substring(i + 1,
floorHeightStr.indexOf(")"));
@@ -184,7 +184,7 @@ public class InfoTestUtil {
while (matcher2.find()) {
// list.add(matcher.group(0));
infoMap.put("height", matcher2.group(0));
System.out.print("总楼层:" + matcher2.group(0) + "\n");
System.out.print("总楼层:" + matcher2.group(0) + "\n");
}
} else {
Pattern pattern = Pattern.compile("\\d+");
@@ -194,37 +194,37 @@ public class InfoTestUtil {
list.add(matcher.group(0));
}
if (list.size() == 1) {
System.out.print("所在楼层" + list.get(0) + "\n");
System.out.print("所在楼层" + list.get(0) + "\n");
infoMap.put("floor", list.get(0));
}
if (list.size() == 2) {
System.out.print("所在楼层" + list.get(0) + "\n");
System.out.print("所在楼层" + list.get(0) + "\n");
infoMap.put("floor", list.get(0));
System.out.print("总楼层" + list.get(1) + "\n");
System.out.print("总楼层" + list.get(1) + "\n");
infoMap.put("height", list.get(1));
}
}
}
String area = infoMap.get(keyword.area.value);
if(area.contains("㎡")){
infoMap.put("area", area.substring(0, area.indexOf("㎡")));
if(area.contains("㎡")){
infoMap.put("area", area.substring(0, area.indexOf("㎡")));
}
if(area.contains("平米")){
infoMap.put("area", area.substring(0, area.indexOf("平米")));
if(area.contains("平米")){
infoMap.put("area", area.substring(0, area.indexOf("平米")));
}
if(area.contains("平方米")){
infoMap.put("area", area.substring(0, area.indexOf("平方米")));
if(area.contains("平方米")){
infoMap.put("area", area.substring(0, area.indexOf("平方米")));
}
infoMap.remove("roomHallToilet");
}
/**
* 判断是否含有特殊字段
* 判断是否含有特殊字段
* @param keyContent
*/
private static void judgeContainKey(String keyContent) {
if (keyContent.contains(key)) {
String[] txt = keyContent.split("㎡");
String[] txt = keyContent.split("㎡");
if (txt.length >= 1) {
String content = txt[0];
for (int j = 1; j < content.length() + 1; j++) {
@@ -233,9 +233,9 @@ public class InfoTestUtil {
String content2 = content.substring(length - j - 1, length);
if (content1.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$")
&& !content2.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$")) {
infoMap.put(keyword.area.value, content1 + "㎡");
infoMap.put(keyword.area.value, content1 + "㎡");
System.out.print(keyword.area.value + ":" + content1
+ "㎡" + "\n");
+ "㎡" + "\n");
infoMap.put(keyword.roomHallToilet.value,
content.substring(5, length - j));
System.out.print(keyword.roomHallToilet.value + ":"
@@ -248,38 +248,38 @@ public class InfoTestUtil {
}
/**
* 判断信息是否全
* 判断信息是否全
* @param arr
*/
private static void judgeInfoIsFull(String[] arr) {
if (infoMap.get("room") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("室")&&!arr[i].contains("厅")) {
if (arr[i].contains("室")&&!arr[i].contains("厅")) {
infoMap.put("room", arr[i].substring(0, arr[i].length()-1));
System.out.print("室" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
System.out.print("室" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
}
}
}
if (infoMap.get("hall") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("厅")&&!arr[i].contains("室")) {
if (arr[i].contains("厅")&&!arr[i].contains("室")) {
infoMap.put("hall", arr[i].substring(0, arr[i].length()-1));
System.out.print("厅" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
System.out.print("厅" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
}
}
}
if (infoMap.get("toilet") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("卫")&&!arr[i].contains("室")) {
if (arr[i].contains("卫")&&!arr[i].contains("室")) {
infoMap.put("toilet", arr[i].substring(0, arr[i].length()-1));
System.out.print("卫" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
System.out.print("卫" + ":"+ arr[i].substring(0, arr[i].length()-1) + "\n");
}
}
}
if (infoMap.get(keyword.area.value) == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("㎡")) {
String[] number = arr[i].split("㎡");
if (arr[i].contains("㎡")) {
String[] number = arr[i].split("㎡");
if (number.length >= 1) {
boolean result = number[0].matches("[0-9]+");
if (result == true) {
@@ -291,9 +291,9 @@ public class InfoTestUtil {
boolean result = arr[i - 1]
.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$");
if (result == true) {
infoMap.put(keyword.area.value, arr[i - 1] + "㎡");
infoMap.put(keyword.area.value, arr[i - 1] + "㎡");
System.out.print(keyword.area.value + ":"
+ arr[i - 1] + "㎡");
+ arr[i - 1] + "㎡");
}
}
}
@@ -303,13 +303,13 @@ public class InfoTestUtil {
}
/**
* 根据关键字处理数据
* 根据关键字处理数据
* @param text
* @param nexText
*/
public static void judgeType(String text, String nexText) {
if (text.contains(":") || text.contains(":")) {
String[] result = text.split(":|:|:");
if (text.contains(":") || text.contains(":")) {
String[] result = text.split(":|:|:");
if (result.length <= 1) {
OutPutResult(result[0], nexText);
} else {
@@ -324,14 +324,14 @@ public class InfoTestUtil {
if (text.contains(vo)) {
String[] result = text.split(vo);
if (result.length > 1 && hasDigit(result[1])) {
if (result[1].contains("万")) {
if (result[1].contains("万")) {
result[1] = result[1].substring(0,
result[1].indexOf("万"));
result[1].indexOf("万"));
}
System.out.print(keyword.totalPrice.value + ":"
+ result[1] + "万" + "\n");
+ result[1] + "万" + "\n");
infoMap.put(keyword.totalPrice.value, result[1]
+ "万");
+ "万");
return;
}
}
@@ -421,19 +421,19 @@ public class InfoTestUtil {
}
/**
* 输出
* 输出
* @param text1
* @param text2
*/
public static void OutPutResult(String text1, String text2) {
if (totalPrice.contains(text1)) {
if (text2.contains("万")) {
text2 = text2.substring(0, text2.indexOf("万"));
if (text2.contains("万")) {
text2 = text2.substring(0, text2.indexOf("万"));
}
System.out.print(keyword.totalPrice.value + ":" + text2 + "万"
System.out.print(keyword.totalPrice.value + ":" + text2 + "万"
+ "\n");
infoMap.put(keyword.totalPrice.value, text2 + "万");
infoMap.put(keyword.totalPrice.value, text2 + "万");
return;
}
if (fitment.contains(text1)) {
@@ -493,9 +493,9 @@ public class InfoTestUtil {
}
public static String fn2(String number)// 方法2
public static String fn2(String number)// 方法2
{
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ,"两"};
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ,"两"};
String alabo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ,"2"};
for (int i = 0; i < 11; i++)
if (number.equals(hanzi[i]))
@@ -33,7 +33,7 @@ public class InfoUtil {
private static Map<String,String> infoMap;
private static String key = "房型面积";
private static String key = "房型面积";
public static Map<String,String> getInforMation(String content) throws UnsupportedEncodingException{
infoMap = new HashMap<String,String>();
@@ -46,7 +46,7 @@ public class InfoUtil {
byte bytes[] = {(byte) 0xC2,(byte) 0xA0};
String UTFSpace = new String(bytes,"utf-8");
arr[i] = arr[i].replaceAll(UTFSpace, "");
arr[i].replaceAll(" | | ", "");
arr[i].replaceAll(" | | ", "");
if(arr[i].contains("[")){
arr[i] = "";
}
@@ -65,7 +65,7 @@ public class InfoUtil {
}
/**
* 最后处理数据
* 最后处理数据
* @param infoMap2
*/
private static void dealMap(Map<String, String> infoMap2) {
@@ -147,25 +147,25 @@ public class InfoUtil {
}
}
String area = infoMap.get("area");
if(area.contains("㎡")){
infoMap.put("area", area.substring(0, area.indexOf("㎡")));
if(area.contains("㎡")){
infoMap.put("area", area.substring(0, area.indexOf("㎡")));
}
if(area.contains("平米")){
infoMap.put("area", area.substring(0, area.indexOf("平米")));
if(area.contains("平米")){
infoMap.put("area", area.substring(0, area.indexOf("平米")));
}
if(area.contains("平方米")){
infoMap.put("area", area.substring(0, area.indexOf("平方米")));
if(area.contains("平方米")){
infoMap.put("area", area.substring(0, area.indexOf("平方米")));
}
infoMap.remove("roomHallToilet");
}
/**
* 判断是否含有特殊字段
* 判断是否含有特殊字段
* @param keyContent
*/
private static void judgeContainKey(String keyContent) {
if (keyContent.contains(key)) {
String[] txt = keyContent.split("㎡");
String[] txt = keyContent.split("㎡");
if (txt.length >= 1) {
String content = txt[0];
for (int j = 1; j < content.length() + 1; j++) {
@@ -174,9 +174,9 @@ public class InfoUtil {
String content2 = content.substring(length - j - 1, length);
if (content1.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$")
&& !content2.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$")) {
infoMap.put("area", content1 + "㎡");
infoMap.put("area", content1 + "㎡");
System.out.print(keyword.area.value + ":" + content1
+ "㎡" + "\n");
+ "㎡" + "\n");
infoMap.put("roomHallToilet",
content.substring(5, length - j));
break;
@@ -187,35 +187,35 @@ public class InfoUtil {
}
/**
* 判断信息是否全
* 判断信息是否全
* @param arr
*/
private static void judgeInfoIsFull(String[] arr) {
if (infoMap.get("room") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("室")&&!arr[i].contains("厅")) {
if (arr[i].contains("室")&&!arr[i].contains("厅")) {
infoMap.put("room", arr[i].substring(0, arr[i].length()-1));
}
}
}
if (infoMap.get("hall") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("厅")&&!arr[i].contains("室")) {
if (arr[i].contains("厅")&&!arr[i].contains("室")) {
infoMap.put("hall", arr[i].substring(0, arr[i].length()-1));
}
}
}
if (infoMap.get("toilet") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("卫")&&!arr[i].contains("室")) {
if (arr[i].contains("卫")&&!arr[i].contains("室")) {
infoMap.put("toilet", arr[i].substring(0, arr[i].length()-1));
}
}
}
if (infoMap.get("area") == null) {
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i].contains("㎡")) {
String[] number = arr[i].split("㎡");
if (arr[i].contains("㎡")) {
String[] number = arr[i].split("㎡");
if (number.length >= 1) {
boolean result = number[0].matches("[0-9]+");
if (result == true) {
@@ -225,7 +225,7 @@ public class InfoUtil {
boolean result = arr[i - 1]
.matches("^\\d+$|^\\d+\\.\\d+$|-\\d+$");
if (result == true) {
infoMap.put("area", arr[i - 1] + "㎡");
infoMap.put("area", arr[i - 1] + "㎡");
}
}
}
@@ -235,13 +235,13 @@ public class InfoUtil {
}
/**
* 根据关键字处理数据
* 根据关键字处理数据
* @param text
* @param nexText
*/
public static void judgeType(String text, String nexText) {
if (text.contains(":") || text.contains(":")) {
String[] result = text.split(":|:|:");
if (text.contains(":") || text.contains(":")) {
String[] result = text.split(":|:|:");
if (result.length <= 1) {
OutPutResult(result[0], nexText);
} else {
@@ -256,9 +256,9 @@ public class InfoUtil {
if (text.contains(vo)) {
String[] result = text.split(vo);
if (result.length > 1 && hasDigit(result[1])) {
if (result[1].contains("万")) {
if (result[1].contains("万")) {
result[1] = result[1].substring(0,
result[1].indexOf("万"));
result[1].indexOf("万"));
}
if(isDecimal(result[1])){
if(result[1].contains(".")){
@@ -348,14 +348,14 @@ public class InfoUtil {
}
/**
* 输出
* 输出
* @param text1
* @param text2
*/
public static void OutPutResult(String text1, String text2) {
if (totalPrice.contains(text1)) {
if (text2.contains("万")) {
text2 = text2.substring(0, text2.indexOf("万"));
if (text2.contains("万")) {
text2 = text2.substring(0, text2.indexOf("万"));
}
if(isDecimal(text2)){
if(text2.contains(".")){
@@ -424,9 +424,9 @@ public class InfoUtil {
return Pattern.compile("([1-9]+[0-9]*|0)(\\.[\\d]+)?").matcher(str).matches();
}
public static String fn2(String number)// 方法2
public static String fn2(String number)// 方法2
{
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九","两" };
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九","两" };
String alabo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ,"2"};
for (int i = 0; i < 11; i++)
if (number.equals(hanzi[i]))
@@ -435,17 +435,17 @@ public class InfoUtil {
}
/**
* 关键字
* 关键字
* @author yk
*
*/
public enum keyword{
fitment("装修"),
area("面积"),
floorHeight("楼层"),
roomHallToilet("户型"),
direction("朝向"),
totalPrice("总价");
fitment("装修"),
area("面积"),
floorHeight("楼层"),
roomHallToilet("户型"),
direction("朝向"),
totalPrice("总价");
public final String value;
@@ -459,15 +459,15 @@ public class InfoUtil {
}
/**
* 室厅卫
* 室厅卫
* @author yk
*
*/
public enum roomHallToiletType{
room("室"),
room2("房"),
hall("厅"),
toilet("卫");
room("室"),
room2("房"),
hall("厅"),
toilet("卫");
private final String value;
@@ -481,7 +481,7 @@ public class InfoUtil {
}
/**
* 获取匹配规则
* 获取匹配规则
*/
private static void getModeList() {
List<AutoModeAnaly> list = autoModeAnalyDao.findAllByType(null);
@@ -25,16 +25,16 @@ public class NewInfoUtil {
private static Map<String, String> infoMap;
private final static List<String> fitmentcontent = new ArrayList<String>(Arrays.asList("毛坯","简装修","中装修","精装修","豪华装修","精装","豪装","一般装修","普通装修","无装修","中等装修","毛坯房","中装"));
private final static List<String> fitmentcontent = new ArrayList<String>(Arrays.asList("毛坯","简装修","中装修","精装修","豪华装修","精装","豪装","一般装修","普通装修","无装修","中等装修","毛坯房","中装"));
public static Map<String, String> getInforMation(String content)
throws UnsupportedEncodingException {
infoMap = new HashMap<String, String>();
Document doc = Jsoup.parse(content);
String links = doc.body().text();
//获取需要解析的字段信息
//获取需要解析的字段信息
List<AutoModeAnaly> list = autoModeAnalyDao.findAllByType(null);
//在所有的文字信息中寻找对应信息
//在所有的文字信息中寻找对应信息
for (int i = 0; i < list.size(); i++) {
String[] text = list.get(i).getDesc().split(",");
for (int j = 0; j < text.length; j++) {
@@ -92,21 +92,21 @@ public class NewInfoUtil {
list.add(matcher.group(0));
}
if (list.size() == 1) {
System.out.print("所在楼层" + list.get(0) + "\n");
System.out.print("所在楼层" + list.get(0) + "\n");
infoMap.put("floor", list.get(0));
}
if (list.size() == 2) {
System.out.print("所在楼层" + list.get(0) + "\n");
System.out.print("所在楼层" + list.get(0) + "\n");
infoMap.put("floor", list.get(0));
System.out.print("总楼层" + list.get(1) + "\n");
System.out.print("总楼层" + list.get(1) + "\n");
infoMap.put("height", list.get(1));
}
}
String area = infoMap2.get("area");
if(StringUtils.isNotBlank(area)){
if(area.contains("㎡")){
String areaStr = area.substring(0, area.indexOf("㎡"));
if(area.contains("㎡")){
String areaStr = area.substring(0, area.indexOf("㎡"));
int j = 0;
for(int i=areaStr.length();i>0;i--){
String txt = areaStr.substring(i-1, i);
@@ -116,14 +116,14 @@ public class NewInfoUtil {
break;
}
}
System.out.print("面积为:"+ areaStr.substring(j, areaStr.length()) +"\n");
infoMap.put("area", areaStr.substring(j, areaStr.length())+"㎡");
System.out.print("面积为:"+ areaStr.substring(j, areaStr.length()) +"\n");
infoMap.put("area", areaStr.substring(j, areaStr.length())+"㎡");
}
}
String price = infoMap2.get("total_price");
if(StringUtils.isNotBlank(price)){
if(price.contains("万")){
String priceStr = price.substring(0, price.indexOf("万"));
if(price.contains("万")){
String priceStr = price.substring(0, price.indexOf("万"));
int j = 0;
for(int i=priceStr.length();i>0;i--){
String txt = priceStr.substring(i-1, i);
@@ -133,8 +133,8 @@ public class NewInfoUtil {
break;
}
}
System.out.print("总价为:"+ priceStr.substring(j, priceStr.length()) +"\n");
infoMap.put("price", priceStr.substring(j, priceStr.length())+"万");
System.out.print("总价为:"+ priceStr.substring(j, priceStr.length()) +"\n");
infoMap.put("price", priceStr.substring(j, priceStr.length())+"万");
}
}
}
@@ -151,9 +151,9 @@ public class NewInfoUtil {
String UTFSpace = new String(bytes, "utf-8");
arr[i] = arr[i].replaceAll(UTFSpace, "");
if (!StringUtil.isBlank(arr[i])) {
if (!arr[i].contains("》") && !arr[i].contains("《")
if (!arr[i].contains("》") && !arr[i].contains("《")
&& !arr[i].contains("|") && !arr[i].contains(">>")
&& !arr[i].contains("<<") && !arr[i].contains("‖")) {
&& !arr[i].contains("<<") && !arr[i].contains("‖")) {
list.add(arr[i]);
}
}
@@ -162,7 +162,7 @@ public class NewInfoUtil {
if (list.size() >= 5) {
for (int j = 5; j < list.size(); j++) {
String text = null;
if (list.get(j).contains(":") || list.get(j).contains(":")) {
if (list.get(j).contains(":") || list.get(j).contains(":")) {
if (list.get(j - 1).length() == 1) {
text = list.get(j - 1) + list.get(j);
if (list.get(j - 2).length() == 1) {
@@ -206,9 +206,9 @@ public class NewInfoUtil {
}
}
public static String fn2(String number)// 方法2
public static String fn2(String number)// 方法2
{
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
String hanzi[] = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
String alabo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
for (int i = 0; i < 10; i++)
if (number.equals(hanzi[i]))
@@ -217,14 +217,14 @@ public class NewInfoUtil {
}
/**
* 关键字
* 关键字
*
* @author yk
*
*/
public enum keyword {
fitment("装修"), area("面积"), floorHeight("楼层"), roomHallToilet("户型"), direction(
"朝向"), totalPrice("总价");
fitment("装修"), area("面积"), floorHeight("楼层"), roomHallToilet("户型"), direction(
"朝向"), totalPrice("总价");
public final String value;
@@ -238,13 +238,13 @@ public class NewInfoUtil {
}
/**
* 室厅卫
* 室厅卫
*
* @author yk
*
*/
public enum roomHallToiletType {
room("室"), room2("房"), hall("厅"), toilet("卫");
room("室"), room2("房"), hall("厅"), toilet("卫");
private final String value;
@@ -20,8 +20,8 @@ public class OpenApiClient {
final String TOKEN = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB";
private static String HOST = "http://open.fangjia.com";
private static String MATCH_HOST = "http://open.fangjia.com";
public static Pattern MULTI_STREET_PATTERN = Pattern.compile(".*(路|街道|大道|街|巷|胡同)(与|和).{2,}(路|街道|大道|街|巷|胡同).*");
public static Pattern NO_KEYWORD_MULTI_STREET_PATTERN = Pattern.compile(".{2,}(路|街道|大道|巷|胡同).{2,}(路|街道|大道|巷|胡同).*");
public static Pattern MULTI_STREET_PATTERN = Pattern.compile(".*(路|街道|大道|街|巷|胡同)(与|和).{2,}(路|街道|大道|街|巷|胡同).*");
public static Pattern NO_KEYWORD_MULTI_STREET_PATTERN = Pattern.compile(".{2,}(路|街道|大道|巷|胡同).{2,}(路|街道|大道|巷|胡同).*");
public static JSONObject addressStandardize(String city, String address) {
if (StringUtils.isBlank(city) || StringUtils.isBlank(address)) {
@@ -44,9 +44,9 @@ public class OpenApiClient {
}
/**
* 格式化地址
* @param city 城市
* @param addr 地址
* 格式化地址
* @param city 城市
* @param addr 地址
*
**/
public static String formateAddress(String city, String addr){
@@ -55,7 +55,7 @@ public class OpenApiClient {
return null;
}
String address = null;
addr = addr.replace("~", "-").replace("~", "-");
addr = addr.replace("~", "-").replace("~", "-");
JSONObject result = addressStandardize(city,addr);
if(result == null){
return addr;
@@ -68,17 +68,17 @@ public class OpenApiClient {
}else if(result.containsKey("street")){
String street = result.getString("street");
if(isMultiStreet(street)){
if(!street.endsWith("交汇") && !street.endsWith("交汇处")){
address = street + "交汇";
if(!street.endsWith("交汇") && !street.endsWith("交汇处")){
address = street + "交汇";
}else{
address = street;
}
}else if(NO_KEYWORD_MULTI_STREET_PATTERN.matcher(street).find()){
address = street;
if(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$") && !(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$"))){
if(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$") && !(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$"))){
int idx = 0;
int kl = 0;
List<String> keywords = Arrays.asList(new String[]{"路","街道","大道","巷","胡同"});
List<String> keywords = Arrays.asList(new String[]{"路","街道","大道","巷","胡同"});
for(String k : keywords){
idx = address.indexOf(k);
if(idx + k.length() != address.length()){
@@ -86,9 +86,9 @@ public class OpenApiClient {
break;
}
}
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
if(!isMatch(address, ".*(交汇|交口|交叉口|交汇处)$")){
address += "交汇";
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
if(!isMatch(address, ".*(交汇|交口|交叉口|交汇处)$")){
address += "交汇";
}
}
}else{
@@ -96,10 +96,10 @@ public class OpenApiClient {
}
}else if(result.containsKey("miniAddress")){
address = result.getString("miniAddress");
if(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$") && !(isMatch(address, ".*(路|街道|大道|巷|胡同)(与|和).{2,}(路|街道|大道|巷|胡同).*"))){
if(isMatch(address, ".+(路|街道|大道|巷|胡同).*(路|街道|大道|巷|胡同)$") && !(isMatch(address, ".*(路|街道|大道|巷|胡同)(与|和).{2,}(路|街道|大道|巷|胡同).*"))){
int idx = 0;
int kl = 0;
List<String> keywords = Arrays.asList(new String[]{"路","街道","大道","巷","胡同"});
List<String> keywords = Arrays.asList(new String[]{"路","街道","大道","巷","胡同"});
for(String k : keywords){
idx = address.indexOf(k);
if(idx + k.length() != address.length()){
@@ -107,13 +107,13 @@ public class OpenApiClient {
break;
}
}
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
if(!isMatch(address, ".*(交汇|交口|交叉口|交汇处)$")){
address += "交汇";
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
address = address.substring(0, idx + kl) + "与" + address.substring(idx + kl);
if(!isMatch(address, ".*(交汇|交口|交叉口|交汇处)$")){
address += "交汇";
}
}
address = address.replaceAll("(交汇|交口|交叉口|交汇处).*","交汇");
address = address.replaceAll("(交汇|交口|交叉口|交汇处).*","交汇");
}
return address;
}
@@ -43,7 +43,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"));
}
}
@@ -120,7 +120,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");
@@ -198,14 +198,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);
@@ -5,7 +5,7 @@ import javax.servlet.http.HttpServletRequest;
public class SessionContent {
/**
* 获取登录用户ID
* 获取登录用户ID
* @param request
* @return
*/
@@ -18,7 +18,7 @@ public class SessionContent {
}
/**
* 获取登录用户名
* 获取登录用户名
* @param request
* @return
*/
@@ -20,13 +20,13 @@ import java.util.List;
import java.util.Map;
/**
* 模板工具类
* 模板工具类
*
* @author liupei
*/
public final class TemplateUtils {
/**
* 清理指定字符串中的特殊字符
* 清理指定字符串中的特殊字符
*
* @author liupei
*/
@@ -35,7 +35,7 @@ public final class TemplateUtils {
}
/**
* 清理特定的某个字符串
* 清理特定的某个字符串
*
* @author
*/
@@ -49,14 +49,14 @@ public final class TemplateUtils {
}
/**
* 截取字符串
* 截取字符串
*
* 若原始字符串的长度小于最大截取长度,则直接返回原始字符串
* 若原始字符串的长度小于最大截取长度,则直接返回原始字符串
*
* @param str
* 原始字符串
* 原始字符串
* @param targetLength
* 截取长度
* 截取长度
* @return
*/
public static String cutString(String str, int targetLength) {
@@ -64,12 +64,12 @@ public final class TemplateUtils {
}
/**
* 按字节截取字符串
* 按字节截取字符串
*
* @param str
* 原始字符串
* 原始字符串
* @param targetLength
* 截取长度
* 截取长度
* @return
*/
public static String bCutString(String str, int targetLength) {
@@ -81,7 +81,7 @@ public final class TemplateUtils {
}
/**
* 截取字符串
* 截取字符串
*
* @param str
* @param beginIndex
@@ -93,7 +93,7 @@ public final class TemplateUtils {
}
/**
* 截取字符串
* 截取字符串
*
* @param str
* @param targetLength
@@ -105,7 +105,7 @@ public final class TemplateUtils {
}
/**
* 获取字符在字符串中的index
* 获取字符在字符串中的index
*
* @param str
* @param strChar
@@ -116,7 +116,7 @@ public final class TemplateUtils {
}
/**
* 加密图片url
* 加密图片url
*
* @param u
* @param s
@@ -134,9 +134,9 @@ public final class TemplateUtils {
}
/**
* 格式化均价
* 格式化均价
*
* 将个位和十位直接变为0
* 将个位和十位直接变为0
*
* @param avgPirce
* @return
@@ -146,7 +146,7 @@ public final class TemplateUtils {
}
/**
* 去掉str中的html标记
* 去掉str中的html标记
*
* @param str
* @return
@@ -156,7 +156,7 @@ public final class TemplateUtils {
}
/**
* 移除HTML中的<a>标记
* 移除HTML中的<a>标记
*
* @param htmlDes
* @return
@@ -166,7 +166,7 @@ public final class TemplateUtils {
}
/**
* 全角转半角
* 全角转半角
*
* @param input
* @return
@@ -176,7 +176,7 @@ public final class TemplateUtils {
}
/**
* 转换时间
* 转换时间
*
* @param input
* @return
@@ -186,7 +186,7 @@ public final class TemplateUtils {
}
/**
* 转换时间
* 转换时间
*
* @param input
* @return _tyler
@@ -196,7 +196,7 @@ public final class TemplateUtils {
}
/**
* 去除不支持的编码字符
* 去除不支持的编码字符
*
* @param input
* @return
@@ -206,7 +206,7 @@ public final class TemplateUtils {
}
/**
* 格式化板块
* 格式化板块
*
* @param block
* @return
@@ -216,7 +216,7 @@ public final class TemplateUtils {
}
/**
* 编码
* 编码
*
* @param s
* @return
@@ -227,7 +227,7 @@ public final class TemplateUtils {
}
/**
* 格式化日期
* 格式化日期
*
*/
public static String dateFormat(Date date, String pattern) {
@@ -238,7 +238,7 @@ public final class TemplateUtils {
}
/**
* 获取date前days天的日期
* 获取date前days天的日期
*
* @param date
* @param days
@@ -255,16 +255,16 @@ public final class TemplateUtils {
return StringUtils.replace(text, searchString, replacement);
}
private static final String[] STRONG_KEYS = new String[] { "房价" };
private static final String[] STRONG_VALUES = new String[] { "<strong>房价</strong>" };
private static final String[] STRONG_CLASS_VALUES = new String[] { "<strong class='yhua'>房价</strong>" };
private static final String[] STRONG_KEYS = new String[] { "房价" };
private static final String[] STRONG_VALUES = new String[] { "<strong>房价</strong>" };
private static final String[] STRONG_CLASS_VALUES = new String[] { "<strong class='yhua'>房价</strong>" };
/**
* 关键字加strong格式
* 关键字加strong格式
*
* @param text
* @param isNeedClass
* true:带样式yhua;false:不带class
* true:带样式yhua;false:不带class
* @return
*/
public static String strong(String text, boolean isNeedClass) {
@@ -284,7 +284,7 @@ public final class TemplateUtils {
}
/**
* 获取1~size的随机数
* 获取1~size的随机数
*
* @param size
* @return
@@ -303,13 +303,13 @@ public final class TemplateUtils {
if (publishDate.after(range[0]) && publishDate.before(range[1])) {
int diffHour = DateUtil.getHour(new Date()) - DateUtil.getHour(publishDate);
if (diffHour > 0) {
return diffHour + "小时前";
return diffHour + "小时前";
} else {
int diffMinute = DateUtil.getMinute(new Date()) - DateUtil.getMinute(publishDate);
if (diffMinute <= 0) {
diffMinute = 1;
}
return diffMinute + "分钟前";
return diffMinute + "分钟前";
}
} else {
@@ -62,40 +62,40 @@ public class UploadHandleServlet extends HttpServlet{
// if(isMultipart){
//得到上传文件的保存目录,将上传的文件存放于WEB-INF目录下,不允许外界直接访问,保证上传文件的安全
//得到上传文件的保存目录,将上传的文件存放于WEB-INF目录下,不允许外界直接访问,保证上传文件的安全
String savePath = this.getServletContext().getRealPath("/WEB-INF/upload/");
System.out.println("servlet:"+savePath);
File file = new File(savePath);
// if(file.exists()){
// File[] files = file.listFiles();//声明目录下所有的文件 files[];
// for (int i = 0;i < files.length;i ++) {//遍历目录下所有的文件
// File[] files = file.listFiles();//声明目录下所有的文件 files[];
// for (int i = 0;i < files.length;i ++) {//遍历目录下所有的文件
// files[i].delete();
// }
// //file.delete();//删除文件夹
// //file.delete();//删除文件夹
// }
//判断上传文件的保存目录是否存在
//判断上传文件的保存目录是否存在
if (!file.exists() && !file.isDirectory()) {
System.out.println(savePath+"目录不存在,需要创建");
//创建目录
System.out.println(savePath+"目录不存在,需要创建");
//创建目录
file.mkdir();
}
//构造一个文件上传处理对象
//构造一个文件上传处理对象
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
Iterator items;
try{
//解析表单中提交的所有文件内容
//解析表单中提交的所有文件内容
items=upload.parseRequest(request).iterator();
while(items.hasNext()){
FileItem item = (FileItem) items.next();
if(!item.isFormField()){
//取出上传文件的文件名称
//取出上传文件的文件名称
String name = item.getName();
//取得上传文件以后的存储路径
//取得上传文件以后的存储路径
InputStream is =item.getInputStream();
String fileName=name.substring(name.lastIndexOf('\\')+1,name.length());
int index=fileName.lastIndexOf(".");
@@ -103,24 +103,24 @@ public class UploadHandleServlet extends HttpServlet{
String fileType=fileName.substring(index);
//parseData(is, fileType);
//获取item中的上传文件的输入流
//获取item中的上传文件的输入流
InputStream in = item.getInputStream();
//创建一个文件输出流
//创建一个文件输出流
FileOutputStream out = new FileOutputStream(savePath + "/" + fileName);
//创建一个缓冲区
//创建一个缓冲区
byte buffer[] = new byte[1024];
//判断输入流中的数据是否已经读完的标识
//判断输入流中的数据是否已经读完的标识
int len = 0;
//循环将输入流读入到缓冲区当中,(len=in.read(buffer))>0就表示in里面还有数据
//循环将输入流读入到缓冲区当中,(len=in.read(buffer))>0就表示in里面还有数据
while((len=in.read(buffer))>0){
//使用FileOutputStream输出流将缓冲区的数据写入到指定的目录(savePath + "\\" + filename)当中
//使用FileOutputStream输出流将缓冲区的数据写入到指定的目录(savePath + "\\" + filename)当中
out.write(buffer, 0, len);
}
//关闭输入流
//关闭输入流
in.close();
//关闭输出流
//关闭输出流
out.close();
//删除处理文件上传时生成的临时文件
//删除处理文件上传时生成的临时文件
item.delete();
}
}