|
@@ -699,20 +699,27 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
String md5 = strArr[3];
|
|
|
String chunk = strArr[4];
|
|
|
|
|
|
+ log.info("mac:{},fileId:{},picNum:{},md5:{},chunk:{}", mac, fileId, picNum, md5, chunk);
|
|
|
+
|
|
|
ResultData result = null;
|
|
|
if (file.isEmpty()){
|
|
|
+ log.error("文件为空。");
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED.code(),"文件为空。");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(fileId)){
|
|
|
+ log.error("文件Id为空。");
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED.code(),"文件Id为空。");
|
|
|
}
|
|
|
if (picNum == null){
|
|
|
+ log.error("照片数目为空。");
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED.code(),"照片数目为空。");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(mac)){
|
|
|
+ log.error("mac为空。");
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED.code(),"mac为空。");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(md5)){
|
|
|
+ log.error("md5为空。");
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED.code(),"md5为空。");
|
|
|
}
|
|
|
long size = file.getSize();
|
|
@@ -726,6 +733,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if(StringUtils.isEmpty(folderName)){
|
|
|
SceneFileBuild fileBuild = findByFileId(fileId);
|
|
|
if(ObjectUtils.isEmpty(fileBuild)){
|
|
|
+ log.error("数据不正常,fileBuild没找到");
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
|
|
|
}
|
|
|
folderName = fileBuild.getUnicode();
|
|
@@ -750,7 +758,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if (uploadEntity != null){
|
|
|
uploadEntity.setSize((int) size);
|
|
|
uploadEntity.setMd5(md5);
|
|
|
- uploadEntity.setFilePath(yunFilePath.toString());
|
|
|
+ uploadEntity.setFilePath(yunFilePath);
|
|
|
uploadEntity.setFileSourceName(fileName);
|
|
|
uploadEntity.setUploadStatus(1);
|
|
|
sceneFileUploadService.updateById(uploadEntity);
|
|
@@ -767,16 +775,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
result = ResultData.ok();
|
|
|
}else if (!md5.equals(fileMD5)) {
|
|
|
- log.info("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
|
|
|
+ log.error("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
|
|
|
FileUtils.delFile(yunFilePath.toString());
|
|
|
needUpload = true;
|
|
|
}else if (yunFile.length() != size){
|
|
|
- log.info("文件已上传,文件大小不一致。上传失败");
|
|
|
- FileUtils.delFile(yunFilePath.toString());
|
|
|
+ log.error("文件已上传,文件大小不一致。上传失败");
|
|
|
+ FileUtils.delFile(yunFilePath);
|
|
|
needUpload = true;
|
|
|
}
|
|
|
}else {
|
|
|
- log.info("文件不存在,需要重新上传");
|
|
|
+ log.error("文件不存在,需要重新上传");
|
|
|
needUpload = true;
|
|
|
}
|
|
|
|
|
@@ -803,18 +811,20 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
sceneFileUploadService.save(sceneFileUploadEntity);
|
|
|
result = ResultData.ok();
|
|
|
}else if (!md5.equals(fileMD5)) {
|
|
|
- log.info("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
|
|
|
+ log.error("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
|
|
|
sceneFileUploadEntity.setUploadStatus(-1);
|
|
|
sceneFileUploadService.save(sceneFileUploadEntity);
|
|
|
result = ResultData.error(ErrorCode.SYSTEM_ERROR,"上传失败, 请重新上传。");
|
|
|
}else if (uploadFile.length() != size){
|
|
|
- log.info("文件已上传,文件大小不一致。上传失败");
|
|
|
+ log.error("文件已上传,文件大小不一致。上传失败");
|
|
|
sceneFileUploadEntity.setUploadStatus(-1);
|
|
|
sceneFileUploadService.save(sceneFileUploadEntity);
|
|
|
result = ResultData.error(ErrorCode.SYSTEM_ERROR,"上传失败, 请重新上传。");
|
|
|
}
|
|
|
}
|
|
|
}catch (IllegalStateException | IOException e) {
|
|
|
+ log.error("上传失败, 请重新上传,md5:{},chunk:{}", md5, chunk);
|
|
|
+ log.error("上传失败", e);
|
|
|
result = ResultData.error(ErrorCode.SYSTEM_ERROR,"上传失败, 请重新上传。");
|
|
|
}
|
|
|
return result;
|