diff --git a/.idea/ecology_htxc.iml b/.idea/ecology_htxc.iml new file mode 100644 index 0000000..b1138b5 --- /dev/null +++ b/.idea/ecology_htxc.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6560a98 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c350197 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0636556 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c468c27 --- /dev/null +++ b/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + com.htsc.ecology + ecology-hr-core + 1.0.0 + + + 1.8 + 1.8 + UTF-8 + + + + + + ${basedir}/dependency/classbean + + + ${basedir}/src/main/resources + + *.* + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + + -verbose + -bootclasspath + ${java.home}${file.separator}lib${file.separator}rt.jar${path.separator}${java.home}${file.separator}lib${file.separator}jce.jar + -extdirs + ${basedir}${file.separator}dependency${file.separator}lib${path.separator}${basedir}${file.separator}dependency${file.separator}lib-new${path.separator}${basedir}${file.separator}dependency${file.separator}classbean${path.separator}${java.home}${file.separator}lib${path.separator}${java.home}${file.separator}lib${file.separator}ext + + + + org.projectlombok + lombok + 1.18.12 + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + package + + jar + + + ${project.build.outputDirectory} + ecology-hr-core + ${project.build.directory} + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindCmd.java b/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindCmd.java new file mode 100644 index 0000000..2571eaa --- /dev/null +++ b/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindCmd.java @@ -0,0 +1,104 @@ +package com.customization.htsc.autoremind; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.constant.requestForm.RequestExecuteType; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + + +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交报错提醒系统管理员") +public class RequestSubmitErrorRemindCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> command) { + + + BaseBean bb = new BaseBean(); + bb.infoLog("RequestSubmitErrorRemindCmd","RequestSubmitErrorRemindCmd"); + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) command; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + User user = requestSubmitCmd.getUser(); + + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String src = Util.null2String(request.getParameter("src")); + + bb.infoLog("RequestSubmitErrorRemindCmd",requestid); + + + Map result = nextExecute(command);; + String remark = "流程流转出错"; + try{ + if(!"1".equals(workflowid)) + { + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + + Map messagemap = resultBean.getMessageInfo(); +// for (Map.Entry entry : messagemap.entrySet()) { +// bb.writeLog("RequestSubmitErrorRemindCmd--messagemap--Key = " + entry.getKey() + ", Value = " + entry.getValue()); +// } +// +// for (Map.Entry entry : result.entrySet()) { +// bb.writeLog("RequestSubmitErrorRemindCmd--result--Key = " + entry.getKey() + ", Value = " + entry.getValue()); +// } +// +// Map resultinfo = resultBean.getMessageInfo(); +// for (Map.Entry entry : resultinfo.entrySet()) { +// bb.writeLog("RequestSubmitErrorRemindCmd--messagemap--Key = " + entry.getKey() + ", Value = " + entry.getValue()); +// } + +// Map submitparams = resultBean.getMessageInfo(); +// for (Map.Entry entry : submitparams.entrySet()) { +// bb.writeLog("RequestSubmitErrorRemindCmd--messagemap--Key = " + entry.getKey() + ", Value = " + entry.getValue()); +// } + + RequestExecuteType requestExecuteType = resultBean.getType(); +// bb.writeLog("RequestSubmitErrorRemindCmd-requestExecuteType = " + requestExecuteType.toString()); + //prompttype + + String detail = Util.null2String(messagemap.get("detail")); + String bottom = Util.null2String(messagemap.get("bottom")); + if(!"".equals(remark)){ + remark = "
"+detail+"
"+bottom+"
"; + } + String isSuccess = Util.null2String(messagemap.get("isSuccess")); + + bb.writeLog("RequestSubmitErrorRemindCmd---isSuccess:"+isSuccess); + bb.writeLog("RequestSubmitErrorRemindCmd---src:"+src); + bb.writeLog("RequestSubmitErrorRemindCmd---requestExecuteType:"+requestExecuteType.toString()); + + if(("false".equals(isSuccess) || ("".equals(isSuccess) && "FAILD".equalsIgnoreCase(requestExecuteType.toString()))) && "submit".equals(src)) + { + bb.writeLog("requestSubmitErrorRemindThread---start"); + RequestSubmitErrorRemindThread requestSubmitErrorRemindThread = new RequestSubmitErrorRemindThread(requestid,user,remark); + new Thread(requestSubmitErrorRemindThread).start(); + bb.writeLog("requestSubmitErrorRemindThread----end"); + } + } + }catch (Exception e){ + bb.writeLog("RequestSubmitErrorRemindCmd-e:"+e); + if(!"1".equals(workflowid)) + { + bb.writeLog("requestSubmitErrorRemindThread--Exception--start"); + RequestSubmitErrorRemindThread requestSubmitErrorRemindThread = new RequestSubmitErrorRemindThread(requestid,user,remark); + new Thread(requestSubmitErrorRemindThread).start(); + bb.writeLog("requestSubmitErrorRemindThread--Exception--end"); + } + } + + return result; + } + + + + + + + +} diff --git a/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindThread.java b/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindThread.java new file mode 100644 index 0000000..f3caad2 --- /dev/null +++ b/src/main/java/com/customization/htsc/autoremind/RequestSubmitErrorRemindThread.java @@ -0,0 +1,154 @@ +package com.customization.htsc.autoremind; + +import weaver.conn.RecordSet; +import weaver.email.EmailWorkRunnable; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.system.SysRemindWorkflow; +import java.util.HashSet; +import java.util.Set; + + +public class RequestSubmitErrorRemindThread implements Runnable { + private String requestid; + private User user; + private String newremark; + + public RequestSubmitErrorRemindThread(String requestid,User user,String newremark) { + this.requestid = requestid; + this.user = user; + this.newremark = newremark; + } + + @Override + public void run() { + BaseBean bb = new BaseBean(); + bb.writeLog("RequestSubmitErrorRemindThread--requestid:"+requestid); + try{ + RecordSet rs = new RecordSet(); + String requestname = "" ; + String requestmark = "" ; + String sqltable = " select abs(t.formid) as formid,t.id,l.requestname,l.requestmark " + + " from workflow_base t " + + " inner join workflow_requestbase l on l.workflowid = t.id " + + " where l.requestid=" + requestid + ""; + rs.execute(sqltable); + if (rs.next()) { + requestname = Util.null2String(rs.getString("requestname")); + requestmark = Util.null2String(rs.getString("requestmark")); + } + + if(!"".equals(requestid)) + { + String type = ""; + String objids = ""; + String sql = " select * from workflow_errorremind "; + rs.executeQuery(sql); + if (rs.next()) { + type = Util.null2String(rs.getString("type")); + objids = Util.null2String(rs.getString("objids")); + } + String operators = ""; + //String operatormails = "" ; + Set setMail = new HashSet(); + + if("0".equals(type)){ //管理人员账号 + operators = objids; + }else if("1".equals(type)){//人力资源 + operators = objids; + if(!"".equals(operators)){ + sql = " select email from hrmresource where id in("+operators+") "; + rs.execute(sql); + while (rs.next()){ + String email =Util.null2String(rs.getString("email")) ; + if(!"".equals(email)){ + //operatormails += operatormails == "" ? email : ","+email; + setMail.add(email); + } + } + } + }else if("2".equals(type)){ //角色 + sql = " select t.resourceid,k.email from hrmrolemembers t \n" + + " inner join hrmroles l on l.id = t.roleid \n" + + " inner join hrmresource k on k.id = t.resourceid \n" + + " where l.id in ("+objids+")"; + + rs.execute(sql); + while (rs.next()){ + String resourceid =Util.null2String(rs.getString("resourceid")) ; + String email =Util.null2String(rs.getString("email")) ; + operators += operators == "" ? resourceid : ","+resourceid ; + + if(!"".equals(email)){ + //operatormails += operatormails == "" ? email : ","+email; + setMail.add(email); + } + + } + }else if(("".equals(type) || type.equals("3")) && this.isAdmin(user)){ + operators = user.getUID()+""; + String email = user.getEmail(); + + if(!"".equals(email)){ + //operatormails += operatormails == "" ? email : ","+email; + setMail.add(email); + } + } + bb.writeLog("operators:"+operators); + bb.writeLog("setMail:"+setMail.toString()); + String remark = this.newremark; + if(!"".equals(operators)) + { + int resource = 1; + SysRemindWorkflow sysRemindWorkflow = new SysRemindWorkflow(); + sysRemindWorkflow.make("流程-"+requestname+"提交报错",0,0,0,0,resource,operators,remark,Util.getIntValue(requestid)); + } + + String operatormails = String.join(",", setMail); + if(!"".equals(operatormails)) + { + String sendTo = operatormails ; + String subject = "流程--"+requestname+"提交报错"; + String sendCc = "" ; + String sendBcc = "" ; + + bb.writeLog("sendTo:" + sendTo); + bb.writeLog("subject:" + subject); + + //EmailService EmailService = new EmailService(); + + String content = " 流程请求ID:"+requestid + "
"+ + " 流程请求名称:"+requestname+ "
"+ + " 流程编号:" +requestmark+"
"+ + " 当前操作者:" +user.getLastname()+"
"+ + " 异常原因:
"+remark; + + EmailWorkRunnable ewr = new EmailWorkRunnable(sendTo,sendCc,sendBcc,subject, content); + boolean result = ewr.emailCommonRemind(); + bb.writeLog("result:" + result); + } + } + }catch (Exception e){ + e.printStackTrace(); + bb.writeLog("RequestSubmitErrorRemindThread---e:"+e); + } + } + /*** + * + * @param user + * @return + */ + public boolean isAdmin(User user){ + boolean flag = false; + RecordSet rs = new RecordSet(); + rs.execute("select count(*) from hrmresourcemanager where id=" + user.getUID()); + if(rs.next()){ + if(rs.getInt(1) > 0){ + flag = true; + } + } + return flag; + } + +} diff --git a/src/main/java/com/customization/htsc/cus/FowardMultiUserHandleCmd.java b/src/main/java/com/customization/htsc/cus/FowardMultiUserHandleCmd.java new file mode 100644 index 0000000..f3361ff --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/FowardMultiUserHandleCmd.java @@ -0,0 +1,46 @@ +package com.customization.htsc.cus; + +import com.alibaba.fastjson.JSONObject; +import com.customization.htsc.integration.PushForwardDataThread; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.workflow.util.WorkflowUtil; +import com.engine.workflow.cmd.requestForm.ForwardSubmitCmd; +import weaver.conn.ConnStatement; +import weaver.filter.WeaverRequest; +import weaver.general.Util; +import weaver.workflow.request.WFAutoApproveThreadPoolUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; +import java.util.Map; +import java.util.Set; + +/** + * Author:wanxq + * Date:2021年6月18日21:10:12 + * Description: 意见征询处理多人力资源字段 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = ForwardSubmitCmd.class, desc = "流程提交后处理多人力资源字段的分组情况") +public class FowardMultiUserHandleCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + ForwardSubmitCmd forwardSubmitCmd = (ForwardSubmitCmd) targetCommand; + HttpServletRequest request = forwardSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + int requestid = Util.getIntValue(request.getParameter("requestid")); + + Map result = nextExecute(targetCommand); + + //保存多人力资源字段的数据结构 + WorkflowUtil.saveMultiUserTypeData(requestid,request); + + return result; + } + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/cus/ITManagementPlatformCmd.java b/src/main/java/com/customization/htsc/cus/ITManagementPlatformCmd.java new file mode 100644 index 0000000..4c56366 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/ITManagementPlatformCmd.java @@ -0,0 +1,133 @@ +package com.customization.htsc.cus; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.interfaces.htsc.GlobatTools.JAVATools; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.util.HttpRequestUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * @Title: ecology-9 + * @Company: 泛微软件 + * @author: K1810039 + * @version: 1.0 + * @CreateDate: 2022-06-13 + * @Description: 对接IT管理平台,IT需求管理平台流程,IT测试和上线申请流程,流程终止时向上游同步状态 + * @ModifyLog: + **/ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class ITManagementPlatformCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + JAVATools.writelog("------ITManagementPlatformCmd------"); + // 从request中可以取到参数,不用以前的方法了 + HttpServletRequest request = requestSubmitCmd.getRequest(); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String requestid = Util.null2String(request.getParameter("requestid")); + JAVATools.writelog("requestid:"+requestid); + // 终止:2 + String oaStatus = "2"; + String tablename = JAVATools.getMaintable(requestid); + String src = Util.null2String(request.getParameter("src")); + JAVATools.writelog("src:"+src); + String dt = ""; + + PropBean pb = new PropBean(); + String itxqglpt_workflowid = pb.getPropName("itxqglpt_workflowid"); + String itcshsxsqglpt_workflowid = pb.getPropName("itcshsxsqglpt_workflowid"); + JAVATools.writelog("IT需求管理平台流程itxqglpt_workflowid"+itxqglpt_workflowid); + JAVATools.writelog("IT测试和上线申请流程itcshsxsqglpt_workflowid"+itcshsxsqglpt_workflowid); + + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + JAVATools.writelog("executeResult:"+executeResult); + + if ("SUCCESS".equals(executeResult) && "dostopc".equals(src)) { + if(workflowid.equals(itxqglpt_workflowid)){ + dt = tablename + "_dt7"; + JAVATools.writelog("-----ITManagementPlatformCmd--itxqglpt--" + getUnnumberAndXqhb(workflowid,tablename,dt,requestid,oaStatus)); + }else if (workflowid.equals(itcshsxsqglpt_workflowid)){ + dt = tablename + "_dt4"; + JAVATools.writelog("-----ITManagementPlatformCmd--itcshsxsqglpt--" + getUnnumberAndXqhb(workflowid,tablename,dt,requestid,oaStatus)); + } + } + return result; + } + + /** + * 获取流程唯一标识 和 需求编号list,并调用上游接口同步状态 + */ + public String getUnnumberAndXqhb(String workflowid,String tablename,String dt,String requestid,String oaStatus){ + String result = ""; + String sql = ""; + String wfUnnumber = ""; + RecordSet rs = new RecordSet(); + + // 根据workflowid拿到流程唯一标识 + sql = "select UNNUMBER from WORKFLOW_BASE where ID = " + workflowid; + JAVATools.writelog(sql); + rs.execute(sql); + if (rs.next()){ + wfUnnumber = Util.null2String(rs.getString("UNNUMBER")); + } + + // 获取该requestid流程中的所有需求编号 + List demandcodeList = new ArrayList<>(); + sql = "select distinct d.XQBH from WORKFLOW_REQUESTBASE w\n" + + " join "+tablename+" m on w.REQUESTID = m.REQUESTID\n" + + " join "+dt+" d on d.MAINID = m.ID\n" + + " where m.REQUESTID = " + requestid; + JAVATools.writelog(sql); + rs.execute(sql); + while (rs.next()){ + demandcodeList.add(Util.null2String(rs.getString("XQBH"))); + } + + // 调用上游接口传状态 + result = sendPost(demandcodeList,oaStatus,wfUnnumber); + return result; + } + + /** + * 调用上游接口同步状态 + */ + public String sendPost(List demandcodeList,String oaStatus,String wfUnnumber){ + + String result = ""; + HttpRequestUtil httpRequestUtil = new HttpRequestUtil(); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("demandcodeList",demandcodeList); + jsonObject.put("oaStatus",oaStatus); + jsonObject.put("unNumber",wfUnnumber); + String params = JSONObject.toJSONString(jsonObject); + JAVATools.writelog(params); + + String url = "http://168.63.17.245:8900/newirm/require/syncOAProcessStatus"; + String response = httpRequestUtil.sendPost(url, params,"UTF-8"); + JAVATools.writelog(response); + JSONObject responseJSON = JSON.parseObject(response); + boolean error = Boolean.parseBoolean(Util.null2String(responseJSON.getString("error"))); + if (error){ + // true:同步失败 + result = "同步失败"; + }else { + // false:同步成功 + result = "同步成功"; + } + return result; + } + +} diff --git a/src/main/java/com/customization/htsc/cus/LeaderNoticeRequestSubCmd.java b/src/main/java/com/customization/htsc/cus/LeaderNoticeRequestSubCmd.java new file mode 100644 index 0000000..674e0f6 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/LeaderNoticeRequestSubCmd.java @@ -0,0 +1,194 @@ +package com.customization.htsc.cus; + +import com.alibaba.fastjson.JSONObject; +import com.api.workflow.service.WorkflowShareService; +import com.cloudstore.dev.api.bean.MessageBean; +import com.cloudstore.dev.api.bean.MessageType; +import com.cloudstore.dev.api.util.Util_Message; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.docx4j.wml.R; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.TimeUtil; +import weaver.general.Util; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.cus.HTUtil; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Author:wanxq + * Date:2021/1/05 14:53 + * Description: 流程提交根据领导意见发送消息通知 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class LeaderNoticeRequestSubCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String src = Util.null2String(request.getParameter("src")); + String remark = Util.HTMLtoTxt(Util.null2String(request.getParameter("remark"))).trim(); + String operator = Util.null2String(request.getParameter("f_weaver_belongto_userid")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + + if("SUCCESS".equals(executeResult) && !"save".equals(src)){ + RecordSet rs = new RecordSet(); + //查询当前流程节点对应的提交人提交意见是否需要发送通知 + rs.executeQuery(" select a.* from uf_ldsyyjtz a,workflow_base b,workflow_nodebase c " + + " where a.lc=b.unnumber and a.lcjd=c.unnumber and ','||cfld||',' like '%,"+operator+",%' " + + " and b.id=? and c.id=? ",new Object[]{workflowid,nodeid}); + if(rs.next()){ + if(!"同意".equals(remark) && !"同意.".equals(remark) && !"同意。".equals(remark) + && !"已阅".equals(remark) && !"已阅.".equals(remark) && !"已阅。".equals(remark)){ + Set userIdSet = new HashSet(); // 消息接收人员集合 + String tstzry = Util.null2String(rs.getString("tstzry")); + //特殊通知人员 + if(!"".equals(tstzry)){ + Set set= new HashSet(Arrays.asList(tstzry.split(","))); + userIdSet.addAll(set); + addWfShare(workflowid,requestid,nodeid,tstzry); + } + + //流程监控人员 + String sql = " select * from workflow_monitor_info where id in ( " + + " select distinct infoid from workflow_monitor_detail where workflowid=? )"; + rs.executeQuery(sql,workflowid); + while(rs.next()){ + String jktype = Util.null2String(rs.getString("jktype")); + String jkvalue = Util.null2String(rs.getString("jkvalue")); + if("1".equals(jktype) || "3".equals(jktype) ){//人力资源和系统管理员类型 + userIdSet.add(jkvalue); + }else{//角色类型 + Set roleMembersSet = getRoleMembers(jkvalue); + userIdSet.addAll(roleMembersSet); + } + } + + //流程参与人员 + rs.executeQuery(" select distinct userid from workflow_currentoperator where requestid=? and userid!=? ",new Object[]{requestid,operator}); + while(rs.next()){ + String userid = Util.null2String(rs.getString("userid")); + userIdSet.add(userid); + } + + //发送消息 + sendNotice(requestid,operator,remark,userIdSet); + + + } + + } + + } + + return result; + } + + + /** + * 添加流程监控角色中的人员 + * @param roleid + * @return + */ + public Set getRoleMembers(String roleid){ + RecordSet rs = new RecordSet(); + Set set = new HashSet(); + rs.executeQuery(" select * from hrmrolemembers where roleid=? "); + while(rs.next()){ + String resourceid = Util.null2String(rs.getString("resourceid")); + set.add(resourceid); + } + return set; + } + + + /** + * 发送通知 + * @param requestid + * @param operator + * @param remark + * @param userIdSet + */ + public void sendNotice(String requestid,String operator,String remark,Set userIdSet){ + + try { + RecordSet rs = new RecordSet(); + rs.executeQuery(" select * from workflow_requestbase where requestid=? ",new Object[]{requestid}); + rs.next(); + String requestmark = Util.null2String(rs.getString("requestmark")); + String requestName = Util.null2String(rs.getString("requestname")); + if(requestName.length()>20){ + requestName = requestName.substring(0,20); + } + + if(remark.length()>30){ + remark = remark.substring(0,30); + } + + DateFormat df = new SimpleDateFormat("yyyy年MM月dd日HH时"); + String operatetime = df.format(new Date()); + + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String operatorName = resourceComInfo.getLastname(operator); + + PropBean propBean = new PropBean(); + int typecode = Util.getIntValue(propBean.getPropName("ldtzMsgTypeCode"),1169); + MessageType messageType = MessageType.newInstance(typecode); // 消息来源 + String title = "领导审批意见通知"; // 标题 + String context = operatorName+"于"+operatetime+"对“"+requestName+"”("+requestmark+")" + + "签署意见“"+remark+"”,请知悉。"; // 内容 + String linkUrl = "/spa/workflow/static4form/index.html#/main/workflow/req?requestid="+requestid+"&ismonitor=1"; // PC端链接 + String linkMobileUrl = "/spa/workflow/static4mobileform/index.html#/req?requestid="+requestid+"&ismonitor=1"; // 移动端链接 + + MessageBean messageBean = Util_Message.createMessage(messageType, userIdSet, title, context, linkUrl, linkMobileUrl); + messageBean.setCreater(1);// 创建人id + Util_Message.store(messageBean); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 给流程添加共享人员 + * @param workflowid + * @param requestid + * @param currentnodeid + * @param tstzry + */ + public void addWfShare(String workflowid,String requestid,String currentnodeid,String tstzry){ + String currentSql = " select id from workflow_currentoperator where requestid="+requestid+" AND nodeid="+currentnodeid; + RecordSet rs = new RecordSet(); + rs.execute(currentSql); + rs.next(); + int currentid = rs.getInt("id"); + WorkflowShareService wss = new WorkflowShareService(); + String userids[] = Util.TokenizerString2(tstzry,","); + wss.saveShareInfo("5",null,0,0,0,null,userids,null,null,"",currentnodeid,requestid,workflowid,1,"1",currentid); + } + + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/cus/MultiUserTypeHandleCmd.java b/src/main/java/com/customization/htsc/cus/MultiUserTypeHandleCmd.java new file mode 100644 index 0000000..dab8a90 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/MultiUserTypeHandleCmd.java @@ -0,0 +1,58 @@ +package com.customization.htsc.cus; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.api.workflow.service.WorkflowShareService; +import com.cloudstore.dev.api.bean.MessageBean; +import com.cloudstore.dev.api.bean.MessageType; +import com.cloudstore.dev.api.util.Util_Message; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.workflow.util.WorkflowUtil; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import tebie.applib.api.M; +import weaver.conn.ConnStatement; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; + +import javax.servlet.http.HttpServletRequest; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Author:wanxq + * Date:2021/5/31 14:53 + * Description: 流程提交后处理多人力资源字段的分组数据 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交后处理多人力资源字段的分组情况") +public class MultiUserTypeHandleCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + int requestid = Util.getIntValue(request.getParameter("requestid")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + + //保存多人力资源字段的数据结构 + if(requestid<0){ + requestid = (int) resultBean.getResultInfo().get("requestid"); + } + WorkflowUtil.saveMultiUserTypeData(requestid,request); + + return result; + } + + + + public static void main(String[] args) { + System.out.println("field138531".substring(5)); + } +} diff --git a/src/main/java/com/customization/htsc/cus/ReiRequestSubCmd.java b/src/main/java/com/customization/htsc/cus/ReiRequestSubCmd.java new file mode 100644 index 0000000..a981abd --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/ReiRequestSubCmd.java @@ -0,0 +1,95 @@ +package com.customization.htsc.cus; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.trip.util.WeaverUtil; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.cus.HTUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * Created by qlk + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "报销流程提交处理业务") +public class ReiRequestSubCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + BaseBean baseBean = new BaseBean(); + //联合报销workflowid + String unionReiWfid = Util.null2String(new PropBean().getPropName("unionReWfid")); + String wfidstr = Util.null2String(new PropBean().getWorkflowIdsByUnNumber(unionReiWfid)); + List lisWF = Arrays.asList(wfidstr.split(",")); + //获取代理对象 + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest(); + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String src = Util.null2String(request.getParameter("src")); //状态 + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String type = Util.null2String(resultBean.getType()); //流程处理结果 + if (lisWF.contains(workflowid) && "0".equals(nodetype)) { // 联合报销创建节点 + if ("SUCCESS".equalsIgnoreCase(type)) { //成功 + if ("save".equalsIgnoreCase(src) || "dostopc".equalsIgnoreCase(src)) { //保存 终止 + Map paras = new HashMap<>(); //行程接口请求参数 + HTUtil htUtil = new HTUtil(); + baseBean.writeLog("unionReWfid====" + unionReiWfid); + baseBean.writeLog("requestid====" + requestid); + //状态 + if ("save".equalsIgnoreCase(src)) { + paras.put("status", "DRAFT"); + } else { + paras.put("status", "TERMINATION"); + } + Map submitParams = resultBean.getSubmitParams(); + if ("-1".equals(requestid)) { + requestid = Util.null2String(submitParams.get("requestid")); + } + //流程id + paras.put("processId", requestid); + String tableName = htUtil.getTableNameByWfid(Util.getIntValue(lisWF.get(0))); //获取表单名 + String sql = "select t3.requestname,lcbh,ngrgh,ngrq,glcclc,zfmxhj,lastname from " +tableName+" t1\n" + + " left join hrmresource t2\n" + + " on t1.ngr=t2.id\n" + + " left join workflow_requestbase t3\n" + + " on t1.requestid=t3.requestid\n" + + " where t1.requestid="+requestid; + RecordSet rs = new RecordSet(); + List bizNos = new ArrayList<>(); + rs.execute(sql); + String glcclc = ""; + if (rs.next()) { + paras.put("draftTime", Util.null2String(rs.getString("ngrq"))); + paras.put("drafterId", Util.null2String(rs.getString("ngrgh"))); + paras.put("reimbursementBizNo", Util.null2String(rs.getString("lcbh"))); + paras.put("drafterName", Util.null2String(rs.getString("lastname"))); + paras.put("totalAmount", Util.null2String(rs.getString("zfmxhj"))); + paras.put("title", Util.null2String(rs.getString("requestname"))); + glcclc = WeaverUtil.getLcBhbyrequestId(rs.getString("glcclc")); + if (!"".equals(glcclc)) { + bizNos = Arrays.asList(glcclc.split(",")); + } + + } + // 关联出差流程 + paras.put("travelApplicationBizNo", bizNos); + baseBean.writeLog("paras", "参数====" + paras); + //调用updateReimbursement方法 + String res = htUtil.updateReimbursement(paras); + baseBean.writeLog("res", "返回值:" + res); + } + } + } + return result; + } +} diff --git a/src/main/java/com/customization/htsc/cus/RemarkMultiUserHandleCmd.java b/src/main/java/com/customization/htsc/cus/RemarkMultiUserHandleCmd.java new file mode 100644 index 0000000..a7f5325 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/RemarkMultiUserHandleCmd.java @@ -0,0 +1,43 @@ +package com.customization.htsc.cus; + +import com.alibaba.fastjson.JSONObject; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.workflow.util.WorkflowUtil; +import com.engine.workflow.cmd.requestForm.ForwardSubmitCmd; +import com.engine.workflow.cmd.requestForm.RemarkSubmitCmd; +import weaver.conn.ConnStatement; +import weaver.general.Util; + +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; +import java.util.Map; +import java.util.Set; + +/** + * Author:wanxq + * Date:2021年6月18日21:10:12 + * Description: 意见征询处理多人力资源字段 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RemarkSubmitCmd.class, desc = "流程提交后处理多人力资源字段的分组情况") +public class RemarkMultiUserHandleCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RemarkSubmitCmd remarkSubmitCmd = (RemarkSubmitCmd) targetCommand; + HttpServletRequest request = remarkSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + int requestid = Util.getIntValue(request.getParameter("requestid")); + + Map result = nextExecute(targetCommand); + + //保存多人力资源字段的数据结构 + WorkflowUtil.saveMultiUserTypeData(requestid,request); + return result; + } + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/cus/RequestSubCmd.java b/src/main/java/com/customization/htsc/cus/RequestSubCmd.java new file mode 100644 index 0000000..a4ebe31 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/RequestSubCmd.java @@ -0,0 +1,188 @@ +package com.customization.htsc.cus; + +import com.alibaba.fastjson.JSONObject; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.cus.HTUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Author:DTY-PC + * Date:2020/10/21 13:53 + * Description: 自定义流程提交代理 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class RequestSubCmd extends AbstractCommandProxy> { + private Log log = LogFactory.getLog(this.getClass()); + @Override + public Map execute(Command> targetCommand) { + BaseBean baseBean = new BaseBean(); + //获取到被代理对象 + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String src = Util.null2String(request.getParameter("src")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + //联合出差申请创建节点 + String unionwfidNum = Util.null2String(new PropBean().getPropName("unionwfid")); + String wfidStr = Util.null2String(new PropBean().getWorkflowIdsByUnNumber(unionwfidNum)); + List listWF = Arrays.asList(wfidStr.split(",")); + if (listWF.contains(workflowid) && nodetype.equals("0")) {// 联合出差申请创建节点 + String type = Util.null2String(resultBean.getType()); + if ("SUCCESS".equalsIgnoreCase(type)) {//成功 + HTUtil htUtil = new HTUtil(); + Map paras = new HashMap<>(); + if ("save".equalsIgnoreCase(src) || "dostopc".equalsIgnoreCase(src)) {//保存 终止 + Map submitParams = resultBean.getSubmitParams(); + if ("-1".equals(requestid)) { + requestid = Util.null2String(submitParams.get("requestid"));// + } + if ("save".equalsIgnoreCase(src)) { + paras.put("status", "DRAFT"); + } else { + paras.put("status", "TERMINATION"); + } + paras.put("requestid", requestid); + String res = htUtil.getSaveTripReqString(paras); + if (!"".equals(res) && !"-1".equals(res)) { + //开始调用保存行程接口 requestid + log.info("=====RequestSubCmd======"); + log.info("=====开始调用保存行程接口, requestid是: "+requestid+"======"); + boolean isSucc = htUtil.saveTrip(res); + } + } + } + } + //联合差旅报销 + String unionReWfidNum = Util.null2String(new PropBean().getPropName("unionReWfid")); + String ReWfidStr = Util.null2String(new PropBean().getWorkflowIdsByUnNumber(unionReWfidNum)); + List listREWF = Arrays.asList(ReWfidStr.split(",")); + if (listREWF.contains(workflowid) && "dostopc".equalsIgnoreCase(src)) { + HTUtil ht = new HTUtil(); + String tableName = ht.getTableNameByWfid(Util.getIntValue(listREWF.get(0))); + if (!"".equals(tableName)) { + ResourceComInfo rc = null; + try { + rc = new ResourceComInfo(); + } catch (Exception e) { + e.printStackTrace(); + } + String tableDt4Name = tableName + "_dt4"; + String tableDt5Name = tableName + "_dt5"; + String tableDt6Name = tableName + "_dt6"; + String tableDt7Name = tableName + "_dt7"; + String sql = "select id,lcbh,ngr from " + tableName + " where requestid = " + requestid; + RecordSet rs = new RecordSet(); + rs.execute(sql); + rs.next(); + int mianid = Util.getIntValue(rs.getString("id"));//主表id + String lcbh = Util.null2String(rs.getString("lcbh"));//流程编号 + String ngr = Util.null2String(rs.getString("ngr"));//拟稿人 + String workcode = rc.getWorkcode(ngr);//工号 + sql = "select wjid,fphm,fpdm from " + tableDt4Name + " where mainid = " + mianid; + rs.execute(sql); + while (rs.next()) { + String wjid = Util.null2String(rs.getString("wjid"));//文件id + String fphm = Util.null2String(rs.getString("fphm"));//发票号码 + String fpdm = Util.null2String(rs.getString("fpdm"));//发票代码 + Map params = new HashMap<>(); + params.put("UserCode", workcode); + params.put("FileID", wjid); + params.put("InvoiceNum", fphm); + params.put("InvoiceCode", fpdm); + params.put("BillID", lcbh); + String res = ht.resetImageAndBill(params); + JSONObject resObj = JSONObject.parseObject(res); + String code = Util.null2String(resObj.get("ReCode"));//1:成功 + String msg = Util.null2String(resObj.get("ReMsg")); + if (!"1".equals(code)) { + baseBean.writeLog("明细4文件ID为:" + wjid + "的重置单据关系失败!-->"+msg); + } + } + + sql = "select wjid,fphm,fpdm from " + tableDt5Name + " where mainid = " + mianid; + rs.execute(sql); + while (rs.next()) { + String wjid = Util.null2String(rs.getString("wjid"));//文件id + String fphm = Util.null2String(rs.getString("fphm"));//发票号码 + String fpdm = Util.null2String(rs.getString("fpdm"));//发票代码 + Map params = new HashMap<>(); + params.put("UserCode", workcode); + params.put("FileID", wjid); + params.put("InvoiceNum", fphm); + params.put("InvoiceCode", fpdm); + params.put("BillID", lcbh); + String res = ht.resetImageAndBill(params); + JSONObject resObj = JSONObject.parseObject(res); + String code = Util.null2String(resObj.get("ReCode"));//1:成功 + String msg = Util.null2String(resObj.get("ReMsg")); + if (!"1".equals(code)) { + baseBean.writeLog("明细5文件ID为:" + wjid + "的重置单据关系失败!-->"+msg); + } + } + + sql = "select wjid,fphm,fpdm from " + tableDt6Name + " where mainid = " + mianid; + rs.execute(sql); + while (rs.next()) { + String wjid = Util.null2String(rs.getString("wjid"));//文件id + String fphm = Util.null2String(rs.getString("fphm"));//发票号码 + String fpdm = Util.null2String(rs.getString("fpdm"));//发票代码 + Map params = new HashMap<>(); + params.put("UserCode", workcode); + params.put("FileID", wjid); + params.put("InvoiceNum", fphm); + params.put("InvoiceCode", fpdm); + params.put("BillID", lcbh); + String res = ht.resetImageAndBill(params); + JSONObject resObj = JSONObject.parseObject(res); + String code = Util.null2String(resObj.get("ReCode"));//1:成功 + String msg = Util.null2String(resObj.get("ReMsg")); + if (!"1".equals(code)) { + baseBean.writeLog("明细6文件ID为:" + wjid + "的重置单据关系失败!-->"+msg); + } + } + + sql = "select wjid from " + tableDt7Name + " where mainid = " + mianid; + rs.execute(sql); + while (rs.next()) { + String wjid = Util.null2String(rs.getString("wjid"));//文件id + Map params = new HashMap<>(); + params.put("UserCode", workcode); + params.put("FileID", wjid); + params.put("InvoiceNum", ""); + params.put("InvoiceCode", ""); + params.put("BillID", lcbh); + String res = ht.resetImageAndBill(params); + JSONObject resObj = JSONObject.parseObject(res); + String code = Util.null2String(resObj.get("ReCode"));//1:成功 + String msg = Util.null2String(resObj.get("ReMsg")); + if (!"1".equals(code)) { + baseBean.writeLog("明细7文件ID为:" + wjid + "的重置单据关系失败!-->"+msg); + } + } + + } + } + return result; + } +} diff --git a/src/main/java/com/customization/htsc/cus/SfxzdjTriggerFlowCmd.java b/src/main/java/com/customization/htsc/cus/SfxzdjTriggerFlowCmd.java new file mode 100644 index 0000000..9dbeae5 --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/SfxzdjTriggerFlowCmd.java @@ -0,0 +1,58 @@ +package com.customization.htsc.cus; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.sfxzdj.service.impl.SfxzdjServiceImpl; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.interfaces.htsc.GlobatTools.JAVATools; +import weaver.interfaces.htsc.comInfo.PropBean; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * 触发流程 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class SfxzdjTriggerFlowCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String src = Util.null2String(request.getParameter("src")); + String remark = Util.HTMLtoTxt(Util.null2String(request.getParameter("remark"))).trim(); + String operator = Util.null2String(request.getParameter("f_weaver_belongto_userid")); + PropBean pb = new PropBean(); + String sfxzdj_workflowid = pb.getPropName("sfxzdj_workflowid"); + + JAVATools.writelog("司法协助登记cmdsfxzdj_workflowid"+sfxzdj_workflowid); + String sfxzdj_nodeid = pb.getPropName("sfxzdj_nodeid"); + JAVATools.writelog("司法协助登记cmdsfxzdj_nodeid"+sfxzdj_nodeid); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + + if ("SUCCESS".equals(executeResult) && "submit".equals(src)) { + if(workflowid.equals(sfxzdj_workflowid)&&sfxzdj_nodeid.equals(nodeid) ){ + SfxzdjServiceImpl service = new SfxzdjServiceImpl(); + HashMap map = new HashMap<>(); + map.put("requestid",requestid); + map.put("user",operator); + JAVATools.writelog("司法协助登记cmd"+map.toString()); + service.triggerFlow(map); + } + + } + + return result; + } +} diff --git a/src/main/java/com/customization/htsc/cus/WfStopNoticeRequestSubCmd.java b/src/main/java/com/customization/htsc/cus/WfStopNoticeRequestSubCmd.java new file mode 100644 index 0000000..1f95afa --- /dev/null +++ b/src/main/java/com/customization/htsc/cus/WfStopNoticeRequestSubCmd.java @@ -0,0 +1,91 @@ +package com.customization.htsc.cus; + +import com.cloudstore.dev.api.bean.MessageBean; +import com.cloudstore.dev.api.bean.MessageType; +import com.cloudstore.dev.api.util.Util_Message; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; + +import javax.servlet.http.HttpServletRequest; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Author:wanxq + * Date:2021/1/05 14:53 + * Description: 流程终止发送通知 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class WfStopNoticeRequestSubCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String requestid = Util.null2String(request.getParameter("requestid")); + String src = Util.null2String(request.getParameter("src")); + String operator = Util.null2String(request.getParameter("f_weaver_belongto_userid")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + + if("SUCCESS".equals(executeResult) && "dostopc".equals(src)){ + Set userIdSet = new HashSet(); // 消息接收人员集合 + RecordSet rs = new RecordSet(); + //流程参与人员 + rs.executeQuery(" select distinct userid from workflow_currentoperator where requestid=? ",new Object[]{requestid}); + while(rs.next()){ + String userid = Util.null2String(rs.getString("userid")); + userIdSet.add(userid); + } + + //发送消息 + try { + + rs.executeQuery(" select * from workflow_requestbase where requestid=? ",new Object[]{requestid}); + rs.next(); + String requestmark = Util.null2String(rs.getString("requestmark")); + String requestName = Util.null2String(rs.getString("requestname")); + + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String operatorName = resourceComInfo.getLastname(operator); + + PropBean propBean = new PropBean(); + int typecode = Util.getIntValue(propBean.getPropName("wfStopMsgTypeCode"),1303); + MessageType messageType = MessageType.newInstance(typecode); // 消息来源 + + String title = "流程终止提醒"; // 标题 + String context = "注意!您审核的 “"+requestName+"”("+requestmark+")已被"+operatorName+"终止,请知悉,您可点击查看详情"; + String linkUrl = "/spa/workflow/static4form/index.html#/main/workflow/req?requestid="+requestid+"&ismonitor=1"; // PC端链接 + String linkMobileUrl = "/spa/workflow/static4mobileform/index.html#/req?requestid="+requestid+"&ismonitor=1"; // 移动端链接 + + MessageBean messageBean = Util_Message.createMessage(messageType, userIdSet, title, context, linkUrl, linkMobileUrl); + messageBean.setCreater(1);// 创建人id + Util_Message.store(messageBean); + + }catch (Exception e){ + e.printStackTrace(); + } + + } + + return result; + } + + + + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/integration/PushDataThread.java b/src/main/java/com/customization/htsc/integration/PushDataThread.java new file mode 100644 index 0000000..76d37aa --- /dev/null +++ b/src/main/java/com/customization/htsc/integration/PushDataThread.java @@ -0,0 +1,227 @@ +package com.customization.htsc.integration; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.engine.htsc.payment.util.HttpUtil; +import com.engine.htsc.workflow.util.WorkflowUtil; +import weaver.conn.RecordSet; +import weaver.filter.WeaverRequest; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.util.HttpRequestUtil; +import weaver.workflow.workflow.WorkflowComInfo; + +import javax.ws.rs.HEAD; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PushDataThread implements Runnable{ + + private WeaverRequest request; + + public PushDataThread(WeaverRequest request) { + this.request = request; + } + + + /** + * "title": "标题333444", + * "todoid": "345678", + * "userid": "zhangsan,suhf", + * "qcuserid": "wangwu", + * "qcusername": "王五", + * "tododescribe": "用印申请123", + * "createdate": "2016-05-26 12:23:23", + * "receivedate": "2018-05-26 12:23:23", + * "contenttype": "1", + * "todostate": "0", + * "flowstate": "已办结", + * "links": "http://xxx.xxx.com.cn/xxxxxx", + * "mlinks": "http://yyy.yyyy.com.cn/yyyyyy", + * "qcuserdeptid": "445566", + * "qcuserdeptname": "测试部门111", + * "todocode": "XYZ111333", + * "todotype": "我处理的" + */ + + @Override + public void run() { + try { + + PropBean pb = new PropBean(); + BaseBean bb = new BaseBean(); + WorkflowUtil workflowUtil = new WorkflowUtil(); + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String nodetype = this.request.getParameter("nodetype"); + String nodeid = this.request.getParameter("nodeid"); + String src = this.request.getParameter("src"); + String isremark = this.request.getParameter("isremark"); + + String title = this.request.getParameter("requestname"); + String todoid = this.request.getParameter("requestid"); + + String workflowid = this.request.getParameter("workflowid"); + WorkflowComInfo workflowComInfo = new WorkflowComInfo(); + String tododescribe = workflowComInfo.getWorkflowname(workflowid); + + String userid = this.request.getParameter("f_weaver_belongto_userid"); + String usercode = resourceComInfo.getWorkcode(userid); + + //给代理人创建已办信息 + bb.writeLog("PushDataThread getAgentInfo====="+todoid+" "+userid+" "+nodeid); + String bagentCodes = workflowUtil.getAgentInfo(todoid,userid,nodeid); + if(!"".equals(bagentCodes)){ + usercode += ","+bagentCodes; + } + + + RecordSet rs = new RecordSet(); + rs.executeQuery(" select currentnodetype,creater,createdate,createtime,lastoperatedate,lastoperatetime,requestmark " + + "from workflow_requestbase where requestid=? ",new Object[]{todoid}); + rs.next(); + String creater = Util.null2String(rs.getString("creater")); + String createdate = Util.null2String(rs.getString("createdate"))+" "+Util.null2String(rs.getString("createtime"));; + String receivedate = ""; + String contenttype = "1"; + String todostate = "0"; + + String qcuserid = Util.null2String(this.request.getParameter("creater")); + if("".equals(qcuserid)){ + qcuserid = creater; + } + String qcusercode = resourceComInfo.getWorkcode(qcuserid); + String qcusername = resourceComInfo.getLastname(qcuserid); + + + String flowstate = ""; + String currentnodetype = Util.null2String(rs.getString("currentnodetype")); + if("3".equals(currentnodetype)){ + flowstate = "已办结"; + receivedate = Util.null2String(rs.getString("lastoperatedate"))+" "+Util.null2String(rs.getString("lastoperatetime")); + + }else { + flowstate = "进行中"; + } + + String oahost = pb.getPropName("OAHOST"); + String links = oahost+"workflow/request/ViewRequestForwardSPA.jsp?requestid="+todoid+"&_workflowid="+workflowid+"&f_weaver_belongto_userid="+userid; + + String mobileHost = pb.getPropName("mobileHost"); + String mobileJumpUrl = pb.getPropName("mobileJumpUrl"); + String mlinks = mobileHost+mobileJumpUrl+"?requestid="+todoid+"&f_weaver_belongto_userid="+userid; + + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + String qcuserdeptid = resourceComInfo.getDepartmentID(qcuserid); + String qcuserdeptcode = departmentComInfo.getDepartmentCode(qcuserdeptid); + String qcuserdeptname = departmentComInfo.getDepartmentName(qcuserdeptid); + + String todocode = Util.null2String(rs.getString("requestmark")); + String todotype = ""; + if("submit".equals(src) || "reject".equals(src)){ + if("0".equals(nodetype)){ + todotype = "我发起的"; + }else{ + todotype = "我处理的"; + } + + }else{ + if("1".equals(isremark)){ + todotype = "他人移交"; + }else if("8".equals(isremark) || "9".equals(isremark)){ + todotype = "通知阅读"; + } + } + String lstusername = workflowUtil.getUnoperators(todoid,userid); + + Map dataMap = new HashMap<>(); + dataMap.put("title",title); + dataMap.put("todoid",todoid); + dataMap.put("userid",usercode); + dataMap.put("qcuserid",qcusercode); + dataMap.put("qcusername",qcusername); + dataMap.put("lstusername",lstusername); + dataMap.put("tododescribe",tododescribe); + dataMap.put("createdate",createdate); + dataMap.put("receivedate",receivedate); + dataMap.put("contenttype",contenttype); + dataMap.put("todostate",todostate); + dataMap.put("flowstate",flowstate); + dataMap.put("links",links); + dataMap.put("mlinks",mlinks); + dataMap.put("qcuserdeptid",qcuserdeptcode); + dataMap.put("qcuserdeptname",qcuserdeptname); + dataMap.put("todocode",todocode); + dataMap.put("todotype",todotype); + + List> dataList = new ArrayList<>(); + dataList.add(dataMap); + + Map paramsMap = new HashMap<>(); + paramsMap.put("systemtype","HTOA"); + paramsMap.put("todojson", JSON.toJSONString(dataList)); + + String addUrl = Util.null2String(pb.getPropName("PortalAddDoneDataUrl"),"http://168.61.9.228:8080/wps/TodoRest/todo/addtodo"); + + bb.writeLog("PushDataThread addparams===="+JSON.toJSONString(paramsMap)); + bb.writeLog("PushDataThread addurl===="+addUrl); + + String addResult = HttpUtil.postFormUrlEncode(addUrl,paramsMap); + bb.writeLog("PushDataThread addResult===="+addResult); + + //更新已办数据, + dataList.clear(); + dataMap.remove("todotype"); + dataMap.remove("todostate"); + dataMap.remove("links"); + dataMap.remove("mlinks"); + dataMap.remove("receivedate"); + dataMap.remove("createdate"); + dataMap.remove("tododescribe"); + dataMap.put("userid","ALL"); + dataList.add(dataMap); + paramsMap.put("todojson",JSON.toJSONString(dataList)); + bb.writeLog("PushDataThread updateparams===="+JSON.toJSONString(paramsMap)); + String updateUrl = Util.null2String(pb.getPropName("PortalUpdateDoneDataUrl"),"http://168.61.9.228:8080/wps/TodoRest/todo/updatetodo"); + String updateResult = HttpUtil.postFormUrlEncode(updateUrl,paramsMap); + bb.writeLog("PushDataThread updateResult===="+updateResult); + + + + + } catch (Exception e) { + e.printStackTrace(); + } + + + + } + + + + + + public static void main(String[] args) throws Exception { + HttpRequestUtil httpRequestUtil = new HttpRequestUtil(); + String url = "http://168.61.9.228:8080/wps/TodoRest/todo/addtodo"; + String params = "{\"todojson\":\"[{\\\"qcuserid\\\":\\\"011413\\\",\\\"qcusername\\\":\\\"蔡洋\\\",\\\"todostate\\\":\\\"0\\\",\\\"tododescribe\\\":\\\"总部重要事项\\\",\\\"createdate\\\":\\\"2021-03-18 17:34:24\\\",\\\"title\\\":\\\"测试门户已办\\\",\\\"userid\\\":\\\"011413\\\",\\\"contenttype\\\":\\\"1\\\",\\\"mlinks\\\":\\\"http://linkxt-test.htsc.com.cn:38080/htmoa/wxapi/wxclientmenu/7bfc8bd866a74b0788f6c205a8668877?requestid=4906903&f_weaver_belongto_userid=28302\\\",\\\"flowstate\\\":\\\"进行中\\\",\\\"qcuserdeptid\\\":\\\"ZZ001014\\\",\\\"todotype\\\":\\\"我发起的\\\",\\\"receivedate\\\":\\\"2021-03-18 17:34:59\\\",\\\"todocode\\\":\\\"申报单信20210318104848\\\",\\\"links\\\":\\\"http://168.61.8.169:8080/htoa/workflow/request/ViewRequestForwardSPA.jsp?requestid=4906903&_workflowid=24&f_weaver_belongto_userid=28302\\\",\\\"qcuserdeptname\\\":\\\"信息技术部\\\"}]\",\"systemtype\":\"oa\"}\n"; + JSONObject json = JSON.parseObject(params); + String systemtype = json.getString("systemtype"); + String todojson = json.getString("todojson"); + Map paramsMap = new HashMap<>(); + paramsMap.put("systemtype",systemtype); + paramsMap.put("todojson", todojson); + + Map header = new HashMap<>(); + header.put("Content-Type","application/x-www-form-urlencoded;charset=utf-8"); + System.out.println(todojson); + String result = HttpUtil.postFormUrlEncode(url,paramsMap,header); + System.out.println(result); + } + + +} diff --git a/src/main/java/com/customization/htsc/integration/PushForwardDataThread.java b/src/main/java/com/customization/htsc/integration/PushForwardDataThread.java new file mode 100644 index 0000000..475317d --- /dev/null +++ b/src/main/java/com/customization/htsc/integration/PushForwardDataThread.java @@ -0,0 +1,207 @@ +package com.customization.htsc.integration; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.engine.htsc.payment.util.HttpUtil; +import com.engine.htsc.workflow.util.WorkflowUtil; +import weaver.conn.RecordSet; +import weaver.filter.WeaverRequest; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.util.HttpRequestUtil; +import weaver.workflow.workflow.WorkflowComInfo; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PushForwardDataThread implements Runnable{ + + private WeaverRequest request; + + public PushForwardDataThread(WeaverRequest request) { + this.request = request; + } + + /** + * "title": "标题333444", + * "todoid": "345678", + * "userid": "zhangsan,suhf", + * "qcuserid": "wangwu", + * "qcusername": "王五", + * "tododescribe": "用印申请123", + * "createdate": "2016-05-26 12:23:23", + * "receivedate": "2018-05-26 12:23:23", + * "contenttype": "1", + * "todostate": "0", + * "flowstate": "已办结", + * "links": "http://xxx.xxx.com.cn/xxxxxx", + * "mlinks": "http://yyy.yyyy.com.cn/yyyyyy", + * "qcuserdeptid": "445566", + * "qcuserdeptname": "测试部门111", + * "todocode": "XYZ111333", + * "todotype": "我处理的" + */ + + @Override + public void run() { + try { + + PropBean pb = new PropBean(); + BaseBean bb = new BaseBean(); + WorkflowUtil workflowUtil = new WorkflowUtil(); + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String nodeid = this.request.getParameter("nodeid"); + String operate = this.request.getParameter("operate"); + + String todoid = this.request.getParameter("requestid"); + String workflowid = this.request.getParameter("workflowid"); + WorkflowComInfo workflowComInfo = new WorkflowComInfo(); + String tododescribe = workflowComInfo.getWorkflowname(workflowid); + + String userid = this.request.getParameter("f_weaver_belongto_userid"); + String usercode = resourceComInfo.getWorkcode(userid); + + //给代理人创建已办信息 + String bagentCodes = workflowUtil.getAgentInfo(todoid,userid,nodeid); + if(!"".equals(bagentCodes)){ + usercode += ","+bagentCodes; + } + + + + RecordSet rs = new RecordSet(); + rs.executeQuery(" select requestname,creater,currentnodetype,createdate,createtime," + + " lastoperatedate,lastoperatetime,requestmark " + + " from workflow_requestbase where requestid=? ",new Object[]{todoid}); + rs.next(); + String title = Util.null2String(rs.getString("requestname")); + String qcuserid = Util.null2String(rs.getString("creater")); + String qcusercode = resourceComInfo.getWorkcode(qcuserid); + String qcusername = resourceComInfo.getLastname(qcuserid); + + String createdate = Util.null2String(rs.getString("createdate"))+" "+Util.null2String(rs.getString("createtime"));; + //String receivedate = Util.null2String(rs.getString("lastoperatedate"))+" "+Util.null2String(rs.getString("lastoperatetime"));; + String receivedate = ""; + + String contenttype = "1"; + String todostate = "0"; + + String flowstate = ""; + String currentnodetype = Util.null2String(rs.getString("currentnodetype")); + if("3".equals(currentnodetype)){ + flowstate = "已办结"; + receivedate = Util.null2String(rs.getString("lastoperatedate"))+" "+Util.null2String(rs.getString("lastoperatetime"));; + }else { + flowstate = "进行中"; + } + + String oahost = pb.getPropName("OAHOST"); + String links = oahost+"workflow/request/ViewRequestForwardSPA.jsp?requestid="+todoid+"&_workflowid="+workflowid+"&f_weaver_belongto_userid="+userid; + + String mobileHost = pb.getPropName("mobileHost"); + String mobileJumpUrl = pb.getPropName("mobileJumpUrl"); + String mlinks = mobileHost+mobileJumpUrl+"?requestid="+todoid+"&f_weaver_belongto_userid="+userid; + + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + String qcuserdeptid = resourceComInfo.getDepartmentID(qcuserid); + String qcuserdeptcode = departmentComInfo.getDepartmentCode(qcuserdeptid); + String qcuserdeptname = departmentComInfo.getDepartmentName(qcuserdeptid); + + String todocode = Util.null2String(rs.getString("requestmark")); + String todotype = "我处理的"; + + + String lstusername = workflowUtil.getUnoperators(todoid,userid); + + Map dataMap = new HashMap<>(); + dataMap.put("title",title); + dataMap.put("todoid",todoid); + dataMap.put("userid",usercode); + dataMap.put("qcuserid",qcusercode); + dataMap.put("qcusername",qcusername); + dataMap.put("lstusername",lstusername); + dataMap.put("tododescribe",tododescribe); + dataMap.put("createdate",createdate); + dataMap.put("receivedate",receivedate); + dataMap.put("contenttype",contenttype); + dataMap.put("todostate",todostate); + dataMap.put("flowstate",flowstate); + dataMap.put("links",links); + dataMap.put("mlinks",mlinks); + dataMap.put("qcuserdeptid",qcuserdeptcode); + dataMap.put("qcuserdeptname",qcuserdeptname); + dataMap.put("todocode",todocode); + dataMap.put("todotype",todotype); + + List> dataList = new ArrayList<>(); + dataList.add(dataMap); + + Map paramsMap = new HashMap<>(); + paramsMap.put("systemtype","HTOA"); + paramsMap.put("todojson", JSON.toJSONString(dataList)); + + String addUrl = Util.null2String(pb.getPropName("PortalAddDoneDataUrl"),"http://168.61.9.228:8080/wps/TodoRest/todo/addtodo"); + + bb.writeLog("PushForwardDataThread addparams===="+JSON.toJSONString(paramsMap)); + bb.writeLog("PushForwardDataThread addurl===="+addUrl); + + String addResult = HttpUtil.postFormUrlEncode(addUrl,paramsMap); + bb.writeLog("PushForwardDataThread addResult===="+addResult); + + //更新已办数据, + dataList.clear(); + dataMap.remove("todotype"); + dataMap.remove("todostate"); + dataMap.remove("links"); + dataMap.remove("mlinks"); + dataMap.remove("receivedate"); + dataMap.remove("createdate"); + dataMap.remove("tododescribe"); + dataMap.put("userid","ALL"); + dataList.add(dataMap); + paramsMap.put("todojson",JSON.toJSONString(dataList)); + String updateUrl = Util.null2String(pb.getPropName("PortalUpdateDoneDataUrl"),"http://168.61.9.228:8080/wps/TodoRest/todo/updatetodo"); + String updateResult = HttpUtil.postFormUrlEncode(updateUrl,paramsMap); + bb.writeLog("PushForwardDataThread updateResult===="+updateResult); + + + + + } catch (Exception e) { + e.printStackTrace(); + } + + + + } + + + + + + public static void main(String[] args) throws Exception { + HttpRequestUtil httpRequestUtil = new HttpRequestUtil(); + String url = "http://168.61.9.228:8080/wps/TodoRest/todo/addtodo"; + String params = "{\"todojson\":\"[{\\\"qcuserid\\\":\\\"011413\\\",\\\"qcusername\\\":\\\"蔡洋\\\",\\\"todostate\\\":\\\"0\\\",\\\"tododescribe\\\":\\\"总部重要事项\\\",\\\"createdate\\\":\\\"2021-03-18 17:34:24\\\",\\\"title\\\":\\\"测试门户已办\\\",\\\"userid\\\":\\\"011413\\\",\\\"contenttype\\\":\\\"1\\\",\\\"mlinks\\\":\\\"http://linkxt-test.htsc.com.cn:38080/htmoa/wxapi/wxclientmenu/7bfc8bd866a74b0788f6c205a8668877?requestid=4906903&f_weaver_belongto_userid=28302\\\",\\\"flowstate\\\":\\\"进行中\\\",\\\"qcuserdeptid\\\":\\\"ZZ001014\\\",\\\"todotype\\\":\\\"我发起的\\\",\\\"receivedate\\\":\\\"2021-03-18 17:34:59\\\",\\\"todocode\\\":\\\"申报单信20210318104848\\\",\\\"links\\\":\\\"http://168.61.8.169:8080/htoa/workflow/request/ViewRequestForwardSPA.jsp?requestid=4906903&_workflowid=24&f_weaver_belongto_userid=28302\\\",\\\"qcuserdeptname\\\":\\\"信息技术部\\\"}]\",\"systemtype\":\"oa\"}\n"; + JSONObject json = JSON.parseObject(params); + String systemtype = json.getString("systemtype"); + String todojson = json.getString("todojson"); + Map paramsMap = new HashMap<>(); + paramsMap.put("systemtype",systemtype); + paramsMap.put("todojson", todojson); + + Map header = new HashMap<>(); + header.put("Content-Type","application/x-www-form-urlencoded;charset=utf-8"); + System.out.println(todojson); + String result = HttpUtil.postFormUrlEncode(url,paramsMap,header); + System.out.println(result); + } + + +} diff --git a/src/main/java/com/customization/htsc/integration/PushFowardDoneDataCmd.java b/src/main/java/com/customization/htsc/integration/PushFowardDoneDataCmd.java new file mode 100644 index 0000000..4460cad --- /dev/null +++ b/src/main/java/com/customization/htsc/integration/PushFowardDoneDataCmd.java @@ -0,0 +1,48 @@ +package com.customization.htsc.integration; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.ForwardSubmitCmd; +import weaver.general.Util; +import weaver.filter.WeaverRequest; +import weaver.workflow.request.WFAutoApproveThreadPoolUtil; +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +/** + * Author:wanxq + * Date:2021/3/25 16:53 + * Description: 集成门户统一已办 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = ForwardSubmitCmd.class, desc = "转办提交后将已办数据推送到门户") +public class PushFowardDoneDataCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + ForwardSubmitCmd forwardSubmitCmd = (ForwardSubmitCmd) targetCommand; + HttpServletRequest request = forwardSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String forwardflag = Util.null2String(request.getParameter("forwardflag")); + //System.out.println("PushFowardDoneDataCmd=====forwardflag==="+ forwardflag); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + //System.out.println("PushFowardDoneDataCmd====="+ JSON.toJSONString(result)); + boolean exeResult = (boolean) result.get("success"); + + //3:转办 2:意见征询 + if(exeResult && ("2".equals(forwardflag) || "3".equals(forwardflag) || "5".equals(forwardflag) )){ + //创建线程处理已办数据推送 + WeaverRequest weaverRequest = new WeaverRequest(request); + PushForwardDataThread pushForwardDataThread = new PushForwardDataThread(weaverRequest); + WFAutoApproveThreadPoolUtil.getFixedThreadPool().execute(pushForwardDataThread); + + } + + return result; + } + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/integration/PushNshfDoneDataCmd.java b/src/main/java/com/customization/htsc/integration/PushNshfDoneDataCmd.java new file mode 100644 index 0000000..47c902d --- /dev/null +++ b/src/main/java/com/customization/htsc/integration/PushNshfDoneDataCmd.java @@ -0,0 +1,45 @@ +package com.customization.htsc.integration; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RemarkSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.filter.WeaverRequest; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.workflow.request.WFAutoApproveThreadPoolUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +/** + * Author:wanxq + * Date:2021/04/01 19:53 + * Description: 集成门户统一已办 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RemarkSubmitCmd.class, desc = "集成门户统一已办") +public class PushNshfDoneDataCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + BaseBean bb = new BaseBean(); + RemarkSubmitCmd remarkSubmitCmd = (RemarkSubmitCmd) targetCommand; + HttpServletRequest request = remarkSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + + if("SUCCESS".equals(executeResult)){ + //创建线程处理已办数据推送 + WeaverRequest weaverRequest = new WeaverRequest(request); + PushDataThread pushDataThread = new PushDataThread(weaverRequest); + WFAutoApproveThreadPoolUtil.getFixedThreadPool().execute(pushDataThread); + } + + return result; + } + + +} diff --git a/src/main/java/com/customization/htsc/integration/PushWorflowDoneDataCmd.java b/src/main/java/com/customization/htsc/integration/PushWorflowDoneDataCmd.java new file mode 100644 index 0000000..d288c55 --- /dev/null +++ b/src/main/java/com/customization/htsc/integration/PushWorflowDoneDataCmd.java @@ -0,0 +1,60 @@ +package com.customization.htsc.integration; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.filter.WeaverRequest; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.workflow.request.WFAutoApproveThreadPoolUtil; +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * Author:wanxq + * Date:2021/3/17 14:53 + * Description: 集成门户统一已办 + * Copyright:上海泛微网络科技股份有限公司 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "集成门户统一已办") +public class PushWorflowDoneDataCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + BaseBean bb = new BaseBean(); + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String src = Util.null2String(request.getParameter("src")); + String isremark = Util.null2String(request.getParameter("isremark")); + String takisremark = Util.null2String(request.getParameter("takisremark")); + + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + + bb.writeLog("PushWorflowDoneDataCmd ======executeResult:"+executeResult+" src=="+src+" ===isremark:"+isremark+" ====takisremark:"+takisremark); + + + if("SUCCESS".equals(executeResult)){ + //submit:正常提交 save: isremark 1、8、9转发、抄送 takisremark 2 意见征询 + if("submit".equals(src) || "reject".equals(src) + || ( "save".equals(src) && ("1".equals(isremark) || "8".equals(isremark) + || "9".equals(isremark) || "2".equals(takisremark)) )){ + //创建线程处理已办数据推送 + WeaverRequest weaverRequest = new WeaverRequest(request); + PushDataThread pushDataThread = new PushDataThread(weaverRequest); + WFAutoApproveThreadPoolUtil.getFixedThreadPool().execute(pushDataThread); + } + + } + + return result; + } + + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestRemarkSubmitFjCmd.java b/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestRemarkSubmitFjCmd.java new file mode 100644 index 0000000..04d8ce3 --- /dev/null +++ b/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestRemarkSubmitFjCmd.java @@ -0,0 +1,80 @@ +package com.customization.htsc.jgxtlc; + +/** + * @author xf + * @version 1.0.0 + * @ClassName JgxtlcRequestRemarkSubmitFjCmd.java + * @createTime 2021年10月28日 19:51:00 + */ + +import com.engine.common.util.ParamUtil; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RemarkSubmitCmd; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.htsc.GlobatTools.JAVATools; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +@CommandDynamicProxy(target = RemarkSubmitCmd.class, desc = "监管协同流程流程提交更新主表附件") +public class JgxtlcRequestRemarkSubmitFjCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> command) { + + BaseBean bb = new BaseBean(); + JAVATools.SetCmdwritelog("RemarkSubmitCmd:ceshi"); + RecordSet rs = new RecordSet(); + RemarkSubmitCmd remarkSubmitCmd = (RemarkSubmitCmd) command; + HttpServletRequest request = remarkSubmitCmd.getRequest(); //从request中可以取到参数,不用以前的方法了 + Map param = ParamUtil.request2Map(request); + for (String key:param.keySet()){ + JAVATools.SetCmdwritelog("测试jgxt:"+key+param.get(key)); + } + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String formid = Util.null2String(request.getParameter("formid")) ; + + String src = Util.null2String(request.getParameter("src")); + bb.writeLog("requestid:"+requestid); + bb.writeLog("workflowid:"+workflowid ); + bb.writeLog("src:"+src); + Map result = nextExecute(command);; + try{ + + if(!"".equals(nodeid)) + { + int current_nodeid = Util.getIntValue(nodeid); + if("save".equals(src) && current_nodeid < 0) + { + bb.writeLog("3333333"); + if(!"".equals(workflowid)){ + String unnumber = "" ; + String sql = " select unnumber from workflow_base where id="+workflowid; + rs.execute(sql); + if(rs.next()){ + unnumber = Util.null2String(rs.getString("unnumber")); + } + bb.writeLog("unnumber:"+unnumber); + if("jgxtsq".equals(unnumber)){ + sql = " update formtable_main_"+Math.abs(Util.getIntValue(formid))+" set fkfj='' where requestid="+requestid; + boolean flag = rs.execute(sql); + bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd---flag:"+flag); + } + } + }else{ + bb.writeLog("4444444:"); + } + } + }catch (Exception e){ + bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd:"+e); + } + return result; + } + + +} diff --git a/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestSubmitUpdateFjCmd.java b/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestSubmitUpdateFjCmd.java new file mode 100644 index 0000000..c1b5e54 --- /dev/null +++ b/src/main/java/com/customization/htsc/jgxtlc/JgxtlcRequestSubmitUpdateFjCmd.java @@ -0,0 +1,83 @@ +package com.customization.htsc.jgxtlc; + +import com.engine.common.util.ParamUtil; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + + +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "监管协同流程流程提交更新主表附件") +public class JgxtlcRequestSubmitUpdateFjCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> command) { + + BaseBean bb = new BaseBean(); + bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd"); + RecordSet rs = new RecordSet(); + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) command; + HttpServletRequest request = requestSubmitCmd.getRequest(); //从request中可以取到参数,不用以前的方法了 + //Map param = ParamUtil.request2Map(request); + + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String formid = Util.null2String(request.getParameter("formid")) ; + + String src = Util.null2String(request.getParameter("src")); + bb.writeLog("requestid:"+requestid); + bb.writeLog("workflowid:"+workflowid ); + bb.writeLog("src:"+src); + Map result = nextExecute(command);; + try{ +// RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); +// Map messagemap = resultBean.getMessageInfo(); +// +// String isSuccess = Util.null2String(messagemap.get("isSuccess")); +// bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd---isSuccess:"+isSuccess); + + if(!"".equals(nodeid)) + { + int current_nodeid = Util.getIntValue(nodeid); + if(("submit".equals(src) || "reject".equals(src)) && current_nodeid < 0) + { + bb.writeLog("3333333"); + if(!"".equals(workflowid)){ + String unnumber = "" ; + String sql = " select unnumber from workflow_base where id="+workflowid; + rs.execute(sql); + if(rs.next()){ + unnumber = Util.null2String(rs.getString("unnumber")); + } + bb.writeLog("unnumber:"+unnumber); + if("jgxtsq".equals(unnumber)){ + sql = " update formtable_main_"+Math.abs(Util.getIntValue(formid))+" set fkfj='' where requestid="+requestid; + boolean flag = rs.execute(sql); + bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd---flag:"+flag); + } + } + }else{ + bb.writeLog("4444444:"); + } + } + }catch (Exception e){ + bb.writeLog("JgxtlcRequestSubmitUpdateFjCmd:"+e); + } + return result; + } + + + + + + + +} diff --git a/src/main/java/com/customization/htsc/lhywxz/LeaderSetMessageCmd.java b/src/main/java/com/customization/htsc/lhywxz/LeaderSetMessageCmd.java new file mode 100644 index 0000000..c0c89b7 --- /dev/null +++ b/src/main/java/com/customization/htsc/lhywxz/LeaderSetMessageCmd.java @@ -0,0 +1,270 @@ +package com.customization.htsc.lhywxz; + +import com.cloudstore.dev.api.bean.MessageBean; +import com.cloudstore.dev.api.bean.MessageType; +import com.cloudstore.dev.api.util.Util_Message; +import com.engine.common.util.ParamUtil; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.integration.util.StringUtils; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.htsc.GlobatTools.JAVATools; +import weaver.interfaces.htsc.comInfo.PropBean; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.*; + +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "领导审阅意见通知") +public class LeaderSetMessageCmd extends AbstractCommandProxy> { + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + + + @Override + public Map execute(Command> targetCommand) { + //获取到被代理对象 + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String src = Util.null2String(request.getParameter("src")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String type = Util.null2String(resultBean.getType()); + //加工 + bs.writeLog("==========领导审阅意见通知============"); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String lhqssp_workflowid = Util.null2String(pb.getPropName("lhqssp.workflowid")); + bs.writeLog("request.workflowid" + workflowid); + bs.writeLog("lhqssp.workflowid" + lhqssp_workflowid); + if ((workflowid.equals(lhqssp_workflowid)) && ("submit".equalsIgnoreCase(src) || "reject".equalsIgnoreCase(src)) && "SUCCESS".equalsIgnoreCase(type) && needNotice(request)) { + bs.writeLog("==========领导审阅意见通知触发============"); + try { + String remark = Util.null2String(request.getParameter("remark")); + remark = remark.replaceAll("[\\s\\t\\n\\r]", ""); + if (!("已阅".equals(remark) || "同意".equals(remark))) { + bs.writeLog("need notice"); + getMessageContext(request); + } + } catch (Exception e) { + e.printStackTrace(); + bs.writeLog("send leader notice error:", e); + } + } + return result; + } + + + /** + * 是否需要通知 + * @param request + * @return + */ + private boolean needNotice(HttpServletRequest request) { + Map map222 = ParamUtil.request2Map(request); + bs.writeLog("request中的参数:"+map222); + bs.writeLog("=======是否需要通知========"); + bs.writeLog("remark:" + request.getParameter("remark")); + bs.writeLog("workflowid:" + request.getParameter("workflowid")); + bs.writeLog("nodeid:" + request.getParameter("nodeid")); + bs.writeLog("requestid:" + request.getParameter("requestid")); + try { + //获取工作流程id + String workflowid = Util.null2String(request.getParameter("workflowid")); + //获取操作节点id + String nodeid = Util.null2String(request.getParameter("nodeid")); + //从配置信息获取公司收文领导审阅流程的UnNumber + String gsswldsy_workflowid = pb.getActiveWorkflowIdByUnNumber(pb.getPropName("lhqssp.unnumbe")); + //从配置信息获取公司收文领导审阅节点 + String gsswldsy_ldsy_nodeid = pb.getActionNodeIdByUnNumber(pb.getPropName("lhqssp.nodeunnumber.lhqssp_gsld")); + String lhqssq_xgrysh = Util.null2String(pb.getPropName("lhqssp.nodeunnumber.lhqssp_xgrysh")); + String operator = Util.null2String(request.getParameter("f_weaver_belongto_userid")); + bs.writeLog("f_weaver_belongto_userid:"+operator); + String agentorbyagentid = Util.null2String( request.getParameter("agentorByAgentId")); + bs.writeLog("agentorbyagentid:"+agentorbyagentid); + List departmentUserId = getDepartmentUserId(); + List xgryLeaderList = new ArrayList(); + //获取相关人员节点ID + String sql = "select id from workflow_nodebase where 1=1 "; + if (!StringUtils.isBlank(lhqssq_xgrysh)) { + sql += "and UNNUMBER ='" + lhqssq_xgrysh + "'"; + } + bs.writeLog(sql); + String remark = Util.null2String(request.getParameter("remark").trim()); + bs.writeLog("留言remark:"+remark); + //相关人员节点操作 + bs.writeLog("nodeid:"+nodeid); + Map map = JAVATools.GetTableToMap(sql, null); + String xgryNodeid = Util.null2String(map.get("id")); + if(xgryNodeid.equals(nodeid) && remark.length()>=5){ + if ((!"".equals(operator) && departmentUserId.contains(operator))){ + //当前节点操作者为公司领导 + xgryLeaderList.add(operator); + bs.writeLog("========领导直接操作============="); + }else{ + bs.writeLog("===========其他人员操作============"); + if(!"-1".equals(agentorbyagentid) && departmentUserId.contains(agentorbyagentid)){ + xgryLeaderList.add(agentorbyagentid); + bs.writeLog("=====领导代理人操作===="); + } + } + + } + if ((xgryLeaderList.size() > 0) || (workflowid.equals(gsswldsy_workflowid) && nodeid.equals(gsswldsy_ldsy_nodeid) && remark.length() >= 5)) { + bs.writeLog("====开启通知====="); + return true; + } + } catch (Exception e) { + e.printStackTrace(); + bs.writeLog("check notice need error:", e); + } + bs.writeLog("=====没有通知===="); + return false; + } + + /** + * 获得接收人id + * + * @param request + * @return + */ + private Set getSendUserId(HttpServletRequest request) { + Set sendIdSet = new HashSet<>(); + String lhqssq_xgrysh = Util.null2String(pb.getPropName("lhqssp.nodeunnumber.lhqssp_xgrysh")); + String lhqssq_gsld = Util.null2String(pb.getPropName("lhqssp.nodeunnumber.lhqssp_gsld")); + String requestid = Util.null2String(request.getParameter("requestid")); + //获取领导节点ID + String sql = "select id from workflow_nodebase where 1=1 "; + if (!StringUtils.isBlank(lhqssq_gsld)) { + sql += "and UNNUMBER ='" + lhqssq_gsld + "'"; + } + bs.writeLog(sql); + Map leaderIdMap = JAVATools.GetTableToMap(sql, null); + String leaderId = Util.null2String(leaderIdMap.get("id")); + //获取相关人员节点ID + String sql3 = "select id from workflow_nodebase where 1=1 "; + if (!StringUtils.isBlank(lhqssq_xgrysh)) { + sql3 += "and UNNUMBER ='" + lhqssq_xgrysh + "'"; + } + bs.writeLog(sql3); + Map xgryIdMap = JAVATools.GetTableToMap(sql3, null); + String xgryId = Util.null2String(xgryIdMap.get("id")); + //将所有人放入sendIdSet,除去领导,对代理人员进行判断 + String sql1 = " select agentorbyagentid,(select departmentid from hrmresource where id = agentorbyagentid ) as agentdepartmentid, " + + " nodeid,OPERATOR,(select departmentid from hrmresource where id = OPERATOR ) as userdepartmentid " + + " from workflow_requestlog " + + " where requestid='" + requestid + "'and nodeid not in ('" + leaderId + "') "; + bs.writeLog(sql1); + List> list = JAVATools.GetTableToListMap(sql1, null); + for (Map map : list) { + //操作者用户ID + String userid = Util.null2String(map.get("operator")); + sendIdSet.add(userid); + } + bs.writeLog(sendIdSet.size()); + //相关人员操作 + String sql2 = " select agentorbyagentid,OPERATOR " + + "from workflow_requestlog where REQUESTID='" + requestid + "' and NODEID ='" + xgryId + "'"; + bs.writeLog(sql2); + List> list1 = JAVATools.GetTableToListMap(sql2, null); + List useridList = new ArrayList<>(); + for (Map userIdMap : list1) { + String userid = Util.null2String(userIdMap.get("operator")); + useridList.add(userid); + } + bs.writeLog(useridList.size()); + //得到领导部门的所有用户ID + List departmentUserIdList = getDepartmentUserId(); + //得到相关人员和领导部门相同的用户ID + for (String uId : useridList) { + if (departmentUserIdList.contains(uId)) { + sendIdSet.remove(uId); + } else { + //移除领导代理人 + String sql4 = " select agentorbyagentid from workflow_requestlog where REQUESTID ='" + requestid + "' and OPERATOR = '" + uId + "' "; + bs.writeLog(sql4); + List> agentorMapList = JAVATools.GetTableToListMap(sql4, null); + for (Map agentorMap : agentorMapList) { + String agentorbyagentid = Util.null2String(agentorMap.get("agentorbyagentid")); + if (departmentUserIdList.contains(agentorbyagentid)) { + sendIdSet.remove(uId); + } + } + } + } + bs.writeLog(sendIdSet.size()); + return sendIdSet; + } + + /** + * 配置文件中领导部门id对应的用户id + * + * @return + */ + public List getDepartmentUserId() { + String deptvalues = Util.null2String(pb.getPropName("lhqssp.leaddeptvalue")); + String deptvalue = String.join("','", deptvalues.split(",")); + String sql = " select t1.id from HRMRESOURCE t1 " + + " left join HRMDEPARTMENT t2 " + + " on t1.DEPARTMENTID = t2.ID " + + " WHERE t2.DEPARTMENTCODE in ('" + deptvalue + "')"; + bs.writeLog(sql); + List> list = JAVATools.GetTableToListMap(sql, null); + List userIdList = new ArrayList<>(); + for (Map userIdMap : list) { + String leaderUserId = Util.null2String(userIdMap.get("id")); + userIdList.add(leaderUserId); + } + return userIdList; + } + + /** + * 获取消息详情 + * + * @param request + */ + public void getMessageContext(HttpServletRequest request) { + //获取主流程ID + String requestid = Util.null2String(request.getParameter("requestid")); + String sql = "select REQUESTNAME from WORKFLOW_REQUESTBASE where REQUESTID = '" + requestid + "' "; + bs.writeLog(sql); + Map mianRequestIdMap = JAVATools.GetTableToMap(sql, null); + String requestName = Util.null2String(mianRequestIdMap.get("requestname")); + Set sendUserId = getSendUserId(request); + bs.writeLog("接收人的ID:" + sendUserId); + String title = "领导审阅意见通知"; + String context = "请及时关注" + requestName + "流程中的公司领导意见!"; + bs.writeLog(context); + String linkUrl = ""; + String linkMobileUrl = ""; + sendMessage(sendUserId, title, context, linkUrl, linkMobileUrl); + } + + /** + * 发送消息提醒 + * + * @param sendIdSet + * @param title + * @param context + * @param linkUrl + * @param linkMobileUrl + */ + private void sendMessage(Set sendIdSet, String title, String context, String linkUrl, String linkMobileUrl) { + //领导审批意见通知消息类型 + String messageCode = pb.getPropName("ldtzMsgTypeCode"); + MessageType messageType = MessageType.newInstance(Integer.parseInt(messageCode)); + try { + MessageBean messageBean = Util_Message.createMessage(messageType, sendIdSet, title, context, linkUrl, linkMobileUrl); + messageBean.setCreater(1);// 创建人id + Util_Message.store(messageBean); + } catch (IOException e) { + e.printStackTrace(); + bs.writeLog("send message error:", e); + } + } + +} diff --git a/src/main/java/com/customization/htsc/payment/SaveTableSendTravelReiData2HT.java b/src/main/java/com/customization/htsc/payment/SaveTableSendTravelReiData2HT.java new file mode 100644 index 0000000..af217e8 --- /dev/null +++ b/src/main/java/com/customization/htsc/payment/SaveTableSendTravelReiData2HT.java @@ -0,0 +1,128 @@ +package com.customization.htsc.payment; + +import com.alibaba.fastjson.JSONObject; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.payment.enums.ReiState; +import com.engine.htsc.trip.util.WeaverUtil; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.interfaces.htsc.cus.HTUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; +import java.util.stream.Collectors; + +/** + * k1810012 + * 总部差旅报销,保存或删除时行程时同步行程状态 + * DRAFT: 保存 + * TERMINATION: 终止 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "总部报销保存时提交行程信息") +public class SaveTableSendTravelReiData2HT extends AbstractCommandProxy> { + + private final Log log = LogFactory.getLog(SaveTableSendTravelReiData2HT.class); + + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest(); + PropBean pp = new PropBean(); + //资金业务付款 workflowid + String headTravelWorkflowId = pp.getPropName("HeadTravelWorkflowId"); + //获取代理对象 + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String src = Util.null2String(request.getParameter("src")); //状态 + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + //流程处理结果 + String type = Util.null2String(resultBean.getType()); + + if (StringUtils.isNotBlank(headTravelWorkflowId) + && workflowid.equals(headTravelWorkflowId) + && "0".equals(nodetype)) { // 总部报销创建节点 + if ("SUCCESS".equalsIgnoreCase(type)) { //成功 + if ("save".equalsIgnoreCase(src) || "dostopc".equalsIgnoreCase(src)) { //保存 终止 + String code = ""; + log.info(String.format("总部差旅拦截保存或删除事件:workflowid:%s;src:%s;nodetype:%s", workflowid, src, nodetype)); + //状态 + if ("save".equalsIgnoreCase(src)) { + code = "DRAFT"; //保存 + } else { + code = "TERMINATION"; //终止 + } + //保存的requestid未生成 + Map submitParams = resultBean.getSubmitParams(); + if ("-1".equals(requestid)) { + requestid = Util.null2String(submitParams.get("requestid")); + } + //流程id + HTUtil ht = new HTUtil(); + String tableName = ht.getTableNameByWfid(Integer.parseInt(workflowid)); + Map reiReq = getDataToUpdate(tableName, requestid, code); + log.info("总部差旅报销流程,同步给华泰差旅报销信息,入参" + JSONObject.toJSONString(reiReq)); + String resp = ht.updateReimbursement(reiReq); + log.info("总部差旅报销流程,同步给华泰差旅报销信息,返回值" + resp); + + } + } + } + return result; + } + + /** + * 生成数据 + * + * @return map + */ + private Map getDataToUpdate(String tableName, String requestId, String code) { + + RecordSet rs = new RecordSet(); + + String sql = "select t1.lcbh,t1.ngrgh,t1.ngsj,t1.glcclc,t1.zfmxhj,t2.lastname,t3.REQUESTNAME\n" + + "from " + tableName + " t1\n" + + "left join hrmresource t2\n" + + "on t1.ngr = t2.id\n" + + "left join workflow_requestbase t3\n" + + "on t1.REQUESTID=t3.REQUESTID\n" + + "where t1.requestid =?"; + rs.executeQuery(sql, requestId); + + Map para = new HashMap<>(); + if (rs.next()) { + para.put("draftTime", Util.null2String(rs.getString("ngsj"))); + para.put("drafterId", Util.null2String(rs.getString("ngrgh"))); + para.put("reimbursementBizNo", Util.null2String(rs.getString("lcbh"))); + para.put("drafterName", Util.null2String(rs.getString("lastname"))); + para.put("totalAmount", Util.null2String(rs.getString("zfmxhj"))); + para.put("title", Util.null2String(rs.getString("REQUESTNAME"))); + para.put("processId", requestId); + para.put("travelApplicationBizNo", splitTravelBizNo(rs.getString("glcclc"))); + para.put("status", code); + } + + return para; + } + + private List splitTravelBizNo(String glcclc) { + List bizNos = new ArrayList<>(); + if (StringUtils.isNotBlank(glcclc)) { + bizNos = Arrays.stream(glcclc.split(",")).map( + i -> "出差申请" + i + ).collect(Collectors.toList()); + } + return bizNos; + } +} diff --git a/src/main/java/com/customization/htsc/receipt/LeaderNoticeCmd.java b/src/main/java/com/customization/htsc/receipt/LeaderNoticeCmd.java new file mode 100644 index 0000000..4084be6 --- /dev/null +++ b/src/main/java/com/customization/htsc/receipt/LeaderNoticeCmd.java @@ -0,0 +1,708 @@ +package com.customization.htsc.receipt; + +import com.api.workflow.service.RequestAuthenticationService; +import com.cloudstore.dev.api.bean.MessageBean; +import com.cloudstore.dev.api.bean.MessageType; +import com.cloudstore.dev.api.util.Util_Message; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import org.apache.commons.lang.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.interfaces.htsc.comInfo.PropBean; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "领导审阅意见通知") +public class LeaderNoticeCmd extends AbstractCommandProxy> { + + @Override + public Map execute(Command> targetCommand) { + //获取到被代理对象 + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + User user = requestSubmitCmd.getUser(); + String src = Util.null2String(request.getParameter("src")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String type = Util.null2String(resultBean.getType()); + //加工 + if("submit".equalsIgnoreCase(src)&&"SUCCESS".equalsIgnoreCase(type)&&needNotice(request,user)){ + BaseBean bs = new BaseBean(); + try{ + String remark = Util.null2String(request.getParameter("remark")); + remark = remark.replaceAll("[\\s\\t\\n\\r]", ""); + if(!("已阅".equals(remark)||"同意".equals(remark))){ + bs.writeLog("need notice"); + getMessageContent(request,user); + } + }catch (Exception e){ + e.printStackTrace(); + bs.writeLog("send leader notice error:",e); + } + } + return result; + } + + /** + * 是否需要通知 + * @param request + * @param user + * @return + */ + private boolean needNotice(HttpServletRequest request,User user){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + try{ + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + + String gsswldsy = pb.getPropName("gsswldsy"); + String gsswldsy_workflowid = pb.getActiveWorkflowIdByUnNumber(gsswldsy); + + String gsswldsy_ldsy = pb.getPropName("gsswldsy_ldsy"); + String gsswldsy_ldsy_nodeid = pb.getNodeIdsByUnNumber(gsswldsy_ldsy); + + if(workflowid.equals(gsswldsy_workflowid)&&nodeid.equals(gsswldsy_ldsy_nodeid)){ + bs.writeLog("true"); + return true; + } + }catch (Exception e){ + e.printStackTrace(); + bs.writeLog("check notice need error:",e); + } + return false; + } + + /** + * 发送消息提醒 + * @param sendIdSet + * @param title + * @param context + * @param linkUrl + * @param linkMobileUrl + */ + private void sendMessage(Set sendIdSet,String title,String context,String linkUrl,String linkMobileUrl){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + String messageCode = pb.getPropName("ldtzMsgTypeCode"); + MessageType messageType = MessageType.newInstance(Integer.parseInt(messageCode)); // 消息来源(见文档第四点补充 必填) + try { + MessageBean messageBean = Util_Message.createMessage(messageType, sendIdSet, title, context, linkUrl, linkMobileUrl); + messageBean.setCreater(1);// 创建人id + Util_Message.store(messageBean); + } catch (IOException e) { + e.printStackTrace(); + bs.writeLog("send message error:",e); + } + } + + /** + * 获取消息详情 + * @param request + * @param user + */ + private void getMessageContent(HttpServletRequest request,User user){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + RecordSet rs = new RecordSet(); + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String remark = Util.null2String(request.getParameter("remark")); + remark = remark.replaceAll("[\\s\\t\\n\\r]", ""); + + //获得消息内容 + String operatorName = user.getUsername(); + String operatetime = getTime(); + String requestName = cutString(getRequestName(requestid),20); + String requestmark = getRequestMark(requestid); + String requestRemark = cutString(remark,30); + String title = "领导审阅意见通知"; + String context = operatorName+"于"+operatetime+"对“"+requestName+"”("+requestmark+")" + + "签署意见“"+requestRemark+"”,请知悉。"; + + Set subNoticeUserSet = new HashSet<>(); + Set adminNoticeUserSet = new HashSet<>(); + + String sql = ""; + //获得主流程id + String mainRequestid = ""; + sql = "select mainrequestid from WORKFLOW_SUBWFREQUEST where subrequestid = '"+requestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainRequestid = Util.null2String(rs.getString("mainrequestid")); + } + //获得主流程表名 + String mainTableName = ""; + sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+mainRequestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainTableName = Util.null2String(rs.getString("tablename")); + } +// //获取主流程表内Id +// String mainId = ""; +// sql = "select id from "+mainTableName+" where requestid = '"+mainRequestid + "'"; +// bs.writeLog(sql); +// rs.executeQuery(sql); +// if(rs.next()){ +// mainId = Util.null2String(rs.getString("id")); +// } + + //特殊领导:周易、张伟 + String gsswldsy = pb.getPropName("gsswldsy"); + List specialLeaderList = new ArrayList<>(); + sql = "select tzry2 from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + specialLeaderList = Arrays.asList(Util.null2String(rs.getString("tzry2")).split(",")); + } + for(String specialLeader:specialLeaderList){ + bs.writeLog("specialLeader:"+specialLeader); + if(compareLoginid(specialLeader,String.valueOf(user.getUID()))){ + bs.writeLog("user.getUID():"+user.getUID()); + //领导审阅已送 + List leaderList = new ArrayList<>(); + + String gsswldsy_ldsy = pb.getPropName("gsswldsy_ldsy"); + String gsswldsy_ldsy_nodeid = pb.getNodeIdsByUnNumber(gsswldsy_ldsy); + bs.writeLog("gsswldsy_ldsy:"+gsswldsy_ldsy); + bs.writeLog("gsswldsy_ldsy_nodeid:"+gsswldsy_ldsy_nodeid); + + sql = "select t1.userid from WORKFLOW_CURRENTOPERATOR t1, WORKFLOW_SUBWFREQUEST t2 " + +"where t2.subrequestid = t1.requestid and t1.isremark <> 0 and t2.mainrequestid = '"+mainRequestid+"' and t1.nodeid = '"+gsswldsy_ldsy_nodeid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + leaderList.add(Util.null2String(rs.getString("userid"))); + } + //党委、董事会、经营管理层 + List specialDeptList = new ArrayList<>(); + sql = "select tzbm from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + specialDeptList = Arrays.asList(Util.null2String(rs.getString("tzbm")).split(",")); + } + + for(String leader:leaderList){ + String deptid = ""; + sql = "select departmentid from HRMRESOURCE where id = '"+leader+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + deptid = Util.null2String(rs.getString("departmentid")); + } + for(String specialDept:specialDeptList){ + if(specialDept.equals(deptid)&&!Integer.toString(user.getUID()).equals(leader)){ + subNoticeUserSet.add(leader); + break; + } + } + } + break; + } + } + + //主办部门 + String gsswzbbm = pb.getPropName("gsswzbbm"); + String gsswzbbm_workflowid = pb.getActiveWorkflowIdByUnNumber(gsswzbbm); + String gsswzbbm_zbbmfzrsh = pb.getPropName("gsswzbbm_zbbmfzrsh"); + String gsswzbbm_zbbmfzrsh_nodeid = pb.getNodeIdsByUnNumber(gsswzbbm_zbbmfzrsh); + String gsswzbbm_zbrycl = pb.getPropName("gsswzbbm_zbrycl"); + String gsswzbbm_zbrycl_nodeid = pb.getNodeIdsByUnNumber(gsswzbbm_zbrycl); + + sql = "select distinct userid from WORKFLOW_CURRENTOPERATOR where isremark <> 0 and requestid in " + +"(select * from " + +"(select t1.subrequestid from WORKFLOW_SUBWFREQUEST t1,WORKFLOW_REQUESTBASE t2 " + +"where t2.requestid = t1.subrequestid and t1.mainrequestid = '"+mainRequestid+"' and t2.workflowid = '"+gsswzbbm_workflowid+"' order by t2.createdate desc, t2.createtime desc) " + +"where ROWNUM <= 1) and nodeid in ("+gsswzbbm_zbbmfzrsh_nodeid+","+gsswzbbm_zbrycl_nodeid+")"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + String userid = Util.null2String(rs.getString("userid")); + subNoticeUserSet.add(userid); + } + +// String zbbmRequestid = ""; +// sql = "select lcmc from "+mainTableName+"_DT11 where mainid = '"+mainId+"' and lclx = '"+gsswzbbm+"' and ROWNUM <= 1"; +// bs.writeLog(sql); +// rs.executeQuery(sql); +// if(rs.next()){ +// zbbmRequestid = Util.null2String(rs.getString("lcmc")); +// } +// if(StringUtils.isNotEmpty(zbbmRequestid)){ +// String zbbmTableName = ""; +// sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " +// +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+zbbmRequestid+"'"; +// bs.writeLog(sql); +// rs.executeQuery(sql); +// if(rs.next()){ +// zbbmTableName = Util.null2String(rs.getString("tablename")); +// } +// sql = "select zbry,fzzbbmld from "+zbbmTableName+" where requestid = '"+zbbmRequestid+"'"; +// bs.writeLog(sql); +// rs.executeQuery(sql); +// if(rs.next()){ +// String zbry = Util.null2String(rs.getString("zbry")); +// String fzzbbmld = Util.null2String(rs.getString("fzzbbmld")); +// if(StringUtils.isNotEmpty(zbry)){ +// subNoticeUserSet.add(zbry); +// } +// if(StringUtils.isNotEmpty(fzzbbmld)){ +// subNoticeUserSet.addAll(Arrays.asList(fzzbbmld.split(","))); +// } +// } +// } +// +// //协办部门 +//// sql = "select bmld from "+mainTableName+"_DT8 where ys = '1' and mainid = '"+mainId+"'"; +//// bs.writeLog(sql); +//// rs.executeQuery(sql); +//// while(rs.next()){ +//// String bmld = Util.null2String(rs.getString("bmld")); +//// if(StringUtils.isNotEmpty(bmld)){ +//// subNoticeUserSet.add(bmld); +//// } +//// } + //看阅部门+协办部门领导 + String gsswyz_swyz = pb.getPropName("gsswyz_swyz"); + String gsswyz_swyz_nodeid = pb.getNodeIdsByUnNumber(gsswyz_swyz); + String gsswxbbm_xbbmfzrsh = pb.getPropName("gsswxbbm_xbbmfzrsh"); + String gsswxbbm_xbbmfzrsh_nodeid = pb.getNodeIdsByUnNumber(gsswxbbm_xbbmfzrsh); + + sql = "select t1.userid from WORKFLOW_CURRENTOPERATOR t1, WORKFLOW_SUBWFREQUEST t2 " + +"where t2.subrequestid = t1.requestid and t1.isremark <> 0 " + +"and t2.mainrequestid = '"+mainRequestid+"' and t1.nodeid in ("+gsswyz_swyz_nodeid+","+gsswxbbm_xbbmfzrsh_nodeid+")"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + String userid = Util.null2String(rs.getString("userid")); + subNoticeUserSet.add(userid); + } + + //配置通知人员:办公室主任(配置成006064)、办公室相关人员(配置成黄叶轩001874、宋艳锴002550、张徐健002155) + sql = "select tzry from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + List list = Arrays.asList(Util.null2String(rs.getString("tzry")).split(",")); + adminNoticeUserSet.addAll(list); + } + + bs.writeLog("subNoticeUserSet:"+subNoticeUserSet.toString()); + bs.writeLog("adminNoticeUserSet:"+adminNoticeUserSet.toString()); + List subNoticeUserList = new ArrayList<>(); + for(String userid:subNoticeUserSet){ + boolean flag = false; + for(String adminid:adminNoticeUserSet){ + if(compareLoginid(adminid,userid)){ + flag = true; + break; + } + } + for(String currentid:subNoticeUserList){ + if(compareLoginid(currentid,userid)){ + flag = true; + break; + } + } + if(!flag){ + subNoticeUserList.add(userid); + } + } + bs.writeLog("subNoticeUserList:"+subNoticeUserList.toString()); + + //发送消息通知 + String receiptLeaderNotice = pb.getPropName("receipt_leader_notice"); + if("1".equals(receiptLeaderNotice)){ + sql = "select id from hrmresource where loginid = '011413'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + String id = Util.null2String(rs.getString("id")); + sendNotice(id,mainRequestid,title,context,"2"); + } + }else{ + for(String adminNoticeUser:adminNoticeUserSet){ + if(!compareLoginid(adminNoticeUser,String.valueOf(user.getUID()))){ + sendNotice(adminNoticeUser,mainRequestid,title,context,"2"); + } + } + for(String subNoticeUser:subNoticeUserList){ + if(!compareLoginid(subNoticeUser,String.valueOf(user.getUID()))){ + sendNotice(subNoticeUser,mainRequestid,title,context,"1"); + } + } + } + } + + /** + * 发送消息通知 type:1-发送子流程链接,2-发送主流程监控链接 + * @param userid + * @param mainRequestid + * @param title + * @param context + * @param type + */ + private void sendNotice(String userid,String mainRequestid,String title,String context,String type){ + BaseBean bs = new BaseBean(); + RecordSet rs = new RecordSet(); + try{ + Set sendIdSet = new HashSet<>(); + sendIdSet.add(userid); + String linkUrl = ""; + String linkMobileUrl = ""; + + if("1".equals(type)){ + String subRequestid = ""; + String sql = "select t1.requestid from WORKFLOW_CURRENTOPERATOR t1, WORKFLOW_SUBWFREQUEST t2 " + +"where t2.subrequestid = t1.requestid and t2.mainrequestid = '"+mainRequestid+"' and t1.userid = '"+userid+"' and t1.isremark <> 0 and ROWNUM <= 1"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + subRequestid = Util.null2String(rs.getString("requestid")); + } + linkUrl = "/spa/workflow/static4form/index.html#/main/workflow/req?requestid="+subRequestid+"&f_weaver_belongto_userid="+userid; // PC端链接 + linkMobileUrl = "/spa/workflow/static4mobileform/index.html#/req?requestid="+subRequestid+"&f_weaver_belongto_userid="+userid; // 移动端链接 + + }else if("2".equals(type)){ + linkUrl = "/spa/workflow/static4form/index.html#/main/workflow/req?requestid="+mainRequestid+"&ismonitor=1"; // PC端链接 + linkMobileUrl = "/spa/workflow/static4mobileform/index.html#/req?requestid="+mainRequestid+"&ismonitor=1"; // 移动端链接 + } + + bs.writeLog("sendIdSet:"+sendIdSet.toString()); + bs.writeLog("title:"+title); + bs.writeLog("context:"+context); + bs.writeLog("linkUrl:"+linkUrl); + bs.writeLog("linkMobileUrl:"+linkMobileUrl); + sendMessage(sendIdSet,title,context,linkUrl,linkMobileUrl); + }catch(Exception e){ + e.printStackTrace(); + } + } + + /** + * 获取消息内容--废弃 + * @param request + * @param user + */ + private void getMessageContext(HttpServletRequest request,User user){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + RecordSet rs = new RecordSet(); + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String remark = Util.null2String(request.getParameter("remark")); + + String sql = ""; + //获得主流程id + String mainRequestid = ""; + sql = "select mainrequestid from WORKFLOW_SUBWFREQUEST where subrequestid = '"+requestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainRequestid = Util.null2String(rs.getString("mainrequestid")); + } + + Set sendIdSet = new HashSet(); //接收人id 必填 + String title = ""; //标题 + String context = ""; //内容 + String authStr = ""; + String authSignatureStr = ""; + String url = "requestid="+mainRequestid+"&relaterequest="+requestid+"&isrequest=3&isovertime=0&desrequestid="+requestid+ + "&authStr="+authStr+"&authSignatureStr="+authSignatureStr+"&f_weaver_belongto_userid="+user.getUID()+"&f_weaver_belongto_usertype=0"; + String linkUrl = "/workflow/request/ViewRequestForwardSPA.jsp?"+url; // PC端链接 + String linkMobileUrl = "/spa/workflow/forwardMobileForm.html?"+url; // 移动端链接 + + sendIdSet = getSendUserId(request,user); + + String operatorName = user.getUsername(); + String operatetime = getTime(); + String requestName = cutString(getRequestName(requestid),20); + String requestmark = getRequestMark(requestid); + String requestRemark = cutString(remark,30); + + title = "领导审阅意见通知"; + context = operatorName+"于"+operatetime+"对“"+requestName+"”("+requestmark+")" + + "签署意见“"+requestRemark+"”,请知悉。"; + + bs.writeLog("sendIdSet:"+sendIdSet.toString()); + bs.writeLog("title:"+title); + bs.writeLog("context:"+context); + bs.writeLog("linkUrl:"+linkUrl); + bs.writeLog("linkMobileUrl:"+linkMobileUrl); + sendMessage(sendIdSet,title,context,linkUrl,linkMobileUrl); + } + + /** + * 获得接收人id--废弃 + * @param request + * @return + */ + private Set getSendUserId(HttpServletRequest request, User user){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + RecordSet rs = new RecordSet(); + Set sendIdSet = new HashSet<>(); + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + + String sql = ""; + //获得主流程id + String mainRequestid = ""; + sql = "select mainrequestid from WORKFLOW_SUBWFREQUEST where subrequestid = '"+requestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainRequestid = Util.null2String(rs.getString("mainrequestid")); + } + //获得主流程表名 + String mainTableName = ""; + sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+mainRequestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainTableName = Util.null2String(rs.getString("tablename")); + } + //获取主流程表内Id + String mainId = ""; + sql = "select id from "+mainTableName+" where requestid = '"+mainRequestid + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainId = Util.null2String(rs.getString("id")); + } + + //主办部门领导+人员 +// sql = "select bmld,zbclr from "+mainTableName+"_DT6 where ys = '1' and mainid = '"+mainId+"'"; +// bs.writeLog(sql); +// rs.executeQuery(sql); +// while(rs.next()){ +// String bmld = Util.null2String(rs.getString("bmld")); +// String zbclr = Util.null2String(rs.getString("zbclr")); +// if(StringUtils.isNotEmpty(bmld)){ +// sendIdSet.add(bmld); +// } +// if(StringUtils.isNotEmpty(zbclr)){ +// sendIdSet.add(zbclr); +// } +// } + String zbbmRequestid = ""; + String gsswzbbm = pb.getPropName("gsswzbbm"); + sql = "select lcmc from "+mainTableName+"_DT11 where mainid = '"+mainId+"' and lclx = '"+gsswzbbm+"' and ROWNUM <= 1"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + zbbmRequestid = Util.null2String(rs.getString("lcmc")); + } + String zbbmTableName = ""; + sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+zbbmRequestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + zbbmTableName = Util.null2String(rs.getString("tablename")); + } + sql = "select zbry,fzzbbmld from "+zbbmTableName+" where requestid = '"+zbbmRequestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + String zbry = Util.null2String(rs.getString("zbry")); + String fzzbbmld = Util.null2String(rs.getString("fzzbbmld")); + if(StringUtils.isNotEmpty(zbry)){ + sendIdSet.add(zbry); + } + if(StringUtils.isNotEmpty(fzzbbmld)){ + sendIdSet.addAll(Arrays.asList(fzzbbmld.split(","))); + } + } + + //协办部门 + sql = "select bmld from "+mainTableName+"_DT8 where ys = '1' and mainid = '"+mainId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + String bmld = Util.null2String(rs.getString("bmld")); + if(StringUtils.isNotEmpty(bmld)){ + sendIdSet.add(bmld); + } + } + //看阅部门 + String gsswyz_swyz = pb.getPropName("gsswyz_swyz"); + String gsswyz_swyz_nodeid = pb.getNodeIdsByUnNumber(gsswyz_swyz); + + sql = "select t1.userid from WORKFLOW_CURRENTOPERATOR t1, WORKFLOW_SUBWFREQUEST t2 " + +"where t2.subrequestid = t1.requestid and t2.mainrequestid = '"+mainRequestid+"' and t1.nodeid = '"+gsswyz_swyz_nodeid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + List list = Arrays.asList(Util.null2String(rs.getString("userid")).split(",")); + sendIdSet.addAll(list); + } + + //配置通知人员:办公室主任(配置成006064)、办公室相关人员(配置成黄叶轩001874、宋艳锴002550、张徐健002155) + String gsswldsy = pb.getPropName("gsswldsy"); + sql = "select tzry from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + List list = Arrays.asList(Util.null2String(rs.getString("tzry")).split(",")); + sendIdSet.addAll(list); + } + + //特殊领导:周易、张伟 + List specialLeaderList = new ArrayList<>(); + sql = "select tzry2 from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + specialLeaderList = Arrays.asList(Util.null2String(rs.getString("tzry2")).split(",")); + } + for(String specialLeader:specialLeaderList){ + bs.writeLog("specialLeader:"+specialLeader); + if(specialLeader.equals(Integer.toString(user.getUID()))){ + bs.writeLog("user.getUID():"+user.getUID()); + //领导审阅已送 + List leaderList = new ArrayList<>(); + + String gsswldsy_ldsy = pb.getPropName("gsswldsy_ldsy"); + String gsswldsy_ldsy_nodeid = pb.getNodeIdsByUnNumber(gsswldsy_ldsy); + bs.writeLog("gsswldsy_ldsy:"+gsswldsy_ldsy); + bs.writeLog("gsswldsy_ldsy_nodeid:"+gsswldsy_ldsy_nodeid); + + sql = "select t1.userid from WORKFLOW_CURRENTOPERATOR t1, WORKFLOW_SUBWFREQUEST t2 " + +"where t2.subrequestid = t1.requestid and t2.mainrequestid = '"+mainRequestid+"' and t1.nodeid = '"+gsswldsy_ldsy_nodeid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + leaderList.add(Util.null2String(rs.getString("userid"))); + } + //党委、董事会、经营管理层 + List specialDeptList = new ArrayList<>(); + sql = "select tzbm from UF_LCTZRY where lcxx = '"+gsswldsy+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + specialDeptList = Arrays.asList(Util.null2String(rs.getString("tzbm")).split(",")); + } + + for(String leader:leaderList){ + String deptid = ""; + sql = "select departmentid from HRMRESOURCE where id = '"+leader+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + deptid = Util.null2String(rs.getString("departmentid")); + } + for(String specialDept:specialDeptList){ + if(specialDept.equals(deptid)&&!Integer.toString(user.getUID()).equals(leader)){ + sendIdSet.add(leader); + break; + } + } + } + break; + } + } + + return sendIdSet; + } + + /** + * 获取流程标题 + * @param requestid + * @return + */ + private String getRequestName(String requestid){ + String requestName = ""; + RecordSet rs = new RecordSet(); + rs.executeQuery("select requestname from workflow_requestbase where requestid=? ", new Object[]{requestid}); + if(rs.next()){ + requestName = Util.null2String(rs.getString("requestname")); + } + return requestName; + } + + /** + * 获得流程编号 + * @param requestid + * @return + */ + private String getRequestMark(String requestid){ + String requestmark = ""; + RecordSet rs = new RecordSet(); + rs.executeQuery("select requestmark from workflow_requestbase where requestid=? ", new Object[]{requestid}); + if(rs.next()){ + requestmark = Util.null2String(rs.getString("requestmark")); + } + return requestmark; + } + + /** + * 获得当前时间 + * @return + */ + private String getTime(){ + Date now = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH时"); + return sdf.format(now); + } + + /** + * 截取String + * @param str + * @param index + * @return + */ + private String cutString(String str,int index){ + if(str.length()>index){ + return str.substring(0, index)+"…"; + }else{ + return str; + } + } + + /** + * 比较工号 + * @param userid_1 + * @param userid_2 + * @return + */ + private boolean compareLoginid(String userid_1,String userid_2){ + RecordSet rs = new RecordSet(); + BaseBean bs = new BaseBean(); + String loginid_1 = ""; + String loginid_2 = ""; + String sql = "select workcode from hrmresource where id = '"+userid_1+"'"; + rs.executeQuery(sql); + if(rs.next()){ + loginid_1 = Util.null2String(rs.getString("workcode")); + } + sql = "select workcode from hrmresource where id = '"+userid_2+"'"; + rs.executeQuery(sql); + if(rs.next()){ + loginid_2 = Util.null2String(rs.getString("workcode")); + } + if(StringUtils.isNotEmpty(loginid_1)&&StringUtils.isNotEmpty(loginid_2)&&loginid_1.equals(loginid_2)){ + return true; + }else{ + return false; + } + } +} diff --git a/src/main/java/com/customization/htsc/receipt/ReceiptSubWorkflowCmd.java b/src/main/java/com/customization/htsc/receipt/ReceiptSubWorkflowCmd.java new file mode 100644 index 0000000..8bb5e0e --- /dev/null +++ b/src/main/java/com/customization/htsc/receipt/ReceiptSubWorkflowCmd.java @@ -0,0 +1,340 @@ +package com.customization.htsc.receipt; + +import com.alibaba.fastjson.JSON; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.htsc.workflow.util.WorkflowUtil; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import org.apache.commons.lang.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.company.DepartmentComInfo; +import weaver.interfaces.htsc.comInfo.PropBean; +import weaver.workflow.request.RequestManager; +import weaver.workflow.request.SubWorkflowTriggerService; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "公司收文触发子流程") +public class ReceiptSubWorkflowCmd extends AbstractCommandProxy> { + + @Override + public Map execute(Command> targetCommand) { + //获取到被代理对象 + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + User user = requestSubmitCmd.getUser(); + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String src = Util.null2String(request.getParameter("src")); + String receiptSubSign = Util.null2String(request.getParameter("receiptSubSign")); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String type = Util.null2String(resultBean.getType()); + if(StringUtils.isNotEmpty(receiptSubSign)&&"save".equalsIgnoreCase(src)&&"SUCCESS".equalsIgnoreCase(type)){ + BaseBean bs = new BaseBean(); + PropBean pb = new PropBean(); + + String gssw = pb.getPropName("gssw"); + String recriptWorkflowid = pb.getActiveWorkflowIdByUnNumber(gssw); + bs.writeLog("recriptWorkflowid:"+recriptWorkflowid); + + if(workflowid.equals(recriptWorkflowid)){ + bs.writeLog("----ReceiptSubWorkflow-------"); + try{ + Map apidatas = new HashMap(); + String paramSubwfSetId = ""; + if("0".equals(receiptSubSign)){//领导审阅 + paramSubwfSetId = pb.getPropName("receipt-subwfset-ldsy"); + bs.writeLog("paramSubwfSetId:"+paramSubwfSetId); + apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); + }else if("1".equals(receiptSubSign)){//主办部门 + paramSubwfSetId = pb.getPropName("receipt-subwfset-zbbm"); + bs.writeLog("paramSubwfSetId:"+paramSubwfSetId); + apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); + }else if("3".equals(receiptSubSign)){//协办部门 + paramSubwfSetId = pb.getPropName("receipt-subwfset-xbbmld"); + bs.writeLog("paramSubwfSetId:"+paramSubwfSetId); + String mainTableName = ""; + RecordSet rs = new RecordSet(); + String sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+requestid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainTableName = Util.null2String(rs.getString("tablename")); + } + String mainid = ""; + sql = "select id from "+mainTableName+" where requestid = '"+requestid + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainid = Util.null2String(rs.getString("id")); + } + + List> xbList = new ArrayList<>(); + sql = "select bmld,xbblry from "+mainTableName+"_dt8 t where sfsxb = '1' and mainid = '"+mainid+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + Map xb = new HashMap<>(); + xb.put("bmld",StringUtils.isNotEmpty(Util.null2String(rs.getString("bmld")))?Util.null2String(rs.getString("bmld")):""); + xb.put("xbblry",StringUtils.isNotEmpty(Util.null2String(rs.getString("xbblry")))?Util.null2String(rs.getString("xbblry")):""); + xbList.add(xb); + } + for(Map xb:xbList){ + String update_sql = "update "+mainTableName+" set fzxbbmld = '"+xb.get("bmld")+"',fzxbry = '"+xb.get("xbblry")+"' where requestid = '"+requestid+"'"; + bs.writeLog(update_sql); + rs.executeUpdate(update_sql); + apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); + } + +// String fzxbbmld = ""; +// String fzxbry = ""; +// sql = "select fzxbbmld,fzxbry from "+mainTableName+" where requestid = '"+requestid+"'"; +// log.info(sql); +// rs.executeQuery(sql); +// if (rs.next()) { +// fzxbbmld = Util.null2String(rs.getString("fzxbbmld")); +// fzxbry = Util.null2String(rs.getString("fzxbry")); +// } +// +// if(StringUtils.isNotEmpty(fzxbbmld)){ +// paramSubwfSetId = pb.getPropName("receipt-subwfset-xbbmld"); +// log.info("paramSubwfSetId:"+paramSubwfSetId); +// apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); +// String update_sql = "update "+mainTableName+" set fzxbbmld = '' where requestid = '"+requestid+"'"; +// log.info(update_sql); +// rs.executeUpdate(update_sql); +// } +// if(StringUtils.isNotEmpty(fzxbry)){ +// paramSubwfSetId = pb.getPropName("receipt-subwfset-xbbmry"); +// log.info("paramSubwfSetId:"+paramSubwfSetId); +// apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); +// } + }else if("6".equals(receiptSubSign)){//看阅部门 + paramSubwfSetId = pb.getPropName("receipt-subwfset-yz"); + bs.writeLog("paramSubwfSetId:"+paramSubwfSetId); + apidatas = creatrSubWorkflow(user,requestid,nodeid,paramSubwfSetId); + } + bs.writeLog("apidatas:"+JSON.toJSON(apidatas)); + result.put("subwfResult",apidatas.get("type")); + getSubProcessInfo(requestid); + }catch(Exception e){ + result.put("subwfResult","FAILD"); + } + } + bs.writeLog("result:"+JSON.toJSON(result)); + } + return result; + } + + private Map creatrSubWorkflow(User user, String requestid, String nodeid, String paramSubwfSetId){ + BaseBean bs = new BaseBean(); + Map apidatas = new HashMap(); + int requestId = Util.getIntValue(requestid, 0); + int nodeId = Util.getIntValue(nodeid, 0); + String triggerTime = "1"; + String hasTriggeredSubwf = ""; + String triggerType = "2"; + try { + RequestManager mainRequest = new RequestManager(); + RecordSet rs = new RecordSet(); + String sql = "select a.*,b.isbill,b.formid from workflow_requestbase a inner join workflow_base b on a.workflowid=b.id where a.requestid= '"+requestId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if (rs.next()) { + mainRequest.setWorkflowid(Util.getIntValue(rs.getString("workflowid"), 0)); + mainRequest.setCreater(Util.getIntValue(rs.getString("creater"), 0)); + mainRequest.setCreatertype(Util.getIntValue(rs.getString("createrType"), 0)); + mainRequest.setRequestid(requestId); + mainRequest.setRequestname(rs.getString("requestname")); + mainRequest.setRequestlevel(rs.getString("requestlevel")); + mainRequest.setMessageType(rs.getString("messagetype")); + mainRequest.setSrc("submit"); + mainRequest.setIsbill(Util.getIntValue(rs.getString("isbill"), 0)); + mainRequest.setFormid(Util.getIntValue(rs.getString("formid"), 0)); + } + SubWorkflowTriggerService triggerService = new SubWorkflowTriggerService(mainRequest, nodeId, hasTriggeredSubwf, user); + triggerService.triggerSubWorkflow(triggerType, triggerTime, paramSubwfSetId); + apidatas.put("type", "SUCCESS"); + } catch (Exception e) { + apidatas.put("type", "FAILD"); + } + return apidatas; + } + + private void getSubProcessInfo(String mainRequestId){ + PropBean pb = new PropBean(); + BaseBean bs = new BaseBean(); + RecordSet rs = new RecordSet(); + bs.writeLog("----Receipt-getSubProcessInfo-------" + mainRequestId); + try { + String sql = ""; + + //获取主流程表名 + String mainTableName = ""; + sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+mainRequestId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainTableName = Util.null2String(rs.getString("tablename")); + } + + //获取主流程表内Id + String mainId = ""; + sql = "select id from "+mainTableName+" where requestid = '"+mainRequestId + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + mainId = Util.null2String(rs.getString("id")); + } + + //获取需要新增的子流程Id + List allList = new ArrayList<>(); + List currentList = new ArrayList<>(); + List newList = new ArrayList<>(); + sql = "select subrequestid from WORKFLOW_SUBWFREQUEST where mainrequestid = '"+mainRequestId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + allList.add(Util.null2String(rs.getString("subrequestid"))); + } + sql = "select lcmc from "+mainTableName+"_dt11 where mainid = '"+mainId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + currentList.add(Util.null2String(rs.getString("lcmc"))); + } + for(String subRequestId:allList){ + if(!currentList.contains(subRequestId)){ + newList.add(subRequestId); + } + } + for(String subRequestId:newList){ + //获取子流程表名 + String subTableName = ""; + sql = "select t3.tablename from WORKFLOW_REQUESTBASE t1,WORKFLOW_BASE t2,WORKFLOW_BILL t3 " + +"where t2.id = t1.workflowid and t3.id = t2.formid and t1.requestid = '"+subRequestId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + subTableName = Util.null2String(rs.getString("tablename")); + } + + //获取子流程信息 + String requestNumber = ""; + String requestHandler = ""; + String requestDept = ""; + String requestTime = ""; + String subWorkflowid = ""; + sql = "select workflowid,requestmark,createdate,createtime from WORKFLOW_REQUESTBASE where requestid = '"+subRequestId+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + subWorkflowid = Util.null2String(rs.getString("workflowid")); +// requestNumber = Util.null2String(rs.getString("requestmark")); + requestTime = Util.null2String(rs.getString("createdate"))+" "+Util.null2String(rs.getString("createtime")); + } + sql = "select lcbh from "+subTableName+" where requestid = '"+subRequestId + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + requestNumber = Util.null2String(rs.getString("lcbh")); + } + String update_sql = "update WORKFLOW_REQUESTBASE set requestmark = '"+requestNumber+"' where requestid = '"+subRequestId+"'"; + bs.writeLog(update_sql); + rs.executeUpdate(update_sql); + + + String gsswldsy = pb.getPropName("gsswldsy"); + String gsswldsy_workflowid = pb.getActiveWorkflowIdByUnNumber(gsswldsy); + bs.writeLog("gsswldsy:"+gsswldsy); + bs.writeLog("gsswldsy_workflowid:"+gsswldsy_workflowid); + + String gsswyz = pb.getPropName("gsswyz"); + String gsswyz_workflowid = pb.getActiveWorkflowIdByUnNumber(gsswyz); + bs.writeLog("gsswyz:"+gsswyz); + bs.writeLog("gsswyz_workflowid:"+gsswyz_workflowid); + + if(subWorkflowid.equals(gsswldsy_workflowid)){ + sql = "select fzldsp from "+subTableName+" where requestid = '"+subRequestId + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + requestHandler = Util.null2String(rs.getString("fzldsp")); + } + }else if(subWorkflowid.equals(gsswyz_workflowid)){ + sql = "select fzkybm from "+subTableName+" where requestid = '"+subRequestId + "'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + requestHandler = Util.null2String(rs.getString("fzkybm")); + } + }else{ + List handlerList = new ArrayList<>(); + sql = "select userid from WORKFLOW_CURRENTOPERATOR where requestid = '"+subRequestId+"' and isremark = '0'"; + bs.writeLog(sql); + rs.executeQuery(sql); + while(rs.next()){ + handlerList.add(Util.null2String(rs.getString("userid"))); + } + requestHandler = String.join(",",handlerList); + } + + Set deptSet = new LinkedHashSet<>(); + List handlerList = Arrays.asList(requestHandler.split(",")); + for(String handler:handlerList){ + sql = "select departmentid from HRMRESOURCE where id = '"+handler+"'"; + bs.writeLog(sql); + rs.executeQuery(sql); + if(rs.next()){ + deptSet.add(Util.null2String(rs.getString("departmentid"))); + } + } + requestDept = String.join(",",deptSet); + + + List deptNameList = new ArrayList<>(); + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + for(String deptid:deptSet){ + String showName = departmentComInfo.getDepartmentname(deptid); + String orgid = ""; + sql = " select l.id from (select t.id from HrmDepartment t where t.supdepid is null or t.supdepid = 0 start with t.id="+deptid+" connect by prior t.supdepid=t.id ) l"; + rs.execute(sql); + if(rs.next()){ + orgid = com.weaver.general.Util.null2String(rs.getString("id")); + } + if(!deptid.equals(orgid)){ + String orgName = WorkflowUtil.getTopDeptShortName(orgid); + showName = showName+"("+orgName+")"; + } + deptNameList.add(showName); + } + String deptNameStr = String.join(" ", deptNameList); + + String subWorkflowUnNumber = ""; + if(!"".equals(subWorkflowid)){ + subWorkflowUnNumber = pb.getWorkflowUnNumberByid(subWorkflowid); + } + bs.writeLog("subWorkflowUnNumber:"+subWorkflowUnNumber); + + String insert_sql = "insert into " + mainTableName + "_dt11(mainid,lcmc,lcbh,lcclr,fsbm,bm,lcfqsj,lclx,sfbj) " + +"values('"+mainId+"','"+subRequestId+"','"+requestNumber+"','"+requestHandler+"','"+requestDept+"','"+deptNameStr+"','"+requestTime+"','"+subWorkflowUnNumber+"','"+0+"')"; + bs.writeLog(insert_sql); + rs.executeUpdate(insert_sql); + } + } catch (Exception e) { + e.printStackTrace(); + bs.writeLog("error---------------",e); + } + } +} diff --git a/src/main/java/com/customization/htsc/tgpt/TgptSaveDetail.java b/src/main/java/com/customization/htsc/tgpt/TgptSaveDetail.java new file mode 100644 index 0000000..1d83ee2 --- /dev/null +++ b/src/main/java/com/customization/htsc/tgpt/TgptSaveDetail.java @@ -0,0 +1,66 @@ +package com.customization.htsc.tgpt; + +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.workflow.cmd.requestForm.RequestSubmitCmd; +import com.engine.workflow.entity.requestForm.RequestOperationResultBean; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.interfaces.htsc.GlobatTools.JAVATools; +import weaver.interfaces.htsc.comInfo.PropBean; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 触发流程 + */ +@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交处理业务") +public class TgptSaveDetail extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand; + HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数,不用以前的方法了 + String requestid = Util.null2String(request.getParameter("requestid")); + String workflowid = Util.null2String(request.getParameter("workflowid")); + String nodetype = Util.null2String(request.getParameter("nodetype")); + String nodeid = Util.null2String(request.getParameter("nodeid")); + String src = Util.null2String(request.getParameter("src")); + String remark = Util.HTMLtoTxt(Util.null2String(request.getParameter("remark"))).trim(); + String operator = Util.null2String(request.getParameter("f_weaver_belongto_userid")); + PropBean pb = new PropBean(); + String Ehd_workflowid = pb.getPropName("ehd_workflowid"); + JAVATools.writelog("投关平台增加明细表Ehd_workflowid"+Ehd_workflowid); + String Ehd_nodeid = pb.getPropName("ehd_nodeid"); + JAVATools.writelog("投关平台增加明细表Ehd_nodeid"+Ehd_nodeid); + String table = pb.getPropName("ehd_tablename"); + JAVATools.writelog("投关平台增加明细表table"+table); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data"); + String executeResult = resultBean.getType().name(); + RecordSet rs = new RecordSet(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + RecordSet rs2 = new RecordSet(); + if ("SUCCESS".equals(executeResult) && "submit".equals(src)) { + if(workflowid.equals(Ehd_workflowid)&&Ehd_nodeid.equals(nodeid) ){ + String sql = "select * from "+table + " where requestid = '"+requestid+"'"; + JAVATools.writelog("投关平台增加明细表sql"+sql); + rs.execute(sql); + while(rs.next()){ + String id = rs.getString("id"); + String wthf = rs.getString("wthf"); + String format = simpleDateFormat.format(new Date()); + String insertSql = "insert into "+table+"_dt4 (mainid,xgxzry,wtda,hfsj) values ('"+id+"','"+operator+"','"+wthf+"','"+format+"')"; + JAVATools.writelog("投关平台增加明细表insertSql"+insertSql); + rs2.execute(insertSql); + } + } + + } + + return result; + } +} + diff --git a/src/main/resources/ESAPI.properties b/src/main/resources/ESAPI.properties new file mode 100644 index 0000000..f681658 --- /dev/null +++ b/src/main/resources/ESAPI.properties @@ -0,0 +1,459 @@ +# +# OWASP Enterprise Security API (ESAPI) Properties file -- PRODUCTION Version +# +# This file is part of the Open Web Application Security Project (OWASP) +# Enterprise Security API (ESAPI) project. For details, please see +# http://www.owasp.org/index.php/ESAPI. +# +# Copyright (c) 2008,2009 - The OWASP Foundation +# +# DISCUSS: This may cause a major backwards compatibility issue, etc. but +# from a name space perspective, we probably should have prefaced +# all the property names with ESAPI or at least OWASP. Otherwise +# there could be problems is someone loads this properties file into +# the System properties. We could also put this file into the +# esapi.jar file (perhaps as a ResourceBundle) and then allow an external +# ESAPI properties be defined that would overwrite these defaults. +# That keeps the application's properties relatively simple as usually +# they will only want to override a few properties. If looks like we +# already support multiple override levels of this in the +# DefaultSecurityConfiguration class, but I'm suggesting placing the +# defaults in the esapi.jar itself. That way, if the jar is signed, +# we could detect if those properties had been tampered with. (The +# code to check the jar signatures is pretty simple... maybe 70-90 LOC, +# but off course there is an execution penalty (similar to the way +# that the separate sunjce.jar used to be when a class from it was +# first loaded). Thoughts? +############################################################################### +# +# WARNING: Operating system protection should be used to lock down the .esapi +# resources directory and all the files inside and all the directories all the +# way up to the root directory of the file system. Note that if you are using +# file-based implementations, that some files may need to be read-write as they +# get updated dynamically. +# +# Before using, be sure to update the MasterKey and MasterSalt as described below. +# N.B.: If you had stored data that you have previously encrypted with ESAPI 1.4, +# you *must* FIRST decrypt it using ESAPI 1.4 and then (if so desired) +# re-encrypt it with ESAPI 2.0. If you fail to do this, you will NOT be +# able to decrypt your data with ESAPI 2.0. +# +# YOU HAVE BEEN WARNED!!! More details are in the ESAPI 2.0 Release Notes. +# +#=========================================================================== +# ESAPI Configuration +# +# If true, then print all the ESAPI properties set here when they are loaded. +# If false, they are not printed. Useful to reduce output when running JUnit tests. +# If you need to troubleshoot a properties related problem, turning this on may help. +# This is 'false' in the src/test/resources/.esapi version. It is 'true' by +# default for reasons of backward compatibility with earlier ESAPI versions. +ESAPI.printProperties=true + +# ESAPI is designed to be easily extensible. You can use the reference implementation +# or implement your own providers to take advantage of your enterprise's security +# infrastructure. The functions in ESAPI are referenced using the ESAPI locator, like: +# +# String ciphertext = +# ESAPI.encryptor().encrypt("Secret message"); // Deprecated in 2.0 +# CipherText cipherText = +# ESAPI.encryptor().encrypt(new PlainText("Secret message")); // Preferred +# +# Below you can specify the classname for the provider that you wish to use in your +# application. The only requirement is that it implement the appropriate ESAPI interface. +# This allows you to switch security implementations in the future without rewriting the +# entire application. +# +# ExperimentalAccessController requires ESAPI-AccessControlPolicy.xml in .esapi directory +ESAPI.AccessControl=org.owasp.esapi.reference.DefaultAccessController +# FileBasedAuthenticator requires users.txt file in .esapi directory +ESAPI.Authenticator=org.owasp.esapi.reference.FileBasedAuthenticator +ESAPI.Encoder=org.owasp.esapi.reference.DefaultEncoder +ESAPI.Encryptor=org.owasp.esapi.reference.crypto.JavaEncryptor + +ESAPI.Executor=org.owasp.esapi.reference.DefaultExecutor +ESAPI.HTTPUtilities=org.owasp.esapi.reference.DefaultHTTPUtilities +ESAPI.IntrusionDetector=org.owasp.esapi.reference.DefaultIntrusionDetector +# Log4JFactory Requires log4j.xml or log4j.properties in classpath - http://www.laliluna.de/log4j-tutorial.html +ESAPI.Logger=org.owasp.esapi.reference.Log4JLogFactory +#ESAPI.Logger=org.owasp.esapi.reference.JavaLogFactory +ESAPI.Randomizer=org.owasp.esapi.reference.DefaultRandomizer +ESAPI.Validator=org.owasp.esapi.reference.DefaultValidator + +#=========================================================================== +# ESAPI Authenticator +# +Authenticator.AllowedLoginAttempts=3 +Authenticator.MaxOldPasswordHashes=13 +Authenticator.UsernameParameterName=username +Authenticator.PasswordParameterName=password +# RememberTokenDuration (in days) +Authenticator.RememberTokenDuration=14 +# Session Timeouts (in minutes) +Authenticator.IdleTimeoutDuration=20 +Authenticator.AbsoluteTimeoutDuration=120 + +#=========================================================================== +# ESAPI Encoder +# +# ESAPI canonicalizes input before validation to prevent bypassing filters with encoded attacks. +# Failure to canonicalize input is a very common mistake when implementing validation schemes. +# Canonicalization is automatic when using the ESAPI Validator, but you can also use the +# following code to canonicalize data. +# +# ESAPI.Encoder().canonicalize( "%22hello world"" ); +# +# Multiple encoding is when a single encoding format is applied multiple times. Allowing +# multiple encoding is strongly discouraged. +Encoder.AllowMultipleEncoding=false + +# Mixed encoding is when multiple different encoding formats are applied, or when +# multiple formats are nested. Allowing multiple encoding is strongly discouraged. +Encoder.AllowMixedEncoding=false + +# The default list of codecs to apply when canonicalizing untrusted data. The list should include the codecs +# for all downstream interpreters or decoders. For example, if the data is likely to end up in a URL, HTML, or +# inside JavaScript, then the list of codecs below is appropriate. The order of the list is not terribly important. +Encoder.DefaultCodecList=HTMLEntityCodec,PercentCodec,JavaScriptCodec + + +#=========================================================================== +# ESAPI Encryption +# +# The ESAPI Encryptor provides basic cryptographic functions with a simplified API. +# To get started, generate a new key using java -classpath esapi.jar org.owasp.esapi.reference.crypto.JavaEncryptor +# There is not currently any support for key rotation, so be careful when changing your key and salt as it +# will invalidate all signed, encrypted, and hashed data. +# +# WARNING: Not all combinations of algorithms and key lengths are supported. +# If you choose to use a key length greater than 128, you MUST download the +# unlimited strength policy files and install in the lib directory of your JRE/JDK. +# See http://java.sun.com/javase/downloads/index.jsp for more information. +# +# Backward compatibility with ESAPI Java 1.4 is supported by the two deprecated API +# methods, Encryptor.encrypt(String) and Encryptor.decrypt(String). However, whenever +# possible, these methods should be avoided as they use ECB cipher mode, which in almost +# all circumstances a poor choice because of it's weakness. CBC cipher mode is the default +# for the new Encryptor encrypt / decrypt methods for ESAPI Java 2.0. In general, you +# should only use this compatibility setting if you have persistent data encrypted with +# version 1.4 and even then, you should ONLY set this compatibility mode UNTIL +# you have decrypted all of your old encrypted data and then re-encrypted it with +# ESAPI 2.0 using CBC mode. If you have some reason to mix the deprecated 1.4 mode +# with the new 2.0 methods, make sure that you use the same cipher algorithm for both +# (256-bit AES was the default for 1.4; 128-bit is the default for 2.0; see below for +# more details.) Otherwise, you will have to use the new 2.0 encrypt / decrypt methods +# where you can specify a SecretKey. (Note that if you are using the 256-bit AES, +# that requires downloading the special jurisdiction policy files mentioned above.) +# +# ***** IMPORTANT: Do NOT forget to replace these with your own values! ***** +# To calculate these values, you can run: +# java -classpath esapi.jar org.owasp.esapi.reference.crypto.JavaEncryptor +# +#Encryptor.MasterKey= +#Encryptor.MasterSalt= + +# Provides the default JCE provider that ESAPI will "prefer" for its symmetric +# encryption and hashing. (That is it will look to this provider first, but it +# will defer to other providers if the requested algorithm is not implemented +# by this provider.) If left unset, ESAPI will just use your Java VM's current +# preferred JCE provider, which is generally set in the file +# "$JAVA_HOME/jre/lib/security/java.security". +# +# The main intent of this is to allow ESAPI symmetric encryption to be +# used with a FIPS 140-2 compliant crypto-module. For details, see the section +# "Using ESAPI Symmetric Encryption with FIPS 140-2 Cryptographic Modules" in +# the ESAPI 2.0 Symmetric Encryption User Guide, at: +# http://owasp-esapi-java.googlecode.com/svn/trunk/documentation/esapi4java-core-2.0-symmetric-crypto-user-guide.html +# However, this property also allows you to easily use an alternate JCE provider +# such as "Bouncy Castle" without having to make changes to "java.security". +# See Javadoc for SecurityProviderLoader for further details. If you wish to use +# a provider that is not known to SecurityProviderLoader, you may specify the +# fully-qualified class name of the JCE provider class that implements +# java.security.Provider. If the name contains a '.', this is interpreted as +# a fully-qualified class name that implements java.security.Provider. +# +# NOTE: Setting this property has the side-effect of changing it in your application +# as well, so if you are using JCE in your application directly rather than +# through ESAPI (you wouldn't do that, would you? ;-), it will change the +# preferred JCE provider there as well. +# +# Default: Keeps the JCE provider set to whatever JVM sets it to. +Encryptor.PreferredJCEProvider= + +# AES is the most widely used and strongest encryption algorithm. This +# should agree with your Encryptor.CipherTransformation property. +# By default, ESAPI Java 1.4 uses "PBEWithMD5AndDES" and which is +# very weak. It is essentially a password-based encryption key, hashed +# with MD5 around 1K times and then encrypted with the weak DES algorithm +# (56-bits) using ECB mode and an unspecified padding (it is +# JCE provider specific, but most likely "NoPadding"). However, 2.0 uses +# "AES/CBC/PKCSPadding". If you want to change these, change them here. +# Warning: This property does not control the default reference implementation for +# ESAPI 2.0 using JavaEncryptor. Also, this property will be dropped +# in the future. +# @deprecated +Encryptor.EncryptionAlgorithm=AES +# For ESAPI Java 2.0 - New encrypt / decrypt methods use this. +Encryptor.CipherTransformation=AES/CBC/PKCS5Padding + +# Applies to ESAPI 2.0 and later only! +# Comma-separated list of cipher modes that provide *BOTH* +# confidentiality *AND* message authenticity. (NIST refers to such cipher +# modes as "combined modes" so that's what we shall call them.) If any of these +# cipher modes are used then no MAC is calculated and stored +# in the CipherText upon encryption. Likewise, if one of these +# cipher modes is used with decryption, no attempt will be made +# to validate the MAC contained in the CipherText object regardless +# of whether it contains one or not. Since the expectation is that +# these cipher modes support support message authenticity already, +# injecting a MAC in the CipherText object would be at best redundant. +# +# Note that as of JDK 1.5, the SunJCE provider does not support *any* +# of these cipher modes. Of these listed, only GCM and CCM are currently +# NIST approved. YMMV for other JCE providers. E.g., Bouncy Castle supports +# GCM and CCM with "NoPadding" mode, but not with "PKCS5Padding" or other +# padding modes. +Encryptor.cipher_modes.combined_modes=GCM,CCM,IAPM,EAX,OCB,CWC + +# Applies to ESAPI 2.0 and later only! +# Additional cipher modes allowed for ESAPI 2.0 encryption. These +# cipher modes are in _addition_ to those specified by the property +# 'Encryptor.cipher_modes.combined_modes'. +# Note: We will add support for streaming modes like CFB & OFB once +# we add support for 'specified' to the property 'Encryptor.ChooseIVMethod' +# (probably in ESAPI 2.1). +# DISCUSS: Better name? +Encryptor.cipher_modes.additional_allowed=CBC + +# 128-bit is almost always sufficient and appears to be more resistant to +# related key attacks than is 256-bit AES. Use '_' to use default key size +# for cipher algorithms (where it makes sense because the algorithm supports +# a variable key size). Key length must agree to what's provided as the +# cipher transformation, otherwise this will be ignored after logging a +# warning. +# +# NOTE: This is what applies BOTH ESAPI 1.4 and 2.0. See warning above about mixing! +Encryptor.EncryptionKeyLength=128 + +# Because 2.0 uses CBC mode by default, it requires an initialization vector (IV). +# (All cipher modes except ECB require an IV.) There are two choices: we can either +# use a fixed IV known to both parties or allow ESAPI to choose a random IV. While +# the IV does not need to be hidden from adversaries, it is important that the +# adversary not be allowed to choose it. Also, random IVs are generally much more +# secure than fixed IVs. (In fact, it is essential that feed-back cipher modes +# such as CFB and OFB use a different IV for each encryption with a given key so +# in such cases, random IVs are much preferred. By default, ESAPI 2.0 uses random +# IVs. If you wish to use 'fixed' IVs, set 'Encryptor.ChooseIVMethod=fixed' and +# uncomment the Encryptor.fixedIV. +# +# Valid values: random|fixed|specified 'specified' not yet implemented; planned for 2.1 +Encryptor.ChooseIVMethod=random +# If you choose to use a fixed IV, then you must place a fixed IV here that +# is known to all others who are sharing your secret key. The format should +# be a hex string that is the same length as the cipher block size for the +# cipher algorithm that you are using. The following is an *example* for AES +# from an AES test vector for AES-128/CBC as described in: +# NIST Special Publication 800-38A (2001 Edition) +# "Recommendation for Block Cipher Modes of Operation". +# (Note that the block size for AES is 16 bytes == 128 bits.) +# +Encryptor.fixedIV=0x000102030405060708090a0b0c0d0e0f + +# Whether or not CipherText should use a message authentication code (MAC) with it. +# This prevents an adversary from altering the IV as well as allowing a more +# fool-proof way of determining the decryption failed because of an incorrect +# key being supplied. This refers to the "separate" MAC calculated and stored +# in CipherText, not part of any MAC that is calculated as a result of a +# "combined mode" cipher mode. +# +# If you are using ESAPI with a FIPS 140-2 cryptographic module, you *must* also +# set this property to false. +Encryptor.CipherText.useMAC=true + +# Whether or not the PlainText object may be overwritten and then marked +# eligible for garbage collection. If not set, this is still treated as 'true'. +Encryptor.PlainText.overwrite=true + +# Do not use DES except in a legacy situations. 56-bit is way too small key size. +#Encryptor.EncryptionKeyLength=56 +#Encryptor.EncryptionAlgorithm=DES + +# TripleDES is considered strong enough for most purposes. +# Note: There is also a 112-bit version of DESede. Using the 168-bit version +# requires downloading the special jurisdiction policy from Sun. +#Encryptor.EncryptionKeyLength=168 +#Encryptor.EncryptionAlgorithm=DESede + +Encryptor.HashAlgorithm=SHA-512 +Encryptor.HashIterations=1024 +Encryptor.DigitalSignatureAlgorithm=SHA1withDSA +Encryptor.DigitalSignatureKeyLength=1024 +Encryptor.RandomAlgorithm=SHA1PRNG +Encryptor.CharacterEncoding=UTF-8 + +# This is the Pseudo Random Function (PRF) that ESAPI's Key Derivation Function +# (KDF) normally uses. Note this is *only* the PRF used for ESAPI's KDF and +# *not* what is used for ESAPI's MAC. (Currently, HmacSHA1 is always used for +# the MAC, mostly to keep the overall size at a minimum.) +# +# Currently supported choices for JDK 1.5 and 1.6 are: +# HmacSHA1 (160 bits), HmacSHA256 (256 bits), HmacSHA384 (384 bits), and +# HmacSHA512 (512 bits). +# Note that HmacMD5 is *not* supported for the PRF used by the KDF even though +# the JDKs support it. See the ESAPI 2.0 Symmetric Encryption User Guide +# further details. +Encryptor.KDF.PRF=HmacSHA256 +#=========================================================================== +# ESAPI HttpUtilties +# +# The HttpUtilities provide basic protections to HTTP requests and responses. Primarily these methods +# protect against malicious data from attackers, such as unprintable characters, escaped characters, +# and other simple attacks. The HttpUtilities also provides utility methods for dealing with cookies, +# headers, and CSRF tokens. +# +# Default file upload location (remember to escape backslashes with \\) +HttpUtilities.UploadDir=C:\\ESAPI\\testUpload +HttpUtilities.UploadTempDir=C:\\temp +# Force flags on cookies, if you use HttpUtilities to set cookies +HttpUtilities.ForceHttpOnlySession=false +HttpUtilities.ForceSecureSession=false +HttpUtilities.ForceHttpOnlyCookies=true +HttpUtilities.ForceSecureCookies=true +# Maximum size of HTTP headers +HttpUtilities.MaxHeaderSize=4096 +# File upload configuration +HttpUtilities.ApprovedUploadExtensions=.zip,.pdf,.doc,.docx,.ppt,.pptx,.tar,.gz,.tgz,.rar,.war,.jar,.ear,.xls,.rtf,.properties,.java,.class,.txt,.xml,.jsp,.jsf,.exe,.dll +HttpUtilities.MaxUploadFileBytes=500000000 +# Using UTF-8 throughout your stack is highly recommended. That includes your database driver, +# container, and any other technologies you may be using. Failure to do this may expose you +# to Unicode transcoding injection attacks. Use of UTF-8 does not hinder internationalization. +HttpUtilities.ResponseContentType=text/html; charset=UTF-8 +# This is the name of the cookie used to represent the HTTP session +# Typically this will be the default "JSESSIONID" +HttpUtilities.HttpSessionIdName=JSESSIONID + + + +#=========================================================================== +# ESAPI Executor +# CHECKME - This should be made OS independent. Don't use unsafe defaults. +# # Examples only -- do NOT blindly copy! +# For Windows: +# Executor.WorkingDirectory=C:\\Windows\\Temp +# Executor.ApprovedExecutables=C:\\Windows\\System32\\cmd.exe,C:\\Windows\\System32\\runas.exe +# For *nux, MacOS: +# Executor.WorkingDirectory=/tmp +# Executor.ApprovedExecutables=/bin/bash +Executor.WorkingDirectory= +Executor.ApprovedExecutables= + + +#=========================================================================== +# ESAPI Logging +# Set the application name if these logs are combined with other applications +Logger.ApplicationName=ExampleApplication +# If you use an HTML log viewer that does not properly HTML escape log data, you can set LogEncodingRequired to true +Logger.LogEncodingRequired=false +# Determines whether ESAPI should log the application name. This might be clutter in some single-server/single-app environments. +Logger.LogApplicationName=true +# Determines whether ESAPI should log the server IP and port. This might be clutter in some single-server environments. +Logger.LogServerIP=true +# LogFileName, the name of the logging file. Provide a full directory path (e.g., C:\\ESAPI\\ESAPI_logging_file) if you +# want to place it in a specific directory. +Logger.LogFileName=ESAPI_logging_file +# MaxLogFileSize, the max size (in bytes) of a single log file before it cuts over to a new one (default is 10,000,000) +Logger.MaxLogFileSize=10000000 + + +#=========================================================================== +# ESAPI Intrusion Detection +# +# Each event has a base to which .count, .interval, and .action are added +# The IntrusionException will fire if we receive "count" events within "interval" seconds +# The IntrusionDetector is configurable to take the following actions: log, logout, and disable +# (multiple actions separated by commas are allowed e.g. event.test.actions=log,disable +# +# Custom Events +# Names must start with "event." as the base +# Use IntrusionDetector.addEvent( "test" ) in your code to trigger "event.test" here +# You can also disable intrusion detection completely by changing +# the following parameter to true +# +IntrusionDetector.Disable=false +# +IntrusionDetector.event.test.count=2 +IntrusionDetector.event.test.interval=10 +IntrusionDetector.event.test.actions=disable,log + +# Exception Events +# All EnterpriseSecurityExceptions are registered automatically +# Call IntrusionDetector.getInstance().addException(e) for Exceptions that do not extend EnterpriseSecurityException +# Use the fully qualified classname of the exception as the base + +# any intrusion is an attack +IntrusionDetector.org.owasp.esapi.errors.IntrusionException.count=1 +IntrusionDetector.org.owasp.esapi.errors.IntrusionException.interval=1 +IntrusionDetector.org.owasp.esapi.errors.IntrusionException.actions=log,disable,logout + +# for test purposes +# CHECKME: Shouldn't there be something in the property name itself that designates +# that these are for testing??? +IntrusionDetector.org.owasp.esapi.errors.IntegrityException.count=10 +IntrusionDetector.org.owasp.esapi.errors.IntegrityException.interval=5 +IntrusionDetector.org.owasp.esapi.errors.IntegrityException.actions=log,disable,logout + +# rapid validation errors indicate scans or attacks in progress +# org.owasp.esapi.errors.ValidationException.count=10 +# org.owasp.esapi.errors.ValidationException.interval=10 +# org.owasp.esapi.errors.ValidationException.actions=log,logout + +# sessions jumping between hosts indicates session hijacking +IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.count=2 +IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.interval=10 +IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.actions=log,logout + + +#=========================================================================== +# ESAPI Validation +# +# The ESAPI Validator works on regular expressions with defined names. You can define names +# either here, or you may define application specific patterns in a separate file defined below. +# This allows enterprises to specify both organizational standards as well as application specific +# validation rules. +# +Validator.ConfigurationFile=validation.properties + +# Validators used by ESAPI +Validator.AccountName=^[a-zA-Z0-9]{3,20}$ +Validator.SystemCommand=^[a-zA-Z\\-\\/]{1,64}$ +Validator.RoleName=^[a-z]{1,20}$ + +#the word TEST below should be changed to your application +#name - only relative URL's are supported +Validator.Redirect=^\\/test.*$ + +# Global HTTP Validation Rules +# Values with Base64 encoded data (e.g. encrypted state) will need at least [a-zA-Z0-9\/+=] +Validator.HTTPScheme=^(http|https)$ +Validator.HTTPServerName=^[a-zA-Z0-9_.\\-]*$ +Validator.HTTPParameterName=^[a-zA-Z0-9_]{1,32}$ +Validator.HTTPParameterValue=^[a-zA-Z0-9.\\-\\/+=@_ ]*$ +Validator.HTTPCookieName=^[a-zA-Z0-9\\-_]{1,32}$ +Validator.HTTPCookieValue=^[a-zA-Z0-9\\-\\/+=_ ]*$ +Validator.HTTPHeaderName=^[a-zA-Z0-9\\-_]{1,32}$ +Validator.HTTPHeaderValue=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ ]*$ +Validator.HTTPContextPath=^\\/?[a-zA-Z0-9.\\-\\/_]*$ +Validator.HTTPServletPath=^[a-zA-Z0-9.\\-\\/_]*$ +Validator.HTTPPath=^[a-zA-Z0-9.\\-_]*$ +Validator.HTTPQueryString=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ %]*$ +Validator.HTTPURI=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ ]*$ +Validator.HTTPURL=^.*$ +Validator.HTTPJSESSIONID=^[A-Z0-9]{10,30}$ + +# Validation of file related input +Validator.FileName=^[a-zA-Z0-9!@#$%^&{}\\[\\]()_+\\-=,.~'` ]{1,255}$ +Validator.DirectoryName=^[a-zA-Z0-9:/\\\\!@#$%^&{}\\[\\]()_+\\-=,.~'` ]{1,255}$ + +# Validation of dates. Controls whether or not 'lenient' dates are accepted. +# See DataFormat.setLenient(boolean flag) for further details. +Validator.AcceptLenientDates=false \ No newline at end of file diff --git a/src/main/resources/IKExpression.cfg.xml b/src/main/resources/IKExpression.cfg.xml new file mode 100644 index 0000000..355ba8c --- /dev/null +++ b/src/main/resources/IKExpression.cfg.xml @@ -0,0 +1,114 @@ + + + + + + java.lang.String + java.lang.String + + + java.lang.String + java.lang.String + + + java.lang.String + java.lang.String + + + java.util.Date + int + int + int + int + int + int + + + + java.util.Date + java.util.Date + + + + + + + java.lang.String + java.lang.String + + + java.lang.String + java.lang.String + + + java.lang.String + java.lang.String + + + java.lang.Object + java.lang.String + java.lang.String + + + java.lang.Object + java.lang.Object + + + java.lang.Object + java.lang.Object + + + java.lang.Object + java.lang.Object + + + java.lang.Object + java.lang.Object + + + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + + + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + java.lang.Object + + + java.lang.String + java.lang.String + + + java.lang.String + java.lang.String + + + java.lang.String + + + java.lang.String + + + + + + \ No newline at end of file diff --git a/src/main/resources/RequestService.wsdl b/src/main/resources/RequestService.wsdl new file mode 100644 index 0000000..eee34f7 --- /dev/null +++ b/src/main/resources/RequestService.wsdl @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/log4j-dev.properties b/src/main/resources/log4j-dev.properties new file mode 100644 index 0000000..e39ed1a --- /dev/null +++ b/src/main/resources/log4j-dev.properties @@ -0,0 +1,12 @@ +log4j.rootLogger = DEBUG,A1 + +#if you want to open the trace from open source,just add # ahead of line +log4j.logger.org = ERROR +log4j.logger.uk = ERROR + +log4j.appender.A1 = org.apache.log4j.ConsoleAppender +log4j.appender.A1.layout = org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern =- %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5p] [%t] [%c.%M(%F:%L)] - %msg%n + + + diff --git a/src/main/resources/paoding-dic-home.properties b/src/main/resources/paoding-dic-home.properties new file mode 100644 index 0000000..eb678f9 --- /dev/null +++ b/src/main/resources/paoding-dic-home.properties @@ -0,0 +1,12 @@ + +#values are "system-env" or "this"; +#if value is "this" , using the paoding.dic.home as dicHome if configed! +paoding.dic.home.config-fisrt=this + +#dictionary home (directory) +#"classpath:xxx" means dictionary home is in classpath. +#e.g "classpath:dic" means dictionaries are in "classes/dic" directory or any other classpath directory +paoding.dic.home=D:/Workspace/paoding/dic + +#seconds for dic modification detection +#paoding.dic.detector.interval=60 diff --git a/src/main/resources/quartz.properties b/src/main/resources/quartz.properties new file mode 100644 index 0000000..de774d7 --- /dev/null +++ b/src/main/resources/quartz.properties @@ -0,0 +1,49 @@ +# Default Properties file for use by StdSchedulerFactory +# to create a Quartz Scheduler Instance, if a different +# properties file is not explicitly specified. +# + +org.quartz.scheduler.rmi.export=false +org.quartz.scheduler.rmi.proxy=false +org.quartz.scheduler.wrapJobExecutionInUserTransaction=false +#============================================================================ +# Configure Main Scheduler Properties +#============================================================================ + +org.quartz.scheduler.instanceName=MyClusteredScheduler +org.quartz.scheduler.instanceId=AUTO +#============================================================================ +# Configure ThreadPool +#============================================================================ + +org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool +org.quartz.threadPool.threadCount=100 +org.quartz.threadPool.threadPriority=5 +org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true +#============================================================================ +# Configure JobStore +#============================================================================ + +org.quartz.jobStore.misfireThreshold=60000 +#org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore + +org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX +#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate + +org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.MSSQLDelegate +org.quartz.jobStore.useProperties=false +org.quartz.jobStore.dataSource=myDS +org.quartz.jobStore.tablePrefix=QRTZ_ +org.quartz.jobStore.isClustered=true +org.quartz.jobStore.clusterCheckinInterval=20000 +#============================================================================ +# Configure Datasources +#============================================================================ + +org.quartz.dataSource.myDS.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver +org.quartz.dataSource.myDS.URL=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=E9test +org.quartz.dataSource.myDS.user=sa + +org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow=60000 + +org.quartz.scheduler.batchTriggerAcquisitionMaxCount=100 diff --git a/src/main/resources/validation.properties b/src/main/resources/validation.properties new file mode 100644 index 0000000..e69de29