liusuyi
2025-10-20 dea4343d9f92a44e45eaeaab0afad6ede9ae5bb9
优化日志打印
4 files modified
18 ■■■■■ changed files
ard-admin/src/main/java/com/ard/web/controller/work/UavBaseController.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/component/forest/MyAddressSource.java 10 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/component/websocket/handler/BaseSubscriptionManager.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java 4 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/work/UavBaseController.java
@@ -72,7 +72,7 @@
    @ApiOperation("获取直播地址")
    @ApiOperationSupport(order = 6)
    @GetMapping("/getBoxList/{boxSn}")
    @GetMapping("/getBoxLiveUrl/{boxSn}")
    public AjaxResult getBoxLiveUrl(@PathVariable("boxSn") String boxSn) {
        BoxStreamUrlReceiver boxLiveUrl = tyService.getBoxLiveUrl(boxSn);
        return AjaxResult.success(boxLiveUrl);
ard-work/src/main/java/com/ard/work/component/forest/MyAddressSource.java
@@ -5,10 +5,12 @@
import com.dtflys.forest.callback.AddressSource;
import com.dtflys.forest.http.ForestAddress;
import com.dtflys.forest.http.ForestRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class MyAddressSource implements AddressSource {
@@ -17,7 +19,15 @@
    @Override
    public ForestAddress getAddress(ForestRequest request) {
        String serverKey = request.varAsString("serverId");
        if(serverKey == null){
            log.warn("请求属性serverId为空");
            return null;
        }
        ArdServerInfo serverInfo = ardServerService.selectArdServerInfoById(serverKey);
        if(serverInfo == null){
            log.warn("边缘服务器不存在");
            return null;
        }
        // 返回 Forest 地址对象
        return new ForestAddress(serverInfo.getHost(), serverInfo.getHttpPort());
    }
ard-work/src/main/java/com/ard/work/component/websocket/handler/BaseSubscriptionManager.java
@@ -90,7 +90,7 @@
        if (userIds != null) {
            for (Long userId : userIds) {
                try {
                    log.warn("给用户{}定时推送",userId);
                    log.debug("给用户{}定时推送",userId);
                    WebSocketUtil.sendMessage(userId, JSON.toJSONString(baseMessage));
                } catch (Exception e) {
                    log.error("Error sending message to session {}", userId, e);
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -111,6 +111,10 @@
    @Override
    public BoxStreamUrlReceiver getBoxLiveUrl(String boxSn) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSn);
        if(ardDroneInfo== null){
            log.warn("未找到对应的飞行器信息,boxSn:{}",boxSn);
            return null;
        }
        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerId(),boxSn);
        return boxLiveUrl.getContent();
    }