diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java index 4e3d5b8f..af4e1e23 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java @@ -2,6 +2,7 @@ package com.awspaas.user.apps.integration.controller; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.bpms.util.DBSql; @@ -15,6 +16,19 @@ import java.util.*; @Controller public class GetmeritsController { + + + /** + * 获取页面的方法 + */ + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getHtml") + public String getHtml(){ + + String html = "territory.html"; + + return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html,new LinkedHashMap<>()); + } + /** * 这是第一个图的筛选方法 * @param sid session diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java index 0287b14f..6b21cec0 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java @@ -2,6 +2,7 @@ package com.awspaas.user.apps.integration.controller; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; @@ -27,25 +28,19 @@ import java.util.*; @Controller public class SendOAProcessController { @Mapping("com.awspaas.user.apps.integration.controller.SendOAProcessController.SendProcessByOA") - public JSONObject SendProcessByOA(String sid,String taskInstId,String processInstId) throws IOException, DocumentException { + public JSONObject SendProcessByOA(String sid,String taskInstId,String processInstId,String isSave) throws IOException, DocumentException { JSONObject result = new JSONObject(new LinkedHashMap<>()); ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); TaskInstance instanceById1 = SDK.getTaskAPI().getInstanceById(taskInstId); XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); xmlDatasUtil.setExternal_system_ID("LCZD"); xmlDatasUtil.setOther_system_to_do_ID(instanceById1.getId()); - BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail(); - if (bo_act_coe_publish!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); - }else { - BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", instanceById.getId()).detail(); - if (bo_eu_1664184390101!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_TITLE")+"】,点击进行处理"); - }else { - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+instanceById.getTitle()+"】,点击进行处理"); - } + ProcessDefinition processDefinition = SDK.getRepositoryAPI().getProcessDefinition(instanceById.getProcessDefId()); + String processName = processDefinition.getName(); + xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+processName+"】"); + + - } //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin String portalUrl = SDK.getPortalAPI().getPortalUrl(); @@ -53,7 +48,7 @@ public class SendOAProcessController { portalUrl = "https://bpm.yili.com:8088/portal/"; } xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+instanceById.getId()+"&taskInstId="+instanceById1.getId()); - xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount="+instanceById1.getTarget()+"&processInstId="+instanceById.getId()+"&taskInstId="+instanceById1.getId()); + xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+instanceById1.getTarget()+"&processInstId="+instanceById.getId()+"&taskInstId="+instanceById1.getId()); String target = instanceById1.getTarget(); if (target.length()==8&&"00".equals(target.substring(0,2))){ target = target.substring(2); @@ -69,6 +64,7 @@ public class SendOAProcessController { String substring = str.substring(str.indexOf(" "), str.length()); xmlDatasUtil.setTo_do_creation_time(substring); xmlDatasUtil.setTo_do_completion_time(substring); + //if (taskInstance.getState()==1){ xmlDatasUtil.setTo_do_status("0"); //} @@ -77,7 +73,8 @@ public class SendOAProcessController { // xmlDatasUtil.setViewtype("0"); // }else if (taskInstance.getReadState()==1){ xmlDatasUtil.setViewtype("0"); -// } +// + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" "))); /*String der =""; @@ -142,49 +139,52 @@ public class SendOAProcessController { HttpClientUtils httpClientUtil = new HttpClientUtils(); - String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil); + BO bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_OA_MOBILEURL", true).addQuery("TODOID=", instanceById1.getId()).detail(); + if (bo_eu_oa_mobileurl==null){ + String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil); - BO bo = new BO(); - bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID()); - bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID()); - bo.set("CONTENT",xmlDatasUtil.getProcess_title()); - bo.set("PCURL",xmlDatasUtil.getPcurl()); - bo.set("MOBILEURL",xmlDatasUtil.getMobileurl()); - bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account()); - bo.set("STATUS",xmlDatasUtil.getTo_do_status()); - bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type()); - bo.set("VIEWTYPE",xmlDatasUtil.getViewtype()); - bo.set("CREATEDATES",xmlDatasUtil.getCreatedate()); - bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time()); - bo.set("DONEDATE",xmlDatasUtil.getDonedate()); - bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status()); - bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate()); - bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime()); - bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype()); - bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode()); - bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename()); - bo.set("NOOPERATOR",xmlDatasUtil.getNooperator()); - bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode()); - bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname()); - bo.set("OA_RESULT",s); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - bo.set("OA_DATE",sdf.format(new Date())); - SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(instanceById1.getTarget())); + BO bo = new BO(); + bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID()); + bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID()); + bo.set("CONTENT",xmlDatasUtil.getProcess_title()); + bo.set("PCURL",xmlDatasUtil.getPcurl()); + bo.set("MOBILEURL",xmlDatasUtil.getMobileurl()); + bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account()); + bo.set("STATUS",xmlDatasUtil.getTo_do_status()); + bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type()); + bo.set("VIEWTYPE",xmlDatasUtil.getViewtype()); + bo.set("CREATEDATES",xmlDatasUtil.getCreatedate()); + bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time()); + bo.set("DONEDATE",xmlDatasUtil.getDonedate()); + bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status()); + bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate()); + bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime()); + bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype()); + bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode()); + bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename()); + bo.set("NOOPERATOR",xmlDatasUtil.getNooperator()); + bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode()); + bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname()); + bo.set("OA_RESULT",s); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bo.set("OA_DATE",sdf.format(new Date())); + SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(instanceById1.getTarget())); - if (s.contains("success")){ - result.put("result","ok"); - }else { - result.put("result","error"); - System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); - TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskInstId); - ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", taskInstance.getTarget()+ "失败更新待办"); - BO bo_faid = new BO(); - bo_faid.set("CHANGED","1"); - bo_faid.set("TASK_ID",taskInstId); - bo_faid.set("PROCESS_ID",processInstId); - UserContext userContext = UserContext.fromUID("admin"); - SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); - SDK.getProcessAPI().start(processInstance); + if (s.contains("success")){ + result.put("result","ok"); + }else { + result.put("result","error"); + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskInstId); + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", taskInstance.getTarget()+ "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","1"); + bo_faid.set("TASK_ID",taskInstId); + bo_faid.set("PROCESS_ID",processInstId); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } } return result; } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java index 585c83fd..fe1fd6f4 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java @@ -400,6 +400,7 @@ public class ProcessAfterData extends InterruptListener { xmlDatasUtil.setExternal_system_ID("LCZD"); xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + if (processInstance!=null){ BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail(); if (bo_act_coe_publish!=null){ xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); @@ -413,7 +414,9 @@ public class ProcessAfterData extends InterruptListener { } - + }else { + xmlDatasUtil.setProcess_title(" 您有一条流程发布流程已作废,点击进行处理"); + } //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin String portalUrl = SDK.getPortalAPI().getPortalUrl(); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java index 9d687c57..8fd4e15b 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java @@ -15,9 +15,11 @@ import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.login.constant.LoginConst; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.org.model.DepartmentModel; import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.server.SSOUtil; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.fs.DCContext; import com.actionsoft.bpms.util.DBSql; @@ -30,6 +32,9 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.awspaas.user.apps.integration.oa.TaskListener; +import com.awspaas.user.apps.integration.util.AesUtil; +import com.awspaas.user.apps.integration.util.DownloadUtil; +import com.awspaas.user.apps.integration.util.HttpUtil; import com.awspaas.user.apps.integration.util.UtilUrl; import com.google.common.io.ByteStreams; import org.apache.commons.httpclient.HttpClient; @@ -75,7 +80,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { if (!"terminate".equals(processExecutionContext.getProcessInstance().getControlState())) { - + DownloadUtil downloadUtil = new DownloadUtil(); String wsId = ""; JSONArray filed = new JSONArray(new LinkedList<>()); String portalUrl = SDK.getPortalAPI().getPortalUrl(); @@ -131,7 +136,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { String da = bo_act_coe_publish1.getString("SEND_SCOP"); if (da.equals("1")) { - List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'"); + List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'and userno is not null"); for (RowMap row : select_userid_from_orguser ) { DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); @@ -162,6 +167,9 @@ public class ProcessEndAfterEvent extends ExecuteListener { System.out.println("部门id》》》》》》》》》》》》》"+org_list ); System.out.println("posts_list》》》》》》》》》》》》》"+posts_list); System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list); + System.out.println("部门数量》》》》》》》》》》》》》"+org_list.size() ); + System.out.println("岗位数量》》》》》》》》》》》》》"+posts_list.size()); + System.out.println("职级数量》》》》》》》》》》》》》"+ranks_list.size()); if (org_list.size()!=0 && org_list!=null) { for (String depaartid : org_list ) { @@ -220,23 +228,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()){ + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -245,23 +247,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -270,23 +266,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()){ + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -295,23 +285,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -320,23 +304,16 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -345,23 +322,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -370,23 +341,17 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id); for (UserModel user : allUsersByDepartments ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } @@ -396,55 +361,44 @@ public class ProcessEndAfterEvent extends ExecuteListener { List allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid); for (UserModel user : allUsersByDepartment ) { - System.out.println("user.getExt2())???????????" + user.getExt2()); - System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); - System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + System.out.println("user.getExt2())???????????" + user.getExt2()); + System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); + System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - + } + String posts=""; + if (posts_list.size() !=0 &&ranks_list.size()==0) { + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and userno is not null"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } } } if (org_list.size()==0||org_list==null){ String posts=""; String levels = ""; - if (posts_list.size() !=0 &&ranks_list.size()!=0){ - String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); - String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); - if (post.length==1){ - // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); - posts = "'"+post[0]+"'"; - }else { - posts = "'"+ StringUtils.join(post, "','")+"'"; - } - if (level.length==1){ - levels = "'"+level[0]+"'"; - }else { - levels = "'"+ StringUtils.join(level, "','")+"'"; - } - List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")"); - for (RowMap map:maps - ) { - uid+=map.getString("USERID")+","; - } - } else if (posts_list.size() !=0 &&ranks_list.size()==0) { + if (posts_list.size() !=0 &&ranks_list.size()==0) { String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); if (post.length==1){ // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); @@ -452,7 +406,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { }else { posts = "'"+ StringUtils.join(post, "','")+"'"; } - List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")"); + List maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and POSITION_NO in(" + posts + ")"); for (RowMap map:maps ) { uid+=map.getString("USERID")+","; @@ -465,7 +419,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { }else { levels = "'"+ StringUtils.join(level, "','")+"'"; } - List maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")"); + List maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and EXT2 in (" + levels + ")"); for (RowMap map:maps ) { uid+=map.getString("USERID")+","; @@ -487,15 +441,21 @@ public class ProcessEndAfterEvent extends ExecuteListener { list.addAll(h); for (String userid:list ) { - - System.out.println("当前账户======》》》》"+userid); + new_uid+=userid+","; + // System.out.println("当前账户======》》》》"+userid); // BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail(); // if (boEuOaReson!=null){ - new_uid+=userid+","; + /* BO bo = new BO(); + bo.set("USER_CODE",userid); + bo.set("USER_NAME",SDK.getORGAPI().getUser(userid).getUserName()); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_YEUWS",bo,userContext);*/ // } } } + + System.out.println("账户人员信息>>>>>>>>>>>>>"+new_uid); } if (StringUtils.isNotEmpty(new_uid @@ -506,7 +466,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { String[] users = new_uid.split(","); int length = 300; int ys = users.length%length; - if (ys==0) { + /*if (ys==0) { int size = users.length/length; int flag = 0; @@ -562,7 +522,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { } } }); - } + }*/ // System.out.println("subString==========================="+substring.substring(substring.lastIndexOf(";")+1,substring.length())); // substring = substring.substring(substring.lastIndexOf(";")+1,substring.length()); @@ -577,11 +537,71 @@ public class ProcessEndAfterEvent extends ExecuteListener { List bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); List bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); List bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); - + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); JSONArray jsonArray = new JSONArray(); + JSONArray jsonArray_EHSQ = new JSONArray(); + for (BO bo:bo_act_coe_publish_n + ) { + JSONObject jsonObject_ehsq = new JSONObject(new LinkedHashMap<>()); + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + wsId = model.getWsId(); + String publishfileid = bo.getString("PUBLISHFILEID"); + LinkedHashMap downloadurl = downloadUtil.outputReportDownload(UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()), bo.getString("TASKID"), publishfileid); + jsonObject_ehsq.put("fileid",bo.getString("TASKID")); + jsonObject_ehsq.put("filename",bo.getString("PUBLISHFILENAME")); + jsonObject_ehsq.put("filecode",bo.getString("PUBLISH_NUMBER")); + String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; + RowMap map = DBSql.getMap(sql_n); + jsonObject_ehsq.put("verion",map.getString("PLVER")); + jsonObject_ehsq.put("releasedate",simpleDateFormat.format(new Date())); + jsonObject_ehsq.put("effectivedate",simpleDateFormat.format(new Date())); + jsonObject_ehsq.put("authorcode",processExecutionContext.getTaskInstance().getTarget()); + jsonObject_ehsq.put("authorname",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getUserName()); + jsonObject_ehsq.put("companycode",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getNo()); + jsonObject_ehsq.put("authorcompany",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getName()); + BO bo1 = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE", true).addQuery("PALNAME=", bo.getString("PUBLISHFILENAME")).detail(); + if (bo1!=null){ + if (bo1.getString("PERMTYPE").equals("1")){ + jsonObject_ehsq.put("releasescope","内蒙古伊利实业集团股份有限公司"); + }else { + String departname = ""; + String orgperm = bo1.getString("ORGPERM"); + String dleass = ""; + String[] deptSplit = orgperm.split(","); + if(deptSplit.length==1){ + dleass = "'"+deptSplit[0]+"'"; + } + dleass ="'"+ StringUtils.join(deptSplit, "','")+"'"; + List maps = DBSql.getMaps("select DEPARTMENTNAME from ORGDEPARTMENT where ID in (" + dleass + ")"); + for (RowMap rowmas:maps + ) { + departname+=rowmas.getString("DEPARTMENTNAME")+";"; + } + jsonObject_ehsq.put("releasescope",departname); + } + } + + System.out.println("任务办理者>>>>>>>>>>>"+processExecutionContext.getTaskInstance().getTarget()); + String sessionId = new SSOUtil().registerClientSessionNoPassword(processExecutionContext.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "localhost", LoginConst.DEVICE_PC); + + System.out.println("办理者的sessionid>>>>>>>>>>>"+sessionId); + String downurl = downloadUtil.getzipURL(sessionId,bo.getString("TASKID"),bo.getString("PUBLISHFILENAME")); + jsonObject_ehsq.put("downloadurl","https://bpm.yili.com:8088/portal/r"+downurl.toString().substring(1)); + String recordfiles = ""; + String recordurls = ""; + Set keys = downloadurl.keySet(); + for ( String key : keys ) { + recordfiles+=key+";"; + String fileDownurl = downloadurl.get(key); + recordurls+=fileDownurl+";"; + } + jsonObject_ehsq.put("recordfiles",recordfiles); + jsonObject_ehsq.put("recordurls",recordurls); + jsonArray_EHSQ.add(jsonObject_ehsq); + } int m = 0; for (BO bo:bo_act_coe_publish_n @@ -681,6 +701,71 @@ public class ProcessEndAfterEvent extends ExecuteListener { } } + + + for (BO bo:bo_act_coe_publish_c + ) { + JSONObject jsonObject_ehsq = new JSONObject(new LinkedHashMap<>()); + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + wsId = model.getWsId(); + String publishfileid = bo.getString("CHANGEDFILEIDNEW"); + LinkedHashMap downloadurl = downloadUtil.outputReportDownload(UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()), bo.getString("TASKID"), publishfileid); + jsonObject_ehsq.put("fileid",bo.getString("TASKID")); + jsonObject_ehsq.put("filename",bo.getString("CHANGEDFILENAMENEW")); + jsonObject_ehsq.put("filecode",bo.getString("CHANGE_NUMBER")); + String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; + RowMap map = DBSql.getMap(sql_n); + jsonObject_ehsq.put("verion",map.getString("PLVER")); + jsonObject_ehsq.put("releasedate",simpleDateFormat.format(new Date())); + jsonObject_ehsq.put("effectivedate",simpleDateFormat.format(new Date())); + jsonObject_ehsq.put("authorcode",processExecutionContext.getTaskInstance().getTarget()); + jsonObject_ehsq.put("authorname",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getUserName()); + jsonObject_ehsq.put("companycode",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getCompanyModel().getNo()); + jsonObject_ehsq.put("authorcompany",UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getCompanyModel().getName()); + BO bo1 = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE", true).addQuery("PALNAME=", bo.getString("PUBLISHFILENAME")).detail(); + if (bo1!=null){ + if (bo1.getString("PERMTYPE").equals("1")){ + jsonObject_ehsq.put("releasescope","内蒙古伊利实业集团股份有限公司"); + }else { + + String departname = ""; + String orgperm = bo1.getString("ORGPERM"); + String dleass = ""; + String[] deptSplit = orgperm.split(","); + if(deptSplit.length==1){ + dleass = "'"+deptSplit[0]+"'"; + } + dleass ="'"+ StringUtils.join(deptSplit, "','")+"'"; + + List maps = DBSql.getMaps("select DEPARTMENTNAME from ORGDEPARTMENT where ID in (" + dleass + ")"); + for (RowMap rowmas:maps + ) { + departname+=rowmas.getString("DEPARTMENTNAME")+";"; + } + jsonObject_ehsq.put("releasescope",departname); + + } + } + + String sessionId = new SSOUtil().registerClientSessionNoPassword(processExecutionContext.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "localhost", LoginConst.DEVICE_PC); + + String downurl = downloadUtil.getzipURL(sessionId,bo.getString("TASKID"),bo.getString("CHANGEDFILENAMENEW")); + jsonObject_ehsq.put("downloadurl","https://bpm.yili.com:8088/portal/r"+downurl.toString().substring(1)); + String recordfiles = ""; + String recordurls = ""; + Set keys = downloadurl.keySet(); + for ( String key : keys ) { + recordfiles+=key+";"; + String fileDownurl = downloadurl.get(key); + recordurls+=fileDownurl+";"; + } + jsonObject_ehsq.put("recordfiles",recordfiles); + jsonObject_ehsq.put("recordurls",recordurls); + jsonArray_EHSQ.add(jsonObject_ehsq); + } + + SendEHSQFile(jsonArray_EHSQ); + for (BO bo:bo_act_coe_publish_c ) { OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); @@ -1138,4 +1223,30 @@ public class ProcessEndAfterEvent extends ExecuteListener { } } + + + public String SendEHSQFile(JSONArray jsonArray) throws Exception { + /** + * 首先需要将传过来的参数进行加密操作,并设置 + */ + AesUtil aesUtil = new AesUtil(); + String system = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "system"); + String AES = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "AES"); + String EHSQUrl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "EHSQUrl"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMDDHHmmss"); + String date = sdf.format(new Date()); + String data = system+"##"+date; + String encrypt = aesUtil.encrypt(data, AES); //获取加密之后的秘钥 + JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); + jsonObject.put("system",system); + jsonObject.put("token",encrypt); + jsonObject.put("infos",jsonArray); + HttpUtil httpUtil = new HttpUtil(); + System.out.println("jsonobject>>>>>>>>>>>>>>>>>>>"+jsonObject); + String s = httpUtil.sendPost(jsonObject, EHSQUrl); + System.out.println("发送到EHSQ是否是正确的>>>>>>>>>"+s); + + return s; + } + } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/TestEvent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/TestEvent.java index 7abea3f4..8db4942b 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/TestEvent.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/TestEvent.java @@ -1,8 +1,21 @@ package com.awspaas.user.apps.integration.event; +import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.org.model.DepartmentModel; +import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.sdk.local.SDK; +import org.apache.commons.lang.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; /** * @PackageName: com.awspaas.user.apps.yili.event @@ -11,8 +24,353 @@ import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface; * @date: 2022/5/30 20:20 */ public class TestEvent extends ExecuteListener implements ExecuteListenerInterface { + + + + @Override + public String getVersion() { + return "0.0.1"; + } + + @Override + public String getProvider() { + return "ActionSoft"; + } + + @Override + public String getDescription() { + return "这个主要是做部门/岗位/职级进行并集,交集测试"; + } + @Override public void execute(ProcessExecutionContext processExecutionContext) throws Exception { - System.err.println(">>>>>>>>>111111111"); + BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_EU_WCY_TEST", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); + String uid = ""; + String new_uid = ""; + if(bo_act_coe_publish1!=null) { + String da = bo_act_coe_publish1.getString("SEND_SCOP"); + + if (da.equals("1")) { + List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'and userno is not null"); + for (RowMap row : select_userid_from_orguser + ) { + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + uid += row.getString("USERID") + ","; + } + } + } else { + List posts_list = new ArrayList(); + List org_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){ + String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(","); + org_list= Arrays.asList(strs); + } + + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) { + String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + posts_list = Arrays.asList(posts); + } + List ranks_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) { + String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + ranks_list = Arrays.asList(ranks); + } + + System.out.println("部门id》》》》》》》》》》》》》"+org_list ); + System.out.println("posts_list》》》》》》》》》》》》》"+posts_list); + System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list); + System.out.println("部门数量》》》》》》》》》》》》》"+org_list.size() ); + System.out.println("岗位数量》》》》》》》》》》》》》"+posts_list.size()); + System.out.println("职级数量》》》》》》》》》》》》》"+ranks_list.size()); + if (org_list.size()!=0 && org_list!=null) { + for (String depaartid : org_list + ) { + System.out.println("departid>>>>>>>>>>>>>" + depaartid); + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid); + boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache(); + System.out.println("是否含有下级?????????????" + existSubModelOfCache); + //判断选中的是否有下级部门 + if (existSubModelOfCache) { + List maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'"); + for (RowMap row : maps + ) { + String id = row.getString("ID"); + DepartmentModel model = SDK.getORGAPI().getDepartmentById(id); + + if (model.isExistSubModelOfCache()) { + //有下级部门的选中有下级部门 + List rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'"); + for (RowMap wo : + rowMapList) { + String ids = wo.getString("ID"); + DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids); + if (model1.isExistSubModelOfCache()) { + List rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'"); + for (RowMap wsa : + rowMapLists) { + String wsaString = wsa.getString("ID"); + DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString); + if (model2.isExistSubModelOfCache()) { + List rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'"); + for (RowMap rows : + rowMapList1) { + String rowsString = rows.getString("ID"); + DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString); + if (model3.isExistSubModelOfCache()) { + List rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'"); + for (RowMap ormap : + rowMapList2) { + String rowsString1 = ormap.getString("ID"); + DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1); + if (model4.isExistSubModelOfCache()) { + List rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'"); + for (RowMap owmapr : + rowMaps) { + String row_id = owmapr.getString("ID"); + DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id); + if (model5.isExistSubModelOfCache()) { + List rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'"); + for (RowMap owzmap : + rowMapList3) { + String idsa = owzmap.getString("ID"); + DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa); + if (model6.isExistSubModelOfCache()) { + + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()){ + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()){ + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id); + for (UserModel user : allUsersByDepartments + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + } else { + //选中的没有下级部门 + List allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid); + for (UserModel user : allUsersByDepartment + ) { + if (!user.isClosed()) { + System.out.println("userclose>>>>>>>>>>"+user.isClosed()); + + System.out.println("user.getExt2())???????????" + user.getExt2()); + System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); + System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); + if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } + String posts=""; + if (posts_list.size() !=0 &&ranks_list.size()==0) { + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and userno is not null"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + } + } + if (org_list.size()==0||org_list==null){ + String posts=""; + String levels = ""; + if (posts_list.size() !=0 &&ranks_list.size()==0) { + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and POSITION_NO in(" + posts + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + }else if (posts_list.size() ==0 &&ranks_list.size()!=0){ + String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + + if (level.length==1){ + levels = "'"+level[0]+"'"; + }else { + levels = "'"+ StringUtils.join(level, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and EXT2 in (" + levels + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + } + + } + } + System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); + + List list = new ArrayList(Arrays.asList(split)); + + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + for (String userid:list + ) { + new_uid+=userid+","; + // System.out.println("当前账户======》》》》"+userid); + // BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail(); + // if (boEuOaReson!=null){ + BO bo = new BO(); + bo.set("USER_CODE",userid); + bo.set("USER_NAME",SDK.getORGAPI().getUser(userid).getUserName()); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_YEUWS",bo,userContext); + // } + + } + } + + System.out.println("账户人员信息>>>>>>>>>>>>>"+new_uid); + } } } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/getEHSQDataEvent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/getEHSQDataEvent.java new file mode 100644 index 00000000..b9142a58 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/getEHSQDataEvent.java @@ -0,0 +1,11 @@ +package com.awspaas.user.apps.integration.event; + +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; +import com.actionsoft.sdk.local.SDK; + +public class getEHSQDataEvent extends ExecuteListener { + @Override + public void execute(ProcessExecutionContext processExecutionContext) throws Exception { + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/tetdt.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/tetdt.java new file mode 100644 index 00000000..5d4d9d31 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/tetdt.java @@ -0,0 +1,395 @@ +package com.awspaas.user.apps.integration.event; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.org.model.DepartmentModel; +import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.sdk.local.SDK; +import org.apache.commons.lang.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +public class tetdt extends ExecuteListener { + @Override + public void execute(ProcessExecutionContext processExecutionContext) throws Exception { + BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); + String uid = ""; + String new_uid = ""; + if(bo_act_coe_publish1!=null) { + String da = bo_act_coe_publish1.getString("SEND_SCOP"); + + if (da.equals("1")) { + List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'"); + for (RowMap row : select_userid_from_orguser + ) { + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + uid += row.getString("USERID") + ","; + } + } + } else { + List posts_list = new ArrayList(); + List org_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){ + String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(","); + org_list= Arrays.asList(strs); + } + + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) { + String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + posts_list = Arrays.asList(posts); + } + List ranks_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) { + String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + ranks_list = Arrays.asList(ranks); + } + + System.out.println("部门id》》》》》》》》》》》》》"+org_list ); + System.out.println("posts_list》》》》》》》》》》》》》"+posts_list); + System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list); + if (org_list.size()!=0 && org_list!=null) { + for (String depaartid : org_list + ) { + System.out.println("departid>>>>>>>>>>>>>" + depaartid); + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid); + boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache(); + System.out.println("是否含有下级?????????????" + existSubModelOfCache); + //判断选中的是否有下级部门 + if (existSubModelOfCache) { + List maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'"); + for (RowMap row : maps + ) { + String id = row.getString("ID"); + DepartmentModel model = SDK.getORGAPI().getDepartmentById(id); + + if (model.isExistSubModelOfCache()) { + //有下级部门的选中有下级部门 + List rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'"); + for (RowMap wo : + rowMapList) { + String ids = wo.getString("ID"); + DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids); + if (model1.isExistSubModelOfCache()) { + List rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'"); + for (RowMap wsa : + rowMapLists) { + String wsaString = wsa.getString("ID"); + DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString); + if (model2.isExistSubModelOfCache()) { + List rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'"); + for (RowMap rows : + rowMapList1) { + String rowsString = rows.getString("ID"); + DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString); + if (model3.isExistSubModelOfCache()) { + List rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'"); + for (RowMap ormap : + rowMapList2) { + String rowsString1 = ormap.getString("ID"); + DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1); + if (model4.isExistSubModelOfCache()) { + List rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'"); + for (RowMap owmapr : + rowMaps) { + String row_id = owmapr.getString("ID"); + DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id); + if (model5.isExistSubModelOfCache()) { + List rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'"); + for (RowMap owzmap : + rowMapList3) { + String idsa = owzmap.getString("ID"); + DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa); + if (model6.isExistSubModelOfCache()) { + + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + } + } else { + //选中的没有下级部门 + List allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid); + for (UserModel user : allUsersByDepartment + ) { + System.out.println("user.getExt2())???????????" + user.getExt2()); + System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); + System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { + uid += user.getUID() + ","; + } + } + } + + } + } + if (org_list.size()==0||org_list==null){ + String posts=""; + String levels = ""; + if (posts_list.size() !=0 &&ranks_list.size()!=0){ + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + if (level.length==1){ + levels = "'"+level[0]+"'"; + }else { + levels = "'"+ StringUtils.join(level, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + } else if (posts_list.size() !=0 &&ranks_list.size()==0) { + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + }else if (posts_list.size() ==0 &&ranks_list.size()!=0){ + String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + + if (level.length==1){ + levels = "'"+level[0]+"'"; + }else { + levels = "'"+ StringUtils.join(level, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + } + + } + } + System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); + + List list = new ArrayList(Arrays.asList(split)); + + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + for (String userid:list + ) { + + System.out.println("当前账户======》》》》"+userid); + // BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail(); + // if (boEuOaReson!=null){ + new_uid+=userid+","; + // } + + } + } + } + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/TestSendOARead.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/TestSendOARead.java index 71c2d735..51786875 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/TestSendOARead.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/TestSendOARead.java @@ -591,7 +591,7 @@ public class TestSendOARead implements IJob { } }*/ - jsonObject.put("userList","00345531"); + jsonObject.put("userList","10056870"); String xmlStr = "\n" + " " + " " + diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java index bf5a309a..8d7fab4f 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java @@ -23,7 +23,7 @@ import java.util.Map; public class UpdateOADAIBANJob implements IJob { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - List bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_OA_MOBILEURL", true).list(); + List bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_UPDATE_OA", true).list(); for (BO bo:bo_eu_oa_mobileurl ) { XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); @@ -33,25 +33,25 @@ public class UpdateOADAIBANJob implements IJob { xmlDatasUtil.setProcess_title(bo.getString("CONTENT")); //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin - xmlDatasUtil.setPcurl(bo.getString("PCURL")); - xmlDatasUtil.setMobileurl(bo.getString("MOBILEURL")); + xmlDatasUtil.setPcurl(bo.getString("PCURL").replaceAll("&","&")); + xmlDatasUtil.setMobileurl(bo.getString("MOBILEURL").replaceAll("&","&")); xmlDatasUtil.setTo_do_login_account(bo.getString("HRCODE")); xmlDatasUtil.setTo_do_creation_time(bo.getString("NEWCREATETIME")); xmlDatasUtil.setTo_do_completion_time(bo.getString("NEWDONETIME")); - xmlDatasUtil.setTo_do_status(bo.getString("STATUS")); + xmlDatasUtil.setTo_do_status("1"); - xmlDatasUtil.setTo_do_official_type(bo.getString("WFTYPE")); + xmlDatasUtil.setTo_do_official_type("0"); - xmlDatasUtil.setViewtype(bo.getString("VIEWTYPE")); + xmlDatasUtil.setViewtype("-2"); xmlDatasUtil.setCreatedate(bo.getString("CREATEDATES")); xmlDatasUtil.setDonedate(bo.getString("DONEDATE")); xmlDatasUtil.setReceivedate(bo.getString("RECEIVEDATE")); xmlDatasUtil.setReceivetime(bo.getString("RECEIVETIME")); - xmlDatasUtil.setCurrentnodetype(bo.getString("CURRENTNODETYPE")); + xmlDatasUtil.setCurrentnodetype("0"); xmlDatasUtil.setRequestcode(bo.getString("REQUESTCODE")); xmlDatasUtil.setCurrentnodename(bo.getString("CURRENTNODENAME")); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java index 64c73b1f..016d4771 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java @@ -10,6 +10,7 @@ import java.util.regex.Pattern; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager; +import com.actionsoft.bpms.bpmn.engine.core.context.TaskBehaviorContextImpl; import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; import com.actionsoft.bpms.commons.login.constant.LoginConst; @@ -147,18 +148,21 @@ public class OaPendComponent { xmlDatasUtil.setExternal_system_ID("LCZD"); xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); - if (bo_act_coe_publish!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); - }else { - BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); - if (bo_eu_1664184390101!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_TITLE")+"】,点击进行处理"); + if (!pec.getProcessInstance().getParentTaskInstId().equals("00000000-0000-0000-0000-000000000000")){ + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); }else { - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理"); + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理"); + } } + }else { + xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+pec.getProcessInstance().getTitle()+"】"); } - String gettaskname = gettaskname(taskInstance); - String openstate = ""; + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin String portalUrl = SDK.getPortalAPI().getPortalUrl(); @@ -166,7 +170,7 @@ public class OaPendComponent { portalUrl = "https://bpm.yili.com:8088/portal/"; } xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); - xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); String target = taskInstance.getTarget(); if (target.length()==8&&"00".equals(target.substring(0,2))){ target = target.substring(2); @@ -183,13 +187,13 @@ public class OaPendComponent { xmlDatasUtil.setTo_do_creation_time(substring); xmlDatasUtil.setTo_do_completion_time(substring); //if (taskInstance.getState()==1){ - xmlDatasUtil.setTo_do_status("0"); + xmlDatasUtil.setTo_do_status("0"); //} xmlDatasUtil.setTo_do_official_type("0"); // if (taskInstance.getReadState()==0){ // xmlDatasUtil.setViewtype("0"); // }else if (taskInstance.getReadState()==1){ - xmlDatasUtil.setViewtype("0"); + xmlDatasUtil.setViewtype("0"); // } xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" "))); @@ -208,7 +212,7 @@ public class OaPendComponent { xmlDatasUtil.setCurrentnodetype("0"); xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId()); - xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),pec.getTaskInstance().getActivityDefId()).getName()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),taskInstance.getActivityDefId()).getName()); // 调用App String sourceAppId = pec.getProcessInstance().getAppId(); @@ -250,7 +254,7 @@ public class OaPendComponent { if (bo_eu_oa_reson!=null){ xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID")); } - xmlDatasUtil.setCreaterworkcode(""); + xmlDatasUtil.setCreaterworkcode(""); @@ -289,14 +293,17 @@ public class OaPendComponent { }else { System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); System.out.println("错误提示>>>>>>>>>>>>"+s); - ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办"); - BO bo_faid = new BO(); - bo_faid.set("CHANGED","1"); - bo_faid.set("TASK_ID",pec.getTaskInstance().getId()); - bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); - UserContext userContext = UserContext.fromUID("admin"); - SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); - SDK.getProcessAPI().start(processInstance); + BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("TASK_ID=", taskInstance.getId()).detail(); + if (bo_eu_faid_data==null){ + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","1"); + bo_faid.set("TASK_ID",taskInstance.getId()); + bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } } } @@ -337,34 +344,52 @@ public class OaPendComponent { public void updatePending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, SOAPException, DocumentException { XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); xmlDatasUtil.setExternal_system_ID("LCZD"); - + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); System.out.println("pec.getProcessInstance()>>>>>>>>"+pec.getProcessInstance()); - BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); - if (bo_act_coe_publish!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); - }else { - BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); - if (bo_eu_1664184390101!=null){ - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_TITLE")+"】,点击进行处理"); + if(pec.getProcessInstance()!=null){ + String actionName = getActionName(taskInstance); + if (actionName.equals("传阅")){ + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessDef().name+"】,点击进行处理"); + } + } }else { - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理"); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理"); + } + } } - + }else { + xmlDatasUtil.setProcess_title(" 您有一条发布流程被作废,点击进行处理"); } - String gettaskname = gettaskname(taskInstance); - String openstate = ""; - if (gettaskname.equals("加签")){ - openstate = "&openState=11"; - } //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin String portalUrl = SDK.getPortalAPI().getPortalUrl(); if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl = "https://bpm.yili.com:8088/portal/"; } - xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); - xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + if (pec.getProcessInstance()!=null){ + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + }else { + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&oauthName=oauthLogin&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm"); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm"); + } String target = taskInstance.getTarget(); if (target.length()==8&&"00".equals(target.substring(0,2))){ @@ -377,19 +402,29 @@ public class OaPendComponent { xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID")); } SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒 - String str = df.format(taskInstance.getBeginTime()); - String substring = str.substring(str.indexOf(" "), str.length()); - xmlDatasUtil.setTo_do_creation_time(substring); - xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length())); + if (taskInstance.getBeginTime()!=null){ + String str = df.format(taskInstance.getBeginTime()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length())); + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); + }else { + String str = df.format(new Date()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(new Date()).substring(df.format(new Date()).indexOf(" "), df.format(new Date()).length())); + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(new Date()).substring(0, df.format(new Date()).indexOf(" "))); + } - xmlDatasUtil.setTo_do_status("1"); + xmlDatasUtil.setTo_do_status("1"); xmlDatasUtil.setTo_do_official_type("0"); - xmlDatasUtil.setViewtype("-2"); + xmlDatasUtil.setViewtype("-2"); + - xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); - xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); String der = ""; if (taskInstance.getReadTime()==null){ der= df.format(new Date()); @@ -399,51 +434,62 @@ public class OaPendComponent { xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); - String actionName = getActionName(taskInstance); - if (actionName.equals("确认发布")||equalsAction(GO_BACK, actionName)){ - xmlDatasUtil.setCurrentnodetype("1"); - }else{ + if (taskInstance!=null){ + String actionName = getActionName(taskInstance); + if (actionName.equals("确认发布")||equalsAction(GO_BACK, actionName)){ + xmlDatasUtil.setCurrentnodetype("1"); + }else{ + xmlDatasUtil.setCurrentnodetype("0"); + } + }else { xmlDatasUtil.setCurrentnodetype("0"); } - xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId()); - xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),pec.getTaskInstance().getActivityDefId()).getName()); - // 调用App - String sourceAppId = pec.getProcessInstance().getAppId(); - // aslp服务地址 - String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; - // 参数定义列表 - Map params = new HashMap(); - //流程实例id,必填 - params.put("processInstId", pec.getProcessInstance().getId()); - //,必填 - if (pec.getUserContext()!=null){ - params.put("sid", pec.getUserContext().getSessionId()); - }else { - String sessionId = new SSOUtil().registerClientSessionNoPassword(pec.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC); - params.put("sid", sessionId); - } + if (pec.getProcessInstance()!=null) { + xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),taskInstance.getActivityDefId()).getName()); + // 调用App + String sourceAppId = pec.getProcessInstance().getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", pec.getProcessInstance().getId()); + //,必填 + if (pec.getUserContext()!=null){ + params.put("sid", pec.getUserContext().getSessionId()); + }else { + String sessionId = new SSOUtil().registerClientSessionNoPassword(pec.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC); + params.put("sid", sessionId); + } - AppAPI appAPI = SDK.getAppAPI(); - //流程节点数据 - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); - String username = ""; - String userid = ""; - if (ro.isOk()){ - String data = ro.getData().toString(); - JSONObject jsonObject = JSONObject.parseObject(data); - JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList")); - if (!jsonArray.isEmpty()){ - for(int i=0;i>>>>>>>>>>>"+s); - ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办"); - BO bo_faid = new BO(); - bo_faid.set("CHANGED","2"); - bo_faid.set("TASK_ID",pec.getTaskInstance().getId()); - bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); - UserContext userContext = UserContext.fromUID("admin"); - SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); - SDK.getProcessAPI().start(processInstance); + BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA").addQuery("TASK_ID=", taskInstance.getId()).detail(); + if (bo_eu_faid_data==null){ + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", "admin" + "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","2"); + bo_faid.set("TASK_ID",taskInstance.getId()); + if (pec.getProcessInstance()!=null){ + bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); + } + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } } } + public void readOa(String taskId) throws Exception { + HttpClientUtils httpClientUtil = new HttpClientUtils(); + String s = httpClientUtil.readOa("http://10.105.1.59/services/yili", taskId); + System.out.println("是否更新成已读了》》》》》》》》》》"+s); + } + private String getActionName(TaskInstance taskInstance) { if (null == taskInstance) { return ""; } - final Iterator iterator = ProcessAPIManager.getInstance() - .getComments(taskInstance.getProcessInstId()).iterator(); - TaskCommentModel next; String actionName = ""; - while (iterator.hasNext()) { - if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) { - actionName = next.getActionName(); + Iterator iterator = null; + if (StringUtils.isNotEmpty(taskInstance.getProcessInstId())){ + iterator= ProcessAPIManager.getInstance() + .getComments(taskInstance.getProcessInstId()).iterator(); + + + TaskCommentModel next; + + while (iterator.hasNext()) { + if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) { + actionName = next.getActionName(); + } } } return actionName; diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java index e718fc5d..689167c9 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.dom4j.DocumentException; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import com.actionsoft.bpms.bpmn.constant.ProcessRuntimeConst; @@ -25,9 +26,11 @@ import com.actionsoft.sdk.local.api.LogAPI; import com.actionsoft.sdk.local.api.Logger; import com.actionsoft.sdk.local.api.TaskAPI; +import javax.xml.soap.SOAPException; + /** * @author lihongyu - * + * */ public class TaskListener extends ProcessPubicListener { @@ -56,7 +59,7 @@ public class TaskListener extends ProcessPubicListener { /** * 所有人工任务相关行为发生时被触发(见PublicEventConst常量) ProcessPubicListener - * + * * @param eventName 事件名称,见PublicEventConst常量 * @param taskInstance 任务实例对象 * @param pec 流程引擎提供给监听器的上下文对象 @@ -65,26 +68,30 @@ public class TaskListener extends ProcessPubicListener { @Override public void call(String eventName, TaskInstance taskInstance, ProcessExecutionContext pec) { - + System.out.println("eventName>>>>>>>>>>"+eventName); /** * 手动作废 增加 开始节点作废删除更新OA待办问题 * 后台管理员删除流程 process_before_delete 时候删除 更新OA为已办 */ //System.out.println("11111111111111"); - if (close.equals(sendEnable)) { + if (close.equals(sendEnable)) { return; } OaPendComponent component = new OaPendComponent(); - if (eventName.equals("PROCESS_BEFORE_DELETE")){ - try { - /** - * 这是发起人作废的时候,作废的流程实例,需要更新OA数据 - */ - String irt = pec.getProcessInstance().getStartTaskInstId(); - TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(irt); - component.updatePending(instanceById,pec); - } catch (Exception e) { - e.printStackTrace(); + if (pec!=null){ + if (pec.getProcessInstance()!=null){ + if (eventName.equals("PROCESS_BEFORE_DELETE")&&UtilString.isNotEmpty(pec.getProcessInstance().getParentTaskInstId())){ + try { + /** + * 这是发起人作废的时候,作废的流程实例,需要更新OA数据 + */ + String irt = pec.getProcessInstance().getStartTaskInstId(); + TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(irt); + component.updatePending(instanceById,pec); + } catch (Exception e) { + e.printStackTrace(); + } + } } } @@ -109,7 +116,7 @@ public class TaskListener extends ProcessPubicListener { list.forEach(h -> { logger.info("调用OA删除任务接口:taskInstanceId:" + h.getId()); try { - component.updatePending(taskInstance,pec); + component.readOa(h.getId()); } catch (Exception e) { e.printStackTrace(); } @@ -119,8 +126,7 @@ public class TaskListener extends ProcessPubicListener { } } else if (PublicEventConst.TASK_DELETE.equals(eventName) || taskInstance.getControlState() == "delete") { - if (actionName == ""||actionName.equals("收回沟通任务")||(actionName.equals("传阅")&& PublicEventConst.TASK_READ.equals(eventName))) { - logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); + if (actionName == ""||actionName.equals("收回沟通任务")||(actionName.equals("传阅")&& PublicEventConst.TASK_READ.equals(eventName))||actionName.equals("激活")) { try { component.updatePending(taskInstance,pec); } catch (Exception e) { @@ -130,10 +136,26 @@ public class TaskListener extends ProcessPubicListener { } } String appId = ""; - if(PublicEventConst.TASK_CREATE.equals(eventName)||PublicEventConst.TASK_COMPLETE.equals(eventName)) { + if(PublicEventConst.TASK_CREATE.equals(eventName)) { ProcessDefinition processDef = pec.getProcessDef(); if(null!=processDef) { appId = processDef.getAppId(); + try { + //component.updatePending(taskInstance,pec); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + if (PublicEventConst.TASK_COMPLETE.equals(eventName)){ + ProcessDefinition processDef = pec.getProcessDef(); + if(null!=processDef) { + appId = processDef.getAppId(); + try { + component.updatePending(taskInstance,pec); + } catch (Exception e) { + e.printStackTrace(); + } } } @@ -165,7 +187,7 @@ public class TaskListener extends ProcessPubicListener { } else if (PublicEventConst.TASK_READ.equals(eventName)) { if (taskInstance.getState() == tranReadState) { - + logger.info("更新知会待办,taskInstanceId:" + taskInstance.getId()); try { component.updatePending(taskInstance,pec); @@ -220,7 +242,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("更新OA待办:" + "转办"); } else { try { - component.updatePending(taskInstance,pec); + component.readOa(taskInstance.getId()); } catch (Exception e) { e.printStackTrace(); } @@ -258,7 +280,7 @@ public class TaskListener extends ProcessPubicListener { if (!h.getParentTaskInstId().equals(rootScopeId)) { if (ProcessRuntimeConst.INST_STATE_ACTIVE.equals(h.getControlState()) && noticeState != h.getState()) { - logger.info("更新OA待办:取消,taskInstanceId:" + h.getId()); + logger.info("更新OA待办:取消,taskInstanceId:" + h.getId()); try { component.updatePending(taskInstance,pec); } catch (Exception e) { @@ -280,11 +302,11 @@ public class TaskListener extends ProcessPubicListener { * logger.info("更新OA待办:作废,taskInstanceId:" + taskInstance.getId()); * OaPendComponent component = new OaPendComponent(); * component.updatePending(taskInstance.getId(), "1", "2"); - * + * */ logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); try { - component.updatePending(taskInstance,pec); + component.readOa(taskInstance.getId()); } catch (Exception e) { e.printStackTrace(); } @@ -311,28 +333,26 @@ public class TaskListener extends ProcessPubicListener { } else { strings.add(taskInstance.getId()); } - + } } else if (PublicEventConst.PROCESS_COMPLETE.equals(eventName)) { - ProcessInstance processInstance = pec.getProcessInstance(); - // 流程删除或取消 - if (ProcessRuntimeConst.INST_STATE_TERMINATE.equals(processInstance.getControlState()) - || ProcessRuntimeConst.INST_STATE_CANCEL.equals(processInstance.getControlState())) { - List list = SDK.getHistoryTaskQueryAPI().processInstId(processInstance.getId()) - .list(); - for (int i = 0; i < list.size(); i++) { - HistoryTaskInstance historyTaskInstance = list.get(i); - if (ProcessRuntimeConst.INST_STATE_TERMINATE.equals(historyTaskInstance.getControlState()) - || ProcessRuntimeConst.INST_STATE_CANCEL.equals(historyTaskInstance.getControlState())) { - logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); - OaDeleteComponent(taskInstance.getId()); - } - } + try { + component.updatePending(taskInstance,pec); + } catch (IOException e) { + e.printStackTrace(); + } catch (SOAPException e) { + e.printStackTrace(); + } catch (DocumentException e) { + e.printStackTrace(); } } else if (PublicEventConst.TASK_CANCEL.equals(eventName)) { logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); - OaDeleteComponent(taskInstance.getId()); + try { + component.readOa(taskInstance.getId()); + } catch (Exception e) { + e.printStackTrace(); + } } } @@ -343,7 +363,7 @@ public class TaskListener extends ProcessPubicListener { /** * 获取某个审批步骤的 数据 - * + * * @param processInstId * @param taskInstanceId * @return diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java index c0fc216a..042e24dc 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java @@ -32,6 +32,7 @@ import com.actionsoft.bpms.client.form.UserTaskFormsWeb; import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.org.model.DepartmentModel; import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.server.RequestParams; import com.actionsoft.bpms.server.SSOUtil; @@ -45,6 +46,7 @@ import com.actionsoft.bpms.util.UtilString; import com.actionsoft.exception.AWSException; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.AppAPI; +import com.actionsoft.sdk.local.api.ORGAPI; import com.actionsoft.sdk.local.api.TaskAPI; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -85,19 +87,10 @@ public class TaskController { JSONObject json = JSONObject.parseObject(userInfo); System.out.println("json-=====>>>>"+json); if (StringUtils.isNotEmpty(json.getString("employeenumber"))){ - System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber")); + System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber")); userid = json.getString("employeenumber"); try { - if(UtilString.isNotEmpty(userid)) { - BO bo = new BO(); - bo.set("LOGINUSERNAME",userid); - UserModel user = SDK.getORGAPI().getUser(userid); - if(user!=null) { - SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID(userid)); - } - - } - + setUserLog(userid,"1"); } catch (Exception e) { } } @@ -129,7 +122,38 @@ public class TaskController { return access_token; } + /** + * 用户登录日志 + * @param userid + * @param logType + */ + public void setUserLog(String userid,String logType) { + System.err.println("用户登录记录存入日志========>"+userid+"_类型:"+logType); + if (UtilString.isNotEmpty(userid)) { + String logTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + BO bo = new BO(); + /*String slq = "SELECT ID,LOGINCOUNTS FROM BO_EU_USER_LOGIN_LOG WHERE LOGINUSERNAME = '"+userid+"' AND LOGINTIME = '"+logTime+"'"; + List maps = DBSql.getMaps(slq); + if(maps.size()!=0) { + bo = SDK.getBOAPI().get("BO_EU_USER_LOGIN_LOG", maps.get(0).getString("ID")); + bo.set("LOGINCOUNTS", maps.get(0).getInt("LOGINCOUNTS")+1); + SDK.getBOAPI().update("BO_EU_USER_LOGIN_LOG", bo); + }else {*/ + ORGAPI orgapi = SDK.getORGAPI(); + UserModel user = orgapi.getUser(userid); + DepartmentModel departmentByUser = orgapi.getDepartmentByUser(userid); + bo.set("LOGINUSERNAME", userid); + bo.set("USERBUNAME",user.getExt4()); + bo.set("USERPOST",user.getPositionName()); + bo.set("USERDEPTNAME", departmentByUser.getPathNameOfCache()); + bo.set("LOGINTIME", logTime); + bo.set("LOGINCOUNTS", 1); + bo.set("LOGTYPE", Integer.valueOf(logType)); + SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID("admin")); + //} + } + } /** @@ -142,8 +166,11 @@ public class TaskController { public String openFormPage(UserContext me, RequestParams params) { System.out.println("进入表单了==========="); System.out.println("参数输出==========="+params.asMap()); - - + //打开待办时记录日志 + try { + setUserLog(me.getUID(),"2"); + } catch (Exception e) { + } String sessionId = me.getSessionId(); String portalUrl = SDK.getPortalAPI().getPortalUrl(); if(!SDK.getPortalAPI().checkSession(sessionId)) { @@ -199,9 +226,16 @@ public class TaskController { @Mapping("com.yili_process_page") public String processTest(UserContext me, RequestParams params) throws IOException, SQLException { + System.out.println("params>>>>>>>>>>>>"+params.toString()); + System.out.println("UserContext>>>>>>>>>>>>"+me.getUID()); String userMobile = me.getDeviceType(); String html = "index_web.html"; Connection conn = DBSql.open(); + //用户打开阅览界面日志 + try { + setUserLog(me.getUID(),"3"); + } catch (Exception e) { + } Map map = new LinkedHashMap(); try { JSONArray jsonArray = new JSONArray(); @@ -210,8 +244,10 @@ public class TaskController { String sid = me.getSessionId(); String processInstId = params.get("processInstId"); String taskInstId = params.get("taskInstId"); - String usercode = params.get("usercode"); - + String usercode = "admin"; + if(UtilString.isNotEmpty(params.get("usercode"))){ + usercode = params.get("usercode"); + } map.put("sid", sid); @@ -381,6 +417,8 @@ public class TaskController { List bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).list(); if (bo_act_dataid != null) { + try { + if (SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail()!=null){ String dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail().getString("DATAID"); @@ -388,6 +426,10 @@ public class TaskController { }else { jsonObject.put("dataid", ""); } + + }catch (Exception e){ + + } } jsonObject.put("status","1"); String xmlStr = "\n" + @@ -434,10 +476,17 @@ public class TaskController { @Mapping("com.yili_process_page_phone") public String processPhone(UserContext me, RequestParams params) throws SQLException { + + System.out.println("params>>>>>>>>>>>>"+params.get("userid")); + System.out.println("UserContext>>>>>>>>>>>>"+me.getUID()); String userMobile = me.getDeviceType(); Connection conn = DBSql.open(); JSONArray jsonArray = new JSONArray(); - + //用户打开阅览界面日志 + try { + setUserLog(me.getUID(),"3"); + } catch (Exception e) { + } String html = "index_phone.html"; Map map = new LinkedHashMap(); try{ @@ -445,7 +494,11 @@ public class TaskController { String sid = me.getSessionId(); String processInstId = params.get("processInstId"); String taskInstId = params.get("taskInstId"); - String usercode = params.get("userid"); + + String usercode = "admin"; + if(UtilString.isNotEmpty(me.getUID())){ + usercode = me.getUID(); + } StringBuffer sb = new StringBuffer(); ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); String sourceAppId = instanceById.getAppId(); @@ -741,10 +794,14 @@ public class TaskController { jsonObject.put("status","1"); //jsonObject.put("pcurl",url); // jsonObject.put("mobileurl",mobileurl); + try { BO bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=", usercode).detail(); if (bo_act_dataid!=null){ jsonObject.put("dataid",bo_act_dataid.getString("DATAID")); } + }catch (Exception e){ + + } //jsonObject.put("userList","00345531"); HttpClientUtils httpClientUtil = new HttpClientUtils(); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java index 47008488..299afe11 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java @@ -23,7 +23,7 @@ public class Plugins implements PluginListener { //注册监听器 //注册外部系统跳转PAL系统 登陆插件 - list.add(new ProcessPublicEventPluginProfile(TaskListener.class.getName(), "待办推送监听器")); + list.add(new ProcessPublicEventPluginProfile(TaskListener.class.getName(), "待办推送监听器")); list.add(new OauthPluginProfile("oauthLogin", OauthLogin.class.getName(), "OA系统 跳转登陆PAl")); list.add(new OauthPluginProfile("WechatOauthLogin", WechatOauthLogin.class.getName(), "企业微信认证")); list.add(new OauthPluginProfile("processOathLogin", ProcessOathLogin.class.getName(), "流程中心发布")); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/AesUtil.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/AesUtil.java new file mode 100644 index 00000000..4107f933 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/AesUtil.java @@ -0,0 +1,87 @@ +package com.awspaas.user.apps.integration.util; + +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.security.Key; +import java.security.SecureRandom; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +/** + * AES加密解密工具类 + * + * @author M-Y + */ +public class AesUtil { + + public static String DES = "AES"; // optional value AES/DES/DESede + + public static String CIPHER_ALGORITHM = "AES"; // optional value + // AES/DES/DESede + + public Key getKey(String strKey) { + try { + if (strKey == null) { + strKey = ""; + } + KeyGenerator _generator = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(strKey.getBytes()); + _generator.init(128, secureRandom); + return _generator.generateKey(); + } catch (Exception e) { + throw new RuntimeException(" 初始化密钥出现异常 "); + } + } + + public String encrypt(String data, String key) throws Exception { + SecureRandom sr = new SecureRandom(); + Key secureKey = getKey(key); + Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, secureKey, sr); + byte[] bt = cipher.doFinal(data.getBytes()); + String strS = new BASE64Encoder().encode(bt); + return strS; + } + + public String decrypt(String message, String key) { + try { + SecureRandom sr = new SecureRandom(); + Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); + Key secureKey = getKey(key); + cipher.init(Cipher.DECRYPT_MODE, secureKey, sr); + byte[] res = new BASE64Decoder().decodeBuffer(message); + res = cipher.doFinal(res); + return new String(res); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public String DecryptedMsg(String message, String key) throws Exception, Exception { + String Msg1 = encrypt(message, key); + System.out.println("message is :" + Msg1); + String encryptMsg1 = URLEncoder.encode(encrypt(message, key), "UTF-8"); + System.out.println("encrypted message is :" + encryptMsg1); + return encryptMsg1; + + } + + public static void main(String[] args) throws Exception { + String data = "AUDIT##202210181611"; + String key = "auditY809kUih23"; + //String encryptMsg1 = AesUtil.encrypt(data, key); + //System.out.println("加密后:" + encryptMsg1); + /*message = "YPS5F%2F%2BVmdbVj0iuxrSINw%3D%3D"; + System.out.println("解密后:" + AesUtil.decrypt(URLDecoder.decode(message), key));*/ + } + + + + +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/DownloadUtil.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/DownloadUtil.java new file mode 100644 index 00000000..b29b70da --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/DownloadUtil.java @@ -0,0 +1,136 @@ +package com.awspaas.user.apps.integration.util; + +import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager; +import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask; +import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel; +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.server.fs.DCContext; +import com.actionsoft.bpms.server.fs.dc.DCProfileManager; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.bpms.util.UtilFile; +import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.AppAPI; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.integration.event.OutputDCFileProcessor; + +import java.io.File; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class DownloadUtil { + + /** + * 流程手册下载 + * @param _uc + * @param taskId + * @return + */ + public LinkedHashMap outputReportDownload(UserContext _uc, String taskId, String ruuid) { + LinkedHashMap map = new LinkedHashMap<>(); + OutputTaskModel model = new OutputTask().getTaskReportById(taskId); + ResponseObject result = ResponseObject.newOkResponse(); + if (model != null) { + try { + UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId()); + if (file.exists()) { + File[] fileList = file.listFiles(); + if (fileList.length > 0) { + File docFile = null; + for (File file2 : fileList) { + if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) { + docFile = file2; + break; + } + } + if (docFile == null) { + // return ResponseObject.newErrResponse("没有找到文件").toString(); + } + + PALRepositoryModel plmodel = PALRepositoryCache.getCache().get(ruuid); + if(plmodel!=null) { + String sourceAppId = "com.actionsoft.apps.coe.pal.output.pr"; + String methodId = plmodel.getMethodId(); + if(methodId.contains("control")) { + sourceAppId = "com.awspaas.user.apps.coe.pal.output.zd"; + }else if(methodId.contains("data")) { + sourceAppId = "com.awspaas.user.apps.coe.pal.output.bd"; + } + String filename = docFile.getName(); + DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename); + String downUrl= SDK.getConfAPI().getPortalUrl() + "/r/" + sourceDc.getDownloadURL().replace("./", ""); + // result.put("url",downUrl); + map.put(filename,downUrl); + } + + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+ruuid+"'" + + ")"; + List maps = DBSql.getMaps(sql_upfile); + UpfileWeb upfileWeb = new UpfileWeb(_uc); + + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + String downUrl= SDK.getConfAPI().getPortalUrl() + "/r/" + dcContexts.getDownloadURL().replace("./", ""); + map.put(row.getString("FILENAME"),downUrl); + } + + } + }else{ + result = ResponseObject.newErrResponse("没有可预览文件"); + } + } catch (Exception e) { + e.printStackTrace(); + // return ResponseObject.newErrResponse().toString(); + } + } + return map; + } + + + public String getzipURL(String sid,String taskId,String title){ + System.out.println("taskid》》》》》》》》》》"+taskId); + System.out.println("fileName》》》》》》》》》》"+title); + String reportDownloadURL = ""; + UserContext me = UserContext.fromSessionId(sid); + OutputTaskModel model = new OutputTask().getTaskReportById(taskId); + JSONObject result = new JSONObject(); + if (model != null) { + //三员管理,步骤横表下载重新生成手册 + + String taskName = model.getTaskName(); + if ("步骤横表".equals(taskName)){ + // 重新设置生成id,与用户id + String uuid = UUIDGener.getUUID(); + model.setUserId(me.getUID()); + + // 重新生成手册文件 + OutputAPIManager.getInstance().reGennerReport(me,model,uuid); + + // 重新构建手册下载URL + taskId = uuid; + } + + try { + reportDownloadURL = OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), taskId, model.getProfileId(), me, title+model.getTaskName()); + } catch (Exception e) { + + e.printStackTrace(); + } + } + return reportDownloadURL; + } + +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java index b2100f8c..eb12023e 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java @@ -63,6 +63,25 @@ public class HttpClientUtils { } + public String readOa(String url, String taskid) throws IOException { + String result = "true"; + StringBuffer sendSoapString = new StringBuffer(); + String xmlStr = "\n" + + " \n" + + " \n" + + " \n" + + " LCZD\n" + + " "+taskid+"\n" + + " \n" + + " \n" + + ""; + + System.out.println("xmlstr================"+xmlStr); + String postSoap = UtilUrl.doPostSoap(url, xmlStr, ""); + + return postSoap; + } + diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpUtil.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpUtil.java new file mode 100644 index 00000000..9f85964a --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpUtil.java @@ -0,0 +1,64 @@ +package com.awspaas.user.apps.integration.util; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicHeader; +import org.apache.http.protocol.HTTP; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +/** + * http请求⼯具 + * @Author wangcy + */ +public class HttpUtil { + private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class); + /** + * 发送post请求 + * @param json + * @param URL + * @return + */ + public String sendPost(JSONObject json,String URL) { + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost post = new HttpPost(URL); + post.setHeader("Content-Type", "application/json"); + //post.addHeader("Authorization", "Basic YWRtaW46"); + String result; + try { + StringEntity s = new StringEntity(json.toString(), "utf-8"); + s.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, + "application/json")); + post.setEntity(s); +// 发送请求 + HttpResponse httpResponse = client.execute(post); +// 获取响应输⼊流 + InputStream inStream = httpResponse.getEntity().getContent(); + BufferedReader reader = new BufferedReader(new InputStreamReader( + inStream, "utf-8")); + StringBuilder strber = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) + strber.append(line + "\n"); + inStream.close(); + result = strber.toString(); + if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + System.out.println("请求服务器成功,做相应处理"); + } else { + System.out.println("请求服务端失败"); + } + } catch (Exception e) { + logger.error("请求异常:"+e.getMessage()); + throw new RuntimeException(e); + } + return result; + } +} \ No newline at end of file