• 数据的导入


    @RequestMapping("/import_data")
     public HttpResult importData(@RequestParam("file") MultipartFile file,HttpServletRequest request) {
      
            Map<String,Object> importParam = new HashMap<>();
            importParam.put("file",file);
            return dwdbBasicDsService.importData(importParam);
        }
    
    HttpResult importData(Map<String, Object> importParam);
    

    //导入信息

    @Override
    public HttpResult importData(Map<String, Object> importParam) {
        //获取传输参数
        MultipartFile file = (MultipartFile) importParam.get("file");
      
        Date now = new Date();
        int iType = "".equals(type) ? 0 : Integer.parseInt(type);
        List<String> keys = HeartHelper.getInstance().getKeys();
        HttpResult<String> router = ExecutorRouteStrategyEnum.ROUND.getRouter().router(keys);
        String clientId = router.getData();
        String ip = redisService.mapGet(clientId, "ip");
        String port = redisService.mapGet(clientId, "port");
        String prefix = redisService.mapGet(clientId, "prefix");
        String importUrl = "";
        if (StrUtil.isNotEmpty(ip) && StrUtil.isNotEmpty(port)) {
            if (StrUtil.isNotEmpty(prefix)) {
                prefix = "/" + prefix;
            }
            importUrl = StrUtil.format("http://{}:{}{}/import_client/import", ip, port, prefix);
        } else {
            return HttpResult.error("获取信息错误");
        }
        try {
            //新增记录
            CurrUserInfo currUserInfo = UserUtils.getCurrUserInfo();
            RwkUploadRecord rwkUploadRecord = new RwkUploadRecord();
            rwkUploadRecord.setUserid(currUserInfo.getUserID());
            rwkUploadRecord.setRequestId(createRequestId(currUserInfo.getUserID(), iType, now));
            rwkUploadRecord.setStartTime(now);
            rwkUploadRecord.setServerIp(IpUtil.getUniqueFlag());
            rwkUploadRecord.setResult(-1);
            rwkUploadRecord.setMsg(StrUtil.format("{} 开始等待导入", yyyyMMddHHmmss(now)));
            rwkUploadRecord.setType(iType);
            iRwkUploadRecordService.save(rwkUploadRecord);
            System.out.println("导入服务地址:" + importUrl);
    
            HttpResponse response = HttpUtil.createPost(importUrl)
                    .form("file", file.getBytes(), file.getName())
                    .form("currUser", JSON.toJSONString(UserUtils.getCurrUserInfo()))
                    .form("type", type)
                    .form("wwrwk", isWwrwk)
                    .form("recordId", rwkUploadRecord.getId())
                    .form("isDs", "1")
                    .form("isUpdateHeadImage", String.valueOf(isUpdateHeadImage))
                    .execute();
            String body = response.body();
            System.out.println("访问导入服务器接受到结果:" + body);
            HttpResult res = JSON.parseObject(body, HttpResult.class);
            return res;
        } catch (Exception e) {
            e.printStackTrace();
            return HttpResult.error(e.getMessage());
        }
    }
    
  • 相关阅读:
    Android内存优化内存抖动的解决实战
    【Unity3D】UI Toolkit样式选择器
    见面礼——图论
    无人机动力系统详解
    你知道SOLIDWORKS焊件类零件有个快速草图建立工具吗?
    学历证书查询 易语言代码
    STM32进阶笔记——复位、时钟与滴答定时器
    XDP入门--通过用户态程序自动加载与卸载eBPF程序字节码到网卡
    webpack(一)模块化
    NumPy创建数组的方法
  • 原文地址:https://blog.csdn.net/weixin_45817985/article/details/126891597