diff --git a/config/db/V3.9__camechannelandorganization_add_col.sql b/config/db/V3.9__camechannelandorganization_add_col.sql new file mode 100644 index 00000000..ea691f7a --- /dev/null +++ b/config/db/V3.9__camechannelandorganization_add_col.sql @@ -0,0 +1,6 @@ +ALTER TABLE t_camera_channel ADD COLUMN region_code VARCHAR(255) COMMENT '市区编码'; +ALTER TABLE t_camera_channel ADD COLUMN region_name VARCHAR(255) COMMENT '市区名称'; + +ALTER TABLE t_camera_organization ADD COLUMN count INT DEFAULT(0); +ALTER TABLE t_camera_organization ADD COLUMN is_parent INT COMMENT '是否父节点'; +ALTER TABLE t_camera_organization ADD COLUMN path VARCHAR(500) COMMENT '从属关系'; \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java index 18e228f2..70f51a2f 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data -@TableName("t_camera_channel01") +@TableName("t_camera_channel") public class CameraChannelNew { @TableId diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java index 1bedc87c..872f9cf4 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java @@ -17,51 +17,51 @@ public interface CameraOrgenizationMapper extends BaseDao { @Select("select * from t_camera_organization where parent_id = #{parentId}") List selectSubOrganization(@Param("parentId") String parentId); - @Select("select * from t_camera_organization02 where parent_id = #{parentId}") + @Select("select * from t_camera_organization where parent_id = #{parentId}") List selectSubOrganizationMap(@Param("parentId") String parentId); - @Select("select name,parent_id,id from t_camera_organization02 where path LIKE CONCAT(#{path},'%') ") + @Select("select name,parent_id,id from t_camera_organization where path LIKE CONCAT(#{path},'%') ") List selectSubOrganizationMapByPath(@Param("path") String path); void batchSaveOrgenization(List list); - @Select("SELECT name,parent_id,id,path FROM t_camera_organization02 WHERE id = #{id}") + @Select("SELECT name,parent_id,id,path FROM t_camera_organization WHERE id = #{id}") Map selectOrgenizationById(@Param("id") String id); - @Update("UPDATE t_camera_organization02 SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}") + @Update("UPDATE t_camera_organization SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}") void updateOrganizationPaht(@Param("path") String path,@Param("id") String id); - @Select(" SELECT id FROM t_camera_organization02") + @Select(" SELECT id FROM t_camera_organization") List listOrgenization(); - @Select(" SELECT name FROM t_camera_organization02 where substring(id,5) = #{idPart} and left(id,3) = '006'") + @Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'") String getNameByidPart(@Param("idPart")String idPart); - @Update("UPDATE t_camera_organization02 SET COUNT = COUNT + 1 WHERE id = #{id}") + @Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}") void updateOrganizationCount(@Param("id") String id); void batchSaveCameraChannel(List list); - @Select("select * from t_camera_organization02") + @Select("select * from t_camera_organization") List testAll(); @Update("truncate table ${tableName}") void truncate(@Param("tableName") String tableName) ; - @Select("select orgaid,id,name,path from t_camera_organization02 order by orgaid") + @Select("select orgaid,id,name,path from t_camera_organization order by orgaid") List selectAllSubOrganizationMap(); - @Update("UPDATE t_camera_organization02 SET channelCount = #{channelCount} where orgaid = #{orgaId}") + @Update("UPDATE t_camera_organization SET channelCount = #{channelCount} where orgaid = #{orgaId}") void editChannelCount(@Param("channelCount") Integer channelCount,@Param("orgaId") Integer orgaId); @Update(" UPDATE t_region a inner join \n" + - " (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel01 GROUP BY region_code) b\n" + + " (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code) b\n" + " ON a.region_code = b.region_code set a.channel_count = b.channel_count") void updateRegionChannelCount(); - @Select(" SELECT id FROM t_camera_organization02 WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization02 a INNER JOIN \n" + + @Select(" SELECT id FROM t_camera_organization WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization a INNER JOIN \n" + "\t(\n" + - "\t\tSELECT parent_id FROM t_camera_channel01 ORDER BY idt_camera_channel desc LIMIT 1\n" + + "\t\tSELECT parent_id FROM t_camera_channel ORDER BY idt_camera_channel desc LIMIT 1\n" + "\t) b ON a.id = b.parent_id \n" + ") ORDER BY orgaid ASC ") List listOrgenization2(); diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java index ebdd67ec..f15068d4 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java @@ -1248,8 +1248,8 @@ public class MonitorService { //2、获取视频通道信息并保存,多线程版 @Async public void saveChannelInfoAsync() throws Exception { - //1-清空t_camera_channel01 - cameraOrgenMapper.truncate("t_camera_channel01"); + //1-清空t_camera_channel + cameraOrgenMapper.truncate("t_camera_channel"); //2-创建线程池 ExecutorService executorService = Executors.newFixedThreadPool(20);//20个线程足够 @@ -1294,6 +1294,9 @@ public class MonitorService { //6-更新完通道信息后,查询地区下通道的数量并更新到地区表和市区表中 editChannelCount(); + + //7-同步武伟达的t_channel_mtm_label数据 + } //单独保存视频通道信息 diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml index 640929c9..e8a299b8 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml @@ -117,7 +117,7 @@ @@ -135,7 +135,7 @@ * sin(radians( tcc.gps_y ))) AS `distance` FROM - t_camera_channel01 tcc + t_camera_channel tcc JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code JOIN t_label tl ON tl.label_code = tcml.label_code @@ -183,7 +183,7 @@ * sin(radians( tcc.gps_y ))) AS `distance` FROM - t_camera_channel01 tcc + t_camera_channel tcc JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code JOIN t_label tl ON tl.label_code = tcml.label_code @@ -215,6 +215,6 @@ \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml index bc024b3f..0aeae4d0 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml @@ -3,7 +3,7 @@ - INSERT INTO t_camera_organization02 ( + INSERT INTO t_camera_organization ( id,name,parent_id,sort,subCount,path,is_parent,is_root ) VALUES @@ -15,7 +15,7 @@ - INSERT INTO t_camera_channel01 + INSERT INTO t_camera_channel ( channel_code,channel_id,channel_name,gps_x,gps_y,status, parent_id,region_code,region_name,node_name