增加国标通道同步到资源管理
parent
074dbd69a2
commit
be527a4bd1
|
@ -1,2 +1,5 @@
|
||||||
alter table wvp_device_channel
|
alter table wvp_device_channel
|
||||||
change stream_id stream_id varying(255)
|
change stream_id stream_id varying(255)
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add common_gb_channel_id int
|
||||||
|
|
|
@ -92,6 +92,7 @@ create table wvp_device_channel (
|
||||||
latitude_wgs84 double precision,
|
latitude_wgs84 double precision,
|
||||||
business_group_id character varying(50),
|
business_group_id character varying(50),
|
||||||
gps_time character varying(50),
|
gps_time character varying(50),
|
||||||
|
common_gb_channel_id integer,
|
||||||
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
|
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -470,11 +470,11 @@ public class CommonGbChannel {
|
||||||
this.commonGbPassword = commonGbPassword;
|
this.commonGbPassword = commonGbPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCommonGbStatus() {
|
public Boolean getCommonGbStatus() {
|
||||||
return commonGbStatus;
|
return commonGbStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommonGbStatus(boolean commonGbStatus) {
|
public void setCommonGbStatus(Boolean commonGbStatus) {
|
||||||
this.commonGbStatus = commonGbStatus;
|
this.commonGbStatus = commonGbStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,10 +582,6 @@ public class CommonGbChannel {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommonGbStatus(Boolean commonGbStatus) {
|
|
||||||
this.commonGbStatus = commonGbStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdateTime() {
|
public String getUpdateTime() {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ public class DeviceChannel {
|
||||||
* 国标通用信息ID
|
* 国标通用信息ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "国标通用信息ID")
|
@Schema(description = "国标通用信息ID")
|
||||||
private int CommonGbChannelId;
|
private int commonGbChannelId;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -597,10 +597,10 @@ public class DeviceChannel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCommonGbChannelId() {
|
public int getCommonGbChannelId() {
|
||||||
return CommonGbChannelId;
|
return commonGbChannelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommonGbChannelId(int commonGbChannelId) {
|
public void setCommonGbChannelId(int commonGbChannelId) {
|
||||||
CommonGbChannelId = commonGbChannelId;
|
commonGbChannelId = commonGbChannelId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public interface ICommonGbChannelService {
|
||||||
* @param gbDeviceId 国标设备编号
|
* @param gbDeviceId 国标设备编号
|
||||||
* @param syncKeys 要同步的字段
|
* @param syncKeys 要同步的字段
|
||||||
*/
|
*/
|
||||||
boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys);
|
boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys, Boolean syncGroup, Boolean syncRegion);
|
||||||
|
|
||||||
List<CommonGbChannel> getChannelsInRegion(String civilCode);
|
List<CommonGbChannel> getChannelsInRegion(String civilCode);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.genersoft.iot.vmp.service.bean;
|
||||||
|
|
||||||
|
public class CommonGbChannelType {
|
||||||
|
public final static String GB28181 = "28181";
|
||||||
|
public final static String PUSH = "push";
|
||||||
|
public final static String PROXY = "proxy";
|
||||||
|
}
|
|
@ -3,8 +3,10 @@ package com.genersoft.iot.vmp.service.impl;
|
||||||
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.service.ICommonGbChannelService;
|
import com.genersoft.iot.vmp.service.ICommonGbChannelService;
|
||||||
|
import com.genersoft.iot.vmp.service.bean.CommonGbChannelType;
|
||||||
import com.genersoft.iot.vmp.storager.dao.CommonGbChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.CommonGbChannelMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -73,23 +75,45 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys) {
|
public boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys, Boolean syncGroup, Boolean syncRegion) {
|
||||||
logger.info("同步通用通道]来自国标设备,国标编号: {}", gbDeviceId);
|
logger.info("同步通用通道]来自国标设备,国标编号: {}", gbDeviceId);
|
||||||
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryAllChannels(gbDeviceId);
|
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryAllChannels(gbDeviceId);
|
||||||
if (deviceChannels.isEmpty()) {
|
if (deviceChannels.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<CommonGbChannel> commonGbChannelList = new ArrayList<>(deviceChannels.size());
|
List<CommonGbChannel> commonGbChannelList = new ArrayList<>(deviceChannels.size());
|
||||||
|
List<DeviceChannel> clearChannels = new ArrayList<>();
|
||||||
for (DeviceChannel deviceChannel : deviceChannels) {
|
for (DeviceChannel deviceChannel : deviceChannels) {
|
||||||
|
if (deviceChannel.getCommonGbChannelId() > 0) {
|
||||||
|
clearChannels.add(deviceChannel);
|
||||||
|
}
|
||||||
CommonGbChannel commonGbChannel = getCommonChannelFromDeviceChannel(deviceChannel, syncKeys);
|
CommonGbChannel commonGbChannel = getCommonChannelFromDeviceChannel(deviceChannel, syncKeys);
|
||||||
commonGbChannelList.add(commonGbChannel);
|
commonGbChannelList.add(commonGbChannel);
|
||||||
}
|
}
|
||||||
int limit = 300;
|
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
||||||
|
int limit = 50;
|
||||||
|
if (!clearChannels.isEmpty()) {
|
||||||
|
if (clearChannels.size() <= limit) {
|
||||||
|
commonGbChannelMapper.deleteByDeviceIDs(clearChannels);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < clearChannels.size(); i += limit) {
|
||||||
|
int toIndex = i + limit;
|
||||||
|
if (i + limit > clearChannels.size()) {
|
||||||
|
toIndex = clearChannels.size();
|
||||||
|
}
|
||||||
|
List<DeviceChannel> clearChannelsSun = clearChannels.subList(i, toIndex);
|
||||||
|
int currentResult = commonGbChannelMapper.deleteByDeviceIDs(clearChannelsSun);
|
||||||
|
if (currentResult <= 0) {
|
||||||
|
dataSourceTransactionManager.rollback(transactionStatus);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
boolean result;
|
boolean result;
|
||||||
if (commonGbChannelList.size() <= limit) {
|
if (commonGbChannelList.size() <= limit) {
|
||||||
result = commonGbChannelMapper.addAll(commonGbChannelList) > 0;
|
result = commonGbChannelMapper.addAll(commonGbChannelList) > 0;
|
||||||
} else {
|
} else {
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
|
||||||
for (int i = 0; i < commonGbChannelList.size(); i += limit) {
|
for (int i = 0; i < commonGbChannelList.size(); i += limit) {
|
||||||
int toIndex = i + limit;
|
int toIndex = i + limit;
|
||||||
if (i + limit > commonGbChannelList.size()) {
|
if (i + limit > commonGbChannelList.size()) {
|
||||||
|
@ -102,9 +126,10 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataSourceTransactionManager.commit(transactionStatus);
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
deviceChannelMapper.updateCommonChannelId(gbDeviceId);
|
||||||
|
dataSourceTransactionManager.commit(transactionStatus);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +139,10 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
}
|
}
|
||||||
CommonGbChannel commonGbChannel = new CommonGbChannel();
|
CommonGbChannel commonGbChannel = new CommonGbChannel();
|
||||||
commonGbChannel.setCommonGbDeviceID(deviceChannel.getChannelId());
|
commonGbChannel.setCommonGbDeviceID(deviceChannel.getChannelId());
|
||||||
|
commonGbChannel.setCommonGbStatus(deviceChannel.isStatus());
|
||||||
|
commonGbChannel.setType(CommonGbChannelType.GB28181);
|
||||||
|
commonGbChannel.setCreateTime(DateUtil.getNow());
|
||||||
|
commonGbChannel.setUpdateTime(DateUtil.getNow());
|
||||||
if (syncKeys == null || syncKeys.isEmpty()) {
|
if (syncKeys == null || syncKeys.isEmpty()) {
|
||||||
commonGbChannel.setCommonGbName(deviceChannel.getName());
|
commonGbChannel.setCommonGbName(deviceChannel.getName());
|
||||||
commonGbChannel.setCommonGbManufacturer(deviceChannel.getManufacture());
|
commonGbChannel.setCommonGbManufacturer(deviceChannel.getManufacture());
|
||||||
|
@ -136,7 +165,6 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
commonGbChannel.setCommonGbIPAddress(deviceChannel.getIpAddress());
|
commonGbChannel.setCommonGbIPAddress(deviceChannel.getIpAddress());
|
||||||
commonGbChannel.setCommonGbPort(deviceChannel.getPort());
|
commonGbChannel.setCommonGbPort(deviceChannel.getPort());
|
||||||
commonGbChannel.setCommonGbPassword(deviceChannel.getPassword());
|
commonGbChannel.setCommonGbPassword(deviceChannel.getPassword());
|
||||||
commonGbChannel.setCommonGbStatus(deviceChannel.isStatus());
|
|
||||||
commonGbChannel.setCommonGbLongitude(deviceChannel.getLongitude());
|
commonGbChannel.setCommonGbLongitude(deviceChannel.getLongitude());
|
||||||
commonGbChannel.setCommonGbLatitude(deviceChannel.getLatitude());
|
commonGbChannel.setCommonGbLatitude(deviceChannel.getLatitude());
|
||||||
commonGbChannel.setCommonGbPtzType(deviceChannel.getPTZType());
|
commonGbChannel.setCommonGbPtzType(deviceChannel.getPTZType());
|
||||||
|
@ -204,9 +232,6 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
case "commonGbPassword":
|
case "commonGbPassword":
|
||||||
commonGbChannel.setCommonGbPassword(deviceChannel.getPassword());
|
commonGbChannel.setCommonGbPassword(deviceChannel.getPassword());
|
||||||
break;
|
break;
|
||||||
case "commonGbStatus":
|
|
||||||
commonGbChannel.setCommonGbStatus(deviceChannel.isStatus());
|
|
||||||
break;
|
|
||||||
case "commonGbLongitude":
|
case "commonGbLongitude":
|
||||||
commonGbChannel.setCommonGbLongitude(deviceChannel.getLongitude());
|
commonGbChannel.setCommonGbLongitude(deviceChannel.getLongitude());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.storager.dao;
|
package com.genersoft.iot.vmp.storager.dao;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@ -17,40 +18,40 @@ public interface CommonGbChannelMapper {
|
||||||
"<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} " +
|
"updateTime= #{ item.updateTime} " +
|
||||||
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
||||||
" <if test='commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
" <if test='item.commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
||||||
" <if test='commonGbManufacturer != null' > ,common_gb_manufacturer= #{ item.commonGbManufacturer} </if>" +
|
" <if test='item.commonGbManufacturer != null' > ,common_gb_manufacturer= #{ item.commonGbManufacturer} </if>" +
|
||||||
" <if test='commonGbModel != null' > ,common_gb_model= #{ item.commonGbModel} </if>" +
|
" <if test='item.commonGbModel != null' > ,common_gb_model= #{ item.commonGbModel} </if>" +
|
||||||
" <if test='commonGbOwner != null' > ,common_gb_owner= #{ item.commonGbOwner} </if>" +
|
" <if test='item.commonGbOwner != null' > ,common_gb_owner= #{ item.commonGbOwner} </if>" +
|
||||||
" <if test='commonGbCivilCode != null' > ,common_gb_civilCode= #{ item.commonGbCivilCode} </if>" +
|
" <if test='item.commonGbCivilCode != null' > ,common_gb_civilCode= #{ item.commonGbCivilCode} </if>" +
|
||||||
" <if test='commonGbBlock != null' > ,common_gb_block= #{ item.commonGbBlock} </if>" +
|
" <if test='item.commonGbBlock != null' > ,common_gb_block= #{ item.commonGbBlock} </if>" +
|
||||||
" <if test='commonGbAddress != null' > ,common_gb_address= #{ item.commonGbAddress} </if>" +
|
" <if test='item.commonGbAddress != null' > ,common_gb_address= #{ item.commonGbAddress} </if>" +
|
||||||
" <if test='common_gb_parental != null' > ,common_gb_parental= #{ item.commonGbParental} </if>" +
|
" <if test='item.common_gb_parental != null' > ,common_gb_parental= #{ item.commonGbParental} </if>" +
|
||||||
" <if test='commonGbParentID != null' > ,common_gb_parent_id= #{ item.commonGbParentID} </if>" +
|
" <if test='item.commonGbParentID != null' > ,common_gb_parent_id= #{ item.commonGbParentID} </if>" +
|
||||||
" <if test='commonGbSafetyWay != null' > ,common_gb_safety_way= #{ item.commonGbSafetyWay} </if>" +
|
" <if test='item.commonGbSafetyWay != null' > ,common_gb_safety_way= #{ item.commonGbSafetyWay} </if>" +
|
||||||
" <if test='commonGbRegisterWay != null' > ,common_gb_register_way= #{ item.commonGbRegisterWay} </if>" +
|
" <if test='item.commonGbRegisterWay != null' > ,common_gb_register_way= #{ item.commonGbRegisterWay} </if>" +
|
||||||
" <if test='commonGbCertNum != null' > ,common_gb_cert_num= #{ item.commonGbCertNum} </if>" +
|
" <if test='item.commonGbCertNum != null' > ,common_gb_cert_num= #{ item.commonGbCertNum} </if>" +
|
||||||
" <if test='commonGbCertifiable != null' > ,common_gb_certifiable= #{ item.commonGbCertifiable} </if>" +
|
" <if test='item.commonGbCertifiable != null' > ,common_gb_certifiable= #{ item.commonGbCertifiable} </if>" +
|
||||||
" <if test='commonGbErrCode != null' > ,common_gb_err_code= #{ item.commonGbErrCode} </if>" +
|
" <if test='item.commonGbErrCode != null' > ,common_gb_err_code= #{ item.commonGbErrCode} </if>" +
|
||||||
" <if test='commonGbEndTime != null' > ,common_gb_end_time= #{ item.commonGbEndTime} </if>" +
|
" <if test='item.commonGbEndTime != null' > ,common_gb_end_time= #{ item.commonGbEndTime} </if>" +
|
||||||
" <if test='commonGbSecrecy != null' > ,common_gb_secrecy= #{ item.commonGbSecrecy} </if>" +
|
" <if test='item.commonGbSecrecy != null' > ,common_gb_secrecy= #{ item.commonGbSecrecy} </if>" +
|
||||||
" <if test='commonGbIPAddress != null' > ,common_gb_ip_address= #{ item.commonGbIPAddress} </if>" +
|
" <if test='item.commonGbIPAddress != null' > ,common_gb_ip_address= #{ item.commonGbIPAddress} </if>" +
|
||||||
" <if test='commonGbPort != null' > ,common_gb_port= #{ item.commonGbPort} </if>" +
|
" <if test='item.commonGbPort != null' > ,common_gb_port= #{ item.commonGbPort} </if>" +
|
||||||
" <if test='commonGbPassword != null' > ,common_gb_password= #{ item.commonGbPassword} </if>" +
|
" <if test='item.commonGbPassword != null' > ,common_gb_password= #{ item.commonGbPassword} </if>" +
|
||||||
" <if test='commonGbStatus != null' > ,common_gb_status= #{ item.commonGbStatus} </if>" +
|
" <if test='item.commonGbStatus != null' > ,common_gb_status= #{ item.commonGbStatus} </if>" +
|
||||||
" <if test='commonGbLongitude != null' > ,common_gb_longitude= #{ item.commonGbLongitude} </if>" +
|
" <if test='item.commonGbLongitude != null' > ,common_gb_longitude= #{ item.commonGbLongitude} </if>" +
|
||||||
" <if test='commonGbLatitude != null' > ,common_gb_latitude= #{ item.commonGbLatitude} </if>" +
|
" <if test='item.commonGbLatitude != null' > ,common_gb_latitude= #{ item.commonGbLatitude} </if>" +
|
||||||
" <if test='commonGbPtzType != null' > ,common_gb_ptz_type= #{ item.commonGbPtzType} </if>" +
|
" <if test='item.commonGbPtzType != null' > ,common_gb_ptz_type= #{ item.commonGbPtzType} </if>" +
|
||||||
" <if test='commonGbPositionType != null' > ,common_gb_position_type= #{ item.commonGbPositionType} </if>" +
|
" <if test='item.commonGbPositionType != null' > ,common_gb_position_type= #{ item.commonGbPositionType} </if>" +
|
||||||
" <if test='commonGbRoomType != null' > ,common_gb_room_type= #{ item.commonGbRoomType} </if>" +
|
" <if test='item.commonGbRoomType != null' > ,common_gb_room_type= #{ item.commonGbRoomType} </if>" +
|
||||||
" <if test='commonGbUseType != null' > ,common_gb_use_type= #{ item.commonGbUseType} </if>" +
|
" <if test='item.commonGbUseType != null' > ,common_gb_use_type= #{ item.commonGbUseType} </if>" +
|
||||||
" <if test='commonGbEndTime != null' > ,common_gb_supply_light_type= #{ item.commonGbSupplyLightType} </if>" +
|
" <if test='item.commonGbEndTime != null' > ,common_gb_supply_light_type= #{ item.commonGbSupplyLightType} </if>" +
|
||||||
" <if test='commonGbSupplyLightType != null' > ,common_gb_direction_type= #{ item.commonGbDirectionType} </if>" +
|
" <if test='item.commonGbSupplyLightType != null' > ,common_gb_direction_type= #{ item.commonGbDirectionType} </if>" +
|
||||||
" <if test='commonGbResolution != null' > ,common_gb_resolution= #{ item.commonGbResolution} </if>" +
|
" <if test='item.commonGbResolution != null' > ,common_gb_resolution= #{ item.commonGbResolution} </if>" +
|
||||||
" <if test='commonGbBusinessGroupID != null' > ,common_gb_business_group_id= #{ item.commonGbBusinessGroupID} </if>" +
|
" <if test='item.commonGbBusinessGroupID != null' > ,common_gb_business_group_id= #{ item.commonGbBusinessGroupID} </if>" +
|
||||||
" <if test='commonGbDownloadSpeed != null' > ,common_gb_download_speed= #{ item.commonGbDownloadSpeed} </if>" +
|
" <if test='item.commonGbDownloadSpeed != null' > ,common_gb_download_speed= #{ item.commonGbDownloadSpeed} </if>" +
|
||||||
" <if test='commonGbSVCTimeSupportMode != null' > ,common_gb_svc_time_support_mode= #{ item.commonGbSVCTimeSupportMode} </if>" +
|
" <if test='item.commonGbSVCTimeSupportMode != null' > ,common_gb_svc_time_support_mode= #{ item.commonGbSVCTimeSupportMode} </if>" +
|
||||||
" <if test='type != null' > ,type= #{ item.type} </if>" +
|
" <if test='item.type != null' > ,type= #{ item.type} </if>" +
|
||||||
" WHERE common_gb_id=#{item.commonGbId}" +
|
" WHERE common_gb_id=#{item.commonGbId}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
|
@ -239,45 +240,52 @@ public interface CommonGbChannelMapper {
|
||||||
"updateTime, " +
|
"updateTime, " +
|
||||||
"createTime " +
|
"createTime " +
|
||||||
") values " +
|
") values " +
|
||||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
"<foreach collection='commonGbChannelList' index='index' item='item' separator=','> " +
|
||||||
"( #{commonGbDeviceID}, " +
|
"( " +
|
||||||
"#{commonGbName}, " +
|
"#{item.commonGbDeviceID}, " +
|
||||||
"#{commonGbManufacturer}, " +
|
"#{item.commonGbName}, " +
|
||||||
"#{commonGbModel}, " +
|
"#{item.commonGbManufacturer}, " +
|
||||||
"#{commonGbOwner}, " +
|
"#{item.commonGbModel}, " +
|
||||||
"#{commonGbCivilCode}, " +
|
"#{item.commonGbOwner}, " +
|
||||||
"#{commonGbBlock}," +
|
"#{item.commonGbCivilCode}, " +
|
||||||
"#{commonGbAddress}," +
|
"#{item.commonGbBlock}," +
|
||||||
"#{commonGbParental}," +
|
"#{item.commonGbAddress}," +
|
||||||
"#{commonGbParentID}," +
|
"#{item.commonGbParental}," +
|
||||||
"#{commonGbSafetyWay}," +
|
"#{item.commonGbParentID}," +
|
||||||
"#{commonGbRegisterWay}," +
|
"#{item.commonGbSafetyWay}," +
|
||||||
"#{commonGbCertNum}," +
|
"#{item.commonGbRegisterWay}," +
|
||||||
"#{commonGbCertifiable}," +
|
"#{item.commonGbCertNum}," +
|
||||||
"#{commonGbErrCode}," +
|
"#{item.commonGbCertifiable}," +
|
||||||
"#{commonGbEndTime}," +
|
"#{item.commonGbErrCode}," +
|
||||||
"#{commonGbSecrecy}," +
|
"#{item.commonGbEndTime}," +
|
||||||
"#{commonGbIPAddress}," +
|
"#{item.commonGbSecrecy}," +
|
||||||
"#{commonGbPort}," +
|
"#{item.commonGbIPAddress}," +
|
||||||
"#{commonGbPassword}," +
|
"#{item.commonGbPort}," +
|
||||||
"#{commonGbStatus}," +
|
"#{item.commonGbPassword}," +
|
||||||
"#{commonGbLongitude}," +
|
"#{item.commonGbStatus}," +
|
||||||
"#{commonGbLatitude}," +
|
"#{item.commonGbLongitude}," +
|
||||||
"#{commonGbPtzType}," +
|
"#{item.commonGbLatitude}," +
|
||||||
"#{commonGbPositionType}," +
|
"#{item.commonGbPtzType}," +
|
||||||
"#{commonGbRoomType}," +
|
"#{item.commonGbPositionType}," +
|
||||||
"#{commonGbUseType}," +
|
"#{item.commonGbRoomType}," +
|
||||||
"#{commonGbSupplyLightType}," +
|
"#{item.commonGbUseType}," +
|
||||||
"#{commonGbDirectionType}," +
|
"#{item.commonGbSupplyLightType}," +
|
||||||
"#{commonGbResolution}," +
|
"#{item.commonGbDirectionType}," +
|
||||||
"#{commonGbBusinessGroupID}," +
|
"#{item.commonGbResolution}," +
|
||||||
"#{commonGbDownloadSpeed}," +
|
"#{item.commonGbBusinessGroupID}," +
|
||||||
"#{commonGbSVCTimeSupportMode}," +
|
"#{item.commonGbDownloadSpeed}," +
|
||||||
"#{type}," +
|
"#{item.commonGbSVCTimeSupportMode}," +
|
||||||
"#{updateTime}," +
|
"#{item.type}," +
|
||||||
"#{createTime}" +
|
"#{item.updateTime}," +
|
||||||
|
"#{item.createTime}" +
|
||||||
")" +
|
")" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int addAll(List<CommonGbChannel> commonGbChannelList);
|
int addAll(List<CommonGbChannel> commonGbChannelList);
|
||||||
|
|
||||||
|
@Delete("<script> "+
|
||||||
|
"DELETE from wvp_common_gb_channel WHERE common_gb_id in" +
|
||||||
|
"<foreach collection='clearChannels' item='item' open='(' separator=',' close=')' > #{item.commonGbChannelId}</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
int deleteByDeviceIDs(List<DeviceChannel> clearChannels);
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,4 +466,11 @@ public interface DeviceChannelMapper {
|
||||||
" </script>"})
|
" </script>"})
|
||||||
List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog);
|
List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog);
|
||||||
|
|
||||||
|
@Update(" update wvp_device_channel wdc " +
|
||||||
|
" set " +
|
||||||
|
" common_gb_channel_id=" +
|
||||||
|
" (select wcgc.common_gb_id from wvp_common_gb_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " +
|
||||||
|
" where wdc.device_id = #{deviceId}")
|
||||||
|
int updateCommonChannelId(@Param("deviceId") String deviceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Tag(name = "通用国标通道")
|
@Tag(name = "通用国标通道")
|
||||||
|
@ -61,7 +60,13 @@ public class CommonChannelController {
|
||||||
@Operation(summary = "从下级设备中同步通道")
|
@Operation(summary = "从下级设备中同步通道")
|
||||||
@Parameter(name = "deviceId", description = "设备编号")
|
@Parameter(name = "deviceId", description = "设备编号")
|
||||||
@Parameter(name = "syncKeys", description = "选择性同步的字段")
|
@Parameter(name = "syncKeys", description = "选择性同步的字段")
|
||||||
public boolean syncFromDevice(String deviceId, String[] syncKeys) {
|
public boolean syncFromDevice(String deviceId, String[] syncKeys,
|
||||||
return commonGbChannelService.SyncChannelFromGb28181Device(deviceId, Lists.newArrayList(syncKeys));
|
@RequestParam(required = false) Boolean syncGroup,
|
||||||
|
@RequestParam(required = false) Boolean syncRegion) {
|
||||||
|
System.out.println("deviceId===" + deviceId);
|
||||||
|
System.out.println("syncKeys===" + Arrays.toString(syncKeys));
|
||||||
|
System.out.println("syncGroup===" + syncGroup);
|
||||||
|
System.out.println("syncRegion===" + syncRegion);
|
||||||
|
return commonGbChannelService.SyncChannelFromGb28181Device(deviceId, Lists.newArrayList(syncKeys), syncGroup, syncRegion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue