Merge remote-tracking branch 'origin/master'

This commit is contained in:
2024-09-11 15:58:53 +08:00
16 changed files with 355 additions and 166 deletions
@@ -579,7 +579,7 @@
<#if way==1>
<a href="../apiUser/userVisitStat?userId=${bo.userId}&way=2&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
<#else>
<a href="../apiUser/userVisitStat?uri=${bo.key}&way=1&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
<a href="../apiUser/userVisitStat?userId=${userId!}&uri=${bo.key}&way=1&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
</#if>
</td>
<#if way?? && way==1>
@@ -787,7 +787,6 @@
function submitForm(action) {
const form = document.getElementById('myForm');
if (action === 'query') {
debugger
form.action = "<#if way?? && way==0>../apiUser/pandect<#else>../apiUser/apiVisitStat</#if>";
} else if (action === 'download') {
form.action = "../apiUser/export";
@@ -52,25 +52,25 @@
<div class="form-group">
<label for="purpose" class="form-label">账号用途:</label>
<select name="purpose" class="form-select">
<option value="1">API</option>
<option value="2">PDS</option>
<option value="4">房生活</option>
<option value="1" <#if purpose?? && purpose == 1>selected</#if> >API</option>
<option value="2"<#if purpose?? && purpose == 2>selected</#if> >PDS</option>
<option value="4"<#if purpose?? && purpose == 4>selected</#if> >房生活</option>
<option >请选择</option>
</select>
</div>
<div class="form-group">
<label for="isTest" class="form-label">账号类型:</label>
<select name="isTest" class="form-select">
<option value="0">正式账号</option>
<option value="1">测试账号</option>
<option value="2">内部账号</option>
<option value="0" <#if isTest?? && isTest == 0>selected</#if> >正式账号</option>
<option value="1" <#if isTest?? && isTest == 1>selected</#if> >测试账号</option>
<option value="2" <#if isTest?? && isTest == 2>selected</#if> >内部账号</option>
</select>
</div>
<div class="form-group">
<label for="status" class="form-label">账号状态:</label>
<select name="status" class="form-select">
<option value="0">正常</option>
<option value="1">禁用</option>
<option value="0" <#if status?? && status == 0>selected</#if> >正常</option>
<option value="1" <#if status?? && status == 1>selected</#if> >禁用</option>
</select>
</div>
<input id="queryBtn" class="btn btn-primary form-button" type="submit" value="查询"/>
@@ -295,7 +295,7 @@
<@menuitem uri='/creditRate/list' text="价格可信度与匹配率关系" />
<@menuitem uri='/czBank/sampleLogs' text="浙商银行" />
<@menuitem uri='/villageIdentify/importResult' text="涉农结果导入" />
<@menuitem uri='/apiCountLog/list' text="API次数日志" />
<@menuitem uri='/apiCountLog/list?purpose=1&isTest=0&status=0' text="API次数日志" />
</ul>
</li>
@@ -406,10 +406,10 @@
const month = now.getMonth() + 1; // 月
let divElement = document.getElementById("date");
divElement.innerHTML = "<span>"+year+"年"+month+"月"+"</span>";
$("#date").html("<span>"+year+"年"+month+"月"+"</span>")
let divElement2 = document.getElementById("date2");
divElement2.innerHTML = "<span>"+year+"年"+month+"月"+"</span>";
$("#date2").html("<span>"+year+"年"+month+"月"+"</span>")
$(function(){
$('.td04').each(function(i){
@@ -177,7 +177,7 @@ public class AddrSvcController {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
int code = json.getInt("status") == 0 ? 200 : 0;
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
@@ -271,10 +271,11 @@ public class AddrSvcController {
public Object suggestionAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getCity())) {
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
return mav;
}
// 城市改为非必填
// if (StringUtils.isBlank(model.getCity())) {
// mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
// return mav;
// }
if (StringUtils.isBlank(model.getKeywords())) {
mav.setModel(BasicModel.buildBadRequestModel("关键字不能为空"));
return mav;
@@ -311,6 +312,46 @@ public class AddrSvcController {
return mav;
}
/**
* 地址联想
*/
public Object tipsAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getKeywords())) {
mav.setModel(BasicModel.buildBadRequestModel("搜索关键字不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("keywords", model.getKeywords());
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : "");
params.put("max", model.getMax() != 0 ? String.valueOf(model.getMax()) : "");
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/tips", params, "UTF-8");
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray.size() > 0) {
basicModel.setResult(jsonArray);
}
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
} catch (Exception e) {
e.printStackTrace();
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public Object avgPriceAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
@@ -1047,11 +1088,21 @@ public class AddrSvcController {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
map.put("cityCode", result.getString("tjjCityCode"));
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("provinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("cityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
list.add(map);
}
}
@@ -1095,9 +1146,15 @@ public class AddrSvcController {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("mzbProvinceCode"));
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("provinceCode")) {
map.put("provinceCode", result.getString("mzbProvinceCode"));
}
list.add(map);
}
}
@@ -1144,13 +1201,27 @@ public class AddrSvcController {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
map.put("cityCode", result.getString("tjjCityCode"));
map.put("district", result.getString("district"));
map.put("districtCode", result.getString("tjjDistrictCode"));
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("provinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("cityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
if (result.containsKey("district")) {
map.put("district", result.getString("district"));
}
if (result.containsKey("districtCode")) {
map.put("districtCode", result.getString("tjjDistrictCode"));
}
list.add(map);
}
}
@@ -1192,15 +1263,33 @@ public class AddrSvcController {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
map.put("cityCode", result.getString("tjjCityCode"));
map.put("district", result.getString("district"));
map.put("districtCode", result.getString("tjjDistrictCode"));
map.put("street", result.getString("street"));
map.put("streetCode", result.getString("tjjStreetCode"));
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("provinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("cityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
if (result.containsKey("district")) {
map.put("district", result.getString("district"));
}
if (result.containsKey("districtCode")) {
map.put("districtCode", result.getString("tjjDistrictCode"));
}
if (result.containsKey("street")) {
map.put("street", result.getString("street"));
}
if (result.containsKey("streetCode")) {
map.put("streetCode", result.getString("tjjStreetCode"));
}
list.add(map);
}
}
@@ -2277,7 +2277,7 @@ public class AddressController {
}
if (json != null) {
int code = json.getInt("status");
int code = json.getInt("status") == 0 ? 200 : 0;
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
@@ -50,6 +50,44 @@ public class GdBankController {
}
};
/**
* 判断所属区域
*
* @param map
* @return
*/
public String addrArea(Map<String, String> map, String type) {
if (map.get("verifyFlag") == null) {
return "";
}
if (map.get("verifyFlag").equals("非农")) {
return "城市区域";
}
if (map.get("verifyFlag").equals("农")) {
return "农村区域";
}
if ("2".equals(type) && "是".equals(map.get("countyGov"))) {
return "县城城区";
}
return "";
}
/**
* 判断县级市
*/
public String countyLevelCity(Map<String, String> map) {
if (map.get("city") == null) {
return "";
}
if (map.get("city").endsWith("区")) {
return "否";
}
if (map.get("city").equals("东莞市") || map.get("city").equals("嘉峪关市") || map.get("city").equals("中山市") || map.get("city").equals("儋州市")) {
return "否";
}
return "是";
}
/**
* 涉农识别-新规则-光大银行
*
@@ -90,22 +128,16 @@ public class GdBankController {
if (json.containsKey("result")) {
//我们的结果
JSONObject result = json.getJSONObject("result");
if (("是").equals(result.get("countyLevelCity"))) {
result.put("prefectureLevelCity", "否");
} else if (("否").equals(result.get("countyLevelCity"))) {
result.put("prefectureLevelCity", "是");
}
// 如果是无效信息或者没有行政区划,则用我们的
if (result.containsKey("addrVerify") && ("无效".equals(result.getString("addrVerify")) || "没有行政区划".equals(result.getString("addrVerify")))) {
//我们省级及以上有开发区,直接用我们的结果
if (result.containsKey("devDistrictName")) {
basicModel.setResult(result);
//我们省级及以上有开发区,直接用我们的结果
} else if (result.containsKey("devDistrictName")) {
} else if (!"2".equals(type)) { // 对私的不用齐梁
basicModel.setResult(result);
} else {
try {
//如果是江苏省或者浙江省 调用齐梁的结果
if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
//结果比较,如果涉农结果不一致
//调用齐梁 type :1 对公 0 对私
//我们 type :1 对私 2 对共
@@ -113,23 +145,31 @@ public class GdBankController {
Map<String, String> map = senRequest(address, qltype);
// 涉农结果不一样
if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
//有市辖建制镇, 或者城市不一样 用我们
if (result.containsKey("city") && ("是".equals(result.get("administrativeTowns")) || (!result.get("city").equals(map.get("city"))
&& StringUtils.isNotBlank(result.getString("city"))))) {
// 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
basicModel.setResult(result);
mav.setModel(basicModel);
return mav;
}
//城市不一样 用我们
if (result.containsKey("city")) {
if ((!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
basicModel.setResult(result);
} else {
map.put("addrVerify", "地址有效");
map.put("typeName", areaMap.get(map.get("typeCode")));
map.put("addrArea", addrArea(map, type));
map.put("countyLevelCity", countyLevelCity(map));
basicModel.setResult(map);
}
} else {
if (("是").equals(result.get("countyLevelCity"))) {
map.put("prefectureLevelCity", "否");
} else if (("否").equals(result.get("countyLevelCity"))) {
map.put("prefectureLevelCity", "是");
}
map.put("addrVerify", "地址有效");
if (result.containsKey("countyLevelCity")) {
map.put("countyLevelCity", result.getString("countyLevelCity"));
}
map.put("typeName", areaMap.get(map.get("typeCode")));
map.put("addrArea", addrArea(map, type));
map.put("countyLevelCity", countyLevelCity(map));
basicModel.setResult(map);
}
} else {
basicModel.setResult(result);
}
@@ -145,6 +185,7 @@ public class GdBankController {
}
}
}
mav.setModel(basicModel);
} else {
@@ -78,7 +78,7 @@ class PoseidonOnce {
// DBCursor cur = coll.find()
// println cur.count()
String url = "http://www.fangjia.com";
DBCollection coll = MongoUtils.getCollectionByName("fangjia", "test2", "192.168.0.188")
DBCollection coll = MongoUtils.getCollectionByName("fangjia", "FiveLevelTest", "192.168.0.188")
// for(int i=426000;i<1000000;i++) {
// String s = url + i + "_" + url.hashCode()
// DBObject dbo = new BasicDBObject()
@@ -16,7 +16,8 @@ class MinglujiData {
DBCollection mlj_COLL = MongoUtils.getCollectionByName("crawl", "kfq_mingluji_com", "192.168.0.206",27020)
def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
DBCollection development_zone_CONN = MongoUtils.getCollectionByName2("fangjia", "development_zone", MONGO100_URL)
DBCollection development_zone_CONN = MongoUtils.getCollectionByName("fangjia_base", "development_zone", "mongo.db.fangjia.com")
DBCollection dev_mapping_CONN = MongoUtils.getCollectionByName2("fangjia", "dev_mapping", MONGO100_URL)
DBCollection community_100_CONN = MongoUtils.getCollectionByName2("fangjia", "community", MONGO100_URL)
@@ -30,16 +31,19 @@ class MinglujiData {
}
def run(){
def prov = "浙江省"
def city = "嘉兴"
def prov = "河北省"
def city = "石家庄市"
// exportDatas(city)
matchDev(prov, city)
matchCommunity(city)
// matchDev(prov, city)
// matchCommunity(city)
// fiveLevelSplit(city)
nineLevelSplit(city)
// tempMatchDev(prov)
// checkDev()
// saveMljData()
fiveLevelSplit(city)
}
def exportDatas(city){
def datas = findMinglujiDatas(city)
@@ -84,9 +88,9 @@ class MinglujiData {
if (d['E'] && !d['N']) {
def obj = findDevByName(d['E'])
def obj = findDevByName(null, d['E'])
if (!obj) {
obj = findDevByAlias(d['E'])
obj = findDevByAlias(null, d['E'])
if (!obj) {
obj = findDebBySimlar(devs, d['E'], d['B'])
if (!obj) {
@@ -122,9 +126,9 @@ class MinglujiData {
def devs = loadAllDevs(prov)
ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\湖州-开发区-等级.xlsx",{d->
if(d['U'] && !d['W'] ){
def obj = findDevByName(d['U'])
def obj = findDevByName(null, d['U'])
if(!obj){
obj = findDevByAlias(d['U'])
obj = findDevByAlias(null, d['U'])
if(!obj){
obj = findDebBySimlar(devs, d['U'], d['B'])
if(!obj){
@@ -202,34 +206,157 @@ class MinglujiData {
}
}
def nineLevelSplit(city){
def i = 1;
while(i<20) {
def fileName = "/home/goojia/gj/mlj_${i}.xlsx"
if (CommonDatautils.isWindow()) {
fileName = "D:\\数据\\数据建设\\名录集\\${city}_${i}.xlsx"
}
File file = new File(fileName);
if (file.exists()) {
ExcelUtils.modify(fileName,{d->
if(d['E'] && !d['Z']){
def jsonObject1 = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['E'])
if(jsonObject1) {
if (jsonObject1.get("dev") && jsonObject1.get("dev") != "null") {
def devName = jsonObject1.get("dev")
def obj = findDev(jsonObject1.get("city"), devName)
d['AD'] = devName
if(jsonObject1.containsKey("detail") && jsonObject1.detail.dev_confi!='null'){
d['AJ'] = jsonObject1.detail.dev_confi
}
if (obj) {
d['AG'] = obj._id.toString()
d['AF'] = obj.name
}
}
}
}
if(d['J'] && !d['M']) {
def jsonObject = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['J'])
def street = jsonObject.get("street")
def streetNumber = jsonObject.get("streetNumber")
if (jsonObject.get("province") && jsonObject.get("province") != "null") {
d['W'] = jsonObject.get("province")
}
if (jsonObject.get("city") && jsonObject.get("city") != "null") {
d['X'] = jsonObject.get("city")
}
if (jsonObject.get("district") && jsonObject.get("district") != "null") {
d['Y'] = jsonObject.get("district")
}
if (jsonObject.get("township") && jsonObject.get("township") != "null") {
d['Z'] = jsonObject.get("township")
}
if (jsonObject && street && streetNumber && street != "null") {
d['AA'] = jsonObject.get("street")
def road = jsonObject.get("street")
if (streetNumber != 'null') {
d['AB'] = jsonObject.get("streetNumber")
road = road + jsonObject.get("streetNumber")
} else {
d['AC'] = "信息不完整"
}
if (!d['AC'] && !d['J'].contains(road)) {
d['AC'] = "原地址不含路"
}
if (!d['AC']) {
def flag = road.matches('^[\u4e00-\u9fa5]+?(路|大道|巷|胡同|街).+[弄号]$')
if (!flag) {
d['AC'] = "路非法"
}
def roadsize = jsonObject.get("street").size()
if (!d['AC'] && (roadsize < 3 || roadsize > 7)) {
d['AC'] = "路太长|路太短"
}
}
}else{
d['AC'] = "无地址"
}
if (jsonObject.get("dev") && jsonObject.get("dev") != "null") {
def devName = jsonObject.get("dev")
def obj = findDev(jsonObject.get("city"), devName)
d['AE'] = devName
if (obj) {
d['AI'] = obj._id.toString()
d['AH'] = obj.name
}
if(jsonObject.containsKey("detail") && jsonObject.detail.dev_confi!='null'){
d['AK'] = jsonObject.detail.dev_confi
}
}
}
},0)
println fileName +" 九级拆分完成"
}
i++
}
}
def findDev( city, name){
def obj = findDevByName(city, name)
if(!obj){
obj = findDevByAlias(city, name)
if(obj){
obj.match_way = "别名"
}
}else{
obj.match_way = "相同"
}
return obj
}
def fiveLevelSplit(city){
def i = 1;
while(i<20) {
def fileName = "/home/goojia/gj/mlj_${i}.xlsx"
if (CommonDatautils.isWindow()) {
fileName = "D:\\数据\\数据建设\\名录集\\mlj_${i}.xlsx"
fileName = "D:\\数据\\数据建设\\名录集\\${city}_${i}.xlsx"
}
File file = new File(fileName);
if (file.exists()) {
ExcelUtils.multiThreadingModify(fileName, { d ->
if(d['J'] && !d['X']){
if(d['J'] && !d['AN']){
def jsonObject = com.fangjia.script.gj.district.FangjiaClientUtils.formatFivelevel(d['B'], d['J'])
if(jsonObject) {
if (jsonObject.get("address") && jsonObject.get("address") != "null") {
d['X'] = jsonObject.get("address")
d['AN'] = jsonObject.get("address")
}
}
}
})
}
i++
println fileName +" 五级拆分完成"
}
}
def checkDev(){
ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\嘉兴入库数据.xlsx",{d->
if(d['F']){
def obj = findDevByName(null, d['F'])
if(obj){
d['I'] = "库中"
}else{
d['I'] = "非库中"
}
}
})
}
def saveMljData(){
ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\湖州入库2.xlsx",{d->
ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\嘉兴入库数据.xlsx",{d->
def obj = new BasicDBObject()
obj.put("province", d['A'])
obj.put("city", d['B'])
@@ -281,14 +408,20 @@ class MinglujiData {
}
return last
}
def findDevByName(name){
def findDevByName(city, name){
def q = new BasicDBObject()
if(city){
q.put("city", city)
}
q.put("name", name)
return development_zone_CONN.findOne(q)
}
def findDevByAlias(name){
def findDevByAlias(city, name){
def q = new BasicDBObject()
if(city){
q.put("city", city)
}
q.put('alias', new BasicDBObject('$in',[name]))
return development_zone_CONN.findOne(q)
}
@@ -19,7 +19,7 @@ class MsbPocTest {
// match(inputfile)
// matchOld(inputfile)
// addPrice("D:\\数据\\美术宝\\美术宝测试数据(价格).xlsx")
// test("D:\\数据\\美术宝\\test2.xlsx")
// test("D:\\数据\\美术宝\\FiveLevelTest.xlsx")
// cityPrice()
// mergeMatchPrice("D:\\数据\\美术宝\\美术宝-新接口价格.xlsx")
@@ -1,5 +1,6 @@
package com.fangjia.script.hubingliang
import com.fangjia.core.Constants
import com.fangjia.core.util.DateUtil
import groovy.sql.Sql
@@ -23,7 +24,7 @@ import com.mongodb.DBObject
@BatchOwner(Watcher.Hubingliang)
class ApiInvokeStatistics extends BaseBatch{
final static def mongoDomain = "mongo.db.fangjia.com"
public static final DBCollection OPEN_URI_LOG = MongoUtils.getCollectionByName("business", "open_uri_log", "seawater.mongo.db.fangjia.com", 27020)
public static final DBCollection OPEN_URI_LOG = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
public static final DBCollection OPEN_URI_LOG_COUNT = MongoUtils.getCollectionByName("business", "api_invoke_statistical", "mongo.db.fangjia.com", 27017)
static final dbFangjia = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?autoReconnect=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver");
static main(args) {
@@ -1,72 +0,0 @@
package com.fangjia.script.majintao
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject
String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy1.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
String comprehensiveUrl = "http://localhost:9180/comprehensiveQuery/houseValueInformation";
String communityUrl = "http://open.fangjia.com/addrSvc/avgPrice";
String valueUrl = "http://open.fangjia.com/property/addressEvaluate";
String caseUrl = "http://open.fangjia.com/house/case";
String poiUrl = "http://open.fangjia.com/district/addrFacilitys";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
String city = items['A']
String address = items['B']
double size = items['C']
System.out.println(city + "---" + address + "----" + size);
map.put("city", city)
map.put("address", address)
map.put("size", size.toString())
map.put("strctureArea", size.toString())
map.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB")
if (!address.contains("%")) {
// 发送HTTP请求
long start
long end
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(communityUrl, map, "UTF-8")
//
//
// end = System.currentTimeMillis();
// items['D'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(valueUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['E'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(caseUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['F'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(poiUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['G'] = String.valueOf(end - start);
start = System.currentTimeMillis();
def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8")
end = System.currentTimeMillis();
items['H'] = String.valueOf(end - start);
println content.get("msg")
if(content.get("msg").contains("该地址不支持估价!")) {
items['I'] = "该地址不支持估价!"
}
}
})
@@ -1,4 +0,0 @@
import org.bson.types.ObjectId
a = new ObjectId()
print(a)
@@ -1,5 +1,6 @@
package com.fangjia.script.openApi
import com.fangjia.core.Constants
import groovy.sql.Sql;
import java.util.regex.Matcher
import java.util.regex.Pattern
@@ -24,7 +25,7 @@ import com.fangjia.script.Watcher
class OpenApiLogAnalyBatch extends BaseBatch{
static DBCollection OPEN_URI_LOG_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "seawater.mongo.db.fangjia.com",27020);
static DBCollection OPEN_URI_LOG_COLL = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
static DBCollection OPEN_URI_ANALY_COLL = MongoUtils.getCollectionByName("business", "open_uri_analy", "mongo.db.fangjia.com");
final Sql USER_CONN = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?useUnicode=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver")
@@ -16,6 +16,7 @@ import org.apache.commons.lang.StringUtils
import org.elasticsearch.action.bulk.BulkProcessor
import org.elasticsearch.action.index.IndexRequest
import java.util.concurrent.TimeUnit
import com.fangjia.core.Constants
/**
* ¹¦ÄÜ˵Ã÷:
@@ -24,7 +25,7 @@ import java.util.concurrent.TimeUnit
class AnalysisOpenUriLogSyncBatch extends BaseBatch {
DBCollection OPEN_URI_LOG_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "192.168.0.206",27020)
DBCollection OPEN_URI_LOG_COLL = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
static final def SQL = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/goojia_fangjia?&characterEncoding=utf8", "sa", "G00jia", "com.mysql.jdbc.Driver");
@@ -53,7 +54,7 @@ class AnalysisOpenUriLogSyncBatch extends BaseBatch {
void process(Object args) {
Map userInfo = getUserInfo()
def startDate = DateUtil.truncateDay(DateUtil.add(new Date(), -3))
def startDate = DateUtil.truncateDay(DateUtil.add(new Date(), -30))
def endDate = DateUtil.truncateDay(new Date())
BasicDBObject query = new BasicDBObject()
query.append("c_date", new BasicDBObject('$gte', startDate).append('$lt', endDate))
@@ -43,15 +43,15 @@ class Test {
static main(args) {
// String test1 = " qwdwqd ssss ";
// String test2 = " qwdwqd ss";
// String FiveLevelTest = " qwdwqd ss";
// String test3 = "qwdwqd dd";
//
// test1 = test1.replaceAll(" |\\s+", " ");
// test2 = test2.replaceAll(" |\\s+", " ");
// FiveLevelTest = FiveLevelTest.replaceAll(" |\\s+", " ");
// test3 = test3.replaceAll(" |\\s+", " ");
//
// String[] arrs1 = test1.split("\\s+")
// String[] arrs2 = test2.split("\\s+")
// String[] arrs2 = FiveLevelTest.split("\\s+")
// String[] arrs3 = test3.split("\\s+")
//
// println arrs1