|
|
@@ -1,19 +1,21 @@
|
|
|
package bus.service.impl;
|
|
|
|
|
|
import bus.model.SnowflakeUtil;
|
|
|
-import bus.model.dto.BBusInfoDto;
|
|
|
-import bus.model.dto.BBusTrackInfoDto;
|
|
|
-import bus.model.dto.BBusTrackTreeDto;
|
|
|
+import bus.model.dto.*;
|
|
|
import bus.model.dto.page.BBusInfoPageDto;
|
|
|
import bus.model.po.BCourseBusPo;
|
|
|
+import bus.model.po.BCourseInfoPo;
|
|
|
+import bus.model.po.BCourseStationPo;
|
|
|
import bus.model.vo.BBusInfoVo;
|
|
|
import bus.model.po.BBusInfoPo;
|
|
|
import bus.mapper.BBusInfoMapper;
|
|
|
|
|
|
-import bus.service.BBusInfoService;
|
|
|
-import bus.service.BCourseBusService;
|
|
|
+import bus.service.*;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.PhoneUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.orcas.common.sso.model.ExtInfo;
|
|
|
@@ -46,6 +48,12 @@ public class BBusInfoServiceImpl extends ServiceImpl<BBusInfoMapper,BBusInfoPo>
|
|
|
private BCourseBusService bCourseBusService;
|
|
|
@Resource
|
|
|
private SnowflakeUtil snowflakeUtil;
|
|
|
+ @Resource
|
|
|
+ BCourseInfoService bCourseInfoService;
|
|
|
+ @Resource
|
|
|
+ BCourseStationService bCourseStationService;
|
|
|
+ @Resource
|
|
|
+ BStationInfoService bStationInfoService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -166,13 +174,12 @@ public class BBusInfoServiceImpl extends ServiceImpl<BBusInfoMapper,BBusInfoPo>
|
|
|
BBusTrackTreeDto statusNode = new BBusTrackTreeDto();
|
|
|
statusNode.setStatus(status);
|
|
|
// 添加子节点(车辆)
|
|
|
- List<BBusInfoDto> children = buses.stream()
|
|
|
+ List<BTrackNameDto> children = buses.stream()
|
|
|
.map(bus -> {
|
|
|
- BBusInfoDto busNode = new BBusInfoDto();
|
|
|
+ BTrackNameDto busNode = new BTrackNameDto();
|
|
|
busNode.setId(bus.getId());
|
|
|
- busNode.setBusNo(bus.getBusNo());
|
|
|
- busNode.setBusName(bus.getBusName());
|
|
|
- busNode.setStatus(bus.getStatus());
|
|
|
+ busNode.setName(bus.getBusName());
|
|
|
+ busNode.setCode(bus.getBusNo());
|
|
|
return busNode;
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
@@ -199,4 +206,45 @@ public class BBusInfoServiceImpl extends ServiceImpl<BBusInfoMapper,BBusInfoPo>
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ public BTrackStationDto getPoint(String busId) {
|
|
|
+ BTrackStationDto dto = new BTrackStationDto();
|
|
|
+ QueryWrapper<BCourseBusPo> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("bus_id", busId);
|
|
|
+ queryWrapper.eq("is_delete", 0);
|
|
|
+ BCourseBusPo courseBus = (BCourseBusPo)this.bCourseBusService.getOne(queryWrapper);
|
|
|
+ if (courseBus == null) {
|
|
|
+ throw new BusinessException("该车辆未分配路线");
|
|
|
+ } else {
|
|
|
+ String courseId = courseBus.getCourseId();
|
|
|
+ BCourseInfoPo byId = (BCourseInfoPo)this.bCourseInfoService.getById(courseId);
|
|
|
+ if (byId == null) {
|
|
|
+ throw new BusinessException("该路线不存在");
|
|
|
+ } else {
|
|
|
+ List<BCourseStationPo> listByCourse = this.bCourseStationService.getListByCourse(courseId);
|
|
|
+ if (CollectionUtil.isNotEmpty(listByCourse)) {
|
|
|
+ List<String> stationIds = (List)listByCourse.stream().map(BCourseStationPo::getStationId).collect(Collectors.toList());
|
|
|
+ List<BStationPointDto> list = new ArrayList();
|
|
|
+ this.bStationInfoService.listByIds(stationIds).forEach((bStationInfoPo) -> {
|
|
|
+ BStationPointDto bCoursePointDto = new BStationPointDto();
|
|
|
+ bCoursePointDto.setLatitude(bCoursePointDto.getLatitude());
|
|
|
+ bCoursePointDto.setLongitude(bCoursePointDto.getLongitude());
|
|
|
+ bCoursePointDto.setId(bStationInfoPo.getId());
|
|
|
+ bCoursePointDto.setName(bStationInfoPo.getName());
|
|
|
+ list.add(bCoursePointDto);
|
|
|
+ });
|
|
|
+ dto.setSlist(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ String mapPoint = byId.getMapPoint();
|
|
|
+ if (StrUtil.isNotBlank(mapPoint)) {
|
|
|
+ List<BCoursePointDto> fileJsons = JSONUtil.toList(mapPoint, BCoursePointDto.class);
|
|
|
+ dto.setClist(fileJsons);
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setId(busId);
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|