|
@@ -2,8 +2,10 @@ package com.fdkankan.contro.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.core.util.ZipUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -21,6 +23,7 @@ import com.fdkankan.contro.service.*;
|
|
|
import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.image.MatrixToImageWriterUtil;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
@@ -170,9 +173,17 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
|
|
|
|
- // dam 文件设置请求头
|
|
|
- newUploadFiles.entrySet().stream().filter(entry-> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
- .forEach(entry-> fYunFileService.uploadFile(entry.getKey(),entry.getValue(),damFileHeaders));
|
|
|
+ if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
+ // dam 文件设置请求头
|
|
|
+ newUploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
+ .forEach(entry -> {
|
|
|
+ // gzip压缩
|
|
|
+ FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
+ // 重命名
|
|
|
+ FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
+ fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
+ });
|
|
|
+ }
|
|
|
// TODO: 2022/3/11 同时上传一份到旧版本的目录,用于过渡期使用,待重构版本稳定后删除
|
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
|
|