Browse Source

Merge remote-tracking branch 'origin/master'

yanjunjie 1 month ago
parent
commit
6f182b9ad9
1 changed files with 30 additions and 13 deletions
  1. 30 13
      src/main/java/com/juxin/client/websocket/FindTask.java

+ 30 - 13
src/main/java/com/juxin/client/websocket/FindTask.java

@@ -27,6 +27,8 @@ public class FindTask {
     public static String Address1 = "ws://127.0.0.1:9990/pythonInteractive/websocket/pythonClient";
 
     public static final String[] status = {"success", "success", "fail", "success", "success", "stop", "success"};
+
+    public static final String[] ERR_MSG = {"失败原因1", "失败原因2", "失败原因3", "失败原因4", "失败原因5", "失败原因6", "失败原因7"};
     //机构已反馈 机构暂未反馈 机构反馈失败,失败原因xxx   国反异常,获取结果失败
     public static final String[] SPLIT_RESULT =
             {"机构已反馈", "机构暂未反馈", "机构反馈失败,失败原因1", "机构已反馈",
@@ -249,6 +251,8 @@ public class FindTask {
                 split.add(map);
             });
             req.put("bankSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
         }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
@@ -280,6 +284,8 @@ public class FindTask {
                 split.add(map);
             });
             req.put("thirdFundsSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
         }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
@@ -310,6 +316,8 @@ public class FindTask {
                 split.add(map);
             });
             req.put("serialNumberSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
         }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
@@ -342,6 +350,8 @@ public class FindTask {
                 split.add(map);
             });
             req.put("allAccountSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
         }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
@@ -374,6 +384,8 @@ public class FindTask {
                 split.add(map);
             });
             req.put("bankAllAccountSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
         }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
@@ -394,19 +406,24 @@ public class FindTask {
         Map<String, Object> req = new HashMap<>();
         req.put("recordId", jsonObject.get("groupId"));
         req.put("groupId", jsonObject.get("groupId"));
-        req.put("jobState", status[RandomUtil.randomInt(0, 6)]);
-        List<Map<String, String>> split = new ArrayList<>();
-        List<Map<String, String>> list = jsonObject.get("list", List.class);
-        list.forEach(e -> {
-            Map<String, String> map = new HashMap<>();
-            map.put("applicationid", IdUtil.fastSimpleUUID());
-            map.put("data", e.get("accountNo"));
-            map.put("searchAgency", Objects.toString(jsonObject.get("searchAgency")));
-            map.put("result", "0000");
-            map.put("accountSearchType", e.get("accountSearchType"));
-            split.add(map);
-        });
-        req.put("thirdSubjectSplits", split);
+        String jobState = status[RandomUtil.randomInt(0, 6)];
+        if (Objects.equals(jobState, "success")) {
+            req.put("jobState", jobState);
+            List<Map<String, String>> split = new ArrayList<>();
+            List<Map<String, String>> list = jsonObject.get("list", List.class);
+            list.forEach(e -> {
+                Map<String, String> map = new HashMap<>();
+                map.put("applicationid", IdUtil.fastSimpleUUID());
+                map.put("data", e.get("accountNo"));
+                map.put("searchAgency", Objects.toString(jsonObject.get("searchAgency")));
+                map.put("result", "0000");
+                map.put("accountSearchType", e.get("accountSearchType"));
+                split.add(map);
+            });
+            req.put("thirdSubjectSplits", split);
+        } else {
+            req.put("errorMsg", status[RandomUtil.randomInt(0, 6)]);
+        }
         result.put("reqJson", req);
         return JSONUtil.toJsonStr(result);
     }