From 1eb42f84740cd967af2e80f765d90a0cc1945521 Mon Sep 17 00:00:00 2001 From: zhengzhen Date: Tue, 20 Apr 2021 16:56:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BC=80=E5=90=AFdebug=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jflow-core/src/main/java/bp/da/DBAccess.java | 72 +++++++++++--------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/jflow-core/src/main/java/bp/da/DBAccess.java b/jflow-core/src/main/java/bp/da/DBAccess.java index d27b977408..4ced878dba 100644 --- a/jflow-core/src/main/java/bp/da/DBAccess.java +++ b/jflow-core/src/main/java/bp/da/DBAccess.java @@ -1285,13 +1285,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + i); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + i); } return i; } catch (Exception ex) { - String msg = "@运行更新在(RunSQL_200705_SQL)出错。\n @SQL: " + sql + "\n @Param: " + paras.getDebugInfo() + String msg = "@运行更新在(RunSQL_200705_SQL)出错。\n @SQL: " + sql + "\n @Param: " + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); @@ -1330,11 +1330,11 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + i); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + i); } return i; } catch (Exception ex) { - String msg = "@运行更新在(RunSQL_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " + paras.getDebugInfo() + String msg = "@运行更新在(RunSQL_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); @@ -1391,12 +1391,12 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + i); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + i); } // conn.commit(); return i; } catch (Exception ex) { - String msg = "@运行更新在(RunSQL_200705_MySQL)出错。\n @SQL: " + sql + "\n @Param: " + paras.getDebugInfo() + String msg = "@运行更新在(RunSQL_200705_MySQL)出错。\n @SQL: " + sql + "\n @Param: " + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); @@ -1443,11 +1443,11 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + i); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + i); } return i; } catch (Exception ex) { - String msg = "@运行更新在(RunSQL_20191230_DM)出错。\n @SQL: " + sql + "\n @Param: " + paras.getDebugInfo() + String msg = "@运行更新在(RunSQL_20191230_DM)出错。\n @SQL: " + sql + "\n @Param: " + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); @@ -1629,12 +1629,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + oratb.Rows.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + oratb.Rows.size()); } return oratb; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_SQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -1694,12 +1694,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + rs.getRow()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + rs.getRow()); } return 1; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_SQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -1765,13 +1765,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + ens.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + ens.size()); } return ens.size(); } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnResultSet_201809_SQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -1858,12 +1858,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + oratb.Rows.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + oratb.Rows.size()); } return oratb; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -1922,12 +1922,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + rs.getRow()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + rs.getRow()); } return 1; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -1986,12 +1986,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + rs.getRow()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + rs.getRow()); } return 1; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2056,13 +2056,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + ens.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + ens.size()); } return ens.size(); } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_Ora)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2128,13 +2128,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + ens.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + ens.size()); } return ens.size(); } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnResultSet_201809_DM)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2250,12 +2250,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + oratb.Rows.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + oratb.Rows.size()); } return oratb; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_MySQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2356,12 +2356,12 @@ public class DBAccess { } if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + oratb.Rows.size()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + oratb.Rows.size()); } return oratb; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnTable_200705_DM)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2426,13 +2426,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + rs.getRow()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + rs.getRow()); } return ens.size(); } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnResultSet_201809_MySQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -2495,13 +2495,13 @@ public class DBAccess { if (Log.isLoggerDebugEnabled()) { Log.DefaultLogWriteLineDebug("SQL: " + sql); - Log.DefaultLogWriteLineDebug("Param: " + paras.getDebugInfo() + ", Result: Rows=" + rs.getRow()); + Log.DefaultLogWriteLineDebug("Param: " + getDebugInfo(paras) + ", Result: Rows=" + rs.getRow()); } return 1; } catch (Exception ex) { String msg = "@运行查询在(RunSQLReturnResultSet_201809_MySQL)出错。\n @SQL: " + sql + "\n @Param: " - + paras.getDebugInfo() + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); + + getDebugInfo(paras) + "\n @异常信息: " + StringUtils.replace(ex.getMessage(), "\n", " "); Log.DefaultLogWriteLineError(msg); throw new RuntimeException(msg, ex); } finally { @@ -3777,4 +3777,12 @@ public class DBAccess { } } + + private static String getDebugInfo(Paras paras){ + if(paras == null){ + return ""; + }else{ + return paras.getDebugInfo(); + } + } } -- Gitee From 28a25f76d09dabdd19fa389cb2e5210f425dc97a Mon Sep 17 00:00:00 2001 From: zhengzhen Date: Tue, 20 Apr 2021 18:14:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=9C=A8catch=E4=B8=AD?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=E8=BE=93=E5=87=BA=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../difference/handler/HttpHandlerBase.java | 779 +++++++++--------- 1 file changed, 390 insertions(+), 389 deletions(-) diff --git a/jflow-core/src/main/java/bp/difference/handler/HttpHandlerBase.java b/jflow-core/src/main/java/bp/difference/handler/HttpHandlerBase.java index 3f857bef7c..ec82a3fdd1 100644 --- a/jflow-core/src/main/java/bp/difference/handler/HttpHandlerBase.java +++ b/jflow-core/src/main/java/bp/difference/handler/HttpHandlerBase.java @@ -1,389 +1,390 @@ -package bp.difference.handler; - -import bp.da.DataType; -import bp.difference.ContextHolderUtils; -import bp.tools.StringHelper; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - -public abstract class HttpHandlerBase -{ - /** - * 获取 "Handler业务处理类"的Type - * 注意: "Handler业务处理类"必须继承自WebContralBase

- */ - public abstract java.lang.Class getCtrlType(); - - public final boolean getIsReusable() - { - return false; - } - - public void ProcessRequestPost(Object mycontext) - { - PrintWriter out =null; - //创建 ctrl 对象. - Object tempVar = mycontext; - - WebContralBase ctrl = (WebContralBase)((tempVar instanceof WebContralBase) ? tempVar : null); - - - String mName=ctrl.GetRequestVal("DoMethod"); - String msg=""; - if (mName==null || mName.equals("null") ) - msg ="方法[" + ctrl.getDoType() + "]类[" + this.getCtrlType().toString() + "]"; - else - msg ="方法[" + mName+ "]类[" + this.getCtrlType().toString() + "],"; - - bp.da.Log.DebugWriteInfo(msg); - // out.write(msg); - - - try - { - //执行方法返回json. - String data = ctrl.DoMethod(ctrl, ctrl.getDoType()); - if(data==null) - data=""; - //返回执行的结果. - this.getResponse().setHeader("content-type", "text/html;charset=UTF-8"); - this.getResponse().setCharacterEncoding("UTF-8"); - out = this.getResponse().getWriter(); - out.write(data); - - - - } - catch (Exception ex) - { - - String err=ex.getMessage(); - - String paras=""; - - paras+= ctrl.GetRequestVal("DoMethod"); - - //返回执行错误的结果. - if (ex.getCause() != null) - { - err+="err@在执行类[" + this.getCtrlType().toString() + "],方法[" + ctrl.getDoType() + "]["+paras+"]错误 \t\n @" + ex.getCause().getMessage() + " \t\n @技术信息:" + ex.getStackTrace(); - } - else - { - err+="err@在执行类[" + this.getCtrlType().toString() + "],方法[" + ctrl.getDoType() + "]["+paras+"]错误 \t\n @" + ex.getMessage() + " \t\n @技术信息:" + ex.getStackTrace(); - } - - bp.da.Log.DebugWriteError(err); - - out.write(err); - - - }finally{ - if(null !=out){ - out.close(); - } - } - } - - // BaseController - - public HttpServletRequest getRequest() { - return ContextHolderUtils.getRequest(); - } - - public HttpServletResponse getResponse()throws Exception { - return ContextHolderUtils.getResponse(); - } - - public String getParamter(String key){ - return getRequest().getParameter(key); - } - - /** - * 增加列的数量。 - */ - public final int getaddRowNum() { - try { - int i = Integer.parseInt(ContextHolderUtils.getRequest() - .getParameter("addRowNum")); - if (ContextHolderUtils.getRequest().getParameter("IsCut") == null) { - return i; - } else { - return i; - } - } catch (java.lang.Exception e) { - return 0; - } - } - - public final int getIsWap() { - if(ContextHolderUtils.getRequest().getParameter("IsWap")==null) - return 0; - if (ContextHolderUtils.getRequest().getParameter("IsWap").equals("1")) { - return 1; - } - return 0; - } - - public String getRefPKVal() { - String str = ContextHolderUtils.getRequest().getParameter("RefPKVal"); - if (str == null) { - return "1"; - } - return str; - } - public final String getSta() { - String str = ContextHolderUtils.getRequest().getParameter("Sta"); - - return str; - } - public int getPageIdx() { - String str = ContextHolderUtils.getRequest().getParameter("PageIdx"); - if (str == null || str.equals("") || str.equals("null")) - return 1; - return Integer.parseInt(str); - // set - // { - // ViewState["PageIdx",value; - // } - } - - public int getPageSize() { - String str = ContextHolderUtils.getRequest().getParameter("PageSize"); - if (str == null || str.equals("") || str.equals("null")) - return 10; - return Integer.parseInt(str); - // set - // { - // ViewState["PageIdx",value; - // } - } - public String getFK_MapExt() { - return ContextHolderUtils.getRequest().getParameter("FK_MapExt"); - } - - public String getFK_MapDtl(){ - return ContextHolderUtils.getRequest().getParameter("FK_MapDtl"); - } - - public final String getKey() { - return ContextHolderUtils.getRequest().getParameter("Key"); - } - - public final String getActionType() - { - String s = ContextHolderUtils.getRequest().getParameter("ActionType"); - if (s == null) - { - s = ContextHolderUtils.getRequest().getParameter("DoType"); - } - - return s; - } - - public String GetRequestVal(String key) - { - return ContextHolderUtils.getRequest().getParameter(key); - } - - public final Long getOID() - { - String str = this.GetRequestVal("RefOID"); // context.Request.QueryString["RefOID"]; - if (DataType.IsNullOrEmpty(str) == true) - str = this.GetRequestVal("OID"); //context.Request.QueryString["OID"]; - - if (DataType.IsNullOrEmpty(str) == true) - str="0"; - - return Long.parseLong(str); - - } - public String getFK_Flow() - { - return GetRequestVal("FK_Flow"); - } - public String getEnName() - { - return GetRequestVal("EnName"); - } - public String getRefNo() - { - return GetRequestVal("RefNo"); - } - public String getEnsName() - { - return GetRequestVal("EnsName"); - } - public final String getFK_Emp() - { - return GetRequestVal("FK_Emp"); - } - public final String getPageID() - { - return GetRequestVal("PageID"); - } - public long getWorkID() - { - return Long.parseLong(StringHelper.isEmpty(getParamter("WorkID"), "0")); - } - public boolean getIsCC() - { - String s = ContextHolderUtils.getRequest().getParameter("Paras"); - if (s == null) - { - return false; - } - - if (s.contains("IsCC")) - { - return true; - } - return false; - } - public String getDoType() - { - return ContextHolderUtils.getRequest().getParameter("DoType"); - } - public final int getallRowCount() { - int i = 0; - try { - i = Integer.parseInt(ContextHolderUtils.getRequest().getParameter( - "rowCount")); - } catch (java.lang.Exception e) { - return 0; - } - return i; - } - public final String getTB_Doc() - { - return GetRequestVal("TB_Doc"); - } - - public String getSID() - { - return GetRequestVal("SID"); - } - public int getRefOID() - { - String s = GetRequestVal("RefOID"); - if (s == null || s.equals("")||s.equals("null")) - s = GetRequestVal("OID"); - if (s == null || s.equals("")||s.equals("null")) - return 0; - return Integer.valueOf(s); - } - //public String FK_Node; - //public String FID; - //public String WorkID; - //public String FK_Flow; - //public String MyPK; - - - - public String getMyPK() { - String s = GetRequestVal("MyPK"); - return s; - } - - - /** - * 输出Alert - * @param response - * @param msg - * @throws IOException - */ - protected void printAlert(HttpServletResponse response, String msg) throws IOException{ - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - protected void printAlertReload(HttpServletResponse response, String msg,String url) throws IOException{ - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - protected void windowReload(HttpServletResponse response, String url) throws IOException{ - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - protected void wirteMsg(HttpServletResponse response, String msg) throws IOException{ - if(null == msg){ - return; - } - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(msg); - out.flush(); - } - protected void winCloseWithMsg(HttpServletResponse response, String mess) throws IOException - { - //this.ResponseWriteRedMsg(mess); - //return; - mess = mess.replace("'", "'"); - - mess = mess.replace("\"", """); - - mess = mess.replace(";", ";"); - mess = mess.replace(")", ")"); - mess = mess.replace("(", "("); - - mess = mess.replace(",", ","); - mess = mess.replace(":", ":"); - - - mess = mess.replace("<", "["); - mess = mess.replace(">", "]"); - - mess = mess.replace("[", "["); - mess = mess.replace("]", "]"); - - - mess = mess.replace("@", "\\n@"); - - mess = mess.replace("\r\n", ""); - - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - - protected void winCloseWithMsg1(HttpServletResponse response,String val) throws IOException{ - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - - protected void winClose(HttpServletResponse response) throws IOException{ - response.setContentType("text/html; charset=utf-8"); - PrintWriter out = response.getWriter(); - out.write(""); - out.flush(); - } - public int getFK_Node() { - String str = ContextHolderUtils.getRequest().getParameter("FK_Node"); - if (str == null || str.equals("")||str.equals("null")) - return 1; - return Integer.parseInt(str); - } - -// public void setFK_Node(String fK_Node) { -// FK_Node = fK_Node; -// } - - public long getFID() { - String str = ContextHolderUtils.getRequest().getParameter("FID"); - if (str == null || str.equals("")||str.equals("null")) - return 0; - return Long.valueOf(str); - } - -} +package bp.difference.handler; + +import bp.da.DataType; +import bp.difference.ContextHolderUtils; +import bp.tools.StringHelper; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; + +public abstract class HttpHandlerBase +{ + /** + * 获取 "Handler业务处理类"的Type + * 注意: "Handler业务处理类"必须继承自WebContralBase

+ */ + public abstract java.lang.Class getCtrlType(); + + public final boolean getIsReusable() + { + return false; + } + + public void ProcessRequestPost(Object mycontext) + { + PrintWriter out =null; + //创建 ctrl 对象. + Object tempVar = mycontext; + + WebContralBase ctrl = (WebContralBase)((tempVar instanceof WebContralBase) ? tempVar : null); + + + String mName=ctrl.GetRequestVal("DoMethod"); + String msg=""; + if (mName==null || mName.equals("null") ) + msg ="方法[" + ctrl.getDoType() + "]类[" + this.getCtrlType().toString() + "]"; + else + msg ="方法[" + mName+ "]类[" + this.getCtrlType().toString() + "],"; + + bp.da.Log.DebugWriteInfo(msg); + // out.write(msg); + + + try + { + //执行方法返回json. + out = this.getResponse().getWriter(); + String data = ctrl.DoMethod(ctrl, ctrl.getDoType()); + if(data==null) + data=""; + //返回执行的结果. + this.getResponse().setHeader("content-type", "text/html;charset=UTF-8"); + this.getResponse().setCharacterEncoding("UTF-8"); + + out.write(data); + + + + } + catch (Exception ex) + { + + String err=ex.getMessage(); + + String paras=""; + + paras+= ctrl.GetRequestVal("DoMethod"); + + //返回执行错误的结果. + if (ex.getCause() != null) + { + err+="err@在执行类[" + this.getCtrlType().toString() + "],方法[" + ctrl.getDoType() + "]["+paras+"]错误 \t\n @" + ex.getCause().getMessage() + " \t\n @技术信息:" + ex.getStackTrace(); + } + else + { + err+="err@在执行类[" + this.getCtrlType().toString() + "],方法[" + ctrl.getDoType() + "]["+paras+"]错误 \t\n @" + ex.getMessage() + " \t\n @技术信息:" + ex.getStackTrace(); + } + + bp.da.Log.DebugWriteError(err); + + out.write(err); + + + }finally{ + if(null !=out){ + out.close(); + } + } + } + + // BaseController + + public HttpServletRequest getRequest() { + return ContextHolderUtils.getRequest(); + } + + public HttpServletResponse getResponse()throws Exception { + return ContextHolderUtils.getResponse(); + } + + public String getParamter(String key){ + return getRequest().getParameter(key); + } + + /** + * 增加列的数量。 + */ + public final int getaddRowNum() { + try { + int i = Integer.parseInt(ContextHolderUtils.getRequest() + .getParameter("addRowNum")); + if (ContextHolderUtils.getRequest().getParameter("IsCut") == null) { + return i; + } else { + return i; + } + } catch (java.lang.Exception e) { + return 0; + } + } + + public final int getIsWap() { + if(ContextHolderUtils.getRequest().getParameter("IsWap")==null) + return 0; + if (ContextHolderUtils.getRequest().getParameter("IsWap").equals("1")) { + return 1; + } + return 0; + } + + public String getRefPKVal() { + String str = ContextHolderUtils.getRequest().getParameter("RefPKVal"); + if (str == null) { + return "1"; + } + return str; + } + public final String getSta() { + String str = ContextHolderUtils.getRequest().getParameter("Sta"); + + return str; + } + public int getPageIdx() { + String str = ContextHolderUtils.getRequest().getParameter("PageIdx"); + if (str == null || str.equals("") || str.equals("null")) + return 1; + return Integer.parseInt(str); + // set + // { + // ViewState["PageIdx",value; + // } + } + + public int getPageSize() { + String str = ContextHolderUtils.getRequest().getParameter("PageSize"); + if (str == null || str.equals("") || str.equals("null")) + return 10; + return Integer.parseInt(str); + // set + // { + // ViewState["PageIdx",value; + // } + } + public String getFK_MapExt() { + return ContextHolderUtils.getRequest().getParameter("FK_MapExt"); + } + + public String getFK_MapDtl(){ + return ContextHolderUtils.getRequest().getParameter("FK_MapDtl"); + } + + public final String getKey() { + return ContextHolderUtils.getRequest().getParameter("Key"); + } + + public final String getActionType() + { + String s = ContextHolderUtils.getRequest().getParameter("ActionType"); + if (s == null) + { + s = ContextHolderUtils.getRequest().getParameter("DoType"); + } + + return s; + } + + public String GetRequestVal(String key) + { + return ContextHolderUtils.getRequest().getParameter(key); + } + + public final Long getOID() + { + String str = this.GetRequestVal("RefOID"); // context.Request.QueryString["RefOID"]; + if (DataType.IsNullOrEmpty(str) == true) + str = this.GetRequestVal("OID"); //context.Request.QueryString["OID"]; + + if (DataType.IsNullOrEmpty(str) == true) + str="0"; + + return Long.parseLong(str); + + } + public String getFK_Flow() + { + return GetRequestVal("FK_Flow"); + } + public String getEnName() + { + return GetRequestVal("EnName"); + } + public String getRefNo() + { + return GetRequestVal("RefNo"); + } + public String getEnsName() + { + return GetRequestVal("EnsName"); + } + public final String getFK_Emp() + { + return GetRequestVal("FK_Emp"); + } + public final String getPageID() + { + return GetRequestVal("PageID"); + } + public long getWorkID() + { + return Long.parseLong(StringHelper.isEmpty(getParamter("WorkID"), "0")); + } + public boolean getIsCC() + { + String s = ContextHolderUtils.getRequest().getParameter("Paras"); + if (s == null) + { + return false; + } + + if (s.contains("IsCC")) + { + return true; + } + return false; + } + public String getDoType() + { + return ContextHolderUtils.getRequest().getParameter("DoType"); + } + public final int getallRowCount() { + int i = 0; + try { + i = Integer.parseInt(ContextHolderUtils.getRequest().getParameter( + "rowCount")); + } catch (java.lang.Exception e) { + return 0; + } + return i; + } + public final String getTB_Doc() + { + return GetRequestVal("TB_Doc"); + } + + public String getSID() + { + return GetRequestVal("SID"); + } + public int getRefOID() + { + String s = GetRequestVal("RefOID"); + if (s == null || s.equals("")||s.equals("null")) + s = GetRequestVal("OID"); + if (s == null || s.equals("")||s.equals("null")) + return 0; + return Integer.valueOf(s); + } + //public String FK_Node; + //public String FID; + //public String WorkID; + //public String FK_Flow; + //public String MyPK; + + + + public String getMyPK() { + String s = GetRequestVal("MyPK"); + return s; + } + + + /** + * 输出Alert + * @param response + * @param msg + * @throws IOException + */ + protected void printAlert(HttpServletResponse response, String msg) throws IOException{ + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + protected void printAlertReload(HttpServletResponse response, String msg,String url) throws IOException{ + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + protected void windowReload(HttpServletResponse response, String url) throws IOException{ + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + protected void wirteMsg(HttpServletResponse response, String msg) throws IOException{ + if(null == msg){ + return; + } + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(msg); + out.flush(); + } + protected void winCloseWithMsg(HttpServletResponse response, String mess) throws IOException + { + //this.ResponseWriteRedMsg(mess); + //return; + mess = mess.replace("'", "'"); + + mess = mess.replace("\"", """); + + mess = mess.replace(";", ";"); + mess = mess.replace(")", ")"); + mess = mess.replace("(", "("); + + mess = mess.replace(",", ","); + mess = mess.replace(":", ":"); + + + mess = mess.replace("<", "["); + mess = mess.replace(">", "]"); + + mess = mess.replace("[", "["); + mess = mess.replace("]", "]"); + + + mess = mess.replace("@", "\\n@"); + + mess = mess.replace("\r\n", ""); + + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + + protected void winCloseWithMsg1(HttpServletResponse response,String val) throws IOException{ + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + + protected void winClose(HttpServletResponse response) throws IOException{ + response.setContentType("text/html; charset=utf-8"); + PrintWriter out = response.getWriter(); + out.write(""); + out.flush(); + } + public int getFK_Node() { + String str = ContextHolderUtils.getRequest().getParameter("FK_Node"); + if (str == null || str.equals("")||str.equals("null")) + return 1; + return Integer.parseInt(str); + } + +// public void setFK_Node(String fK_Node) { +// FK_Node = fK_Node; +// } + + public long getFID() { + String str = ContextHolderUtils.getRequest().getParameter("FID"); + if (str == null || str.equals("")||str.equals("null")) + return 0; + return Long.valueOf(str); + } + +} -- Gitee From 67691a86408c2d144471e6d96ca2560ceb0edacb Mon Sep 17 00:00:00 2001 From: zhengzhen Date: Thu, 22 Apr 2021 09:44:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99=E5=AF=BC=E8=87=B4=E9=A1=B5=E9=9D=A2=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/webapp/WF/Comm/RefFunc/EnOnly.htm | 2896 ++++++++--------- 1 file changed, 1448 insertions(+), 1448 deletions(-) diff --git a/jflow-web/src/main/webapp/WF/Comm/RefFunc/EnOnly.htm b/jflow-web/src/main/webapp/WF/Comm/RefFunc/EnOnly.htm index 6a4a772f93..cbcc2fe419 100644 --- a/jflow-web/src/main/webapp/WF/Comm/RefFunc/EnOnly.htm +++ b/jflow-web/src/main/webapp/WF/Comm/RefFunc/EnOnly.htm @@ -1,1448 +1,1448 @@ - - - - - - ccform正在加载请稍候... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
-
-
-
-
-
- 正在初始化,请耐心等待。。。 -
-
-
-
- - - - + + + + + + ccform正在加载请稍候... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
+
+
+
+ 正在初始化,请耐心等待。。。 +
+
+
+
+ + + + -- Gitee From 8548b1e0b2f97b1ef8a0c323ebafb15f56ebb7b2 Mon Sep 17 00:00:00 2001 From: zhengzhen Date: Thu, 22 Apr 2021 18:04:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=9B=BE=E6=A0=87=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/bp/wf/template/MapFrmFool.java | 1787 +++++++++-------- 1 file changed, 894 insertions(+), 893 deletions(-) diff --git a/jflow-core/src/main/java/bp/wf/template/MapFrmFool.java b/jflow-core/src/main/java/bp/wf/template/MapFrmFool.java index 04c74704ae..115c1ffb58 100644 --- a/jflow-core/src/main/java/bp/wf/template/MapFrmFool.java +++ b/jflow-core/src/main/java/bp/wf/template/MapFrmFool.java @@ -1,894 +1,895 @@ -package bp.wf.template; - -import bp.da.*; -import bp.difference.SystemConfig; -import bp.en.*; -import bp.en.Map; -import bp.sys.*; -import bp.web.WebUser; - -/** - 傻瓜表单属性 -*/ -public class MapFrmFool extends EntityNoName -{ - private static final long serialVersionUID = 1L; - - ///属性 - /** - 是否是节点表单? - * @throws Exception - */ - public final boolean getIsNodeFrm() throws Exception - { - if (this.getNo().contains("ND") == false) - { - return false; - } - - if (this.getNo().contains("Rpt") == true) - { - return false; - } - - if (this.getNo().substring(0, 2).equals("ND") && this.getNo().contains("Dtl") == false) - { - return true; - } - - return false; - } - /** - 物理存储表 - * @throws Exception - */ - public final String getPTable() throws Exception - { - return this.GetValStrByKey(MapDataAttr.PTable); - } - public final void setPTable(String value) throws Exception - { - this.SetValByKey(MapDataAttr.PTable, value); - } - /** - 节点ID. - */ - public final int getNodeID() throws Exception - { - if (this.getNo().indexOf("ND") != 0) - { - return 0; - } - return Integer.parseInt(this.getNo().replace("ND", "")); - } - - /** - 表格显示的列 - */ - public final int getTableCol() - { - return 4; - /*int i = this.GetValIntByKey(MapDataAttr.TableCol); - if (i == 0 || i == 1) - { - return 4; - } - return i;*/ - } - public final void setTableCol(int value) throws Exception - { - this.SetValByKey(MapDataAttr.TableCol, value); - } - - public final String getFK_FormTree() throws Exception - { - return this.GetValStringByKey(MapDataAttr.FK_FormTree); - } - public final void setFK_FormTree(String value) throws Exception - { - this.SetValByKey(MapDataAttr.FK_FormTree, value); - } - - - /// - - - ///权限控制. - @Override - public UAC getHisUAC() throws Exception - { - UAC uac = new UAC(); - //uac.OpenForSysAdmin(); - uac.OpenForAdmin(); //2020.5.15修改. - uac.IsInsert = false; - return uac; - } - - /// 权限控制. - - - ///构造方法 - /** - 傻瓜表单属性 - */ - public MapFrmFool() - { - } - /** - 傻瓜表单属性 - - @param no 表单ID - */ - public MapFrmFool(String no) throws Exception - { - super(no); - } - /** - EnMap - */ - @Override - public Map getEnMap() throws Exception - { - if (this.get_enMap() != null) - { - return this.get_enMap(); - } - - Map map = new Map("Sys_MapData", "傻瓜表单属性"); - - map.setCodeStruct("4"); - - - ///基本属性. - - map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20); - - if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.Single) - { - map.AddTBString(MapDataAttr.PTable, null, "存储表", true, false, 0, 100, 20); - } - else - { - map.AddTBString(MapDataAttr.PTable, null, "存储表", true, true, 0, 100, 20); - } - - - map.AddTBString(MapDataAttr.Name, null, "表单名称", true, false, 0, 500, 20, true); - - map.AddDDLSysEnum(MapDataAttr.TableCol, 0, "表单显示列数", true, true, "显示方式", "@0=4列@1=6列@2=上下模式3列"); - - // map.AddTBInt(MapDataAttr.TableWidth, 900, "傻瓜表单宽度", true, false); - // map.AddTBInt(MapDataAttr.TableHeight, 900, "傻瓜表单高度", true, false); - - map.AddTBInt(MapDataAttr.FrmW, 900, "表单宽度", true, false); - map.AddTBInt(MapDataAttr.FrmH, 900, "表单高度", true, false); - - //数据源. - map.AddDDLEntities(MapDataAttr.DBSrc, "local", "数据源", new SFDBSrcs(), true); - - if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.Single) - { - map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), true); - } - else - { - map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), false); - } - - - //表单的运行类型. - map.AddDDLSysEnum(MapDataAttr.FrmType, FrmType.FreeFrm.getValue(), "表单类型", true, false, MapDataAttr.FrmType); - //表单解析 0 普通 1 页签展示 - map.AddDDLSysEnum(MapDataAttr.FrmShowType, 0, "表单展示方式", true, true, "表单展示方式", "@0=普通方式@1=页签方式"); - - - /// 基本属性. - - - ///设计者信息. - map.AddTBString(MapDataAttr.Designer, null, "设计者", true, false, 0, 500, 20); - map.AddTBString(MapDataAttr.DesignerContact, null, "联系方式", true, false, 0, 500, 20); - map.AddTBString(MapDataAttr.DesignerUnit, null, "单位", true, false, 0, 500, 20, true); - map.AddTBString(MapDataAttr.GUID, null, "GUID", true, true, 0, 128, 20, false); - map.AddTBString(MapDataAttr.Ver, null, "版本号", true, true, 0, 30, 20); - // map.AddTBString(MapFrmFreeAttr.DesignerTool, null, "表单设计器", true, true, 0, 30, 20); - - map.AddTBString(MapDataAttr.Note, null, "备注", true, false, 0, 400, 100, true); - //增加参数字段. - map.AddTBAtParas(4000); - map.AddTBInt(MapDataAttr.Idx, 100, "顺序号", false, false); - - /// 设计者信息. - - //查询条件. - map.AddSearchAttr(MapDataAttr.DBSrc); - - - ///方法 - 基本功能. - - RefMethod rm = new RefMethod(); - - - rm = new RefMethod(); - rm.Title = "装载填充"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoPageLoadFull"; - rm.Icon = "../../WF/Img/FullData.png"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "表单事件"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoEvent"; - rm.Icon = "../../WF/Img/Event.png"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - - - rm = new RefMethod(); - rm.Title = "批量修改字段"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoBatchEditAttr"; - rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/field.png"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Target = "_blank"; - // map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "手机端表单"; - rm.Icon = "../../WF/Admin/CCFormDesigner/Img/telephone.png"; - rm.ClassMethodName = this.toString() + ".DoSortingMapAttrs"; - rm.refMethodType = RefMethodType.RightFrameOpen; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "表单body属性"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoBodyAttr"; - rm.Icon = "../../WF/Img/Script.png"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "导出XML表单模版"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoExp"; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Icon = "../../WF/Img/Export.png"; - rm.Visable = true; - rm.RefAttrLinkLabel = "导出到xml"; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - - //带有参数的方法. - rm = new RefMethod(); - rm.Title = "重命名字段"; - rm.getHisAttrs().AddTBString("FieldOld", null, "旧字段英文名", true, false, 0, 100, 100); - rm.getHisAttrs().AddTBString("FieldNew", null, "新字段英文名", true, false, 0, 100, 100); - rm.getHisAttrs().AddTBString("FieldNewName", null, "新字段中文名", true, false, 0, 100, 100); - rm.ClassMethodName = this.toString() + ".DoChangeFieldName"; - rm.Icon = "../../WF/Img/ReName.png"; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "表单检查"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoCheckFixFrmForUpdateVer"; - rm.Visable = true; - rm.RefAttrLinkLabel = "表单检查"; - rm.Icon = "../../WF/Img/Check.png"; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "Tab顺序键"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoTabIdx"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "模板打印"; - rm.ClassMethodName = this.toString() + ".DoBill"; - rm.Icon = "../../WF/Img/FileType/doc.gif"; - rm.refMethodType = RefMethodType.RightFrameOpen; - map.AddRefMethod(rm); - - - rm = new RefMethod(); - rm.Title = "模板打印2019"; - rm.ClassMethodName = this.toString() + ".DoBill2019"; - rm.Icon = "../../WF/Img/FileType/doc.gif"; - rm.refMethodType = RefMethodType.RightFrameOpen; - map.AddRefMethod(rm); - - - - /// 方法 - 基本功能. - - - ///高级功能. - rm = new RefMethod(); - rm.Title = "改变表单类型"; - rm.GroupName = "高级功能"; - rm.ClassMethodName = this.toString() + ".DoChangeFrmType()"; - rm.getHisAttrs().AddDDLSysEnum("FrmType", 0, "修改表单类型", true, true); - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "启动傻瓜表单设计器"; - rm.GroupName = "高级功能"; - rm.ClassMethodName = this.toString() + ".DoDesignerFool"; - rm.Icon = "../../WF/Img/FileType/xlsx.gif"; - rm.Visable = true; - rm.Target = "_blank"; - rm.refMethodType = RefMethodType.LinkeWinOpen; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "JS编程"; // "设计表单"; - rm.GroupName = "高级功能"; - rm.ClassMethodName = this.toString() + ".DoInitScript"; - rm.Icon = "../../WF/Img/Script.png"; - rm.Visable = true; - rm.refMethodType = RefMethodType.RightFrameOpen; - rm.Target = "_blank"; - map.AddRefMethod(rm); - - //平铺模式. - if (bp.wf.Glo.getCCBPMRunModel() != CCBPMRunModel.Single) - { - map.getAttrsOfOneVSM().AddGroupPanelModel(new bp.wf.template.FrmOrgs(), new bp.wf.port.admin2.Orgs(), bp.wf.template.FrmOrgAttr.FrmID, bp.wf.template.FrmOrgAttr.OrgNo, "适用组织"); - } - - /// - - - ///开发接口. - rm = new RefMethod(); - rm.Title = "调用查询API"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoSearch"; - rm.Icon = "../../WF/Img/Table.gif"; - rm.Visable = true; - rm.refMethodType = RefMethodType.LinkeWinOpen; - rm.Target = "_blank"; - rm.GroupName = "开发接口"; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "调用分析API"; // "设计表单"; - rm.ClassMethodName = this.toString() + ".DoGroup"; - rm.Icon = "../../WF/Img/Table.gif"; - rm.Visable = true; - rm.refMethodType = RefMethodType.LinkeWinOpen; - rm.Target = "_blank"; - rm.GroupName = "开发接口"; - map.AddRefMethod(rm); - - /// 方法 - 开发接口. - - - ///实验中的功能 - rm = new RefMethod(); - rm.Title = "批量设置验证规则"; - rm.GroupName = "实验中的功能"; - rm.Icon = "../../WF/Img/RegularExpression.png"; - rm.ClassMethodName = this.toString() + ".DoRegularExpressionBatch"; - rm.refMethodType = RefMethodType.RightFrameOpen; - map.AddRefMethod(rm); - - rm = new RefMethod(); - rm.Title = "一键设置表单元素只读"; - rm.Warning = "您确定要设置吗?所有的元素,包括字段、从表、附件以及其它组件都将会被设置为只读的."; - rm.GroupName = "实验中的功能"; - //rm.Icon = "../../WF/Img/RegularExpression.png"; - rm.ClassMethodName = this.toString() + ".DoOneKeySetReadonly"; - rm.refMethodType = RefMethodType.Func; - map.AddRefMethod(rm); - - - /// 实验中的功能 - - this.set_enMap(map); - return this.get_enMap(); - } - /** - 删除后清缓存 - * @throws Exception - */ - @Override - protected void afterDelete() throws Exception - { - //调用frmEditAction, 完成其他的操作. - bp.sys.CCFormAPI.AfterFrmEditAction(this.getNo()); - super.afterDelete(); - } - - /// - - - ///高级设置. - /** - 一键设置为只读. - - @return - */ - public final String DoOneKeySetReadonly()throws Exception - { - bp.sys.CCFormAPI.OneKeySetFrmEleReadonly(this.getNo()); - return "设置成功."; - } - /** - 改变表单类型 @李国文 ,需要搬到jflow.并测试. - - @param val 要改变的类型 - @return - */ - public final String DoChangeFrmType(int val)throws Exception - { - MapData md = new MapData(this.getNo()); - String str = "原来的是:" + md.getHisFrmTypeText() + "类型,"; - md.setHisFrmTypeInt(val); - str += "现在修改为:" + md.getHisFrmTypeText() + "类型"; - md.Update(); - - return str; - } - - /// 高级设置. - - @Override - protected boolean beforeUpdate() throws Exception - { - //注册事件表单实体. - //bp.sys.FormEventBase feb = bp.sys.Glo.GetFormEventBaseByEnName(this.getNo()); - //if (feb == null) - // this.FromEventEntity = ""; - //else - // this.FromEventEntity = feb.ToString(); - - if (this.getNodeID() != 0) - { - this.setFK_FormTree(""); - } - - return super.beforeUpdate(); - } - @Override - protected void afterUpdate() throws Exception - { - //修改关联明细表 - MapDtl dtl = new MapDtl(); - dtl.setNo(this.getNo()); - if (dtl.RetrieveFromDBSources() == 1) - { - dtl.setName( this.getName()); - dtl.setPTable(this.getPTable()); - dtl.DirectUpdate(); - - MapData map = new MapData(this.getNo()); - //避免显示在表单库中 - map.setFK_FrmSort(""); - map.setFK_FormTree(""); - map.DirectUpdate(); - } - - //调用frmEditAction, 完成其他的操作. - bp.sys.CCFormAPI.AfterFrmEditAction(this.getNo()); - - super.afterUpdate(); - } - - ///节点表单方法. - public final String DoTabIdx() throws Exception - { - return SystemConfig.getCCFlowWebPath() + "WF/Admin/FoolFormDesigner/TabIdx.htm?FK_MapData=" + this.getNo(); - } - /** - 单据打印 - - @return - * @throws Exception - */ - public final String DoBill() throws Exception - { - return "../../Admin/AttrNode/Bill.htm?FK_MapData=" + this.getNo()+ "&NodeID=" + this.getNodeID() + "&FK_Node=" + this.getNodeID(); - } - /** - 单据打印 - - @return - * @throws Exception - */ - public final String DoBill2019() throws Exception - { - return "../../Admin/AttrNode/Bill2019.htm?FK_MapData=" + this.getNo()+ "&FrmID=" + this.getNo()+ "&NodeID=" + this.getNodeID() + "&FK_Node=" + this.getNodeID(); - } - - /** - 傻瓜表单设计器 - - @return - * @throws Exception - */ - public final String DoDesignerFool() throws Exception - { - return "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.getNo()+ "&MyPK=" + this.getNo()+ "&IsFirst=1&IsEditMapData=True"; - } - - /** - 节点表单组件 - - @return - * @throws Exception - */ - public final String DoNodeFrmCompent() throws Exception - { - if (this.getNo().contains("ND") == true) - { - return "../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PK=" + this.getNo().replace("ND", "") + "&t=" + DataType.getCurrentDataTime(); - } - else - { - return "../../Admin/FoolFormDesigner/Do.htm&DoType=FWCShowError"; - } - } - /** - 执行旧版本的兼容性检查. - * @throws Exception - */ - public final String DoCheckFixFrmForUpdateVer() throws Exception - { - // 更新状态. - DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlType='' WHERE CtrlType IS NULL"); - DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); - DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); - - //删除重影数据. - DBAccess.RunSQL("DELETE FROM Sys_GroupField WHERE CtrlType='FWC' and CTRLID is null"); - - //一直遇到遇到自动变长的问题, 强制其修复过来. - DBAccess.RunSQL("UPDATE Sys_Mapattr SET colspan=3 WHERE UIHeight<=38 AND colspan=4"); - - String str = ""; - - //处理失去分组的字段. - String sql = "SELECT MyPK FROM Sys_MapAttr WHERE FK_MapData='" + this.getNo()+ "' AND GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='" + this.getNo()+ "' AND ( CtrlType='' OR CtrlType IS NULL) ) OR GroupID IS NULL "; - DataTable dt = DBAccess.RunSQLReturnTable(sql); - if (dt.Rows.size() != 0) - { - GroupField gf = null; - GroupFields gfs = new GroupFields(this.getNo()); - for (GroupField mygf : gfs.ToJavaList()) - { - if (mygf.getCtrlID().equals("")) - { - gf = mygf; - } - } - - if (gf == null) - { - gf = new GroupField(); - gf.setLab("基本信息"); - gf.setFrmID(this.getNo()); - gf.Insert(); - } - - //设置 GroupID - for (DataRow dr : dt.Rows) - { - DBAccess.RunSQL("UPDATE Sys_MapAttr SET GroupID=" + gf.getOID()+ " WHERE MyPK='" + dr.getValue(0).toString() + "'"); - } - } - - //从表. - MapDtls dtls = new MapDtls(this.getNo()); - for (MapDtl dtl : dtls.ToJavaList()) - { - GroupField gf = new GroupField(); - int i = gf.Retrieve(GroupFieldAttr.CtrlID, dtl.getNo(), GroupFieldAttr.FrmID, this.getNo()); - if (i == 1) - { - continue; - } - - //GroupField gf = new GroupField(); - //if (gf.IsExit(GroupFieldAttr.CtrlID, dtl.getNo()) == true && !DataType.IsNullOrEmpty(gf.CtrlType)) - // continue; - - gf.setLab(dtl.getName()); - gf.setCtrlID(dtl.getNo()); - gf.setCtrlType("Dtl"); - gf.setFrmID(dtl.getFK_MapData()); - gf.Save(); - str += "@为从表" + dtl.getName() + " 增加了分组."; - } - - // 框架. - MapFrames frams = new MapFrames(this.getNo()); - for (MapFrame fram : frams.ToJavaList()) - { - GroupField gf = new GroupField(); - int i = gf.Retrieve(GroupFieldAttr.CtrlID, fram.getMyPK(), GroupFieldAttr.FrmID, this.getNo()); - if (i == 1) - { - continue; - } - - gf.setLab(fram.getName()); - gf.setCtrlID(fram.getMyPK()); - gf.setCtrlType("Frame"); - gf.setEnName(fram.getFK_MapData()); - gf.Insert(); - - str += "@为框架 " + fram.getName() + " 增加了分组."; - } - - // 附件. - FrmAttachments aths = new FrmAttachments(this.getNo()); - for (FrmAttachment ath : aths.ToJavaList()) - { - if (ath.getIsVisable() == false) - { - continue; - } - - GroupField gf = new GroupField(); - int i = gf.Retrieve(GroupFieldAttr.CtrlID, ath.getMyPK(), GroupFieldAttr.FrmID, this.getNo()); - if (i == 1) - { - continue; - } - - gf.setLab(ath.getName()); - gf.setCtrlID(ath.getMyPK()); - gf.setCtrlType("Ath"); - gf.setFrmID(ath.getFK_MapData()); - gf.Insert(); - - str += "@为附件 " + ath.getName() + " 增加了分组."; - } - - if (this.getIsNodeFrm() == true) - { - //提高执行效率. - // FrmNodeComponent conn = new FrmNodeComponent(this.getNo()deID); - // conn.InitGroupField(); - //conn.Update(); - } - - - //删除重复的数据, 比如一个从表显示了多个分组里. 增加此部分. - if (SystemConfig.getAppCenterDBType() == DBType.Oracle) - { - sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) WHERE Num > 1"; - } - else - { - sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) AS A WHERE A.Num > 1"; - } - - dt = DBAccess.RunSQLReturnTable(sql); - for (DataRow dr : dt.Rows) - { - String enName = dr.getValue(0).toString(); - String ctrlID = dr.getValue(1).toString(); - String ctrlType = dr.getValue(2).toString(); - - GroupFields gfs = new GroupFields(); - gfs.Retrieve(GroupFieldAttr.FrmID, enName, GroupFieldAttr.CtrlID, ctrlID, GroupFieldAttr.CtrlType, ctrlType); - - if (gfs.size() <= 1) - { - continue; - } - for (GroupField gf : gfs.ToJavaList()) - { - gf.Delete(); //删除其中的一个. - break; - } - } - - if (str.equals("")) - { - return "检查成功."; - } - - return str + ", @@@ 检查成功。"; - } - - /// - - - ///通用方法. - /** - 替换名称 - - @param fieldOldName 旧名称 - @param newField 新字段 - @param newFieldName 新字段名称(可以为空) - @return - */ - public final String DoChangeFieldName(String fieldOld, String newField, String newFieldName) throws Exception - { - MapAttr attrOld = new MapAttr(); - attrOld.setKeyOfEn(fieldOld); - attrOld.setFK_MapData(this.getNo()); - attrOld.setMyPK(attrOld.getFK_MapData() + "_" + attrOld.getKeyOfEn()); - if (attrOld.RetrieveFromDBSources() == 0) - { - return "@旧字段输入错误[" + attrOld.getKeyOfEn() + "]."; - } - - //检查是否存在该字段? - MapAttr attrNew = new MapAttr(); - attrNew.setKeyOfEn(newField); - attrNew.setFK_MapData(this.getNo()); - attrNew.setMyPK(attrNew.getFK_MapData() + "_" + attrNew.getKeyOfEn()); - if (attrNew.RetrieveFromDBSources() == 1) - { - return "@该字段[" + attrNew.getKeyOfEn() + "]已经存在."; - } - - //删除旧数据. - attrOld.Delete(); - - //copy这个数据,增加上它. - attrNew.Copy(attrOld); - attrNew.setKeyOfEn(newField); - attrNew.setFK_MapData(this.getNo()); - - if (!newFieldName.equals("")) - { - attrNew.setName(newFieldName); - } - - attrNew.Insert(); - - //更新处理他的相关业务逻辑. - MapExts exts = new MapExts(this.getNo()); - for (MapExt item : exts.ToJavaList()) - { - item.setMyPK(item.getMyPK().replace("_" + fieldOld, "_" + newField)); - - if (fieldOld.equals(item.getAttrOfOper())) - { - item.setAttrOfOper(newField); - } - - if (fieldOld.equals(item.getAttrsOfActive())) - { - item.setAttrsOfActive(newField); - } - - item.setTag(item.getTag().replace(fieldOld, newField)); - item.setTag1(item.getTag1().replace(fieldOld, newField)); - item.setTag2(item.getTag2().replace(fieldOld, newField)); - item.setTag3(item.getTag3().replace(fieldOld, newField)); - - item.setAtPara(item.getAtPara().replace(fieldOld, newField)); - item.setDoc(item.getDoc().replace(fieldOld, newField)); - item.Save(); - } - return "执行成功"; - } - /** - 批量设置正则表达式规则. - - @return - * @throws Exception - */ - public final String DoRegularExpressionBatch() throws Exception - { - return "../../Admin/FoolFormDesigner/MapExt/RegularExpressionBatch.htm?FK_Flow=&FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); - } - /** - 批量修改字段 - - @return - */ - public final String DoBatchEditAttr() throws Exception - { - return "../../Admin/FoolFormDesigner/BatchEdit.htm?FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); - } - /** - 排序字段顺序 - - @return - */ - public final String DoSortingMapAttrs() throws Exception - { - return "../../Admin/AttrNode/SortingMapAttrs.htm?FK_Flow=&FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); - } - /** - 设计表单 - - @return - */ - public final String DoDFrom() throws Exception - { - String url = "../../Admin/FoolFormDesigner/CCForm/Frm.htm?FK_MapData=" + this.getNo()+ "&UserNo=" + WebUser.getNo() + "&SID=" + WebUser.getSID() + "&AppCenterDBType=" + DBAccess.getAppCenterDBType() + "&CustomerNo=" + SystemConfig.getCustomerNo(); - return url; - } - /** - 设计傻瓜表单 - - @return - */ - public final String DoDFromCol4() throws Exception - { - String url = "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.getNo()+ "&UserNo=" + WebUser.getNo() + "&SID=" + WebUser.getSID() + "&IsFirst=1&AppCenterDBType=" + DBAccess.getAppCenterDBType() + "&CustomerNo=" + SystemConfig.getCustomerNo(); - return url; - } - /** - 查询 - - @return - */ - public final String DoSearch() throws Exception - { - return "../../Comm/Search.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=" + this.getNo(); - } - /** - 调用分析API - - @return - */ - public final String DoGroup() throws Exception - { - return "../../Comm/Group.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=" + this.getNo(); - } - /** - 数据源管理 - - @return - */ - public final String DoDBSrc() throws Exception - { - return "../../Comm/Search.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=bp.sys.SFDBSrcs"; - } - - public final String DoPageLoadFull() throws Exception - { - return "../../Admin/FoolFormDesigner/MapExt/PageLoadFull.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=PageLoadFull&RefNo="; - } - public final String DoInitScript() throws Exception - { - return "../../Admin/FoolFormDesigner/MapExt/InitScript.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=PageLoadFull&RefNo="; - } - /** - 傻瓜表单属性. - - @return - */ - public final String DoBodyAttr() throws Exception - { - return "../../Admin/FoolFormDesigner/MapExt/BodyAttr.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=BodyAttr&RefNo="; - } - /** - 表单事件 - - @return - */ - public final String DoEvent() throws Exception - { - return "../../Admin/CCFormDesigner/Action.htm?FK_MapData=" + this.getNo()+ "&T=sd&FK_Node=0"; - } - - /** - 导出表单 - - @return - */ - public final String DoExp() throws Exception - { - return "../../Admin/FoolFormDesigner/ImpExp/Exp.htm?FK_MapData=" + this.getNo(); - } - - /// 方法. +package bp.wf.template; + +import bp.da.*; +import bp.difference.SystemConfig; +import bp.en.*; +import bp.en.Map; +import bp.sys.*; +import bp.web.WebUser; + +/** + 傻瓜表单属性 +*/ +public class MapFrmFool extends EntityNoName +{ + private static final long serialVersionUID = 1L; + + ///属性 + /** + 是否是节点表单? + * @throws Exception + */ + public final boolean getIsNodeFrm() throws Exception + { + if (this.getNo().contains("ND") == false) + { + return false; + } + + if (this.getNo().contains("Rpt") == true) + { + return false; + } + + if (this.getNo().substring(0, 2).equals("ND") && this.getNo().contains("Dtl") == false) + { + return true; + } + + return false; + } + /** + 物理存储表 + * @throws Exception + */ + public final String getPTable() throws Exception + { + return this.GetValStrByKey(MapDataAttr.PTable); + } + public final void setPTable(String value) throws Exception + { + this.SetValByKey(MapDataAttr.PTable, value); + } + /** + 节点ID. + */ + public final int getNodeID() throws Exception + { + if (this.getNo().indexOf("ND") != 0) + { + return 0; + } + return Integer.parseInt(this.getNo().replace("ND", "")); + } + + /** + 表格显示的列 + */ + public final int getTableCol() + { + return 4; + /*int i = this.GetValIntByKey(MapDataAttr.TableCol); + if (i == 0 || i == 1) + { + return 4; + } + return i;*/ + } + public final void setTableCol(int value) throws Exception + { + this.SetValByKey(MapDataAttr.TableCol, value); + } + + public final String getFK_FormTree() throws Exception + { + return this.GetValStringByKey(MapDataAttr.FK_FormTree); + } + public final void setFK_FormTree(String value) throws Exception + { + this.SetValByKey(MapDataAttr.FK_FormTree, value); + } + + + /// + + + ///权限控制. + @Override + public UAC getHisUAC() throws Exception + { + UAC uac = new UAC(); + //uac.OpenForSysAdmin(); + uac.OpenForAdmin(); //2020.5.15修改. + uac.IsInsert = false; + return uac; + } + + /// 权限控制. + + + ///构造方法 + /** + 傻瓜表单属性 + */ + public MapFrmFool() + { + } + /** + 傻瓜表单属性 + + @param no 表单ID + */ + public MapFrmFool(String no) throws Exception + { + super(no); + } + /** + EnMap + */ + @Override + public Map getEnMap() throws Exception + { + if (this.get_enMap() != null) + { + return this.get_enMap(); + } + + Map map = new Map("Sys_MapData", "傻瓜表单属性"); + + map.setCodeStruct("4"); + + + ///基本属性. + + map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20); + + if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.Single) + { + map.AddTBString(MapDataAttr.PTable, null, "存储表", true, false, 0, 100, 20); + } + else + { + map.AddTBString(MapDataAttr.PTable, null, "存储表", true, true, 0, 100, 20); + } + + + map.AddTBString(MapDataAttr.Name, null, "表单名称", true, false, 0, 500, 20, true); + + map.AddDDLSysEnum(MapDataAttr.TableCol, 0, "表单显示列数", true, true, "显示方式", "@0=4列@1=6列@2=上下模式3列"); + + // map.AddTBInt(MapDataAttr.TableWidth, 900, "傻瓜表单宽度", true, false); + // map.AddTBInt(MapDataAttr.TableHeight, 900, "傻瓜表单高度", true, false); + + map.AddTBInt(MapDataAttr.FrmW, 900, "表单宽度", true, false); + map.AddTBInt(MapDataAttr.FrmH, 900, "表单高度", true, false); + + //数据源. + map.AddDDLEntities(MapDataAttr.DBSrc, "local", "数据源", new SFDBSrcs(), true); + + if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.Single) + { + map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), true); + } + else + { + map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), false); + } + + + //表单的运行类型. + map.AddDDLSysEnum(MapDataAttr.FrmType, FrmType.FreeFrm.getValue(), "表单类型", true, false, MapDataAttr.FrmType); + //表单解析 0 普通 1 页签展示 + map.AddDDLSysEnum(MapDataAttr.FrmShowType, 0, "表单展示方式", true, true, "表单展示方式", "@0=普通方式@1=页签方式"); + + + /// 基本属性. + + + ///设计者信息. + map.AddTBString(MapDataAttr.Designer, null, "设计者", true, false, 0, 500, 20); + map.AddTBString(MapDataAttr.DesignerContact, null, "联系方式", true, false, 0, 500, 20); + map.AddTBString(MapDataAttr.DesignerUnit, null, "单位", true, false, 0, 500, 20, true); + map.AddTBString(MapDataAttr.GUID, null, "GUID", true, true, 0, 128, 20, false); + map.AddTBString(MapDataAttr.Ver, null, "版本号", true, true, 0, 30, 20); + // map.AddTBString(MapFrmFreeAttr.DesignerTool, null, "表单设计器", true, true, 0, 30, 20); + + map.AddTBString(MapDataAttr.Note, null, "备注", true, false, 0, 400, 100, true); + //增加参数字段. + map.AddTBAtParas(4000); + map.AddTBInt(MapDataAttr.Idx, 100, "顺序号", false, false); + + /// 设计者信息. + + //查询条件. + map.AddSearchAttr(MapDataAttr.DBSrc); + + + ///方法 - 基本功能. + + RefMethod rm = new RefMethod(); + + + rm = new RefMethod(); + rm.Title = "装载填充"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoPageLoadFull"; + rm.Icon = "../../WF/Img/FullData.png"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "表单事件"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoEvent"; + rm.Icon = "../../WF/Img/Event.png"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + + + rm = new RefMethod(); + rm.Title = "批量修改字段"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoBatchEditAttr"; + rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/field.png"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Target = "_blank"; + // map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "手机端表单"; + rm.Icon = "../../WF/Admin/CCFormDesigner/Img/telephone.png"; + rm.ClassMethodName = this.toString() + ".DoSortingMapAttrs"; + rm.refMethodType = RefMethodType.RightFrameOpen; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "表单body属性"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoBodyAttr"; + rm.Icon = "../../WF/Img/Script.png"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "导出XML表单模版"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoExp"; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Icon = "../../WF/Img/Export.png"; + rm.Visable = true; + rm.RefAttrLinkLabel = "导出到xml"; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + + //带有参数的方法. + rm = new RefMethod(); + rm.Title = "重命名字段"; + rm.getHisAttrs().AddTBString("FieldOld", null, "旧字段英文名", true, false, 0, 100, 100); + rm.getHisAttrs().AddTBString("FieldNew", null, "新字段英文名", true, false, 0, 100, 100); + rm.getHisAttrs().AddTBString("FieldNewName", null, "新字段中文名", true, false, 0, 100, 100); + rm.ClassMethodName = this.toString() + ".DoChangeFieldName"; + rm.Icon = "../../WF/Img/ReName.png"; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "表单检查"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoCheckFixFrmForUpdateVer"; + rm.Visable = true; + rm.RefAttrLinkLabel = "表单检查"; + //rm.Icon = "../../WF/Img/Check.png"; + rm.Icon = "../../WF/Img/Btn/Check.png"; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "Tab顺序键"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoTabIdx"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "模板打印"; + rm.ClassMethodName = this.toString() + ".DoBill"; + rm.Icon = "../../WF/Img/FileType/doc.gif"; + rm.refMethodType = RefMethodType.RightFrameOpen; + map.AddRefMethod(rm); + + + rm = new RefMethod(); + rm.Title = "模板打印2019"; + rm.ClassMethodName = this.toString() + ".DoBill2019"; + rm.Icon = "../../WF/Img/FileType/doc.gif"; + rm.refMethodType = RefMethodType.RightFrameOpen; + map.AddRefMethod(rm); + + + + /// 方法 - 基本功能. + + + ///高级功能. + rm = new RefMethod(); + rm.Title = "改变表单类型"; + rm.GroupName = "高级功能"; + rm.ClassMethodName = this.toString() + ".DoChangeFrmType()"; + rm.getHisAttrs().AddDDLSysEnum("FrmType", 0, "修改表单类型", true, true); + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "启动傻瓜表单设计器"; + rm.GroupName = "高级功能"; + rm.ClassMethodName = this.toString() + ".DoDesignerFool"; + rm.Icon = "../../WF/Img/FileType/xlsx.gif"; + rm.Visable = true; + rm.Target = "_blank"; + rm.refMethodType = RefMethodType.LinkeWinOpen; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "JS编程"; // "设计表单"; + rm.GroupName = "高级功能"; + rm.ClassMethodName = this.toString() + ".DoInitScript"; + rm.Icon = "../../WF/Img/Script.png"; + rm.Visable = true; + rm.refMethodType = RefMethodType.RightFrameOpen; + rm.Target = "_blank"; + map.AddRefMethod(rm); + + //平铺模式. + if (bp.wf.Glo.getCCBPMRunModel() != CCBPMRunModel.Single) + { + map.getAttrsOfOneVSM().AddGroupPanelModel(new bp.wf.template.FrmOrgs(), new bp.wf.port.admin2.Orgs(), bp.wf.template.FrmOrgAttr.FrmID, bp.wf.template.FrmOrgAttr.OrgNo, "适用组织"); + } + + /// + + + ///开发接口. + rm = new RefMethod(); + rm.Title = "调用查询API"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoSearch"; + rm.Icon = "../../WF/Img/Table.gif"; + rm.Visable = true; + rm.refMethodType = RefMethodType.LinkeWinOpen; + rm.Target = "_blank"; + rm.GroupName = "开发接口"; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "调用分析API"; // "设计表单"; + rm.ClassMethodName = this.toString() + ".DoGroup"; + rm.Icon = "../../WF/Img/Table.gif"; + rm.Visable = true; + rm.refMethodType = RefMethodType.LinkeWinOpen; + rm.Target = "_blank"; + rm.GroupName = "开发接口"; + map.AddRefMethod(rm); + + /// 方法 - 开发接口. + + + ///实验中的功能 + rm = new RefMethod(); + rm.Title = "批量设置验证规则"; + rm.GroupName = "实验中的功能"; + rm.Icon = "../../WF/Img/RegularExpression.png"; + rm.ClassMethodName = this.toString() + ".DoRegularExpressionBatch"; + rm.refMethodType = RefMethodType.RightFrameOpen; + map.AddRefMethod(rm); + + rm = new RefMethod(); + rm.Title = "一键设置表单元素只读"; + rm.Warning = "您确定要设置吗?所有的元素,包括字段、从表、附件以及其它组件都将会被设置为只读的."; + rm.GroupName = "实验中的功能"; + //rm.Icon = "../../WF/Img/RegularExpression.png"; + rm.ClassMethodName = this.toString() + ".DoOneKeySetReadonly"; + rm.refMethodType = RefMethodType.Func; + map.AddRefMethod(rm); + + + /// 实验中的功能 + + this.set_enMap(map); + return this.get_enMap(); + } + /** + 删除后清缓存 + * @throws Exception + */ + @Override + protected void afterDelete() throws Exception + { + //调用frmEditAction, 完成其他的操作. + bp.sys.CCFormAPI.AfterFrmEditAction(this.getNo()); + super.afterDelete(); + } + + /// + + + ///高级设置. + /** + 一键设置为只读. + + @return + */ + public final String DoOneKeySetReadonly()throws Exception + { + bp.sys.CCFormAPI.OneKeySetFrmEleReadonly(this.getNo()); + return "设置成功."; + } + /** + 改变表单类型 @李国文 ,需要搬到jflow.并测试. + + @param val 要改变的类型 + @return + */ + public final String DoChangeFrmType(int val)throws Exception + { + MapData md = new MapData(this.getNo()); + String str = "原来的是:" + md.getHisFrmTypeText() + "类型,"; + md.setHisFrmTypeInt(val); + str += "现在修改为:" + md.getHisFrmTypeText() + "类型"; + md.Update(); + + return str; + } + + /// 高级设置. + + @Override + protected boolean beforeUpdate() throws Exception + { + //注册事件表单实体. + //bp.sys.FormEventBase feb = bp.sys.Glo.GetFormEventBaseByEnName(this.getNo()); + //if (feb == null) + // this.FromEventEntity = ""; + //else + // this.FromEventEntity = feb.ToString(); + + if (this.getNodeID() != 0) + { + this.setFK_FormTree(""); + } + + return super.beforeUpdate(); + } + @Override + protected void afterUpdate() throws Exception + { + //修改关联明细表 + MapDtl dtl = new MapDtl(); + dtl.setNo(this.getNo()); + if (dtl.RetrieveFromDBSources() == 1) + { + dtl.setName( this.getName()); + dtl.setPTable(this.getPTable()); + dtl.DirectUpdate(); + + MapData map = new MapData(this.getNo()); + //避免显示在表单库中 + map.setFK_FrmSort(""); + map.setFK_FormTree(""); + map.DirectUpdate(); + } + + //调用frmEditAction, 完成其他的操作. + bp.sys.CCFormAPI.AfterFrmEditAction(this.getNo()); + + super.afterUpdate(); + } + + ///节点表单方法. + public final String DoTabIdx() throws Exception + { + return SystemConfig.getCCFlowWebPath() + "WF/Admin/FoolFormDesigner/TabIdx.htm?FK_MapData=" + this.getNo(); + } + /** + 单据打印 + + @return + * @throws Exception + */ + public final String DoBill() throws Exception + { + return "../../Admin/AttrNode/Bill.htm?FK_MapData=" + this.getNo()+ "&NodeID=" + this.getNodeID() + "&FK_Node=" + this.getNodeID(); + } + /** + 单据打印 + + @return + * @throws Exception + */ + public final String DoBill2019() throws Exception + { + return "../../Admin/AttrNode/Bill2019.htm?FK_MapData=" + this.getNo()+ "&FrmID=" + this.getNo()+ "&NodeID=" + this.getNodeID() + "&FK_Node=" + this.getNodeID(); + } + + /** + 傻瓜表单设计器 + + @return + * @throws Exception + */ + public final String DoDesignerFool() throws Exception + { + return "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.getNo()+ "&MyPK=" + this.getNo()+ "&IsFirst=1&IsEditMapData=True"; + } + + /** + 节点表单组件 + + @return + * @throws Exception + */ + public final String DoNodeFrmCompent() throws Exception + { + if (this.getNo().contains("ND") == true) + { + return "../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PK=" + this.getNo().replace("ND", "") + "&t=" + DataType.getCurrentDataTime(); + } + else + { + return "../../Admin/FoolFormDesigner/Do.htm&DoType=FWCShowError"; + } + } + /** + 执行旧版本的兼容性检查. + * @throws Exception + */ + public final String DoCheckFixFrmForUpdateVer() throws Exception + { + // 更新状态. + DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlType='' WHERE CtrlType IS NULL"); + DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); + DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); + + //删除重影数据. + DBAccess.RunSQL("DELETE FROM Sys_GroupField WHERE CtrlType='FWC' and CTRLID is null"); + + //一直遇到遇到自动变长的问题, 强制其修复过来. + DBAccess.RunSQL("UPDATE Sys_Mapattr SET colspan=3 WHERE UIHeight<=38 AND colspan=4"); + + String str = ""; + + //处理失去分组的字段. + String sql = "SELECT MyPK FROM Sys_MapAttr WHERE FK_MapData='" + this.getNo()+ "' AND GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='" + this.getNo()+ "' AND ( CtrlType='' OR CtrlType IS NULL) ) OR GroupID IS NULL "; + DataTable dt = DBAccess.RunSQLReturnTable(sql); + if (dt.Rows.size() != 0) + { + GroupField gf = null; + GroupFields gfs = new GroupFields(this.getNo()); + for (GroupField mygf : gfs.ToJavaList()) + { + if (mygf.getCtrlID().equals("")) + { + gf = mygf; + } + } + + if (gf == null) + { + gf = new GroupField(); + gf.setLab("基本信息"); + gf.setFrmID(this.getNo()); + gf.Insert(); + } + + //设置 GroupID + for (DataRow dr : dt.Rows) + { + DBAccess.RunSQL("UPDATE Sys_MapAttr SET GroupID=" + gf.getOID()+ " WHERE MyPK='" + dr.getValue(0).toString() + "'"); + } + } + + //从表. + MapDtls dtls = new MapDtls(this.getNo()); + for (MapDtl dtl : dtls.ToJavaList()) + { + GroupField gf = new GroupField(); + int i = gf.Retrieve(GroupFieldAttr.CtrlID, dtl.getNo(), GroupFieldAttr.FrmID, this.getNo()); + if (i == 1) + { + continue; + } + + //GroupField gf = new GroupField(); + //if (gf.IsExit(GroupFieldAttr.CtrlID, dtl.getNo()) == true && !DataType.IsNullOrEmpty(gf.CtrlType)) + // continue; + + gf.setLab(dtl.getName()); + gf.setCtrlID(dtl.getNo()); + gf.setCtrlType("Dtl"); + gf.setFrmID(dtl.getFK_MapData()); + gf.Save(); + str += "@为从表" + dtl.getName() + " 增加了分组."; + } + + // 框架. + MapFrames frams = new MapFrames(this.getNo()); + for (MapFrame fram : frams.ToJavaList()) + { + GroupField gf = new GroupField(); + int i = gf.Retrieve(GroupFieldAttr.CtrlID, fram.getMyPK(), GroupFieldAttr.FrmID, this.getNo()); + if (i == 1) + { + continue; + } + + gf.setLab(fram.getName()); + gf.setCtrlID(fram.getMyPK()); + gf.setCtrlType("Frame"); + gf.setEnName(fram.getFK_MapData()); + gf.Insert(); + + str += "@为框架 " + fram.getName() + " 增加了分组."; + } + + // 附件. + FrmAttachments aths = new FrmAttachments(this.getNo()); + for (FrmAttachment ath : aths.ToJavaList()) + { + if (ath.getIsVisable() == false) + { + continue; + } + + GroupField gf = new GroupField(); + int i = gf.Retrieve(GroupFieldAttr.CtrlID, ath.getMyPK(), GroupFieldAttr.FrmID, this.getNo()); + if (i == 1) + { + continue; + } + + gf.setLab(ath.getName()); + gf.setCtrlID(ath.getMyPK()); + gf.setCtrlType("Ath"); + gf.setFrmID(ath.getFK_MapData()); + gf.Insert(); + + str += "@为附件 " + ath.getName() + " 增加了分组."; + } + + if (this.getIsNodeFrm() == true) + { + //提高执行效率. + // FrmNodeComponent conn = new FrmNodeComponent(this.getNo()deID); + // conn.InitGroupField(); + //conn.Update(); + } + + + //删除重复的数据, 比如一个从表显示了多个分组里. 增加此部分. + if (SystemConfig.getAppCenterDBType() == DBType.Oracle) + { + sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) WHERE Num > 1"; + } + else + { + sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) AS A WHERE A.Num > 1"; + } + + dt = DBAccess.RunSQLReturnTable(sql); + for (DataRow dr : dt.Rows) + { + String enName = dr.getValue(0).toString(); + String ctrlID = dr.getValue(1).toString(); + String ctrlType = dr.getValue(2).toString(); + + GroupFields gfs = new GroupFields(); + gfs.Retrieve(GroupFieldAttr.FrmID, enName, GroupFieldAttr.CtrlID, ctrlID, GroupFieldAttr.CtrlType, ctrlType); + + if (gfs.size() <= 1) + { + continue; + } + for (GroupField gf : gfs.ToJavaList()) + { + gf.Delete(); //删除其中的一个. + break; + } + } + + if (str.equals("")) + { + return "检查成功."; + } + + return str + ", @@@ 检查成功。"; + } + + /// + + + ///通用方法. + /** + 替换名称 + + @param fieldOldName 旧名称 + @param newField 新字段 + @param newFieldName 新字段名称(可以为空) + @return + */ + public final String DoChangeFieldName(String fieldOld, String newField, String newFieldName) throws Exception + { + MapAttr attrOld = new MapAttr(); + attrOld.setKeyOfEn(fieldOld); + attrOld.setFK_MapData(this.getNo()); + attrOld.setMyPK(attrOld.getFK_MapData() + "_" + attrOld.getKeyOfEn()); + if (attrOld.RetrieveFromDBSources() == 0) + { + return "@旧字段输入错误[" + attrOld.getKeyOfEn() + "]."; + } + + //检查是否存在该字段? + MapAttr attrNew = new MapAttr(); + attrNew.setKeyOfEn(newField); + attrNew.setFK_MapData(this.getNo()); + attrNew.setMyPK(attrNew.getFK_MapData() + "_" + attrNew.getKeyOfEn()); + if (attrNew.RetrieveFromDBSources() == 1) + { + return "@该字段[" + attrNew.getKeyOfEn() + "]已经存在."; + } + + //删除旧数据. + attrOld.Delete(); + + //copy这个数据,增加上它. + attrNew.Copy(attrOld); + attrNew.setKeyOfEn(newField); + attrNew.setFK_MapData(this.getNo()); + + if (!newFieldName.equals("")) + { + attrNew.setName(newFieldName); + } + + attrNew.Insert(); + + //更新处理他的相关业务逻辑. + MapExts exts = new MapExts(this.getNo()); + for (MapExt item : exts.ToJavaList()) + { + item.setMyPK(item.getMyPK().replace("_" + fieldOld, "_" + newField)); + + if (fieldOld.equals(item.getAttrOfOper())) + { + item.setAttrOfOper(newField); + } + + if (fieldOld.equals(item.getAttrsOfActive())) + { + item.setAttrsOfActive(newField); + } + + item.setTag(item.getTag().replace(fieldOld, newField)); + item.setTag1(item.getTag1().replace(fieldOld, newField)); + item.setTag2(item.getTag2().replace(fieldOld, newField)); + item.setTag3(item.getTag3().replace(fieldOld, newField)); + + item.setAtPara(item.getAtPara().replace(fieldOld, newField)); + item.setDoc(item.getDoc().replace(fieldOld, newField)); + item.Save(); + } + return "执行成功"; + } + /** + 批量设置正则表达式规则. + + @return + * @throws Exception + */ + public final String DoRegularExpressionBatch() throws Exception + { + return "../../Admin/FoolFormDesigner/MapExt/RegularExpressionBatch.htm?FK_Flow=&FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); + } + /** + 批量修改字段 + + @return + */ + public final String DoBatchEditAttr() throws Exception + { + return "../../Admin/FoolFormDesigner/BatchEdit.htm?FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); + } + /** + 排序字段顺序 + + @return + */ + public final String DoSortingMapAttrs() throws Exception + { + return "../../Admin/AttrNode/SortingMapAttrs.htm?FK_Flow=&FK_MapData=" + this.getNo()+ "&t=" + DataType.getCurrentDataTime(); + } + /** + 设计表单 + + @return + */ + public final String DoDFrom() throws Exception + { + String url = "../../Admin/FoolFormDesigner/CCForm/Frm.htm?FK_MapData=" + this.getNo()+ "&UserNo=" + WebUser.getNo() + "&SID=" + WebUser.getSID() + "&AppCenterDBType=" + DBAccess.getAppCenterDBType() + "&CustomerNo=" + SystemConfig.getCustomerNo(); + return url; + } + /** + 设计傻瓜表单 + + @return + */ + public final String DoDFromCol4() throws Exception + { + String url = "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.getNo()+ "&UserNo=" + WebUser.getNo() + "&SID=" + WebUser.getSID() + "&IsFirst=1&AppCenterDBType=" + DBAccess.getAppCenterDBType() + "&CustomerNo=" + SystemConfig.getCustomerNo(); + return url; + } + /** + 查询 + + @return + */ + public final String DoSearch() throws Exception + { + return "../../Comm/Search.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=" + this.getNo(); + } + /** + 调用分析API + + @return + */ + public final String DoGroup() throws Exception + { + return "../../Comm/Group.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=" + this.getNo(); + } + /** + 数据源管理 + + @return + */ + public final String DoDBSrc() throws Exception + { + return "../../Comm/Search.htm?s=34&FK_MapData=" + this.getNo()+ "&EnsName=bp.sys.SFDBSrcs"; + } + + public final String DoPageLoadFull() throws Exception + { + return "../../Admin/FoolFormDesigner/MapExt/PageLoadFull.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=PageLoadFull&RefNo="; + } + public final String DoInitScript() throws Exception + { + return "../../Admin/FoolFormDesigner/MapExt/InitScript.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=PageLoadFull&RefNo="; + } + /** + 傻瓜表单属性. + + @return + */ + public final String DoBodyAttr() throws Exception + { + return "../../Admin/FoolFormDesigner/MapExt/BodyAttr.htm?s=34&FK_MapData=" + this.getNo()+ "&ExtType=BodyAttr&RefNo="; + } + /** + 表单事件 + + @return + */ + public final String DoEvent() throws Exception + { + return "../../Admin/CCFormDesigner/Action.htm?FK_MapData=" + this.getNo()+ "&T=sd&FK_Node=0"; + } + + /** + 导出表单 + + @return + */ + public final String DoExp() throws Exception + { + return "../../Admin/FoolFormDesigner/ImpExp/Exp.htm?FK_MapData=" + this.getNo(); + } + + /// 方法. } \ No newline at end of file -- Gitee