|
@ -46,6 +46,7 @@ public class FileManageService {
|
|
|
param.setTaskId(UUID.randomUUID().toString());
|
|
|
}
|
|
|
boolean copflag =false;
|
|
|
long chunkFileSize = 5 * 1024 * 1024;
|
|
|
/**
|
|
|
* basePath是我的路径,可以替换为你的
|
|
|
* 1:原文件名改为UUID
|
|
@ -66,9 +67,11 @@ public class FileManageService {
|
|
|
//第二步
|
|
|
FileChannel fileChannel = raf.getChannel();
|
|
|
//第三步
|
|
|
long offset = param.getChunk() * param.getSize();
|
|
|
long offset = param.getChunk() * chunkFileSize;
|
|
|
//第四步
|
|
|
byte[] fileData = param.getFile().getBytes();
|
|
|
logger.info("offset"+offset);
|
|
|
logger.info("fileData.length"+fileData.length);
|
|
|
//第五步
|
|
|
MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE,offset,fileData.length);
|
|
|
//第六步
|
|
@ -80,9 +83,11 @@ public class FileManageService {
|
|
|
//第八步
|
|
|
boolean isComplete = checkUploadStatus(param,fileName,filePath);
|
|
|
if(isComplete){
|
|
|
logger.info("unCompelete size:"+tempFile.getTotalSpace());
|
|
|
renameFile(tempFile,fileName);
|
|
|
return filePath+"/"+fileName;
|
|
|
}else {
|
|
|
logger.info("unCompelete size:"+tempFile.getTotalSpace());
|
|
|
return "unCompelete";
|
|
|
}
|
|
|
|