|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IotEquipmentMapper iotEquipmentMapper; |
|
|
private final IotEquipmentMapper iotEquipmentMapper; |
|
|
|
|
|
|
|
|
private final RoadInformationMapper roadInformationMapper; |
|
|
|
|
|
|
|
|
|
|
|
private final SectionMapper sectionMapper; |
|
|
|
|
|
|
|
|
|
|
|
public JsonResult getList(QueryIotEquipmentListRequest request) { |
|
|
public JsonResult getList(QueryIotEquipmentListRequest request) { |
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
JsonResult result = this.check(request); |
|
|
JsonResult result = this.check(request); |
|
|
|
|
|
|
|
|
log.info("查询物联设备列表:校验失败:{}", result.getMsg()); |
|
|
log.info("查询物联设备列表:校验失败:{}", result.getMsg()); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 获取部门Id的查询范围 |
|
|
// 获取部门Id的查询范围 |
|
|
List<String> deptIdList = this.getDeptIdList(user); |
|
|
List<String> deptIdList = this.getDeptIdList(user); |
|
|
request.setDeptIdList(deptIdList); |
|
|
request.setDeptIdList(deptIdList); |
|
|
|
|
|
|
|
|
|
|
|
request.setTenantId(user.getTenantId()); |
|
|
List<IotEquipment> iotEquipmentList = iotEquipmentMapper.selectList(request); |
|
|
List<IotEquipment> iotEquipmentList = iotEquipmentMapper.selectList(request); |
|
|
|
|
|
|
|
|
List<IotEquipmentVo> iotEquipmentVoList = this.buildIotEquipmentVoList(iotEquipmentList); |
|
|
List<IotEquipmentVo> iotEquipmentVoList = this.buildIotEquipmentVoList(iotEquipmentList); |
|
|
|
|
|
|
|
|
return JsonResult.success(iotEquipmentVoList); |
|
|
return JsonResult.success(iotEquipmentVoList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<IotEquipmentVo> iotEquipmentVoList = IotEquipmentConverMapper.INSTANCE.fromIotEquipmentToIotEquipmentVoList(iotEquipmentList); |
|
|
List<IotEquipmentVo> iotEquipmentVoList = IotEquipmentConverMapper.INSTANCE.fromIotEquipmentToIotEquipmentVoList(iotEquipmentList); |
|
|
return iotEquipmentVoList; |
|
|
return iotEquipmentVoList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取公路列表,放到map,减少循环次数 |
|
|
|
|
|
* |
|
|
|
|
|
* @param iotEquipmentList |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, RoadInformation> getRoadInformationMap(List<IotEquipment> iotEquipmentList) { |
|
|
|
|
|
List<String> roadInformationIdList = iotEquipmentList.stream().map(o -> o.getRoadId()).collect(Collectors.toList()); |
|
|
|
|
|
List<RoadInformation> roadInformationList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>() |
|
|
|
|
|
.in(RoadInformation::getId, roadInformationIdList) |
|
|
|
|
|
.eq(RoadInformation::getMark, MarkEnum.VALID.getCode())); |
|
|
|
|
|
Map<String, RoadInformation> roadInformationMap = roadInformationList.stream().collect(Collectors.toMap(RoadInformation::getId, Function.identity())); |
|
|
|
|
|
return roadInformationMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取路段列表,放到map,减少循环次数 |
|
|
|
|
|
* |
|
|
|
|
|
* @param iotEquipmentList |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, Section> getSectionMap(List<IotEquipment> iotEquipmentList) { |
|
|
|
|
|
List<String> sectionIdList = iotEquipmentList.stream().map(o -> o.getRoadId()).collect(Collectors.toList()); |
|
|
|
|
|
List<Section> roadInformationList = sectionMapper.selectList(new LambdaQueryWrapper<Section>() |
|
|
|
|
|
.in(Section::getId, sectionIdList) |
|
|
|
|
|
.eq(Section::getMark, MarkEnum.VALID.getCode())); |
|
|
|
|
|
Map<String, Section> sectionMap = roadInformationList.stream().collect(Collectors.toMap(Section::getId, Function.identity())); |
|
|
|
|
|
return sectionMap; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |