新增异常兜底返回
This commit is contained in:
+47
-43
@@ -2760,55 +2760,59 @@ public class AddressController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
BasicModel resultModel = new BasicModel(HttpStatusCodeEnum.OK);
|
BasicModel resultModel = new BasicModel(HttpStatusCodeEnum.OK);
|
||||||
Map<String,String> resultMap = new HashMap<String, String>();
|
Map<String, String> resultMap = new HashMap<String, String>();
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
try {
|
||||||
if(StringUtils.isNotBlank(model.getCity())){
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("city", model.getCity());
|
if (StringUtils.isNotBlank(model.getCity())) {
|
||||||
}
|
params.put("city", model.getCity());
|
||||||
params.put("address", model.getAddress());
|
}
|
||||||
params.put("useMap", "false");
|
params.put("address", model.getAddress());
|
||||||
String result = addressMatchProxyService.parser(params);
|
params.put("useMap", "false");
|
||||||
if (result != null) {
|
String result = addressMatchProxyService.parser(params);
|
||||||
JSONObject json = JSONObject.fromObject(result);
|
if (result != null) {
|
||||||
if(json.getInt("code")==200){
|
JSONObject json = JSONObject.fromObject(result);
|
||||||
JSONObject resultJson = json.getJSONObject("result");
|
if (json.getInt("code") == 200) {
|
||||||
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
|
JSONObject resultJson = json.getJSONObject("result");
|
||||||
if(resultJson.getInt("credit")>0){
|
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
|
||||||
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
|
if (resultJson.getInt("credit") > 0) {
|
||||||
if(district != null){
|
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
|
||||||
resultMap.put("riskLevel","A");
|
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);
|
resultModel.setResult(resultMap);
|
||||||
mav.setModel(resultModel);
|
mav.setModel(resultModel);
|
||||||
return mav;
|
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");
|
resultMap.put("riskLevel","C");
|
||||||
|
|||||||
Reference in New Issue
Block a user