feat(trajectory): 新增轨迹检测与 Beacon 注册表
This commit is contained in:
@@ -39,14 +39,20 @@ public interface AreaDeviceApi {
|
||||
@PathVariable("areaId") Long areaId
|
||||
);
|
||||
|
||||
@GetMapping(PREFIX + "/{areaId}/devices")
|
||||
@Operation(summary = "查询区域设备列表(按类型)")
|
||||
CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
|
||||
@Parameter(description = "区域ID", required = true, example = "1302")
|
||||
@PathVariable("areaId") Long areaId,
|
||||
@Parameter(description = "关联类型(BADGE/TRAFFIC_COUNTER/BEACON)", required = false, example = "BADGE")
|
||||
@RequestParam(value = "relationType", required = false) String relationType
|
||||
);
|
||||
@GetMapping(PREFIX + "/{areaId}/devices")
|
||||
@Operation(summary = "查询区域设备列表(按类型)")
|
||||
CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
|
||||
@Parameter(description = "区域ID", required = true, example = "1302")
|
||||
@PathVariable("areaId") Long areaId,
|
||||
@Parameter(description = "关联类型(BADGE/TRAFFIC_COUNTER/BEACON)", required = false, example = "BADGE")
|
||||
@RequestParam(value = "relationType", required = false) String relationType
|
||||
);
|
||||
|
||||
// ==================== 全量查询 ====================
|
||||
|
||||
@GetMapping(PREFIX + "/beacons/all")
|
||||
@Operation(summary = "查询所有启用的Beacon设备(轨迹检测用)")
|
||||
CommonResult<List<AreaDeviceDTO>> getAllEnabledBeacons();
|
||||
|
||||
// ==================== 按设备查询 ====================
|
||||
|
||||
|
||||
@@ -82,6 +82,23 @@ public interface AreaDeviceService {
|
||||
*/
|
||||
List<Long> getDeviceIdsByAreaAndType(Long areaId, String relationType);
|
||||
|
||||
/**
|
||||
* 查询所有启用的指定类型设备关联
|
||||
*
|
||||
* @param relationType 关联类型(BADGE/BEACON/TRAFFIC_COUNTER)
|
||||
* @return 所有启用的指定类型关联关系
|
||||
*/
|
||||
List<OpsAreaDeviceRelationDO> listAllByType(String relationType);
|
||||
|
||||
/**
|
||||
* 查询所有启用的 Beacon 设备关联
|
||||
* <p>
|
||||
* 用于轨迹检测功能,获取全量 Beacon 注册表
|
||||
*
|
||||
* @return 所有启用的 Beacon 类型关联关系
|
||||
*/
|
||||
List<OpsAreaDeviceRelationDO> listAllEnabledBeacons();
|
||||
|
||||
/**
|
||||
* 初始化区域设备配置缓存
|
||||
* <p>
|
||||
|
||||
@@ -163,6 +163,16 @@ public class AreaDeviceServiceImpl implements AreaDeviceService, InitializingBea
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OpsAreaDeviceRelationDO> listAllByType(String relationType) {
|
||||
return relationMapper.selectListByAreaIdAndRelationType(null, relationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OpsAreaDeviceRelationDO> listAllEnabledBeacons() {
|
||||
return listAllByType("BEACON");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initConfigCache() {
|
||||
log.info("[AreaDevice] 开始初始化区域设备配置缓存...");
|
||||
|
||||
@@ -37,6 +37,13 @@ public class AreaDeviceController {
|
||||
@Resource
|
||||
private AreaDeviceService areaDeviceService;
|
||||
|
||||
@GetMapping("/beacons/all")
|
||||
@Operation(summary = "查询所有启用的Beacon设备(轨迹检测用)")
|
||||
public CommonResult<List<AreaDeviceDTO>> getAllEnabledBeacons() {
|
||||
List<OpsAreaDeviceRelationDO> relations = areaDeviceService.listAllEnabledBeacons();
|
||||
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/{areaId}/badges")
|
||||
@Operation(summary = "查询区域的工牌设备列表")
|
||||
public CommonResult<List<AreaDeviceDTO>> getBadgesByArea(
|
||||
@@ -45,21 +52,21 @@ public class AreaDeviceController {
|
||||
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/{areaId}/devices")
|
||||
@Operation(summary = "查询区域设备列表(按类型)")
|
||||
public CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
|
||||
@PathVariable("areaId") Long areaId,
|
||||
@RequestParam(value = "relationType", required = false) String relationType) {
|
||||
|
||||
List<OpsAreaDeviceRelationDO> relations;
|
||||
if (relationType != null) {
|
||||
relations = areaDeviceService.listByAreaIdAndType(areaId, relationType);
|
||||
} else {
|
||||
relations = areaDeviceService.listByAreaId(areaId);
|
||||
}
|
||||
|
||||
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
|
||||
}
|
||||
@GetMapping("/{areaId}/devices")
|
||||
@Operation(summary = "查询区域设备列表(按类型)")
|
||||
public CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
|
||||
@PathVariable("areaId") Long areaId,
|
||||
@RequestParam(value = "relationType", required = false) String relationType) {
|
||||
|
||||
List<OpsAreaDeviceRelationDO> relations;
|
||||
if (relationType != null) {
|
||||
relations = areaDeviceService.listByAreaIdAndType(areaId, relationType);
|
||||
} else {
|
||||
relations = areaDeviceService.listByAreaId(areaId);
|
||||
}
|
||||
|
||||
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/device/{deviceId}/relation")
|
||||
@Operation(summary = "查询设备的关联关系")
|
||||
|
||||
Reference in New Issue
Block a user