瀏覽代碼

临时提交

648540858 1 年之前
父節點
當前提交
5a259aaa63

+ 4 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java

@@ -262,7 +262,10 @@ public interface CommonGBChannelMapper {
 
     @Select("<script>" +
             " select " +
-            "    *, " +
+            "    id," +
+            "    coalesce(gb_device_id, device_id) as device_id," +
+            "    coalesce(gb_name, name) as name, " +
+            "    coalesce(gb_parent_id, parent_id) as parent_device_id, " +
             "    1 as type, " +
             "    true as is_leaf " +
             " from wvp_device_channel " +

+ 11 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java

@@ -1,6 +1,7 @@
 package com.genersoft.iot.vmp.gb28181.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
+import com.genersoft.iot.vmp.gb28181.bean.Group;
 import com.genersoft.iot.vmp.gb28181.bean.Region;
 import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
 import org.apache.ibatis.annotations.*;
@@ -104,4 +105,14 @@ public interface RegionMapper {
             " </script>")
     List<CommonGBChannel> queryByPlatform(@Param("platformId") Integer platformId);
 
+
+    @Update(" <script>" +
+            " update wvp_common_region w1 " +
+            " inner join (select * from wvp_common_region ) w2 on w1.parent_device_id = w2.device_id " +
+            " set w1.parent_id = w2.id" +
+            " where w1.id in " +
+            " <foreach collection='regionListForAdd'  item='item'  open='(' separator=',' close=')' > #{item.id}</foreach>" +
+            " </script>")
+    void updateParentId(List<Region> regionListForAdd);
+
 }

+ 6 - 8
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java

@@ -511,10 +511,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                     if (i + limitCount > addChannels.size()) {
                         toIndex = addChannels.size();
                     }
-                    result = result || channelMapper.batchAdd(addChannels.subList(i, toIndex)) < 0;
+                    result = result || channelMapper.batchAdd(addChannels.subList(i, toIndex)) > 0;
                 }
             }else {
-                result = result || channelMapper.batchAdd(addChannels) < 0;
+                result = channelMapper.batchAdd(addChannels) > 0;
             }
         }
         if (!result && !updateChannels.isEmpty()) {
@@ -524,14 +524,13 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                     if (i + limitCount > updateChannels.size()) {
                         toIndex = updateChannels.size();
                     }
-                    result = result || channelMapper.batchUpdate(updateChannels.subList(i, toIndex)) < 0;
+                    result = result || channelMapper.batchUpdate(updateChannels.subList(i, toIndex)) > 0;
                 }
             }else {
-                result = result || channelMapper.batchUpdate(updateChannels) < 0;
+                result = channelMapper.batchUpdate(updateChannels) > 0;
             }
         }
         if (!result && !deleteChannels.isEmpty()) {
-            System.out.println("删除: " + deleteChannels.size());
             if (deleteChannels.size() > limitCount) {
                 for (int i = 0; i < deleteChannels.size(); i += limitCount) {
                     int toIndex = i + limitCount;
@@ -541,11 +540,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                     result = result || channelMapper.batchDel(deleteChannels.subList(i, toIndex)) < 0;
                 }
             }else {
-                result = result || channelMapper.batchDel(deleteChannels) < 0;
+                result = channelMapper.batchDel(deleteChannels) < 0;
             }
         }
-
-        return true;
+        return result;
 
     }
 

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java

@@ -640,7 +640,6 @@ public class PlatformServiceImpl implements IPlatformService {
         inviteInfo.setStatus(InviteSessionStatus.ok);
         ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
         String contentString = new String(responseEvent.getResponse().getRawContent());
-        System.out.println(contentString);
         String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString);
         // 兼容回复的消息中缺少ssrc(y字段)的情况
         if (ssrcInResponse == null) {

+ 8 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/RegionServiceImpl.java

@@ -175,6 +175,7 @@ public class RegionServiceImpl implements IRegionService {
     }
 
     @Override
+    @Transactional
     public boolean batchAdd(List<Region> regionList) {
         if (regionList== null || regionList.isEmpty()) {
             return false;
@@ -190,7 +191,12 @@ public class RegionServiceImpl implements IRegionService {
                 regionMapForVerification.remove(region.getDeviceId());
             }
         }
-        regionMapper.batchAdd(new ArrayList<>(regionMapForVerification.values()));
-        return false;
+        if (!regionMapForVerification.isEmpty()) {
+            List<Region> regions = new ArrayList<>(regionMapForVerification.values());
+            regionMapper.batchAdd(regions);
+            regionMapper.updateParentId(regions);
+        }
+
+        return true;
     }
 }

+ 1 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java

@@ -74,7 +74,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
     @Transactional
     public void handForDevice(RequestEvent evt, Device device, Element element) {
         taskQueue.offer(new HandlerCatchData(evt, device, element));
-        System.out.println(evt.getRequest());
         // 回复200 OK
         try {
             responseAck((SIPRequest) evt.getRequest(), Response.OK);
@@ -187,7 +186,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
 
         List<Region> regionList = catalogDataCatch.getRegionList(device.getDeviceId());
         if ( regionList!= null && !regionList.isEmpty()) {
-            result &= regionService.batchAdd(catalogDataCatch.getRegionList(device.getDeviceId()));
+            result &= regionService.batchAdd(regionList);
         }
 
         List<Group> groupList = catalogDataCatch.getGroupList(device.getDeviceId());

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java

@@ -227,7 +227,6 @@ public class ZLMServerFactory {
         if (sendRtpItem.getLocalPort() != 0) {
             if (sendRtpItem.isTcpActive()) {
                 startSendRtpStreamResult = startSendRtpPassive(mediaInfo, param);
-                System.out.println(JSON.toJSON(param));
             }else {
                 param.put("is_udp", is_Udp);
                 param.put("dst_url", sendRtpItem.getIp());

+ 91 - 87
src/main/resources/civilCode.csv

@@ -1,38 +1,40 @@
 编号,名称,上级
 11,北京市, 
-110101,东城区,11
-110102,西城区,11
-110105,朝阳区,11
-110106,丰台区,11
-110107,石景山区,11
-110108,海淀区,11
-110109,门头沟区,11
-110111,房山区,11
-110112,通州区,11
-110113,顺义区,11
-110114,昌平区,11
-110115,大兴区,11
-110116,怀柔区,11
-110117,平谷区,11
-110118,密云区,11
-110119,延庆区,11
+1101,市辖区,11
+110101,东城区,1101
+110102,西城区,1101
+110105,朝阳区,1101
+110106,丰台区,1101
+110107,石景山区,1101
+110108,海淀区,1101
+110109,门头沟区,1101
+110111,房山区,1101
+110112,通州区,1101
+110113,顺义区,1101
+110114,昌平区,1101
+110115,大兴区,1101
+110116,怀柔区,1101
+110117,平谷区,1101
+110118,密云区,1101
+110119,延庆区,1101
 12,天津市, 
-120101,和平区,12
-120102,河东区,12
-120103,河西区,12
-120104,南开区,12
-120105,河北区,12
-120106,红桥区,12
-120110,东丽区,12
-120111,西青区,12
-120112,津南区,12
-120113,北辰区,12
-120114,武清区,12
-120115,宝坻区,12
-120116,滨海新区,12
-120117,宁河区,12
-120118,静海区,12
-120119,蓟州区,12
+1201,市辖区,12
+120101,和平区,1201
+120102,河东区,1201
+120103,河西区,1201
+120104,南开区,1201
+120105,河北区,1201
+120106,红桥区,1201
+120110,东丽区,1201
+120111,西青区,1201
+120112,津南区,1201
+120113,北辰区,1201
+120114,武清区,1201
+120115,宝坻区,1201
+120116,滨海新区,1201
+120117,宁河区,1201
+120118,静海区,1201
+120119,蓟州区,1201
 13,河北省, 
 1301,石家庄市,13
 130102,长安区,1301
@@ -786,22 +788,23 @@
 232721,呼玛县,2327
 232722,塔河县,2327
 31,上海市, 
-310101,黄浦区,31
-310104,徐汇区,31
-310105,长宁区,31
-310106,静安区,31
-310107,普陀区,31
-310109,虹口区,31
-310110,杨浦区,31
-310112,闵行区,31
-310113,宝山区,31
-310114,嘉定区,31
-310115,浦东新区,31
-310116,金山区,31
-310117,松江区,31
-310118,青浦区,31
-310120,奉贤区,31
-310151,崇明区,31
+3101,市辖区,31
+310101,黄浦区,3101
+310104,徐汇区,3101
+310105,长宁区,3101
+310106,静安区,3101
+310107,普陀区,3101
+310109,虹口区,3101
+310110,杨浦区,3101
+310112,闵行区,3101
+310113,宝山区,3101
+310114,嘉定区,3101
+310115,浦东新区,3101
+310116,金山区,3101
+310117,松江区,3101
+310118,青浦区,3101
+310120,奉贤区,3101
+310151,崇明区,3101
 32,江苏省, 
 3201,南京市,32
 320102,玄武区,3201
@@ -2226,44 +2229,45 @@
 469029,保亭黎族苗族自治县,46
 469030,琼中黎族苗族自治县,46
 50,重庆市, 
-500101,万州区,50
-500102,涪陵区,50
-500103,渝中区,50
-500104,大渡口区,50
-500105,江北区,50
-500106,沙坪坝区,50
-500107,九龙坡区,50
-500108,南岸区,50
-500109,北碚区,50
-500110,綦江区,50
-500111,大足区,50
-500112,渝北区,50
-500113,巴南区,50
-500114,黔江区,50
-500115,长寿区,50
-500116,江津区,50
-500117,合川区,50
-500118,永川区,50
-500119,南川区,50
-500120,璧山区,50
-500151,铜梁区,50
-500152,潼南区,50
-500153,荣昌区,50
-500154,开州区,50
-500155,梁平区,50
-500156,武隆区,50
-500229,城口县,50
-500230,丰都县,50
-500231,垫江县,50
-500233,忠县,50
-500235,云阳县,50
-500236,奉节县,50
-500237,巫山县,50
-500238,巫溪县,50
-500240,石柱土家族自治县,50
-500241,秀山土家族苗族自治县,50
-500242,酉阳土家族苗族自治县,50
-500243,彭水苗族土家族自治县,50
+5001,市辖区,50
+500101,万州区,5001
+500102,涪陵区,5001
+500103,渝中区,5001
+500104,大渡口区,5001
+500105,江北区,5001
+500106,沙坪坝区,5001
+500107,九龙坡区,5001
+500108,南岸区,5001
+500109,北碚区,5001
+500110,綦江区,5001
+500111,大足区,5001
+500112,渝北区,5001
+500113,巴南区,5001
+500114,黔江区,5001
+500115,长寿区,5001
+500116,江津区,5001
+500117,合川区,5001
+500118,永川区,5001
+500119,南川区,5001
+500120,璧山区,5001
+500151,铜梁区,5001
+500152,潼南区,5001
+500153,荣昌区,5001
+500154,开州区,5001
+500155,梁平区,5001
+500156,武隆区,5001
+500229,城口县,5001
+500230,丰都县,5001
+500231,垫江县,5001
+500233,忠县,5001
+500235,云阳县,5001
+500236,奉节县,5001
+500237,巫山县,5001
+500238,巫溪县,5001
+500240,石柱土家族自治县,5001
+500241,秀山土家族苗族自治县,5001
+500242,酉阳土家族苗族自治县,5001
+500243,彭水苗族土家族自治县,5001
 51,四川省, 
 5101,成都市,51
 510104,锦江区,5101
@@ -3217,4 +3221,4 @@
 659009,昆玉市,65
 71,台湾省, 
 81,香港特别行政区, 
-82,澳门特别行政区, 
+82,澳门特别行政区, 

+ 1 - 46
web_src/src/components/dialog/channelCode.vue

@@ -224,54 +224,9 @@ export default {
         let parent = ''
         if (this.activeKey === '1') {
           parent = this.allVal[0].val
-          if (parent === '11' || parent === '12' || parent === '31') {
-            this.regionList = []
-            this.regionList.push({
-              // 数据库自增ID
-              commonRegionId: -1,
-              // 区域国标编号
-              deviceId: parent + '01',
-              // 区域名称
-              name: '市辖区',
-              // 父区域国标ID
-              commonRegionParentId: parent,
-            })
-            console.log(this.regionList)
-            return
-          } else if (parent === '50') {
-            this.regionList = [
-              {
-                // 数据库自增ID
-                commonRegionId: -1,
-                // 区域国标编号
-                deviceId: parent + '01',
-                // 区域名称
-                name: '市辖区',
-                // 父区域国标ID
-                commonRegionParentId: parent,
-              },
-              {
-                // 数据库自增ID
-                commonRegionId: -1,
-                // 区域国标编号
-                deviceId: parent + '02',
-                // 区域名称
-                name: '县',
-                // 父区域国标ID
-                commonRegionParentId: parent,
-              },
-            ]
-            return
-          }
         }
         if (this.activeKey === '2') {
-          if (this.allVal[0].val === '11' || this.allVal[0].val === '12' || this.allVal[0].val === '31' || this.allVal[0].val === '50') {
-            parent = this.allVal[0].val
-          } else {
-            parent = this.allVal[0].val + this.allVal[1].val
-          }
-
-          console.log(parent)
+          parent = this.allVal[0].val + this.allVal[1].val
         }
         if (this.activeKey !== '0' && parent === '') {
           this.$message.error('请先选择上级行政区划');

+ 0 - 43
web_src/src/components/dialog/regionCode.vue

@@ -200,56 +200,13 @@ export default {
         let parent = ''
         if (this.activeKey === '1') {
           parent = this.allVal[0].val
-
-          if (parent === '11' || parent === '12' || parent === '31') {
-            this.regionList = []
-            this.regionList.push({
-              // 数据库自增ID
-              commonRegionId: -1,
-              // 区域国标编号
-              deviceId: parent + '01',
-              // 区域名称
-              name: '市辖区',
-              // 父区域国标ID
-              commonRegionParentId: parent,
-            })
-            console.log(this.regionList)
-            return
-          } else if (parent === '50') {
-            this.regionList = [
-              {
-                // 数据库自增ID
-                commonRegionId: -1,
-                // 区域国标编号
-                deviceId: parent + '01',
-                // 区域名称
-                name: '市辖区',
-                // 父区域国标ID
-                commonRegionParentId: parent,
-              },
-              {
-                // 数据库自增ID
-                commonRegionId: -1,
-                // 区域国标编号
-                deviceId: parent + '02',
-                // 区域名称
-                name: '县',
-                // 父区域国标ID
-                commonRegionParentId: parent,
-              },
-            ]
-            return
-          }
         }
         if (this.activeKey === '2') {
           if (this.allVal[1].val === ""){
             parent = ""
-          }else if (this.allVal[0].val === '11' || this.allVal[0].val === '12' || this.allVal[0].val === '31' || this.allVal[0].val === '50') {
-            parent = this.allVal[0].val
           } else {
             parent = this.allVal[0].val + this.allVal[1].val
           }
-
         }
         if (this.activeKey !== '0' && parent === '') {
           this.$message.error('请先选择上级行政区划');