修改位置分发逻辑
This commit is contained in:
@@ -68,4 +68,22 @@ public class MobilePosition {
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MobilePosition{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
", channelId=" + channelId +
|
||||
", channelDeviceId='" + channelDeviceId + '\'' +
|
||||
", deviceName='" + deviceName + '\'' +
|
||||
", time='" + time + '\'' +
|
||||
", longitude=" + longitude +
|
||||
", latitude=" + latitude +
|
||||
", altitude=" + altitude +
|
||||
", speed=" + speed +
|
||||
", direction=" + direction +
|
||||
", reportSource='" + reportSource + '\'' +
|
||||
", createTime='" + createTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,13 +89,6 @@ public class GroupController {
|
||||
return groupService.getPath(deviceId, businessGroup);
|
||||
}
|
||||
|
||||
@Operation(summary = "从第三方同步组织结构")
|
||||
@ResponseBody
|
||||
@GetMapping("/sync")
|
||||
public void sync(){
|
||||
groupService.sync();
|
||||
}
|
||||
|
||||
// @Operation(summary = "根据分组Id查询分组")
|
||||
// @Parameter(name = "groupDeviceId", description = "分组节点编号", required = true)
|
||||
// @ResponseBody
|
||||
|
||||
@@ -31,8 +31,6 @@ public interface IGroupService {
|
||||
|
||||
Group queryGroupByAlias(String groupAlias);
|
||||
|
||||
void sync();
|
||||
|
||||
Map<String, Group> queryGroupByAliasMap();
|
||||
|
||||
void saveByAlias(Collection<Group> groups);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
@@ -16,7 +16,6 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -30,7 +29,7 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GroupServiceImpl implements IGroupService, CommandLineRunner {
|
||||
public class GroupServiceImpl implements IGroupService {
|
||||
|
||||
@Autowired
|
||||
private GroupMapper groupManager;
|
||||
@@ -47,14 +46,6 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
// 启动后请求组织结构同步
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
String key = VideoManagerConstants.VM_MSG_GROUP_LIST_REQUEST;
|
||||
log.info("[redis发送通知] 发送 同步组织结构请求 {}", key);
|
||||
redisTemplate.convertAndSend(key, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Group group) {
|
||||
Assert.notNull(group, "参数不可为NULL");
|
||||
@@ -323,15 +314,6 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
|
||||
return groupManager.queryGroupByAlias(groupAlias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sync() {
|
||||
try {
|
||||
this.run();
|
||||
}catch (Exception e) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "同步失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Group> queryGroupByAliasMap() {
|
||||
return groupManager.queryGroupByAliasMap();
|
||||
@@ -340,6 +322,7 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveByAlias(Collection<Group> groups) {
|
||||
log.info("[存储分组数据] {}", JSONObject.toJSONString(groups));
|
||||
// 清空别名数据
|
||||
groupManager.deleteHasAlias();
|
||||
// 写入新数据
|
||||
|
||||
Reference in New Issue
Block a user