光大涉农接口完善
This commit is contained in:
+62
-21
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user