| New file |
| | |
| | | package com.java110.web.components.community; |
| | | |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.web.smo.ICommunityServiceSMO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 入驻小区组件处理类 |
| | | * |
| | | * add by wuxw 2019-04-15 |
| | | */ |
| | | @Component("enterCommunity") |
| | | public class EnterCommunityComponent { |
| | | |
| | | |
| | | @Autowired |
| | | private ICommunityServiceSMO communityServiceSMOImpl; |
| | | /** |
| | | * 查询我入驻的小区 |
| | | * @param pd |
| | | * @return |
| | | */ |
| | | public ResponseEntity<String> listMyCommunity(IPageData pd){ |
| | | ResponseEntity<String> responseEntity = null; |
| | | try{ |
| | | responseEntity = communityServiceSMOImpl.listMyCommunity(pd); |
| | | }catch (Exception e){ |
| | | responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); |
| | | }finally { |
| | | return responseEntity; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public ICommunityServiceSMO getCommunityServiceSMOImpl() { |
| | | return communityServiceSMOImpl; |
| | | } |
| | | |
| | | public void setCommunityServiceSMOImpl(ICommunityServiceSMO communityServiceSMOImpl) { |
| | | this.communityServiceSMOImpl = communityServiceSMOImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.web.smo; |
| | | |
| | | import com.java110.core.context.IPageData; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | /** |
| | | * 小区服务类 |
| | | */ |
| | | public interface ICommunityServiceSMO { |
| | | |
| | | /** |
| | | * 我入驻的小区 |
| | | * @param pd |
| | | * @return |
| | | */ |
| | | public ResponseEntity<String> listMyCommunity(IPageData pd); |
| | | } |
| New file |
| | |
| | | package com.java110.web.smo.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.cache.MappingCache; |
| | | import com.java110.common.constant.MappingConstant; |
| | | import com.java110.common.constant.ServiceConstant; |
| | | import com.java110.common.util.Assert; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.web.core.BaseComponentSMO; |
| | | import com.java110.web.smo.ICommunityServiceSMO; |
| | | 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; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * 小区服务类 |
| | | */ |
| | | |
| | | @Service("communityServiceSMOImpl") |
| | | public class CommunityServiceSMOImpl extends BaseComponentSMO implements ICommunityServiceSMO { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(CommunityServiceSMOImpl.class); |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Override |
| | | public ResponseEntity<String> listMyCommunity(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.myCommunity.byMember?memberId="+storeId+ |
| | | "&memberTypeCd="+MappingCache.getValue(MappingConstant.DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE,storeTypeCd), |
| | | HttpMethod.GET); |
| | | |
| | | if(responseEntity.getStatusCode() != HttpStatus.OK){ |
| | | return responseEntity; |
| | | } |
| | | responseEntity = new ResponseEntity<String>(JSONObject.parseObject(responseEntity.getBody().toString()).getJSONArray("communitys").toJSONString(), |
| | | HttpStatus.OK); |
| | | return responseEntity; |
| | | } |
| | | |
| | | public RestTemplate getRestTemplate() { |
| | | return restTemplate; |
| | | } |
| | | |
| | | public void setRestTemplate(RestTemplate restTemplate) { |
| | | this.restTemplate = restTemplate; |
| | | } |
| | | } |
| New file |
| | |
| | | <div id="component" class="wrapper wrapper-content animated fadeInRight ecommerce"> |
| | | <div class="row"> |
| | | <div class="col-lg-12"> |
| | | <div class="ibox"> |
| | | <div class="ibox-title"> |
| | | <h5>已入驻小区</h5> |
| | | <div class="ibox-tools" style="top:10px;"> |
| | | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#addStaffModel"> |
| | | <i class="glyphicon glyphicon-plus"></i> |
| | | 入驻小区 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | |
| | | <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15"> |
| | | <thead> |
| | | <tr> |
| | | <th>小区ID</th> |
| | | <th data-hide="phone">名称</th> |
| | | <th data-hide="phone">地址</th> |
| | | <th data-hide="phone">地标</th> |
| | | <th data-hide="phone,tablet" >城市编码</th> |
| | | <th data-hide="phone">状态</th> |
| | | <th class="text-right">操作</th> |
| | | |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr v-for="community in communityInfo.enterCommunityInfo"> |
| | | <td> |
| | | {{community.communityId}} |
| | | </td> |
| | | <td> |
| | | {{community.name}} |
| | | </td> |
| | | <td> |
| | | {{community.address}} |
| | | </td> |
| | | <td> |
| | | {{community.nearbyLandmarks}} |
| | | </td> |
| | | <td> |
| | | {{community.cityCode}} |
| | | </td> |
| | | <td> |
| | | {{community.statusCd == 0 ? '在用': '审核中'}} |
| | | </td> |
| | | <td class="text-right"> |
| | | <div class="btn-group"> |
| | | <button class="btn-white btn btn-xs" v-on:click="_openExitCommunityModel(community)">退出</button> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | <tfoot> |
| | | <tr> |
| | | <td colspan="7"> |
| | | <ul class="pagination float-right"></ul> |
| | | </td> |
| | | </tr> |
| | | </tfoot> |
| | | </table> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| New file |
| | |
| | | /** |
| | | 入驻小区 |
| | | **/ |
| | | (function(vc){ |
| | | vc.extends({ |
| | | data:{ |
| | | communityInfo:{ |
| | | enterCommunityInfo:[], |
| | | } |
| | | }, |
| | | _initMethod:function(){ |
| | | vc.component.listMyCommunity(); |
| | | }, |
| | | _initEvent:function(){ |
| | | |
| | | }, |
| | | methods:{ |
| | | listMyCommunity:function(){ |
| | | var param = { |
| | | params:{ |
| | | msg:this.message |
| | | } |
| | | |
| | | } |
| | | //发送get请求 |
| | | vc.http.get('enterCommunity', |
| | | 'listMyCommunity', |
| | | param, |
| | | function(json,res){ |
| | | vc.component.communityInfo.enterCommunityInfo=JSON.parse(json); |
| | | },function(errInfo,error){ |
| | | console.log('请求失败处理'); |
| | | } |
| | | ); |
| | | }, |
| | | openEnterCommunity:function(){ |
| | | |
| | | }, |
| | | _openDeleteStaffPrivilegeModel:function(_community){ |
| | | |
| | | } |
| | | } |
| | | }); |
| | | })(window.vc); |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en" |
| | | xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:th="http://www.thymeleaf.org" |
| | | xmlns:vc="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta charset="UTF-8"/> |
| | | <title>入驻小区|java110</title> |
| | | <vc:create name="commonTop"></vc:create> |
| | | </head> |
| | | <body> |
| | | <div id="wrapper"> |
| | | <vc:create name="menu"></vc:create> |
| | | |
| | | |
| | | <div id="page-wrapper" class="gray-bg dashbard-1"> |
| | | <div class="row border-bottom"> |
| | | <vc:create name="nav"></vc:create> |
| | | </div> |
| | | <!-- id="component" --> |
| | | <div class="wrapper wrapper-content animated fadeInRight"> |
| | | <vc:create name="enterCommunity"></vc:create> |
| | | </div> |
| | | |
| | | <vc:create name="copyright"></vc:create> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <vc:create name="commonBottom"></vc:create> |
| | | </body> |
| | | </html> |
| New file |
| | |
| | | |
| | | |
| | | **1\. 查询商户入驻小区信息** |
| | | ###### 接口功能 |
| | | > 用户通过web端或APP查询商户入驻小区信息接口 |
| | | |
| | | ###### URL |
| | | > [http://api.java110.com:8008/api/query.myCommunity.byMember](http://api.java110.com:8008/api/query.myCommunity.byMember) |
| | | |
| | | ###### 支持格式 |
| | | > JSON |
| | | |
| | | ###### HTTP请求方式 |
| | | > GET |
| | | |
| | | ###### 请求参数(header部分) |
| | | |参数名称|约束|类型|长度|描述|取值说明| |
| | | | :-: | :-: | :-: | :-: | :-: | :-:| |
| | | |app_id|1|String|30|应用ID|Api服务分配 | |
| | | |transaction_id|1|String|30|请求流水号|不能重复 1000000000+YYYYMMDDhhmmss+6位序列 | |
| | | |sign|1|String|-|签名|请参考签名说明| |
| | | |req_time|1|String|-|请求时间|YYYYMMDDhhmmss| |
| | | |
| | | ###### 请求参数(url部分) |
| | | |参数名称|约束|类型|长度|描述|取值说明| |
| | | | :-: | :-: | :-: | :-: | :-: | :-: | |
| | | |memberId|1|String|30|小区成员ID|-| |
| | | |memberTypeCd|1|String|12|小区成员角色|-| |
| | | |
| | | ###### 返回协议 |
| | | |
| | | 当http返回状态不为200 时请求处理失败 body内容为失败的原因 |
| | | |
| | | 当http返回状态为200时请求处理成功,body内容为返回内容, |
| | | |
| | | |父参数名称|参数名称|约束|类型|长度|描述|取值说明| |
| | | | :-: | :-: | :-: | :-: | :-: | :-: | :-: | |
| | | |-|communitys|1|Array|30|小区节点|-| |
| | | |communitys|communityId|1|String|30|小区ID|-| |
| | | |communitys|name|1|String|50|小区名称|-| |
| | | |communitys|address|1|String|200|小区地址|-| |
| | | |communitys|nearbyLandmarks|1|String|200|小区地标|-| |
| | | |communitys|cityCode|1|String|12|城市编码|-| |
| | | |communitys|mapX|1|String|12|精度|-| |
| | | |communitys|mapY|1|String|12|维度|-| |
| | | |communitys|memberId|1|String|30|小区成员ID|-| |
| | | |communitys|memberTypeCd|1|String|30|小区成员类型|-| |
| | | |communitys|statusCd|1|String|4|状态|0 有效状态 1 失效状态 1000 入驻审核状态| |
| | | |
| | | |
| | | |
| | | |
| | | ###### 举例 |
| | | > 地址:[http://api.java110.com:8008/api/query.myCommunity.byMember?memberId=345678&memberTypeCd=390001200001](http://api.java110.com:8008/api/query.myCommunity.byMember?memberId=345678&memberTypeCd=390001200001) |
| | | |
| | | ``` javascript |
| | | 请求头信息: |
| | | Content-Type:application/json |
| | | USER_ID:1234 |
| | | APP_ID:8000418002 |
| | | TRANSACTION_ID:10029082726 |
| | | REQ_TIME:20181113225612 |
| | | SIGN:aabdncdhdbd878sbdudn898 |
| | | 请求报文: |
| | | |
| | | 无 |
| | | |
| | | 返回报文: |
| | | { |
| | | "orderTypeCd": "Q", |
| | | "serviceCode": "", |
| | | "response": { |
| | | "code": "0000", |
| | | "message": "成功" |
| | | }, |
| | | "responseTime": "20190415115326", |
| | | "communitys": [{ |
| | | "memberTypeCd": "390001200001", |
| | | "address": "青海省西宁市城中区129号", |
| | | "nearbyLandmarks": "王府井旁30米", |
| | | "cityCode": "100010", |
| | | "name": "万博家博园(城西区)", |
| | | "statusCd": "0", |
| | | "communityId": "7020181217000001", |
| | | "mapY": "36.597263", |
| | | "mapX": "101.801909", |
| | | "memberId": "345678" |
| | | }], |
| | | "bId": "-1", |
| | | "businessType": "", |
| | | "transactionId": "-1", |
| | | "dataFlowId": "-1" |
| | | } |
| | | |
| | | ``` |
| | |
| | | > insert into c_route(app_id,service_id,order_type_cd,invoke_model) |
| | | > values('8000418004','78','Q','S'); |
| | | |
| | | ## 添加查询类 服务 |
| | | |
| | | > INSERT INTO c_service_sql |
| | | > (service_code,`name`,params,query_model,`sql`,template) |
| | | > VALUES |
| | | > ( |
| | | > 'query.myCommunity.byMember', |
| | | > '查询商户入驻小区信息', |
| | | > 'memberId,memberTypeCd', |
| | | > '1', |
| | | > '{"param1":"SELECT |
| | | > sc.`community_id` communityId, |
| | | > sc.`name`, |
| | | > sc.`address`, |
| | | > sc.`nearby_landmarks` nearbyLandmarks, |
| | | > sc.`city_code` cityCode, |
| | | > sc.`map_x` mapX, |
| | | > sc.`map_y` mapY, |
| | | > scm.`member_id` memberId, |
| | | > scm.`member_type_cd` memberTypeCd, |
| | | > scm.`status_cd` statusCd |
| | | > FROM |
| | | > s_community sc, |
| | | > s_community_member scm |
| | | > WHERE sc.`community_id` = scm.`community_id` |
| | | > AND sc.`status_cd` = ''0'' |
| | | > AND scm.`member_id` = #memberId# |
| | | > AND scm.`member_type_cd` = #memberTypeCd# |
| | | > AND scm.`status_cd` IN (''0'', ''1000'')"}', |
| | | > '{"PARAM": {"param1": "$.#communitys#Array"},"TEMPLATE": {}}' |
| | | > ); |
| | | |
| | | |
| | | |
| | |
| | | public final static String DOMAIN_DEFAULT_PRIVILEGE = "DEFAULT_PRIVILEGE"; |
| | | |
| | | |
| | | /** |
| | | * 商户类型转 小区成员角色 |
| | | */ |
| | | public final static String DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE = "STORE_TYPE_2_COMMUNITY_MEMBER_TYPE"; |
| | | |
| | | |
| | | |
| | | |
| | | } |