Merge branch 'dev' into 'master'

Dev

See merge request !815
This commit is contained in:
2024-02-26 20:26:05 +08:00
13 changed files with 797 additions and 8 deletions
@@ -206,7 +206,7 @@ public class AddrSvcController {
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
BasicModel basicModel = new BasicModel(200, "ok");
if (json != null && json.size()>0) {
if (json != null && json.size() > 0) {
basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json));
}
mav.setModel(basicModel);
@@ -284,16 +284,16 @@ public class AddrSvcController {
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
BasicModel basicModel = new BasicModel(200, "ok");
if (json != null && json.size()>0) {
if (json != null && json.size() > 0) {
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json);
District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(),"district");
District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), "district");
if (null != district) {
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(dto.getCity(), dto.getDistrict(), dto.getName()));
if(null != statBo){
if(statBo.getDistrictStat()!=null){
if (null != statBo) {
if (statBo.getDistrictStat() != null) {
dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice());
}else if(statBo.getVillaDistrictStat()!=null){
} else if (statBo.getVillaDistrictStat() != null) {
dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice());
}
@@ -309,8 +309,9 @@ public class AddrSvcController {
return mav;
}
/**
*五级地址标准化
* 五级地址标准化
*
* @param model
* @return
@@ -357,6 +358,54 @@ public class AddrSvcController {
return mav;
}
/**
* 涉农识别-新规则
*
* @param model
* @return
*/
public Object villageIdentifyAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
params.put("address", model.getAddress());
params.put("type", StringUtils.isNotBlank(model.getType()) ? model.getType() : null);
params.put("showFullValue", StringUtils.isNotBlank(model.getShowFullValue()) ? model.getShowFullValue() : null);
params.put("showTestValue", StringUtils.isNotBlank(model.getShowTestValue()) ? model.getShowTestValue() : null);
Integer radius = model.getRadius();
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
basicModel.setResult(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public void setDistrictStatService(DistrictStatService districtStatService) {
this.districtStatService = districtStatService;
}
@@ -42,6 +42,10 @@ public class AddressModel extends FangjiaApiModel {
//是否使用地图poi数据
private boolean useMap;
//涉农到区之后,是否显式后面的字段值
private String showFullValue;
//是否显示涉农测试用字段值
private String showTestValue;
public boolean isContainsLocation() {
return containsLocation;
}
@@ -258,4 +262,20 @@ public class AddressModel extends FangjiaApiModel {
public void setUseMap(boolean useMap) {
this.useMap = useMap;
}
public String getShowFullValue() {
return showFullValue;
}
public void setShowFullValue(String showFullValue) {
this.showFullValue = showFullValue;
}
public String getShowTestValue() {
return showTestValue;
}
public void setShowTestValue(String showTestValue) {
this.showTestValue = showTestValue;
}
}
@@ -0,0 +1,72 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.gj.village.ailiyun.SignatureUtils
import com.fangjia.script.util.ExcelUtils
//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801"
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
count = count + 1
if (count % 10 == 0) {
println("已处理:" + count)
}
sleep(50)
def address = items['A']
def map = SignatureUtils.getAliAddressStrc(address)
//prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012
if ("prov" in map) {
def province = map.get("prov")
items['D'] = province
}
if ("city" in map) {
def city = map.get("city")
items['H'] = city
}
if ("district" in map) {
def district = map.get("district")
items['L'] = district
}
if ("town" in map) {
def town = map.get("town")
items['P'] = town
}
if ("community" in map) {
def community = map.get("community")
items['T'] = community
}
// if ("road" in map) {
// def road = map.get("road")
// items['G'] = road
//
// }
// if ("poi" in map) {
//
// def poi = map.get("poi")
// items['H'] = poi
//
// }
// if ("roomno" in map) {
// def roomno = map.get("roomno")
// items['I'] = roomno
//
// }
// if ("devzone" in map) {
// def devzone = map.get("devzone")
// items['J'] = devzone
//
// }
// if ("roadno" in map) {
// def roadno = map.get("roadno")
// items['K'] = roadno
// }
})
@@ -0,0 +1,76 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.gj.village.ailiyun.SignatureUtils
import com.fangjia.script.util.ExcelUtils
//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801"
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
count = count + 1
if (count % 10 == 0) {
println("已处理:" + count)
}
sleep(50)
def address = items['A']
def pro = items['D']
if (pro == null) {
def map = SignatureUtils.getAliAddressStrc(address)
//prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012
if ("prov" in map) {
def province = map.get("prov")
items['D'] = province
}
if ("city" in map) {
def city = map.get("city")
items['H'] = city
}
if ("district" in map) {
def district = map.get("district")
items['L'] = district
}
if ("town" in map) {
def town = map.get("town")
items['P'] = town
}
if ("community" in map) {
def community = map.get("community")
items['T'] = community
}
// if ("road" in map) {
// def road = map.get("road")
// items['G'] = road
//
// }
// if ("poi" in map) {
//
// def poi = map.get("poi")
// items['H'] = poi
//
// }
// if ("roomno" in map) {
// def roomno = map.get("roomno")
// items['I'] = roomno
//
// }
// if ("devzone" in map) {
// def devzone = map.get("devzone")
// items['J'] = devzone
//
// }
// if ("roadno" in map) {
// def roadno = map.get("roadno")
// items['K'] = roadno
// }
}
})
@@ -0,0 +1,64 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\ÁÙʱÊý¾Ý\\2.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
String url = "http://192.168.0.19:31080/FangJiaAddressService/v3/structure";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
String address = items['A']
def map = [:]
map.put("address", address)
map.put("complete", "true")
map.put("addressAssessment", "true")
def content = httpRequest.getJsonContent(url, map, "UTF-8")
def result = content.get("result")
if ("province" in result) {
items['B'] = result.get("province")
}
if ("provinceCode" in result) {
items['C'] = result.get("provinceCode")
}
if ("city" in result){
items['D'] = result.get("city")
}
if("cityCode" in result){
items['E'] = result.get("cityCode")
}
if ("district" in result){
items['F'] = result.get("district")
}
if ("districtCode" in result){
items['G'] = result.get("districtCode")
}
if ("township" in result){
items['H'] = result.get("township")
}
if ("townshipCode" in result){
items['I'] = result.get("townshipCode")
print(result.get("townshipCode"))
}
if ("address" in result){
items['J'] = result.get("address")
}
if ("formatAddress" in result){
items['K'] = result.get("formatAddress")
}
})
@@ -0,0 +1,124 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.multiThreadingModify(excelFilePath, { List items ->
count += 1
if (count % 10 == 0) {
println("已处理:" + count)
}
String address = items['A']
String province = items['B']
if (province == null) {
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
def map = [:]
map.put("address", address)
map.put("complete", "true")
map.put("addressAssessment", "true")
map.put("type", "1")
def content = httpRequest.getJsonContent(url, map, "UTF-8")
def result = content.get("result")
if (result != null) {
if ("province" in result) {
items['B'] = result.get("province")
}
if ("provinceCode" in result) {
items['C'] = result.get("provinceCode")
}
if ("city" in result) {
items['D'] = result.get("city")
}
if ("cityCode" in result) {
items['E'] = result.get("cityCode")
}
if ("district" in result) {
items['F'] = result.get("district")
}
if ("districtCode" in result) {
items['G'] = result.get("districtCode")
}
if ("town" in result) {
items['H'] = result.get("town")
}
if ("townCode" in result) {
items['I'] = result.get("townCode")
}
if ("committee" in result) {
items['J'] = result.get("committee")
}
if ("committeeCode" in result) {
items['K'] = result.get("committeeCode")
}
if ("typeCode" in result) {
items['L'] = result.get("typeCode")
}
if ("typeName") {
items['M'] = result.get("typeName")
}
if ("verifyFlag") {
items['N'] = result.get("verifyFlag")
}
if ("addrVerify") {
items['O'] = result.get("addrVerify")
}
if ("countyLevelCity") {
items['P'] = result.get("countyLevelCity")
}
if ("countyGov") {
items['Q'] = result.get("countyGov")
}
if ("communitySource") {
items['R'] = result.get("communitySource")
}
if ("administrativeTowns" in result) {
items['T'] = result.get("administrativeTowns")
}
if ("devDistrict" in result) {
items['V'] = result.get("devDistrict")
}
if ("devDistrictName" in result) {
items['W'] = result.get("devDistrictName")
}
if ("splitCommittee" in result) {
items['X'] = result.get("splitCommittee")
}
if ("splitStreet" in result) {
items['Y'] = result.get("splitStreet")
}
if ("poiName" in result) {
items['Z'] = result.get("poiName")
}
if ("splitStreetNum" in result) {
items['AA'] = result.get("splitStreetNum")
}
if ("dev" in result) {
items['AB'] = result.get("dev")
}
}
}
})
@@ -0,0 +1,147 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\对公.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
count+=1
if (count%10==0){
println("已处理:"+count)
}
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
String address = items['A']
// print(address)
// province;
// city;
// district;
// town;
// committee;
// type;
// provinceCode;
// cityCode;
// districtCode;
// townCode;
// committeeCode;
// typeCode;
// typeName;
// verifyFlag;//涉农标识
// addrVerify;//地址是否有效信息
// countyLevelCity;//是否为县级市
// administrativeTowns;//是否市辖建制镇
// countyGov;//是否为县政府
// devDistrict;//是否为开发区
// devDistrictName;//开发区
// splitCommittee;
// splitStreet;
// poiName;
// splitStreetNum;
// dev;
// communitySource;//居委来源
def map = [:]
map.put("address", address)
map.put("complete", "true")
map.put("addressAssessment", "true")
map.put("type", "2")
def content = httpRequest.getJsonContent(url, map, "UTF-8")
def result = content.get("result")
if ("province" in result) {
items['B'] = result.get("province")
}
if ("provinceCode" in result) {
items['C'] = result.get("provinceCode")
}
if ("city" in result){
items['D'] = result.get("city")
}
if("cityCode" in result){
items['E'] = result.get("cityCode")
}
if ("district" in result){
items['F'] = result.get("district")
}
if ("districtCode" in result){
items['G'] = result.get("districtCode")
}
if ("town" in result){
items['H'] = result.get("town")
}
if ("townCode" in result){
items['I'] = result.get("townCode")
}
if ("committee" in result){
items['J'] = result.get("committee")
}
if ("committeeCode" in result){
items['K'] = result.get("committeeCode")
}
if ("typeCode" in result){
items['L'] = result.get("typeCode")
}
if ("typeName"){
items['M'] = result.get("typeName")
}
if ("verifyFlag"){
items['N'] = result.get("verifyFlag")
}
if ("addrVerify"){
items['O'] = result.get("addrVerify")
}
if ("countyLevelCity"){
items['P'] = result.get("countyLevelCity")
}
if ("countyGov"){
items['Q'] = result.get("countyGov")
}
if ("communitySource"){
items['R'] = result.get("communitySource")
}
if ("administrativeTowns" in result){
items['T'] = result.get("administrativeTowns")
}
if ("devDistrict" in result){
items['V'] = result.get("devDistrict")
}
if ("devDistrictName" in result){
items['W'] = result.get("devDistrictName")
}
if ("splitCommittee" in result){
items['X'] = result.get("splitCommittee")
}
if ("splitStreet" in result){
items['Y'] = result.get("splitStreet")
}
if ("poiName" in result){
items['Z'] = result.get("poiName")
}
if ("splitStreetNum" in result){
items['AA'] = result.get("splitStreetNum")
}
if ("dev" in result){
items['AB'] = result.get("dev")
}
})
@@ -0,0 +1,44 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据 - 副本.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
count += 1
if (count % 10 == 0) {
println("已处理:" + count)
}
String flag = items['X']
String address = items['A']
String tt = items['Y']
if (flag == null&&"地址有效".equals(tt)) {
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
def map = [:]
map.put("address", address)
map.put("complete", "true")
map.put("addressAssessment", "true")
map.put("type", "1")
def content = httpRequest.getJsonContent(url, map, "UTF-8")
def result = content.get("result")
if (result != null) {
if ("verifyFlag" in result) {
items['X'] = result.get("verifyFlag")
}
}
}
})
@@ -0,0 +1,121 @@
package com.fangjia.script.majintao.test
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\ÄϾ©ÒøÐвâÊÔ.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
def count = 0
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
count+=1
if (count%10==0){
println("ÒÑ´¦Àí£º"+count)
}
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
String address = items['A']
def map = [:]
map.put("address", address)
map.put("complete", "true")
map.put("addressAssessment", "true")
map.put("type", "2")
def content = httpRequest.getJsonContent(url, map, "UTF-8")
def result = content.get("result")
if ("province" in result) {
items['B'] = result.get("province")
}
if ("provinceCode" in result) {
items['C'] = result.get("provinceCode")
}
if ("city" in result){
items['D'] = result.get("city")
}
if("cityCode" in result){
items['E'] = result.get("cityCode")
}
if ("district" in result){
items['F'] = result.get("district")
}
if ("districtCode" in result){
items['G'] = result.get("districtCode")
}
if ("town" in result){
items['H'] = result.get("town")
}
if ("townCode" in result){
items['I'] = result.get("townCode")
}
if ("committee" in result){
items['J'] = result.get("committee")
}
if ("committeeCode" in result){
items['K'] = result.get("committeeCode")
}
if ("typeCode" in result){
items['L'] = result.get("typeCode")
}
if ("typeName"){
items['M'] = result.get("typeName")
}
if ("verifyFlag"){
items['N'] = result.get("verifyFlag")
}
if ("addrVerify"){
items['O'] = result.get("addrVerify")
}
if ("countyLevelCity"){
items['P'] = result.get("countyLevelCity")
}
if ("countyGov"){
items['Q'] = result.get("countyGov")
}
// if ("communitySource"){
// items['R'] = result.get("communitySource")
// }
//
// if ("administrativeTowns" in result){
// items['T'] = result.get("administrativeTowns")
// }
// if ("devDistrict" in result){
// items['V'] = result.get("devDistrict")
// }
// if ("devDistrictName" in result){
// items['W'] = result.get("devDistrictName")
// }
// if ("splitCommittee" in result){
// items['X'] = result.get("splitCommittee")
// }
// if ("splitStreet" in result){
// items['Y'] = result.get("splitStreet")
// }
// if ("poiName" in result){
// items['Z'] = result.get("poiName")
// }
// if ("splitStreetNum" in result){
// items['AA'] = result.get("splitStreetNum")
// }
// if ("dev" in result){
// items['AB'] = result.get("dev")
// }
})
@@ -0,0 +1,72 @@
package com.fangjia.script.majintao.test
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'] = "该地址不支持估价!"
}
}
})
@@ -454,7 +454,7 @@ public class ExcelUtils{
def data = ExcelUtils.read(fileName, srcSheetIndex, 0)
def body = data.subList(1, data.size())
def nThread = Runtime.getRuntime().availableProcessors() * 3
def nThread = 10
println nThread
ExecutorService executorService = Executors.newFixedThreadPool(3)
final AtomicInteger counter = new AtomicInteger(0)