<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 組件源碼 ``` /** * <b>方法描述:</b> FTP文件下載 <br/> * <b>創建者:</b> admin <br/> * <b>創建時間:</b> 2018-05-08 18:22:33 <br/> * * @param ftpHost * 入參|FTP服務器地址|{@link java.lang.String} * @param ftpPort * 入參|FTP服務器端口|{@link java.lang.Integer} * @param ftpUser * 入參|FTP用戶|{@link java.lang.String} * @param ftpPswd * 入參|FTP密碼|{@link java.lang.String} * @param remoteFile * 入參|服務器文件|{@link java.lang.String} * @param localFile * 入參|本地目錄|{@link java.lang.String} * @return -1 異常<br/> * 0 失敗<br/> * 1 成功<br/> */ @Component(label = "FTP文件下載", style = "判斷型", type = "同步組件", comment = "FTP文件下載", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-08 06:22:33") @InParams(param = { @Param(name = "ftpHost", comment = "FTP服務器地址", type = java.lang.String.class), @Param(name = "ftpPort", comment = "FTP服務器端口", type = java.lang.Integer.class), @Param(name = "ftpUser", comment = "FTP用戶", type = java.lang.String.class), @Param(name = "ftpPswd", comment = "FTP密碼", type = java.lang.String.class), @Param(name = "remoteFile", comment = "服務器文件", type = java.lang.String.class), @Param(name = "localFile", comment = "本地目錄", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "異常"), @Return(id = "0", desp = "失敗"), @Return(id = "1", desp = "成功") }) public static ResultBase P_ftpDownload(String ftpHost, Integer ftpPort, String ftpUser, String ftpPswd, String remoteFile, String localFile) { FTPClient ftp = new FTPClient(); ftp.setControlEncoding("GBK"); FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX); conf.setServerLanguageCode("zh"); ftp.configure(conf); String[] strATmp = remoteFile.replaceAll("\\\\", "/").split("/"); String svrFile = strATmp[strATmp.length - 1]; String svrPath = remoteFile.substring(0, remoteFile.length() - svrFile.length()); if (StringUtils.isEmpty(localFile)) { localFile = svrFile; } else { localFile = localFile.replaceAll("\\\\", "/"); if (localFile.endsWith("/")) { localFile += svrFile; } File ff = new File(new File(localFile).getParent()); ff.mkdirs(); } try { int reply; ftp.connect(ftpHost, ftpPort); ftp.login(ftpUser, ftpPswd); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return ResultBase.newFailureResult("TPTX0006", "登錄FTP服務失敗"); } if (StringUtils.isNotEmpty(svrPath) && !ftp.changeWorkingDirectory(svrPath)) { ftp.disconnect(); return ResultBase.newFailureResult("TPTX0007", "遠程目錄" + svrPath + "不存在"); } ftp.setFileType(FTP.BINARY_FILE_TYPE); FTPFile[] fs = ftp.listFiles(svrFile); if (fs == null || fs.length < 1) { ftp.disconnect(); return ResultBase.newFailureResult("TPTX0008", "遠程文件" + svrFile + "不存在"); } for (FTPFile ff : fs) { File fileObj = new File(localFile); OutputStream is = new FileOutputStream(fileObj); ftp.retrieveFile(ff.getName(), is); is.close(); } ftp.logout(); return ResultBase.newSuccessResult(); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTX0009", "FTP下載文件失敗," + AppLog.errorMsg(e)); } finally { try { ftp.disconnect(); } catch (Exception ioe) { AppLog.error(ioe); } } } ``` # 交易中組件使用方式 ![](https://img.kancloud.cn/fa/35/fa358fa51dd626332b36793837d895e1_1868x891.png) # 參數說明及示例 ## 入口參數 FTP服務器地址:FTP 所在服務地址,示例: `__REQ__["serverName"]` FTP服務器端口:FTP 服務端口,示例: `__REQ__["port"]` FTP用戶:FTP 用戶名,示例: `__REQ__["user"]` FTP密碼:FTP 密碼,示例: `__REQ__["password"]` 服務器文件:FTP 服務器目錄中的文件,示例: `"/opt/abc.txt"` 本地目錄:下載到本地哪個目錄,示例: `"D:\\work\\CQYY\\workspace"`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看