Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-19 15:42:32 +08:00
commit dc62d53ca5
4 changed files with 61 additions and 0 deletions

View File

@ -69,4 +69,6 @@ public interface CameraChannelMapper extends BaseDao<CameraChannel> {
Integer selectByParentIdCountNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes,@Param("path") String path); Integer selectByParentIdCountNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes,@Param("path") String path);
List<Map> selectChannelNumByRegion(); List<Map> selectChannelNumByRegion();
void batchSaveMtmLabel(@Param("list") List<Map<String,Object>> list);
} }

View File

@ -1,6 +1,7 @@
package io.renren.modules.monitor.service; package io.renren.modules.monitor.service;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -14,7 +15,9 @@ import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.Java2DFrameConverter; import org.bytedeco.javacv.Java2DFrameConverter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -27,6 +30,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.sql.DataSource;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
@ -71,6 +75,10 @@ public class MonitorService {
@Autowired @Autowired
private BoothMapper boothMapper; private BoothMapper boothMapper;
@Lazy
@Autowired
private JdbcTemplate jdbcTemplate;
@Value("${resource.path}") @Value("${resource.path}")
private String fileDir; private String fileDir;
@Value("${resource.pic-host}") @Value("${resource.pic-host}")
@ -79,6 +87,18 @@ public class MonitorService {
@Value("iOgQotfgfyLvhj6WgfDTpq7F") @Value("iOgQotfgfyLvhj6WgfDTpq7F")
private String key; private String key;
@Value("${synchro.driver-class-name}")
private String jdbcDriverClassName;
@Value("${synchro.url}")
private String jdbcUrl;
@Value("${synchro.username}")
private String jdbcUserName;
@Value("${synchro.password}")
private String jdbcPassWord;
private static final String userName = "ynszdz"; private static final String userName = "ynszdz";
private static final String password = "Admin@123"; private static final String password = "Admin@123";
private static final String monitorDomain = "http://10.132.191.3:8314"; private static final String monitorDomain = "http://10.132.191.3:8314";
@ -1296,9 +1316,31 @@ public class MonitorService {
editChannelCount(); editChannelCount();
//7-同步武伟达的t_channel_mtm_label数据 //7-同步武伟达的t_channel_mtm_label数据
synchronizeMtmLabel();
}
//同步武伟达的t_channel_mtm_label数据
public void synchronizeMtmLabel(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(jdbcUrl);
druidDataSource.setDriverClassName(jdbcDriverClassName);
druidDataSource.setUsername(jdbcUserName);
druidDataSource.setPassword(jdbcPassWord);
jdbcTemplate.setDataSource(druidDataSource);
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from t_channel_mtm_label");
if(maps.size() > 0){
//清空t_channel_mtm_label
cameraOrgenMapper.truncate("t_channel_mtm_label");
List<List<Map<String, Object>>> partition = Lists.partition(maps, 200);
partition.forEach(list->{
cameraChannelMapper.batchSaveMtmLabel(list);
});
}
} }
//单独保存视频通道信息 //单独保存视频通道信息
public void batchSaveChannelInfos(List<Map> list,String parentId){ public void batchSaveChannelInfos(List<Map> list,String parentId){
List<Map> needSave = new ArrayList<>(); List<Map> needSave = new ArrayList<>();

View File

@ -62,3 +62,10 @@ hisense:
qdyjj: qdyjj:
ipAndPort: 15.2.21.238:9015 ipAndPort: 15.2.21.238:9015
#同步摄像头标签表t_channel_mtm_label需要链接的数据库配置
synchro:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: Hisense2019

View File

@ -217,4 +217,14 @@
<select id="selectChannelNumByRegion" resultType="java.util.Map"> <select id="selectChannelNumByRegion" resultType="java.util.Map">
SELECT ROUND(COUNT(idt_camera_channel) /10000,1) AS channelCount,region_code,region_name FROM t_camera_channel WHERE region_name is not null GROUP BY region_code,region_name SELECT ROUND(COUNT(idt_camera_channel) /10000,1) AS channelCount,region_code,region_name FROM t_camera_channel WHERE region_name is not null GROUP BY region_code,region_name
</select> </select>
<insert id="batchSaveMtmLabel" parameterType="java.util.List">
INSERT INTO t_channel_mtm_label (
channel_code,label_code
)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.channel_code},#{item.label_code})
</foreach>
</insert>
</mapper> </mapper>