dengsixing 5 months ago
parent
commit
8b85bfc498

+ 3 - 2
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -112,8 +112,9 @@ public class SceneEditController extends BaseController {
     public ResultData uploadTagImg(@RequestParam(value = "num") String num,
                                    MultipartFile file,
                                    @RequestParam(value = "sid") String sid,
-                                   @RequestParam(value = "size", defaultValue = "320") Integer size) throws Exception {
-        return sceneProService.uploadTagImg(num, file, sid, size);
+                                   @RequestParam(value = "size", defaultValue = "320") Integer size,
+                                   @RequestParam(value = "tileSize", defaultValue = "511") Integer tileSize) throws Exception {
+        return sceneProService.uploadTagImg(num, file, sid, size, tileSize);
     }
 
     /**

+ 1 - 1
src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -34,7 +34,7 @@ public interface ISceneProService extends IService<ScenePro> {
 
     ResultData addOrUpdateTag(SaveTagsParamVO param) throws Exception;
 
-    ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size) throws Exception;
+    ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size, Integer tileSize) throws Exception;
 
     ResultData deleteTag(DeleteHotParamVO param) throws Exception;
 

+ 3 - 13
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -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);
     }
 
@@ -637,16 +637,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 });
             }
 
-            /* v4.12版本之前是这种方式
-            "media": {
-                "image": [
-                {
-                    "src": "FfRdi413774.jpg"
-                }
-		    ]
-            },
-            "type": "image"
-             */
             if("image".equals(type) || "audio".equals(type) || "video".equals(type)){
                 //删除图片、视频
                 JSONObject media = jsonObject.getJSONObject("media");