ludc
2024-09-26 085df90e488067783759dcd63cdb5fb43a51ff1f
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -5,6 +5,7 @@
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.corba.framework.data.RoleRightInfo;
import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.qtm.QTInfo;
import com.vci.corba.portal.PortalService;
import com.vci.corba.portal.data.*;
import com.vci.dto.RoleRightDTO;
@@ -2266,7 +2267,7 @@
     * @param obj
     * @throws PLException
     */
    public void checkCodeName(PLUILayout obj) throws PLException {
    private void checkCodeName(PLUILayout obj) throws PLException {
        PLUILayout[] plUILayouts = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(obj.plRelatedType);
        int length = plUILayouts.length;
        String code = obj.plCode;
@@ -2332,6 +2333,220 @@
        return res;
    }
    /**
     * 业务类型、源对象类型、顶层节点显示类型等都调用这个接口查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    public DataGrid<BizType> getBtmDatasByPage(BaseQueryObject baseQueryObject) throws PLException{
        BizType[] btmNames = null;
        int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1;
        int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit());
        String where = " 1=1 ";
        String text = "";
        Map<String, String> conditionMap = baseQueryObject.getConditionMap();
        if(Func.isNotEmpty(conditionMap)){
            //过滤条件
            String filterInputValue = conditionMap.get("filterInputValue");
            if(Func.isNotBlank(filterInputValue)){
                where += String.format(" and (bt.name like '%%%s%%' or bt.label like '%%%s%%')", text, text);
            }
        }
        String fromWhere = String.format(" from plbtmtype bt where %s ", where);
        String fromWhereOrderBy = String.format(" %s order by bt.name", fromWhere);
        String sql = String.format("select * from(" +
                "  select row_.*,rownum rownum_ from( " +
                "         select bt.name, bt.label %s" +
                "  ) row_ " +
                ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end);
        List<BizType> list = new LinkedList<BizType>();
        String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        for(String[] kvs : kvss){
            BizType bi = new BizType();
            bi.name = kvs[0];
            bi.label = kvs[1];
            list.add(bi);
        }
        btmNames = list.toArray(new BizType[]{});
        sql = String.format("select count(1) count_ %s", fromWhere);
        kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        int total = Integer.valueOf(kvss[0][0]);
        DataGrid<BizType> res = new DataGrid<>();
        res.setData(Arrays.asList(btmNames));
        res.setTotal(total);
        return res;
    }
    /**
     * UI定义下拉查询(templateType为UI定义时的UI定义下拉查询)
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    public DataGrid<PLUILayout> getUILayoutDatasByPage(BaseQueryObject baseQueryObject) throws PLException{
        PLUILayout[] datas = null;
        int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1;
        int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit());
        String where = " 1=1 ";
        Map<String, String> conditionMap = baseQueryObject.getConditionMap();
        if(Func.isNotEmpty(conditionMap)){
            //选择的对象类型
            String selectBtmType = conditionMap.get("selectBtmType");
            if(selectBtmType != null){
                where += String.format(" and ui.PLRELATEDTYPE = '%s' ", selectBtmType);
            }
            //过滤条件
            String filterInputValue = conditionMap.get("filterInputValue");
            if(Func.isNotBlank(filterInputValue)){
                where += String.format(" and (ui.plname like '%%%s%%') ", filterInputValue, filterInputValue);
            }
        }
        String fromWhere = String.format(" from PLUILAYOUT ui where %s ", where);
        String fromWhereOrderBy = String.format(" %s order by ui.plname", fromWhere);
        String sql = String.format("select * from(" +
                "  select row_.*,rownum rownum_ from( " +
                "         select ui.plname, ui.plcode %s" +
                "  ) row_ " +
                ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end);
        List<PLUILayout> list = new LinkedList<PLUILayout>();
        String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        for(String[] kvs : kvss){
            PLUILayout bi = new PLUILayout();
            bi.plName = kvs[0];
            bi.plCode = kvs[1];
            list.add(bi);
        }
        datas = list.toArray(new PLUILayout[0]);
        sql = String.format("select count(1) count_ %s", fromWhere);
        kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        int total = Integer.valueOf(kvss[0][0]);
        DataGrid<PLUILayout> res = new DataGrid<PLUILayout>();
        res.setData(Arrays.asList(datas));
        res.setTotal(total);
        return res;
    }
    /**
     * 选择模板下拉查询(templateType为表格、表单、树表时的选择对象下拉查询)
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    public DataGrid<PortalVI> getPortalVIDatasByPage(BaseQueryObject baseQueryObject) throws PLException{
        PortalVI[] datas = null;
        int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1;
        int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit());
        String where = " 1=1 ";
        Map<String, String> conditionMap = baseQueryObject.getConditionMap();
        if(Func.isNotEmpty(conditionMap)){
            //选择的源对象或者是选择的父节点显示类型
            String selectBtmType = conditionMap.get("selectBtmType");
            if(selectBtmType != null){
                where += String.format(" and vi.typename = '%s' ", selectBtmType);
            }
            /*if(getPopupDialog().getPortalVIType() != null){
                where += String.format(" and vi.vitype = %d ", getPopupDialog().getPortalVIType().getIntVal());
            }*/
            //过滤条件
            String filterInputValue = conditionMap.get("filterInputValue");
            if(Func.isNotBlank(filterInputValue)){
                where += String.format(" and (vi.viname like '%%%s%%') ", filterInputValue, filterInputValue);
            }
        }
        String fromWhere = String.format(" from plportalvi vi where %s ", where);
        String fromWhereOrderBy = String.format(" %s order by vi.viname", fromWhere);
        String sql = String.format("select * from(" +
                "  select row_.*,rownum rownum_ from( " +
                "         select vi.viname,vi.vitype  %s" +
                "  ) row_ " +
                ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end);
        List<PortalVI> list = new LinkedList<>();
        String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        for(String[] kvs : kvss){
            PortalVI bi = new PortalVI();
            bi.viName = kvs[0];
            bi.viType = Short.valueOf(kvs[1]);
            list.add(bi);
        }
        datas = list.toArray(new PortalVI[]{});
        sql = String.format("select count(1) count_ %s", fromWhere);
        kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        int total = Integer.valueOf(kvss[0][0]);
        DataGrid<PortalVI> res = new DataGrid<>();
        res.setData(Arrays.asList(datas));
        res.setTotal(total);
        return res;
    }
    /**
     * 查询模板下拉查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    public DataGrid<QTInfo> getQTInfoDatasByPage(BaseQueryObject baseQueryObject) throws PLException{
        QTInfo[] datas = null;
        int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1;
        int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit());
        String where = " 1=1 ";
        Map<String, String> conditionMap = baseQueryObject.getConditionMap();
        if(Func.isNotEmpty(conditionMap)){
            //选择的源对象或者是选择的父节点显示类型
            String selectBtmType = conditionMap.get("selectBtmType");
            if(selectBtmType != null){
                where += String.format(" and qt.btmname = '%s' ", selectBtmType);
            }
            //过滤条件
            String filterInputValue = conditionMap.get("filterInputValue");
            if(Func.isNotBlank(filterInputValue)){
                where += String.format(" and (qt.qtname like '%%%s%%') ", filterInputValue, filterInputValue);
            }
        }
        String fromWhere = String.format(" from PL_QTEMPLATE qt where %s ", where);
        String fromWhereOrderBy = String.format(" %s order by qt.qtname ", fromWhere);
        String sql = String.format("select * from(" +
                "  select row_.*,rownum rownum_ from( " +
                "         select qt.qtname,qt.btmname  %s" +
                "  ) row_ " +
                ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end);
        List<QTInfo> list = new LinkedList<QTInfo>();
        String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        for(String[] kvs : kvss){
            QTInfo bi = new QTInfo();
            bi.qtName = kvs[0];
            bi.btmName = kvs[1];
            list.add(bi);
        }
        datas = list.toArray(new QTInfo[]{});
        sql = String.format("select count(1) count_ %s", fromWhere);
        kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
        int total = Integer.valueOf(kvss[0][0]);
        DataGrid<QTInfo> res = new DataGrid<QTInfo>();
        res.setData(Arrays.asList(datas));
        res.setTotal(total);
        return res;
    }
    //基础公共检查接口
    private abstract class BaseComptInter {