diff --git a/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp b/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp index 0c9401cf1..9fa33235f 100644 --- a/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp +++ b/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp @@ -67,8 +67,9 @@ {usertype:'Á÷³ÌÖÐÖ¸¶¨²½ÖèµÄÈËÔ±'}, {usertype:'Ìá½»ÈËËùÔÚ²¿ÃŵĽÇÉ«'}, {usertype:'Á÷³Ì·¢ÆðÈËËùÔÚ²¿ÃŵĽÇÉ«'}, + {usertype:'Ñ¡ÔñÖ¸¶¨ÈÎÎñ³Ø½ÇÉ«'}, {usertype:'¸ù¾ÝSQLÓï¾ä'}, - {usertype:'¸ù¾Ýjava´úÂë'} + {usertype:'¸ù¾Ýjava´úÂë'}, ]; if("<%=selectbase%>"=="true"){ jsonData=[{usertype:'Ö¸¶¨ÈËÔ±'}, diff --git a/WebContent/AppConfig/RoleManage/RoleList.jsp b/WebContent/AppConfig/RoleManage/RoleList.jsp index a48de05cb..f426f162d 100644 --- a/WebContent/AppConfig/RoleManage/RoleList.jsp +++ b/WebContent/AppConfig/RoleManage/RoleList.jsp @@ -17,7 +17,7 @@ }*/ ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //ÉèÖÃDW·ç¸ñ 1:Grid 2:Freeform - dwTemp.ReadOnly = "1"; //ÉèÖÃÊÇ·ñÖ»¶Á 1:Ö»¶Á 0:¿Éд + dwTemp.ReadOnly = "0"; //ÉèÖÃÊÇ·ñÖ»¶Á 1:Ö»¶Á 0:¿Éд dwTemp.setPageSize(20); dwTemp.genHTMLObjectWindow(""); String sButtons[][] = { @@ -27,6 +27,7 @@ {(CurUser.hasRole("099")||CurUser.hasRole("299")?"true":"false"),"","Button","Ö÷²Ëµ¥ÊÚȨ","¸ø½ÇÉ«ÊÚȨÖ÷²Ëµ¥","my_AddMenu()","","","","btn_icon_menu"}, {(CurUser.hasRole("099")||CurUser.hasRole("299")?"true":"false"),"","Button","¶à½ÇÉ«²Ëµ¥ÊÚȨ","¸ø¶à¸ö½ÇÉ«ÊÚȨÖ÷²Ëµ¥","much_AddMenu()","","","","btn_icon_roles"}, {(CurUser.hasRole("099")||CurUser.hasRole("299")?"true":"false"),"","Button","±ä¸üÉúЧ","ͬ²½»º´æÖÐÊý¾ÝʹÊý¾Ý¿â±ä¸üÉúЧ","reloadCacheRole()","","","","btn_icon_valid"}, + {(CurUser.hasRole("099")||CurUser.hasRole("299")?"true":"false"),"","Button","±£´æ","±£´æ","as_save(0)","","","","btn_icon_save"} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp b/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp index 5cce8af69..6a6f89f7a 100644 --- a/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp +++ b/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp @@ -19,7 +19,8 @@ dwTemp.ReadOnly = "1"; //ÉèÖÃÊÇ·ñÖ»¶Á 1:Ö»¶Á 0:¿Éд dwTemp.genHTMLObjectWindow(sRoleID); String sButtons[][] = { - {"true","","Button","µ¼³öExcel","µ¼³öExcel","exportAll()","","","",""}, + {"true","","Button","µ¼³öExcel","µ¼³öExcel","exportAll()","","","","btn_icon_export"}, + {"true","","Button","ÅäÖÃÈÎÎñÈ¨ÖØ","ÅäÖÃÈÎÎñÈ¨ÖØ","configWeight()","","","","btn_icon_edit"} }; %> <%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/jbo/jbo_awe.xml b/WebContent/WEB-INF/etc/jbo/jbo_awe.xml index 021c8222c..4fa083819 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_awe.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_awe.xml @@ -130,6 +130,7 @@ + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml index 3d8e5d95c..2b1b18be0 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml @@ -958,7 +958,8 @@ - + + @@ -1351,7 +1352,7 @@ - + @@ -2211,5 +2212,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/amarsoft/app/flow/FlowAction.java b/src/com/amarsoft/app/flow/FlowAction.java index a5d792869..f7db684af 100644 --- a/src/com/amarsoft/app/flow/FlowAction.java +++ b/src/com/amarsoft/app/flow/FlowAction.java @@ -18,6 +18,8 @@ import jbo.sys.FLOW_ENTRUSTED_USER; import jbo.sys.FLOW_MODEL; import jbo.sys.FLOW_TASK; import jbo.sys.FLOW_TASK_USER_HIS; +import jbo.sys.USER_TASK_DATA; +import jbo.sys.USER_TASK_INFO; import org.apache.commons.lang.StringUtils; @@ -489,6 +491,25 @@ public class FlowAction { .createQuery( "select O.flowno,O.phaseno,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ") .setParameter("serialNo", taskNo).getSingleResult(false); + + //´¦ÀíÈÎÎñ³Ø + BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx); + BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx); + BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + ft.getAttribute("userid").toString() + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true); + if(utdbo != null) { + int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt(); + ARE.getLog().info("***********ÈÎÎñ³ØÈÕÖ¾***:Ϊ"+ taskNo + "µÄ" + utdbo.getAttribute("userid") + "Óû§¹Ø±ÕÒ»¸öÈÎÎñ£¬µ±Ç°Î´´¦Àí´ý°ìÊýΪ" + taskNumber); + String status = utdbo.getAttribute("status").toString(); + if("approve_status01".equals(status)) { + utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate(); + } + utdbo.setAttributeValue("status", "approve_status02"); + utdbo.setAttributeValue("endtime", StringFunction.getTodayNow()); + utdbom.saveObject(utdbo); + } + PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft .getAttribute("phaseno").getString(), ft.getAttribute("objecttype").getString(), @@ -555,6 +576,9 @@ public class FlowAction { .setParameter("userID", AssignmentId).getSingleResult(false); if (userBO != null) { this.initFlowTaskUserHis(tx); + //ÖØÐÂÖ¸ÅÉ´¦ÀíÈ˵Äͬʱ£¬ÐÞ¸ÄÈÎÎñ³ØÊý¾Ý + FlowTask tf = new FlowTask(taskNo, tx); + userID = tf.UserID; JBOFactory .getBizObjectManager("jbo.sys.FLOW_TASK") .createQuery( @@ -568,7 +592,38 @@ public class FlowAction { .setParameter("orgName", userBO.getAttribute("orgName").getString()) .executeUpdate(); - + String role = tf.PhaseOpinion4; + String curRole = role; + Transaction tran = Transaction.createTransaction(tx); + ASUser user = ASUser.getUser(AssignmentId, tran); + if(!"".equals(role)) { + String now = StringFunction.getTodayNow().replaceAll(":", "¡÷"); + SqlObject sql = null; + if(user.getRoleTable().contains(role)) { + sql = new SqlObject(("insert into user_task_data " + + "select sys_guid() ,'" + AssignmentId + "', roleid, flowno, flowunid, project_id, contract_id, '" + now + "', endtime," + + " 'approve_status03', taskno" + + " from user_task_data where userid = '" + userID + "' and taskno = '" + taskNo + "' and (status = 'approve_status01' or status = 'approve_status03')")); + sql.setDebugSql(sql.getDebugSql().replaceAll("¡÷", ":")); + sql.setOriginalSql(sql.getOriginalSql().replaceAll("¡÷", ":")); + sql.setRunSql(sql.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(sql); + sql = new SqlObject("update user_task_info set task_number = nvl(task_number, 0) + 1 " + + " where userid = '" + AssignmentId + "' and roleid = '" + curRole + "'"); + tran.executeSQL(sql); + } else { + role = user.getRoleTable().get(0); + } + sql = new SqlObject("update user_task_data set endtime = '" + now + "',status = 'approve_status04'" + + " where userid = '" + userID + "' and taskno = '" + taskNo + "' and (status = 'approve_status01' or status = 'approve_status03')"); + sql.setDebugSql(sql.getDebugSql().replaceAll("¡÷", ":")); + sql.setOriginalSql(sql.getOriginalSql().replaceAll("¡÷", ":")); + sql.setRunSql(sql.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(sql); + sql = new SqlObject("update user_task_info set task_number = nvl(task_number, 0) - 1 " + + " where userid = '" + userID + "' and roleid = '" + curRole + "'"); + tran.executeSQL(sql); + } } return ""; } @@ -879,6 +934,25 @@ public class FlowAction { } else if (!StringX.isEmpty(ft.getAttribute("endTime"))) { return "´ËÁ÷³ÌÈÎÎñÒÑ×Ô¶¯Ìá½»£¡"; } + + //´¦ÀíÈÎÎñ³Ø + BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx); + BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx); + BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + userID + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true); + if(utdbo != null) { + int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt(); + ARE.getLog().info("***********ÈÎÎñ³ØÈÕÖ¾***:Ϊ"+ taskNo + "µÄ" + utdbo.getAttribute("userid") + "Óû§¹Ø±ÕÒ»¸öÈÎÎñ£¬µ±Ç°Î´´¦Àí´ý°ìÊýΪ" + taskNumber); + String status = utdbo.getAttribute("status").toString(); + if("approve_status01".equals(status)) { + utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate(); + } + utdbo.setAttributeValue("status", "approve_status02"); + utdbo.setAttributeValue("endtime", StringFunction.getTodayNow()); + utdbom.saveObject(utdbo); + } + // ¸üÐÂbeginTimeËøÕâЩ¼Ç¼ ftManager .createQuery( diff --git a/src/com/amarsoft/dict/als/manage/ColRelativeInfo.java b/src/com/amarsoft/dict/als/manage/ColRelativeInfo.java index 7f1ea2ca3..656e7beb3 100644 --- a/src/com/amarsoft/dict/als/manage/ColRelativeInfo.java +++ b/src/com/amarsoft/dict/als/manage/ColRelativeInfo.java @@ -22,6 +22,9 @@ import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; public class ColRelativeInfo { @@ -278,4 +281,12 @@ public class ColRelativeInfo { } return "0"; } + + public static String getTaskNumber(String UserID, String RoleID) throws Exception { + JBOTransaction tx = JBOFactory.createJBOTransaction(); + Transaction tran = Transaction.createTransaction(tx); + String result = tran.getString(new SqlObject("select count(1) from user_task_data where userid = '" + UserID + "' and roleid = '" + RoleID + "' and status = 'approve_status01' group by userid,roleid")); + tx.commit(); + return result == null ? "" : result; + } } diff --git a/src_core/com/tenwa/flow/util/SelectUser.java b/src_core/com/tenwa/flow/util/SelectUser.java index 01dc73ef7..4960605b5 100644 --- a/src_core/com/tenwa/flow/util/SelectUser.java +++ b/src_core/com/tenwa/flow/util/SelectUser.java @@ -41,6 +41,8 @@ public class SelectUser { sql=this.getSelectRoleSql(curpid); }else if(this.selectType.equals("Á÷³ÌÖÐÖ¸¶¨²½ÖèµÄÈËÔ±")){ sql=this.getSelectFlowSetpSql(); + }else if(this.selectType.equals("Ñ¡ÔñÖ¸¶¨ÈÎÎñ³Ø½ÇÉ«")){ + sql=this.getSelectTaskPool(); } ASResultSet rs = null; try { @@ -64,7 +66,6 @@ public class SelectUser { return chileNode; } public String getSelectUserSql(String curpid) throws Exception{ - System.out.println("curpid===="+curpid); String sql="SELECT sortno,orgid treeid,orgname treename,parentid ,nodetype FROM ( "; sql+=" SELECT orgid,orgname,sortno,relativeorgid parentid,'fold' nodetype FROM org_info WHERE sortno<>'8' "; sql+=" UNION "; @@ -103,7 +104,7 @@ public String getSelectRoleSql(String curpid) throws Exception{ sql+=" WHERE ( a.parentid=8 or a.parentid like '"+curpid+"%')"; sql+=" and a.treename like '"+this.serarchData+"%'"; }else{ - sql+=" WHERE ( a.parentid=8 or a.parentid like '"+curpid+"%')"; + sql+=" WHERE ( a.parentid=8 or a.parentid like '%"+curpid+"%')"; } if(this.nodetype.equals("fold")){ sql+=" and a.nodetype like '"+this.nodetype+"%'"; @@ -111,6 +112,12 @@ public String getSelectRoleSql(String curpid) throws Exception{ sql+=" ORDER BY sortno"; return sql; } +public String getSelectTaskPool() throws Exception{ + String sql = "SELECT sortno,roleid treeid,rolename treename,parentid ,nodetype FROM ( " + + " SELECT roleid,rolename,sortno,belongorg parentid,'leaf' nodetype FROM role_info where task_pool = 'Y' ) a " + + " ORDER BY sortno"; + return sql; +} public String getSelectFlowSetpSql() throws Exception{ String sql="SELECT phaseno sortno,phaseno treeid,phasename treename,nodetype FROM ( "; sql+="SELECT phaseno,phasename,'leaf' nodetype FROM flow_model WHERE flowno='"+this.flowno+"' AND phasetype NOT IN('1040','1050')) a " ; diff --git a/src_tenwa/com/tenwa/handler/UserTaskInfoHandler.java b/src_tenwa/com/tenwa/handler/UserTaskInfoHandler.java new file mode 100644 index 000000000..970166062 --- /dev/null +++ b/src_tenwa/com/tenwa/handler/UserTaskInfoHandler.java @@ -0,0 +1,17 @@ +package com.tenwa.handler; + +import com.amarsoft.app.als.sys.tools.DateUtil; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.awe.dw.handler.impl.CommonHandler; + +public class UserTaskInfoHandler extends CommonHandler { + + @Override + protected void initDisplayForAdd(BizObject bo) throws Exception { + bo.setAttributeValue("userid", this.asPage.getParameter("UserId")); + bo.setAttributeValue("roleid", this.asPage.getParameter("RoleId")); + bo.setAttributeValue("inputuserid", this.curUser.getUserID()); + bo.setAttributeValue("inputorgid", this.curUser.getOrgID()); + bo.setAttributeValue("inputtime", DateUtil.getTodayNow()); + } +} diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/TaskPool.java b/src_tenwa/com/tenwa/lease/app/quartzmession/TaskPool.java new file mode 100644 index 000000000..d7749d240 --- /dev/null +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/TaskPool.java @@ -0,0 +1,207 @@ +package com.tenwa.lease.app.quartzmession; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.amarsoft.app.als.sys.tools.DateUtil; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; + +public class TaskPool implements Job { + + /** + * Ϊ¹æ±Ü¶¨Ê±ÈÎÎñµÄ²¢ÐУ¬Ê¹Óô洢¹ý³Ì·Öµ¥ + * @author zhulh + *//* + @Override + public void execute(JobExecutionContext arg0) throws JobExecutionException { + Transaction tran = null; + try { + tran = Transaction.createTransaction(JBOFactory.createJBOTransaction()); + tran.executeSQL(new SqlObject("{call proc_task_pool()}")); + } catch(Exception e) { + e.printStackTrace(); + try { + if(tran != null) tran.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + } finally { + try { + if(tran != null) tran.commit(); + } catch (JBOException e) { + e.printStackTrace(); + } + } + }*/ + + //·ÀÖ¹ÊÖ¶¯´¥·¢Ê±£¬Óë×Ô¶¯´¥·¢ÈÎÎñ³åÍ»µ¼ÖµÄÊý¾ÝÎÉÂÒ + @Override + public synchronized void execute(JobExecutionContext arg0) throws JobExecutionException{ + Transaction tran = null; + ASResultSet rsRole = null; + ASResultSet rsUser = null; + ASResultSet rsFlow = null; + try { + //¿ªÆôÊÂÎñ + tran = Transaction.createTransaction(JBOFactory.createJBOTransaction()); + //ËÑË÷ËùÓÐÈÎÎñ³Ø½ÇÉ« + rsRole = tran.getASResultSet(new SqlObject("select roleid from role_info where task_pool = 'Y'")); + while(rsRole.next()) { + String roleId = rsRole.getString("roleid"); + //»ñÈ¡´Ë½ÇÉ«ÏÂÉϸÚÓû§ + rsUser = tran.getASResultSet( + new SqlObject("select uti.userid, uti.task_weight, nvl(utd.cou,0) tasknumber from user_task_info uti left join (select userid,roleid,count(1) cou from user_task_data where status = 'approve_status01' group by userid,roleid) utd on utd.userid=uti.userid and utd.roleid=uti.roleid where uti.roleid = '" + + roleId + "' and exists(select 1 from user_role where roleid=uti.roleid and userid=uti.userid) and uti.induction_state = 'induction_state01' and to_number(uti.task_weight) > to_number(nvl(utd.cou,0)) order by to_number(uti.task_weight)-to_number(nvl(utd.cou, '0'))")); + + //»ñµÃÐèÒª·ÖÅäµÄ´ý°ì + SqlObject sql = new SqlObject("select serialno, objectno, flowno from flow_task where userid = '" + roleId + "' order by to_date(begintime,'yyyy/mm/dd hh24¡÷mi¡÷ss')"); + sql.setDebugSql(sql.getDebugSql().replaceAll("¡÷", ":")); + sql.setOriginalSql(sql.getOriginalSql().replaceAll("¡÷", ":")); + sql.setRunSql(sql.getRunSql().replaceAll("¡÷", ":")); + rsFlow = tran.getASResultSet(sql); + + List userLists = new ArrayList(); + while(rsUser.next()) { + double taskWeight = rsUser.getInt("task_weight");//»ñµÃÈ¨ÖØ + double taskNumber = rsUser.getInt("tasknumber");;//»ñµÃÒÑÊÕµ½´ý°ì + String cou = tran.getString(new SqlObject("select count(1) from user_task_data where userid = '" + rsUser.getString("userid") + "' and roleid = '" + roleId + "' and status = 'approve_status01' group by userid,roleid")); + if(cou == null) { + cou = "0"; + } + taskNumber = Double.parseDouble(cou); + String weight = (taskNumber == 0 ? "0" : taskNumber/taskWeight + "") + "@" + taskNumber + "@" + taskWeight + "@" + rsUser.getString("userid") + "@0"; + + userLists.add(weight); + } + + List removeUsers = new ArrayList(); + + while(rsFlow.next()) { + if(userLists.size() == 0) { + break; + } + //ÎªÈ¨ÖØÈÎÎñ³ØÅÅÐò + sortList(userLists); + //»ñÈ¡¿ÉËæ»úÓû§Êý + int number = getRandomNumber(userLists); + String userWeight = userLists.get(number); + double taskNumber = Double.parseDouble(userWeight.split("@")[1]); + double taskWeight = Double.parseDouble(userWeight.split("@")[2]); + double actualWeight = (taskNumber + 1) / taskWeight; + String userId = userWeight.split("@")[3]; + ASUser user = ASUser.getUser(userId, tran); + int n = Integer.parseInt(userWeight.split("@")[4]) + 1; + //ÖØÐ´ò°üÓû§ + userWeight = actualWeight + "@" + (taskNumber + 1) + "@" + taskWeight + "@" + userId + "@" + n; + if(actualWeight == 1.0) {//ÈÎÎñÂúÁ˵ÄÇé¿ö£¬¾Í´ÓÓû§ÈÎÎñ¼¯ºÏɾ³ý + userLists.remove(number); + removeUsers.add(userWeight); + } else { + userLists.set(number, userWeight); + } + + ARE.getLog().info("******************ÈÎÎñ³ØÈÕÖ¾*****Ϊ" + user.getUserID() + "Ôö¼Óµ¥×Ó£º" + rsFlow.getString("serialno")); + + tran.executeSQL(new SqlObject("update flow_task set " + + "phaseopinion4 = '" + roleId + "', userid = '" + user.getUserID() + "'," + + "username = '" + user.getUserName() + "', orgid = '" + user.getOrgID() + "'," + + "orgname = '" + user.getOrgName() + "' where serialno = '" + rsFlow.getString("serialno") + "'")); + SqlObject so = new SqlObject("insert into user_task_data(id,roleid,userid,taskno,flowno,flowunid,project_id,contract_id,begintime,endtime,status)" + + "select sys_guid(),'" + roleId + "','" + user.getUserID() + "','" + rsFlow.getString("serialno") + "','" + rsFlow.getString("flowno") + "',flow_unid,proj_id,contract_id,'" + + DateUtil.getTodayNow().replaceAll(":", "¡÷") + "','','approve_status01' from flow_bussiness_object where flow_unid = '" + rsFlow.getString("objectno") + "'"); + so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); + so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); + so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(so); + } + userLists.addAll(removeUsers); + for(String user : userLists) { + if(Integer.parseInt(user.split("@")[4]) == 0) { + continue; + } + ARE.getLog().info("******************ÈÎÎñ³ØÈÕÖ¾*****Ϊ" + user.split("@")[3] + "Ôö¼ÓÈÎÎñ£º" + user.split("@")[4] + "Êý¾ÝΪ£º" + user); + tran.executeSQL(new SqlObject("update user_task_info set task_number = nvl(task_number,0) + " + + Integer.parseInt(user.split("@")[4]) +" where userid = '" + user.split("@")[3] + "' and roleid = '" + roleId + "'")); + } + } + } catch (Exception e) { + e.printStackTrace(); + try { + if(tran != null) tran.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + } finally { + try { + if(tran != null) tran.commit(); + } catch (JBOException e) { + e.printStackTrace(); + } + try { + if(rsRole != null) rsRole.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + try { + if(rsUser != null) rsUser.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + try { + if(rsFlow != null) rsFlow.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + public static void sortList(List userLists) { + List sortList = new ArrayList(userLists.size()); + for(int i = 0; i < userLists.size(); i ++) { + double weight = Double.parseDouble(userLists.get(i).split("@")[0]); + int j = 0; + for(; j < sortList.size(); j ++) { + double sweight = Double.parseDouble(sortList.get(j).split("@")[0]); + if(sweight >= weight) { + break; + } + } + sortList.add(j, userLists.get(i)); + } + userLists.clear(); + userLists.addAll(sortList); + } + + public static int getRandomNumber(List userLists) { + int i = 0; + double weight = Double.parseDouble(userLists.get(0).split("@")[0]); + for(String userList : userLists) { + double sweight = Double.parseDouble(userList.split("@")[0]); + if(weight == sweight) { + i ++; + } + } + return (int)(Math.random()*(i)); + } + + public static String modifyStringByIndex(int index,String oriValue, String value) { + String[] ori = oriValue.split("@"); + ori[index] = value; + String result = ""; + for(String o : ori) { + result += "@" + o; + } + return result.substring(1); + } +}