|
@@ -1,508 +0,0 @@
|
|
|
-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;
|
|
|
- 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"));
|
|
|
- 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);
|
|
|
- }
|
|
|
-
|
|
|
- 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"));
|
|
|
- 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"));
|
|
|
- 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"));
|
|
|
- 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("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"));
|
|
|
- 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("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"));
|
|
|
- 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("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);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 回捞任务
|
|
|
- *
|
|
|
- * @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;
|
|
|
- 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"));
|
|
|
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
|
|
|
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
|
|
|
- result.put("reqJson", req);
|
|
|
- FileUtil.copy(FileUtil.file("excel/6226890438342486.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"));
|
|
|
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
|
|
|
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
|
|
|
- result.put("reqJson", req);
|
|
|
- FileUtil.copy(FileUtil.file("excel/6226890438342486.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"));
|
|
|
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
|
|
|
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
|
|
|
- result.put("reqJson", req);
|
|
|
- FileUtil.copy(FileUtil.file("excel/6226890438342486.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", Objects.toString(jsonObject.get("combineSearchFlag")));
|
|
|
- result.put("combineSearchStart", Objects.toString(jsonObject.get("combineSearchStart")));
|
|
|
- result.put("combineSearchEnd", Objects.toString(jsonObject.get("combineSearchEnd")));
|
|
|
- Map<String, Object> req = new HashMap<>();
|
|
|
- req.put("applicationId", param.get("applicationid"));
|
|
|
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
|
|
|
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
|
|
|
- result.put("reqJson", req);
|
|
|
- FileUtil.copy(FileUtil.file("excel/6226890438342486.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");
|
|
|
- Map<String, Object> req = new HashMap<>();
|
|
|
- req.put("applicationId", param.get("applicationid"));
|
|
|
- req.put("status", SPLIT_RESULT[RandomUtil.randomInt(0, 10)]);
|
|
|
- req.put("valueCount", RandomUtil.randomInt(0, 10000));
|
|
|
- result.put("reqJson", req);
|
|
|
- FileUtil.copy(FileUtil.file("excel/6226890438342486.xlsx")
|
|
|
- , FileUtil.file(Objects.toString(param.get("file_path")))
|
|
|
- , true);
|
|
|
- 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);
|
|
|
- }
|
|
|
-}
|