|
@@ -75,68 +75,16 @@ public class ViewController extends Controller {
|
|
|
public void testDown() {
|
|
|
// TODO Auto-generated method stub
|
|
|
try {
|
|
|
-
|
|
|
-// FTPClient ftpClient = new FTPClient();
|
|
|
-// int reply;
|
|
|
-//
|
|
|
-// try {
|
|
|
-// ftpClient.connect(PropKit.get("ftp_host"), PropKit.getInt("ftp_port"));
|
|
|
-// ftpClient.login(PropKit.get("ftp_user"), PropKit.get("ftp_password"));
|
|
|
-// reply = ftpClient.getReplyCode();
|
|
|
-// if (!FTPReply.isPositiveCompletion(reply)) {
|
|
|
-// ftpClient.disconnect();
|
|
|
-//// return null;
|
|
|
-// this.renderText("noconn");
|
|
|
-//
|
|
|
-// }
|
|
|
-// ftpClient.setControlEncoding("UTF-8");
|
|
|
-// ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
|
-// ftpClient.enterLocalPassiveMode();
|
|
|
-//
|
|
|
-// File localFile = new File("/home/zskk/FTP_FILE" + File.separatorChar + "123.jpg");
|
|
|
-// OutputStream os = new FileOutputStream(localFile);
|
|
|
-// //ftp中文名需要iso-8859-1字符
|
|
|
-// boolean flag2 = ftpClient.retrieveFile(new String("20240726/1AFB48FCF39241AA8DE61F85EE6D847F/Report/Report.jpg".getBytes("GBK"), "iso-8859-1"), os);
|
|
|
-// if (!flag2) {
|
|
|
-// System.out.println("没有找到" + "20240726/1AFB48FCF39241AA8DE61F85EE6D847F/Report/Report.jpg" + "---该文件");
|
|
|
-// localFile.delete();
|
|
|
-// } else {
|
|
|
-// System.out.println("=================== save success");
|
|
|
-// }
|
|
|
-// os.close();
|
|
|
-// ftpClient.logout();
|
|
|
-// ftpClient.disconnect();
|
|
|
-//// return "/home/zskk/FTP_FILE" + File.separatorChar + fileName;
|
|
|
-// this.renderText("succ");
|
|
|
-//
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// this.renderText(e.toString());
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
- AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(PropKit.get("oss_endpoint"), PropKit.get("region"));
|
|
|
-// BasicAWSCredentials credentials = new BasicAWSCredentials(PropKit.get("oss_accessKey"), PropKit.get("oss_secretKey"));
|
|
|
-// AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
|
|
|
-// AmazonS3 client = AmazonS3ClientBuilder.standard()
|
|
|
-// .withEndpointConfiguration(endpointConfiguration)
|
|
|
-// .withCredentials(credentialsProvider).build();
|
|
|
-
|
|
|
- String fileNameStr[] = "ftp://FTPUser:ftpuser@188.188.2.1:6161/20240726/1AFB48FCF39241AA8DE61F85EE6D847F/Report/Report.jpg".split("/");
|
|
|
- String fileName = fileNameStr[fileNameStr.length - 3]+".jpg";
|
|
|
- String fpString = fileNameStr[fileNameStr.length - 4]+"/"+fileNameStr[fileNameStr.length - 3]+"/"+fileNameStr[fileNameStr.length - 2]+"/"+fileNameStr[fileNameStr.length - 1];
|
|
|
-// String fileStorePath = getFileWithUrl(fpString, fileName);
|
|
|
-// String fileStorePath = downloadFtpFile(fpString, fileName);
|
|
|
- this.renderText(fpString+"*******"+fileName);
|
|
|
+
|
|
|
|
|
|
-// DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
-// Map<String, String> annex_params = new HashMap<>();
|
|
|
-// annex_params.put("institution_id", PropKit.get("institution_id"));
|
|
|
-// annex_params.put("type", "1");
|
|
|
-// annex_params.put("code", "11");
|
|
|
-// //附件类型1.mp4 2.pdf 3.jpeg
|
|
|
-// annex_params.put("annex_class_code", "3");
|
|
|
-// dService.saveAnnex(annex_params, "ftp://FTPUser:ftpuser@188.188.2.1:6161/20240726/1AFB48FCF39241AA8DE61F85EE6D847F/Report/Report.jpg");
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
+ Map<String, String> annex_params = new HashMap<>();
|
|
|
+ annex_params.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ annex_params.put("type", "1");
|
|
|
+ annex_params.put("code", "11");
|
|
|
+ //附件类型1.mp4 2.pdf 3.jpeg
|
|
|
+ annex_params.put("annex_class_code", "3");
|
|
|
+ dService.saveAnnex(annex_params, "ftp://FTPUser:ftpuser@188.188.2.1:6161/20240726/1AFB48FCF39241AA8DE61F85EE6D847F/Report/Report.jpg");
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
this.renderText(e.toString());
|