| | |
| | | private String domain; |
| | | private String description; |
| | | private String statusCd = "0"; |
| | | private String mId; |
| | | |
| | | private String createTime; |
| | | |
| | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getmId() { |
| | | return mId; |
| | | } |
| | | |
| | | public void setmId(String mId) { |
| | | this.mId = mId; |
| | | } |
| | | } |
| | |
| | | <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 --> |
| | | <insert id="saveBasePrivilegeInfo" parameterType="Map"> |
| | | insert into p_privilege( |
| | | p_id,name,resource,domain,description |
| | | p_id,name,resource,domain,description,m_id |
| | | ) values ( |
| | | #{pId},#{name},#{resource},#{domain},#{description} |
| | | #{pId},#{name},#{resource},#{domain},#{description},#{mId} |
| | | ) |
| | | |
| | | </insert> |
| | |
| | | </if> |
| | | <if test="domain !=null and domain != ''"> |
| | | and t.domain= #{domain} |
| | | </if> |
| | | <if test="mId !=null and mId != ''"> |
| | | and t.m_id= #{mId} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | |
| | | <if test="domain !=null and domain != ''"> |
| | | and t.domain= #{domain} |
| | | </if> |
| | | <if test="mId !=null and mId != ''"> |
| | | and t.m_id= #{mId} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | |
| | | insert into m_menu( |
| | | m_id,name,g_id,url,seq,p_id,description,is_show |
| | | ) values ( |
| | | #{mId},#{name},#{gId},#{url},#{seq},#{pId},#{description},#{isShow} |
| | | #{mId},#{name},#{gId},#{url},#{seq},'-1',#{description},#{isShow} |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | from m_menu t,p_privilege p |
| | | where t.status_cd= '0' |
| | | and p.status_cd= '0' |
| | | and t.p_id = p.p_id |
| | | and t.m_id = p.m_id |
| | | <if test="gId !=null and gId != ''"> |
| | | and t.g_id= #{gId} |
| | | </if> |
| | |
| | | <if test="mName !=null and mName != ''"> |
| | | and t.name like concat('%',#{mName},'%') |
| | | </if> |
| | | <if test="pId !=null and pId != ''"> |
| | | and t.p_id= #{pId} |
| | | </if> |
| | | |
| | | <if test="domain !=null and domain != ''"> |
| | | and p.domain= #{domain} |
| | | </if> |
| | |
| | | and t.m_id= #{mId} |
| | | </if> |
| | | <if test="pId !=null and pId != ''"> |
| | | and t.p_id= #{pId} |
| | | and p.p_id= #{pId} |
| | | </if> |
| | | <if test="isShow !=null and isShow != ''"> |
| | | and t.is_show= #{isShow} |
| | |
| | | from m_menu t,p_privilege p |
| | | where t.status_cd= '0' |
| | | and p.status_cd= '0' |
| | | and t.p_id = p.p_id |
| | | and t.m_id = p.m_id |
| | | <if test="gId !=null and gId != ''"> |
| | | and t.g_id= #{gId} |
| | | </if> |
| | |
| | | and p.name like concat('%',#{pName},'%') |
| | | </if> |
| | | <if test="mId !=null and mId != ''"> |
| | | and t.m_id= #{mId} |
| | | and p.m_id= #{mId} |
| | | </if> |
| | | <if test="pId !=null and pId != ''"> |
| | | and t.p_id= #{pId} |
| | |
| | | Assert.hasKeyAndValue(reqJson, "name", "必填,请填写权限名称"); |
| | | Assert.hasKeyAndValue(reqJson, "domain", "必填,请选择商户类型"); |
| | | Assert.hasKeyAndValue(reqJson, "resource", "必填,请选择资源路径"); |
| | | Assert.hasKeyAndValue(reqJson, "mId", "必填,菜单为空"); |
| | | |
| | | } |
| | | |
| | |
| | | JSONObject viewMenuGroupInfo = getObj(infos, "viewMenuGroupInfo"); |
| | | JSONObject addMenuView = getObj(infos, "addMenuView"); |
| | | JSONObject addPrivilegeView = getObj(infos, "addPrivilegeView"); |
| | | addPrivilegeView.put("mId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.MENU)); |
| | | addMenuView.put("mId", addPrivilegeView.getString("mId")); |
| | | if (!hasKey(viewMenuGroupInfo, "gId")) { |
| | | saveMenuGroup(viewMenuGroupInfo, context); |
| | | } |
| | |
| | | } |
| | | |
| | | private void saveMenu(Map info, DataFlowContext context) { |
| | | info.put("mId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.MENU)); |
| | | //info.put("mId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.MENU)); |
| | | info.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID)); |
| | | MenuDto menuDto = BeanConvertUtil.covertBean(info, MenuDto.class); |
| | | if (menuInnerServiceSMOImpl.saveMenu(menuDto) < 1) { |
| | |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | pd.setApiUrl("/api/" + api); |
| | | //权限校验 |
| | | hasPrivilege(restTemplate, pd, "/" + api); |
| | | hasPrivilege(restTemplate, pd, "/callComponent/" + api); |
| | | |
| | | Object componentInstance = ApplicationContextFactory.getBean(componentCode); |
| | | |
| | |
| | | |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | //权限校验 |
| | | hasPrivilege(restTemplate, pd, "/" + componentCode + "/" + componentMethod); |
| | | hasPrivilege(restTemplate, pd, "/callComponent/" + componentCode + "/" + componentMethod); |
| | | |
| | | Object componentInstance = ApplicationContextFactory.getBean(componentCode); |
| | | |
| | |
| | | |
| | | pd = freshPageDate(request); |
| | | //权限校验 |
| | | hasPrivilege(restTemplate, pd, "/" + componentCode + "/" + componentMethod); |
| | | hasPrivilege(restTemplate, pd, "/callComponent/" + componentCode + "/" + componentMethod); |
| | | |
| | | Object componentInstance = ApplicationContextFactory.getBean(componentCode); |
| | | |
| | |
| | | Assert.hasLength(componentMethod, "参数错误,未传入调用组件方法"); |
| | | pd = freshPageDate(request); |
| | | |
| | | hasPrivilege(restTemplate, pd, "/" + componentCode + "/" + componentMethod); |
| | | hasPrivilege(restTemplate, pd, "/callComponent/download/" + componentCode + "/" + componentMethod); |
| | | |
| | | |
| | | Object componentInstance = ApplicationContextFactory.getBean(componentCode); |
| | |
| | | |
| | | 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); |