Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
+1
-1
@@ -1768,7 +1768,7 @@ public class AddressController {
|
||||
matchParams.setProvince(model.getProvince());
|
||||
|
||||
// matchParams.setUseMap(true);
|
||||
matchParams.setUseAliyunApi(true);
|
||||
matchParams.setUseAliyunApi(false);
|
||||
// matchParams.setUseCrf(true);
|
||||
matchParams.setContainsLocation(model.isContainsLocation());
|
||||
Building building = addressParserService.standard(matchParams);
|
||||
|
||||
+56
-1
@@ -10,6 +10,9 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fangjia.dal.common.XcxKey;
|
||||
import com.fangjia.dal.mongo.model.bkoff.XcxUserInfo;
|
||||
import com.fangjia.service.mongo.fangjia.XcxUserInfoService;
|
||||
import com.fangjia.service.open.WeChatAuthService;
|
||||
import com.fangjia.service.open.WeChatAuthServiceImpl;
|
||||
import com.fangjia.service.util.CookieUtils;
|
||||
@@ -37,6 +40,7 @@ public class UserController {
|
||||
private UserCityService userCityService;
|
||||
private FjtUsersService fjtUsersService;
|
||||
private WeChatAuthService weChatAuthService;
|
||||
private XcxUserInfoService xcxUserInfoService;
|
||||
|
||||
public void setUserCityService(UserCityService userCityService) {
|
||||
this.userCityService = userCityService;
|
||||
@@ -58,7 +62,15 @@ public class UserController {
|
||||
public Object reqLoginPageAction(UserModel model) {
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
public Object bhydLoginPageAction(UserModel model) {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setXcxUserInfoService(XcxUserInfoService xcxUserInfoService) {
|
||||
this.xcxUserInfoService = xcxUserInfoService;
|
||||
}
|
||||
|
||||
public Object reqCityChoicePageAction(UserModel model, HttpServletResponse response, HttpServletRequest request) {
|
||||
String type = StringUtils.trimToNull(model.getType());
|
||||
if(!StringUtils.isBlank(type)){
|
||||
@@ -217,6 +229,25 @@ public class UserController {
|
||||
String username = StringUtils.trimToNull(model.getUsername());
|
||||
String pass = StringUtils.trimToNull(model.getPass());
|
||||
String weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
|
||||
if(StringUtils.isBlank(weiXinId) && StringUtils.isNotBlank(model.getCode())){
|
||||
System.out.println("小程序code:"+model.getCode());
|
||||
System.out.println("小程序AppId:"+model.getAppId());
|
||||
System.out.println("小程序AppSecret:"+model.getAppSecret());
|
||||
System.out.println("sid:"+model.getSid());
|
||||
XcxKey sessionValue = getSessionValue(model.getCode(), null, model.getAppId(), model.getAppSecret());
|
||||
if(sessionValue!=null){
|
||||
weiXinId = sessionValue.getOpenId();
|
||||
}
|
||||
if(weiXinId == null) {
|
||||
weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
}
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
}
|
||||
System.out.println("[sid]小程序微信OPEN_ID:" + weiXinId);
|
||||
}
|
||||
|
||||
//测试时可以先去掉
|
||||
if (StringUtils.isBlank(username) || StringUtils.isBlank(pass) || StringUtils.isBlank(weiXinId)){
|
||||
resultModel.setMsg(Message.PARAM_NOT_NULL);
|
||||
@@ -241,6 +272,30 @@ public class UserController {
|
||||
return resultModel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public XcxKey getSessionValue(String code, String sid, String appId, String secret){
|
||||
XcxKey sessionValue = null;
|
||||
if(StringUtils.isNotBlank(sid)){
|
||||
System.out.println(sid+"houqi");
|
||||
sessionValue = new XcxKey();
|
||||
sessionValue.setSid(sid);
|
||||
sessionValue.setOpenId(sid);
|
||||
}
|
||||
//缓存中没有登陆信息
|
||||
if(sessionValue==null){
|
||||
//获取openid信息
|
||||
sessionValue = xcxUserInfoService.getOpenId(code, appId, secret);
|
||||
XcxUserInfo user = null;
|
||||
if(sessionValue!=null&&StringUtils.isNotBlank(sessionValue.getOpenId())){
|
||||
//根据是否是第一次使用,保存并查询除用户信息
|
||||
user = xcxUserInfoService.save(sessionValue.getOpenId(), null);
|
||||
sessionValue.setSid(sessionValue.getOpenId());
|
||||
}
|
||||
|
||||
}
|
||||
return sessionValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存的验证码
|
||||
|
||||
+2
@@ -191,6 +191,8 @@ public class XcxInfoController {
|
||||
}
|
||||
return sessionValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序估价接口
|
||||
|
||||
@@ -16,6 +16,10 @@ public class UserModel extends BaseModel {
|
||||
private String pass;
|
||||
private String code;
|
||||
private List<String> citys;
|
||||
|
||||
private String appId;//²âÊÔ
|
||||
private String appSecret;//²âÊÔ
|
||||
private String sid;//²âÊÔ
|
||||
|
||||
public List<String> getCitys() {
|
||||
return citys;
|
||||
@@ -80,4 +84,28 @@ public class UserModel extends BaseModel {
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
374548aec5ca5d3cde89978570a9627c
|
||||
@@ -183,10 +183,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<!-- 暂时注释 -->
|
||||
<script type="text/javascript" src="http://cdn.highcharts.com.cn/highcharts/9.0.1/highcharts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.highcharts.com.cn/highcharts/9.0.1/highcharts.js"></script>
|
||||
<script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/exporting.js"></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/trend-charts.js"></script>
|
||||
|
||||
@@ -152,8 +152,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/select.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/autoCompletion.js' charset='utf-8'></script>
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
$("#evaluateBtn").on('click', function(){
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
</head>
|
||||
|
||||
@@ -117,10 +117,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<#include '/layout/footer.ftl'/>
|
||||
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/trend-charts.js"></script>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?ak=0a7eM0lkIvpKGPiq1bMCfeH7&v=2.0&callback=initMap"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?ak=0a7eM0lkIvpKGPiq1bMCfeH7&v=2.0&callback=initMap"></script>
|
||||
<script type="text/javascript">
|
||||
var Constants = {
|
||||
wwwUrl : '${wwwUrl}',
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
<style>
|
||||
@@ -63,7 +63,7 @@
|
||||
<#include '/layout/footer.ftl'/>
|
||||
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
|
||||
<#if !(cityName??) || cityName ==''>
|
||||
<script src="http://api.map.baidu.com/api?ak=0a7eM0lkIvpKGPiq1bMCfeH7&v=2.0&services=false"></script>
|
||||
<script src="https://api.map.baidu.com/api?ak=0a7eM0lkIvpKGPiq1bMCfeH7&v=2.0&services=false"></script>
|
||||
<script type='text/javascript'>
|
||||
Array.prototype.contains = function(item){
|
||||
return RegExp(item).test(this);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
<style>
|
||||
@@ -42,8 +42,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='js/wx.js' charset='utf-8'></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" >
|
||||
$.config = {router: false}
|
||||
</script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script>var jQuery = Zepto</script>
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ZzX6mRFfE5GKn4cpUp24Q3OyUIHnfQAR"></script>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js"></script>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=ZzX6mRFfE5GKn4cpUp24Q3OyUIHnfQAR"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
|
||||
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
$.init()
|
||||
// 加载flag
|
||||
|
||||
@@ -94,6 +94,34 @@
|
||||
} else {
|
||||
html += ("<em>" + this.zsj + "</em> 万元</span></p><p><label>报告收费:</label><span>" + (this.bgsf!=null?this.bgsf+" 元":'-') + "</span></p></div></div></div>");
|
||||
}
|
||||
}else if(data.role==17) {
|
||||
html += "<div class='topic topic01' onclick='showDetail("+this.eid+", this)'><div class='topicContent topicContent01'><div class='left'><p><label>下载日期:</label><span>" + this.xzrq +
|
||||
"</span></p><p><label>地址:</label><span>" + address + "</span></p><p><label>主贷人:</label><span>" + this.zdr + "</span></p><p><label>面积:</label><span>" + this.mj;
|
||||
if (this.mj == "-") {
|
||||
html += "</span></p></div><div class='right'><p><label>总价:</label><span>" + this.zj;
|
||||
} else {
|
||||
if (this.zsj == "-") {
|
||||
html += " 平米</span></p></div><div class='right'><p><label>总价:</label><span><em>" + this.zj + "</em>";
|
||||
} else {
|
||||
html += " 平米</span></p></div><div class='right'><p><label>总价:</label><span>" + this.zj;
|
||||
}
|
||||
}
|
||||
if (this.zj == "-") {
|
||||
html += "</span></p><p><label>参考价:</label><span>" + this.ckj;
|
||||
} else {
|
||||
html += " 万元</span></p><p><label>参考价:</label><span>" + this.ckj;
|
||||
}
|
||||
if (this.ckj == "-") {
|
||||
html += "</span></p><p><label>终审价:</label><span>";
|
||||
} else {
|
||||
html += " 万元</span></p><p><label>终审价:</label><span>";
|
||||
}
|
||||
if (this.zsj == "-") {
|
||||
html += ("-</span></p></div></div></div>");
|
||||
|
||||
} else {
|
||||
html += ("<em>" + this.zsj + "</em> 万元</span></p></div></div></div>");
|
||||
}
|
||||
} else {
|
||||
html += "<div class='topic topic01'><div class='topicContent topicContent01'><div class='left'><p><label>下载日期:</label><span>" + this.xzrq +
|
||||
"</span></p><p><label>地址:</label><span>" + address + "</span></p></div><div class='right'><p><label>总价:</label><span>";
|
||||
@@ -111,6 +139,13 @@
|
||||
});
|
||||
|
||||
$('.infinite-scroll-bottom .list-container').append(html);
|
||||
|
||||
if(data['result'].length<itemsPerLoad){
|
||||
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
||||
$.detachInfiniteScroll($('.infinite-scroll'));
|
||||
// 删除加载提示符
|
||||
$('.infinite-scroll-preloader').remove();
|
||||
}
|
||||
}, "json");
|
||||
// 添加新条目
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -56,8 +56,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>渤海易贷</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<div class="content login_bg">
|
||||
<div class="login_logo"><img src="../static/images/bohaiyidai2.jpg"></div>
|
||||
<div class="login_content">
|
||||
<div class="login_input">
|
||||
<div class="inputInfo01">
|
||||
<span>
|
||||
<i class="login_icon01"></i>
|
||||
<input class="input_mobileNumber" id="username" type="text" autocomplete="off" placeholder="请输入用户名">
|
||||
</span>
|
||||
</div>
|
||||
<div class="inputInfo02">
|
||||
<span>
|
||||
<i class="login_icon02"></i>
|
||||
<input class="input_password" id="pass" type="password" autocomplete="off" placeholder="请输入密码">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p>忘记密码请拨打客服电话<a href="tel:4001883787">400-888-8811</a>进行查询</p>
|
||||
<div class="content-block">
|
||||
<p><a href="#" class="button button-big login_btn">登录</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' charset='utf-8'>
|
||||
$(function() {
|
||||
|
||||
var checkUsername = function(username) {
|
||||
if(username == "") {
|
||||
$.toast("用户名不能为空");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
var checkPass = function(pass) {
|
||||
if(pass == "") {
|
||||
$.toast("密码不能为空");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$(".login_btn").click(function(){
|
||||
var username = $("#username").val();
|
||||
var pass = $("#pass").val();
|
||||
if(checkUsername(username) && checkPass(pass)){
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "../user/enterpriseLogin",
|
||||
data : {
|
||||
"username" : username,
|
||||
"pass":pass,
|
||||
"code":"${code!''}",
|
||||
"sid":"${sid!''}",
|
||||
"appId":"${appId!''}",
|
||||
"appSecret":"${appSecret!''}"
|
||||
},
|
||||
success : function(result) {
|
||||
var re = $.parseJSON(result);
|
||||
if(re.result == "fail"){
|
||||
$.toast(re.msg);
|
||||
} else {
|
||||
window.location.href = "reqCityChoicePage?type=b";
|
||||
}
|
||||
},error:function (data, status) {
|
||||
$.toast("发送失败,请重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</#compress>
|
||||
@@ -13,7 +13,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -189,8 +189,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -54,8 +54,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type='text/javascript'>
|
||||
var codeToeken = "";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/city.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<script>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -47,8 +47,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' charset='utf-8'>
|
||||
$(function() {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<style>
|
||||
.list-block .item-content .item-inner{margin-left:0;padding-left:0.75rem;}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<style>
|
||||
.list-block .item-content .item-inner{margin-left:0;padding-left:0.75rem;}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -48,10 +48,17 @@
|
||||
function addItems(number, lastIndex) {
|
||||
var page = lastIndex / 10 + 1;
|
||||
$.post(url, "page="+page, function(data){
|
||||
//返回为空,代表加载完毕
|
||||
if(data['result']==null || data['result'].length==0) {
|
||||
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
||||
$.detachInfiniteScroll($('.infinite-scroll'));
|
||||
// 删除加载提示符
|
||||
$('.infinite-scroll-preloader').remove();
|
||||
return;
|
||||
}
|
||||
// 生成新条目的HTML
|
||||
var html = '';
|
||||
$.each(data['result'], function(i){
|
||||
|
||||
var address = this.dz;
|
||||
var fontColor = "";
|
||||
if(this.hn){
|
||||
@@ -64,7 +71,7 @@
|
||||
fontColor = "background-color:#F3F3F3;"
|
||||
}
|
||||
|
||||
if(data.role == 12) {
|
||||
if(data.role == 12 || data.role == 17) {
|
||||
html += "<div class='topic topic01' onclick='showDetail("+this.eid+", this)'><div class='topicContent topicContent01' style='"+fontColor+"'><div class='left'><p><label>评估日期:</label><span>" + this.pgrq + "</span></p>" +
|
||||
"<p><label>核价日期:</label><span>" + this.tjrq + "</span></p><p><label>地址:</label><span>" + address + "</span></p><p><label>物业类型:</label><span>" + this.wylx +
|
||||
"</span></p><p><label>面积:</label><span>" + this.mj;
|
||||
@@ -110,6 +117,13 @@
|
||||
});
|
||||
|
||||
$('.infinite-scroll-bottom .list-container').append(html);
|
||||
|
||||
if(data['result'].length<itemsPerLoad){
|
||||
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
||||
$.detachInfiniteScroll($('.infinite-scroll'));
|
||||
// 删除加载提示符
|
||||
$('.infinite-scroll-preloader').remove();
|
||||
}
|
||||
}, "json");
|
||||
// 添加新条目
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<style>
|
||||
.list-block02 ul:before,.list-block02 ul:after{height:0;}
|
||||
@@ -30,7 +30,25 @@
|
||||
<p style="margin-top:-4px;"><i class="location"></i><small>${fjtEvaluation.address!}</small> <a href="../district/weXinList?cityName=${fjtEvaluation.city!}" class="collectionLink" style="line-height: 32px;">重新评估 ></a></p>
|
||||
<span></span>
|
||||
<p style="margin-top:14px;">评估总价:<#if fjtEvaluation??><strong class="<#if evaluationAudit?? && evaluationAudit.auditPrice??><#else>price_final</#if>">${(fjtEvaluation.totalPrice/10000)?string('0.##')}</strong> 万元</#if></p>
|
||||
<p>评估单价:${fjtEvaluation.averagePrice!} 元/平米</p>
|
||||
<p>评估单价:${fjtEvaluation.averagePrice!} 元/平米</p>
|
||||
<#if role?? && role==17>
|
||||
<#if fjtEvaluation.districtName=="锦绣花木公寓">
|
||||
<p style="margin-top:-12px;">所属分类:A类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:7成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.7/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
<#elseif fjtEvaluation.districtName=="南山雨果">
|
||||
<p style="margin-top:-12px;">所属分类:C类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:6成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.6/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
<#elseif fjtEvaluation.districtName=="新泾三村">
|
||||
<p style="margin-top:-12px;">所属分类:D类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:5成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.5/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
</#if>
|
||||
</#if>
|
||||
</div>
|
||||
<div class="topicContent topicBottom" style="padding:0 20px;padding-bottom:5px;">
|
||||
<a id="evalRows" class="collectionLink">估价记录 ></a>
|
||||
@@ -373,7 +391,7 @@
|
||||
|
||||
<#include '/layout/footer.ftl'/>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/report.js?v=${t_util.currentTimeMillis()}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
|
||||
<#include '/layout/footer.ftl'/>
|
||||
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/trend-charts.js"></script>
|
||||
<script type="text/javascript" src="../static/js/report.js?v=${t_util.currentTimeMillis()}"></script>
|
||||
|
||||
+6
-4
@@ -54,6 +54,10 @@ class DealPriceMathBatch extends BaseBatch{
|
||||
|
||||
|
||||
def flag = true;
|
||||
|
||||
def startDate = DateUtil.getFirstDayOfMonth(new Date(),-1)
|
||||
def endDate = DateUtil.getFirstDayOfMonth(new Date(), 1)
|
||||
|
||||
cityMap.each{city,alias->
|
||||
println "开始加载【${city}】小区"
|
||||
if(city != "昆玉"){
|
||||
@@ -61,10 +65,8 @@ class DealPriceMathBatch extends BaseBatch{
|
||||
districtMap.putAll(detailMap)
|
||||
}
|
||||
}
|
||||
def startDate = DateUtil.getFirstDayOfMonth(DateUtil.parseDate("2020-01-01","yyyy-MM-dd"))
|
||||
// def startDate = DateUtil.getFirstDayOfMonth(new Date())
|
||||
// def endDate = DateUtil.getFirstDayOfMonth(new Date(), 1)
|
||||
def endDate = DateUtil.getFirstDayOfMonth(DateUtil.parseDate("2021-04-30","yyyy-MM-dd"))
|
||||
// def startDate = DateUtil.getFirstDayOfMonth(DateUtil.parseDate("2020-01-01","yyyy-MM-dd"))
|
||||
// def endDate = DateUtil.getFirstDayOfMonth(DateUtil.parseDate("2021-04-30","yyyy-MM-dd"))
|
||||
|
||||
while(flag){
|
||||
println "开始加载解析数据......"
|
||||
|
||||
+2
-2
@@ -76,8 +76,8 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
def createDatas(def city){
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", null);
|
||||
|
||||
def lastDate = DateUtils.getLastDayOfMonth(new Date(), -1)
|
||||
def startDate = DateUtils.getFirstDayOfMonth(lastDate);
|
||||
def lastDate = new Date()
|
||||
def startDate = DateUtils.getFirstDayOfMonth(lastDate, -1)
|
||||
|
||||
def result = []
|
||||
for(def rMap : districts){
|
||||
|
||||
@@ -2,13 +2,19 @@ package com.fangjia.script.fuzhou
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.thirdPriceCrawl.CrawalDBUtil
|
||||
import com.fangjia.script.util.CsvUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.yinjihaun.util.DingDingMessageUtil
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
|
||||
def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1)
|
||||
//福州第三方均价统计,发送钉钉消息
|
||||
//def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1)
|
||||
//def datas = CsvUtils.read("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv");
|
||||
def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202106.csv")
|
||||
def count0 = 0
|
||||
def count1 = 0
|
||||
def count2 = 0
|
||||
@@ -18,35 +24,44 @@ def count5 = 0
|
||||
def count6 = 0
|
||||
def count7 = 0
|
||||
def count8 = 0
|
||||
def total=4943
|
||||
def count9 = 0
|
||||
def total = datas.size()
|
||||
def regions = ["鼓楼","仓山","台江","晋安","马尾","长乐"]
|
||||
def regionCount = 0
|
||||
|
||||
def rets = []
|
||||
rets << ["网站有对比价数量","有对比价楼盘量","有对比价占比"]
|
||||
for(def d : datas){
|
||||
def list = []
|
||||
if(d['G']){
|
||||
list << d['G']
|
||||
if(regions.contains(d[3])){
|
||||
regionCount ++
|
||||
}
|
||||
if(d['H']){
|
||||
list << d['H']
|
||||
if(d[6]){
|
||||
list << d[6]
|
||||
}
|
||||
if(d['I']){
|
||||
list << d['I']
|
||||
if(d[7]){
|
||||
list << d[7]
|
||||
}
|
||||
if(d['J']){
|
||||
list << d['J']
|
||||
if(d[8]){
|
||||
list << d[8]
|
||||
}
|
||||
if(d['K']){
|
||||
list << d['K']
|
||||
if(d[9]){
|
||||
list << d[9]
|
||||
}
|
||||
if(d['L']){
|
||||
list << d['L']
|
||||
if(d[10]){
|
||||
list << d[10]
|
||||
}
|
||||
if(d['M']){
|
||||
list << d['M']
|
||||
if(d[11]){
|
||||
list << d[11]
|
||||
}
|
||||
if(d['N']){
|
||||
list << d['N']
|
||||
if(d[12]){
|
||||
list << d[12]
|
||||
}
|
||||
if(d['O']){
|
||||
list << d['O']
|
||||
if(d[13]){
|
||||
list << d[13]
|
||||
}
|
||||
if(d[14]){
|
||||
list << d[14]
|
||||
}
|
||||
if(list.size()==0){
|
||||
count0++
|
||||
@@ -76,18 +91,53 @@ for(def d : datas){
|
||||
if(list.size()==8){
|
||||
count8++
|
||||
}
|
||||
if(list.size()==9){
|
||||
count9++
|
||||
}
|
||||
}
|
||||
|
||||
println("count0:"+ (DataHandleUtils.getDoubleRound(2, count0*100.0/total)))
|
||||
println("count1:"+ (DataHandleUtils.getDoubleRound(2, count1*100.0/total)))
|
||||
println("count2:"+ (DataHandleUtils.getDoubleRound(2, count2*100.0/total)))
|
||||
println("count3:"+ (DataHandleUtils.getDoubleRound(2, count3*100.0/total)))
|
||||
println("count4:"+ (DataHandleUtils.getDoubleRound(2, count4*100.0/total)))
|
||||
println("count5:"+ (DataHandleUtils.getDoubleRound(2, count5*100.0/total)))
|
||||
println("count6:"+ (DataHandleUtils.getDoubleRound(2, count6*100.0/total)))
|
||||
println("count7:"+ (DataHandleUtils.getDoubleRound(2, count7*100.0/total)))
|
||||
println("count8:"+ (DataHandleUtils.getDoubleRound(2, count8*100.0/total)))
|
||||
println("总量:"+ total)
|
||||
def pre1 = DataHandleUtils.getDoubleRound(2, count1*100.0/total)
|
||||
println("count1:"+ pre1)
|
||||
def pre2 = DataHandleUtils.getDoubleRound(2, count2*100.0/total)
|
||||
println("count2:"+ pre2)
|
||||
def pre3 = DataHandleUtils.getDoubleRound(2, count3*100.0/total)
|
||||
println("count3:"+ pre3)
|
||||
|
||||
def pre4 = DataHandleUtils.getDoubleRound(2, count4*100.0/total)
|
||||
println("count4:"+ pre4)
|
||||
|
||||
def pre5 = DataHandleUtils.getDoubleRound(2, count5*100.0/total)
|
||||
println("count5:"+ pre5)
|
||||
|
||||
def pre6 = DataHandleUtils.getDoubleRound(2, count6*100.0/total)
|
||||
println("count6:"+ pre6)
|
||||
|
||||
def pre7 = DataHandleUtils.getDoubleRound(2, count7*100.0/total)
|
||||
println("count7:"+ pre7)
|
||||
|
||||
def pre8 = DataHandleUtils.getDoubleRound(2, count8*100.0/total)
|
||||
println("count8:"+ pre8)
|
||||
|
||||
def pre9 = DataHandleUtils.getDoubleRound(2, count9*100.0/total)
|
||||
println("count9:"+ pre9)
|
||||
|
||||
rets << ["1家",count1, pre1+"%"]
|
||||
rets << ["2家",count2, pre2+"%"]
|
||||
rets << ["3家",count3, pre3+"%"]
|
||||
rets << ["4家",count4, pre4+"%"]
|
||||
rets << ["5家",count5, pre5+"%"]
|
||||
rets << ["6家",count6, pre6+"%"]
|
||||
rets << ["7家",count7, pre7+"%"]
|
||||
rets << ["8家",count8, pre8+"%"]
|
||||
rets << ["9家",count9, pre9+"%"]
|
||||
|
||||
def curMonth = DateUtils.formatDateByPattern(new Date(), "yyyyMM")
|
||||
ExcelUtils.write("d:\\数据\\福州\\多方均价对比统计数据"+curMonth+".xlsx",rets,"统计")
|
||||
def s = "第三方均价总量:${total}\n6区总量:${regionCount}\ncount1: "+ count1+"( "+pre1+"% )\ncount2: "+ count2+"( "+pre2+"% )\ncount3: "+count3+"( "+pre3+"% )\ncount4: "+count4+"( "+pre4+"% )\ncount5: "+count5+"( "+pre5+"% )\ncount6: "+count6+"( "+pre6+"% )\ncount7: "+count7+"( "+pre7+"%)\ncount8: "+count8+"( "+pre8+"% )\ncount9: "+count9+" ("+pre9+"% )"
|
||||
|
||||
def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60"
|
||||
DingDingMessageUtil.sendTextMessage(access_token, s)
|
||||
|
||||
|
||||
////def districts = CommonDatautils.findAllDistricts("福州", "district", ["city", "region", "name"]);
|
||||
@@ -128,6 +178,18 @@ println("count8:"+ (DataHandleUtils.getDoubleRound(2, count8*100.0/total)))
|
||||
//}
|
||||
|
||||
|
||||
def readTxt(def fileName){
|
||||
File file = new File(fileName);
|
||||
def rows = [];
|
||||
|
||||
file.eachLine{
|
||||
def row = it.split("@\\|@",-1)
|
||||
rows << row
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+29
-13
@@ -45,10 +45,20 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
def updateErrorLists = []
|
||||
def flagLists = []
|
||||
def index = 0
|
||||
def prefix = "district_"
|
||||
|
||||
// def categorys = ["141202", "141203"]//中学,小学
|
||||
def categorys = ["120000", "120200","120203","120300","120301","120302","120303","120304"]//住宅相关
|
||||
|
||||
// def prefix = "district_"
|
||||
// def categorys = ["120000", "120200","120203","120300","120301","120302","120303","120304"]//住宅相关
|
||||
|
||||
// def prefix = "road_"
|
||||
// def categorys = ["190301"]//道路相关
|
||||
|
||||
// def prefix = "village_"
|
||||
// def categorys = ["190108","190109"]//村庄
|
||||
|
||||
def prefix = "company_"
|
||||
def categorys = ["170000","170100","170200","170201","170202","170203","170204","170205","170206","170207","170208","170209","170300","170400","170401","170402","170403","170404","170405","170406","170407","170408"]
|
||||
def totalCount = new AtomicLong()
|
||||
|
||||
static main(args) {
|
||||
@@ -106,14 +116,20 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
|
||||
|
||||
def run(){//,"西安","重庆"
|
||||
// def citys = [ "临沂","泰安","菏泽","东营","德州","济宁","日照","聊城","滨州","枣庄","莱芜","济南","青岛","威海","烟台","潍坊","淄博"]
|
||||
def citys = ["重庆","哈尔滨","沈阳","东莞","南昌","昆明","金华","温州","淄博","湛江","肇庆","宜昌","岳阳","安庆","芜湖","西宁","日照","常德","张家口","北京","上海","广州","深圳","重庆","郑州","长沙","西安","成都","东莞","佛山","杭州","合肥","南京","青岛","沈阳","苏州","天津","武汉","珠海","中山","长春","扬州","烟台","徐州","无锡","温州","太原","台州","石家庄","绍兴","厦门","泉州","宁波","南通","南宁","南昌","兰州","常州","大连","福州","贵阳","哈尔滨","海口","惠州","济南","嘉兴","金华","昆明","遵义","淄博","株洲","镇江","肇庆","漳州","湛江","岳阳","银川","宜昌","盐城","芜湖","乌鲁木齐","唐山","泰州","汕头","三亚","清远","秦皇岛","马鞍山","洛阳","柳州","连云港","廊坊","九江","吉林","淮安","湖州","呼和浩特","沧州","保定","安庆","张家口","西宁","日照","拉萨","锦州","大同","常德","北海","文昌","陵水","保亭"]
|
||||
def citys = ["上海","重庆","哈尔滨","沈阳","东莞","南昌","昆明","金华","温州","淄博","湛江","肇庆","宜昌","岳阳","安庆","芜湖","西宁","日照","常德","张家口","北京","广州","深圳","重庆","郑州","长沙","西安","成都","东莞","佛山","杭州","合肥","南京","青岛","沈阳","苏州","天津","武汉","珠海","中山","长春","扬州","烟台","徐州","无锡","温州","太原","台州","石家庄","绍兴","厦门","泉州","宁波","南通","南宁","南昌","兰州","常州","大连","福州","贵阳","哈尔滨","海口","惠州","济南","嘉兴","金华","昆明","遵义","淄博","株洲","镇江","肇庆","漳州","湛江","岳阳","银川","宜昌","盐城","芜湖","乌鲁木齐","唐山","泰州","汕头","三亚","清远","秦皇岛","马鞍山","洛阳","柳州","连云港","廊坊","九江","吉林","淮安","湖州","呼和浩特","沧州","保定","安庆","张家口","西宁","日照","拉萨","锦州","大同","常德","北海","文昌","陵水","保亭"]
|
||||
// def citys = CommonUtils.findAllCity()
|
||||
def totalCount = 0;
|
||||
for(def city : citys){
|
||||
def cityLations = findAllLation(city);
|
||||
println "开始处理["+city +"]:"+cityLations.size()
|
||||
gaoDeCitySearch(cityLations);
|
||||
def stop = false
|
||||
while(stop == false){
|
||||
def cityLations = findAllLation(city);
|
||||
if(!cityLations){
|
||||
stop = true;
|
||||
}else{
|
||||
println "开始处理["+city +"]:"+cityLations.size()
|
||||
gaoDeCitySearch(cityLations);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +141,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
q.put(prefix+"status", new BasicDBObject(QueryOperators.EXISTS, false))
|
||||
// q.put("status", "失败")
|
||||
// q.put("traffic_status", new BasicDBObject(QueryOperators.EXISTS, false))
|
||||
def results = BOUNDS_COLL.find(q).batchSize(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def results = BOUNDS_COLL.find(q).limit(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -138,7 +154,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
// void run() {
|
||||
// try{
|
||||
// totalCount.addAndGet(1)
|
||||
searching(location)
|
||||
searching(i, location)
|
||||
// }catch(Exception e){
|
||||
// e.printStackTrace()
|
||||
// } finally {
|
||||
@@ -165,7 +181,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
}
|
||||
}
|
||||
|
||||
def searching(location){
|
||||
def searching(i, location){
|
||||
// def bound_gd = location.bound_gd
|
||||
// def lats = [bound_gd[1], bound_gd[3]]
|
||||
// def lngs = [bound_gd[0], bound_gd[2]]
|
||||
@@ -173,7 +189,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
// lngs.sort()
|
||||
// println index
|
||||
// if(lngs[0]<=121.418153 && lngs[1]>=121.418153 && lats[0]<=31.218824 && lats[1]>=31.218824){
|
||||
search(location)
|
||||
search(i, location)
|
||||
// }
|
||||
|
||||
if(updateLists.size() > 0 && updateLists.size()>1000){
|
||||
@@ -192,7 +208,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
}
|
||||
|
||||
|
||||
def search(location){
|
||||
def search(i, location){
|
||||
def bound_gd = location.bound_gd
|
||||
def lats = [bound_gd[1], bound_gd[3]]
|
||||
def lngs = [bound_gd[0], bound_gd[2]]
|
||||
@@ -226,7 +242,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
updateErrorLists.addAll(location)
|
||||
}
|
||||
// update(location);
|
||||
println "[ "+totalCount.get()+" ]"+location._id+" "+location.city+" "+location.bound_gd+" flag: "+m.status
|
||||
println "[ "+i+" ]"+location._id+" "+location.city+" "+location.bound_gd+" flag: "+m.status
|
||||
}
|
||||
|
||||
def processData(rets){
|
||||
|
||||
+2
-2
@@ -65,12 +65,12 @@ class LandDetailCrawl {
|
||||
}
|
||||
|
||||
def updateData(){
|
||||
def datas = ExcelUtils.read("D:\\数据\\土地\\土地成交3月(2).xlsx",0, 1)
|
||||
def datas = ExcelUtils.read("D:\\数据\\土地\\土地-21-06.xlsx",0, 1)
|
||||
if(datas && datas.size()>0){
|
||||
for(def data : datas){
|
||||
def id = data['A']
|
||||
DBObject upMap = new BasicDBObject()
|
||||
def area = data['E']
|
||||
def area = data['I']
|
||||
|
||||
if(area){
|
||||
if(area){
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
|
||||
class WuXiAddressTest {
|
||||
static main(args) {
|
||||
def task = new WuXiAddressTest()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
// def datas = ExcelUtils.read("D:\\数据\\无锡\\教育机构-标准化(已处理).xlsx",0,1)
|
||||
// for(def d : datas){
|
||||
// def locationStr = getLocationInfo(d['D'], d['Q'])
|
||||
// def township = getStreetInfo(locationStr)
|
||||
// def name = getJuWeiHuiInfo(locationStr);
|
||||
//
|
||||
// }
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\无锡\\教育机构-标准化(已处理).xlsx",{d->
|
||||
if(!d['S']){
|
||||
def locationStr = getLocationInfo(d['D'], d['Q'])
|
||||
def township = getStreetInfo(locationStr)
|
||||
def name = getJuWeiHuiInfo(locationStr, "村委会", "1000");
|
||||
if(!name){
|
||||
name = getJuWeiHuiInfo(locationStr,"村委会", "2000");
|
||||
if(name){
|
||||
d['T'] = 2000
|
||||
}
|
||||
}else{
|
||||
d['T'] = 1000
|
||||
}
|
||||
|
||||
if(!name){
|
||||
name = getJuWeiHuiInfo(locationStr, "村委会", "3000");
|
||||
if(name){
|
||||
d['T'] = 3000
|
||||
}
|
||||
}
|
||||
d['R'] = township
|
||||
d['S'] = name
|
||||
}
|
||||
|
||||
|
||||
},0)
|
||||
|
||||
}
|
||||
|
||||
def getLocationInfo(def city, def address){
|
||||
def gloJson = GaoDeApiUtils.geo(city, address)
|
||||
if(gloJson) {
|
||||
def glocation = null
|
||||
if (gloJson && gloJson.get("geocodes")) {
|
||||
def geocodes = gloJson.get("geocodes")
|
||||
glocation = geocodes.get(0).location
|
||||
}
|
||||
return glocation
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
def getStreetInfo(def glocation){
|
||||
def township = null
|
||||
if(glocation){
|
||||
def jsonObject = GaoDeApiUtils.geocode(glocation)
|
||||
if(jsonObject && jsonObject.regeocode) {
|
||||
def addressComponent = jsonObject.regeocode.addressComponent
|
||||
if(addressComponent){
|
||||
township = addressComponent.township
|
||||
}
|
||||
}
|
||||
}
|
||||
return township;
|
||||
}
|
||||
|
||||
def getJuWeiHuiInfo(def glocation, def keyword, def radius){
|
||||
def json = GaoDeApiUtils.around2(glocation, radius,keyword, null)
|
||||
def name = null
|
||||
if(json && json.info=="OK" && json.pois){
|
||||
def pois = json.pois
|
||||
if(pois){
|
||||
def poi = pois[0]
|
||||
name = poi.name
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -47,7 +47,7 @@ class YouDaDataParser {
|
||||
def final AtomicInteger count_ = new AtomicInteger(0)
|
||||
|
||||
|
||||
static def statDate = "2021-04-01"
|
||||
static def statDate = "2021-05-01"
|
||||
static main(args) {
|
||||
def task = new YouDaDataParser();
|
||||
// task.newHouseparse();//友达一手房存入mongo
|
||||
@@ -285,7 +285,7 @@ class YouDaDataParser {
|
||||
|
||||
|
||||
def esfParser(){
|
||||
def files = ["D:\\数据\\友达\\2021年5月\\二手房\\查询1.DBF"]
|
||||
def files = ["D:\\数据\\友达\\2021年6月\\二手房\\查询1.DBF"]
|
||||
def datas = []
|
||||
for(def fileName : files){
|
||||
def rows = readDBF(fileName);
|
||||
|
||||
+16
@@ -65,6 +65,22 @@ class FangjiaClientUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static def addressStand(def address){
|
||||
def jsonObj = null
|
||||
try {
|
||||
def url = "http://192.168.0.19:39080/FangJiaNlpService/ner?address="+URLEncoder.encode(address,"UTF-8")
|
||||
|
||||
// def url = "http://192.168.0.19:39080/FangJiaAddressService/structure?address="+URLEncoder.encode(address,"UTF-8")
|
||||
def content = new HttpRequest().newGet(url, null, "utf-8")
|
||||
jsonObj = JSONObject.fromObject(content)
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonObj;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> JsonToMap(JSONObject json) {
|
||||
Map<String, Object> columnValMap = new HashMap<String, Object>();
|
||||
Set<Object> jsonKeys = json.keySet();
|
||||
|
||||
+1237
File diff suppressed because it is too large
Load Diff
+36
-1
@@ -18,8 +18,10 @@ class EsMonthHouseStat {
|
||||
static main(args) {
|
||||
def task = new EsMonthHouseStat()
|
||||
// task.run()
|
||||
task.tradeRun()
|
||||
// task.tradeRun()
|
||||
// task.houseRun()
|
||||
|
||||
task.statHouseUpdateCount()
|
||||
}
|
||||
|
||||
def run(){
|
||||
@@ -233,4 +235,37 @@ class EsMonthHouseStat {
|
||||
rMap.total_new = rets.size()
|
||||
return rMap
|
||||
}
|
||||
|
||||
|
||||
def statHouseUpdateCount(){
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
def root = "lianjia.com"
|
||||
def rets = []
|
||||
rets << ["城市", "5月上旬","5月中旬","5月下旬", "6月前10天"]
|
||||
for(def city : citys){
|
||||
def count1 = findHouseCount(city, root, 20210501, 20210510)
|
||||
def count2 = findHouseCount(city, root, 20210510, 20210520)
|
||||
def count3 = findHouseCount(city, root, 20210520, 20210530)
|
||||
def count4 = findHouseCount(city, root, 20210601, 20210610)
|
||||
rets << [city, count1, count2, count3, count4]
|
||||
}
|
||||
ExcelUtils.write("d:\\数据\\房源分析\\城市房源分析.xlsx", rets, "数据")
|
||||
}
|
||||
|
||||
|
||||
def findHouseCount(def city, def root, def startDate, def endDate){
|
||||
def aliasStr = null;
|
||||
def total = 0
|
||||
try{
|
||||
String sql = "select count(*) as c from latest_seawater where cat='sell' and city='${city}' and p_date >= ${startDate} and p_date<${endDate} and root='${root}'"
|
||||
|
||||
ElasticUtils.executeSqlQuery(sql,{data->
|
||||
total = data.c
|
||||
})
|
||||
}catch(Exception e){
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return total
|
||||
}
|
||||
}
|
||||
|
||||
+229
-20
@@ -1,11 +1,14 @@
|
||||
package com.fangjia.script.gj.location
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.GeocodeUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.looplineinfo.InsidePolygon
|
||||
import com.fangjia.script.looplineinfo.Point
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.GeoHelper
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
@@ -21,9 +24,16 @@ class LocationTest {
|
||||
static DBCollection POLYLINECOLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "region_polyline")
|
||||
|
||||
static main(args) {
|
||||
def task = new LocationTest()
|
||||
Date date=new Date(1622802609);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String str = format.format(date);
|
||||
System.out.println(str);
|
||||
|
||||
// def task = new LocationTest()
|
||||
// task.run()
|
||||
task.run2()
|
||||
// task.run2()
|
||||
// task.run3()
|
||||
// task.run4()
|
||||
}
|
||||
|
||||
def run(){
|
||||
@@ -43,11 +53,14 @@ class LocationTest {
|
||||
|
||||
def loactionMap = matchMap(dist)
|
||||
if(loactionMap){
|
||||
ret << "地图"
|
||||
ret << loactionMap.source
|
||||
ret << loactionMap.region
|
||||
ret << loactionMap.mapName
|
||||
ret << loactionMap.address
|
||||
def distance = GeoHelper.GetDistance(dist.lat/10000000000.0, dist.lng/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
ret << distance
|
||||
ret << loactionMap.lng
|
||||
ret << loactionMap.lat
|
||||
if(dist.region==loactionMap.region){
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,与地图相同"
|
||||
}else{
|
||||
@@ -61,31 +74,188 @@ class LocationTest {
|
||||
|
||||
}
|
||||
}
|
||||
ExcelUtils.write("d:\\数据\\福州\\区域经纬度错误3.xlsx", rets, "区域不在行政范围内")
|
||||
ExcelUtils.write("d:\\数据\\福州\\区域经纬度错误5.xlsx", rets, "区域不在行政范围内")
|
||||
}
|
||||
|
||||
def run2(){
|
||||
ExcelUtils.multiThreadingModify("d:\\数据\\福州\\福州小区.xlsx")
|
||||
def datas = ExcelUtils.read("d:\\数据\\福州\\福州小区.xlsx", 0,1)
|
||||
def rets = []
|
||||
rets << ["城市", "区域", "名称", "来源","地图区域", "地图名称","距离", "地图地址", "地图经度", "地图纬度"]
|
||||
def index = 0
|
||||
for(def d : datas){
|
||||
def count = d['H'].toInteger()
|
||||
def label = d['G'].toInteger()
|
||||
if(count && count>=4 && label!=-1){
|
||||
index++
|
||||
def city = d['C']
|
||||
def region = d['D']
|
||||
def name = d['B']
|
||||
|
||||
def dist = CommonDatautils.queryDistrictById(d['A'].toString())
|
||||
def ret = []
|
||||
ret << city
|
||||
ret << region
|
||||
ret << name
|
||||
|
||||
def loactionMap = matchMap(dist)
|
||||
if(loactionMap){
|
||||
ret << loactionMap.source
|
||||
ret << loactionMap.region
|
||||
ret << loactionMap.mapName
|
||||
def distance = null
|
||||
if(loactionMap.source=="高德"){
|
||||
distance = GeoHelper.GetDistance(dist.lat/10000000000.0, dist.lng/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
}else if(loactionMap.source=="百度"){
|
||||
distance = GeoHelper.GetDistance(dist.lat2/10000000000.0, dist.lng2/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
}
|
||||
ret << distance
|
||||
ret << loactionMap.address
|
||||
ret << loactionMap.lng
|
||||
ret << loactionMap.lat
|
||||
if(dist.region==loactionMap.region){
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,与地图相同"
|
||||
}else{
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内 地图:"+ loactionMap.region+" "+distance
|
||||
}
|
||||
}else{
|
||||
// ret << ""
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,地图没找到"
|
||||
}
|
||||
|
||||
rets << ret
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtils.write("d:\\数据\\福州\\相同经纬度小区4.xlsx", rets, "数据")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
def run3(){
|
||||
ExcelUtils.modify("d:\\数据\\福州\\区域经纬度错误5.xlsx", {d->
|
||||
def distance = null
|
||||
if(d['G']){
|
||||
distance = d['G'].toDouble()
|
||||
}
|
||||
if(d['E'] && d['B'] == d['E'] && distance && distance>=1000){
|
||||
def mapName = d['F'].toString().replace("(建设中)","").replace("?","").replace("&","").replace("·","").replace(".","").replace("(","").replace(")","").replace("(","").replace(")","").replace("11期","十一期").replace("12期","十二期").replace("13期","十三期").replace("14期","十四期").replace("15期","十五期").replace("16期","十六期").replace("17期","十七期").replace("18期","十八期").replace("19期","十九期").replace("10期","十期").replace("1期","一期").replace("2期","二期").replace("3期","三期").replace("4期","四期").replace("5期","五期").replace("6期","六期").replace("7期","七期").replace("8期","八期").replace("9期","九期")
|
||||
if(mapName.contains("-") && mapName.endsWith("楼")){
|
||||
mapName = mapName.substring(0, mapName.indexOf("-"))
|
||||
}
|
||||
if(d['C']==mapName){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", d['A'])
|
||||
q.put("region", d['B'])
|
||||
q.put("name", d['C'])
|
||||
q.put("cat", 'district')
|
||||
q.put("status", 0)
|
||||
def lng2 = null
|
||||
def lat2 = null
|
||||
def lng = null
|
||||
def lat = null
|
||||
if(d['D']=="高德"){
|
||||
lng = (d['I'].toDouble()*10000000000).longValue()
|
||||
lat = (d['J'].toDouble()*10000000000).longValue()
|
||||
def gmap = GeocodeUtils.getGaodeToBaidu(d['I'].toDouble(), d['J'].toDouble())
|
||||
if(gmap){
|
||||
lng2 = (gmap.get("lng")*10000000000).longValue()
|
||||
lat2 = (gmap.get("lat")*10000000000).longValue()
|
||||
}
|
||||
|
||||
}else{
|
||||
lng2 = (d['I'].toDouble()*10000000000).longValue()
|
||||
lat2 = (d['J'].toDouble()*10000000000).longValue()
|
||||
def gmap = GeocodeUtils.geoconvBaiduToGoogle(d['I'].toDouble(), d['J'].toDouble())
|
||||
if(gmap){
|
||||
lng = (gmap.get("lng")*10000000000).longValue()
|
||||
lat = (gmap.get("lat")*10000000000).longValue()
|
||||
}
|
||||
}
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("lng", lng)
|
||||
udata.put("lat", lat)
|
||||
udata.put("lng2", lng2)
|
||||
udata.put("lat2", lat2)
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
|
||||
|
||||
def dbo = DbUtils.seaweed.findOne(q)
|
||||
d['K'] = "修正"
|
||||
|
||||
}
|
||||
}
|
||||
},0)
|
||||
|
||||
}
|
||||
|
||||
|
||||
def run4(){
|
||||
ExcelUtils.modify("d:\\数据\\福州\\福州相同经纬度小区4.xlsx", {d->
|
||||
def region = d['B']
|
||||
def name = d['C']
|
||||
if(!d['K']){
|
||||
def dist = ["city":d['A'], "region":region, "name":name]
|
||||
def loactionMap = matchMap(dist)
|
||||
if(loactionMap){
|
||||
d['D'] << loactionMap.source
|
||||
d['E'] << loactionMap.region
|
||||
d['F'] << loactionMap.mapName
|
||||
def distance = null
|
||||
if(loactionMap.source=="高德"){
|
||||
distance = GeoHelper.GetDistance(dist.lat/10000000000.0, dist.lng/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
}else if(loactionMap.source=="百度"){
|
||||
distance = GeoHelper.GetDistance(dist.lat2/10000000000.0, dist.lng2/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
}
|
||||
d['G'] << distance
|
||||
d['H'] << loactionMap.address
|
||||
d['I'] << loactionMap.lng
|
||||
d['J'] << loactionMap.lat
|
||||
if(dist.region==loactionMap.region){
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,与地图相同"
|
||||
}else{
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内 地图:"+ loactionMap.region+" "+distance
|
||||
}
|
||||
}else{
|
||||
// ret << ""
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,地图没找到"
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def matchMap(def dist){
|
||||
def gaodeRest = FangjiaClientUtils.searchMapData(dist.city, dist.name,"住宅", "高德")
|
||||
def locationMap = null
|
||||
def gdlocationMap = null
|
||||
def bdlocationMap = null
|
||||
if(gaodeRest){
|
||||
locationMap = getMapLocation(dist, gaodeRest);
|
||||
if(locationMap){
|
||||
return locationMap
|
||||
gdlocationMap = getMapLocation(dist, gaodeRest);
|
||||
if(gdlocationMap){
|
||||
gdlocationMap.source = "高德"
|
||||
}
|
||||
}
|
||||
|
||||
def baiduRest = null
|
||||
if (!locationMap) {
|
||||
baiduRest = FangjiaClientUtils.searchMapData(dist.city, dist.name,"住宅", "百度")
|
||||
}
|
||||
def baiduRest = FangjiaClientUtils.searchMapData(dist.city, dist.name,"住宅", "百度")
|
||||
if(baiduRest){
|
||||
locationMap = getMapLocation(dist, baiduRest);
|
||||
bdlocationMap = getMapLocation(dist, baiduRest);
|
||||
if(bdlocationMap){
|
||||
bdlocationMap.source = "百度"
|
||||
}
|
||||
}
|
||||
return locationMap
|
||||
|
||||
if(gdlocationMap && bdlocationMap){
|
||||
if(gdlocationMap.score>=bdlocationMap.score){
|
||||
return gdlocationMap
|
||||
}else{
|
||||
return bdlocationMap
|
||||
}
|
||||
}else if(gdlocationMap){
|
||||
return gdlocationMap
|
||||
}else if(bdlocationMap){
|
||||
return bdlocationMap
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
def getMapLocation(def dist, def rets){
|
||||
@@ -93,6 +263,8 @@ class LocationTest {
|
||||
def lng = null
|
||||
def region = null
|
||||
def mapName = null
|
||||
def address = null
|
||||
def score = 0
|
||||
for(def r : rets){
|
||||
if(!r.city){
|
||||
continue
|
||||
@@ -100,12 +272,20 @@ class LocationTest {
|
||||
if(!r.city.contains(dist.city)){
|
||||
continue
|
||||
}
|
||||
def name = r.name.replace("?","").replace("&","").replace("·","").replace(".","").replace("(","").replace(")","").replace("(","").replace(")","").replace("【","").replace("】","").replace("11期","十一期").replace("12期","十二期").replace("13期","十三期").replace("14期","十四期").replace("15期","十五期").replace("16期","十六期").replace("17期","十七期").replace("18期","十八期").replace("19期","十九期").replace("10期","十期").replace("1期","一期").replace("2期","二期").replace("3期","三期").replace("4期","四期").replace("5期","五期").replace("6期","六期").replace("7期","七期").replace("8期","八期").replace("9期","九期").replace(" ","").trim()
|
||||
def name = r.name.replace("?","").replace("&","").replace("·","").replace(".","").replace("(","").replace(")","").replace("(","").replace(")","").replace("【","").replace("】","").replace("11期","十一期").replace("12期","十二期").replace("13期","十三期").replace("14期","十四期").replace("15期","十五期").replace("16期","十六期").replace("17期","十七期").replace("18期","十八期").replace("19期","十九期").replace("10期","十期").replace("1期","一期").replace("2期","二期").replace("3期","三期").replace("4期","四期").replace("5期","五期").replace("6期","六期").replace("7期","七期").replace("8期","八期").replace("9期","九期").replace(" ","").replace("建设中","").replace("钢混","").trim()
|
||||
if(dist.name == name){
|
||||
lat = r.lat
|
||||
lng = r.lng
|
||||
mapName = r.name
|
||||
region = r.district
|
||||
address = r.address
|
||||
|
||||
if(r.district.contains(dist.region)){
|
||||
score = 10
|
||||
}else {
|
||||
score = 5
|
||||
}
|
||||
|
||||
}else{
|
||||
def word = null
|
||||
if (name.length() >= dist.name.length()) {
|
||||
@@ -116,11 +296,18 @@ class LocationTest {
|
||||
if (word) {
|
||||
def words = ["商住楼", "小区","公寓","别墅"]
|
||||
for (def w : words) {
|
||||
if (word == w) {
|
||||
if (word == w ) {
|
||||
lat = r.lat
|
||||
lng = r.lng
|
||||
region = r.district
|
||||
mapName = r.name
|
||||
address = r.address
|
||||
|
||||
if(r.district.contains(dist.region)){
|
||||
score = 9
|
||||
}else {
|
||||
score = 5
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -132,6 +319,30 @@ class LocationTest {
|
||||
lng = r.lng
|
||||
region = r.district
|
||||
mapName = r.name
|
||||
address = r.address
|
||||
if(r.district.contains(dist.region)){
|
||||
score = 8
|
||||
}else {
|
||||
score = 5
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if(!lng){
|
||||
Pattern pattern = Pattern.compile("[A-Za-z]区");
|
||||
Matcher matcher = pattern.matcher(word);
|
||||
if(matcher.find()){
|
||||
lat = r.lat
|
||||
lng = r.lng
|
||||
region = r.district
|
||||
mapName = r.name
|
||||
address = r.address
|
||||
if(r.district.contains(dist.region)){
|
||||
score = 7
|
||||
}else {
|
||||
score = 5
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -142,10 +353,8 @@ class LocationTest {
|
||||
}
|
||||
}
|
||||
if(lng){
|
||||
return ["region":region, "lng":lng, "lat":lat, "mapName":mapName]
|
||||
return ["region":region, "lng":lng, "lat":lat, "mapName":mapName, "address":address, "score":score]
|
||||
}
|
||||
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
+14
-11
@@ -502,18 +502,21 @@ class GaoDeUtils {
|
||||
}
|
||||
|
||||
static String getRandomKey2() {
|
||||
def KeyList = [
|
||||
"2af0b8533415a612b98d59bb93d664b9",
|
||||
"0246c57bbcf24aa246c207b3c99dfe41",
|
||||
"042328b3f0fa5daf426802d379521d87",
|
||||
"055d4f1b5b64a2bce18f4fe1f15c2639",
|
||||
"d5484f5170502405d88bbaffe1b496f0",
|
||||
"e74ccc4258079d2200199695110cceb1",
|
||||
"f58629fc799fbc8537ca85046c6d44a5",
|
||||
"291073f17ee0b963ccb1927ed92bf265",
|
||||
"2a1fb75990f2b39f6221e50892dd3988"
|
||||
]
|
||||
// def KeyList = [
|
||||
// "2af0b8533415a612b98d59bb93d664b9",
|
||||
// "0246c57bbcf24aa246c207b3c99dfe41",
|
||||
// "042328b3f0fa5daf426802d379521d87",
|
||||
// "055d4f1b5b64a2bce18f4fe1f15c2639",
|
||||
// "d5484f5170502405d88bbaffe1b496f0",
|
||||
// "e74ccc4258079d2200199695110cceb1",
|
||||
// "f58629fc799fbc8537ca85046c6d44a5",
|
||||
// "291073f17ee0b963ccb1927ed92bf265",
|
||||
// "2a1fb75990f2b39f6221e50892dd3988"
|
||||
// ]
|
||||
|
||||
def KeyList = [
|
||||
"10bcb421d2ee4e51ed9268d6dca58ad1"
|
||||
]
|
||||
def count = RandomUtils.nextInt(KeyList.size())
|
||||
return KeyList.get(count);
|
||||
}
|
||||
|
||||
+301
@@ -0,0 +1,301 @@
|
||||
package com.fangjia.script.gj.test
|
||||
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
class AddressStandard {
|
||||
static main(args) {
|
||||
def task = new AddressStandard()
|
||||
task.run()//地址标准化
|
||||
task.test()//统计标准化后的结果
|
||||
|
||||
}
|
||||
|
||||
def run2(){
|
||||
ExcelUtils.multiThreadingModify("d://数据//地址标准化//阿里接口拆分数据(1).xlsx",{d->
|
||||
def json = FangjiaClientUtils.addressStand(d['A'])
|
||||
|
||||
if(json && json.status!=0){
|
||||
println d['A'] +" "+json
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def run(){
|
||||
// def datas = ExcelUtils.read("d://数据//地址标准化//阿里接口拆分数据(1-test).xlsx",0,1)
|
||||
|
||||
|
||||
ExcelUtils.multiThreadingModify("d://数据//地址标准化//阿里接口拆分数据(1).xlsx",{d->
|
||||
if(d['A']){
|
||||
for(def i=18;i<d.size();i++){
|
||||
d[i] = null
|
||||
}
|
||||
|
||||
def json = FangjiaClientUtils.addressStand(d['A'])
|
||||
if(json && json.entities){
|
||||
def entities = json.entities
|
||||
for(def m : entities){
|
||||
if(m.type=="prov"){
|
||||
d['S'] = m.word
|
||||
}
|
||||
if(m.type=="city"){
|
||||
d['T'] = m.word
|
||||
}
|
||||
if(m.type=="dist") {
|
||||
d['U'] = m.word
|
||||
}
|
||||
if(m.type=="town") {
|
||||
d['V'] = m.word
|
||||
}
|
||||
if(m.type=="community") {
|
||||
d['W'] = m.word
|
||||
}
|
||||
if(m.type=="road") {
|
||||
d['X'] = m.word
|
||||
}
|
||||
|
||||
if(m.type=="roadno") {
|
||||
d['Y'] = m.word
|
||||
}
|
||||
if(m.type=="dir") {
|
||||
d['Z'] = m.word
|
||||
}
|
||||
if(m.type=="poi") {
|
||||
d['AA'] = m.word
|
||||
}
|
||||
if(m.type=="subpoi") {
|
||||
d['AB'] = m.word
|
||||
}
|
||||
if(m.type=="group") {
|
||||
d['AC'] = m.word
|
||||
}
|
||||
if(m.type=="houseno") {
|
||||
d['AD'] = m.word
|
||||
}
|
||||
if(m.type=="cellno") {
|
||||
d['AE'] = m.word
|
||||
}
|
||||
if(m.type=="floorno") {
|
||||
d['AF'] = m.word
|
||||
}
|
||||
if(m.type=="roomno") {
|
||||
d['AG'] = m.word
|
||||
}
|
||||
if(m.type=="dev"){
|
||||
d['AH'] = m.word
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},0)
|
||||
|
||||
}
|
||||
|
||||
|
||||
def test(){
|
||||
def AtomicInteger provCount = new AtomicInteger(0)
|
||||
def AtomicInteger cityCount = new AtomicInteger(0)
|
||||
def AtomicInteger distCount = new AtomicInteger(0)
|
||||
def AtomicInteger townCount = new AtomicInteger(0)
|
||||
def AtomicInteger roadCount = new AtomicInteger(0)
|
||||
def AtomicInteger roadnoConnt = new AtomicInteger(0)
|
||||
def AtomicInteger communityCount = new AtomicInteger(0)
|
||||
def AtomicInteger poiCount = new AtomicInteger(0)
|
||||
def AtomicInteger subpoiCount = new AtomicInteger(0)
|
||||
def AtomicInteger housenoCount = new AtomicInteger(0)
|
||||
def AtomicInteger cellnoCount = new AtomicInteger(0)
|
||||
def AtomicInteger floornoCount = new AtomicInteger(0)
|
||||
def AtomicInteger roomnoCount = new AtomicInteger(0)
|
||||
def AtomicInteger devCount = new AtomicInteger(0)
|
||||
|
||||
def AtomicInteger total = new AtomicInteger(0)
|
||||
|
||||
ExcelUtils.multiThreadingModify("d://数据//地址标准化//阿里接口拆分数据(1).xlsx",{d->
|
||||
total.addAndGet(1)
|
||||
def sameCount = 0
|
||||
def list = []
|
||||
def a_prov = d['B']?d['B']:""
|
||||
if(a_prov && (a_prov.toString().endsWith("省") || a_prov.toString().endsWith("自治区"))){
|
||||
a_prov = a_prov.replace("维吾尔自治区","").replace("回族自治区","").replace("壮族自治区","").replace("自治区省","").replace("自治区","").replace("省","")
|
||||
}
|
||||
def b_prov = d['S']?d['S']:""
|
||||
if(b_prov && (b_prov.toString().endsWith("省") || b_prov.toString().endsWith("自治区"))){
|
||||
b_prov = b_prov.replace("维吾尔自治区","").replace("回族自治区","").replace("壮族自治区","").replace("自治区省","").replace("自治区","").replace("省","")
|
||||
}
|
||||
if(a_prov == b_prov){
|
||||
provCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "prov"
|
||||
}
|
||||
|
||||
def a_city = d['C']?d['C']:""
|
||||
def b_city = d['T']?d['T']:""
|
||||
if(a_city && a_city.toString().endsWith("市")){
|
||||
a_city = a_city.replace("市","")
|
||||
}
|
||||
if(b_city && b_city.toString().endsWith("市")){
|
||||
b_city = b_city.replace("市","")
|
||||
}
|
||||
if(a_city == b_city){
|
||||
cityCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "city"
|
||||
}
|
||||
|
||||
def a_dist = d['D']?d['D']:""
|
||||
def b_dist = d['U']?d['U']:""
|
||||
if(a_dist && (a_dist.endsWith("区")||a_dist.endsWith("县"))){
|
||||
a_dist = a_dist.replace("新区","").replace("区","").replace("县","")
|
||||
}
|
||||
if(b_dist && (b_dist.endsWith("区")||b_dist.endsWith("县"))){
|
||||
b_dist = b_dist.replace("新区","").replace("区","").replace("县","")
|
||||
}
|
||||
|
||||
if(a_dist == b_dist){
|
||||
distCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "dist"
|
||||
}
|
||||
|
||||
def a_town = d['E']?d['E']:""
|
||||
def b_town = d['V']?d['V']:""
|
||||
if(a_town==b_town){
|
||||
townCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "town"
|
||||
}
|
||||
|
||||
|
||||
|
||||
def a_road = d['F']?d['F']:""
|
||||
def b_road = d['X']?d['X']:""
|
||||
if(a_road == b_road){
|
||||
roadCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "road"
|
||||
}
|
||||
|
||||
|
||||
def a_roadno = d['H']?d['H']:""
|
||||
def b_roadno = d['Y']?d['Y']:""
|
||||
if(a_roadno == b_roadno){
|
||||
roadnoConnt.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "roadno"
|
||||
}
|
||||
|
||||
def a_community = d['I']?d['I']:""
|
||||
def b_community = d['W']?d['W']:""
|
||||
if(a_community == b_community){
|
||||
communityCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "community"
|
||||
}
|
||||
|
||||
def a_poi = d['J']?d['J']:""
|
||||
def b_poi = d['AA']?d['AA']:""
|
||||
if(a_poi == b_poi){
|
||||
poiCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "poi"
|
||||
}
|
||||
|
||||
def a_subpoi = d['K']?d['K']:""
|
||||
def b_subpoi = d['AB']?d['AB']:""
|
||||
if(a_subpoi == b_subpoi){
|
||||
subpoiCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "subpoi"
|
||||
}
|
||||
|
||||
def a_houseno = d['L']?d['L'].replace("号楼","").replace("幢楼","").replace("栋号","").replace("幢","").replace("栋","").replace("座","").replace("号","").replace("楼","").replace("第","").replace("楼",""):""
|
||||
def b_houseno = d['AD']?d['AD'].replace("号楼","").replace("幢楼","").replace("栋号","").replace("幢","").replace("栋","").replace("座","").replace("号","").replace("楼","").replace("第","").replace("楼",""):""
|
||||
if(a_houseno == b_houseno){
|
||||
housenoCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "houseno"
|
||||
}
|
||||
|
||||
def a_cellno = d['M']?chNumberConver(d['M'].replace("单元","")):""
|
||||
def b_cellno = d['AE']?chNumberConver(d['AE'].replace("单元","")):""
|
||||
if(a_cellno == b_cellno){
|
||||
cellnoCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "cellno"
|
||||
}
|
||||
|
||||
def a_floorno = d['N']?d['N'].replace("层楼","").replace("层","").replace("楼",""):""
|
||||
def b_floorno = d['AF']?d['AF'].replace("层楼","").replace("层","").replace("楼",""):""
|
||||
if(a_floorno == b_floorno){
|
||||
floornoCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "floorno"
|
||||
}
|
||||
|
||||
def a_roomno = d['O']?d['O'].replace("室号","").replace("号门","").replace("室","").replace("房","").replace("户","").replace("号","").replace("门",""):""
|
||||
def b_roomno = d['AG']?d['AG'].replace("室号","").replace("号门","").replace("室","").replace("房","").replace("户","").replace("号","").replace("门",""):""
|
||||
if(a_roomno == b_roomno){
|
||||
roomnoCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "roomno"
|
||||
}
|
||||
|
||||
def a_dev = d['Q']?d['Q']:''
|
||||
def b_dev = d['AH']?d['AH']:''
|
||||
if(a_dev == b_dev){
|
||||
devCount.addAndGet(1)
|
||||
sameCount++
|
||||
}else{
|
||||
list << "dev"
|
||||
}
|
||||
|
||||
d['AI'] = sameCount
|
||||
d['AJ'] = list.join(",")
|
||||
|
||||
},0)
|
||||
|
||||
def totalCount = total.get()
|
||||
println totalCount
|
||||
def prov_pre = DataHandleUtils.getDoubleRound(2, provCount.get()*100.0/totalCount)
|
||||
def city_pre = DataHandleUtils.getDoubleRound(2, cityCount.get()*100.0/totalCount)
|
||||
def dist_pre = DataHandleUtils.getDoubleRound(2, distCount.get()*100.0/totalCount)
|
||||
def town_pre = DataHandleUtils.getDoubleRound(2, townCount.get()*100.0/totalCount)
|
||||
def community_pre = DataHandleUtils.getDoubleRound(2, communityCount.get()*100.0/totalCount)
|
||||
def road_pre = DataHandleUtils.getDoubleRound(2, roadCount.get()*100.0/totalCount)
|
||||
def roadno_pre = DataHandleUtils.getDoubleRound(2, roadnoConnt.get()*100.0/totalCount)
|
||||
def poi_pre = DataHandleUtils.getDoubleRound(2, poiCount.get()*100.0/totalCount)
|
||||
def subpoi_pre = DataHandleUtils.getDoubleRound(2, subpoiCount.get()*100.0/totalCount)
|
||||
def houseno_pre = DataHandleUtils.getDoubleRound(2, housenoCount.get()*100.0/totalCount)
|
||||
def cellno_pre = DataHandleUtils.getDoubleRound(2, cellnoCount.get()*100.0/totalCount)
|
||||
def floor_pre = DataHandleUtils.getDoubleRound(2, floornoCount.get()*100.0/totalCount)
|
||||
def roomno_pre = DataHandleUtils.getDoubleRound(2, roomnoCount.get()*100.0/totalCount)
|
||||
def datas = []
|
||||
datas << ["总量", "prov","city","dist","town","community","road","roadno","poi","subpoi","houseno","cellno","floor","roomno"]
|
||||
datas << [totalCount,prov_pre,city_pre,dist_pre,town_pre,community_pre,road_pre,roadno_pre,poi_pre,subpoi_pre,houseno_pre,cellno_pre,floor_pre,roomno_pre]
|
||||
ExcelUtils.write("d://数据//地址标准化//测试结果1.xlsx", datas, "数据")
|
||||
|
||||
}
|
||||
|
||||
def chNumberConver(def s){
|
||||
if(s && s.size()==1){
|
||||
return s.replace("一","1").replace("二","2").replace("三","3").replace("四","4").replace("五","5").replace("六","6").replace("七","7").replace("八","8").replace("九","9").replace("十","10")
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
+18
-9
@@ -15,8 +15,8 @@ class CrawlDistrictIdSelect {
|
||||
|
||||
static main(args) {
|
||||
def task = new CrawlDistrictIdSelect()
|
||||
// task.run()
|
||||
task.synch()
|
||||
task.run()
|
||||
// task.synch()
|
||||
}
|
||||
|
||||
def synch(){
|
||||
@@ -38,25 +38,34 @@ class CrawlDistrictIdSelect {
|
||||
|
||||
def run(){
|
||||
def datas = findCrawlData()
|
||||
def list = []
|
||||
datas.each {k,v->
|
||||
if(v){
|
||||
for(def d : v){
|
||||
d.c_date = new Date()
|
||||
d.m_date = new Date()
|
||||
districtseedsColl.save(d)
|
||||
list << d
|
||||
}
|
||||
}
|
||||
|
||||
if(list.size()==10000){
|
||||
districtseedsColl.insert(list)
|
||||
list = []
|
||||
}
|
||||
}
|
||||
if(list.size()>0){
|
||||
districtseedsColl.insert(list)
|
||||
}
|
||||
}
|
||||
|
||||
def findCrawlData(){
|
||||
def q = new BasicDBObject()
|
||||
// q.put("city","¸£ÖÝ")
|
||||
q.put("source", "Öî¸ðÕÒ·¿")
|
||||
q.put("s_date",202010)
|
||||
q.put("source", "°²¾Ó¿Í")
|
||||
q.put("s_date",202012)
|
||||
def dbcursor = thirdPartyColl.find(q).batchSize(10000).setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def retMap = [:]
|
||||
def prefix = "xiaoqu.zhuge.com/"
|
||||
def prefix = "anjuke.com/"
|
||||
def keyList =new HashSet()
|
||||
for(def db : dbcursor){
|
||||
def url = null
|
||||
@@ -68,11 +77,11 @@ class CrawlDistrictIdSelect {
|
||||
url = db.url
|
||||
}
|
||||
if(url && url.contains(prefix) ){
|
||||
def district_id = url.substring(url.indexOf(prefix)+prefix.length(),url.size()-1)
|
||||
def district_id = db.district_id//url.substring(url.indexOf(prefix)+prefix.length(),url.size()-1)
|
||||
if(district_id=="0"){
|
||||
continue
|
||||
}
|
||||
def shortCity = url.substring(url.indexOf("//")+2, url.indexOf(".xiaoqu.zhuge.com"))
|
||||
def shortCity = url.substring(url.indexOf("//")+2, url.indexOf(".anjuke.com"))
|
||||
def key = shortCity +"#"+district_id
|
||||
|
||||
def ids = retMap.get(key)
|
||||
@@ -83,7 +92,7 @@ class CrawlDistrictIdSelect {
|
||||
|
||||
if(!keyList.contains(key)){
|
||||
def map = new BasicDBObject()
|
||||
map.root = "zhuge.com"
|
||||
map.root = "anjuke.com"
|
||||
map.city_short= shortCity
|
||||
map.city = db.city
|
||||
map.region = db.region
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ class CZBlankDataExport {
|
||||
def directionMap1 = ["Î÷ÄÏ":1,"¶«ÄÏ":2,"ÄÏ":3,"Î÷±±":4,"¶«±±":5,"¶«":6,"Î÷":7,"±±":8,"¶«Î÷":9,"Äϱ±":10]
|
||||
def directionMap = [1:"ÄÏ",2:"±±",3:"Äϱ±",4:"¶«",5:"Î÷",6:"¶«Î÷",7:"¶«ÄÏ",8:"Î÷ÄÏ",9:"¶«±±",10:"Î÷±±"]
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200?timezone=UTC&page.size=240&connect.timeout=240000&network.timeout=60000&page.timeout=240000&query.timeout=90000"
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+5
-4
@@ -166,8 +166,8 @@ class Esf58Crawl extends BaseBatch{
|
||||
def addr = JQueryUtils.selectText(".desc", detailDocument);
|
||||
if(info){
|
||||
if(info.size()>=4){
|
||||
city = info[2].replace("小区","")
|
||||
region = info[3].replace("小区","")
|
||||
city = info[2].replace("小区","").trim()
|
||||
region = info[3].replace("小区","").trim()
|
||||
}
|
||||
}
|
||||
if(!addr){
|
||||
@@ -212,8 +212,8 @@ class Esf58Crawl extends BaseBatch{
|
||||
def saveThirdParty(metadata){
|
||||
DBObject obj = new BasicDBObject();
|
||||
obj.put("district_id", metadata.url);
|
||||
obj.put("city", metadata.city);
|
||||
obj.put("region", metadata.region);
|
||||
obj.put("city", metadata.city.trim());
|
||||
obj.put("region", metadata.region.trim());
|
||||
obj.put("block", metadata.block);
|
||||
obj.put("name", metadata.name);
|
||||
obj.put("s_date", SHORT_DATE);
|
||||
@@ -221,6 +221,7 @@ class Esf58Crawl extends BaseBatch{
|
||||
obj.put("addres", metadata.address);
|
||||
obj.put("avg_price", metadata.avg_price.toInteger());
|
||||
obj.put("c_date", new Date());
|
||||
println obj.toString()
|
||||
thirdPartyColl.save(obj);
|
||||
}
|
||||
|
||||
|
||||
+12
-7
@@ -4,14 +4,17 @@ import com.fangjia.script.util.CommonUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.apache.solr.common.util.Hash
|
||||
|
||||
/**
|
||||
* 福州农商行
|
||||
* 将抓取的小区均价同步到第三方均价表中
|
||||
*/
|
||||
class SynchDistrictPrice {
|
||||
|
||||
def static final SHORT_DATE = Utils.getLastMonth()
|
||||
def thirdPartyColl = CrawalDBUtil.getThirdPartyCol();
|
||||
def districtDetailColl = CrawalDBUtil.getDistrictDetailColl();
|
||||
def sourceMap = ["jiwu.com":"吉屋"]
|
||||
//"58.com":"58同城","lianjia.com":"链家","ke.com":"贝壳找房","fang.com":"搜房","fangdd.com":"房多多","jiwu.com":"吉屋"
|
||||
|
||||
def sourceMap = ["jiwu.com":"吉屋","58.com":"58同城","lianjia.com":"链家","ke.com":"贝壳找房","fang.com":"搜房","fangdd.com":"房多多","house365.com":"365淘房",
|
||||
"anjuke.com":"安居客"]
|
||||
static main(args) {
|
||||
def task = new SynchDistrictPrice()
|
||||
task.run()
|
||||
@@ -19,13 +22,14 @@ class SynchDistrictPrice {
|
||||
|
||||
|
||||
def run(){
|
||||
def citys = ["福州"]//CommonUtils.findAllCity()
|
||||
def citys = CommonUtils.findAllCity()
|
||||
|
||||
sourceMap.each { k, v ->
|
||||
for(def city : citys){
|
||||
def rets = findCrawlDistrictDetails(city, k, v)
|
||||
synchData(city, rets, v)
|
||||
println city +" "+rets.size()
|
||||
synchData(city, rets, v)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +80,7 @@ class SynchDistrictPrice {
|
||||
}catch(Exception e){
|
||||
println e.getMessage()
|
||||
}
|
||||
|
||||
println "["+source +"-"+city + "] add:"+ rets.size()+" 原抓取:"+count
|
||||
}else{
|
||||
for(def r : rets){
|
||||
def flag = findIsExists(r.city, r.region, r.name, SHORT_DATE, source)
|
||||
@@ -85,9 +89,10 @@ class SynchDistrictPrice {
|
||||
thirdPartyColl.save(r)
|
||||
}
|
||||
}
|
||||
println "["+source +"-"+city + "] add:"+ addIndex+" 原抓取:"+count
|
||||
}
|
||||
|
||||
println "["+source +"-"+city + "] add:"+ addIndex+" 原抓取:"+count
|
||||
|
||||
}
|
||||
|
||||
def findIsExists(def city, def region, def name, def sDate, def source){
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ class TestCrawlTotalCount {
|
||||
def run(){
|
||||
def sources = ["房估估","诸葛找房","安居客","搜房","中原地产","赶集","链家","兔博士","城市房产","贝壳找房","Q房","Q房(新)","中原地产(新)","乐有家","乐有家(新)","房探","房多多","小资家","我爱我家","麦田","房途","C21","乐居","房产超市","58同城","365淘房"]
|
||||
for(def source :sources){
|
||||
def count1 = findTotalCount(source, 202102);
|
||||
def count2 = findTotalCount(source, 202103);
|
||||
def count1 = findTotalCount(source, 202105);
|
||||
def count2 = findTotalCount(source, 202106);
|
||||
println source +" "+count1 +" "+count2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.script.util
|
||||
|
||||
import com.fangjia.script.lixue.util.DateFormat
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.poi.hssf.record.BoolErrRecord
|
||||
|
||||
@@ -389,8 +390,8 @@ public class ExcelUtils{
|
||||
try{
|
||||
closure.call(row)
|
||||
int count = counter.incrementAndGet()
|
||||
if(count % 100 == 0){
|
||||
println("执行进度:${com.fangjia.core.util.DataUtil.roundDouble((count * 100)/total, 2)}%")
|
||||
if(count % 1000 == 0){
|
||||
println(DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")+"执行进度:${com.fangjia.core.util.DataUtil.roundDouble((count * 100)/total, 2)}%")
|
||||
}
|
||||
}catch (Exception e){
|
||||
println(row)
|
||||
|
||||
+2
-2
@@ -121,9 +121,9 @@ public class OpenApiClient {
|
||||
params.put("suggestName", suggestName)
|
||||
}
|
||||
|
||||
String content = new HttpRequest().get("http://open.fangjia.com/address/match", params, "utf-8")
|
||||
String content = new HttpRequest().get("http://open.fangjia.com/address/matchV2", params, "utf-8")
|
||||
while (content == null) {
|
||||
content = new HttpRequest().get("http:///open.fangjia.com/address/match", params, "utf-8")
|
||||
content = new HttpRequest().get("http:///open.fangjia.com/address/matchV2", params, "utf-8")
|
||||
println("${city} ${input} ${cat}程序调用异常")
|
||||
Thread.sleep(6000)
|
||||
}
|
||||
|
||||
+35
@@ -173,6 +173,41 @@ class GaoDeApiUtils {
|
||||
}
|
||||
|
||||
|
||||
def static around2(String location,String radius, String keywords = null, types = null) {
|
||||
Map<String, String> params = new HashMap<String, String>()
|
||||
params.put("key", GAO_DE_AK)
|
||||
if(keywords){
|
||||
params.put("keywords", keywords)
|
||||
}
|
||||
if(types){
|
||||
params.put("types", types)
|
||||
}
|
||||
if(location){
|
||||
params.put("location", location)
|
||||
}
|
||||
if(radius){
|
||||
params.put("radius", radius)
|
||||
}
|
||||
params.put("sortrule", "distance")
|
||||
String content = null;
|
||||
try {
|
||||
content = new HttpRequest().newGet("https://restapi.amap.com/v3/place/around", params, "utf-8")
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
JSONObject jsonObj = JSONObject.fromObject(content)
|
||||
if(jsonObj && jsonObj.get("infocode").equals("10000")){
|
||||
return jsonObj
|
||||
}else if(jsonObj && jsonObj.get("infocode").equals("20003")){
|
||||
return null;
|
||||
} else {
|
||||
return around(location, radius, keywords, types)
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
def static searchKey(def keyword, def cityCode){
|
||||
def url = "https://www.amap.com/service/poiInfo?query_type=TQUERY&pagesize=20&pagenum=1&qii=true&cluster_state=5&need_utd=true&utd_sceneid=1000&div=PC1000&addr_poi_merge=true&is_classify=true&zoom=10&city="+cityCode+"&geoobj=113.082026%7C22.516777%7C115.059608%7C22.922141&keywords="+URLEncoder.encode(keyword,"UTF-8")
|
||||
String content
|
||||
|
||||
+99
-47
@@ -9,8 +9,10 @@ import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.QueryOperators
|
||||
|
||||
/**
|
||||
* 浙商本地化部署同步脚本
|
||||
* 浙商本地化部署同步脚本
|
||||
*/
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class BasicInfoDataSynch extends BaseBatch{
|
||||
@@ -50,14 +52,14 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
zsCitysMap.put(zsCitys._id.toString(), zsCitys)
|
||||
zsDatas << zsCitys
|
||||
}
|
||||
//数据存在则修改,不存在则保存
|
||||
//数据存在则修改,不存在则保存
|
||||
if(fangjiaCitys){
|
||||
for(def fjCity : fangjiaCitys){
|
||||
if(fjCity.display!="全国"){
|
||||
if(fjCity.display!="全国"){
|
||||
fjCitysMap.put(fjCity._id.toString(), fjCity)
|
||||
}
|
||||
def zsCity = zsCitysMap.get(fjCity._id.toString())
|
||||
if(zsCity){//修改
|
||||
if(zsCity){//修改
|
||||
if(zsCity.province != fjCity.province || zsCity.alias!=fjCity.alias){
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("province",fjCity.province)
|
||||
@@ -66,7 +68,7 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
udata.put("update_date",new Date().getTime())
|
||||
ZS_CITYS_CONN.update(new BasicDBObject("_id",zsCity._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}else{//保存
|
||||
}else{//保存
|
||||
def addUata = new BasicDBObject()
|
||||
addUata.put("_id",fjCity._id)
|
||||
addUata.put("display",fjCity.display)
|
||||
@@ -79,7 +81,7 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
}
|
||||
}
|
||||
|
||||
//老数据不在新数据中,被删除时,状态修改为1
|
||||
//老数据不在新数据中,被删除时,状态修改为1
|
||||
if(zsDatas){
|
||||
for(def zsCity : zsDatas){
|
||||
def fjCity = fjCitysMap.get(zsCity._id.toString())
|
||||
@@ -92,7 +94,7 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
}
|
||||
}
|
||||
|
||||
println "[${fangjiaCitys.size()}]个城市同步完成"
|
||||
println "[${fangjiaCitys.size()}]个城市同步完成"
|
||||
|
||||
}
|
||||
def synchRegion(){
|
||||
@@ -137,7 +139,7 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
}
|
||||
}
|
||||
}
|
||||
println "[${fjRegions.size()}]个行政区域同步完成"
|
||||
println "[${fjRegions.size()}]个行政区域同步完成"
|
||||
}
|
||||
|
||||
def synchTown(){
|
||||
@@ -183,40 +185,48 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
}
|
||||
}
|
||||
}
|
||||
println "[${fjTowns.size()}]个乡镇同步完成"
|
||||
println "[${fjTowns.size()}]个乡镇同步完成"
|
||||
}
|
||||
def synchDict(){
|
||||
def fjDicts = CommonDatautils.getAllDictionary()
|
||||
def zsDictCursor = ZS_DICT_CONN.find(new BasicDBObject())
|
||||
def zsDicts = []
|
||||
def zsDictMap = [:]
|
||||
def fjDictMap = [:]
|
||||
for(def obj : zsDictCursor){
|
||||
zsDictMap.put(obj._id.toString(), obj)
|
||||
zsDicts << obj;
|
||||
def dbcursor = ZS_DICT_CONN.find(new BasicDBObject()).sort(new BasicDBObject("version",-1)).limit(1)
|
||||
def maxObj = null
|
||||
for(def dbo : dbcursor){
|
||||
maxObj = dbo
|
||||
}
|
||||
if(fjDicts){
|
||||
def version = 1
|
||||
if(maxObj && maxObj.version){
|
||||
version = maxObj.version + 1
|
||||
}
|
||||
|
||||
|
||||
def fjDicts = CommonDatautils.getAllDictionary()
|
||||
|
||||
def deleteQuery = new BasicDBObject()
|
||||
if(maxObj && maxObj.version){
|
||||
deleteQuery.put("version", maxObj.version)
|
||||
}else{
|
||||
deleteQuery.put("version", new BasicDBObject(QueryOperators.EXISTS, false))
|
||||
}
|
||||
ZS_DICT_CONN.remove(deleteQuery)
|
||||
|
||||
if(fjDicts) {
|
||||
def addDatas = []
|
||||
for(def fjDict : fjDicts){
|
||||
fjDictMap.put(fjDict._id.toString(), fjDict)
|
||||
def zsDictObj = zsDictMap.get(fjDict._id.toString())
|
||||
for (def fjDict : fjDicts) {
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("cat",fjDict.cat)
|
||||
udata.put("name",fjDict.name)
|
||||
if(fjDict.address_components){
|
||||
udata.put("address_components", fjDict.address_components)
|
||||
}
|
||||
udata.put("status",0)
|
||||
udata.put("update_date",new Date().getTime())
|
||||
if(zsDictObj){
|
||||
if(fjDict.cat!=zsDictObj.cat||fjDict.name!=zsDictObj.name||zsDictObj.status!=0){
|
||||
ZS_DICT_CONN.update(new BasicDBObject("_id",zsDictObj._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}else{
|
||||
udata.put("_id",fjDict._id)
|
||||
addDatas << udata
|
||||
if(addDatas.size()%10000==0){
|
||||
println addDatas.size()/10000 +" 10000"
|
||||
ZS_DICT_CONN.insert(addDatas);
|
||||
addDatas = [];
|
||||
}
|
||||
udata.put("version", version)
|
||||
udata.put("_id",fjDict._id)
|
||||
addDatas << udata
|
||||
if(addDatas.size()%10000==0){
|
||||
println addDatas.size()/10000 +" 10000"
|
||||
ZS_DICT_CONN.insert(addDatas);
|
||||
addDatas = [];
|
||||
}
|
||||
}
|
||||
if(addDatas.size()>0){
|
||||
@@ -225,18 +235,60 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
}
|
||||
}
|
||||
|
||||
if(zsDicts){
|
||||
for(def zsDict : zsDicts){
|
||||
def fjDict = fjDictMap.get(zsDict._id.toString())
|
||||
if(!fjDict){
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("status",1)
|
||||
udata.put("update_date",new Date().getTime())
|
||||
ZS_DICT_CONN.update(new BasicDBObject("_id",zsDict._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}
|
||||
}
|
||||
println "[${fjDicts.size()}]个字典数据同步完成"
|
||||
|
||||
|
||||
|
||||
/* def zsDictCursor = ZS_DICT_CONN.find(new BasicDBObject())
|
||||
def zsDicts = []
|
||||
def zsDictMap = [:]
|
||||
def fjDictMap = [:]
|
||||
for(def obj : zsDictCursor){
|
||||
zsDictMap.put(obj._id.toString(), obj)
|
||||
zsDicts << obj;
|
||||
}
|
||||
if(fjDicts){
|
||||
def addDatas = []
|
||||
for(def fjDict : fjDicts){
|
||||
fjDictMap.put(fjDict._id.toString(), fjDict)
|
||||
def zsDictObj = zsDictMap.get(fjDict._id.toString())
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("cat",fjDict.cat)
|
||||
udata.put("name",fjDict.name)
|
||||
udata.put("status",0)
|
||||
udata.put("update_date",new Date().getTime())
|
||||
udata.put("version", version)
|
||||
if(zsDictObj){
|
||||
if(fjDict.cat!=zsDictObj.cat||fjDict.name!=zsDictObj.name||zsDictObj.status!=0){
|
||||
ZS_DICT_CONN.update(new BasicDBObject("_id",zsDictObj._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}else{
|
||||
udata.put("_id",fjDict._id)
|
||||
addDatas << udata
|
||||
if(addDatas.size()%10000==0){
|
||||
println addDatas.size()/10000 +" 10000"
|
||||
ZS_DICT_CONN.insert(addDatas);
|
||||
addDatas = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(addDatas.size()>0){
|
||||
ZS_DICT_CONN.insert(addDatas);
|
||||
addDatas = [];
|
||||
}
|
||||
}
|
||||
|
||||
if(zsDicts){
|
||||
for(def zsDict : zsDicts){
|
||||
def fjDict = fjDictMap.get(zsDict._id.toString())
|
||||
if(!fjDict){
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("status",1)
|
||||
udata.put("update_date",new Date().getTime())
|
||||
ZS_DICT_CONN.update(new BasicDBObject("_id",zsDict._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}
|
||||
}*/
|
||||
println "[${fjDicts.size()}]个字典数据同步完成"
|
||||
}
|
||||
def synchDistrict(cat){
|
||||
def fangjiaCitys = CommonDatautils.findAllCity()
|
||||
@@ -315,10 +367,10 @@ class BasicInfoDataSynch extends BaseBatch{
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("status",1)
|
||||
udata.put("update_date",new Date().getTime())
|
||||
ZS_SEAWEED_CONN.update(new BasicDBObject("_id",fjDistrict._id), new BasicDBObject('$set',udata))
|
||||
ZS_SEAWEED_CONN.update(new BasicDBObject("_id",zsDistrict._id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
}
|
||||
}
|
||||
println "[${fjCity}-${cat}][${districts.size()}]个小区数据同步完成"
|
||||
println "[${fjCity}-${cat}][${districts.size()}]个小区数据同步完成"
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -34,6 +34,8 @@ public interface XcxUserInfoService {
|
||||
* @return
|
||||
*/
|
||||
public XcxKey getOpenId(String code);
|
||||
|
||||
public XcxKey getOpenId(String code, String appId, String secret);
|
||||
/**
|
||||
* 获取有多少人查询过他们自己的故事
|
||||
* @return
|
||||
|
||||
+33
@@ -101,6 +101,39 @@ public class XcxUserInfoServiceImpl implements XcxUserInfoService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public XcxKey getOpenId(String code, String appId, String secret) {
|
||||
HttpRequest http = new HttpRequest();
|
||||
//»ñÈ¡openid
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("appid", appId);
|
||||
map.put("secret", secret);
|
||||
map.put("grant_type", XCXConstant.GRANT_TYPE);
|
||||
map.put("js_code", code);
|
||||
String result = null;
|
||||
try {
|
||||
result = http.get(XCXConstant.OPENID_URL, map, "utf-8");
|
||||
System.out.println(result);
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//½âÎöresult
|
||||
if(StringUtils.isNotBlank(result)){
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if(json!=null&&json.get("openid")!=null){
|
||||
String openId = (json.get("openid")!=null)?json.get("openid").toString():null;
|
||||
String sessionKey = (json.get("session_key")!=null)?json.get("session_key").toString():null;
|
||||
XcxKey xcxKey = new XcxKey();
|
||||
xcxKey.setOpenId(openId);
|
||||
xcxKey.setSessionKey(sessionKey);
|
||||
return xcxKey;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int havaReviewStory() {
|
||||
|
||||
|
||||
@@ -24,4 +24,7 @@ public interface WeChatAuthService {
|
||||
*/
|
||||
WeChatAuthServiceImpl.WeChatWebToken getWeChatWebToken(String code);
|
||||
|
||||
|
||||
WeChatAuthServiceImpl.WeChatWebToken getWeChatWebToken(String code, String appId, String appSecret);
|
||||
|
||||
}
|
||||
|
||||
+34
@@ -108,6 +108,40 @@ public class WeChatAuthServiceImpl implements WeChatAuthService{
|
||||
}
|
||||
|
||||
|
||||
public WeChatWebToken getWeChatWebToken(String code, String appId, String appSecret){
|
||||
|
||||
if(code == null){
|
||||
return null;
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("appid", appId);
|
||||
params.put("grant_type", "authorization_code");
|
||||
params.put("secret", appSecret);
|
||||
params.put("code", code);
|
||||
try {
|
||||
JSONObject json = request.getJsonContent(WE_CHAT_API_HOST + "/sns/oauth2/access_token",params ,"UTF-8");
|
||||
if(json.containsKey("access_token")){
|
||||
WeChatWebToken token = new WeChatWebToken();
|
||||
token.accessToken = json.getString("access_token");
|
||||
token.expiresIn = json.getInt("expires_in");
|
||||
token.refreshToken= json.getString("refresh_token");
|
||||
token.openid = json.getString("openid");
|
||||
token.scope = json.getString("scope");
|
||||
return token;
|
||||
}else{
|
||||
logger.error("Web Access Token »ñȡʧ°Ü:" + json.toString());
|
||||
}
|
||||
|
||||
} catch (HttpRequestException e) {
|
||||
logger.error("Web Access Token »ñȡʧ°Ü:", e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class WeChatToken implements Serializable{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user