Przeglądaj źródła

定时任务增加参数设置

wy 2 lat temu
rodzic
commit
3bb039db44

+ 15 - 13
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/sysdata/services/impl/CronNotifyServiceImpl.java

@@ -63,13 +63,13 @@ public class CronNotifyServiceImpl implements CronNotifyService {
                     if(task.get(i)!=null && !task.get(i).isEmpty()  ) {
                         int index = i;
                         APIResult<Void> result = iBpmInstProvider.startAndName(
-                                this.getParameters(task.get(index),
-                                        map.get("fieldName").get(index),
-                                        map.get("fieldValue").get(index)),
-                                        map.get("subject").get(index),
-                                        map.get("userId").get(index),
-                                        map.get("userName").get(index)
-                                     );
+         this.getParameters(task.get(index),
+                            map.get("fieldName").get(index),
+                            map.get("fieldValue").get(index),
+                            map.get("jsonData").get(index)),
+                            map.get("subject").get(index),
+                            map.get("userId").get(index),
+                            map.get("userName").get(index));
                         //devncq
                         String id = map.get("id").get(index);
                         String proInstId = (String)result.getVariable("proInstId");
@@ -87,7 +87,7 @@ public class CronNotifyServiceImpl implements CronNotifyService {
     }
 
     /*封装一个开启流程参数 */
-    public APIRequest getParameters(String taskIds,String name,String val){
+    public APIRequest getParameters(String taskIds,String name,String val,String da){
         List<APIRequestParameter> api = new ArrayList<>();
         APIRequestParameter apiRequestParameter = new APIRequestParameter();
         apiRequestParameter.setKey("defId");
@@ -102,10 +102,11 @@ public class CronNotifyServiceImpl implements CronNotifyService {
         APIRequestParameter apiRequestParameter2 = new APIRequestParameter();
         apiRequestParameter2.setKey("data");
         //添加流程参数
-        JSONObject json = JSONObject.parseObject("{'id':''}");
-        if(!name.isEmpty()){
-            json.put(name,val);
-        }
+       //JSONObject json = JSONObject.parseObject("{'id':''}");
+        JSONObject json = JSONObject.parseObject(da);
+//        if(!name.isEmpty()){
+//            json.put(name,val);
+//        }
         apiRequestParameter2.setValue(json.toString());
         api.add(apiRequestParameter2);
         APIRequest apiRequest = new APIRequest();
@@ -151,6 +152,7 @@ public class CronNotifyServiceImpl implements CronNotifyService {
         map.put("subject",new LinkedList<>());//流程名称
         map.put("fieldName",new LinkedList<>());//字段名称
         map.put("fieldValue",new LinkedList<>());//字段值
+        map.put("jsonData",new LinkedList<>());//json值
         for (JSONObject js : json) {
             //判断是否有任务 ,若有,则添加流程参数
             if(null!=js.getString("dui_ying_liu_chen") && null!=js.getString("shou_li_ren_yuan_")) {
@@ -163,7 +165,7 @@ public class CronNotifyServiceImpl implements CronNotifyService {
                     map.get("userName").add(name);
                     map.get("task").add(js.getString("dui_ying_liu_chen"));
                     map.get("subject").add(js.getString("ding_shi_ren_wu_n")+"{"+this.getSysYear()+"/"+orgName+"/"+name+"}");
-
+                    map.get("jsonData").add(js.getString("dui_ying_ren_wu_i")==null?"" : js.getString("dui_ying_ren_wu_i"));
                     map.get("fieldName").add(js.getString("guan_lian_zi_duan")==null? "" : js.getString("guan_lian_zi_duan"));
                     map.get("fieldValue").add(js.getString("guan_lian_fu_biao")==null? "" : js.getString("guan_lian_fu_biao"));
             }