liusuyi
2026-06-01 a2e7e8ff9cfaa69b001d483710bddbda50d55c91
ard-modules/ard-modules-gb28181/src/main/java/com/ard/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
@@ -1,6 +1,5 @@
package com.ard.gb28181.transmit.event.request.impl.message.response.cmd;
import com.ard.common.core.utils.DateUtils;
import com.ard.gb28181.config.SipConfig;
import com.ard.gb28181.api.domain.Device;
import com.ard.gb28181.api.domain.DeviceChannel;
@@ -11,10 +10,6 @@
import com.ard.gb28181.transmit.event.request.impl.message.IMessageHandler;
import com.ard.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
import com.ard.gb28181.utils.Coordtransform;
import com.ard.qs.api.common.CivilCodePo;
import com.ard.qs.api.domain.QsGroup;
import com.ard.qs.api.domain.QsRegion;
import com.ard.qs.api.utils.CivilCodeUtil;
import gov.nist.javax.sip.message.SIPRequest;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.DocumentException;
@@ -117,14 +112,12 @@
                if (sumNum == 0) {
                    log.info("[收到通道]设备:{}的: 0个", take.getDevice().getDeviceId());
                    // 数据已经完整接收
                    deviceChannelService.cleanChannelsForDevice(take.getDevice().getId());
                    deviceChannelService.cleanChannelsForDevice(take.getDevice().getDeviceId());
                    return;
                } else {
                    Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
                    if (deviceListIterator != null) {
                        List<DeviceChannel> channelList = new ArrayList<>();
                        List<QsRegion> regionList = new ArrayList<>();
                        List<QsGroup> groupList = new ArrayList<>();
                        // 遍历DeviceList
                        while (deviceListIterator.hasNext()) {
                            Element itemDevice = deviceListIterator.next();
@@ -147,42 +140,15 @@
                            // 解析通道类型
                            if (channel.getDeviceId().length() <= 8) {
                                // 行政区划
                                QsRegion region = new QsRegion();
                                region.setName(channel.getName());
                                region.setDeviceId(channel.getDeviceId());
                                CivilCodePo parentCode = CivilCodeUtil.INSTANCE.getParentCode(channel.getDeviceId());
                                if (parentCode != null) {
                                    region.setParentDeviceId(parentCode.getCode());
                                }
                                region.setCreateTime(DateUtils.getNowDate());
                                region.setUpdateTime(DateUtils.getNowDate());
                                regionList.add(region);
                                channel.setChannelType(1);
                            } else if (channel.getDeviceId().length() == 20) {
                                // 业务分组/虚拟组织
                                GbCode gbCode = GbCode.decode(channel.getDeviceId());
                                if (gbCode == null || (!gbCode.getTypeCode().equals("215") && !gbCode.getTypeCode().equals("216"))) {
//                                    channelList.add(null);
                                }
                                QsGroup group = new QsGroup();
                                group.setName(channel.getName());
                                group.setDeviceId(channel.getDeviceId());
                                group.setCreateTime(DateUtils.getNowDate());
                                group.setUpdateTime(DateUtils.getNowDate());
                                if (gbCode.getTypeCode().equals("215")) {
                                    group.setBusinessGroup(channel.getDeviceId());
                                } else if (gbCode.getTypeCode().equals("216")) {
                                    group.setBusinessGroup(channel.getBusinessGroupId());
                                    group.setParentDeviceId(channel.getParentId());
                                }
                                if (group.getBusinessGroup() == null) {
//                                    channelList.add(null);
                                }
                                if (group != null) {
                                if (gbCode != null && ("215".equals(gbCode.getTypeCode()) || "216".equals(gbCode.getTypeCode()))) {
                                    // 业务分组/虚拟组织
                                    channel.setParental(1);
                                    channel.setChannelType(2);
                                    groupList.add(group);
                                }
                                // 坐标转换(所有20位编码通道,含普通摄像头和业务分组)
                                if (channel.getLongitude() != null && channel.getLatitude() != null && channel.getLongitude() > 0 && channel.getLatitude() > 0) {
                                    Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(channel.getLongitude(), channel.getLatitude());
                                    channel.setGbLongitude(wgs84Position[0]);