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