|
|
@@ -1,7 +1,9 @@
|
|
|
package com.java110.web.smo.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.java110.common.cache.MappingCache;
|
|
|
+import com.java110.common.constant.AttrCdConstant;
|
|
|
import com.java110.common.constant.MappingConstant;
|
|
|
import com.java110.common.constant.ServiceConstant;
|
|
|
import com.java110.common.util.Assert;
|
|
|
@@ -51,11 +53,65 @@ public class CommunityServiceSMOImpl extends BaseComponentSMO implements ICommun
|
|
|
if(responseEntity.getStatusCode() != HttpStatus.OK){
|
|
|
return responseEntity;
|
|
|
}
|
|
|
- responseEntity = new ResponseEntity<String>(JSONObject.parseObject(responseEntity.getBody().toString()).getJSONArray("communitys").toJSONString(),
|
|
|
+ JSONArray tmpCommunitys = JSONObject.parseObject(responseEntity.getBody().toString()).getJSONArray("communitys");
|
|
|
+ freshCommunityAttr(tmpCommunitys);
|
|
|
+ responseEntity = new ResponseEntity<String>(tmpCommunitys.toJSONString(),
|
|
|
HttpStatus.OK);
|
|
|
return responseEntity;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询未入驻的小区
|
|
|
+ * @param pd
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseEntity<String> listNoEnterCommunity(IPageData pd) {
|
|
|
+ ResponseEntity<String> responseEntity = null;
|
|
|
+ JSONObject _paramObj = JSONObject.parseObject(pd.getReqData());
|
|
|
+ responseEntity = super.getStoreInfo(pd,restTemplate);
|
|
|
+ if(responseEntity.getStatusCode() != HttpStatus.OK){
|
|
|
+ return responseEntity;
|
|
|
+ }
|
|
|
+ Assert.jsonObjectHaveKey(responseEntity.getBody().toString(),"storeId","根据用户ID查询商户ID失败,未包含storeId节点");
|
|
|
+
|
|
|
+ String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId");
|
|
|
+ String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd");
|
|
|
+
|
|
|
+ //修改用户信息
|
|
|
+ responseEntity = this.callCenterService(restTemplate,pd,"",
|
|
|
+ ServiceConstant.SERVICE_API_URL+"/api/query.noEnterCommunity.byMember?memberId="+storeId+
|
|
|
+ "&memberTypeCd="+MappingCache.getValue(MappingConstant.DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE,storeTypeCd),
|
|
|
+ HttpMethod.GET);
|
|
|
+
|
|
|
+ if(responseEntity.getStatusCode() != HttpStatus.OK){
|
|
|
+ return responseEntity;
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray tmpCommunitys = JSONObject.parseObject(responseEntity.getBody().toString()).getJSONArray("communitys");
|
|
|
+ freshCommunityAttr(tmpCommunitys);
|
|
|
+ responseEntity = new ResponseEntity<String>(tmpCommunitys.toJSONString(),
|
|
|
+ HttpStatus.OK);
|
|
|
+ return responseEntity;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void freshCommunityAttr(JSONArray community){
|
|
|
+ for(int _communityIndex = 0 ;_communityIndex < community.size();_communityIndex++){
|
|
|
+ JSONObject _community = community.getJSONObject(_communityIndex);
|
|
|
+ if(!_community.containsKey("attrs")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONArray _attrs = _community.getJSONArray("attrs");
|
|
|
+ for(int _cAttrIndex = 0;_cAttrIndex < _attrs.size();_cAttrIndex++){
|
|
|
+ if(AttrCdConstant.SPEC_CD_COMMUNITY_TEL.equals(_attrs.getJSONObject(_cAttrIndex).getString("specCd"))){
|
|
|
+ _community.put("tel",_attrs.getJSONObject(_cAttrIndex).getString("value"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
public RestTemplate getRestTemplate() {
|
|
|
return restTemplate;
|
|
|
}
|