123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679 |
- package com.juxin.client.websocket;
- import cn.hutool.core.date.DatePattern;
- import cn.hutool.core.date.DateUtil;
- import cn.hutool.core.io.FileUtil;
- import cn.hutool.core.util.IdUtil;
- import cn.hutool.core.util.RandomUtil;
- import cn.hutool.core.util.StrUtil;
- import cn.hutool.json.JSONObject;
- import cn.hutool.json.JSONUtil;
- import com.juxin.client.websocket.constant.GfConstants;
- import com.juxin.client.websocket.enums.WebsocketTypeEnum;
- import com.juxin.client.websocket.ppojo.WebsocketInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Bean;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import org.springframework.util.StringUtils;
- import org.springframework.web.socket.client.WebSocketClient;
- import javax.annotation.PostConstruct;
- import javax.websocket.ContainerProvider;
- import javax.websocket.Session;
- import javax.websocket.WebSocketContainer;
- import java.net.URI;
- import java.util.*;
- @Component
- 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"};
- //机构已反馈 机构暂未反馈 机构反馈失败,失败原因xxx 国反异常,获取结果失败
- public static final String[] SPLIT_RESULT =
- {"机构已反馈", "机构暂未反馈", "机构反馈失败,失败原因1", "机构已反馈",
- "国反异常,获取结果失败", "机构已反馈",
- "机构反馈失败,失败原因2", "机构已反馈", "机构反馈失败,失败原因3", "机构已反馈", "机构已反馈"};
- @Autowired
- private com.juxin.client.websocket.WebSocketClient client;
- public void init() {
- try {
- WebSocketContainer container = ContainerProvider.getWebSocketContainer();
- client = new com.juxin.client.websocket.WebSocketClient();
- Session session = container.connectToServer(client, new URI(Address1));
- client.setUserSession(session);
- // client.sendMessage("{ \"infoType\": \"heart\", \"postType\": \"python\", \"methodType\": \"heart\", \"reqJson\": { \"receiveJobStatus\": \"1\", \"msg\": \"ping\" } }");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- @Scheduled(cron = "*/20 * * * * ?")
- public void heart() throws Exception {
- if (client == null || client.getUserSession() == null) {
- init();
- }
- try {
- // 发送消息
- client.sendMessage("{ \"infoType\": \"heart\", \"postType\": \"python\", \"methodType\": \"heart\", \"reqJson\": { \"receiveJobStatus\": \"1\", \"msg\": \"ping\" } }");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- @Scheduled(cron = "*/5 * * * * ?")
- public void findResultTask() {
- if (client == null || client.getUserSession() == null) {
- return;
- }
- if (!GfConstants.FIND_RESULT_FLAG) {
- System.out.println("不具备获取结果状态,获取任务标志为false,证明有回捞任务在运行中**********************************");
- return;
- }
- try {
- // 发送消息
- client.sendMessage("{ \"infoType\": \"getResultQueueJob\", \"postType\": \"python\", \"methodType\": \"getResultQueueJob\" }");
- GfConstants.FIND_RESULT_FLAG = false;
- // 保持连接一段时间
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- @Scheduled(cron = "*/20 * * * * ?")
- public void findTask() {
- if (client == null || client.getUserSession() == null) {
- return;
- }
- if (!GfConstants.FIND_FLAG) {
- System.out.println("不具备获取任务状态,获取任务标志为false,证明有任务在运行中**********************************");
- return;
- }
- try {
- // 发送消息
- client.sendMessage("{ \"infoType\": \"getQueueJob\", \"postType\": \"python\", \"methodType\": \"getQueueJob\" }");
- GfConstants.FIND_FLAG = false;
- // 保持连接一段时间
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void dealTask(String message) {
- try {
- String result = "";
- WebsocketInfo bean = JSONUtil.toBean(message, WebsocketInfo.class);
- WebsocketTypeEnum enumByType = WebsocketTypeEnum.getEnumByType(bean.getInfoType());
- int i = RandomUtil.randomInt(0, 3);
- System.out.println("开始睡眠,睡眠时间" + i + "*********************************************");
- //Thread.sleep(i * 1000);
- switch (enumByType) {
- case COMMIT_MSG:
- result = commitTask(bean);
- if (result == null || result == "") {
- GfConstants.FIND_FLAG = true;
- } else {
- try {
- client.sendMessage(result);
- } finally {
- GfConstants.FIND_FLAG = true;
- }
- }
- break;
- case RESULT_LIST_MSG:
- result = searchTask(bean);
- if (result == "") {
- System.out.println("无回捞结果任务");
- return;
- }
- try {
- client.sendMessage(result);
- } finally {
- GfConstants.FIND_RESULT_FLAG = true;
- }
- break;
- case GET_RESULT_QUEUE_JOB:
- result = searchTask(bean);
- if (result == "") {
- return;
- }
- break;
- case ALARM_DATA:
- result = alarmWork(bean);
- if (result == "") {
- return;
- }
- break;
- default:
- return;
- }
- } catch (Exception e) {
- System.out.println("出现位置异常*******************:" + message);
- throw new RuntimeException(e);
- }
- }
- /**
- * 提交任务
- *
- * @param bean
- * @return
- */
- public String commitTask(WebsocketInfo bean) {
- String result = "";
- String methodType = bean.getMethodType();
- Object reqJson = bean.getReqJson();
- if (Objects.isNull(reqJson) || reqJson == "") {
- return result;
- }
- if (StrUtil.isBlankIfStr(methodType) || StrUtil.isBlankIfStr(reqJson) || reqJson == "" || reqJson == null) {
- return result;
- }
- switch (methodType) {
- case "bankCommit":
- result = bankCommitTask(reqJson);
- break;
- case "thirdCommit":
- result = thirdCommitTask(reqJson);
- break;
- case "serialCommit":
- result = serialCommitTask(reqJson);
- break;
- case "allAccountCommit":
- result = allAccountCommitTask(reqJson);
- break;
- case "bankAllAccountCommit":
- result = bankAllAccountCommitTask(reqJson);
- break;
- case "thirdSubjectCommit":
- result = thirdSubjectCommitTask(reqJson);
- break;
- default:
- break;
- }
- return result;
- }
- public String bankCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "bankCommit");
- Map<String, Object> req = new HashMap<>();
- req.put("recordId", jsonObject.get("groupId"));
- req.put("groupId", jsonObject.get("groupId"));
- String jobState = status[RandomUtil.randomInt(0, 6)];
- req.put("jobState", jobState);
- if (Objects.equals(jobState, "success")) {
- 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("bankCard", e.get("bankCard"));
- map.put("result", "0000");
- map.put("maninBodyType", e.get("maninBodyType"));
- map.put("bankName", Objects.toString(jsonObject.get("bankname")));
- map.put("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- split.add(map);
- });
- req.put("bankSplits", split);
- }
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- public String thirdCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "thirdCommit");
- Map<String, Object> req = new HashMap<>();
- req.put("recordId", jsonObject.get("groupId"));
- req.put("groupId", jsonObject.get("groupId"));
- String jobState = status[RandomUtil.randomInt(0, 6)];
- req.put("jobState", jobState);
- if (Objects.equals(jobState, "success")) {
- 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"));
- map.put("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- split.add(map);
- });
- req.put("thirdFundsSplits", split);
- }
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- public String serialCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "serialCommit");
- Map<String, Object> req = new HashMap<>();
- req.put("recordId", jsonObject.get("groupId"));
- req.put("groupId", jsonObject.get("groupId"));
- String jobState = status[RandomUtil.randomInt(0, 6)];
- req.put("jobState", jobState);
- if (Objects.equals(jobState, "success")) {
- 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("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- split.add(map);
- });
- req.put("serialNumberSplits", split);
- }
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- public String allAccountCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "allAccountCommit");
- Map<String, Object> req = new HashMap<>();
- req.put("recordId", jsonObject.get("groupId"));
- req.put("groupId", jsonObject.get("groupId"));
- String jobState = status[RandomUtil.randomInt(0, 6)];
- req.put("jobState", jobState);
- if (Objects.equals(jobState, "success")) {
- 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("peopleName", e.get("peopleName"));
- map.put("result", "0000");
- map.put("accountSearchType", e.get("accountSearchType"));
- map.put("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- split.add(map);
- });
- req.put("allAccountSplits", split);
- }
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- public String bankAllAccountCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "bankAllAccountCommit");
- Map<String, Object> req = new HashMap<>();
- req.put("recordId", jsonObject.get("groupId"));
- req.put("groupId", jsonObject.get("groupId"));
- String jobState = status[RandomUtil.randomInt(0, 6)];
- req.put("jobState", jobState);
- if (Objects.equals(jobState, "success")) {
- 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("result", "0000");
- map.put("maninBodyType", e.get("maninBodyType"));
- map.put("accountNo", e.get("accountNo"));
- map.put("accountName", e.get("accountName"));
- map.put("bankName", Objects.toString(jsonObject.get("bankname")));
- map.put("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- split.add(map);
- });
- req.put("bankAllAccountSplits", split);
- }
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- /**
- * 第三方主体 提交over接口
- * @param reqJson
- * @return
- */
- public String thirdSubjectCommitTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "over");
- result.put("postType", "python");
- result.put("methodType", "thirdSubjectCommit");
- 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);
- result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- /**
- * 回捞任务
- *
- * @param bean
- * @return
- */
- public String searchTask(WebsocketInfo bean) {
- String result = "";
- String methodType = bean.getMethodType();
- if (methodType == null || methodType.equals("")) {
- return result;
- }
- Object reqJson = bean.getReqJson();
- switch (methodType) {
- case "bankResult":
- result = bankResultTask(reqJson);
- break;
- case "thirdResult":
- result = thirdResultTask(reqJson);
- break;
- case "serialResult":
- result = serialResultTask(reqJson);
- break;
- case "allAccountResult":
- result = allAccountResultTask(reqJson);
- break;
- case "bankAllAccountResult":
- result = bankAllAccountResultTask(reqJson);
- break;
- case "thirdOwnerResult":
- result = thirdSubjectResultTask(reqJson);
- break;
- default:
- break;
- }
- return result;
- }
- public String bankResultTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "bankResult");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- String splitResult = SPLIT_RESULT[RandomUtil.randomInt(0, 10)];
- req.put("status", splitResult);
- if (Objects.equals(splitResult, "机构已反馈")) {
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- } else {
- req.put("valueCount", 0);
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水空文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- }
- return JSONUtil.toJsonStr(result);
- }
- public String thirdResultTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "thirdResult");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- String splitResult = SPLIT_RESULT[RandomUtil.randomInt(0, 10)];
- req.put("status", splitResult);
- if (Objects.equals(splitResult, "机构已反馈")) {
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- } else {
- req.put("valueCount", 0);
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水空文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- }
- return JSONUtil.toJsonStr(result);
- }
- public String serialResultTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "serialResult");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- String splitResult = SPLIT_RESULT[RandomUtil.randomInt(0, 10)];
- req.put("status", splitResult);
- if (Objects.equals(splitResult, "机构已反馈")) {
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- } else {
- req.put("valueCount", 0);
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/流水空文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- }
- return JSONUtil.toJsonStr(result);
- }
- public String allAccountResultTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "allAccountResult");
- result.put("combineSearchFlag", "是");
- result.put("combineSearchStart", "2025-03-05");
- result.put("combineSearchEnd", "2025-05-05");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- String splitResult = SPLIT_RESULT[RandomUtil.randomInt(0, 10)];
- req.put("status", splitResult);
- if (Objects.equals(splitResult, "机构已反馈")) {
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/第三方全账户.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- } else {
- req.put("valueCount", 0);
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/第三方全账户空文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- }
- return JSONUtil.toJsonStr(result);
- }
- public String bankAllAccountResultTask(Object reqJson) {
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "bankAllAccountResult");
- result.put("combineSearchFlag", "是");
- result.put("combineSearchStart", "2025-03-05");
- result.put("combineSearchEnd", "2025-05-05");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- String splitResult = SPLIT_RESULT[RandomUtil.randomInt(0, 10)];
- req.put("status", splitResult);
- if (Objects.equals(splitResult, "机构已反馈")) {
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/银行卡全账户.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- } else {
- req.put("valueCount", 0);
- result.put("reqJson", req);
- FileUtil.copy(FileUtil.file("excel/银行卡全账户空文件.xlsx")
- , FileUtil.file(Objects.toString(param.get("file_path")))
- , true);
- }
- return JSONUtil.toJsonStr(result);
- }
- /**
- * 第三方主体 回捞结果 数据
- * @param reqJson
- * @return
- */
- public String thirdSubjectResultTask(Object reqJson){
- String thirdSubjectResult=" {\n" +
- " \n" +
- " \"applicationid\":\"0303A2002331253012019FZ2505151353210\",\n" +
- " \"result\":\"0000\",\n" +
- " \n" +
- " \"datatype\":\"01\",\n" +
- " \"data\":\"Cl19850404(085e9858e9a060738bd691107@wx.tenpay.com)\",\n" +
- " \"subjecttype\":\"01\",\n" +
- " \"accountownername\":\"陈林\",\n" +
- " \"accountowneridtype\":\"01\",\n" +
- " \"accountownerid\":\"320922198504045025\",\n" +
- " \"credentialvalidity\":\"20160405-20360405\",\n" +
- " \"telnumber\":\"15190380742\",\n" +
- " \"bindingdatatype\":\"03\",\n" +
- " \"bindingdata\":\"Cl19850404\",\n" +
- " \"bankcard\":[\n" +
- " {\n" +
- " \"applicationid\":\"0303A2002331253012019FZ2505151353210\",\n" +
- " \"bankid\":\"2702\",\n" +
- " \"bankname\":\"江苏农商联合银行\",\n" +
- " \"bankaccount\":\"6230661635027269745\",\n" +
- " \"cardtype\":\"1\",\n" +
- " \"cardvalidation\":\"1\",\n" +
- " \"cardexpirydate\":\"-\",\n" +
- " \"cardinfo\":\"-\",\n" +
- " \"txcode\":null,\n" +
- " \"pk\":\"0303A2002331253012019FZ2505151353210\"\n" +
- " },\n" +
- " {\n" +
- "\n" +
- " \"applicationid\":\"1111\",\n" +
- " \"bankid\":\"1111\",\n" +
- " \"bankname\":\"1111银行\",\n" +
- " \"bankaccount\":\"111111111115\",\n" +
- " \"cardtype\":\"2\",\n" +
- " \"cardvalidation\":\"2\",\n" +
- " \"cardexpirydate\":\"-\",\n" +
- " \"cardinfo\":\"-\",\n" +
- " \"txcode\":null,\n" +
- " \"pk\":\"0303A2002331253012019FZ2505151353210\"\n" +
- " }\n" +
- " ]\n" +
- " }";
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- JSONObject param = jsonObject.get("params", JSONObject.class);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "result");
- result.put("postType", "python");
- result.put("methodType", "thirdOwnerResult");
- Map<String, Object> req = new HashMap<>();
- req.put("applicationId", param.get("applicationid"));
- req.put("accountSearchType",param.get("accountSearchType"));
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
- JSONObject thirdSubject=JSONUtil.parseObj(thirdSubjectResult);
- thirdSubject.put("applicationid", param.get("applicationid"));
- thirdSubject.put("data",param.get("data"));
- req.put("thirdSubjectResult",thirdSubject);
- result.put("reqJson", req);
- System.out.println(result);
- return JSONUtil.toJsonStr(result);
- }
- public static void main(String[] args) {
- FileUtil.copy(FileUtil.file("excel/6226890438342486.xlsx")
- , FileUtil.file("C:\\Users\\EDY\\Desktop\\需求\\银行卡查询\\test.xlsx")
- , true);
- }
- public String alarmWork(WebsocketInfo bean) {
- String methodType = bean.getMethodType();
- if (methodType == null || methodType.equals("")) {
- return "";
- }
- Object reqJson = bean.getReqJson();
- JSONObject jsonObject = JSONUtil.parseObj(reqJson);
- Map<String, Object> result = new HashMap<>();
- result.put("infoType", "alarmData");
- result.put("postType", "python");
- result.put("methodType", "bankCommit");
- 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("bankCard", e.get("bankCard"));
- // map.put("result", "0000");
- // map.put("maninBodyType", e.get("maninBodyType"));
- // map.put("bankName", Objects.toString(jsonObject.get("bankname")));
- // map.put("splitTime", DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN) + "-"
- // + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN));
- // split.add(map);
- // });
- // req.put("bankSplits", split);
- // result.put("reqJson", req);
- return JSONUtil.toJsonStr(result);
- }
- }
|