diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java index 2cadda4e8..749eb20a3 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java @@ -285,6 +285,11 @@ public class ApiUserController { bo.setPriceType(apiUserCfg_pt.getCfgValue().toString()); } + ApiUserCfg apiUserCfg_ai = apiUserCfgService.findByUserId(apiUser.getId(), ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI); + if (apiUserCfg_ai != null && apiUserCfg_ai.getCfgValue() != null) { + bo.setEnterpriseVillageAi(apiUserCfg_ai.getCfgValue().toString()); + } + model.setApiUserBo(bo); if (StringUtils.isNotBlank(model.getMsg()) && model.getMsg().equals("success")) { model.setMsg("更新成功!"); @@ -343,6 +348,7 @@ public class ApiUserController { //ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE, model.getEvaluateRate()); modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.PRICE_TYPE, model.getPriceType()); + modifyUserCfg(userId, ApiUserCfg.ApiUserCfgKey.ENTERPRISE_VILLAGE_AI, model.getEnterpriseVillageAi()); model.setViewType("redirect"); //model.setViewParam("location", "/apiUser/edit?msg=sucess&userId=" + model.getUserId()); diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java index e97feedf7..364b64cb4 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java @@ -37,6 +37,7 @@ public class ApiUserModel extends BaseModel { private String totalCountMap; private Integer creditLevelStatus; private String priceType; + private String enterpriseVillageAi; private Map priceRatingMap; private Integer isMonitor; @@ -50,6 +51,14 @@ public class ApiUserModel extends BaseModel { private Integer isWarnExpired; + public String getEnterpriseVillageAi() { + return enterpriseVillageAi; + } + + public void setEnterpriseVillageAi(String enterpriseVillageAi) { + this.enterpriseVillageAi = enterpriseVillageAi; + } + public String getPriceType() { return priceType; } diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl index a4f2007ab..9ef3b4b30 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl @@ -155,6 +155,15 @@ + + 对公涉农是否启用AI + + + + siteName diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ApiUserCfg.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ApiUserCfg.java index 39fecf554..8e2f9aba5 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ApiUserCfg.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ApiUserCfg.java @@ -68,6 +68,7 @@ public class ApiUserCfg implements MongoEntity { public enum ApiUserCfgKey{ EVALUATE_RATE, - PRICE_TYPE; + PRICE_TYPE, + ENTERPRISE_VILLAGE_AI; } } 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 cd5bad413..e24535154 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 @@ -1,6 +1,7 @@ package com.fangjia.open.controllers; import com.fangjia.core.util.HttpRequest; +import com.fangjia.dal.mongo.model.ApiUserCfg; import com.fangjia.dal.mongo.model.Township; import com.fangjia.dal.mongo.model.VillageIdentify; import com.fangjia.dal.seaweed.model.District; @@ -10,6 +11,7 @@ import com.fangjia.open.dto.addressGovernance.DistrictDto; import com.fangjia.open.dto.addressGovernance.DistrictIdentifyDto; import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; import com.fangjia.open.dto.addressGovernance.StructureAndCompleteDto; +import com.fangjia.open.interceptors.AuthenticationBean; import com.fangjia.open.interceptors.Authority; import com.fangjia.open.interceptors.Role; import com.fangjia.open.model.AddesssMatchModel; @@ -22,6 +24,7 @@ import com.fangjia.service.datastore.DistrictService; import com.fangjia.service.district.DistrictStatService; import com.fangjia.service.mongo.fangjia.TownshipService; import com.fangjia.service.mongo.fangjia.VillageIdentifyService; +import com.fangjia.service.api.ApiUserCfgService; import com.fangjia.service.open.DistrictAnalyDataService; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -42,8 +45,10 @@ import org.apache.http.impl.conn.DefaultProxyRoutePlanner; import org.apache.http.util.EntityUtils; import org.sothis.core.util.CollectionUtils; import org.sothis.core.util.Pager; +import org.sothis.web.mvc.ActionContext; import sun.misc.BASE64Encoder; +import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.net.Authenticator; import java.net.PasswordAuthentication; @@ -64,6 +69,7 @@ public class AddrSvcController { private VillageIdentifyService villageIdentifyService; private DistrictAnalyDataService districtAnalyDataService; private TownshipService townshipService; + private ApiUserCfgService apiUserCfgService; /** * 地址结构化 @@ -1121,6 +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"); + } + } + } + } try { json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/enterpriseVillageIdentify", params, "UTF-8"); } catch (Exception e) { @@ -1745,4 +1764,8 @@ public class AddrSvcController { public void setTownshipService(TownshipService townshipService) { this.townshipService = townshipService; } + + public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) { + this.apiUserCfgService = apiUserCfgService; + } } 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 3b4d35ee0..1344bd63c 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 @@ -1,14 +1,19 @@ package com.fangjia.open.controllers; import com.fangjia.core.util.HttpRequest; +import com.fangjia.dal.mongo.model.ApiUserCfg; +import com.fangjia.open.interceptors.AuthenticationBean; import com.fangjia.open.interceptors.Authority; import com.fangjia.open.interceptors.Role; import com.fangjia.open.model.AddressModel; import com.fangjia.open.model.BasicModel; import com.fangjia.open.model.RestfulModelAndView; +import com.fangjia.service.api.ApiUserCfgService; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; +import org.sothis.web.mvc.ActionContext; +import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; @@ -18,6 +23,8 @@ import java.util.Map; @Authority(role = Role.USER) public class GdBankController { + private ApiUserCfgService apiUserCfgService; + private static final Map areaMap = new HashMap() { { // 添加键值对到 Map 中 @@ -88,6 +95,19 @@ 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"); + } + } + } + } try { json = request.getJsonContent("http://192.168.0.80:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8"); } catch (Exception e) { @@ -115,4 +135,8 @@ public class GdBankController { return mav; } + public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) { + this.apiUserCfgService = apiUserCfgService; + } + } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java index c7efb253b..653ef11ea 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java @@ -26,8 +26,12 @@ public class ApiUserBo implements Serializable { private Date deadTime; private String manager; private String priceType; + private String enterpriseVillageAi; private Integer isMonitor; + private Date creationDate; + + private String contact; //联系人 private String phone; //联系人手机号 @@ -38,6 +42,14 @@ public class ApiUserBo implements Serializable { private Integer isWarnExpired; + public String getEnterpriseVillageAi() { + return enterpriseVillageAi; + } + + public void setEnterpriseVillageAi(String enterpriseVillageAi) { + this.enterpriseVillageAi = enterpriseVillageAi; + } + public String getPriceType() { return priceType; }