瀏覽代碼

人体分割抠图

dsx 2 年之前
父節點
當前提交
698fcec8f4

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

@@ -87,9 +87,8 @@ public class SceneController extends BaseController {
      * @throws Exception
      */
     @PostMapping(value = "/uploadBodySegment")
-    public ResultData uploadBodySegment(@RequestParam(value = "num") String num,
-                                     @RequestParam("file") MultipartFile file) throws Exception {
-        return sceneService.uploadBodySegment(num, file);
+    public ResultData uploadBodySegment(@RequestParam("file") MultipartFile file) throws Exception {
+        return sceneService.uploadBodySegment(file);
     }
 
     /**

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

@@ -7,7 +7,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 public interface ISceneService {
 
-    ResultData uploadBodySegment(String num, MultipartFile file) throws Exception;
+    ResultData uploadBodySegment(MultipartFile file) throws Exception;
 
     void bodySegmentHandler(String imgUrl, String uuid);
 

+ 5 - 2
src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java

@@ -38,6 +38,8 @@ public class SceneServiceImpl implements ISceneService {
 
     @Value("${queue.bodySegment:body-segment}")
     private String queueName;
+    @Value("${oss.bodySegment.bucket:4dkankan-huadong}")
+    private String bodySegmentBucket;
 
     @Autowired
     private OssBodySegmentUtil ossBodySegmentUtil;
@@ -51,7 +53,7 @@ public class SceneServiceImpl implements ISceneService {
     public FYunFileConfig fYunFileConfig;
 
     @Override
-    public ResultData uploadBodySegment(String num, MultipartFile file) throws Exception {
+    public ResultData uploadBodySegment(MultipartFile file) throws Exception {
 
         if(!FileUtils.checkFileSizeIsLimit(file.getSize(), 3, "M")){
             throw new BusinessException(ErrorCode.FAILURE_CODE_4003, "3M");
@@ -65,7 +67,8 @@ public class SceneServiceImpl implements ISceneService {
         file.transferTo(tempFile);
 
         String orgImgOssPath = "body_segment/original/" + tempFile.getName();
-        ossBodySegmentUtil.uploadOss(tempFile.getPath(), orgImgOssPath);
+//        ossBodySegmentUtil.uploadOss(tempFile.getPath(), orgImgOssPath);
+        fYunFileService.uploadFile(bodySegmentBucket, tempFile.getPath(), orgImgOssPath);
 
         BodySegmentStatusBean bodySegmentStatusBean = BodySegmentStatusBean.builder().uuid(uuid).status(CommonOperStatus.WAITING.code()).build();
         redisUtil.hset(RedisKey.SCENE_BODY_SEGMENT, uuid, JSON.toJSONString(bodySegmentStatusBean));