|
@@ -71,7 +71,7 @@ public class AttachmentFileUtil {
|
|
|
ftpClient.type(FTP.BINARY_FILE_TYPE);
|
|
|
ftpClient.enterLocalPassiveMode(); // 切换到被动模式
|
|
|
fileUrl = encode(fileUrl,"UTF-8");
|
|
|
- logger.info("fileUrl:" + fileUrl);
|
|
|
+ logger.info("FTP fileUrl:" + fileUrl);
|
|
|
String dir = ftpClient.printWorkingDirectory();
|
|
|
//System.out.println(dir);
|
|
|
//ftpClient.changeWorkingDirectory("Files/CMB");
|
|
@@ -80,7 +80,7 @@ public class AttachmentFileUtil {
|
|
|
//fileUrl = dir + fileUrl;
|
|
|
|
|
|
inputStream = ftpClient.retrieveFileStream(fileUrl);
|
|
|
- logger.info("inputStream -- size:"+inputStream.available());
|
|
|
+ logger.info("FTP inputStream -- size:"+inputStream.available());
|
|
|
//System.out.println("inputStream:"+inputStream);
|
|
|
|
|
|
outStream = new ByteArrayOutputStream();
|
|
@@ -104,10 +104,10 @@ public class AttachmentFileUtil {
|
|
|
// 苍穹自带
|
|
|
TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
|
|
|
tempUrl = cache.saveAsFullUrl((String) attachItem.get("name"), inputStream, 1600);
|
|
|
- logger.info("tempUrl -- inputStream -- size:" + CacheFactory.getCommonCacheFactory().getTempFileCache().getInputStream(tempUrl).available());
|
|
|
+ logger.info("FTP tempUrl -- inputStream -- size:" + CacheFactory.getCommonCacheFactory().getTempFileCache().getInputStream(tempUrl).available());
|
|
|
System.out.println(":tempUrl"+tempUrl);
|
|
|
} catch (Exception e) {
|
|
|
- logger.info("附件上传失败,堆栈信息:",e);
|
|
|
+ logger.info("FTP 附件上传失败,堆栈信息:",e);
|
|
|
result.put("isSuccess", "false");
|
|
|
result.put("msg", "转文件流异常"+e);
|
|
|
return result;
|
|
@@ -124,7 +124,7 @@ public class AttachmentFileUtil {
|
|
|
ftpClient.disconnect();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- logger.info("附件上传失败,堆栈信息01:",e.getMessage());
|
|
|
+ logger.info("FTP 附件上传失败,堆栈信息01:",e.getMessage());
|
|
|
result.put("isSuccess", "false");
|
|
|
result.put("msg", "文件流关闭异常:"+e.getMessage());
|
|
|
return result;
|
|
@@ -137,7 +137,7 @@ public class AttachmentFileUtil {
|
|
|
|
|
|
//上传到临时文件服务器
|
|
|
String actUrl = AttachmentServiceHelper.saveTempToFileService(tempUrl,appId,entity, pk, (String)attachItem.get("name"));
|
|
|
- logger.info("actUrl:"+actUrl);
|
|
|
+ logger.info("FTP actUrl:"+actUrl);
|
|
|
System.out.println("actUrl:"+actUrl);
|
|
|
TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
|
|
|
InputStream in = cache.getInputStream(tempUrl);
|
|
@@ -153,7 +153,7 @@ public class AttachmentFileUtil {
|
|
|
|
|
|
//从临时上传至 文件服务器
|
|
|
String downUrl =service.upload(fileItem);
|
|
|
- logger.info("downUrl:"+downUrl);
|
|
|
+ logger.info("FTP downUrl:"+downUrl);
|
|
|
System.out.println("downUrl:"+downUrl);
|
|
|
|
|
|
attachItem.put("url", actUrl);
|
|
@@ -162,7 +162,7 @@ public class AttachmentFileUtil {
|
|
|
AttachmentServiceHelper.upload(entity, pk, attachKey, attachments);
|
|
|
|
|
|
}catch(Exception e1){
|
|
|
- logger.info("附件上传失败,堆栈信息e1:",e1);
|
|
|
+ logger.info("FTP 附件上传失败,堆栈信息e1:",e1);
|
|
|
result.put("isSuccess", "false");
|
|
|
result.put("msg", "上传服务器异常:"+e1);
|
|
|
return result;
|
|
@@ -184,7 +184,7 @@ public class AttachmentFileUtil {
|
|
|
//上传到临时文件服务器
|
|
|
System.out.println(tempUrl);
|
|
|
String actUrl = AttachmentServiceHelper.saveTempToFileService(tempUrl,appId,entity, pk,fileName);
|
|
|
- System.out.println("actUrl:"+actUrl);
|
|
|
+ System.out.println("FTP actUrl:"+actUrl);
|
|
|
TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
|
|
|
InputStream in = cache.getInputStream(tempUrl);
|
|
|
FileService service = FileServiceFactory.getAttachmentFileService();
|
|
@@ -192,7 +192,7 @@ public class AttachmentFileUtil {
|
|
|
String uuid = UUID.randomUUID().toString().replace("-", "");
|
|
|
String pathParam = FileNameUtils.getAttachmentFileName(requestContext.getTenantId(),
|
|
|
requestContext.getAccountId(), uuid, fileName);
|
|
|
- System.out.println("pathParam:"+pathParam);
|
|
|
+ System.out.println("FTP pathParam:"+pathParam);
|
|
|
FileItem fileItem = new FileItem(fileName, pathParam, in);
|
|
|
|
|
|
//从临时上传至 文件服务器
|