1. Data query
var dql1 = "select * from tlk_aa where istmp=0 "; var datas1 = queryBySQL(dql1); // if(datas1!=null && datas1.size()>0){ for(var iter1 = datas1.iterator();iter1.hasNext();){ var doc1 = iter1.next(); } }
2. Option script
var opts=createOptions(); opts.add("",""); var dql1 = "select * from tlk_aa where istmp=0 "; var datas1 = queryBySQLNoPage(dql1); // if(datas1!=null && datas1.size()>0){ for(var iter1 = datas1.iterator();iter1.hasNext();){ var doc1 = iter1.next(); opts.add(doc1.getItemValueAsString("AA") , doc1.getId()) } } opts
3. Department
//Default Department Id of current person getWebUser().getDefaultDepartment(); //Obtain the Department name according to the Department id var process = createProcess("cn.myapps.core.department.ejb.DepartmentProcess");//Department business processing class var dept=process.doView(id);//ID is the Department ID, and the Department object is obtained var name=dept.getName();//Get department name
4. Get current person
var rtn = getItemValueAsString("applicant"); if(!isNotNull(rtn)){ rtn = getWebUser().getName(); } rtn;
5. Get current date
var retvar =getItemValueAsDate("Fd_Time"); if(retvar==null) { retvar = getToday(); } format(retvar,"yyyy-MM-dd");
6. CC role and designated person
#include "SystemRole" var sp1 = getNewRoleIdByName2("Board of directors"); var sp2 = getCurrentDocument().getAuthor().getId(); //applicant var allspr = sp1+";"+sp2 var arr = splitText(allspr,";"); var userlist = createObject("java.util.ArrayList"); for (var i=0;i<arr.length;i++){ if(arr[i] != null && arr[i].trim().length() > 0){ userlist.add(getUserById(arr[i])); } } userlist;
7. Create form
//Create a form with a process var curdoc = getCurrentDocument(); var LXID = getItemValueAsString("LXID"); var bdid = curdoc.getId(); var Fd_ProjName = getDocItemValueAsString(LXID,"Fd_ProjName"); var process = getDocumentProcess(); var formProcess = new Packages.cn.myapps.core.dynaform.form.ejb.FormProcessBean(); var flowid="11e9-f3cf-60c2ce60-b04c-6f92c4c166e6"; var form = formProcess.doViewByFormName("FMPM_DesiTaskCardBySign",getApplication()); var xmjl = curdoc.getItemValueAsString("Fd_RWXDR"); var user = getUserById(xmjl); var tuser = new Packages.cn.myapps.core.user.action.WebUser(user); var doc = process.doNew(form,tuser,new Packages.cn.myapps.base.action.ParamsTable()); doc.setFlowid(flowid); var params =new Packages.cn.myapps.base.action.ParamsTable(); doc.addStringItem("pid",LXID); doc.addStringItem("Fd_ReQueMan",xmjl); doc.addStringItem("Fd_ProjName",Fd_ProjName); doc.addStringItem("QRDId",bdid); params.setParameter("_flowid",flowid); getDocumentProcess().doStartFlowOrUpdate(doc,params,tuser); //Create a normal form var user = getUserById(xmjl); var tuser = new Packages.cn.myapps.core.user.action.WebUser(user); var processfunc = getDocumentProcess(); var formProcessfunc = new Packages.cn.myapps.core.dynaform.form.ejb.FormProcessBean(); var arr = splitText(names, ","); for (var i=0;i<arr.length;i++){ if(!arr[i].equals("")){ var form2 = formProcessfunc.doViewByFormName("Fm_ScoringEdit",getApplication()); var doc2 = processfunc.doNew(form2,tuser,new Packages.cn.myapps.base.action.ParamsTable()); doc2.addStringItem("GLID",pid); doc2.addStringItem("XMID",xmid); doc2.addDateItem("Fd_Stime",getToday()); doc2.addDateItem("Fd_PlanEtime",etime); doc2.addStringItem("Fd_FormName",formnames); doc2.addStringItem("Fd_flowNames",flownames); doc2.addStringItem("Fd_Name",arr[i]); doc2.setParent(pid); processfunc.doCreate(doc2); } }
8. Form link
//Pop up a new form connection: getParamsTable().getContextPath()+"/portal/dynaform/document/new.action?_formid=11e8-bd41-118a72d5-82e3-b9c966406ea7&_isJump=1" //Pop up old form link: var url = getContextPath()+"/portal/dynaform/document/view.action?"; url += "_docid="+getCurrentDocument().getId()+"&_formid="+getCurrentDocument().getFormid(); url += "&application="+getApplication(); //Pop up template form link: url += getContextPath()+"/portal/dynaform/document/view.action?"; url += "_docid="+getCurrentDocument().getId()+"&_formid="+getCurrentDocument().getFormid(); url += "&application="+getApplication()+"&_templateForm="+mudeID+"&isRelate=false";
9. Use of Java functions
var util = new Packages.cn.myapps.core.dynaform.custom.action.HuahanDataHelper; util.updateProjectSpaceName("11e9-f3a4-98eebed7-b237-9b24b2212da4");
10. System function
//Whether the pop-up dialog box is executed is the same as js confirm createConfirm("Submit?")
11,JavaScript
//Open layer method function OpenDiaDialog(url){ var opener = window.top;//From which page to open the pop-up box, for example: windowthis page / window Parent parent page / top top page opener.JHKJ.dialog.show({ refreshOpener: false,//Refresh the open page of the pop-up box refreshTrigger:false,//Refresh the page that triggered the pop-up box trigger: window,//Pass in this page that triggers the pop-up box. The default value is the page that opens the pop-up box when there is no value maximized: false,//Allow pop-up box to be maximized. If it is not filled in by default, it is allowed to be maximized width: '1500',//Pop up width height: '800',//Pop up box height, cannot be percentage url: url,//Address of pop-up box args: {},//Pass in the parameters of the pop-up box. The form here is defined by itself. It can be array / object / string title: '',//Title of pop-up box close: function(rtVal) {//Callback function of pop-up box, return value dy_refresh("") } }); } //Normal open function openForms(url,backurl,target){ if(backurl==""){ backurl = window.location.href; }if(target==""){ target = "_self"; } if(url.indexOf("&")!=-1){ window.open(url+"&_backURL="+encodeURIComponent(backurl),target) }else{ window.open(url+"?_backURL="+encodeURIComponent(backurl),target) } }
12. Intercept string
AA.substr(0,0)
13. Use of HashMap
var map = createObject("java.util.HashMap"); map.put("apple", "Fresh apple"); //Add objects to the collection map.put("computer", "Well configured computer"); map.put("book", "A mountain of books"); var key = "book"; map.containsKey(key);//Does the map contain a key for(var iter2 = map.entrySet().iterator();iter2.hasNext();){ var maps = iter2.next(); var keyI = maps.getKey(); //key [employee No.] } map.size(); //quantity
14. Use of json
//json example var content = '[{"type":"Project Leader","full name":"Zhang San", "proportion":"50"},{"type":"Project Leader","full name":"Li Si", "proportion":"20"}]' var json1 = createObject("net.sf.json.JSONArray"); //net.sf.json.JSONObject = = = = net.sf.json.JSONArray var jsonArray = json1.fromObject(content); for(var i = 0 ; i < jsonArray.size() ; i++){ var jsonObject = jsonArray.getJSONObject(i); //println("ah ah ah:" + jsonObject.get("name")) }
15. View selection box defect handling
var rtn = getItemValueAsString("Fd_Mark"); rtn = replaceString(rtn,"\r",""); //The line break should be removed from the view selection box, otherwise it cannot be selected rtn = replaceString(rtn,"\n",""); //The line break should be removed from the view selection box, otherwise it cannot be selected rtn
16. Database operation
//Set password to a update t_user set loginpwd = '0ceb614c418d06e3b9b1ee4c2fc43685' //Delete a when there are multiple approval phases SELECT * FROM t_flow_intervention WHERE docid="11e9-5ab1-b2a9947f-b41b-fd2e1f293e2e" #Process status SELECT * FROM t_flowstatert WHERE docid="11e8-0700-ed8c9dce-bad4-558174c9ae7c" #Process node information table SELECT * FROM t_nodert WHERE docid="11e9-5ab1-b2a9947f-b41b-fd2e1f293e2e" #Form information table SELECT id,statelabel FROM tlk_xxx WHERE id="11e9-5ab1-b2a9947f-b41b-fd2e1f293e2e" #Document information table SELECT id,statelabel FROM t_document WHERE id="11e9-5ab1-b2a9947f-b41b-fd2e1f293e2e" //Database operation: set process management [suspend] UPDATE t_nodert SET ISSUSPEND = 1 WHERE docid='11e9-5a76-45242c17-b41b-fd2e1f293e2e' //Delete redundant data var sql = " DELETE FROM tlk_Fm_AttendaceResult WHERE "; sql += " id NOT IN ( "; sql += " SELECT dt.maxID FROM( SELECT MAX(id) AS maxID FROM tlk_Fm_AttendaceResult GROUP BY item_recdate , item_Fd_UserName) dt "; sql += " ) "; deleteByDSName("huahangl",sql)
17. Process
//Table structure of process design t_flowstatert The current status of the document is stored through the process table docid And t_document Table Association t_t_nodert It stores the node information in the document process state flowstatert_id And t_flowstatert relation t_actorrt It stores the processor information of a node where the document process status is located nodert_id And t_t_nodert relation
18. Bottom
HttpSession session = request.getSession(); //Get application String appid = (String) session.getAttribute(Web.SESSION_ATTRIBUTE_APPLICATIONID); //Get current login WebUser webUser = (WebUser) session.getAttribute(Web.SESSION_ATTRIBUTE_FRONT_USER);
19. Repair process BUG with iscript
//iscript repair [no approver temporarily], and then adjust the approval phase in process management. var OneSequence2 = createObject("cn.myapps.util.sequence.Sequence"); var thisId = OneSequence2.getSequence(); var flowName = "Design Institute/core"; var noderId = "1515059436718"; var flowId = "11e9-f0a9-061e780a-a3b8-c7065e657909"; var docId = "11ec-7e4b-f5d3fb96-b469-e326b91ec60d" var FLOWSTATERT_ID = "11ec-7e4b-f6217f10-b469-e326b91ec60d"; //Find the corresponding t_ id of flowstatert var domainId = "11e6-b837-4a81a076-8be2-bb4bf4ae2c4b"; var applicationId = getApplication(); var parentNoderId = "1515057330427"; var DEADLINE = format(getToday() , "yyyy-MM-dd HH:mm:ss"); var sql22 = " insert into t_nodert (ID,NAME,NODEID,FLOWID,DOCID,FLOWSTATERT_ID,SORTID,NOTIFIABLE,DOMAINID,APPLICATIONID,STATELABEL,FLOWOPTION,SPLITTOKEN,PASSCONDITION,PARENTNODERTID,DEADLINE,ORDERLY,APPROVAL_POSITION,STATE,LASTPROCESSTIME,REMINDER_TIMES,ISSUSPEND,RETRACEMENT) values ('"+thisId+"','"+flowName+"','"+noderId+"','"+flowId+"','"+docId+"','"+FLOWSTATERT_ID+"',null,'','"+domainId+"','"+applicationId+"','"+flowName+"','80','','0','"+parentNoderId+"','"+DEADLINE+"',null,null,null,'0000-00-00 00:00:00',null,0,null)"; insertByDSName("apcegl",sql22);
20. Database form information
Table name | describe |
T_APPLICATION | Application information table |
T_ACTORRT | Process role information table |
T_ACTIVITY | Button information table |
T_ACTORHIS | History information table of process handler |
T_APPVALIDATE | Entry verification information table of Alibaba software |
T_BILLDEFI | Customized process information sheet |
T_COMMONINFO | Public data information table |
T_COMPONENT | Component information table |
T_CROSSREPORT | Cross information table |
T_CALENDAR | Calendar information table |
T_COUNTER | Count information table |
T_COLUMNMAPPING | Column configuration information table |
T_DEPARTMENT | Department information sheet |
T_DYNAFORM_FORM | Dynamic save table information table |
T_DOCUMENT | Document object information table |
T_DATAPREPARE | Preparation date information table |
T_DATASOURCE | Data source information table |
T_DOMAIN | Domain information table |
T_DOMAINLEVEL | Domain level information table |
T_FLOWSTATERT | Process status information table |
T_HELPER | Help information table |
T_HOMEPAGE | Home page information table |
T_IMAGEREPOSITORY | Picture library information table |
T_MODULE | Module information table |
T_MAPPINGCONFIG | Import configuration table of Excel |
T_MULTILANGUAGE | Multilingual information table |
T_NODERT | Process node information table |
T_PANDING | To do information sheet |
T_PAGE | Page information table |
T_PERMISSION | Permission information table of roles and menus |
T_QUERY_PARAMETER | Report query range information table |
T_QUERY | Report query information table |
T_RELATIONHIS | Process approval history information table |
T_PERSONALMESSAGE | In station mail information table |
T_ROLE | Role information table |
T_RESOURCE | Menu information table |
T_REMINDER | Reminder information table |
T_REMOTESERVERT | Transportation configuration table |
T_REPOSITORY | Report information table |
T_REPORTCONFIG | Report configuration information table |
T_SUPERUSER | Super administrator information table |
T_SHORTMESSAGE_RECEIVED | Received SMS message form |
T_SHORTMESSAGE_SUBMIT | Send SMS information table |
T_SQLSENTENCE | Sql statement save table |
T_STYLEREPOSITORY | Information table of style library |
T_STATELABEL | Process status information table |
T_SPECIALDAY | Special date information sheet |
T_STANDARDDAY | Standard date information table |
T_TASK | Scheduled task information table |
T_TASK_DAYSOFWEEK | Scheduled task running days information table |
T_USER | User information table |
T_VALIDATEREPPSOTPRY | Validation library data information table |
T_VIEW | View information table |
T_APPLICATION_SUPERUSER_SET | To many association tables (t_application & & t_superuser) |
T_REPORT_MAPPING_SET | To many association tables (t_reportconfig & & t_mappingconfig) |
T_DOMAIN_APPLICATION | T_application & & t_domain |
T_DOMAIN_SUPERUSER_SET | To many association tables (t_domain & & t_superuser) |
T_USER_DEPARTMENT | To many associated tables (t_department & & t_user) |
T_USER_ROLE_SET | To many associated tables (t_user & & t_role) |
T_PENDING_ACTOR_SET | T_pending & & t_actor t |