Просмотр исходного кода

博洋新增自动通过oa审批节点

wzy 1 месяц назад
Родитель
Сommit
14e7f5baf0
1 измененных файлов с 51 добавлено и 5 удалено
  1. 51 5
      mjava-boyang/src/main/java/com/malk/boyang/service/impl/BoyangServiceImpl.java

+ 51 - 5
mjava-boyang/src/main/java/com/malk/boyang/service/impl/BoyangServiceImpl.java

@@ -325,19 +325,42 @@ public class BoyangServiceImpl implements BoyangService {
 
 
                 String signedFileName = fileName.substring(0, suffixIndex) + "(已签署)" + fileName.substring(suffixIndex);
                 String signedFileName = fileName.substring(0, suffixIndex) + "(已签署)" + fileName.substring(suffixIndex);
 
 
-                //todo 1、评论签署后附件下载链接
+                //todo 方案1、评论签署后附件下载链接
 //                    comment(processInstanceId,userId,"接口测试 "+ "已签署,签署文件下载地址:" + signDownloadOuterUrl,null);
 //                    comment(processInstanceId,userId,"接口测试 "+ "已签署,签署文件下载地址:" + signDownloadOuterUrl,null);
 
 
 
 
 
 
-                //todo 2、评论签署后附件
-                //todo 签署后文件下载到本地
+                //方案2、评论签署后附件
+                //签署后文件下载到本地
                 downloadFile(signDownloadOuterUrl,downloadPath + signedFileName);
                 downloadFile(signDownloadOuterUrl,downloadPath + signedFileName);
-                //todo 签署后文件上传到钉盘
+                //签署后文件上传到钉盘
                 Map dentry = uploadDdFile(spaceId, parentDentryUuid, downloadPath + signedFileName, operatorUnionId);
                 Map dentry = uploadDdFile(spaceId, parentDentryUuid, downloadPath + signedFileName, operatorUnionId);
-                //todo 审批单添加评论
+                //审批单添加评论
                 comment(processInstanceId,originatorUserId,fileName + "已签署",Arrays.asList(dentry));
                 comment(processInstanceId,originatorUserId,fileName + "已签署",Arrays.asList(dentry));
             }
             }
+
+            //自动通过节点
+            List<Map> tasks = UtilMap.getList(result, "tasks");
+            for (Map task : tasks) {
+                String activityId = UtilMap.getString(task, "activityId");
+                //e签宝签署节点id:f0e3_8ef9
+                if ("f0e3_8ef9".equals(activityId)){
+                    long taskId = UtilMap.getLong(task, "taskId");
+                    String userId = UtilMap.getString(task, "userId");
+
+                    Map body = new HashMap();
+                    body.put("processInstanceId",processInstanceId);
+                    body.put("remark","签署完成自动通过");
+                    body.put("result","agree");
+                    body.put("actionerUserId",userId);
+                    body.put("taskId",taskId);
+
+                    UtilHttp.doPost("https://api.dingtalk.com/v1.0/workflow/processInstances/execute", ddClient.initTokenHeader(), null, body);
+
+                    return;
+                }
+            }
+
         } catch (Exception e) {
         } catch (Exception e) {
             throw new RuntimeException(e);
             throw new RuntimeException(e);
         }
         }
@@ -390,6 +413,29 @@ public class BoyangServiceImpl implements BoyangService {
 
 
             //审批单添加评论
             //审批单添加评论
             comment(processInstanceId,originatorUserId,"签署地址:" + signUrlShort,null);
             comment(processInstanceId,originatorUserId,"签署地址:" + signUrlShort,null);
+
+            //自动通过节点
+            List<Map> tasks = UtilMap.getList(result, "tasks");
+            for (Map task : tasks) {
+                String activityId = UtilMap.getString(task, "activityId");
+                //e签宝设置签署区节点id:802c_7eaf
+                if ("802c_7eaf".equals(activityId)){
+                    long taskId = UtilMap.getLong(task, "taskId");
+                    String userId = UtilMap.getString(task, "userId");
+
+                    Map body = new HashMap();
+                    body.put("processInstanceId",processInstanceId);
+                    body.put("remark","签署区设置完成自动通过");
+                    body.put("result","agree");
+                    body.put("actionerUserId",userId);
+                    body.put("taskId",taskId);
+
+                    UtilHttp.doPost("https://api.dingtalk.com/v1.0/workflow/processInstances/execute", ddClient.initTokenHeader(), null, body);
+
+                    return;
+                }
+            }
+
         } catch (Exception e) {
         } catch (Exception e) {
             throw new RuntimeException(e);
             throw new RuntimeException(e);
         }
         }