java110
2020-07-31 c569069f3202d4694e3b89dee78116d4c67f2331
优化代码
6个文件已修改
64 ■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/basePrivilege/BasePrivilegeDto.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/basePrivilege/SaveBasePrivilegeListener.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/configMenu/BindingConfigMenuListener.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/controller/CallComponentController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/controller/app/AppController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/basePrivilege/BasePrivilegeDto.java
@@ -13,6 +13,7 @@
    private String domain;
    private String description;
    private String statusCd = "0";
    private String mId;
    private String createTime;
@@ -87,4 +88,12 @@
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getmId() {
        return mId;
    }
    public void setmId(String mId) {
        this.mId = mId;
    }
}
java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml
@@ -122,9 +122,9 @@
    <!-- 保存路由信息至 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>
@@ -146,6 +146,9 @@
        </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 ">
@@ -214,6 +217,9 @@
        <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>
@@ -226,7 +232,7 @@
        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>
@@ -239,7 +245,7 @@
        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>
@@ -249,9 +255,7 @@
        <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>
@@ -262,7 +266,7 @@
            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}
@@ -346,7 +350,7 @@
        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>
@@ -366,7 +370,7 @@
            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}
service-api/src/main/java/com/java110/api/listener/basePrivilege/SaveBasePrivilegeListener.java
@@ -36,6 +36,7 @@
        Assert.hasKeyAndValue(reqJson, "name", "必填,请填写权限名称");
        Assert.hasKeyAndValue(reqJson, "domain", "必填,请选择商户类型");
        Assert.hasKeyAndValue(reqJson, "resource", "必填,请选择资源路径");
        Assert.hasKeyAndValue(reqJson, "mId", "必填,菜单为空");
    }
service-api/src/main/java/com/java110/api/listener/configMenu/BindingConfigMenuListener.java
@@ -71,6 +71,8 @@
        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);
        }
@@ -107,7 +109,7 @@
    }
    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) {
service-front/src/main/java/com/java110/front/controller/CallComponentController.java
@@ -64,7 +64,7 @@
            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);
@@ -130,7 +130,7 @@
            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);
@@ -201,7 +201,7 @@
            pd = freshPageDate(request);
            //权限校验
            hasPrivilege(restTemplate, pd, "/" + componentCode + "/" + componentMethod);
            hasPrivilege(restTemplate, pd, "/callComponent/" + componentCode + "/" + componentMethod);
            Object componentInstance = ApplicationContextFactory.getBean(componentCode);
@@ -268,7 +268,7 @@
            Assert.hasLength(componentMethod, "参数错误,未传入调用组件方法");
            pd = freshPageDate(request);
            hasPrivilege(restTemplate, pd, "/" + componentCode + "/" + componentMethod);
            hasPrivilege(restTemplate, pd, "/callComponent/download/" + componentCode + "/" + componentMethod);
            Object componentInstance = ApplicationContextFactory.getBean(componentCode);
service-front/src/main/java/com/java110/front/controller/app/AppController.java
@@ -2,6 +2,7 @@
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;
@@ -12,6 +13,7 @@
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;
@@ -33,6 +35,9 @@
    @Autowired
    private IApiSMO apiSMOImpl;
    @Autowired
    private RestTemplate restTemplate;
    /**
     * 资源请求 post方式
@@ -60,6 +65,8 @@
            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);
@@ -90,6 +97,8 @@
            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);
@@ -123,6 +132,8 @@
            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);
@@ -158,6 +169,8 @@
            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);
@@ -190,6 +203,8 @@
            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);
@@ -219,7 +234,8 @@
            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);