Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into open_bohai
# Conflicts: # projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java
This commit is contained in:
+264
@@ -0,0 +1,264 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.open.dto.addressGovernance.*;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.AddesssMatchModel;
|
||||
import com.fangjia.open.model.AddressModel;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.CommonDtoUtils;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 地址治理
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2023/5/25
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public class AddrSvcController {
|
||||
|
||||
/**
|
||||
* 地址结构化
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object structureAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure/v2", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(CommonDtoUtils.transformV(StructureDto.class, json.get("result")));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区划识别接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object divisionAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(CommonDtoUtils.transformV(DistrictIdentifyDto.class, json.get("result")));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址补全
|
||||
*/
|
||||
public Object completeAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result")));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址验证
|
||||
*/
|
||||
public Object addrVerifyAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/addrVerify", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址匹配
|
||||
*/
|
||||
public Object matchAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
params.put("category", model.getCategory());
|
||||
params.put("district", model.getSuggestDistrict());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/match", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json.get("result")));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址联想
|
||||
*/
|
||||
public Object suggestionAction(AddressModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getCity())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getKeyword())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("关键字不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", model.getCity());
|
||||
params.put("region", model.getRegion());
|
||||
params.put("keywords", model.getKeyword());
|
||||
params.put("page", "0");
|
||||
params.put("size", String.valueOf(model.getMax() == 0 ? 20 : (model.getMax() > 100 ? 100 : model.getMax())));
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/addressAssociation2", params, "UTF-8");
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
JSONObject result = (JSONObject.fromObject(json.get("result")));
|
||||
if (result.getInt("totalElements") > 0) {
|
||||
basicModel.setResult(CommonDtoUtils.transformListV(DistrictDto.class, result.getJSONArray("content")));
|
||||
}
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
+393
-14
@@ -1,6 +1,24 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.open.model.*;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SdQuery;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
@@ -91,6 +109,8 @@ public class AddressController {
|
||||
private static final String GRADE_CONSUME = "消费评分";
|
||||
|
||||
public final static OpenConfig CONFIG = OpenConfig.getConfig();
|
||||
private static final String ES_USER = "developer";
|
||||
private static final String ES_PASSWORD = "5e8edd851d2fdfbd7415232c67367cc3";
|
||||
|
||||
/**
|
||||
* @deprecated see parse2Action
|
||||
@@ -496,8 +516,65 @@ public class AddressController {
|
||||
}
|
||||
MatchDistrictResult matchResult = addressMatchProxyService.checkMatchDistrictCorrect(param);
|
||||
jsonResult.put("matchResult", matchResult);
|
||||
if (jsonResult.containsKey("category")) {
|
||||
if ("office".equals(jsonResult.getString("category"))) {
|
||||
jsonResult.put("propertyType", "写字楼");
|
||||
} else if ("shop".equals(jsonResult.getString("category"))) {
|
||||
jsonResult.put("propertyType", "商铺");
|
||||
}
|
||||
}
|
||||
} else if (jsonResult != null) {
|
||||
jsonResult.put("matchResult", new MatchDistrictResult());
|
||||
// 判断是否为自然村
|
||||
boolean matchedVillage = false;
|
||||
try {
|
||||
if (jsonResult.get("searchAddress") != null) {
|
||||
JSONObject searchAddress = (JSONObject) jsonResult.get("searchAddress");
|
||||
String city = searchAddress.containsKey("city") ? searchAddress.getString("city") : null;
|
||||
String region = searchAddress.containsKey("district") ? searchAddress.getString("district") : null;
|
||||
String name = searchAddress.containsKey("keywords") ? searchAddress.getString("keywords") : null;
|
||||
String township = searchAddress.containsKey("township") ? searchAddress.getString("township") : null;
|
||||
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(name)) {
|
||||
List<JSONObject> villages = findVillage(city, region, name);
|
||||
if (CollectionUtils.isNotEmpty(villages)) {
|
||||
if (villages.size() == 1 || StringUtils.isBlank(township)) {
|
||||
JSONObject village = villages.get(0).getJSONObject("_source");
|
||||
jsonResult.put("id", villages.get(0).getString("_id"));
|
||||
jsonResult.put("province", village.getString("province"));
|
||||
jsonResult.put("city", village.getString("city"));
|
||||
jsonResult.put("district", village.getString("region"));
|
||||
jsonResult.put("township", village.getString("township"));
|
||||
jsonResult.put("name", village.getString("name"));
|
||||
jsonResult.put("lng", village.getJSONObject("location").getDouble("lon"));
|
||||
jsonResult.put("lat", village.getJSONObject("location").getDouble("lat"));
|
||||
jsonResult.put("propertyType", "自然村");
|
||||
matchedVillage = true;
|
||||
} else {
|
||||
for (JSONObject source : villages) {
|
||||
JSONObject village = source.getJSONObject("_source");
|
||||
if (village.getString("township").contains(township) || township.contains(village.getString("township"))) {
|
||||
jsonResult.put("id", source.getString("_id"));
|
||||
jsonResult.put("province", village.getString("province"));
|
||||
jsonResult.put("city", village.getString("city"));
|
||||
jsonResult.put("district", village.getString("region"));
|
||||
jsonResult.put("township", village.getString("township"));
|
||||
jsonResult.put("name", village.getString("name"));
|
||||
jsonResult.put("lng", village.getJSONObject("location").getDouble("lon"));
|
||||
jsonResult.put("lat", village.getJSONObject("location").getDouble("lat"));
|
||||
jsonResult.put("propertyType", "自然村");
|
||||
matchedVillage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (matchedVillage == false) {
|
||||
jsonResult.put("matchResult", new MatchDistrictResult());
|
||||
}
|
||||
}
|
||||
resultModel.setResult(json.get("result"));
|
||||
mav.setModel(resultModel);
|
||||
@@ -893,6 +970,68 @@ public class AddressController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private JSONObject addTerm(String name, String value){
|
||||
JSONObject term = new JSONObject();
|
||||
JSONObject match = new JSONObject();
|
||||
match.put(name, value);
|
||||
term.put("term", match);
|
||||
return term;
|
||||
}
|
||||
|
||||
private JSONObject addMatchPhrase(String name, String value){
|
||||
JSONObject term = new JSONObject();
|
||||
JSONObject match = new JSONObject();
|
||||
match.put(name, value);
|
||||
term.put("match_phrase", match);
|
||||
return term;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取自然村
|
||||
* @param city
|
||||
* @param region
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private List<JSONObject> findVillage(String city, String region, String name) {
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("from", 0);
|
||||
reqBody.put("size", 5);
|
||||
JSONObject query = new JSONObject();
|
||||
JSONObject bool = new JSONObject();
|
||||
JSONArray must = new JSONArray();
|
||||
must.add(addTerm("city", city));
|
||||
must.add(addTerm("region", region));
|
||||
must.add(addTerm("name", name));
|
||||
bool.put("must", must);
|
||||
query.put("bool", bool);
|
||||
reqBody.put("query", query);
|
||||
Base64 token = new Base64();
|
||||
String authenticationEncoding = token.encodeAsString((""+ES_USER+":"+ES_PASSWORD+"").getBytes());
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", "Basic "+authenticationEncoding+"");
|
||||
try {
|
||||
String response = request.postWithBody("http://192.168.0.45:9200/village/_search", reqBody, headers, "UTF-8");
|
||||
JSONObject json = JSONObject.fromObject(response);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
|
||||
List<JSONObject> results = new ArrayList<JSONObject>();
|
||||
for(int i=0 ;i < hits.size(); i++){
|
||||
JSONObject jsonObject = hits.getJSONObject(i);
|
||||
results.add(jsonObject);
|
||||
}
|
||||
return results;
|
||||
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载测试数据
|
||||
*
|
||||
@@ -1699,6 +1838,7 @@ public class AddressController {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
|
||||
params.put("address", model.getAddress());
|
||||
params.put("showCode", model.getShowCode());
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
@@ -1723,6 +1863,44 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 招商证券POC测试接口封装
|
||||
*/
|
||||
public Object cmbTestAction(AddesssMatchModel 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() : CONFIG.getDefaultCity());
|
||||
params.put("address", model.getAddress());
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/cmbTest", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/cmbTest", params, "UTF-8");
|
||||
} catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 五级地址标准化接口
|
||||
*
|
||||
@@ -1902,6 +2080,163 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址信息分类接口
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object communitySummaryAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
try{
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
|
||||
reqBody.put("address", model.getAddress());
|
||||
reqBody.put("area", model.getArea());
|
||||
reqBody.put("maxFloor", model.getMaxFloor());
|
||||
reqBody.put("housePurpose", model.getHousePurpose());
|
||||
reqBody.put("memo", model.getMemo());
|
||||
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/communitySummary", reqBody ,headers, "UTF-8");
|
||||
if(result != null){
|
||||
try{
|
||||
json = JSONObject.fromObject(result);
|
||||
} catch(Exception e){
|
||||
json = null;
|
||||
}
|
||||
}
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 楼盘评级
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object buildingRatingAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
try{
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
|
||||
reqBody.put("address", model.getAddress());
|
||||
reqBody.put("area", model.getArea());
|
||||
reqBody.put("maxFloor", model.getMaxFloor());
|
||||
reqBody.put("housePurpose", model.getHousePurpose());
|
||||
reqBody.put("memo", model.getMemo());
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/buildingRating", reqBody, headers, "UTF-8");
|
||||
if(result != null){
|
||||
try{
|
||||
json = JSONObject.fromObject(result);
|
||||
} catch(Exception e){
|
||||
json = null;
|
||||
}
|
||||
}
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 财力评级
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object financialRatingAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
try{
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
|
||||
reqBody.put("address", model.getAddress());
|
||||
reqBody.put("area", model.getArea());
|
||||
reqBody.put("maxFloor", model.getMaxFloor());
|
||||
reqBody.put("housePurpose", model.getHousePurpose());
|
||||
reqBody.put("memo", model.getMemo());
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/financialRating", reqBody, headers,"UTF-8");
|
||||
if(result != null){
|
||||
try{
|
||||
json = JSONObject.fromObject(result);
|
||||
} catch(Exception e){
|
||||
json = null;
|
||||
}
|
||||
}
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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 Object similarityAction(AddesssMatchModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress_1()) || StringUtils.isBlank(model.getAddress_2())) {
|
||||
@@ -2988,20 +3323,26 @@ public class AddressController {
|
||||
searchKey.append(searchAddress.getString("streetNumber"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(searchKey.toString()) && searchAddress.has("city") && StringUtils.isNotBlank(searchAddress.getString("city"))) {
|
||||
JSONObject jsonObject = addressMatchProxyService.searchByAmap(searchAddress.getString("city"), model.getAddress());
|
||||
JSONArray poisData = jsonObject.getJSONArray("pois");
|
||||
for (int i = 0; i < poisData.size(); i++) {
|
||||
String address = poisData.getJSONObject(i).getString("address");
|
||||
if (address.contains(searchKey.toString())) {
|
||||
resultMap.put("riskLevel", "A");
|
||||
resultModel.setResult(resultMap);
|
||||
mav.setModel(resultModel);
|
||||
return mav;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
// JSONObject jsonObject = addressMatchProxyService.searchByAmap(searchAddress.getString("city"), model.getAddress());
|
||||
// JSONArray poisData = jsonObject.getJSONArray("pois");
|
||||
// for (int i = 0; i < poisData.size(); i++) {
|
||||
// String address = poisData.getJSONObject(i).getString("address");
|
||||
// if (address.contains(searchKey.toString())) {
|
||||
// resultMap.put("riskLevel", "A");
|
||||
// resultModel.setResult(resultMap);
|
||||
// mav.setModel(resultModel);
|
||||
// return mav;
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
String city = searchAddress.getString("city");
|
||||
List<JSONObject> poiList = this.findPois(city, searchKey.toString());
|
||||
if (CollectionUtils.isNotEmpty(poiList)) {
|
||||
resultMap.put("riskLevel", "A");
|
||||
} else {
|
||||
resultMap.put("riskLevel", "B");
|
||||
}
|
||||
resultMap.put("riskLevel", "B");
|
||||
resultModel.setResult(resultMap);
|
||||
mav.setModel(resultModel);
|
||||
return mav;
|
||||
@@ -3018,6 +3359,44 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
private List<JSONObject> findPois(String city, String address) {
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("from", 0);
|
||||
reqBody.put("size", 1);
|
||||
JSONObject query = new JSONObject();
|
||||
JSONObject bool = new JSONObject();
|
||||
JSONArray must = new JSONArray();
|
||||
must.add(addTerm("city", city));
|
||||
must.add(addMatchPhrase("address", address));
|
||||
bool.put("must", must);
|
||||
query.put("bool", bool);
|
||||
reqBody.put("query", query);
|
||||
Base64 token = new Base64();
|
||||
String authenticationEncoding = token.encodeAsString((""+ES_USER+":"+ES_PASSWORD+"").getBytes());
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", "Basic "+authenticationEncoding+"");
|
||||
try {
|
||||
String response = request.postWithBody("http://192.168.0.45:9200/association/_search", reqBody, headers, "UTF-8");
|
||||
JSONObject json = JSONObject.fromObject(response);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
|
||||
List<JSONObject> results = new ArrayList<JSONObject>();
|
||||
for(int i=0 ;i < hits.size(); i++){
|
||||
JSONObject jsonObject = hits.getJSONObject(i);
|
||||
results.add(jsonObject);
|
||||
}
|
||||
return results;
|
||||
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void setAddressService(AddressService addressService) {
|
||||
this.addressService = addressService;
|
||||
}
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.AddesssMatchModel;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
public class MeishubaoController {
|
||||
|
||||
/**
|
||||
* 详细地址标准化接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object financialRatingAction(AddesssMatchModel 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", model.getCity());
|
||||
params.put("address", model.getAddress());
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/meishubao/financialRating", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/meishubao/financialRating", params, "UTF-8");
|
||||
} catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.fangjia.open.dto.addressGovernance;
|
||||
|
||||
public class DistrictDto {
|
||||
|
||||
private String province;
|
||||
private String city;
|
||||
private String region;
|
||||
private String name;
|
||||
private String address;
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.fangjia.open.dto.addressGovernance;
|
||||
|
||||
/**
|
||||
* Çø»®Ê¶±ðDTO
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2023/5/25
|
||||
*/
|
||||
public class DistrictIdentifyDto {
|
||||
|
||||
private String province;
|
||||
private String provinceCode;
|
||||
private String city;
|
||||
private String cityCode;
|
||||
private String district;
|
||||
private String districtCode;
|
||||
private String township;
|
||||
private String townshipCode;
|
||||
private String community;
|
||||
private String communityCode;
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getProvinceCode() {
|
||||
return provinceCode;
|
||||
}
|
||||
|
||||
public void setProvinceCode(String provinceCode) {
|
||||
this.provinceCode = provinceCode;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getDistrictCode() {
|
||||
return districtCode;
|
||||
}
|
||||
|
||||
public void setDistrictCode(String districtCode) {
|
||||
this.districtCode = districtCode;
|
||||
}
|
||||
|
||||
public String getTownship() {
|
||||
return township;
|
||||
}
|
||||
|
||||
public void setTownship(String township) {
|
||||
this.township = township;
|
||||
}
|
||||
|
||||
public String getTownshipCode() {
|
||||
return townshipCode;
|
||||
}
|
||||
|
||||
public void setTownshipCode(String townshipCode) {
|
||||
this.townshipCode = townshipCode;
|
||||
}
|
||||
|
||||
public String getCommunity() {
|
||||
return community;
|
||||
}
|
||||
|
||||
public void setCommunity(String community) {
|
||||
this.community = community;
|
||||
}
|
||||
|
||||
public String getCommunityCode() {
|
||||
return communityCode;
|
||||
}
|
||||
|
||||
public void setCommunityCode(String communityCode) {
|
||||
this.communityCode = communityCode;
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.fangjia.open.dto.addressGovernance;
|
||||
|
||||
/**
|
||||
* 地址匹配DTO
|
||||
*/
|
||||
public class MatchedBuildingDto {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 置信度
|
||||
*/
|
||||
private Double credit;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 乡镇街道
|
||||
*/
|
||||
private String township;
|
||||
/**
|
||||
* 建筑物名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 建筑物地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 经度(高德)
|
||||
*/
|
||||
private Double lng;
|
||||
/**
|
||||
* 纬度(高德)
|
||||
*/
|
||||
private Double lat;
|
||||
/**
|
||||
* 物业类型
|
||||
*/
|
||||
private String propertyType;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Double getCredit() {
|
||||
return credit;
|
||||
}
|
||||
|
||||
public void setCredit(Double credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getTownship() {
|
||||
return township;
|
||||
}
|
||||
|
||||
public void setTownship(String township) {
|
||||
this.township = township;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(Double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getPropertyType() {
|
||||
return propertyType;
|
||||
}
|
||||
|
||||
public void setPropertyType(String propertyType) {
|
||||
this.propertyType = propertyType;
|
||||
}
|
||||
}
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
package com.fangjia.open.dto.addressGovernance;
|
||||
|
||||
/**
|
||||
* 地址补全DTO
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2023/5/25
|
||||
*/
|
||||
public class StructureAndCompleteDto {
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 开发区
|
||||
*/
|
||||
private String dev;
|
||||
/**
|
||||
* 乡镇街道
|
||||
*/
|
||||
private String township;
|
||||
/**
|
||||
* 道路
|
||||
*/
|
||||
private String street;
|
||||
/**
|
||||
* 路号
|
||||
*/
|
||||
private String streetNumber;
|
||||
/**
|
||||
* 居委村委
|
||||
*/
|
||||
private String community;
|
||||
/**
|
||||
* 村组
|
||||
*/
|
||||
private String group;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 楼栋
|
||||
*/
|
||||
private String buildingNumber;
|
||||
/**
|
||||
* 单元
|
||||
*/
|
||||
private String unitNumber;
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
private String floor;
|
||||
/**
|
||||
* 室号
|
||||
*/
|
||||
private String roomNumber;
|
||||
/**
|
||||
* 格式化地址
|
||||
*/
|
||||
private String formatAddress;
|
||||
/**
|
||||
* 地址验证
|
||||
*/
|
||||
private String addrVerify;
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getDev() {
|
||||
return dev;
|
||||
}
|
||||
|
||||
public void setDev(String dev) {
|
||||
this.dev = dev;
|
||||
}
|
||||
|
||||
public String getTownship() {
|
||||
return township;
|
||||
}
|
||||
|
||||
public void setTownship(String township) {
|
||||
this.township = township;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getStreetNumber() {
|
||||
return streetNumber;
|
||||
}
|
||||
|
||||
public void setStreetNumber(String streetNumber) {
|
||||
this.streetNumber = streetNumber;
|
||||
}
|
||||
|
||||
public String getCommunity() {
|
||||
return community;
|
||||
}
|
||||
|
||||
public void setCommunity(String community) {
|
||||
this.community = community;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getBuildingNumber() {
|
||||
return buildingNumber;
|
||||
}
|
||||
|
||||
public void setBuildingNumber(String buildingNumber) {
|
||||
this.buildingNumber = buildingNumber;
|
||||
}
|
||||
|
||||
public String getUnitNumber() {
|
||||
return unitNumber;
|
||||
}
|
||||
|
||||
public void setUnitNumber(String unitNumber) {
|
||||
this.unitNumber = unitNumber;
|
||||
}
|
||||
|
||||
public String getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(String floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public String getRoomNumber() {
|
||||
return roomNumber;
|
||||
}
|
||||
|
||||
public void setRoomNumber(String roomNumber) {
|
||||
this.roomNumber = roomNumber;
|
||||
}
|
||||
|
||||
public String getFormatAddress() {
|
||||
return formatAddress;
|
||||
}
|
||||
|
||||
public void setFormatAddress(String formatAddress) {
|
||||
this.formatAddress = formatAddress;
|
||||
}
|
||||
|
||||
public String getAddrVerify() {
|
||||
return addrVerify;
|
||||
}
|
||||
|
||||
public void setAddrVerify(String addrVerify) {
|
||||
this.addrVerify = addrVerify;
|
||||
}
|
||||
}
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
package com.fangjia.open.dto.addressGovernance;
|
||||
|
||||
/**
|
||||
* 地址结构化,请不要增加其他字段,与文档及地数输出一致
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2023/5/25
|
||||
*/
|
||||
public class StructureDto {
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 开发区
|
||||
*/
|
||||
private String dev;
|
||||
/**
|
||||
* 乡镇街道
|
||||
*/
|
||||
private String township;
|
||||
/**
|
||||
* 道路
|
||||
*/
|
||||
private String street;
|
||||
/**
|
||||
* 路号
|
||||
*/
|
||||
private String streetNumber;
|
||||
/**
|
||||
* 居委村委
|
||||
*/
|
||||
private String community;
|
||||
/**
|
||||
* 村组
|
||||
*/
|
||||
private String group;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 楼栋
|
||||
*/
|
||||
private String buildingNumber;
|
||||
/**
|
||||
* 单元
|
||||
*/
|
||||
private String unitNumber;
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
private String floor;
|
||||
/**
|
||||
* 室号
|
||||
*/
|
||||
private String roomNumber;
|
||||
/**
|
||||
* 地址验证
|
||||
*/
|
||||
private String addrVerify;
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getDev() {
|
||||
return dev;
|
||||
}
|
||||
|
||||
public void setDev(String dev) {
|
||||
this.dev = dev;
|
||||
}
|
||||
|
||||
public String getTownship() {
|
||||
return township;
|
||||
}
|
||||
|
||||
public void setTownship(String township) {
|
||||
this.township = township;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getStreetNumber() {
|
||||
return streetNumber;
|
||||
}
|
||||
|
||||
public void setStreetNumber(String streetNumber) {
|
||||
this.streetNumber = streetNumber;
|
||||
}
|
||||
|
||||
public String getCommunity() {
|
||||
return community;
|
||||
}
|
||||
|
||||
public void setCommunity(String community) {
|
||||
this.community = community;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getBuildingNumber() {
|
||||
return buildingNumber;
|
||||
}
|
||||
|
||||
public void setBuildingNumber(String buildingNumber) {
|
||||
this.buildingNumber = buildingNumber;
|
||||
}
|
||||
|
||||
public String getUnitNumber() {
|
||||
return unitNumber;
|
||||
}
|
||||
|
||||
public void setUnitNumber(String unitNumber) {
|
||||
this.unitNumber = unitNumber;
|
||||
}
|
||||
|
||||
public String getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(String floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public String getRoomNumber() {
|
||||
return roomNumber;
|
||||
}
|
||||
|
||||
public void setRoomNumber(String roomNumber) {
|
||||
this.roomNumber = roomNumber;
|
||||
}
|
||||
|
||||
public String getAddrVerify() {
|
||||
return addrVerify;
|
||||
}
|
||||
|
||||
public void setAddrVerify(String addrVerify) {
|
||||
this.addrVerify = addrVerify;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -213,7 +213,7 @@ public class AuthenticationInterceptor implements Interceptor {
|
||||
if (null == apiUser) {
|
||||
return ret;
|
||||
}
|
||||
if(apiUser.getDeadTime() != null && new Date().after(apiUser.getDeadTime())){
|
||||
if(apiUser.getDeadTime() != null && DateUtil.truncateDay(new Date()).after(apiUser.getDeadTime())){
|
||||
return new HttpCode(OpenHttpCodeEnum.USER_EXPIRED);
|
||||
}
|
||||
if(!isOldUser(apiUser) && isExpired(token)){
|
||||
|
||||
@@ -22,6 +22,8 @@ public class AddesssMatchModel extends FangjiaApiModel {
|
||||
private String address_1;
|
||||
private String address_2;
|
||||
|
||||
private String showCode;
|
||||
|
||||
public String getAddress_1() {
|
||||
return address_1;
|
||||
}
|
||||
@@ -134,4 +136,12 @@ public class AddesssMatchModel extends FangjiaApiModel {
|
||||
public void setDebugName(String debugName) {
|
||||
this.debugName = debugName;
|
||||
}
|
||||
|
||||
public String getShowCode() {
|
||||
return showCode;
|
||||
}
|
||||
|
||||
public void setShowCode(String showCode) {
|
||||
this.showCode = showCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public class AddressModel extends FangjiaApiModel {
|
||||
private String preciseLevel;
|
||||
private String province;
|
||||
private String district;
|
||||
private String region;
|
||||
|
||||
private String chooseId;
|
||||
|
||||
@@ -36,6 +37,9 @@ public class AddressModel extends FangjiaApiModel {
|
||||
private Integer pageNo;
|
||||
// 是否用于检查
|
||||
private String dataLevel;
|
||||
|
||||
private String keyword;
|
||||
|
||||
public boolean isContainsLocation() {
|
||||
return containsLocation;
|
||||
}
|
||||
@@ -228,5 +232,20 @@ public class AddressModel extends FangjiaApiModel {
|
||||
public void setDataLevel(String dataLevel) {
|
||||
this.dataLevel = dataLevel;
|
||||
}
|
||||
|
||||
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
|
||||
/**
|
||||
* 小区宽表入参DTO
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2022/10/11
|
||||
*/
|
||||
public class CommunitySummaryRequestDto extends FangjiaApiModel {
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 总楼层
|
||||
*/
|
||||
private Integer maxFloor;
|
||||
|
||||
/**
|
||||
* 面积
|
||||
*/
|
||||
private Float area;
|
||||
|
||||
/**
|
||||
* 房屋用途
|
||||
*/
|
||||
private String housePurpose;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Integer getMaxFloor() {
|
||||
return maxFloor;
|
||||
}
|
||||
|
||||
public void setMaxFloor(Integer maxFloor) {
|
||||
this.maxFloor = maxFloor;
|
||||
}
|
||||
|
||||
public Float getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(Float area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public String getHousePurpose() {
|
||||
return housePurpose;
|
||||
}
|
||||
|
||||
public void setHousePurpose(String housePurpose) {
|
||||
this.housePurpose = housePurpose;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.fangjia.open.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用实体与DTO互相转换工具类
|
||||
*
|
||||
* @author shenjian
|
||||
* @date 2021/06/16
|
||||
*/
|
||||
public class CommonDtoUtils {
|
||||
public static <T> T transformV(Class<T> targetClass, Object source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
String jsonSource = JSON.toJSONString(source);
|
||||
return JSONObject.parseObject(jsonSource, targetClass);
|
||||
} catch (Exception var3) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> transformListV(Class<T> targetClass, List<?> listSource) {
|
||||
if (listSource == null) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
String jsonSource = JSON.toJSONString(listSource);
|
||||
return JSONArray.parseArray(jsonSource, targetClass);
|
||||
} catch (Exception var3) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user