临时提交
This commit is contained in:
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -1047,4 +1048,11 @@ public interface DeviceChannelMapper {
|
||||
" WHERE id=#{channelId}" +
|
||||
" </script>"})
|
||||
void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='gpsMsgInfoList' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_longitude = #{item.lng}, gb_latitude=#{item.lat} WHERE id = #{item.channelId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,4 +18,7 @@ public interface IMobilePositionService {
|
||||
List<Platform> queryEnablePlatformListWithAsMessageChannel();
|
||||
|
||||
MobilePosition queryLatestPosition(String deviceId);
|
||||
|
||||
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
|
||||
import com.genersoft.iot.vmp.service.IMobilePositionService;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -92,7 +93,10 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
|
||||
return mobilePositionMapper.queryLatestPositionByDevice(deviceId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList) {
|
||||
channelMapper.updateStreamGPS(gpsMsgInfoList);
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 1000)
|
||||
@Transactional
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.genersoft.iot.vmp.service.redisMsg;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.genersoft.iot.vmp.service.IMobilePositionService;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -29,6 +30,9 @@ public class RedisGpsMsgListener implements MessageListener {
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private IMobilePositionService mobilePositionService;
|
||||
|
||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@Qualifier("taskExecutor")
|
||||
@@ -63,10 +67,10 @@ public class RedisGpsMsgListener implements MessageListener {
|
||||
*/
|
||||
@Scheduled(fixedRate = 2 * 1000) //每2秒执行一次
|
||||
public void execute(){
|
||||
List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo();
|
||||
if (gpsMsgInfo.size() > 0) {
|
||||
// storager.updateStreamGPS(gpsMsgInfo);
|
||||
for (GPSMsgInfo msgInfo : gpsMsgInfo) {
|
||||
List<GPSMsgInfo> gpsMsgInfoList = redisCatchStorage.getAllGpsMsgInfo();
|
||||
if (!gpsMsgInfoList.isEmpty()) {
|
||||
mobilePositionService.updateStreamGPS(gpsMsgInfoList);
|
||||
for (GPSMsgInfo msgInfo : gpsMsgInfoList) {
|
||||
msgInfo.setStored(true);
|
||||
redisCatchStorage.updateGpsMsgInfo(msgInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user