From 905c99aff0497618b4ef105cfb02cf27386aee15 Mon Sep 17 00:00:00 2001 From: Mr-wang Date: Wed, 23 Aug 2023 11:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=98=AF=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=A1=A5=E5=8F=91=E4=BA=BA=E5=91=98,=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8E=E5=AF=B9=E6=9C=AA=E8=A1=A5=E5=8F=91?= =?UTF-8?q?=E7=9A=84=E4=BA=BA=E5=91=98=E8=BF=9B=E8=A1=8C=E8=A1=A5=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/coe/pal/datamigration/CopyJob.java | 145 +++--------------- 1 file changed, 22 insertions(+), 123 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/CopyJob.java b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/CopyJob.java index e64a20b8..52fc1c42 100644 --- a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/CopyJob.java +++ b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/CopyJob.java @@ -124,28 +124,29 @@ public class CopyJob implements IJob { ArrayList list = new ArrayList<>(); - /* for (String user_id:sendList){ + for (String user_id:sendList){ - BO bo_eu_require_data = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID = ", cc).addQuery("USER_ID=",user_id).detail(); + BO bo_eu_require_data = SDK.getBOAPI().query("BO_EU_REQUIRE_DATA", true).addQuery("PROCESS_ID = ", cc).addQuery("USER_ID=",user_id).detail(); if (bo_eu_require_data!=null){ }else { - BO bo_eu_Read = SDK.getBOAPI().query("BO_ACT_ALREADY_DATAID", true).addQuery("PROCESSID = ", cc).addQuery("USER_ID=",user_id).detail(); + /* BO bo_eu_Read = SDK.getBOAPI().query("BO_ACT_ALREADY_DATAID", true).addQuery("PROCESSID = ", cc).addQuery("USER_ID=",user_id).detail(); if (bo_eu_Read!=null){ }else { list.add(user_id); - } + }*/ + list.add(user_id); } - }*/ + } // list.add("10036614"); // list.add("10056870"); - - new_uid = new_uid.join(",", sendList); + new_uid = new_uid.join(",",list); long startTimes = System.currentTimeMillis(); String[] users = new_uid.split(","); System.out.println("new_uid>>>>>>>>>>>>>>"+users.length); + System.out.println("new_uids>>>>>>>>>>>>>>"+users); int length = 100; int ys = users.length%length; /** @@ -218,15 +219,15 @@ public class CopyJob implements IJob { CountDownLatch countDownLatch = new CountDownLatch(list.size()); ExecutorService service = Executors.newFixedThreadPool(5); int m = 0; - for (String[] resrt:list - ) { + for (int i=0;i>>>>>>"+Arrays.asList(resrt).size()); + System.out.println("最后一个数组是什么>>>>>>>"+Arrays.asList(list.get(finalI)).size()); String userIds = ""; - userIds = StringUtils.join(resrt, ","); + userIds = StringUtils.join(list.get(finalI), ","); System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds); /*try { SendOARead(jsonObject, processInstance, userIds,"批量推送"); @@ -239,9 +240,9 @@ public class CopyJob implements IJob { } catch (DocumentException e) { e.printStackTrace(); } - + //InsertBO(jsonObject, processInstance, userIds,"批量推送"); + countDownLatch.countDown(); } - }); m++; } @@ -311,6 +312,14 @@ public class CopyJob implements IJob { } + public void InsertBO(JSONObject jsonObject, ProcessInstance processInstance, String userIds,String type){ + BO bo = new BO(); + bo.set("PROCESSID",processInstance.getId()); + bo.set("USERIDS",userIds); + SDK.getBOAPI().create("BO_EU_JSIS_DATA",bo,processInstance.getId(),processInstance.getCreateUser()); + } + + public void secondSendOARead(JSONObject jsonObject, ProcessInstance processInstance, List idList,String type) throws DocumentException { @@ -409,117 +418,7 @@ public class CopyJob implements IJob { } - /** - * 发送OA待阅数据 - * - * @param jsonObject - * @param processInstance - * @throws DocumentException - */ - /* public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds, String type) - throws DocumentException { - String processInstId = processInstance.getId(); - // System.err.println(processInstance.getTitle() + "开始发送:" + userId); - - - if ("".equals(userIds) || UtilString.isEmpty(userIds)) { - return; - } - - jsonObject.put("userList", userIds); - String xmlStr = "\n" - + " " + " " + " " + " " - + "" + " " + " " - + " " + ""; - // System.out.println("xmlStr>>>>>>>>" + xmlStr); - String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl"); - try { - 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"); - String resultString = result.getData().toString(); - JSONObject jsonObject1 = JSON.parseObject(resultString); - String datas = jsonObject1.getString("data"); - 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()+"人"); - - - int sucount = 1; - 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()); - - - *//*BO oa_real_time = SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=", processInstance.getId()).detail(); - if (oa_real_time != null) { - int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + sucount + "'WHERE PROCESSID ='" + processInstId + "'"); - } 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); - - SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser()); - } - sucount++;*//* - - } - if ("单个账号推送".equals(type)) { - DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '" + processInstId + "' AND NAME = '" + userIds + "'"); - } - } else { - System.out.println(processInstance.getTitle() + "待阅推送失败:" + userIds); - try { - 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()); - } catch (Exception e) { - // TODO: handle exception - } - } - - } catch (Exception e) { - System.out.println(processInstance.getTitle() + "待阅推送失败:" + userIds); - 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()); - } - - } -*/