diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index e24535154..dbdfb3852 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -1127,15 +1127,19 @@ public class AddrSvcController { } else { Integer radius = model.getRadius(); params.put("radius", (radius != null && radius != 0) ? radius.toString() : null); - HttpServletRequest req = ActionContext.getContext().getRequest(); - if (req != null && apiUserCfgService != null) { - AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); - if (authenticationBean != null && authenticationBean.apiUser != null) { - ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI); - if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) { - String aiVal = apiUserCfg.getCfgValue().toString(); - if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) { - params.put("ai", "1"); + if(model.getAi() != null && model.getAi() == 1){ + params.put("ai", "1"); + }else{ + HttpServletRequest req = ActionContext.getContext().getRequest(); + if (req != null && apiUserCfgService != null) { + AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI); + if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) { + String aiVal = apiUserCfg.getCfgValue().toString(); + if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) { + params.put("ai", "1"); + } } } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/GdBankController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/GdBankController.java index 1344bd63c..0b9d3563e 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/GdBankController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/GdBankController.java @@ -95,19 +95,24 @@ public class GdBankController { Map params = new HashMap(); params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null); params.put("address", model.getAddress()); - HttpServletRequest req = ActionContext.getContext().getRequest(); - if (req != null && apiUserCfgService != null) { - AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); - if (authenticationBean != null && authenticationBean.apiUser != null) { - ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI); - if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) { - String aiVal = apiUserCfg.getCfgValue().toString(); - if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) { - params.put("ai", "1"); + if(model.getAi() != null && model.getAi() == 1){ + params.put("ai", "1"); + }else{ + HttpServletRequest req = ActionContext.getContext().getRequest(); + if (req != null && apiUserCfgService != null) { + AuthenticationBean authenticationBean = (AuthenticationBean) req.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + ApiUserCfg apiUserCfg = apiUserCfgService.findByUserId(authenticationBean.apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI); + if (apiUserCfg != null && apiUserCfg.getCfgValue() != null) { + String aiVal = apiUserCfg.getCfgValue().toString(); + if ("1".equals(aiVal) || "true".equalsIgnoreCase(aiVal)) { + params.put("ai", "1"); + } } } } } + try { json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8"); } catch (Exception e) { diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java index 62bd77997..a92697219 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java @@ -6,6 +6,7 @@ public class AddressModel extends FangjiaApiModel { private String city; private String address; + private Integer ai; private String suggestDistrict; private Integer businessMatch; private Double area; @@ -334,4 +335,12 @@ public class AddressModel extends FangjiaApiModel { public void setPage(Integer page) { this.page = page; } + + public Integer getAi() { + return ai; + } + + public void setAi(Integer ai) { + this.ai = ai; + } }