From 2d079ac843ebcb335f2ef7d6952f9700a16fddde Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 05 五月 2021 14:11:00 +0800
Subject: [PATCH] 游湖阿底阿妈
---
java110-core/src/main/java/com/java110/core/component/BaseComponentSMO.java | 110 ++++++++++++++++++++++++++++++++++---------------------
1 files changed, 68 insertions(+), 42 deletions(-)
diff --git a/java110-core/src/main/java/com/java110/core/component/BaseComponentSMO.java b/java110-core/src/main/java/com/java110/core/component/BaseComponentSMO.java
old mode 100644
new mode 100755
index 3115926..6920805
--- a/java110-core/src/main/java/com/java110/core/component/BaseComponentSMO.java
+++ b/java110-core/src/main/java/com/java110/core/component/BaseComponentSMO.java
@@ -2,19 +2,21 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.cache.MappingCache;
-import com.java110.utils.constant.MappingConstant;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.context.IPageData;
+import com.java110.core.smo.IGetCommunityStoreInfoSMO;
+import com.java110.entity.component.ComponentValidateResult;
import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.ServiceCodeConstant;
import com.java110.utils.constant.ServiceConstant;
import com.java110.utils.exception.SMOException;
import com.java110.utils.factory.ApplicationContextFactory;
import com.java110.utils.util.Assert;
-import com.java110.core.base.smo.BaseServiceSMO;
-import com.java110.core.context.IPageData;
-import com.java110.entity.component.ComponentValidateResult;
-import org.apache.commons.lang3.StringUtils;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -31,6 +33,9 @@
private static Logger logger = LoggerFactory.getLogger(BaseComponentSMO.class);
protected static final int MAX_ROW = 50;
+
+ @Autowired(required = false)
+ private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl;
/**
* 璋冪敤缁勪欢
@@ -106,16 +111,66 @@
}
/**
+ * 鑾峰彇鐢ㄦ埛淇℃伅
+ *
+ * @param pd
+ * @param restTemplate
+ * @return
+ */
+ protected ResponseEntity<String> getUserAndAttr(IPageData pd, RestTemplate restTemplate, Map paramIn) {
+ //Assert.hasLength(pd.getUserId(), "鐢ㄦ埛鏈櫥褰曡鍏堢櫥褰�");
+ ResponseEntity<String> responseEntity = null;
+ if (paramIn != null) {
+ paramIn.put("page", "1");
+ paramIn.put("row", "1");
+ }
+ responseEntity = this.callCenterService(restTemplate, pd, "",
+ ServiceConstant.SERVICE_API_URL + "/api/user.listUsers" + mapToUrlParam(paramIn), HttpMethod.GET);
+ // 杩囨护杩斿洖鎶ユ枃涓殑瀛楁锛屽彧杩斿洖name瀛楁
+ //{"address":"","orderTypeCd":"Q","serviceCode":"","responseTime":"20190401194712","sex":"","localtionCd":"","userId":"302019033054910001","levelCd":"00","transactionId":"-1","dataFlowId":"-1","response":{"code":"0000","message":"鎴愬姛"},"name":"996icu","tel":"18909780341","bId":"-1","businessType":"","email":""}
+ return responseEntity;
+
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛淇℃伅
+ *
+ * @param pd
+ * @param restTemplate
+ * @return
+ */
+ protected ResponseEntity<String> getOwnerAppUser(IPageData pd, RestTemplate restTemplate, Map paramIn) {
+ //Assert.hasLength(pd.getUserId(), "鐢ㄦ埛鏈櫥褰曡鍏堢櫥褰�");
+ ResponseEntity<String> responseEntity = null;
+ if (paramIn != null) {
+ paramIn.put("page", "1");
+ paramIn.put("row", "1");
+ }
+ responseEntity = this.callCenterService(restTemplate, pd, "",
+ ServiceConstant.SERVICE_API_URL + "/api/" + ServiceCodeConstant.LIST_APPUSERBINDINGOWNERS + mapToUrlParam(paramIn), HttpMethod.GET);
+ // 杩囨护杩斿洖鎶ユ枃涓殑瀛楁锛屽彧杩斿洖name瀛楁
+ //{"address":"","orderTypeCd":"Q","serviceCode":"","responseTime":"20190401194712","sex":"","localtionCd":"","userId":"302019033054910001","levelCd":"00","transactionId":"-1","dataFlowId":"-1","response":{"code":"0000","message":"鎴愬姛"},"name":"996icu","tel":"18909780341","bId":"-1","businessType":"","email":""}
+ return responseEntity;
+
+ }
+
+
+ /**
* 鏌ヨ鍟嗘埛淇℃伅
*
* @return
*/
protected ResponseEntity<String> getStoreInfo(IPageData pd, RestTemplate restTemplate) {
Assert.hasLength(pd.getUserId(), "鐢ㄦ埛鏈櫥褰曡鍏堢櫥褰�");
- ResponseEntity<String> responseEntity = null;
- responseEntity = this.callCenterService(restTemplate, pd, "", ServiceConstant.SERVICE_API_URL + "/api/query.store.byuser?userId=" + pd.getUserId(), HttpMethod.GET);
- return responseEntity;
+ ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreInfo(pd, restTemplate, pd.getUserId());
+
+ return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST);
+ }
+
+ private ResponseEntity<String> getStoreEnterCommunitys(IPageData pd, String storeId, String storeTypeCd, RestTemplate restTemplate) {
+ ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate);
+ return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST);
}
/**
@@ -126,18 +181,16 @@
protected void checkStoreEnterCommunity(IPageData pd, String storeId, String storeTypeCd, String communityId, RestTemplate restTemplate) {
Assert.hasLength(pd.getUserId(), "鐢ㄦ埛鏈櫥褰曡鍏堢櫥褰�");
ResponseEntity<String> responseEntity = null;
- responseEntity = this.callCenterService(restTemplate, pd, "",
- ServiceConstant.SERVICE_API_URL + "/api/query.myCommunity.byMember?memberId=" + storeId + "&memberTypeCd="
- + MappingCache.getValue(MappingConstant.DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE, storeTypeCd), HttpMethod.GET);
+ responseEntity = getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate);
if (responseEntity.getStatusCode() != HttpStatus.OK) {
throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "杩樻湭鍏ラ┗灏忓尯锛岃鍏堝叆椹诲皬鍖�");
}
- Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "communitys", "杩樻湭鍏ラ┗灏忓尯锛岃鍏堝叆椹诲皬鍖�");
+ Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "data", "杩樻湭鍏ラ┗灏忓尯锛岃鍏堝叆椹诲皬鍖�");
JSONObject community = JSONObject.parseObject(responseEntity.getBody().toString());
- JSONArray communitys = community.getJSONArray("communitys");
+ JSONArray communitys = community.getJSONArray("data");
if (communitys == null || communitys.size() == 0) {
throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "杩樻湭鍏ラ┗灏忓尯锛岃鍏堝叆椹诲皬鍖�");
@@ -199,33 +252,6 @@
}
- /**
- * map 鍙傛暟杞� url get 鍙傛暟 闈炵┖鍊艰浆涓篻et鍙傛暟 绌哄�煎拷鐣�
- *
- * @param info map鏁版嵁
- * @return url get 鍙傛暟 甯︼紵
- */
- protected String mapToUrlParam(Map info) {
- String urlParam = "";
- if (info == null || info.isEmpty()) {
- return urlParam;
- }
-
- urlParam += "?";
-
- for (Object key : info.keySet()) {
- if (StringUtils.isEmpty(info.get(key) + "")) {
- continue;
- }
-
- urlParam += (key + "=" + info.get(key) + "&");
- }
-
- urlParam = urlParam.endsWith("&") ? urlParam.substring(0, urlParam.length() - 1) : urlParam;
-
- return urlParam;
- }
-
/**
* 鏍¢獙 鍛樺伐 鍟嗘埛 灏忓尯 鍏崇郴
@@ -253,7 +279,7 @@
JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
String communityId = "";
- if (paramIn.containsKey("communityId")) {
+ if (paramIn.containsKey("communityId") && !StringUtil.isEmpty(paramIn.getString("communityId"))) {
communityId = paramIn.getString("communityId");
checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate);
}
--
Gitblit v1.8.0