|
@@ -11,6 +11,7 @@ import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.RecStatus;
|
|
|
import com.fdkankan.common.constant.ServerCode;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
@@ -137,8 +138,9 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
// 获取文件后缀
|
|
|
String prefix = fileName.substring(fileName.lastIndexOf("."));
|
|
|
- File newFile = File.createTempFile(UUID.randomUUID().toString() ,prefix);
|
|
|
- file.transferTo(newFile);
|
|
|
+ String path = String.format(ConstantFilePath.SCENE_TMP_PATH_V4, num).concat(UUID.randomUUID().toString()).concat(prefix);
|
|
|
+// File newFile = File.createTempFile(UUID.randomUUID().toString() ,prefix);
|
|
|
+ file.transferTo(new File(path));
|
|
|
String realFileName = fileName;
|
|
|
if(files.size() ==1 && StringUtils.isNotBlank(sendFileName)){
|
|
|
realFileName = sendFileName ;
|
|
@@ -151,7 +153,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
|
String ossPath = StrUtil.isNotBlank(uploadPath) ? uploadPath : (String.format(UploadFilePath.USER_EDIT_PATH ,num) + realFileName);
|
|
|
try {
|
|
|
TimeInterval timer = DateUtil.timer();
|
|
|
- fYunFileService.uploadFile(bucket, newFile.getPath(), ossPath);
|
|
|
+ fYunFileService.uploadFile(bucket, path, ossPath);
|
|
|
System.out.println(timer.intervalRestart());
|
|
|
}catch (Exception e){
|
|
|
log.error(ossPath+"上传文件失败"+e);
|
|
@@ -160,7 +162,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
|
|
|
|
urlList.add(realFileName);
|
|
|
|
|
|
- FileUtils.delFile(newFile.getPath());
|
|
|
+ FileUtils.delFile(path);
|
|
|
//添加记录
|
|
|
this.saveData(num,ossPath,bizType,userId);
|
|
|
}
|