|
@@ -1,6 +1,7 @@
|
|
|
package sys.sc.formplugin;
|
|
|
|
|
|
import com.alipay.api.kms.aliyun.utils.BackoffUtils;
|
|
|
+import com.jcraft.jsch.SftpException;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
@@ -77,15 +78,11 @@ public class CreatDatPlugin extends AbstractListPlugin {
|
|
|
}
|
|
|
this.getView().showMessage("创建成功"+filePath);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
String spiltsign=jkdataDy.getString("nckd_split");
|
|
|
|
|
|
String endsign=jkdataDy.getString("nckd_endsign");
|
|
|
-
|
|
|
- DatFileCreatUtils datFileCreatUtils=new DatFileCreatUtils(tablenumber,bizappnum,fileList,filePath,spiltsign,endsign);
|
|
|
-
|
|
|
- datFileCreatUtils.creatDatFile();
|
|
|
-
|
|
|
|
|
|
String host=jkdataDy.getString("nckd_servername");
|
|
|
|
|
@@ -94,35 +91,43 @@ public class CreatDatPlugin extends AbstractListPlugin {
|
|
|
String password=jkdataDy.getString("nckd_password");
|
|
|
|
|
|
int port=jkdataDy.getInt("nckd_port");
|
|
|
+
|
|
|
+
|
|
|
SftpClient sftpClient=new SftpClient(host,username,password,port);
|
|
|
-
|
|
|
try {
|
|
|
- sftpClient.connect();
|
|
|
-
|
|
|
- sftpClient.fileCreat(filePath,nckd_url+filename);
|
|
|
- } catch (Exception e) {
|
|
|
+
|
|
|
+ Path localFile = Files.createTempFile(tablenumber, ".dat");
|
|
|
+
|
|
|
+ DatFileCreatUtils datFileCreatUtils=new DatFileCreatUtils(tablenumber,bizappnum,fileList,localFile.toString(),spiltsign,endsign);
|
|
|
+
|
|
|
+ datFileCreatUtils.creatDatFile();
|
|
|
+ sftpClient.fileCreat(String.valueOf(localFile),nckd_url);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ } catch (SftpException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
sftpClient.disconnect();
|
|
|
}
|
|
|
if (name.equals("uploadfile"))
|
|
|
{
|
|
|
- String remoteFilePath="/home/kingdee/cosmic/nginx-appstatic/store/appstatic/";
|
|
|
- SftpClient sftpClient=new SftpClient("192.168.10.69","root","Kd@86262007",22);
|
|
|
- try {
|
|
|
- sftpClient.connect();
|
|
|
-
|
|
|
- Path localFile = Files.createTempFile("tempfile", ".txt");
|
|
|
- Files.write(localFile, Collections.singleton("Hello, SFTP!"));
|
|
|
- sftpClient.fileCreat(localFile.toString(),remoteFilePath);
|
|
|
- Files.delete(localFile);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- sftpClient.disconnect();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|