优化通用通道同步,待完成
parent
5a5108c827
commit
e44be505d9
|
@ -35,8 +35,8 @@ CREATE TABLE `wvp_common_gb_channel`
|
||||||
`common_gb_download_speed` varchar(255) DEFAULT NULL,
|
`common_gb_download_speed` varchar(255) DEFAULT NULL,
|
||||||
`common_gb_svc_time_support_mode` integer,
|
`common_gb_svc_time_support_mode` integer,
|
||||||
`type` varchar(255) NOT NULL,
|
`type` varchar(255) NOT NULL,
|
||||||
`updateTime` varchar(50) NOT NULL,
|
`update_time` varchar(50) NOT NULL,
|
||||||
`createTime` varchar(50) NOT NULL,
|
`create_time` varchar(50) NOT NULL,
|
||||||
PRIMARY KEY (`common_gb_id`),
|
PRIMARY KEY (`common_gb_id`),
|
||||||
UNIQUE KEY `common_gb_device_id` (`common_gb_device_id`)
|
UNIQUE KEY `common_gb_device_id` (`common_gb_device_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package com.genersoft.iot.vmp.common;
|
package com.genersoft.iot.vmp.common;
|
||||||
|
|
||||||
public class BatchLimit {
|
public class BatchLimit {
|
||||||
public static final int count = 50;
|
public static final int count = 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class CatalogDataCatch {
|
||||||
if ( catalogData.getLastTime().isBefore(instantBefore5S)) {
|
if ( catalogData.getLastTime().isBefore(instantBefore5S)) {
|
||||||
// 超过五秒收不到消息任务超时, 只更新这一部分数据, 收到数据与声明的总数一致,则重置通道数据,数据不全则只对收到的数据做更新操作
|
// 超过五秒收不到消息任务超时, 只更新这一部分数据, 收到数据与声明的总数一致,则重置通道数据,数据不全则只对收到的数据做更新操作
|
||||||
if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.runIng)) {
|
if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.runIng)) {
|
||||||
deviceChannelService.updateChannels(catalogData.getDevice(), catalogData.getChannelList());
|
deviceChannelService.updateChannelsForCatalog(catalogData.getDevice(), catalogData.getChannelList());
|
||||||
String errorMsg = "更新成功,共" + catalogData.getTotal() + "条,已更新" + catalogData.getChannelList().size() + "条";
|
String errorMsg = "更新成功,共" + catalogData.getTotal() + "条,已更新" + catalogData.getChannelList().size() + "条";
|
||||||
catalogData.setErrorMsg(errorMsg);
|
catalogData.setErrorMsg(errorMsg);
|
||||||
}else if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready)) {
|
}else if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready)) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||||
if (catalogDataCatch.get(take.getDevice().getDeviceId()).size() == sumNum) {
|
if (catalogDataCatch.get(take.getDevice().getDeviceId()).size() == sumNum) {
|
||||||
// 数据已经完整接收, 此时可能存在某个设备离线变上线的情况,但是考虑到性能,此处不做处理,
|
// 数据已经完整接收, 此时可能存在某个设备离线变上线的情况,但是考虑到性能,此处不做处理,
|
||||||
// 目前支持设备通道上线通知时和设备上线时向上级通知
|
// 目前支持设备通道上线通知时和设备上线时向上级通知
|
||||||
boolean resetChannelsResult = deviceChannelService.updateChannels(take.getDevice(), catalogDataCatch.get(take.getDevice().getDeviceId()));
|
boolean resetChannelsResult = deviceChannelService.updateChannelsForCatalog(take.getDevice(), catalogDataCatch.get(take.getDevice().getDeviceId()));
|
||||||
String errorMsg = null;
|
String errorMsg = null;
|
||||||
if (!resetChannelsResult) {
|
if (!resetChannelsResult) {
|
||||||
errorMsg = "接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(take.getDevice().getDeviceId()).size() + "条";
|
errorMsg = "接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(take.getDevice().getDeviceId()).size() + "条";
|
||||||
|
|
|
@ -32,7 +32,7 @@ public interface IDeviceChannelService {
|
||||||
* @param deviceId 设备id
|
* @param deviceId 设备id
|
||||||
* @param channels 多个通道
|
* @param channels 多个通道
|
||||||
*/
|
*/
|
||||||
int updateChannels(String deviceId, List<DeviceChannel> channels);
|
int updateChannelsForCatalog(String deviceId, List<DeviceChannel> channels);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取统计信息
|
* 获取统计信息
|
||||||
|
@ -91,6 +91,6 @@ public interface IDeviceChannelService {
|
||||||
/**
|
/**
|
||||||
* 重置通道
|
* 重置通道
|
||||||
*/
|
*/
|
||||||
boolean updateChannels(Device device, List<DeviceChannel> deviceChannelList);
|
boolean updateChannelsForCatalog(Device device, List<DeviceChannel> deviceChannelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -723,14 +723,10 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
if (i + BatchLimit.count > commonGbChannels.size()) {
|
if (i + BatchLimit.count > commonGbChannels.size()) {
|
||||||
toIndex = commonGbChannels.size();
|
toIndex = commonGbChannels.size();
|
||||||
}
|
}
|
||||||
if (commonGbChannelMapper.batchAdd(commonGbChannels.subList(i, toIndex)) < 0) {
|
commonGbChannelMapper.batchAdd(commonGbChannels.subList(i, toIndex));
|
||||||
throw new RuntimeException("batch add commonGbChannel fail");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (commonGbChannelMapper.batchAdd(commonGbChannels) < 0) {
|
commonGbChannelMapper.batchAdd(commonGbChannels);
|
||||||
throw new RuntimeException("batch add commonGbChannel fail");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceChannelMapper channelMapper;
|
private DeviceChannelMapper channelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CommonGbChannelMapper commonGbChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceMapper deviceMapper;
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
@ -122,7 +125,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateChannels(String deviceId, List<DeviceChannel> channels) {
|
public int updateChannelsForCatalog(String deviceId, List<DeviceChannel> channels) {
|
||||||
List<DeviceChannel> addChannels = new ArrayList<>();
|
List<DeviceChannel> addChannels = new ArrayList<>();
|
||||||
List<DeviceChannel> updateChannels = new ArrayList<>();
|
List<DeviceChannel> updateChannels = new ArrayList<>();
|
||||||
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
|
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
|
||||||
|
@ -283,31 +286,35 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean updateChannels(Device device, List<DeviceChannel> deviceChannelList) {
|
public boolean updateChannelsForCatalog(Device device, List<DeviceChannel> deviceChannelList) {
|
||||||
if (CollectionUtils.isEmpty(deviceChannelList)) {
|
if (CollectionUtils.isEmpty(deviceChannelList)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Map<String, DeviceChannel> allChannelMap = channelMapper.queryAllChannelsForMap(device.getDeviceId());
|
Map<String, DeviceChannel> allChannelMap = channelMapper.queryAllChannelsForMap(device.getDeviceId());
|
||||||
|
Map<String, CommonGbChannel> allCommonChannelMap = commonGbChannelMapper.queryAllChannelsForMap();
|
||||||
|
|
||||||
// 存储数据,方便对数据去重
|
// 存储数据,方便对数据去重
|
||||||
List<DeviceChannel> channels = new ArrayList<>();
|
List<DeviceChannel> channels = new ArrayList<>();
|
||||||
|
|
||||||
// 存储需要更新的国标通道
|
|
||||||
List<DeviceChannel> updateChannelsForInfo = new ArrayList<>();
|
|
||||||
// 存储需要更新的通用通道
|
|
||||||
List<CommonGbChannel> updateCommonChannelsForInfo = new ArrayList<>();
|
|
||||||
// 存储需要更新的分组
|
|
||||||
List<Group> updateGroupForInfo = new ArrayList<>();
|
|
||||||
// 存储需要更新的行政区划
|
|
||||||
List<Region> updateRegionForInfo = new ArrayList<>();
|
|
||||||
// 存储需要需要新增的国标通道
|
// 存储需要需要新增的国标通道
|
||||||
List<DeviceChannel> addChannels = new ArrayList<>();
|
List<DeviceChannel> addChannelList = new ArrayList<>();
|
||||||
|
// 存储需要更新的国标通道
|
||||||
|
List<DeviceChannel> updateChannelList = new ArrayList<>();
|
||||||
|
|
||||||
// 存储需要需要新增的通用通道
|
// 存储需要需要新增的通用通道
|
||||||
List<CommonGbChannel> addCommonChannels = new ArrayList<>();
|
List<CommonGbChannel> addCommonChannelList = new ArrayList<>();
|
||||||
|
// 存储需要更新的通用通道
|
||||||
|
List<CommonGbChannel> updateCommonChannelList = new ArrayList<>();
|
||||||
|
|
||||||
// 存储需要需要新增的分组
|
// 存储需要需要新增的分组
|
||||||
List<Group> addGroups = new ArrayList<>();
|
List<Group> addGroupList = new ArrayList<>();
|
||||||
|
// 存储需要更新的分组
|
||||||
|
List<Group> updateGroupList = new ArrayList<>();
|
||||||
|
|
||||||
// 存储需要需要新增的行政区划
|
// 存储需要需要新增的行政区划
|
||||||
List<Region> addRegions = new ArrayList<>();
|
List<Region> addRegionList = new ArrayList<>();
|
||||||
|
// 存储需要更新的行政区划
|
||||||
|
List<Region> updateRegionList = new ArrayList<>();
|
||||||
|
|
||||||
Map<String, Integer> subContMap = new HashMap<>();
|
Map<String, Integer> subContMap = new HashMap<>();
|
||||||
|
|
||||||
|
@ -339,18 +346,19 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
deviceChannel.setCommonGbChannelId(channelInDb.getCommonGbChannelId());
|
deviceChannel.setCommonGbChannelId(channelInDb.getCommonGbChannelId());
|
||||||
deviceChannel.setUpdateTime(DateUtil.getNow());
|
deviceChannel.setUpdateTime(DateUtil.getNow());
|
||||||
// 同步时发现状态变化
|
// 同步时发现状态变化
|
||||||
updateChannelsForInfo.add(deviceChannel);
|
updateChannelList.add(deviceChannel);
|
||||||
if (channelIdType == null) {
|
|
||||||
updateCommonChannelsForInfo.add(CommonGbChannel.getInstance(null, deviceChannel));
|
|
||||||
}
|
|
||||||
// 将需要更新的移除,剩下的都是需要删除的了
|
// 将需要更新的移除,剩下的都是需要删除的了
|
||||||
allChannelMap.remove(deviceChannel.getChannelId());
|
allChannelMap.remove(deviceChannel.getChannelId());
|
||||||
}else {
|
}else {
|
||||||
deviceChannel.setCreateTime(DateUtil.getNow());
|
deviceChannel.setCreateTime(DateUtil.getNow());
|
||||||
deviceChannel.setUpdateTime(DateUtil.getNow());
|
deviceChannel.setUpdateTime(DateUtil.getNow());
|
||||||
addChannels.add(deviceChannel);
|
addChannelList.add(deviceChannel);
|
||||||
|
}
|
||||||
if (channelIdType == null) {
|
if (channelIdType == null) {
|
||||||
addCommonChannels.add(CommonGbChannel.getInstance(null, deviceChannel));
|
if (allCommonChannelMap.containsKey(deviceChannel.getChannelId())) {
|
||||||
|
updateCommonChannelList.add(CommonGbChannel.getInstance(null, deviceChannel));
|
||||||
|
}else {
|
||||||
|
addCommonChannelList.add(CommonGbChannel.getInstance(null, deviceChannel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,14 +376,14 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
// 行政区划条目
|
// 行政区划条目
|
||||||
region = Region.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(),
|
region = Region.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(),
|
||||||
civilCode);
|
civilCode);
|
||||||
addRegions.add(region);
|
addRegionList.add(region);
|
||||||
}else {
|
}else {
|
||||||
// 区域存在记录并检查是否需要更新
|
// 区域存在记录并检查是否需要更新
|
||||||
region = regionMap.get(deviceChannel.getChannelId());
|
region = regionMap.get(deviceChannel.getChannelId());
|
||||||
if (region.getCommonRegionName().equals(deviceChannel.getName())) {
|
if (region.getCommonRegionName().equals(deviceChannel.getName())) {
|
||||||
// 对于行政区划,父节点是不会变化的,所以只需要判断名称变化,执行更新就可以
|
// 对于行政区划,父节点是不会变化的,所以只需要判断名称变化,执行更新就可以
|
||||||
region.setCommonRegionName(deviceChannel.getName());
|
region.setCommonRegionName(deviceChannel.getName());
|
||||||
updateRegionForInfo.add(region);
|
updateRegionList.add(region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
regionMap.put(region.getCommonRegionDeviceId(), region);
|
regionMap.put(region.getCommonRegionDeviceId(), region);
|
||||||
|
@ -385,14 +393,14 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
if (!businessGroupMap.containsKey(deviceChannel.getChannelId())) {
|
if (!businessGroupMap.containsKey(deviceChannel.getChannelId())) {
|
||||||
group = Group.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(),
|
group = Group.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(),
|
||||||
null, deviceChannel.getChannelId());
|
null, deviceChannel.getChannelId());
|
||||||
businessGroupMap.put(deviceChannel.getChannelId(), group);
|
addGroupList.add(group);
|
||||||
}else {
|
}else {
|
||||||
// 对于业务分组,因为它本身即使顶级节点,所以不能父节点变化,所以只需要考虑名称变化的情况
|
// 对于业务分组,因为它本身即使顶级节点,所以不能父节点变化,所以只需要考虑名称变化的情况
|
||||||
group = businessGroupMap.get(deviceChannel.getChannelId());
|
group = businessGroupMap.get(deviceChannel.getChannelId());
|
||||||
if (!group.getCommonGroupName().equals(deviceChannel.getName())) {
|
if (!group.getCommonGroupName().equals(deviceChannel.getName())) {
|
||||||
group.setCommonGroupName(deviceChannel.getName());
|
group.setCommonGroupName(deviceChannel.getName());
|
||||||
}
|
}
|
||||||
updateGroupForInfo.add(group);
|
updateGroupList.add(group);
|
||||||
}
|
}
|
||||||
businessGroupMap.put(group.getCommonGroupDeviceId(), group);
|
businessGroupMap.put(group.getCommonGroupDeviceId(), group);
|
||||||
|
|
||||||
|
@ -400,7 +408,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
Group group;
|
Group group;
|
||||||
if (!virtuallyGroupMap.containsKey(deviceChannel.getChannelId())) {
|
if (!virtuallyGroupMap.containsKey(deviceChannel.getChannelId())) {
|
||||||
group = Group.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(), deviceChannel.getParentId(), deviceChannel.getBusinessGroupId());
|
group = Group.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(), deviceChannel.getParentId(), deviceChannel.getBusinessGroupId());
|
||||||
virtuallyGroupMap.put(deviceChannel.getChannelId(), group);
|
addGroupList.add(group);
|
||||||
}else {
|
}else {
|
||||||
// 对于虚拟组织的变化,需要考虑三点, 名称, 顶级父节点(所属业务分组)或者 父节点
|
// 对于虚拟组织的变化,需要考虑三点, 名称, 顶级父节点(所属业务分组)或者 父节点
|
||||||
group = virtuallyGroupMap.get(deviceChannel.getChannelId());
|
group = virtuallyGroupMap.get(deviceChannel.getChannelId());
|
||||||
|
@ -411,16 +419,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
group.setCommonGroupName(deviceChannel.getName());
|
group.setCommonGroupName(deviceChannel.getName());
|
||||||
group.setCommonGroupTopId(deviceChannel.getBusinessGroupId());
|
group.setCommonGroupTopId(deviceChannel.getBusinessGroupId());
|
||||||
group.setCommonGroupParentId(deviceChannel.getParentId());
|
group.setCommonGroupParentId(deviceChannel.getParentId());
|
||||||
updateGroupForInfo.add(group);
|
updateGroupList.add(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtuallyGroupMap.put(group.getCommonGroupDeviceId(), group);
|
virtuallyGroupMap.put(group.getCommonGroupDeviceId(), group);
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
if (!StringUtils.isEmpty(deviceChannel.getCivilCode())) {
|
|
||||||
civilCodeSet.add(deviceChannel.getCivilCode());
|
|
||||||
}
|
|
||||||
addCommonChannels.add(CommonGbChannel.getInstance(null, deviceChannel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
channels.add(deviceChannel);
|
channels.add(deviceChannel);
|
||||||
|
@ -452,20 +455,33 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
}else {
|
}else {
|
||||||
// 检查业务分组与虚拟组织
|
// 检查业务分组与虚拟组织
|
||||||
if (!virtuallyGroupMap.isEmpty()) {
|
if (!virtuallyGroupMap.isEmpty()) {
|
||||||
for (String key : virtuallyGroupMap.keySet()) {
|
for (int i = 0; i < addGroupList.size(); i++) {
|
||||||
Group virtuallyGroup = virtuallyGroupMap.get(key);
|
Group group = addGroupList.get(i);
|
||||||
if (virtuallyGroup.getCommonGroupTopId() == null
|
if (ObjectUtils.isEmpty(group.getCommonGroupTopId())) {
|
||||||
|| !businessGroupMap.containsKey(virtuallyGroup.getCommonGroupTopId())
|
if (businessGroupMap.containsKey(group.getCommonGroupParentId())) {
|
||||||
) {
|
group.setCommonGroupTopId(group.getCommonGroupParentId());
|
||||||
virtuallyGroupMap.remove(key);
|
}else {
|
||||||
|
addGroupList.remove(i);
|
||||||
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (virtuallyGroup.getCommonGroupParentId() != null && !virtuallyGroupMap.containsKey(virtuallyGroup.getCommonGroupParentId())) {
|
}else {
|
||||||
virtuallyGroup.setCommonGroupParentId(null);
|
if (!businessGroupMap.containsKey(group.getCommonGroupTopId())) {
|
||||||
|
addGroupList.remove(i);
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (virtuallyGroupMap.isEmpty()) {
|
|
||||||
businessGroupMap.clear();
|
if (!ObjectUtils.isEmpty(group.getCommonGroupParentId())
|
||||||
|
&& !virtuallyGroupMap.containsKey(group.getCommonGroupParentId())) {
|
||||||
|
addGroupList.remove(i);
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!businessGroupMap.containsKey(group.getCommonGroupTopId())) {
|
||||||
|
group.setCommonGroupTopId(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,10 +490,13 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
if (!regionMap.containsKey(civilCode)) {
|
if (!regionMap.containsKey(civilCode)) {
|
||||||
logger.warn("[通道信息中缺少地区信息]补充地区信息 civilCode: {}", civilCode );
|
logger.warn("[通道信息中缺少地区信息]补充地区信息 civilCode: {}", civilCode );
|
||||||
if (civilCode.length() == 8) {
|
if (civilCode.length() == 8) {
|
||||||
Region region = civilCodeFileConf.createRegion(civilCode.substring(0, 6));
|
Region parentRegion = civilCodeFileConf.createRegion(civilCode.substring(0, 6));
|
||||||
if (region != null) {
|
if (parentRegion != null) {
|
||||||
Region.getInstance(civilCode, region.getCommonRegionName() + "的基层组织", region.getCommonRegionDeviceId());
|
Region region = Region.getInstance(civilCode,
|
||||||
|
parentRegion.getCommonRegionName() + "的基层组织",
|
||||||
|
parentRegion.getCommonRegionDeviceId());
|
||||||
regionMap.put(region.getCommonRegionDeviceId(), region);
|
regionMap.put(region.getCommonRegionDeviceId(), region);
|
||||||
|
addRegionList.add(region);
|
||||||
}else {
|
}else {
|
||||||
logger.warn("[获取地区信息]失败 civilCode: {}", civilCode );
|
logger.warn("[获取地区信息]失败 civilCode: {}", civilCode );
|
||||||
}
|
}
|
||||||
|
@ -485,18 +504,16 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
Region region = civilCodeFileConf.createRegion(civilCode);
|
Region region = civilCodeFileConf.createRegion(civilCode);
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
regionMap.put(region.getCommonRegionDeviceId(), region);
|
regionMap.put(region.getCommonRegionDeviceId(), region);
|
||||||
|
addRegionList.add(region);
|
||||||
}else {
|
}else {
|
||||||
logger.warn("[获取地区信息]失败 civilCode: {}", civilCode );
|
logger.warn("[获取地区信息]失败 civilCode: {}", civilCode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 对待写入的数据做处理
|
// 对待写入的数据做处理
|
||||||
if (!addCommonChannels.isEmpty()) {
|
if (!addCommonChannelList.isEmpty()) {
|
||||||
addCommonChannels.stream().forEach(commonGbChannel -> {
|
addCommonChannelList.stream().forEach(commonGbChannel -> {
|
||||||
if (commonGbChannel.getCommonGbParentID() != null
|
if (commonGbChannel.getCommonGbParentID() != null
|
||||||
&& !virtuallyGroupMap.containsKey(commonGbChannel.getCommonGbParentID())) {
|
&& !virtuallyGroupMap.containsKey(commonGbChannel.getCommonGbParentID())) {
|
||||||
commonGbChannel.setCommonGbParentID(null);
|
commonGbChannel.setCommonGbParentID(null);
|
||||||
|
@ -540,108 +557,62 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
commonGbChannelService.batchDelete(allCommonChannelsForDelete);
|
commonGbChannelService.batchDelete(allCommonChannelsForDelete);
|
||||||
}
|
}
|
||||||
// addChannels 与 addCommonChannels 数量一致,这里使用同一个循环处理
|
// addChannels 与 addCommonChannels 数量一致,这里使用同一个循环处理
|
||||||
if (!addChannels.isEmpty()) {
|
if (!addChannelList.isEmpty()) {
|
||||||
// 对于新增的部分需要先添加通用通道,拿到ID后再添加国标通道
|
// 对于新增的部分需要先添加通用通道,拿到ID后再添加国标通道
|
||||||
commonGbChannelService.batchAdd(addCommonChannels);
|
commonGbChannelService.batchAdd(addCommonChannelList);
|
||||||
for (int j = 0; j < addCommonChannels.size(); j++) {
|
for (int j = 0; j < addCommonChannelList.size(); j++) {
|
||||||
addChannels.get(j).setCommonGbChannelId(addCommonChannels.get(j).getCommonGbId());
|
addChannelList.get(j).setCommonGbChannelId(addCommonChannelList.get(j).getCommonGbId());
|
||||||
}
|
}
|
||||||
if (addChannels.size() > BatchLimit.count) {
|
addChannelHandler(addChannelList);
|
||||||
for (int i = 0; i < addChannels.size(); i += BatchLimit.count) {
|
|
||||||
int toIndex = i + BatchLimit.count;
|
|
||||||
if (i + BatchLimit.count > addChannels.size()) {
|
|
||||||
toIndex = addChannels.size();
|
|
||||||
}
|
}
|
||||||
channelMapper.batchAdd(addChannels.subList(i, toIndex));
|
if (!updateChannelList.isEmpty()) {
|
||||||
}
|
commonGbChannelService.batchUpdate(updateCommonChannelList);
|
||||||
}else {
|
updateChannelHandler(updateChannelList);
|
||||||
channelMapper.batchAdd(addChannels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!updateChannelsForInfo.isEmpty()) {
|
|
||||||
if (updateChannelsForInfo.size() > BatchLimit.count) {
|
|
||||||
for (int i = 0; i < updateChannelsForInfo.size(); i += BatchLimit.count) {
|
|
||||||
int toIndex = i + BatchLimit.count;
|
|
||||||
if (i + BatchLimit.count > updateChannelsForInfo.size()) {
|
|
||||||
toIndex = updateChannelsForInfo.size();
|
|
||||||
}
|
|
||||||
channelMapper.batchUpdate(updateChannelsForInfo.subList(i, toIndex));
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
channelMapper.batchUpdate(updateChannelsForInfo);
|
|
||||||
}
|
|
||||||
commonGbChannelService.batchUpdate(updateCommonChannelsForInfo);
|
|
||||||
}
|
}
|
||||||
// 写入分组数据
|
// 写入分组数据
|
||||||
List<Group> allGroup = new ArrayList<>(businessGroupMap.values());
|
if (!addGroupList.isEmpty()) {
|
||||||
allGroup.addAll(virtuallyGroupMap.values());
|
addGroupHandler(addGroupList);
|
||||||
if (!allGroup.isEmpty()) {
|
|
||||||
// 这里也采取只插入新数据的方式
|
|
||||||
List<Group> groupInDBList = groupMapper.queryInList(allGroup);
|
|
||||||
if (!groupInDBList.isEmpty()) {
|
|
||||||
groupInDBList.stream().forEach(groupInDB -> {
|
|
||||||
for (int i = 0; i < allGroup.size(); i++) {
|
|
||||||
if (groupInDB.getCommonGroupDeviceId().equalsIgnoreCase(allGroup.get(i).getCommonGroupDeviceId())) {
|
|
||||||
allGroup.remove(i);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (!updateGroupList.isEmpty()) {
|
||||||
|
updateGroupHandler(updateGroupList);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!allGroup.isEmpty()) {
|
|
||||||
if (allGroup.size() <= BatchLimit.count) {
|
|
||||||
groupMapper.addAll(allGroup);
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < allGroup.size(); i += BatchLimit.count) {
|
|
||||||
int toIndex = i + BatchLimit.count;
|
|
||||||
if (i + BatchLimit.count > allGroup.size()) {
|
|
||||||
toIndex = allGroup.size();
|
|
||||||
}
|
|
||||||
groupMapper.addAll(allGroup.subList(i, toIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 写入地区
|
|
||||||
List<Region> allRegion = new ArrayList<>(regionMap.values());
|
|
||||||
|
|
||||||
if (!allRegion.isEmpty()) {
|
// 写入地区
|
||||||
// 这里也采取只插入新数据的方式
|
if (!addRegionList.isEmpty()) {
|
||||||
List<Region> regionInDBList = regionMapper.queryInList(allRegion);
|
// 如果下级未发送完整的区域树,则通过自动探查补全
|
||||||
List<Region> regionInForUpdate = new ArrayList<>();
|
addRegionList.stream().forEach((region -> {
|
||||||
if (!regionInDBList.isEmpty()) {
|
if (!regionMap.containsKey(region.getCommonRegionParentId())
|
||||||
regionInDBList.stream().forEach(regionInDB -> {
|
&& !ObjectUtils.isEmpty(region.getCommonRegionParentId())
|
||||||
for (int i = 0; i < allRegion.size(); i++) {
|
&& region.getCommonRegionParentId().length() > 2) {
|
||||||
if (regionInDB.getCommonRegionDeviceId().equalsIgnoreCase(allRegion.get(i).getCommonRegionDeviceId())) {
|
Region parentRegion = civilCodeFileConf.createRegion(region.getCommonRegionParentId());
|
||||||
if (!regionInDB.getCommonRegionName().equals(allRegion.get(i).getCommonRegionName())) {
|
addRegionList.add(parentRegion);
|
||||||
regionInForUpdate.add(allRegion.get(i));
|
String parentDeviceId = parentRegion.getCommonRegionParentId();
|
||||||
|
if (parentDeviceId.length() == 6) {
|
||||||
|
CivilCodePo parentCode = civilCodeFileConf.getParentCode(region.getCommonRegionDeviceId());
|
||||||
|
if (parentCode == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
allRegion.remove(i);
|
parentDeviceId = parentCode.getParentCode();
|
||||||
break;
|
if (regionMap.containsKey(region.getCommonRegionDeviceId())) {
|
||||||
|
addRegionList.add(Region.getInstance(parentCode.getCode(),
|
||||||
|
parentCode.getCode(), parentCode.getParentCode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
if (parentDeviceId.length() == 4) {
|
||||||
|
CivilCodePo parentCode = civilCodeFileConf.getParentCode(region.getCommonRegionDeviceId());
|
||||||
|
if (parentCode == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!allRegion.isEmpty()) {
|
addRegionList.add(Region.getInstance(parentCode.getCode(),
|
||||||
if (allRegion.size() <= BatchLimit.count) {
|
parentCode.getCode(), parentCode.getParentCode()));
|
||||||
if (regionMapper.addAll(allRegion) <= 0) {
|
|
||||||
regionMapper.addAll(allRegion);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < allRegion.size(); i += BatchLimit.count) {
|
|
||||||
int toIndex = i + BatchLimit.count;
|
|
||||||
if (i + BatchLimit.count > allRegion.size()) {
|
|
||||||
toIndex = allRegion.size();
|
|
||||||
}
|
|
||||||
List<Region> allRegionSub = allRegion.subList(i, toIndex);
|
|
||||||
regionMapper.addAll(allRegionSub);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
|
addRegionHandler(addRegionList);
|
||||||
}
|
}
|
||||||
// 对于名称变化的地区进行修改
|
if (!updateRegionList.isEmpty()) {
|
||||||
if (!regionInForUpdate.isEmpty()) {
|
updateRegionHandler(updateRegionList);
|
||||||
regionMapper.updateAllForName(regionInForUpdate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -657,4 +628,92 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
|| channelIdType == Gb28181CodeType.CIVIL_CODE_COUNTY
|
|| channelIdType == Gb28181CodeType.CIVIL_CODE_COUNTY
|
||||||
|| channelIdType == Gb28181CodeType.CIVIL_CODE_GRASS_ROOTS;
|
|| channelIdType == Gb28181CodeType.CIVIL_CODE_GRASS_ROOTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addChannelHandler(List<DeviceChannel> addChannels) {
|
||||||
|
if (addChannels.size() > BatchLimit.count) {
|
||||||
|
for (int i = 0; i < addChannels.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > addChannels.size()) {
|
||||||
|
toIndex = addChannels.size();
|
||||||
|
}
|
||||||
|
channelMapper.batchAdd(addChannels.subList(i, toIndex));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
channelMapper.batchAdd(addChannels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateChannelHandler(List<DeviceChannel> updateChannels) {
|
||||||
|
if (updateChannels.size() > BatchLimit.count) {
|
||||||
|
for (int i = 0; i < updateChannels.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > updateChannels.size()) {
|
||||||
|
toIndex = updateChannels.size();
|
||||||
|
}
|
||||||
|
channelMapper.batchUpdate(updateChannels.subList(i, toIndex));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
channelMapper.batchUpdate(updateChannels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addRegionHandler(List<Region> regionList) {
|
||||||
|
if (regionList.size() <= BatchLimit.count) {
|
||||||
|
if (regionMapper.addAll(regionList) <= 0) {
|
||||||
|
regionMapper.addAll(regionList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < regionList.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > regionList.size()) {
|
||||||
|
toIndex = regionList.size();
|
||||||
|
}
|
||||||
|
List<Region> allRegionSub = regionList.subList(i, toIndex);
|
||||||
|
regionMapper.addAll(allRegionSub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateRegionHandler(List<Region> regionList) {
|
||||||
|
if (regionList.size() <= BatchLimit.count) {
|
||||||
|
regionMapper.updateAllForName(regionList);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < regionList.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > regionList.size()) {
|
||||||
|
toIndex = regionList.size();
|
||||||
|
}
|
||||||
|
List<Region> allRegionSub = regionList.subList(i, toIndex);
|
||||||
|
regionMapper.updateAllForName(allRegionSub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addGroupHandler(List<Group> groupList) {
|
||||||
|
if (groupList.size() <= BatchLimit.count) {
|
||||||
|
groupMapper.addAll(groupList);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < groupList.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > groupList.size()) {
|
||||||
|
toIndex = groupList.size();
|
||||||
|
}
|
||||||
|
groupMapper.addAll(groupList.subList(i, toIndex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateGroupHandler(List<Group> groupList) {
|
||||||
|
if (groupList.size() <= BatchLimit.count) {
|
||||||
|
groupMapper.updateAll(groupList);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < groupList.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > groupList.size()) {
|
||||||
|
toIndex = groupList.size();
|
||||||
|
}
|
||||||
|
groupMapper.updateAll(groupList.subList(i, toIndex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
for (DeviceChannel deviceChannel : deviceChannels) {
|
for (DeviceChannel deviceChannel : deviceChannels) {
|
||||||
deviceChannelsForStore.add(deviceChannelService.updateGps(deviceChannel, device));
|
deviceChannelsForStore.add(deviceChannelService.updateGps(deviceChannel, device));
|
||||||
}
|
}
|
||||||
deviceChannelService.updateChannels(device.getDeviceId(), deviceChannelsForStore);
|
deviceChannelService.updateChannelsForCatalog(device.getDeviceId(), deviceChannelsForStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.*;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -21,7 +22,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update(value = "<script>" +
|
@Update(value = "<script>" +
|
||||||
"<foreach collection='channels' item='item' separator=';'>" +
|
"<foreach collection='channels' item='item' separator=';'>" +
|
||||||
"UPDATE wvp_common_gb_channel SET " +
|
"UPDATE wvp_common_gb_channel SET " +
|
||||||
"updateTime= #{ item.updateTime} " +
|
"update_time= #{ item.updateTime} " +
|
||||||
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
||||||
" <if test='item.commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
" <if test='item.commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
||||||
" <if test='item.commonGbManufacturer != null' > ,common_gb_manufacturer= #{ item.commonGbManufacturer} </if>" +
|
" <if test='item.commonGbManufacturer != null' > ,common_gb_manufacturer= #{ item.commonGbManufacturer} </if>" +
|
||||||
|
@ -30,7 +31,7 @@ public interface CommonGbChannelMapper {
|
||||||
" <if test='item.commonGbCivilCode != null' > ,common_gb_civilCode= #{ item.commonGbCivilCode} </if>" +
|
" <if test='item.commonGbCivilCode != null' > ,common_gb_civilCode= #{ item.commonGbCivilCode} </if>" +
|
||||||
" <if test='item.commonGbBlock != null' > ,common_gb_block= #{ item.commonGbBlock} </if>" +
|
" <if test='item.commonGbBlock != null' > ,common_gb_block= #{ item.commonGbBlock} </if>" +
|
||||||
" <if test='item.commonGbAddress != null' > ,common_gb_address= #{ item.commonGbAddress} </if>" +
|
" <if test='item.commonGbAddress != null' > ,common_gb_address= #{ item.commonGbAddress} </if>" +
|
||||||
" <if test='item.common_gb_parental != null' > ,common_gb_parental= #{ item.commonGbParental} </if>" +
|
" <if test='item.commonGbParental != null' > ,common_gb_parental= #{ item.commonGbParental} </if>" +
|
||||||
" <if test='item.commonGbParentID != null' > ,common_gb_parent_id= #{ item.commonGbParentID} </if>" +
|
" <if test='item.commonGbParentID != null' > ,common_gb_parent_id= #{ item.commonGbParentID} </if>" +
|
||||||
" <if test='item.commonGbSafetyWay != null' > ,common_gb_safety_way= #{ item.commonGbSafetyWay} </if>" +
|
" <if test='item.commonGbSafetyWay != null' > ,common_gb_safety_way= #{ item.commonGbSafetyWay} </if>" +
|
||||||
" <if test='item.commonGbRegisterWay != null' > ,common_gb_register_way= #{ item.commonGbRegisterWay} </if>" +
|
" <if test='item.commonGbRegisterWay != null' > ,common_gb_register_way= #{ item.commonGbRegisterWay} </if>" +
|
||||||
|
@ -108,8 +109,8 @@ public interface CommonGbChannelMapper {
|
||||||
" <if test='common_gb_download_speed != null' > ,common_gb_download_speed </if>" +
|
" <if test='common_gb_download_speed != null' > ,common_gb_download_speed </if>" +
|
||||||
" <if test='common_gb_svc_time_support_mode != null' > ,common_gb_svc_time_support_mode </if>" +
|
" <if test='common_gb_svc_time_support_mode != null' > ,common_gb_svc_time_support_mode </if>" +
|
||||||
" <if test='type != null' > ,type </if>" +
|
" <if test='type != null' > ,type </if>" +
|
||||||
" <if test='updateTime != null' > ,updateTime </if>" +
|
" <if test='updateTime != null' > ,update_time </if>" +
|
||||||
" <if test='createTime != null' > ,createTime </if>" +
|
" <if test='createTime != null' > ,create_time </if>" +
|
||||||
") values (" +
|
") values (" +
|
||||||
"#{commonGbDeviceID}" +
|
"#{commonGbDeviceID}" +
|
||||||
" <if test='common_gb_name != null' > ,#{commonGbName}</if>" +
|
" <if test='common_gb_name != null' > ,#{commonGbName}</if>" +
|
||||||
|
@ -156,7 +157,7 @@ public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
@Update(value = "<script>" +
|
@Update(value = "<script>" +
|
||||||
"UPDATE wvp_common_gb_channel SET " +
|
"UPDATE wvp_common_gb_channel SET " +
|
||||||
"updateTime= #{ updateTime} " +
|
"update_time= #{ updateTime} " +
|
||||||
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ commonGbDeviceID} </if>" +
|
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ commonGbDeviceID} </if>" +
|
||||||
" <if test='commonGbName != null' > ,common_gb_name= #{ commonGbName} </if>" +
|
" <if test='commonGbName != null' > ,common_gb_name= #{ commonGbName} </if>" +
|
||||||
" <if test='commonGbManufacturer != null' > ,common_gb_manufacturer= #{ commonGbManufacturer} </if>" +
|
" <if test='commonGbManufacturer != null' > ,common_gb_manufacturer= #{ commonGbManufacturer} </if>" +
|
||||||
|
@ -165,7 +166,7 @@ public interface CommonGbChannelMapper {
|
||||||
" <if test='commonGbCivilCode != null' > ,common_gb_civilCode= #{ commonGbCivilCode} </if>" +
|
" <if test='commonGbCivilCode != null' > ,common_gb_civilCode= #{ commonGbCivilCode} </if>" +
|
||||||
" <if test='commonGbBlock != null' > ,common_gb_block= #{ commonGbBlock} </if>" +
|
" <if test='commonGbBlock != null' > ,common_gb_block= #{ commonGbBlock} </if>" +
|
||||||
" <if test='commonGbAddress != null' > ,common_gb_address= #{ commonGbAddress} </if>" +
|
" <if test='commonGbAddress != null' > ,common_gb_address= #{ commonGbAddress} </if>" +
|
||||||
" <if test='common_gb_parental != null' > ,common_gb_parental= #{ commonGbParental} </if>" +
|
" <if test='commonGbParental != null' > ,common_gb_parental= #{ commonGbParental} </if>" +
|
||||||
" <if test='commonGbParentID != null' > ,common_gb_parent_id= #{ commonGbParentID} </if>" +
|
" <if test='commonGbParentID != null' > ,common_gb_parent_id= #{ commonGbParentID} </if>" +
|
||||||
" <if test='commonGbSafetyWay != null' > ,common_gb_safety_way= #{ commonGbSafetyWay} </if>" +
|
" <if test='commonGbSafetyWay != null' > ,common_gb_safety_way= #{ commonGbSafetyWay} </if>" +
|
||||||
" <if test='commonGbRegisterWay != null' > ,common_gb_register_way= #{ commonGbRegisterWay} </if>" +
|
" <if test='commonGbRegisterWay != null' > ,common_gb_register_way= #{ commonGbRegisterWay} </if>" +
|
||||||
|
@ -238,8 +239,8 @@ public interface CommonGbChannelMapper {
|
||||||
"common_gb_download_speed, " +
|
"common_gb_download_speed, " +
|
||||||
"common_gb_svc_time_support_mode, " +
|
"common_gb_svc_time_support_mode, " +
|
||||||
"type, " +
|
"type, " +
|
||||||
"updateTime, " +
|
"update_time, " +
|
||||||
"createTime " +
|
"create_time " +
|
||||||
") values " +
|
") values " +
|
||||||
"<foreach collection='commonGbChannelList' index='index' item='item' separator=','> " +
|
"<foreach collection='commonGbChannelList' index='index' item='item' separator=','> " +
|
||||||
"( " +
|
"( " +
|
||||||
|
@ -473,10 +474,11 @@ public interface CommonGbChannelMapper {
|
||||||
" common_gb_download_speed, " +
|
" common_gb_download_speed, " +
|
||||||
" common_gb_svc_time_support_mode, " +
|
" common_gb_svc_time_support_mode, " +
|
||||||
" type, " +
|
" type, " +
|
||||||
" updateTime, " +
|
" update_time, " +
|
||||||
" createTime )"+
|
" create_time )"+
|
||||||
"values " +
|
"values " +
|
||||||
"<foreach collection='commonGbChannels' index='index' item='item' open='(' close=')' separator=','> " +
|
"<foreach collection='commonGbChannels' index='index' item='item' separator=','> " +
|
||||||
|
"(" +
|
||||||
"#{item.commonGbDeviceID}, " +
|
"#{item.commonGbDeviceID}, " +
|
||||||
"#{item.commonGbName}, " +
|
"#{item.commonGbName}, " +
|
||||||
"#{item.commonGbManufacturer}, " +
|
"#{item.commonGbManufacturer}, " +
|
||||||
|
@ -513,7 +515,7 @@ public interface CommonGbChannelMapper {
|
||||||
"#{item.type}," +
|
"#{item.type}," +
|
||||||
"#{item.updateTime}," +
|
"#{item.updateTime}," +
|
||||||
"#{item.createTime}" +
|
"#{item.createTime}" +
|
||||||
"</foreach> " +
|
")</foreach> " +
|
||||||
"</script>")
|
"</script>")
|
||||||
int batchAdd(@Param("commonGbChannels") List<CommonGbChannel> commonGbChannels);
|
int batchAdd(@Param("commonGbChannels") List<CommonGbChannel> commonGbChannels);
|
||||||
|
|
||||||
|
@ -530,7 +532,7 @@ public interface CommonGbChannelMapper {
|
||||||
" <if test='item.commonGbCivilCode != null' > ,common_gb_civilCode = #{item.commonGbCivilCode} </if>" +
|
" <if test='item.commonGbCivilCode != null' > ,common_gb_civilCode = #{item.commonGbCivilCode} </if>" +
|
||||||
" <if test='item.commonGbBlock != null' > ,common_gb_block = #{item.commonGbBlock} </if>" +
|
" <if test='item.commonGbBlock != null' > ,common_gb_block = #{item.commonGbBlock} </if>" +
|
||||||
" <if test='item.commonGbAddress != null' > ,common_gb_address = #{item.commonGbAddress} </if>" +
|
" <if test='item.commonGbAddress != null' > ,common_gb_address = #{item.commonGbAddress} </if>" +
|
||||||
" <if test='item.common_gb_parental != null' > ,common_gb_parental = #{item.commonGbParental} </if>" +
|
" <if test='item.commonGbParental != null' > ,common_gb_parental = #{item.commonGbParental} </if>" +
|
||||||
" <if test='item.commonGbParentID != null' > ,common_gb_parent_id = #{item.commonGbParentID} </if>" +
|
" <if test='item.commonGbParentID != null' > ,common_gb_parent_id = #{item.commonGbParentID} </if>" +
|
||||||
" <if test='item.commonGbSafetyWay != null' > ,common_gb_safety_way = #{item.commonGbSafetyWay} </if>" +
|
" <if test='item.commonGbSafetyWay != null' > ,common_gb_safety_way = #{item.commonGbSafetyWay} </if>" +
|
||||||
" <if test='item.commonGbRegisterWay != null' > ,common_gb_register_way = #{item.commonGbRegisterWay} </if>" +
|
" <if test='item.commonGbRegisterWay != null' > ,common_gb_register_way = #{item.commonGbRegisterWay} </if>" +
|
||||||
|
@ -570,4 +572,9 @@ public interface CommonGbChannelMapper {
|
||||||
"<foreach collection='ids' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
"<foreach collection='ids' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int batchDelete(@Param("ids") List<Integer> ids);
|
int batchDelete(@Param("ids") List<Integer> ids);
|
||||||
|
|
||||||
|
@MapKey("commonGbDeviceID")
|
||||||
|
@Select("select * from wvp_common_gb_channel")
|
||||||
|
Map<String, CommonGbChannel> queryAllChannelsForMap();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,4 +150,17 @@ public interface GroupMapper {
|
||||||
@MapKey("commonGroupDeviceId")
|
@MapKey("commonGroupDeviceId")
|
||||||
@Select("select * from wvp_common_group where common_group_device_id != common_group_top_id")
|
@Select("select * from wvp_common_group where common_group_device_id != common_group_top_id")
|
||||||
Map<String, Group> queryNotTopGroupForMap();
|
Map<String, Group> queryNotTopGroupForMap();
|
||||||
|
|
||||||
|
@Update({"<script>" +
|
||||||
|
"<foreach collection='groupList' item='item' separator=';'>" +
|
||||||
|
" UPDATE" +
|
||||||
|
" wvp_common_group" +
|
||||||
|
" SET " +
|
||||||
|
" common_group_top_id=#{item.commonGroupTopId}, " +
|
||||||
|
" common_group_parent_id=#{item.commonGroupParentId}, " +
|
||||||
|
" common_group_name=#{item.commonGroupName}" +
|
||||||
|
" WHERE common_group_device_id=#{item.commonGroupId}"+
|
||||||
|
"</foreach>" +
|
||||||
|
"</script>"})
|
||||||
|
int updateAll(@Param("groupList") List<Group> groupList);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue