优化CivilCode缓存

This commit is contained in:
648540858
2024-03-14 14:54:20 +08:00
parent e1c8183adf
commit d4f6ec39b7
5 changed files with 63 additions and 38 deletions

View File

@@ -108,7 +108,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
}else {
event = eventElement.getText().toUpperCase();
}
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf);
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event);
if (channel == null) {
logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;

View File

@@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
@@ -57,9 +56,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Autowired
private CivilCodeFileConf civilCodeFileConf;
@Autowired
private SipConfig sipConfig;
private AtomicBoolean processing = new AtomicBoolean(false);
@@ -118,7 +114,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
if (channelDeviceElement == null) {
continue;
}
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, null, civilCodeFileConf);
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, null);
if (channel == null) {
logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;

View File

@@ -3,10 +3,10 @@ package com.genersoft.iot.vmp.gb28181.utils;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.CivilCodePo;
import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
import com.genersoft.iot.vmp.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@@ -240,7 +240,7 @@ public class XmlUtil {
CivilCode, BusinessGroup,VirtualOrganization,Other
}
public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event, CivilCodeFileConf civilCodeFileConf){
public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event){
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setDeviceId(device.getDeviceId());
Element channdelIdElement = itemDevice.element("DeviceID");
@@ -267,7 +267,7 @@ public class XmlUtil {
}
if(channelId.length() <= 8) {
deviceChannel.setHasAudio(false);
CivilCodePo parentCode = civilCodeFileConf.getParentCode(channelId);
CivilCodePo parentCode = CivilCodeUtil.INSTANCE.getParentCode(channelId);
if (parentCode != null) {
deviceChannel.setParentId(parentCode.getCode());
deviceChannel.setCivilCode(parentCode.getCode());