%@page import="com.amarsoft.app.als.sys.tools.Tools"%> <%@page import="java.util.regex.*"%> <%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBegin.jsp"%><% /* Content: 选择树型对话框页面 Input Param: SelName:查询名称 ParaString:参数字符串 */ //获取参数:查询名称和参数 String sSelName = CurPage.getParameter("SelName"); String sParaString = CurPage.getParameter("ParaString"); sParaString = (sParaString == null)?"":java.net.URLDecoder.decode(sParaString, "UTF-8"); //将空值转化为空字符串 if(sSelName == null) sSelName = ""; if(sParaString == null) sParaString = ""; //汽车业务:1,一般租赁业务:3,其他,2 String sProductType = ""; if(sParaString.contains("ProductType")){ String[] arry = sParaString.split(","); Pattern p = Pattern.compile("ProductType,[A-Za-z0-9@]+"); Matcher m = p.matcher(sParaString); while(m.find()){ sProductType = m.group().split(",")[1]; } } String sTypeNo = ""; if(sParaString.contains("TypeNo")){ String[] arry = sParaString.split(","); Pattern p = Pattern.compile("TypeNo,[A-Za-z0-9@]+"); Matcher m = p.matcher(sParaString); while(m.find()){ sTypeNo = m.group().split(",")[1]; } } String checkValue = ""; if(sParaString.indexOf("checkValue") != -1){ checkValue = sParaString.split("checkValue")[1].split(",")[0].substring(1); sParaString = sParaString.replaceAll("checkValue="+checkValue, ""); sParaString = sParaString.replaceAll("&&", "&"); } //定义变量:查询类型、展现方式、参数、隐藏域 String sSelType = "",sSelBrowseMode = "",sSelArgs = "",sSelHideField = ""; //定义变量:代码、字段显示中文名称、表名、主键 String sSelCode = "",sSelFieldName = "",sSelTableName = "",sSelPrimaryKey = ""; //定义变量:字段显示风格、返回值、过滤字段、选择方式 String sSelFieldDisp = "",sSelReturnValue = "",sSelFilterField = ""; boolean isMutil = false; //定义变量:属性1、属性2、属性3、属性4、属性5 String sAttribute1 = "",sAttribute2 = "",sAttribute3 = "",sAttribute4 = "",sAttribute5 = ""; String sSql = " select SelType,SelTableName,SelPrimaryKey,SelBrowseMode,SelArgs,SelHideField,SelCode, "+ " SelFieldName,SelFieldDisp,SelReturnValue,SelFilterField,MutilOrSingle,Attribute1, "+ " Attribute2,Attribute3,Attribute4,Attribute5 "+ " from O where SelName =:SelName and IsInUse = '1' "; BizObject bo = JBOFactory.createBizObjectQuery("jbo.sys.SELECT_CATALOG", sSql).setParameter("SelName", sSelName).getSingleResult(false); if(bo != null){ sSelType = bo.getAttribute("SelType").getString(); // × 预留参数,现只有Sql sSelTableName = bo.getAttribute("SelTableName").getString(); // × 预留 sSelPrimaryKey = bo.getAttribute("SelPrimaryKey").getString(); // × 预留 sSelBrowseMode = bo.getAttribute("SelBrowseMode").getString(); // × 固定TreeView sSelArgs = bo.getAttribute("SelArgs").getString(); // × 页面参数ParaString sSelHideField = bo.getAttribute("SelHideField").getString(); // sColId sSelCode = bo.getAttribute("SelCode").getString(); // sFrom //筛选业务类型 if(!sProductType.contains("@") && "1".equals(sProductType)){ sSelCode = sSelCode + "and sortno LIKE '0005%' "; if(sTypeNo.length() != 0){ sSelCode += " and typeno <>'"+sTypeNo+"' "; } }else if(!sProductType.contains("@") && "3".equals(sProductType)){ sSelCode = sSelCode + "and sortno LIKE '0006%' "; if(sTypeNo.length() != 0){ sSelCode += " and typeno <>'"+sTypeNo+"' "; } }else if(sProductType.contains("@") && sProductType.contains("1") && sProductType.contains("3")){ sSelCode = sSelCode + "and sortno not LIKE '0003%' and sortno not LIKE '0004%' "; if(sTypeNo.length() != 0){ sSelCode += " and typeno <>'"+sTypeNo+"' "; } } sSelFieldName = bo.getAttribute("SelFieldName").getString(); // sColValue sSelFieldDisp = bo.getAttribute("SelFieldDisp").getString(); // sColName sSelReturnValue = bo.getAttribute("SelReturnValue").getString(); // × node.value@node.name sSelFilterField = bo.getAttribute("SelFilterField").getString(); // sOrderBy isMutil = "Multi".equals(bo.getAttribute("MutilOrSingle").getString()); // MultiSelect sAttribute1 = bo.getAttribute("Attribute1").getString(); // ExpandNodeId sAttribute2 = bo.getAttribute("Attribute2").getString(); // 表示是否能选文件夹节点,2表示不能 sAttribute3 = bo.getAttribute("Attribute3").getString(); // × 预留 sAttribute4 = bo.getAttribute("Attribute4").getString(); // × 预留 sAttribute5 = bo.getAttribute("Attribute5").getString(); // × 预留 } //将空值转化为空字符串 if(sSelType == null) sSelType = ""; if(sSelTableName == null) sSelTableName = ""; if(sSelPrimaryKey == null) sSelPrimaryKey = ""; if(sSelBrowseMode == null) sSelBrowseMode = ""; if(sSelArgs == null) sSelArgs = ""; else sSelArgs = sSelArgs.trim(); if(sSelHideField == null) sSelHideField = ""; else sSelHideField = sSelHideField.trim(); if(sSelCode == null) sSelCode = ""; else sSelCode = sSelCode.trim(); if(sSelFieldName == null) sSelFieldName = ""; else sSelFieldName = sSelFieldName.trim(); if(sSelFieldDisp == null) sSelFieldDisp = ""; else sSelFieldDisp = sSelFieldDisp.trim(); if(sSelReturnValue == null) sSelReturnValue = ""; else sSelReturnValue = sSelReturnValue.trim(); if(sSelFilterField == null) sSelFilterField = ""; else sSelFilterField = sSelFilterField.trim(); if(sAttribute1 == null) sAttribute1 = ""; if(sAttribute2 == null) sAttribute2 = ""; if(sAttribute3 == null) sAttribute3 = ""; if(sAttribute4 == null) sAttribute4 = ""; if(sAttribute5 == null) sAttribute5 = ""; //获取返回值 StringTokenizer st = new StringTokenizer(sSelReturnValue,"@"); String [] sReturnValue = new String[st.countTokens()]; int l = 0; while (st.hasMoreTokens()) { sReturnValue[l] = st.nextToken(); l ++; } //设置显示标题 String sHeaders = sSelFieldName; //将Sql中的变量用相对应的值替换 StringTokenizer stArgs = new StringTokenizer(sParaString,","); while (stArgs.hasMoreTokens()) { try{ String sArgName = stArgs.nextToken().trim(); String sArgValue = stArgs.nextToken().trim(); sSelCode = StringFunction.replace(sSelCode,"#"+sArgName,sArgValue ); }catch(NoSuchElementException ex){ throw new Exception("输入参数格式错误!"); } } %>