zy пре 7 месеци
родитељ
комит
0b78b74054

+ 13 - 0
bus-biz/src/main/java/bus/service/BCourseInfoService.java

@@ -95,4 +95,17 @@ public interface BCourseInfoService extends IService<BCourseInfoPo> {
 
 
     List<WBusInfoDto> getCourseBusByCourseId(String courseId);
+
+    /**
+     * 根据路线,标记点名称搜索路线
+     * @param name
+     * @return
+     */
+    List<FindTypeDto> findRoute(String name);
+
+    /**
+     * 小程序所选的站点名称,列出所有路线
+     */
+    FindStationDetailDto findStationDetail(String stationId);
+
 }

+ 75 - 0
bus-biz/src/main/java/bus/service/impl/BCourseInfoServiceImpl.java

@@ -844,4 +844,79 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
         }
         return CollectionUtil.newArrayList();
     }
+
+    /**
+     * 根据路线,标记点名称搜索路线
+     *
+     * @param name
+     * @return
+     */
+    @Override
+    public List<FindTypeDto> findRoute(String name) {
+        List<FindTypeDto> listType = CollectionUtil.newArrayList();
+        List<FindResultDto> result = CollectionUtil.newArrayList();
+        QueryWrapper<BCourseInfoPo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.like("course_name", name);
+        List<BCourseInfoPo> list = bCourseInfoMapper.selectList(queryWrapper);
+        if(CollectionUtil.isNotEmpty(list)) {
+            for (BCourseInfoPo bCourseInfoPo : list) {
+                FindResultDto dto2 = new FindResultDto();
+                dto2.setId(bCourseInfoPo.getId());
+                dto2.setName(bCourseInfoPo.getCourseName());
+                dto2.setType("0");
+                result.add(dto2);
+            }
+        }
+        FindTypeDto dto1 = new FindTypeDto();
+        dto1.setType("0");
+        dto1.setDtoList(result);
+        listType.add(dto1);
+
+        List<FindResultDto> result1 = CollectionUtil.newArrayList();
+        QueryWrapper<BStationInfoPo> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.like("name", name);
+        List<BStationInfoPo> list2 = bStationInfoService.list(queryWrapper2);
+        if(CollectionUtil.isNotEmpty(list2)) {
+            for (BStationInfoPo bStationInfoPo : list2) {
+                FindResultDto dto = new FindResultDto();
+                dto.setId(bStationInfoPo.getId());
+                dto.setName(bStationInfoPo.getName());
+                dto.setType("1");
+                result1.add(dto);
+            }
+        }
+        FindTypeDto dto3 = new FindTypeDto();
+        dto3.setType("1");
+        dto3.setDtoList(result1);
+        listType.add(dto3);
+        return listType;
+    }
+
+    /**
+     * 小程序所选的站点,列出所有路线
+     *
+     * @param stationId
+     */
+    @Override
+    public FindStationDetailDto findStationDetail(String stationId) {
+        FindStationDetailDto findStationDetailDto = new FindStationDetailDto();
+        BStationInfoDto detailById = bStationInfoService.getDetailById(stationId);
+        BStationPointDto bStationPointDto = BeanUtil.toBean(detailById, BStationPointDto.class);
+        findStationDetailDto.setSList(Arrays.asList(bStationPointDto));
+        //更具站点id查询路线
+        QueryWrapper<BCourseStationPo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("station_id", stationId);
+        List<BCourseStationPo> list = bCourseStationService.list(queryWrapper);
+        if(CollectionUtil.isNotEmpty(list)) {
+            // 获取路线Id 列表并去重
+            List<String> courseIdList = list.stream().map(BCourseStationPo::getCourseId).distinct().collect(Collectors.toList());
+            //根据路线id查询路线信息
+            List<BCourseInfoPo> list1 = bCourseInfoMapper.selectBatchIds(courseIdList);
+            List<WCourseInfoByTypeDto> wCourseInfoByTypeDtos = BeanUtil.copyToList(list1, WCourseInfoByTypeDto.class);
+            findStationDetailDto.setWList(wCourseInfoByTypeDtos);
+        }
+        return findStationDetailDto;
+    }
+
+
 }

