|
@@ -164,7 +164,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size) throws Exception {
|
|
|
+ public ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size, Integer tileSize) throws Exception {
|
|
|
String extName = FileUtil.extName(file.getOriginalFilename());
|
|
|
String fragmentPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "hot_img_fragment/";
|
|
|
String workPath = fragmentPath + sid;
|
|
@@ -185,7 +185,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
uploadMap.put(origFilePath, ossPath + sid + "." + extName);
|
|
|
|
|
|
//切图
|
|
|
- String fragmentCmd = "vips dzsave --tile-size 511 " + origFilePath + " " + workPath;
|
|
|
+ String fragmentCmd = "vips dzsave --tile-size " + tileSize + " " + origFilePath + " " + workPath;
|
|
|
CmdUtils.callLine(fragmentCmd);
|
|
|
if(!ComputerUtil.checkComputeCompleted(dziPath, 5, 200)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5052);
|
|
@@ -230,7 +230,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
hw.put("height",height);
|
|
|
hw.put("width",width);
|
|
|
hw.put("sid",sid);
|
|
|
- hw.put("tileSize",511);
|
|
|
+ hw.put("tileSize",tileSize);
|
|
|
return ResultData.ok(hw);
|
|
|
}
|
|
|
|
|
@@ -607,6 +607,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
//删除图片音频视频等资源文件
|
|
|
List<String> deleteFileList = new ArrayList<>();
|
|
|
+ List<String> deleteKeys = new ArrayList<>();
|
|
|
for (String data : hotdataList) {
|
|
|
if(StrUtil.isBlank(data)){
|
|
|
continue;
|
|
@@ -630,23 +631,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
JSONArray media = jsonObject.getJSONArray("media");
|
|
|
media.stream().forEach(v->{
|
|
|
JSONObject o = (JSONObject) v;
|
|
|
- String src = o.getString("src");
|
|
|
- if(StrUtil.isNotEmpty(src)){
|
|
|
- deleteFileList.add(src);
|
|
|
+ String fileSid = o.getString("sid");
|
|
|
+ if(o.containsKey("tileSize")){//4.14.0版本,图片类型热点不调用通用上传接口上传,改为切图接口上传,所以这里直接删除整个文件目录
|
|
|
+ String ossPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "hotspot/" + fileSid + "/";
|
|
|
+ deleteKeys.add(ossPath);
|
|
|
+ }else{
|
|
|
+ String src = o.getString("src");
|
|
|
+ if(StrUtil.isNotEmpty(src)){
|
|
|
+ deleteFileList.add(src);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- /* v4.12版本之前是这种方式
|
|
|
- "media": {
|
|
|
- "image": [
|
|
|
- {
|
|
|
- "src": "FfRdi413774.jpg"
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- "type": "image"
|
|
|
- */
|
|
|
if("image".equals(type) || "audio".equals(type) || "video".equals(type)){
|
|
|
//删除图片、视频
|
|
|
JSONObject media = jsonObject.getJSONObject("media");
|
|
@@ -661,14 +659,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(CollUtil.isEmpty(deleteFileList)){
|
|
|
- return;
|
|
|
+ if(CollUtil.isNotEmpty(deleteFileList)){
|
|
|
+ sceneUploadService.delete(
|
|
|
+ DeleteFileParamVO.builder()
|
|
|
+ .num(num)
|
|
|
+ .fileNames(deleteFileList)
|
|
|
+ .bizType("tag-media").build());
|
|
|
}
|
|
|
- sceneUploadService.delete(
|
|
|
- DeleteFileParamVO.builder()
|
|
|
- .num(num)
|
|
|
- .fileNames(deleteFileList)
|
|
|
- .bizType("tag-media").build());
|
|
|
+ if(CollUtil.isNotEmpty(deleteKeys)){
|
|
|
+ deleteKeys.stream().forEach(key->{
|
|
|
+ fYunFileService.deleteFolder(key);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|