Selaa lähdekoodia

增加全景图识别推理队列

xiewj 2 vuotta sitten
vanhempi
commit
34ed92fead

+ 15 - 3
src/main/java/com/fdkankan/scene/controller/SceneMarkShapeController.java

@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import com.fdkankan.scene.entity.SceneMarkShape;
 import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.entity.ScenePlusExt;
@@ -24,7 +25,9 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -37,7 +40,8 @@ import java.util.stream.Collectors;
 @RequestMapping("/service/scene/sceneMarkShape")
 public class SceneMarkShapeController extends BaseController
 {
-
+    @Value("${queue.scene.yolov5-detect-queue}")
+    private String yolov5DetectQueue;
     @Autowired
     private ISceneMarkShapeService sceneMarkShapeService;
     @Resource
@@ -48,7 +52,8 @@ public class SceneMarkShapeController extends BaseController
     private IScenePlusExtService scenePlusExtService;
     @Value("${fyun.host}")
     private String ossUrlPrefix;
-
+    @Autowired
+    private RabbitMqProducer rabbitMqProducer;
     /**
      * 获取场景全景图路径连接
      */
@@ -74,7 +79,14 @@ public class SceneMarkShapeController extends BaseController
         SceneMarkShape res=  sceneMarkShapeService.findByNumAndImagePath(param.getNum(),param.getImagePath());
         return ResultData.ok(res);
     }
-
+    /**
+     * 将需要推理的场景推入到队列
+     */
+    @PostMapping("/detectScene")
+    public ResultData detect(@RequestBody @Validated  SceneMarkShapeParamVO param) {
+        rabbitMqProducer.sendByWorkQueue(yolov5DetectQueue, param);
+        return ResultData.ok();
+    }
     /**
      * 保存或者修改
      */