zy 7 hónapja
szülő
commit
5b4ce8dcb3

+ 2 - 0
bus-biz/src/main/java/bus/mapper/BCourseInfoMapper.java

@@ -24,6 +24,8 @@ public interface BCourseInfoMapper extends BaseMapper<BCourseInfoPo> {
     List<BCourseInfoVo> list(BCourseInfoPageDto dto);
 
     List<BStationInfoDto> findNearbyStations(NearbyRoutesDto nearbyRoutesDto);
+
+    List<BStationInfoDto> findAllbyStations(NearbyRoutesDto nearbyRoutesDto);
     List<BCourseInfoVo> findRoutesByStations(@Param("stationIds") List<String> stationIds);
 
     List<BCourseInfoVo> findRoutesByStationId(@Param("stationIds") List<String> stationIds);

+ 6 - 1
bus-biz/src/main/java/bus/service/impl/BCourseInfoServiceImpl.java

@@ -429,7 +429,12 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
         }
 
         // 1. 查询附近站点
-        List<BStationInfoDto> nearbyStations = bCourseInfoMapper.findNearbyStations(nearbyRoutesDto);
+        List<BStationInfoDto> nearbyStations = null;
+        if(nearbyRoutesDto.getIsAll().equals("0")) {
+            nearbyStations = bCourseInfoMapper.findAllbyStations(nearbyRoutesDto);
+        }else{
+            nearbyStations = bCourseInfoMapper.findNearbyStations(nearbyRoutesDto);
+        }
         if (CollectionUtil.isEmpty(nearbyStations)) {
             return Collections.emptyList();
         }

+ 34 - 34
bus-biz/src/main/resources/mapper/BCourseInfoMapper.xml

@@ -44,41 +44,41 @@
  </select>
 
     <!-- 查询附近站点 -->
-<!--    <select id="findNearbyStations" resultType="bus.model.dto.BStationInfoDto"-->
-<!--            parameterType="bus.model.dto.NearbyRoutesDto" >-->
-<!--        SELECT-->
-<!--        id,-->
-<!--        name,-->
-<!--        latitude,-->
-<!--        longitude,-->
-<!--        ROUND(-->
-<!--        6378.137 * 2 * ASIN(-->
-<!--        SQRT(-->
-<!--        POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +-->
-<!--        COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *-->
-<!--        POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)-->
-<!--        )-->
-<!--        ) * 1000-->
-<!--        , 2) AS distance-->
-<!--        FROM b_station_info-->
-<!--        WHERE-->
-<!--        is_delete = 0-->
-<!--        AND latitude BETWEEN #{latitude} -  #{radius} / 111300 AND #{latitude} + #{radius} / 111300-->
-<!--        AND longitude BETWEEN #{longitude} - #{radius} / (111300 * COS(#{latitude} * PI() / 180))-->
-<!--        AND #{longitude} + #{radius} / (111300 * COS(#{latitude} * PI() / 180))-->
-<!--        AND (-->
-<!--        6378.137 * 2 * ASIN(-->
-<!--        SQRT(-->
-<!--        POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +-->
-<!--        COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *-->
-<!--        POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)-->
-<!--        )-->
-<!--        ) * 1000-->
-<!--        ) &lt;= #{radius}-->
-<!--        ORDER BY distance-->
-<!--    </select>-->
-
     <select id="findNearbyStations" resultType="bus.model.dto.BStationInfoDto"
+            parameterType="bus.model.dto.NearbyRoutesDto" >
+        SELECT
+        id,
+        name,
+        latitude,
+        longitude,
+        ROUND(
+        6378.137 * 2 * ASIN(
+        SQRT(
+        POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +
+        COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *
+        POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)
+        )
+        ) * 1000
+        , 2) AS distance
+        FROM b_station_info
+        WHERE
+        is_delete = 0
+        AND latitude BETWEEN #{latitude} -  #{radius} / 111300 AND #{latitude} + #{radius} / 111300
+        AND longitude BETWEEN #{longitude} - #{radius} / (111300 * COS(#{latitude} * PI() / 180))
+        AND #{longitude} + #{radius} / (111300 * COS(#{latitude} * PI() / 180))
+        AND (
+        6378.137 * 2 * ASIN(
+        SQRT(
+        POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +
+        COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *
+        POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)
+        )
+        ) * 1000
+        ) &lt;= #{radius}
+        ORDER BY distance
+    </select>
+
+    <select id="findAllbyStations" resultType="bus.model.dto.BStationInfoDto"
             parameterType="bus.model.dto.NearbyRoutesDto">
         SELECT
             id,

+ 1 - 2
bus-biz/src/main/resources/mapper/BCoursePreMapper.xml

@@ -29,8 +29,7 @@
       a.pre_time as preTime,
       b.pre_date as preDate,
       c.course_name as courseName,
-      d.id as preBusId,
-      d.bus_code as busCode,
+      d.bus_no as busCode,
       d.pre_status as preStatus,
       d.id as preBusId
 

+ 2 - 1
bus-common/src/main/java/bus/model/dto/NearbyRoutesDto.java

@@ -16,5 +16,6 @@ public class NearbyRoutesDto {
 
     @ApiModelProperty("站点名称")
     private String stationName;
-
+    @ApiModelProperty("全部路线0 附近路线1")
+    private String isAll = "0";
 }

+ 1 - 0
bus-web/src/main/java/bus/controller/biz/BCoursePreController.java

@@ -94,6 +94,7 @@ public class BCoursePreController implements BaseController {
     @ApiOperation("路线时刻人数列表")
     @PostMapping(value = "getPreUserNum")
     PageSerializable<BCourseUserPrePageDto> getPreUserNum(@RequestBody BCourseUserPreReqDto reqDto){
+        PageHelper.startPage(reqDto.getPageNum(),reqDto.getPageSize());
         return new PageSerializable<>(bCoursePreService.getPreUserNum(reqDto));
     }
 

+ 1 - 1
bus-web/src/main/java/bus/controller/biz/WChatUserController.java

@@ -95,7 +95,7 @@ public class WChatUserController implements BaseController {
         }
         JSONObject jsonObj = new JSONObject(json);
         if(jsonObj.get(ERROR_CODE_STR)!=null && jsonObj.get(ERROR_CODE_STR,Integer.class)!=0){
-            throw new BusinessException("小程序登录失败");
+            throw new BusinessException("小程序获取openid失败");
         }
         Map<String,String> map = new HashMap<>();
         String openId = (String)jsonObj.get("openid");