修复分组更新BUG

结构优化
648540858 2023-11-08 18:30:41 +08:00
parent 2f9bd859f4
commit 6fb820e49c
6 changed files with 41 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.Gb28181CodeType;
import com.github.pagehelper.PageInfo;
import java.util.ArrayList;
@ -49,4 +50,6 @@ public interface ICommonGbChannelService {
PageInfo<CommonGbChannel> queryChannelListInGroup(String groupDeviceId, String query, int page, int count);
PageInfo<CommonGbChannel> queryChannelList(String query, int page, int count);
String getRandomCode(Gb28181CodeType type);
}

View File

@ -621,4 +621,10 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
List<CommonGbChannel> all = commonGbChannelMapper.query(query);
return new PageInfo<>(all);
}
@Override
public String getRandomCode(Gb28181CodeType type) {
return "";
}
}

View File

@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.service.IGroupService;
import com.genersoft.iot.vmp.service.bean.Group;
import com.genersoft.iot.vmp.storager.dao.GroupMapper;
import com.genersoft.iot.vmp.storager.dao.CommonGbChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.PageHelper;
@ -67,6 +68,8 @@ public class GroupServiceImpl implements IGroupService {
public boolean add(Group group) {
assert group.getCommonGroupDeviceId() != null;
assert group.getCommonGroupDeviceId() != null;
group.setCommonGroupCreateTime(DateUtil.getNow());
group.setCommonGroupUpdateTime(DateUtil.getNow());
return groupMapper.add(group) > 0;
}
@ -94,7 +97,9 @@ public class GroupServiceImpl implements IGroupService {
groupMapper.updateParentDeviceId(groupInDb.getCommonGroupDeviceId(), group.getCommonGroupDeviceId());
// 修改所有通用通道中分组编号
commonGbChannelDao.updateChanelGroup(groupInDb.getCommonGroupDeviceId(), group.getCommonGroupDeviceId());
}else if (groupInDb.getCommonGroupParentId().equals(group.getCommonGroupParentId())
}else if (
((groupInDb.getCommonGroupParentId() == null && group.getCommonGroupParentId() == null)
|| groupInDb.getCommonGroupParentId().equals(group.getCommonGroupParentId()))
&& groupInDb.getCommonGroupName().equals(group.getCommonGroupName())) {
// 数据无变化
return false;

View File

@ -53,15 +53,15 @@ public interface GroupMapper {
@Update(value = {" <script>" +
"UPDATE wvp_common_group " +
"SET common_group_update_time=#{commonGroupUpdateTime}" +
"<if test='commonGroupName != null'>, common_group_name=#{commonGroupName}</if>" +
"<if test='commonGroupDeviceId != null'>, common_group_device_id=#{commonGroupDeviceId}</if>" +
"<if test='commonGroupParentId != null'>, common_group_parent_id=#{commonGroupParentId}</if>" +
"<if test='commonGroupTopId != null'>, common_group_top_id=#{commonGroupTopId}</if>" +
"<if test='commonGroupUpdateTime != null'>, common_group_update_time=#{commonGroupUpdateTime}</if>" +
"WHERE common_group_id=#{commonGroupId}" +
"SET common_group_update_time=#{group.commonGroupUpdateTime}" +
"<if test='group.commonGroupName != null'>, common_group_name=#{group.commonGroupName}</if>" +
"<if test='group.commonGroupDeviceId != null'>, common_group_device_id=#{group.commonGroupDeviceId}</if>" +
"<if test='group.commonGroupParentId != null'>, common_group_parent_id=#{group.commonGroupParentId}</if>" +
"<if test='group.commonGroupTopId != null'>, common_group_top_id=#{group.commonGroupTopId}</if>" +
"<if test='group.commonGroupUpdateTime != null'>, common_group_update_time=#{group.commonGroupUpdateTime}</if>" +
"WHERE common_group_id=#{group.commonGroupId}" +
" </script>"})
int update(@Param("Group") Group Group);
int update(@Param("group") Group group);
@Insert(value = "<script>" +

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.vmanager.channel;
import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.gb28181.bean.Gb28181CodeType;
import com.genersoft.iot.vmp.service.ICommonGbChannelService;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
@ -103,4 +104,20 @@ public class CommonChannelController {
commonGbChannelService.update(commonGbChannel);
}
@Operation(summary = "获取一个随机的可用国标编号")
@Parameter(name = "type", description = "类型: " +
"CIVIL_CODE_PROVINCE 省级编号 " +
"CIVIL_CODE_CIT 市级编号" +
"CIVIL_CODE_GRASS_ROOTS 区级编号" +
"CIVIL_CODE_GRASS_ROOTS 基层接入单位编号 " +
"BUSINESS_GROUP 业务分组 " +
"VIRTUAL_ORGANIZATION 虚拟组织 ", required = true)
@ResponseBody
@GetMapping("/code/random")
public String getRandomCode(
@RequestParam(required = true) Gb28181CodeType type
){
return commonGbChannelService.getRandomCode(type);
}
}

View File

@ -178,7 +178,7 @@ user-settings:
# 国标是否录制
record-sip: true
# 是否将日志存储进数据库
logInDatabase: true
log-in-database: true
# 使用推流状态作为推流通道状态
use-pushing-as-status: true
# 使用来源请求ip作为streamIp,当且仅当你只有zlm节点它与wvp在一起的情况下开启