| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.controller.BaseController; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.front.smo.api.IApiSMO; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | @Autowired |
| | | private IApiSMO apiSMOImpl; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | /** |
| | | * 资源请求 post方式 |
| | |
| | | headers.put(CommonConstant.HTTP_SERVICE, service); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_POST); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | responseEntity = apiSMOImpl.doApi(postInfo, headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求post 方法[" + service + "]失败:" + postInfo, e); |
| | |
| | | headers.put(CommonConstant.HTTP_SERVICE, service); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_GET); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", "", headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求get 方法[" + service + "]失败:", e); |
| | |
| | | headers.put(CommonConstant.HTTP_ACTION, action); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_GET); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", "", headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求get 方法[" + action + "]失败:", e); |
| | |
| | | headers.put(CommonConstant.HTTP_ACTION, action); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_POST); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", action, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | responseEntity = apiSMOImpl.doApi(postInfo, headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求post 方法[" + action + "]失败:" + postInfo, e); |
| | |
| | | headers.put(CommonConstant.HTTP_SERVICE, service); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_PUT); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service ); |
| | | responseEntity = apiSMOImpl.doApi(postInfo, headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求put 方法[" + service + "]失败:", e); |
| | |
| | | headers.put(CommonConstant.HTTP_SERVICE, service); |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_DELETE); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, "", headers); |
| | | |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service ); |
| | | responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | } catch (Throwable e) { |
| | | logger.error("请求delete 方法[" + service + "]失败:", e); |