diff --git a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar index 30dbf174..efffeb3c 100644 Binary files a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar and b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar differ diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java index 0fd2e4f6..3b7f142d 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java @@ -170,7 +170,7 @@ public class ProcesNumberUtil { // 查询出主表数据 BO mainData = SDK.getBOAPI().getByProcess("BO_ACT_COE_PUBLISH", bindId); // 根据主表数据查询出权限的编码 - String qxSql = "select * from BO_ACT_AUTH_INFO where ORGNAME='%s' and LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and LEVEL_4_PROCESS_NAME='%s' " + String qxSql = "select * from BO_ACT_AUTH_INFO where ORGNAME='%s' and LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and LEVEL_4_PROCESS_NAME='%s' " + " and ADAPT_REGION_NAME = '%s' and APPLICABLE_PRODUCT='%s'"; RowMap authData = DBSql.getMap(String.format(qxSql, mainData.getString("ADAPT_NAME_THE_COMPANY"), mainData.getString("LEVEL_1_PROCESS_NAME"), mainData.getString("LEVEL_2_PROCESS_NAME"), @@ -264,7 +264,7 @@ public class ProcesNumberUtil { String levelOne = authData.getString("LEVEL_1_PROCESS_ID"); String levelTwo = authData.getString("LEVEL_2_PROCESS_ID"); String levelThree = authData.getString("LEVEL_3_PROCESS_ID"); - String levelFour=authData.getString("LEVEL_4_PROCESS_ID"); + String levelFour = authData.getString("LEVEL_4_PROCESS_ID"); String regionCode = authData.getString("ADAPT_REGION_CODE"); String productCode = authData.getString("APPLICABLE_PRODUCT_CODE"); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index d08610d9..2d92f0f0 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -4366,7 +4366,7 @@ public class ProcessPublishWeb extends ActionWeb { String methodId = paljb.getString("methodId"); PALRepositoryModel model = PALRepositoryCache.getCache().get(id); - //ID获取L1 L2 L3的值 + //ID获取L1 L2 L3 L4 的值 List resulttmp = DBSql.getMaps(String.format("select PROPERTYID,PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PROPERTYID in ('Process_Architecture_L1','Process_Architecture_L2','Process_Architecture_L3','Process_Architecture_L4') AND PLID='%s'", id)); for (RowMap tmp : resulttmp) { String key = tmp.getString("PROPERTYID"); @@ -4409,11 +4409,11 @@ public class ProcessPublishWeb extends ActionWeb { * @param product * @return */ - public String getApproveInfos(UserContext me, String level1, String level2, String level3, String level4, String company, String region, String product, String bindid) { + public String getApproveInfos(UserContext me, String level1, String level2, String level3,String level4, String company, String region, String product, String bindid) { //l1 l2 l3 l4 保存到表里 - DBSql.update(String.format("update BO_ACT_COE_PUBLISH set LEVEL_1_PROCESS_NAME='%s',LEVEL_2_PROCESS_NAME='%s',LEVEL_3_PROCESS_NAME='%s',LEVEL_4_PROCESS_NAME='%s' where BINDID='%s'", level1, level2, level3, level4, bindid)); - String sql = "select AUDITOR1,AUDITOR_NO_1,L1_SP,AUDITOR2,AUDITOR_NO_2,L2_SP,AUDITOR3,AUDITOR_NO_3,L3_SP,AUDITOR4,AUDITOR_NO_4,L4_SP from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and LEVEL_4_PROCESS_NAME='%s' and ORGNAME='%s' and ADAPT_REGION_NAME='%s' and APPLICABLE_PRODUCT='%s'"; - RowMap result = DBSql.getMap(String.format(sql, level1, level2, level3, level4, company, region, product)); + DBSql.update(String.format("update BO_ACT_COE_PUBLISH set LEVEL_1_PROCESS_NAME='%s',LEVEL_2_PROCESS_NAME='%s',LEVEL_3_PROCESS_NAME='%s',LEVEL_4_PROCESS_NAME='%s' where BINDID='%s'", level1, level2, level3, bindid)); + String sql = "select AUDITOR1,AUDITOR_NO_1,L1_SP,AUDITOR2,AUDITOR_NO_2,L2_SP,AUDITOR3,AUDITOR_NO_3,L3_SP from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and LEVEL_4_PROCESS_NAME='%s' and ORGNAME='%s' and ADAPT_REGION_NAME='%s' and APPLICABLE_PRODUCT='%s'"; + RowMap result = DBSql.getMap(String.format(sql, level1, level2, level3, level4,company, region, product)); ResponseObject ro = ResponseObject.newOkResponse(); ro.put("data", result == null ? "" : result); return ro.toString(); @@ -4651,7 +4651,7 @@ public class ProcessPublishWeb extends ActionWeb { } } - } else { + } else if(type.equals("2")) { //发布变更文件 List publishCBO = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").bindId(processInstId).list(); @@ -4688,6 +4688,42 @@ public class ProcessPublishWeb extends ActionWeb { } } + }else if(type.equals("3")) { + //发布变更文件 + List publishSBO = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").bindId(processInstId).list(); + + if (publishSBO.size() > 0) { + + for (BO onePublishS : publishSBO) { + + /* if(onePublishC.getString("TASKID")=="submit_create"){ + return ResponseObject.newWarnResponse("请先创建手册!!").toString(); + }*/ + + String plId = onePublishS.getString("STOPFILEID"); + int count = 0; + // 重新生成手册 + PALRepositoryModel model = PALRepositoryCache.getCache().get(plId); + String wsIdro = queryMaPublishGetWsId(); + JSONObject wsIdJson = JSONObject.parseObject(wsIdro); + String taskId = createOutputReport(model, wsIdJson.getJSONObject("data").get("wsId").toString(), "admin", "", plId); + // 刷新预览加载的表 + String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'"; + DBSql.update(sqlr); + String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_S WHERE STOPFILEID = '" + plId + "'"; + + if (UtilString.isNotEmpty(DBSql.getString(sql2))) { + count = DBSql.update( + "UPDATE BO_ACT_COE_PUBLISH_S SET TASKID='" + taskId + "'WHERE STOPFILEID ='" + plId + "'"); + } + if (count != 0) { + DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='" + + plId + "'"); + } + + + } + } } } catch (AWSDataAccessException e) { ro.put("result","创建手册失败!!!"); @@ -4711,7 +4747,7 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); try { - //ID获取L1 L2 L3的值 + //ID获取L1 L2 L3 L4 的值 List resulttmp = DBSql.getMaps(String.format("select PROPERTYID,PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PROPERTYID in ('Process_Architecture_L1','Process_Architecture_L2','Process_Architecture_L3','Process_Architecture_L4') AND PLID='%s'", uuid)); for (RowMap tmp : resulttmp) { String key = tmp.getString("PROPERTYID"); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java index 3adcf5cc..2e194d2c 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java @@ -131,18 +131,14 @@ public class SubFormAfterSave extends ExecuteListener { //保存文件类型到主表 saveFileType(processInstId); - - System.out.println("L1========="+formData.getString("LEVEL_1_PROCESS_NAME")); - System.out.println("L1========="+formData.getString("LEVEL_2_PROCESS_NAME")); - System.out.println("L1========="+formData.getString("LEVEL_3_PROCESS_NAME")); System.out.println(formData.getString("ADAPT_NAME_THE_COMPANY")); System.out.println(formData.getString("ADAPT_REGION_NAME")); System.out.println(formData.getString("APPLICABLE_PRODUCT")); /* - 根据L1、L2、L3查询权限矩阵所属分部数据 + 根据L1、L2、L3、L4查询权限矩阵所属分部数据 */ - String sql = "SELECT SSFB FROM BO_ACT_AUTH_INFO WHERE LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? AND ORGNAME=? AND ADAPT_REGION_NAME=? AND APPLICABLE_PRODUCT=?"; + String sql = "SELECT SSFB FROM BO_ACT_AUTH_INFO WHERE LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? AND ORGNAME=? AND ADAPT_REGION_NAME=? AND APPLICABLE_PRODUCT=?"; String ssfb = DBSql.getString(sql, new Object[] { formData.getString("LEVEL_1_PROCESS_NAME"),formData.getString("LEVEL_2_PROCESS_NAME"),formData.getString("LEVEL_3_PROCESS_NAME"),formData.getString("LEVEL_4_PROCESS_NAME"),formData.getString("ADAPT_NAME_THE_COMPANY"),formData.getString("ADAPT_REGION_NAME"),formData.getString("APPLICABLE_PRODUCT") }); if(StringUtils.isNotEmpty(ssfb)){ diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java index 0bea16d7..0d8aea82 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java @@ -827,7 +827,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList } } catch (Exception e) { - System.out.println(processInstance.getTitle() + "待阅推送失败:" + userIds); + System.out.println(processInstance.getTitle() + "待阅推送失败:" + userIds); BO bo = new BO(); bo.set("TITLE", processInstance.getTitle()); bo.set("NAME", userIds); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java index 2519058b..0bcceb02 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java @@ -15,6 +15,7 @@ import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import com.actionsoft.exception.AWSDataAccessException; import org.apache.commons.lang.StringUtils; import org.dom4j.Document; import org.dom4j.DocumentException; @@ -66,7 +67,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute private String isSendOA = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendOA"); private String isSendKMS = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendKMS"); - private int sucount=1; + + private int sendTotal; @Override public String getDescription() { @@ -99,6 +101,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute @Override public void run() { try { + System.out.println("进入方法==============="); ProcessData(ext); } catch (Exception e) { // TODO Auto-generated catch block @@ -165,8 +168,12 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute jsonObject.put("title", " " + "" + boActCoePublish.getString("PROCESS_TITLE") + ""); jsonObject.put("dept", SDK.getORGAPI() .getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo());// SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + System.out.println("processExecutionContext.getTaskInstance().getTarget()).getNo()==========="+SDK.getORGAPI() + .getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo()); String target = processExecutionContext.getTaskInstance().getTarget(); + System.out.println("target============"+target); target = processExecutionContext.getTaskInstance().getTarget(); + jsonObject.put("user", target); // jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser() jsonObject.put("date", sdf.format(endTime)); @@ -370,14 +377,13 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute } else { // 发送组织岗位职级 sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject); - } long countTime = System.currentTimeMillis(); System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>" + (countTime - startTime) + "毫秒"); - + sendTotal=sendList.size(); /* * for (String user : sendList) { try { SendOARead(jsonObject, instanceById, * user, "批量推送"); } catch (Exception e) { // TODO: handle exception } } @@ -387,32 +393,24 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute int toIndex = 300; int listSize = sendList.size(); boolean shutdown = false; + for (int i = 0; i < sendList.size(); i += 300) { + long startTime1 = System.currentTimeMillis(); if (i + 300 > listSize) { toIndex = listSize - i; } List idList = sendList.subList(i, i + toIndex); try { - BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail(); - if(executiveTaskBO!=null){ - String userIds = StringUtils.join(idList, ","); - String[] userIdsArray=userIds.split(","); - for(String oneuserId:userIdsArray){ - BO bo = new BO(); - bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle()); - bo.set("NAME", oneuserId); - bo.set("TYPE", "批量推送"); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId()); - bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); - } - return; - } SendOARead(jsonObject, instanceById, idList, "批量推送"); } catch (Exception e) { + + System.out.println("OA待阅推送exception======"+e); // TODO: handle exception } + long endTimes1 = System.currentTimeMillis(); + + System.err.println(instanceById.getTitle() + "单次300条推送单条====>" + "用时:" + + (endTimes1 - startTime1) / 1000 + "秒"); /* * ExecutorService cachedThreadPool = Executors.newFixedThreadPool(3); // 开启一个线程 @@ -434,14 +432,13 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute } // 二次推送 - List List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '" + instanceById.getId() + "' AND RESULT = '待处理'"); if (List.size() != 0) { System.err.println(instanceById.getTitle() + "批量推送失败后执行二次推送=======>" + List.size()); - BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail(); + /*BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail(); if(executiveTaskBO!=null){ for (RowMap rowMap : List) { BO bo = new BO(); @@ -454,19 +451,19 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); } return; - } + }*/ for (RowMap rowMap : List) { try { - - ArrayList userList3 = new ArrayList(); - userList3.add(rowMap.getString("NAME")); - System.err.println(instanceById.getTitle() + "二次推送账号=======>" + userList3); - SendOARead(jsonObject, instanceById, userList3, "单个账号推送"); + ArrayList secondUserList = new ArrayList(); + secondUserList.add(rowMap.getString("NAME")); + System.err.println(instanceById.getTitle() + "二次推送账号=======>" + secondUserList); + secondSendOARead(jsonObject, instanceById, secondUserList, "单个账号推送"); } catch (Exception e) { // TODO: handle exception } } + } long endTimes = System.currentTimeMillis(); @@ -477,10 +474,17 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute + //发送消息通知 List readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processExecutionContext.getProcessInstance().getId()).list(); if(readCountBO.size()>0){ SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processExecutionContext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!"); } + + //更新任务状态 + int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID ='" + processExecutionContext.getProcessInstance().getId() + "'"); + + + } } @@ -830,8 +834,25 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, List idList,String type) throws DocumentException { + /*BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processInstance.getId()).addQuery("TASKSTATUS=",2).detail(); + if(executiveTaskBO!=null){ + String userIds = StringUtils.join(idList, ","); + String[] userIdsArray=userIds.split(","); + for(String oneuserId:userIdsArray){ + BO bo = new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", oneuserId); + bo.set("TYPE", "批量推送"); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstance.getId()); + bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); + SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + } + return; + }*/ + + System.out.println("idList========="+idList.toString()); String processInstId = processInstance.getId(); - System.out.println("流程实例id==============="+processInstId); // System.err.println(processInstance.getTitle() + "开始发送:" + userId); /* @@ -840,6 +861,163 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute if (idList.size() == 0) { return; } + + String userIds = StringUtils.join(idList, ","); + jsonObject.put("userList", userIds); + String xmlStr = "\n" + + " " + " " + " " + " " + + "" + " " + " " + + " " + ""; + // System.out.println("xmlStr>>>>>>>>" + xmlStr); + String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl"); + String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, ""); + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + Element result = rootElement.element("Body").element("serviceResponse").element("out"); + String resultString = result.getData().toString(); + JSONObject jsonObject1 = JSON.parseObject(resultString); + System.out.println("jsonObject1==============="+jsonObject1); + String datas = jsonObject1.getString("data"); + System.out.println("data================="+datas); + String status = jsonObject1.getString("status"); + System.out.println("推送》》》》》》》》》》》" + status); + + + if ("true".equals(status)) { + JSONArray resultArray = JSONObject.parseArray(datas); + System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人"); + //批量入库操作 + //加入时间戳 + if(resultArray.size()>0){ + List recordLists = new ArrayList(); + long startTime2 = System.currentTimeMillis(); + for (int j = 0; j < resultArray.size(); j++) { + + JSONObject jsonObject2 = resultArray.getJSONObject(j); + String user = jsonObject2.get("user").toString(); + String dataid = jsonObject2.get("dataid").toString(); + BO bo = new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("PROCESSID", processInstance.getId()); + bo.set("USER_ID", user); + bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId()); + bo.set("DATAID", dataid); + bo.set("RESULT", status); + bo.set("SENDTYPE", "1"); + bo.set("READSTATE", "未读"); + bo.set("TYPE", type); + recordLists.add(bo); + + BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail(); + + String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; + List mapsy = DBSql.getMaps(sqly); + + if(oa_real_time!=null){ + int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + mapsy.size() + "'WHERE PROCESSID ='" + processInstance.getId() + "'"); + }else{ + //插入实时更新人数表 + BO realTimeBO=new BO(); + realTimeBO.set("USREID", user); + realTimeBO.set("DEPID", SDK.getORGAPI().getUser(user).getDepartmentId()); + realTimeBO.set("BUNAME",SDK.getORGAPI().getUser(user).getExt4()); + realTimeBO.set("TITLE", processInstance.getTitle()); + realTimeBO.set("PROCESSID", processInstance.getId()); + realTimeBO.set("SENDNUMSJ", 1); + realTimeBO.set("SENDNUM",sendTotal); + SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser()); + } + + } + SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, processInstance.getId(), processInstance.getCreateUser()); + + long endTime2 = System.currentTimeMillis(); + System.err.println(processInstance.getTitle() + "批量插入OA待阅数据====>" + "用时:" + + (endTime2 - startTime2) / 1000 + "秒"); + } + + if("单个账号推送".equals(type)) { + DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '"+processInstId+"' AND NAME = '"+userIds+"'"); + } + } else { + BO bo = null; + List recordFailLists = new ArrayList(); + for (String userId : idList) { + System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId); + try { + bo= new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", userId); + bo.set("TYPE", type); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstId); + bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId()); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + recordFailLists.add(bo); + } catch (Exception e) { + bo= new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", userIds); + bo.set("TYPE", type); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstId); + bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId()); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + recordFailLists.add(bo); + } + } + System.out.println("recordFailLists========="+recordFailLists.size()); + SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processInstance.getId(), processInstance.getCreateUser()); + + + + + + } + + } + + + + /** + * 发送OA待阅数据 + * + * @param jsonObject + * @param processInstance + * @param results + * @throws DocumentException + */ + public void secondSendOARead(JSONObject jsonObject, ProcessInstance processInstance, List idList,String type) + throws DocumentException { + + /*BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processInstance.getId()).addQuery("TASKSTATUS=",2).detail(); + if(executiveTaskBO!=null){ + String userIds = StringUtils.join(idList, ","); + String[] userIdsArray=userIds.split(","); + for(String oneuserId:userIdsArray){ + BO bo = new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", oneuserId); + bo.set("TYPE", "批量推送"); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstance.getId()); + bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); + SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + } + return; + }*/ + + System.out.println("idList========="+idList.toString()); + String processInstId = processInstance.getId(); + // System.err.println(processInstance.getTitle() + "开始发送:" + userId); + + /* + * if ("".equals(userId) || UtilString.isEmpty(userId)) { return; } + */ + if (idList.size() == 0) { + return; + } + String userIds = StringUtils.join(idList, ","); jsonObject.put("userList", userIds); String xmlStr = "\n" @@ -851,90 +1029,77 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, ""); Document document = DocumentHelper.parseText(postSoap); Element rootElement = document.getRootElement(); - System.out.println("rootElement>>>>>>" + rootElement); Element result = rootElement.element("Body").element("serviceResponse").element("out"); - System.out.printf("result============"+result); String resultString = result.getData().toString(); JSONObject jsonObject1 = JSON.parseObject(resultString); System.out.println("jsonObject1==============="+jsonObject1); String datas = jsonObject1.getString("data"); System.out.println("data================="+datas); String status = jsonObject1.getString("status"); - System.out.println("推送》》》》》》》》》》》" + status); + System.out.println("推送》》》》》》》》》》》" + status); if ("true".equals(status)) { JSONArray resultArray = JSONObject.parseArray(datas); - //System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人"); - for (int j = 0; j < resultArray.size(); j++) { - JSONObject jsonObject2 = resultArray.getJSONObject(j); - String user = jsonObject2.get("user").toString(); - String dataid = jsonObject2.get("dataid").toString(); - BO bo = new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("PROCESSID", processInstance.getId()); - bo.set("USER_ID", user); - bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId()); - bo.set("DATAID", dataid); - bo.set("RESULT", status); - bo.set("SENDTYPE", "1"); - bo.set("READSTATE", "未读"); - bo.set("TYPE", type); - SDK.getBOAPI().create("BO_ACT_DATAID", bo, processInstance.getId(), processInstance.getCreateUser()); + System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人"); + //批量入库操作 + //加入时间戳 + if(resultArray.size()>0){ + List recordLists = new ArrayList(); + long startTime2 = System.currentTimeMillis(); + for (int j = 0; j < resultArray.size(); j++) { + JSONObject jsonObject2 = resultArray.getJSONObject(j); + String user = jsonObject2.get("user").toString(); + String dataid = jsonObject2.get("dataid").toString(); + BO bo = new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("PROCESSID", processInstance.getId()); + bo.set("USER_ID", user); + bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId()); + bo.set("DATAID", dataid); + bo.set("RESULT", status); + bo.set("SENDTYPE", "1"); + bo.set("READSTATE", "未读"); + bo.set("TYPE", type); + recordLists.add(bo); + BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail(); - BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail(); - System.out.println("oa_real_time=========="+oa_real_time); - System.out.println("sucount============="+sucount); - if(oa_real_time!=null){ - int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + sucount + "'WHERE PROCESSID ='" + processInstance.getId() + "'"); - }else{ - //插入实时更新人数表 - BO realTimeBO=new BO(); - realTimeBO.set("USREID", user); - realTimeBO.set("DEPID", SDK.getORGAPI().getUser(user).getDepartmentId()); - realTimeBO.set("BUNAME",SDK.getORGAPI().getUser(user).getExt4()); - realTimeBO.set("TITLE", processInstance.getTitle()); - realTimeBO.set("PROCESSID", processInstance.getId()); - realTimeBO.set("SENDNUMSJ", 1); + String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; + List mapsy = DBSql.getMaps(sqly); + + if(oa_real_time!=null){ + int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + mapsy.size() + "'WHERE PROCESSID ='" + processInstance.getId() + "'"); + }else{ + //插入实时更新人数表 + BO realTimeBO=new BO(); + realTimeBO.set("USREID", user); + realTimeBO.set("DEPID", SDK.getORGAPI().getUser(user).getDepartmentId()); + realTimeBO.set("BUNAME",SDK.getORGAPI().getUser(user).getExt4()); + realTimeBO.set("TITLE", processInstance.getTitle()); + realTimeBO.set("PROCESSID", processInstance.getId()); + realTimeBO.set("SENDNUMSJ", 1); + realTimeBO.set("SENDNUM",sendTotal); + SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser()); + } - SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser()); } - sucount++; + SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, processInstance.getId(), processInstance.getCreateUser()); + long endTime2 = System.currentTimeMillis(); + System.err.println(processInstance.getTitle() + "批量插入OA待阅数据====>" + "用时:" + + (endTime2 - startTime2) / 1000 + "秒"); } + if("单个账号推送".equals(type)) { DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '"+processInstId+"' AND NAME = '"+userIds+"'"); } - } else { - for (String userId : idList) { - System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId); - try { - BO bo = new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", userId); - bo.set("TYPE", type); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstId); - bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - } catch (Exception e) { - BO bo = new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", userIds); - bo.set("TYPE", type); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstId); - bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - } - } - - } + } + /** * 发送EHSQ数据 * @@ -1298,7 +1463,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute bo_Read_log.set("SENDNUM", arr.size()); String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; List mapsy = DBSql.getMaps(sqly); - bo_Read_log.set("SENDNUMSJ", mapsy.size()); + String alsqly = "SELECT ID FROM BO_ACT_ALREADY_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; + List almapsy = DBSql.getMaps(sqly); + bo_Read_log.set("SENDNUMSJ", mapsy.size()+almapsy.size()); BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId) .addQuery("OPTIONTYPE IS NOT NULL", null).detail(); String send_scop = bo_act_coe_publishs.getString("SEND_SCOP"); diff --git a/com.actionsoft.apps.coe.pal.publisher/template/form/发布流程-批量流程制度发布申请.htm b/com.actionsoft.apps.coe.pal.publisher/template/form/发布流程-批量流程制度发布申请.htm index aff455f3..b9c28ad0 100644 --- a/com.actionsoft.apps.coe.pal.publisher/template/form/发布流程-批量流程制度发布申请.htm +++ b/com.actionsoft.apps.coe.pal.publisher/template/form/发布流程-批量流程制度发布申请.htm @@ -2,6 +2,8 @@ + + @@ -2142,6 +2144,12 @@ var 下一页 = "下一页"; var 上一页 = "上一页"; var 显示0到1条共2条 = "显示 {0} 到 {1} 条,共 {2} 条"; // ]]> + diff --git a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js index ff3e5416..bac385a8 100644 --- a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js +++ b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js @@ -332,6 +332,11 @@ function initHtml() { stopHtml += ''; // stopHtml += ''; stopHtml += ''; + stopHtml += ''; + stopHtml += ''; + + + } //stopHtml += ''; // stopHtml += ''; @@ -971,11 +976,13 @@ function addProcess(type) { }, 200); } } - if (type == 'stop' ) { + if (type == 'stop') { + debugger; if (treeCheckedStopArr.length == 0) { $.simpleAlert('停用流程不能为空'); return; } else { + disabledButton(); setTimeout(function() { // 获取说明内容 @@ -1202,6 +1209,7 @@ function openQueryDataDialog(type) { $('#publisher_dialog_name').val(names); closeDialog();// 关闭窗口 } else {// stop + debugger; getStopBatchResult(type); // 数据写入主dialog var names = ''; @@ -1531,7 +1539,7 @@ function getStopBatchResult(type) { var L1old = ui("LEVEL_1_PROCESS_NAME"); var L2old = ui("LEVEL_2_PROCESS_NAME"); var L3old = ui("LEVEL_3_PROCESS_NAME"); - var L4old = ui("LEVEL_3_PROCESS_NAME"); + var L4old = ui("LEVEL_4_PROCESS_NAME"); if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old) || (L4old != '' && L4 != L4old)){ $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); $.simpleAlert("只能选择同一级别下的流程,请重新选择");