+ 1 - 1
bus-boot/src/main/resources/bootstrap-dev.yaml

@@ -45,7 +45,7 @@ orcas:
     logout:
       path: /logout
     excluded:
-      paths: /swagger-ui.html,/webjars/**,/swagger-resources/**,/v2/api-docs,/doc.html,/wChatUser/auto/login,/wChatUser/getPhoneNumber,/wChatUser/encryptedDataber,/wChatUser/getXcxOpenId,/bNoticeInfo/list,/bCourseInfo/etNearbyRoutes,/bCourseInfo/getCourseDetail,/bCourseInfo/getAllCourseByType,/bAdvert/list,/bNoticeUser/getNoticeInfoList,/bCourseInfo/getNearbyRoutes,/bStationInfo/getStationTypeList,/bCourseInfo/getDetailById,/bBusTrackInfo/getAllPoint,/bNoticeInfo/getDetailById,/bAdvert/getDetailById,/bBusTrackInfo/getPointByBusId
+      paths: /swagger-ui.html,/webjars/**,/swagger-resources/**,/v2/api-docs,/doc.html,/wChatUser/auto/login,/wChatUser/getPhoneNumber,/wChatUser/encryptedDataber,/wChatUser/getXcxOpenId,/bNoticeInfo/list,/bCourseInfo/etNearbyRoutes,/bCourseInfo/getCourseDetail,/bCourseInfo/getAllCourseByType,/bAdvert/list,/bNoticeUser/getNoticeInfoList,/bCourseInfo/getNearbyRoutes,/bStationInfo/getStationTypeList,/bCourseInfo/getDetailById,/bBusTrackInfo/getAllPoint,/bNoticeInfo/getDetailById,/bAdvert/getDetailById,/bBusTrackInfo/getPointByBusId,/bCourseInfo/findRoute,/bCourseInfo/findStationDetail
 
 file-store:
   go-fastdfs:

+ 12 - 0
bus-common/src/main/java/bus/model/dto/FindResultDto.java

@@ -0,0 +1,12 @@
+package bus.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class FindResultDto {
+    private String id;
+    @ApiModelProperty(value = "类型 0路线 1标记点")
+    private String type;
+    private String name;
+}

+ 15 - 0
bus-common/src/main/java/bus/model/dto/FindStationDetailDto.java

@@ -0,0 +1,15 @@
+package bus.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FindStationDetailDto {
+    @ApiModelProperty("站点信息")
+    List<BStationPointDto> sList;
+    @ApiModelProperty("路线信息")
+    List<WCourseInfoByTypeDto> wList;
+
+}

+ 13 - 0
bus-common/src/main/java/bus/model/dto/FindTypeDto.java

@@ -0,0 +1,13 @@
+package bus.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FindTypeDto {
+    @ApiModelProperty(value = "类型 0路线 1标记点")
+    private String type;
+    List<FindResultDto> dtoList;
+}

+ 20 - 0
bus-web/src/main/java/bus/controller/biz/BCourseInfoController.java

@@ -146,4 +146,24 @@ public class BCourseInfoController implements BaseController {
         WCourseDetailDto courseDetail = bCourseInfoService.getCourseDetail(courseId);
         return courseDetail;
     }
+
+    /**
+     * 根据路线,标记点名称搜索路线
+     * @param name
+     * @return
+     */
+    @GetMapping(value = "findRoute")
+    @ApiOperation("小程序-根据路线,标记点名称搜索路线")
+    List<FindTypeDto> findRoute(@RequestParam String name){
+        return bCourseInfoService.findRoute(name);
+    }
+
+    /**
+     * 小程序所选的站点名称,列出所有路线
+     */
+    @GetMapping(value = "findStationDetail")
+    @ApiOperation("小程序所选的站点id,列出所有路线")
+    FindStationDetailDto findStationDetail(String stationId){
+        return bCourseInfoService.findStationDetail(stationId);
+    }
 }