Преглед на файлове

相机上传文件路径拼错

dengsixing преди 2 години
родител
ревизия
a14aa3092a
променени са 1 файла, в които са добавени 10 реда и са изтрити 10 реда
  1. 10 10
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

+ 10 - 10
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -393,7 +393,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         byte[] res = RSAEncrypt.decrypt(RSAEncrypt.loadPrivateKeyByStr(RSAEncrypt.loadPrivateKeyByFile()),
                 base64.decode(cipher));
         String restr = new String(res, "UTF-8");
-        log.info("uploadSuccessBuild-params解密结果:" + restr);
+        log.info("turntableUploadSuccess-params:解密结果:" + restr);
         String[] strArr = restr.split(SPLICE);
         if (strArr.length != 3) {
             throw new BusinessException(ErrorCode.PARAM_REQUIRED);
@@ -745,7 +745,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         if (yunFile.exists()){
             String fileMD5 = FileMd5Util.getFileMD5(yunFile);
             if (md5.equals(fileMD5) && yunFile.length() == size){
-                log.warn("文件已存在,MD5和文件大小一致。");
+                log.info("文件已存在,MD5和文件大小一致。");
                 SceneFileUpload uploadEntity = sceneFileUploadService.findByFileIdAndChunk(fileId, Integer.valueOf(chunk));
                 if (uploadEntity != null){
                     uploadEntity.setSize((int) size);
@@ -767,16 +767,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 }
                 result = ResultData.ok();
             }else if (!md5.equals(fileMD5)) {
-                log.warn("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
+                log.info("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
                 FileUtils.delFile(yunFilePath.toString());
                 needUpload = true;
             }else if (yunFile.length() != size){
-                log.warn("文件已上传,文件大小不一致。上传失败");
+                log.info("文件已上传,文件大小不一致。上传失败");
                 FileUtils.delFile(yunFilePath.toString());
                 needUpload = true;
             }
         }else {
-            log.warn("文件不存在,需要重新上传");
+            log.info("文件不存在,需要重新上传");
             needUpload = true;
         }
 
@@ -784,31 +784,31 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         // 5. 如果相等,更新数据记录。如果不相等,返回上传失败结果。
         try {
             if (needUpload){
-                fYunFileService.uploadFile(file.getInputStream(),ConstantFilePath.OSS_PREFIX.concat(filePath).concat(fileName));
+                fYunFileService.uploadFile(file.getInputStream(),ConstantFilePath.OSS_PREFIX.concat(filePath).concat(File.separator).concat(fileName));
                 File uploadFile = new File(yunFilePath);
                 String fileMD5 = FileMd5Util.getFileMD5(uploadFile);
 
                 SceneFileUpload sceneFileUploadEntity = new SceneFileUpload();
                 sceneFileUploadEntity.setSize((int) size);
                 sceneFileUploadEntity.setMd5(md5);
-                sceneFileUploadEntity.setFilePath(yunFilePath.toString());
+                sceneFileUploadEntity.setFilePath(yunFilePath);
                 sceneFileUploadEntity.setFileSourceName(fileName);
                 sceneFileUploadEntity.setFileId(fileId);
                 sceneFileUploadEntity.setChunk(Integer.valueOf(chunk));
 
                 if (md5.equals(fileMD5) && uploadFile.length() == size){
-                    log.warn("文件已上传,MD5和文件大小一致。上传成功");
+                    log.info("文件已上传,MD5和文件大小一致。上传成功");
 
                     sceneFileUploadEntity.setUploadStatus(1);
                     sceneFileUploadService.save(sceneFileUploadEntity);
                     result = ResultData.ok();
                 }else if (!md5.equals(fileMD5)) {
-                    log.warn("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
+                    log.info("文件已上传,上传MD5:"+md5+",服务器MD5:"+fileMD5+"。不一致。上传失败");
                     sceneFileUploadEntity.setUploadStatus(-1);
                     sceneFileUploadService.save(sceneFileUploadEntity);
                     result = ResultData.error(ErrorCode.SYSTEM_ERROR,"上传失败, 请重新上传。");
                 }else if (uploadFile.length() != size){
-                    log.warn("文件已上传,文件大小不一致。上传失败");
+                    log.info("文件已上传,文件大小不一致。上传失败");
                     sceneFileUploadEntity.setUploadStatus(-1);
                     sceneFileUploadService.save(sceneFileUploadEntity);
                     result = ResultData.error(ErrorCode.SYSTEM_ERROR,"上传失败, 请重新上传。");