| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.PrivilegeCodeConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.constant.StoreTypeConstant; |
| | | import com.java110.utils.exception.SMOException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.component.AbstractComponentSMO; |
| | | import com.java110.web.smo.community.IEditCommunitySMO; |
| | | 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; |
| | |
| | | @Override |
| | | protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) { |
| | | ResponseEntity<String> responseEntity = null; |
| | | super.validateStoreStaffCommunityRelationship(pd, restTemplate); |
| | | //super.validateStoreStaffCommunityRelationship(pd, restTemplate); |
| | | // 校验 员工和商户是否有关系 |
| | | responseEntity = getStoreInfo(pd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, responseEntity.getBody() + ""); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点"); |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点"); |
| | | |
| | | String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId"); |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | |
| | | if(!StoreTypeConstant.STORE_TYPE_SYSTEM_MANAGER.equals(storeTypeCd)){ |
| | | super.validateStoreStaffCommunityRelationship(pd, restTemplate); |
| | | } |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/community.updateCommunity", |
| | | HttpMethod.POST); |
| | |
| | | <vc:create name="addCommunity"></vc:create> |
| | | <vc:create name="editCommunity"></vc:create> |
| | | <vc:create name="deleteCommunity"></vc:create> |
| | | <vc:create name="recallAuditFinishCommunity"></vc:create> |
| | | |
| | | </div> |
| | |
| | | (function(vc,vm){ |
| | | (function(vc, vm) { |
| | | |
| | | vc.extends({ |
| | | data:{ |
| | | editCommunityInfo:{ |
| | | communityId:'', |
| | | name:'', |
| | | address:'', |
| | | nearbyLandmarks:'', |
| | | cityCode:'0971', |
| | | mapX:'101.33', |
| | | mapY:'101.33', |
| | | data: { |
| | | editCommunityInfo: { |
| | | communityId: '', |
| | | name: '', |
| | | address: '', |
| | | nearbyLandmarks: '', |
| | | cityCode: '', |
| | | mapX: '101.33', |
| | | mapY: '101.33', |
| | | |
| | | } |
| | | }, |
| | | _initMethod:function(){ |
| | | _initMethod: function() { |
| | | |
| | | }, |
| | | _initEvent:function(){ |
| | | vc.on('editCommunity','openEditCommunityModal',function(_params){ |
| | | }, |
| | | _initEvent: function() { |
| | | vc.on('editCommunity', 'openEditCommunityModal', |
| | | function(_params) { |
| | | vc.component.refreshEditCommunityInfo(); |
| | | $('#editCommunityModel').modal('show'); |
| | | vc.component.editCommunityInfo = _params; |
| | | //vc.component.editCommunityInfo.communityId = vc.getCurrentCommunity().communityId; |
| | | }); |
| | | }, |
| | | methods:{ |
| | | editCommunityValidate:function(){ |
| | | return vc.validate.validate({ |
| | | editCommunityInfo:vc.component.editCommunityInfo |
| | | },{ |
| | | 'editCommunityInfo.name':[ |
| | | { |
| | | limit:"required", |
| | | param:"", |
| | | errInfo:"小区名称不能为空" |
| | | }, |
| | | { |
| | | limit:"maxin", |
| | | param:"4,20", |
| | | errInfo:"小区名称必须在4至20字符之间" |
| | | }, |
| | | methods: { |
| | | editCommunityValidate: function() { |
| | | return vc.validate.validate({ |
| | | editCommunityInfo: vc.component.editCommunityInfo |
| | | }, |
| | | { |
| | | 'editCommunityInfo.name': [{ |
| | | limit: "required", |
| | | param: "", |
| | | errInfo: "小区名称不能为空" |
| | | }, |
| | | { |
| | | limit: "maxin", |
| | | param: "4,20", |
| | | errInfo: "小区名称必须在4至20字符之间" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.address':[ |
| | | { |
| | | limit:"required", |
| | | param:"", |
| | | errInfo:"小区地址不能为空" |
| | | }, |
| | | { |
| | | limit:"maxLength", |
| | | param:"200", |
| | | errInfo:"小区地址不能大于200个字符" |
| | | }, |
| | | 'editCommunityInfo.address': [{ |
| | | limit: "required", |
| | | param: "", |
| | | errInfo: "小区地址不能为空" |
| | | }, |
| | | { |
| | | limit: "maxLength", |
| | | param: "200", |
| | | errInfo: "小区地址不能大于200个字符" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.nearbyLandmarks':[ |
| | | { |
| | | limit:"required", |
| | | param:"", |
| | | errInfo:"附近地标不能为空" |
| | | }, |
| | | { |
| | | limit:"maxLength", |
| | | param:"50", |
| | | errInfo:"小区附近地标不能大于50个字符" |
| | | }, |
| | | 'editCommunityInfo.nearbyLandmarks': [{ |
| | | limit: "required", |
| | | param: "", |
| | | errInfo: "附近地标不能为空" |
| | | }, |
| | | { |
| | | limit: "maxLength", |
| | | param: "50", |
| | | errInfo: "小区附近地标不能大于50个字符" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.cityCode':[ |
| | | { |
| | | limit:"maxLength", |
| | | param:"12", |
| | | errInfo:"小区城市编码不能大于4个字符" |
| | | }, |
| | | 'editCommunityInfo.cityCode': [{ |
| | | limit: "maxLength", |
| | | param: "12", |
| | | errInfo: "小区城市编码不能大于4个字符" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.mapX':[ |
| | | { |
| | | limit:"maxLength", |
| | | param:"20", |
| | | errInfo:"小区城市编码不能大于4个字符" |
| | | }, |
| | | 'editCommunityInfo.mapX': [{ |
| | | limit: "maxLength", |
| | | param: "20", |
| | | errInfo: "小区城市编码不能大于4个字符" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.mapY':[ |
| | | { |
| | | limit:"maxLength", |
| | | param:"20", |
| | | errInfo:"小区城市编码不能大于4个字符" |
| | | }, |
| | | 'editCommunityInfo.mapY': [{ |
| | | limit: "maxLength", |
| | | param: "20", |
| | | errInfo: "小区城市编码不能大于4个字符" |
| | | }, |
| | | ], |
| | | 'editCommunityInfo.communityId':[ |
| | | { |
| | | limit:"required", |
| | | param:"", |
| | | errInfo:"小区ID不能为空" |
| | | }] |
| | | 'editCommunityInfo.communityId': [{ |
| | | limit: "required", |
| | | param: "", |
| | | errInfo: "小区ID不能为空" |
| | | }] |
| | | |
| | | }); |
| | | }, |
| | | editCommunity:function(){ |
| | | if(!vc.component.editCommunityValidate()){ |
| | | }); |
| | | }, |
| | | editCommunity: function() { |
| | | if (!vc.component.editCommunityValidate()) { |
| | | vc.toast(vc.validate.errInfo); |
| | | return ; |
| | | return; |
| | | } |
| | | |
| | | vc.http.post( |
| | | 'editCommunity', |
| | | 'update', |
| | | JSON.stringify(vc.component.editCommunityInfo), |
| | | { |
| | | emulateJSON:true |
| | | }, |
| | | function(json,res){ |
| | | //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); |
| | | if(res.status == 200){ |
| | | //关闭model |
| | | $('#editCommunityModel').modal('hide'); |
| | | vc.emit('communityManage','listCommunity',{}); |
| | | return ; |
| | | } |
| | | vc.message(json); |
| | | }, |
| | | function(errInfo,error){ |
| | | console.log('请求失败处理'); |
| | | vc.http.post('editCommunity', 'update', JSON.stringify(vc.component.editCommunityInfo), { |
| | | emulateJSON: true |
| | | }, |
| | | function(json, res) { |
| | | //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); |
| | | if (res.status == 200) { |
| | | //关闭model |
| | | $('#editCommunityModel').modal('hide'); |
| | | vc.emit('communityManage', 'listCommunity', {}); |
| | | return; |
| | | } |
| | | vc.message(json); |
| | | }, |
| | | function(errInfo, error) { |
| | | console.log('请求失败处理'); |
| | | |
| | | vc.message(errInfo); |
| | | }); |
| | | vc.message(errInfo); |
| | | }); |
| | | }, |
| | | refreshEditCommunityInfo:function(){ |
| | | vc.component.editCommunityInfo= { |
| | | communityId:'', |
| | | name:'', |
| | | address:'', |
| | | nearbyLandmarks:'', |
| | | cityCode:'0971', |
| | | mapX:'101.33', |
| | | mapY:'101.33', |
| | | refreshEditCommunityInfo: function() { |
| | | vc.component.editCommunityInfo = { |
| | | communityId: '', |
| | | name: '', |
| | | address: '', |
| | | nearbyLandmarks: '', |
| | | cityCode: '', |
| | | mapX: '101.33', |
| | | mapY: '101.33', |
| | | |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | })(window.vc,window.vc.component); |
| | | })(window.vc, window.vc.component); |