| | |
| | | import com.java110.service.smo.IQueryServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | String userId = event.getCmdDataFlowContext().getReqHeaders().get("user-id"); |
| | | |
| | | if(StringUtil.isEmpty(userId)){ |
| | | userId = reqJson.getString("userId"); |
| | | } |
| | | |
| | | DataQuery dataQuery = new DataQuery(); |
| | | dataQuery.setServiceCode("query.store.byuser"); |
| | | JSONObject param = new JSONObject(); |
| | |
| | | dataQuery.setRequestParams(param); |
| | | queryServiceSMOImpl.commonQueryService(dataQuery); |
| | | ResponseEntity<String> responseEntity = dataQuery.getResponseEntity(); |
| | | //todo 直接查询失败,所以直接返回异常 |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | context.setResponseEntity(new ResponseEntity<>("初始化商户", HttpStatus.FORBIDDEN)); |
| | | return; |
| | | } |
| | | |
| | | |
| | | //todo 说明是员工 返回查询信息 |
| | | String storeInfo = responseEntity.getBody(); |
| | | if (Assert.isJsonObject(storeInfo) && JSONObject.parseObject(storeInfo).containsKey("storeId")) { |
| | | context.setResponseEntity(responseEntity); |
| | | return; |
| | | } |
| | | context.setResponseEntity(new ResponseEntity<>("初始化商户", HttpStatus.FORBIDDEN)); |
| | | //todo 说明是业主 返回空即可 |
| | | context.setResponseEntity(ResultVo.success()); |
| | | } |
| | | } |