Browse Source

新增单据时回传flowid

wzy 9 months ago
parent
commit
6db8feeb79

+ 11 - 5
mjava-shantai/src/main/java/com/malk/shantai/service/impl/StDingProcServiceImpl.java

@@ -222,11 +222,14 @@ public class StDingProcServiceImpl extends ServiceImpl<ShantaiMapper, Shantai> i
         body.put("form",form);
 
         Map document = JSONObject.parseObject(UtilHttp.doPost(stEkbConfig.getPreUrl() + ("/api/openapi/v2.2/flow/data"), null, param, body));
+        Map flow = (Map) document.get("flow");
+        String flowId = flow.get("id").toString();
 
         Shantai shantai = new Shantai();
         shantai.setProcInstId(procInstId);
         shantai.setState("3");
         shantai.setUserId(userId);
+        shantai.setFlowId(flowId);
         shantaiMapper.insert(shantai);
 
         log.info("新增单据成功:{}",document);
@@ -254,16 +257,18 @@ public class StDingProcServiceImpl extends ServiceImpl<ShantaiMapper, Shantai> i
         if (Objects.isNull(userId)){
             userId = map.get("userId").toString();
         }
+        //上传钉盘目前设置为管理员
+        String unionId = operatorUnionId;
 
-        DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", userId), DDR_New.class);
+        /*DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", userId), DDR_New.class);
         Map result = (Map) ddrNew.getResult();
-        String unionId = "4SLghmRuGL3Gii2DHXENHlwiEiE";
+
         if (Objects.nonNull(result)){
-//            unionId = result.get("unionid").toString();
+            unionId = result.get("unionid").toString();
         }else {
             unionId = operatorUnionId;//曹艳杰
             userId = operatorUserId;//曹艳杰
-        }
+        }*/
 
         //获取附件上传到钉盘
         List<String> paths = (List<String>) map.get("paths");
@@ -277,13 +282,14 @@ public class StDingProcServiceImpl extends ServiceImpl<ShantaiMapper, Shantai> i
                     dentries.add(dentry);
                 }catch (IOException e){
                     e.printStackTrace();
+                    log.info("上传文件至钉盘失败:{}",e.getMessage());
+                    return McR.errorUnknown("上传文件至钉盘失败");
                 }
             }
         }
 
         String state = map.get("state").toString();
 
-
         if (Objects.nonNull(shantai) && shantai.getState().equals("2") && dentries.isEmpty()){
             log.info("该单据Id:{}本次无水单上传,不进行同步",flowId);
             return McR.success();

+ 1 - 1
mjava-shantai/src/test/java/com/malk/shantai/DdTest.java

@@ -40,7 +40,7 @@ public class DdTest {
 //        stDingProcService.fkdSync("_ynuK9h3RYW4oE06B-D44A06971715048029");
 //        stDingProcService.fkdSync("lReoTnLiRbSreZKodGsyRg06971715650847");
 //        stDingProcService.fkdSync("o2zdfQO-TP6ipxqzZh9cjA06971715405894");
-        stDingProcService.fkdSync("y5D3GSA0S923ppCDNDDS-w06971719558034");
+        stDingProcService.fkdSync("bThPL5IUTVyievfVv53Rmw06971725441883");
 
 
     }