From abbb5643c5332d52661c6912f42349f288bf294d Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 10 Nov 2023 17:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=BB=84=E6=A0=91?= =?UTF-8?q?=E7=9A=84=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/impl/GroupServiceImpl.java | 11 +++++++++++ .../iot/vmp/storager/dao/GroupMapper.java | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GroupServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GroupServiceImpl.java index 66aace07..31f04626 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GroupServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import java.util.List; @@ -70,6 +71,16 @@ public class GroupServiceImpl implements IGroupService { assert group.getCommonGroupDeviceId() != null; group.setCommonGroupCreateTime(DateUtil.getNow()); group.setCommonGroupUpdateTime(DateUtil.getNow()); + Gb28181CodeType channelIdType = SipUtils.getChannelIdType(group.getCommonGroupParentId()); + if (ObjectUtils.isEmpty(group.getCommonGroupParentId().trim()) || channelIdType.equals(Gb28181CodeType.BUSINESS_GROUP)) { + group.setCommonGroupParentId(null); + } + if (ObjectUtils.isEmpty(group.getCommonGroupTopId().trim())) { + Gb28181CodeType channelIdTypeForItem = SipUtils.getChannelIdType(group.getCommonGroupDeviceId()); + if (channelIdTypeForItem.equals(Gb28181CodeType.BUSINESS_GROUP)) { + group.setCommonGroupTopId(group.getCommonGroupDeviceId()); + } + } return groupMapper.add(group) > 0; } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java index c8d42781..75223c8b 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java @@ -27,20 +27,22 @@ public interface GroupMapper { " WHERE common_group_device_id = #{deviceId} ") Group queryByDeviceId(@Param("deviceId") String deviceId); - @Insert("INSERT INTO wvp_common_group (" + + @Insert(value = " ") int add(@Param("group") Group group); @Delete("delete from wvp_common_group where common_group_id = #{id}")