From 499cfe461d6520d173590337c69f05a4c72140ce Mon Sep 17 00:00:00 2001 From: zzk Date: Wed, 11 Oct 2023 09:04:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=98=E5=B7=A5=E4=B8=8A=E4=B8=8B=E7=8F=AD?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/WorkFlow/FlowSubmitDialog.jsp | 8 +- .../Frame/page/jspf/include/jsp_mainmenu.jspf | 21 +++- .../CreateVoucherProcess/CommutingToWork.java | 111 ++++++++++++++++++ 3 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 src_core/com/tenwa/voucher/CreateVoucherProcess/CommutingToWork.java diff --git a/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp b/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp index 262397018..f31706b13 100644 --- a/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp +++ b/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp @@ -196,15 +196,17 @@ var phaseName=routeJson.route[i].phaseName; var userInfo=routeJson.route[i].userInfo; var flowOperatorType=routeJson.route[i].flowUserOperatorType; - var vUser=userInfo.split("@"); - actionSet.append("
请选择"+phaseName+"用户:
"); + var userarr = AsControl.RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.CommutingToWork","FilterUserinfo","userinfo="+userInfo); + var vUser=userarr.split("@"); + console.log("==============",userInfo,userarr,vUser); + actionSet.append("
请选择"+phaseName+"用户:
"); var phaseAction = $("#phaseaction"+cindex); var type = "radio"; if(flowOperatorType!="01"){type="checkbox";} for(var i=0;i"); + phaseAction.append(""); } if(vUser.length==1&&type=="radio"){ $("input[name=phaseaction"+cindex+"]:first").attr("checked",true); diff --git a/WebContent/Frame/page/jspf/include/jsp_mainmenu.jspf b/WebContent/Frame/page/jspf/include/jsp_mainmenu.jspf index 63abf1b64..7b8216fd8 100644 --- a/WebContent/Frame/page/jspf/include/jsp_mainmenu.jspf +++ b/WebContent/Frame/page/jspf/include/jsp_mainmenu.jspf @@ -68,9 +68,11 @@ for(String role : roles) { var user=$($('#main_userinfo td').eq(3).html()).val(); var card = ""; card =''+user+''; + var but = " 上班 下班"; + //var button = "" // $('#main_userinfo a').remove(); $('#main_userinfo').children().first().remove(); - $('#main_userinfo').append(card); + $('#main_userinfo').append(card).append(but); trs.css("display","none"); }); function setFlowOperatorUser(){ @@ -92,6 +94,23 @@ for(String role : roles) { $("#messageNumber").text("消息("+cnumber+")"); } } + + function gotowork(){ + var res = AsControl.RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.CommutingToWork","CommutingToWorkMethod","userid=<%=CurUser.getUserID()%>,type = 1"); + if(res=="true"){ + alert("开始上班"); + return; + } + } + + function afterwork(){ + var res = AsControl.RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.CommutingToWork","CommutingToWorkMethod","userid=<%=CurUser.getUserID()%>,type = 2"); + if(res=="true"){ + alert("工作结束"); + return; + } + } + /* $(function(){ setInterval("getMessageNumber()",10000); diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/CommutingToWork.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/CommutingToWork.java new file mode 100644 index 000000000..9c688ee0d --- /dev/null +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/CommutingToWork.java @@ -0,0 +1,111 @@ +package com.tenwa.voucher.CreateVoucherProcess; + +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.tenwa.reckon.util.Conn; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class CommutingToWork { + + private String userid; + + public String getUserid() { + return userid; + } + + + public void setUserid(String userid) { + this.userid = userid; + } + + + private String type; + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + private String userinfo; + + public String getUserinfo() { + return userinfo; + } + + + public void setUserinfo(String userinfo) { + this.userinfo = userinfo; + } + + private static String REGEX_CHINESE = "[\u4e00-\u9fa5]"; + + + public String CommutingToWorkMethod(JBOTransaction tx) throws Exception{ + + try { + tx= JBOFactory.createJBOTransaction(); + Transaction sqlca = Transaction.createTransaction(tx); + String sql = ""; + if(type.equals("1")){ + sql = "update USER_TASK_INFO set induction_state = 'induction_state01' where userid = '"+userid+"'"; + }else { + sql = "update USER_TASK_INFO set induction_state = 'induction_state02' where userid = '"+userid+"'"; + } + SqlObject sqlObject = new SqlObject(sql); + sqlca.executeSQL(sqlObject); + tx.commit(); + + }catch (Exception e){ + e.printStackTrace(); + return "falser"; + } + + return "true"; + } + + + public String FilterUserinfo(JBOTransaction tx) throws Exception{ + + List userlist = new ArrayList<>(Arrays.asList(userinfo.split("@"))); + + String userarr = ""; + List userarry = new ArrayList<>(); + Conn conn = new Conn(tx); + + for(int i = userlist.size() - 1; i >= 0; i--){ + String user = userlist.get(i); + Matcher matcher = Pattern.compile(REGEX_CHINESE).matcher(user); + String userid = matcher.replaceAll(""); + String sql = "select case when instr(GROUP_CONCAT(induction_state),'induction_state02')>0 then 'false' else 'true' end as bo from USER_TASK_INFO where userid = '"+userid+"'"; + List> info = conn.executeQuery(sql); + if(info.get(0).get("bo").equals("false")){ + userlist.remove(user); + }else { + userarry.add(user); + } + } + + for (int i = userarry.size()-1; i >= 0; i--) { + if(i==0){ + userarr = userarr + userarry.get(i); + }else{ + userarr = userarr + userarry.get(i) + "@"; + } + } + + return userarr; + } + +}