fit:修改无人机类型表和接口,增加条件查询;增加拓恒云003-FM系列
This commit is contained in:
parent
a367415167
commit
1a90e9852f
|
|
@ -54,10 +54,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
/**
|
||||
* 按厂商分组查询无人机类型
|
||||
*
|
||||
* @param vo 无人机类型通用枚举VO
|
||||
* @return 按厂商分组的无人机类型列表
|
||||
*/
|
||||
@GetMapping("/vendorGroup")
|
||||
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendor()
|
||||
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendor(AirTypeGeneralEnumVO vo)
|
||||
{
|
||||
// 从数据字典获取无人机厂商类型
|
||||
R<List<SysDictData>> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER);
|
||||
|
|
@ -66,7 +67,8 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
if (dictResult.getData() != null)
|
||||
{
|
||||
// 获取所有无人机类型数据
|
||||
List<DeviceAirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO());
|
||||
DeviceAirTypeGeneralEnumDTO dto = DeviceAirTypeGeneralEnumVOConvert.to(vo);
|
||||
List<DeviceAirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(dto);
|
||||
List<AirTypeGeneralEnumVO> allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList);
|
||||
|
||||
// 为每个字典项创建分组
|
||||
|
|
@ -78,11 +80,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
|
||||
// 筛选属于当前厂商的无人机类型
|
||||
List<AirTypeGeneralEnumVO> vendorAirTypes = new ArrayList<>();
|
||||
for (AirTypeGeneralEnumVO vo : allVoList)
|
||||
for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : allVoList)
|
||||
{
|
||||
if (dictData.getDictValue().equals(vo.getVendorId().toString()))
|
||||
if (dictData.getDictValue().equals(airTypeGeneralEnumVO.getVendorId().toString()))
|
||||
{
|
||||
vendorAirTypes.add(vo);
|
||||
vendorAirTypes.add(airTypeGeneralEnumVO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,10 +98,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
/**
|
||||
* 按厂商分组查询无人机类型(厂商 -> 分类 -> 设备类型)
|
||||
*
|
||||
* @param vo 无人机类型通用枚举VO
|
||||
* @return 按厂商分组的无人机类型列表
|
||||
*/
|
||||
@GetMapping("/vendorGroupNew")
|
||||
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendorNew()
|
||||
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendorNew(AirTypeGeneralEnumVO vo)
|
||||
{
|
||||
// 从数据字典获取无人机厂商类型
|
||||
R<List<SysDictData>> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER);
|
||||
|
|
@ -108,7 +111,8 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
if (dictResult.getData() != null)
|
||||
{
|
||||
// 获取所有无人机类型数据(包括生效和失效的)
|
||||
List<DeviceAirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO());
|
||||
DeviceAirTypeGeneralEnumDTO dto = DeviceAirTypeGeneralEnumVOConvert.to(vo);
|
||||
List<DeviceAirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(dto);
|
||||
List<AirTypeGeneralEnumVO> allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList);
|
||||
|
||||
// 为每个字典项创建分组
|
||||
|
|
@ -120,26 +124,26 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
|
||||
// 筛选属于当前厂商的无人机类型
|
||||
List<AirTypeGeneralEnumVO> vendorAirTypes = new ArrayList<>();
|
||||
for (AirTypeGeneralEnumVO vo : allVoList)
|
||||
for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : allVoList)
|
||||
{
|
||||
if (dictData.getDictValue().equals(vo.getVendorId().toString()))
|
||||
if (dictData.getDictValue().equals(airTypeGeneralEnumVO.getVendorId().toString()))
|
||||
{
|
||||
vendorAirTypes.add(vo);
|
||||
vendorAirTypes.add(airTypeGeneralEnumVO);
|
||||
}
|
||||
}
|
||||
|
||||
// 按分类分组
|
||||
Map<String, List<AirTypeGeneralEnumVO>> categoryMap = new HashMap<>();
|
||||
for (AirTypeGeneralEnumVO vo : vendorAirTypes)
|
||||
for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : vendorAirTypes)
|
||||
{
|
||||
String category = vo.getCategory();
|
||||
String category = airTypeGeneralEnumVO.getCategory();
|
||||
if (category == null || category.isEmpty()) {
|
||||
category = "其他";
|
||||
}
|
||||
if (!categoryMap.containsKey(category)) {
|
||||
categoryMap.put(category, new ArrayList<>());
|
||||
}
|
||||
categoryMap.get(category).add(vo);
|
||||
categoryMap.get(category).add(airTypeGeneralEnumVO);
|
||||
}
|
||||
|
||||
// 构建分类分组列表
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `device_air_type_general_enum` (
|
|||
`category` VARCHAR(255) DEFAULT NULL COMMENT '分类',
|
||||
`enabled` TINYINT DEFAULT 0 COMMENT '是否生效:0-失效,1-生效',
|
||||
`vendor_id` BIGINT DEFAULT NULL COMMENT '厂商ID',
|
||||
`domain` BIGINT DEFAULT NULL COMMENT '领域',
|
||||
`domain` BIGINT DEFAULT NULL COMMENT '领域:0:无人机;2:遥控器;3:机场',
|
||||
`type` BIGINT DEFAULT NULL COMMENT '主类型',
|
||||
`sub_type` BIGINT DEFAULT NULL COMMENT '子类型',
|
||||
`icon` VARCHAR(255) DEFAULT NULL COMMENT '图标',
|
||||
|
|
@ -54,3 +54,7 @@ INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, do
|
|||
('大疆机场', '机场', 0, 1, 3, 1, 0, '-'),
|
||||
('大疆机场 2', '机场', 0, 1, 3, 2, 0, '-'),
|
||||
('大疆机场 3', '机场', 0, 1, 3, 3, 0, '-');
|
||||
|
||||
-- 拓恒无人机系列
|
||||
INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES
|
||||
('云003-FM', '云', 1, 0, 0, 1, 0, '-');
|
||||
|
|
|
|||
Loading…
Reference in New Issue