浏览代码

1.添加根据设备主键ID查询设备对应的客户端ID接口 支持语音通话

hxd 2 月之前
父节点
当前提交
fb0e4d35c7

+ 6 - 0
portal-service-application/src/main/java/com/hfln/portal/application/controller/pub/PubController.java

@@ -45,4 +45,10 @@ public class PubController {
         pubGateway.updateOTA(params);
         return ApiResult.success();
     }
+
+    @GetMapping("/queryClientIdByDevId")
+    @Operation(summary = "根据设备主键ID查询设备对应的客户端ID")
+    public ApiResult<String> queryClientIdByDeviD(@RequestParam Long devId) {
+        return ApiResult.success(pubGateway.queryClientIdByDeviD(devId));
+    }
 }

+ 2 - 0
portal-service-domain/src/main/java/com/hfln/portal/domain/gateway/PubGateway.java

@@ -17,6 +17,8 @@ public interface PubGateway {
 
     void updateOTA(UpdateOTAParams params);
 
+    String queryClientIdByDeviD(Long devId);
+
 
 }
 

+ 14 - 0
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/gateway/impl/PubGatewayImpl.java

@@ -10,7 +10,9 @@ import com.hfln.portal.domain.customer.util.CopyUtils;
 import com.hfln.portal.domain.exception.ErrorEnum;
 import com.hfln.portal.domain.gateway.PubGateway;
 import com.hfln.portal.infrastructure.mqtt.MqttClient;
+import com.hfln.portal.infrastructure.po.DevInfo;
 import com.hfln.portal.infrastructure.po.TblOssFile;
+import com.hfln.portal.infrastructure.service.DevInfoService;
 import com.hfln.portal.infrastructure.service.OssFileService;
 import com.hfln.portal.infrastructure.service.TblDicItemService;
 import lombok.extern.slf4j.Slf4j;
@@ -36,6 +38,9 @@ public class PubGatewayImpl implements PubGateway {
     @Autowired
     private MqttClient mqttClient;
 
+    @Autowired
+    private DevInfoService devInfoService;
+
 
     @Override
     public List<DicItemDto> query(String dicType) {
@@ -91,5 +96,14 @@ public class PubGatewayImpl implements PubGateway {
         log.info("批量OTA升级操作完成,共处理{}个设备", params.getClientIds().size());
     }
 
+
+    @Override
+    public String queryClientIdByDeviD(Long devId) {
+        DevInfo devInfo = devInfoService.getById(devId);
+        if (devInfo == null) {
+            throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
+        }
+        return devInfo.getClientId();
+    }
 }