|
@@ -0,0 +1,94 @@
|
|
|
+package com.fdkankan.manage.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.fdkankan.manage.common.ResultCode;
|
|
|
+import com.fdkankan.manage.common.ResultData;
|
|
|
+import com.fdkankan.manage.entity.MqCameraLevel;
|
|
|
+import com.fdkankan.manage.entity.MqNumLevel;
|
|
|
+import com.fdkankan.manage.entity.MqQueueConfig;
|
|
|
+import com.fdkankan.manage.exception.BusinessException;
|
|
|
+import com.fdkankan.manage.service.IMqCameraLevelService;
|
|
|
+import com.fdkankan.manage.service.IMqNumLevelService;
|
|
|
+import com.fdkankan.manage.service.IMqQueueConfigService;
|
|
|
+import com.fdkankan.manage.vo.request.ModelingLevelParam;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2024-05-08
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/service/manage/mqQueueConfig")
|
|
|
+public class MqQueueConfigController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IMqQueueConfigService queueConfigService;
|
|
|
+
|
|
|
+ @PostMapping("/allList")
|
|
|
+ public ResultData allList(){
|
|
|
+ return ResultData.ok(queueConfigService.getNormalConfig());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IMqCameraLevelService mqCameraLevelService;
|
|
|
+ @Autowired
|
|
|
+ IMqNumLevelService mqNumLevelService;
|
|
|
+
|
|
|
+ @GetMapping("/getInfo")
|
|
|
+ public ResultData getInfo(@RequestParam(required = false) String num ,@RequestParam(required = false) Long cameraId){
|
|
|
+ if(StringUtils.isBlank(num) && cameraId == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(num)){
|
|
|
+ MqNumLevel byNum = mqNumLevelService.getByNum(num);
|
|
|
+ if(byNum != null){
|
|
|
+ return ResultData.ok(queueConfigService.getById(byNum.getQueueConfigId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(cameraId != null){
|
|
|
+ MqCameraLevel byCameraId = mqCameraLevelService.getByCameraId(cameraId);
|
|
|
+ if(byCameraId != null){
|
|
|
+ return ResultData.ok(queueConfigService.getById(byCameraId.getQueueConfigId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultData.ok(queueConfigService.getDefaultConfig());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改场景或相机计算优先级
|
|
|
+ */
|
|
|
+ @PostMapping("/updateModelingLevel")
|
|
|
+ public ResultData updateModelingLevel(@RequestBody ModelingLevelParam param){
|
|
|
+ if(param.getConfigId() == null && (param.getCameraId() == null || StringUtils.isBlank(param.getNum()))){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ if(param.getCameraId() != null){
|
|
|
+ MqCameraLevel cameraLevel = mqCameraLevelService.getByCameraId(param.getCameraId());
|
|
|
+ if(cameraLevel == null){
|
|
|
+ mqCameraLevelService.saveEntity(param.getCameraId(),param.getConfigId());
|
|
|
+ }else {
|
|
|
+ mqCameraLevelService.updateLevelById(cameraLevel.getId(),param.getConfigId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getNum())){
|
|
|
+ MqNumLevel mqNumLevel = mqNumLevelService.getByNum(param.getNum());
|
|
|
+ if(mqNumLevel == null){
|
|
|
+ mqNumLevelService.saveEntity(param.getNum(),param.getConfigId());
|
|
|
+ }else {
|
|
|
+ mqNumLevelService.updateLevelById(mqNumLevel.getId(),param.getConfigId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|