Merge branch 'open_gj' of http://gitlab.fangjia.com/dev0/main into open_gj
This commit is contained in:
+47
-43
@@ -2760,55 +2760,59 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
BasicModel resultModel = new BasicModel(HttpStatusCodeEnum.OK);
|
||||
Map<String,String> resultMap = new HashMap<String, String>();
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
params.put("city", model.getCity());
|
||||
}
|
||||
params.put("address", model.getAddress());
|
||||
params.put("useMap", "false");
|
||||
String result = addressMatchProxyService.parser(params);
|
||||
if (result != null) {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if(json.getInt("code")==200){
|
||||
JSONObject resultJson = json.getJSONObject("result");
|
||||
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
|
||||
if(resultJson.getInt("credit")>0){
|
||||
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
|
||||
if(district != null){
|
||||
resultMap.put("riskLevel","A");
|
||||
Map<String, String> resultMap = new HashMap<String, String>();
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
params.put("city", model.getCity());
|
||||
}
|
||||
params.put("address", model.getAddress());
|
||||
params.put("useMap", "false");
|
||||
String result = addressMatchProxyService.parser(params);
|
||||
if (result != null) {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if (json.getInt("code") == 200) {
|
||||
JSONObject resultJson = json.getJSONObject("result");
|
||||
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
|
||||
if (resultJson.getInt("credit") > 0) {
|
||||
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
|
||||
if (district != null) {
|
||||
resultMap.put("riskLevel", "A");
|
||||
resultModel.setResult(resultMap);
|
||||
mav.setModel(resultModel);
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
StringBuffer searchKey = new StringBuffer();
|
||||
if (searchAddress.containsKey("street")) {
|
||||
searchKey.append(searchAddress.getString("street"));
|
||||
}
|
||||
if (searchAddress.containsKey("streetNumber")) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
resultMap.put("riskLevel", "B");
|
||||
resultModel.setResult(resultMap);
|
||||
mav.setModel(resultModel);
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
StringBuffer searchKey = new StringBuffer();
|
||||
if(searchAddress.containsKey("street")){
|
||||
searchKey.append(searchAddress.getString("street"));
|
||||
}
|
||||
if(searchAddress.containsKey("streetNumber")){
|
||||
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;
|
||||
}
|
||||
}
|
||||
resultMap.put("riskLevel","B");
|
||||
resultModel.setResult(resultMap);
|
||||
mav.setModel(resultModel);
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("风险识别出错:" + ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
resultMap.put("riskLevel","C");
|
||||
|
||||
Reference in New Issue
Block a user