Преглед изворни кода

上车提醒和下次提醒

fllmoyu пре 4 година
родитељ
комит
445b3a7fa4

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/RouteStationDTO.java

@@ -11,5 +11,7 @@ public class RouteStationDTO {
 
     private String id;
 
+    private String stationId;
+
     private String name;
 }

+ 12 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationRemind.java

@@ -27,6 +27,9 @@ public class StationRemind {
      */
     @ApiModelProperty(value = "起始站点编号")
     private String startStationId;
+
+    @ApiModelProperty(value = "终点站id")
+    private String endStationId;
     /**
      * 提醒站点编号
      */
@@ -57,6 +60,9 @@ public class StationRemind {
      */
     @ApiModelProperty(value = "班次编号(下车提醒用)")
     private String vehicleShiftId;
+
+    @ApiModelProperty(value = "线路id")
+    private String routeId;
     /**
      * 创建人
      */
@@ -86,4 +92,10 @@ public class StationRemind {
      */
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
+
+    private String routeName;
+
+    private String endStationName;
+
+    private String remindStationName;
 }

+ 17 - 10
common/src/main/resources/mapper/bus/StationRemind.xml

@@ -6,12 +6,14 @@
     <resultMap id="StationRemindMap" type="com.jpsoft.bus.modules.bus.entity.StationRemind">
         <id property="id" column="id_"/>
         <result property="startStationId" column="start_station_id"/>
+        <result property="endStationId" column="end_station_id"/>
         <result property="remindStationId" column="remind_station_id"/>
         <result property="advanceStationId" column="advance_station_id"/>
         <result property="stopInAdvance" column="stop_in_advance"/>
         <result property="openId" column="open_id"/>
         <result property="remindType" column="remind_type"/>
         <result property="vehicleShiftId" column="vehicle_shift_id"/>
+        <result property="routeId" column="route_id"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
@@ -26,18 +28,20 @@
         -->
         <![CDATA[
 		insert into bus_station_remind
-	    (id_,start_station_id,remind_station_id,advance_station_id,
-	    stop_in_advance,open_id,remind_type,vehicle_shift_id,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,start_station_id,end_station_id,remind_station_id,advance_station_id,
+	    stop_in_advance,open_id,remind_type,vehicle_shift_id,route_id,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
             #{id,jdbcType= VARCHAR }
             ,#{startStationId,jdbcType=VARCHAR}
+            ,#{endStationId,jdbcType=VARCHAR}
             ,#{remindStationId,jdbcType=VARCHAR}
             ,#{advanceStationId,jdbcType=VARCHAR}
             ,#{stopInAdvance,jdbcType= NUMERIC }
             ,#{openId,jdbcType=VARCHAR}
             ,#{remindType,jdbcType= NUMERIC }
             ,#{vehicleShiftId,jdbcType=VARCHAR}
+            ,#{routeId,jdbcType=VARCHAR}
             ,#{createBy,jdbcType=VARCHAR}
             ,#{createTime,jdbcType= TIMESTAMP }
             ,#{updateBy,jdbcType=VARCHAR}
@@ -55,6 +59,9 @@
             <if test="startStationId!=null">
                 start_station_id=#{startStationId,jdbcType=VARCHAR},
             </if>
+            <if test="endStationId!=null">
+                end_station_id=#{endStationId,jdbcType=VARCHAR},
+            </if>
             <if test="remindStationId!=null">
                 remind_station_id=#{remindStationId,jdbcType=VARCHAR},
             </if>
@@ -73,6 +80,9 @@
             <if test="vehicleShiftId!=null">
                 vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
             </if>
+            <if test="routeId!=null">
+                route_id=#{routeId,jdbcType=VARCHAR},
+            </if>
             <if test="createBy!=null">
                 create_by=#{createBy,jdbcType=VARCHAR},
             </if>
@@ -92,10 +102,7 @@
         where id_=#{id}
     </update>
     <select id="get" parameterType="string" resultMap="StationRemindMap">
-        select
-        id_,start_station_id,remind_station_id,stop_in_advance,advance_station_id,
-        open_id,remind_type,vehicle_shift_id,create_by,create_time,update_by,update_time,del_flag
-        from bus_station_remind
+        select * from bus_station_remind
         where id_=#{0}
     </select>
     <select id="exist" parameterType="string" resultType="int">
@@ -136,10 +143,10 @@
 
     <select id="findByOpenId" resultMap="StationRemindMap">
         <![CDATA[
-        select * from bus_station_remind
-        where del_flag = 0
-        and open_id = #{openId}
-        order by create_time desc
+        select a.* from bus_station_remind a
+        where a.del_flag = 0
+        and a.open_id = #{openId}
+        order by a.create_time desc
         ]]>
     </select>
 </mapper>

+ 35 - 0
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

@@ -1170,6 +1170,7 @@ public class PassengerApiController {
                     for (StationInfo stationInfo : stationInfoList) {
                         RouteStationDTO routeStationDTO = new RouteStationDTO();
                         routeStationDTO.setId(stationInfo.getRouteId());
+                        routeStationDTO.setStationId(stationInfo.getId());
                         routeStationDTO.setName(stationInfo.getName());
                         list.add(routeStationDTO);
                     }
@@ -1761,7 +1762,41 @@ public class PassengerApiController {
 
         try {
 
+
             List<StationRemind> stationRemindList = stationRemindService.findByOpenId(openId);
+            if (stationRemindList.size()>0){
+                for (StationRemind stationRemind : stationRemindList){
+
+                    if (StringUtils.isNotBlank(stationRemind.getVehicleShiftId())){
+                        ShiftInfo shiftInfo = shiftInfoService.get(stationRemind.getVehicleShiftId());
+                        if ("1".equals(shiftInfo.getStatus())){
+                            RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+                            //终点站
+                            StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
+                            //提醒站
+                            StationInfo remindStation = stationInfoService.get(stationRemind.getRemindStationId());
+                            stationRemind.setRouteName(routeInfo.getName());
+                            stationRemind.setEndStationName(endStation.getName());
+                            stationRemind.setRemindStationName(remindStation.getName());
+                        }
+
+                    }
+                    if (StringUtils.isNotBlank(stationRemind.getRouteId())){
+                        RouteInfo routeInfo = routeInfoService.get(stationRemind.getRouteId());
+                        //终点站
+                        StationInfo endStation = stationInfoService.get(stationRemind.getEndStationId());
+                        //提醒站
+                        StationInfo remindStation = stationInfoService.get(stationRemind.getRemindStationId());
+                        stationRemind.setRouteName(routeInfo.getName());
+                        stationRemind.setEndStationName(endStation.getName());
+                        stationRemind.setRemindStationName(remindStation.getName());
+                    }
+
+                }
+            }
+
+
+
 
             messageResult.setData(stationRemindList);
             messageResult.setResult(true);

+ 7 - 2
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/StationRemindApiController.java

@@ -55,14 +55,16 @@ public class StationRemindApiController {
     @PostMapping("add")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "startStationId", value = "起始站点编号", paramType = "form"),
+            @ApiImplicitParam(name = "endStationId", value = "终点站站点编号", paramType = "form"),
             @ApiImplicitParam(name = "remindStationId", value = "提醒站点编号", paramType = "form"),
             @ApiImplicitParam(name = "stopInAdvance", value = "提前多少站通知", paramType = "form"),
             @ApiImplicitParam(name = "remindType", value = "提醒类型(1-上车,2-下车)", paramType = "form"),
             @ApiImplicitParam(name = "vehicleShiftId", value = "车辆班次编号", paramType = "form", allowEmptyValue = true),
+            @ApiImplicitParam(name = "routeId", value = "线路id", paramType = "form", allowEmptyValue = true),
             @ApiImplicitParam(name = "openId", value = "微信openId", paramType = "form")
     })
-    public MessageResult<StationRemind> add(String startStationId, String remindStationId, Integer stopInAdvance,
-                                            Integer remindType, String vehicleShiftId, String openId) {
+    public MessageResult<StationRemind> add(String startStationId, String endStationId, String remindStationId, Integer stopInAdvance,
+                                            Integer remindType, String vehicleShiftId, String routeId,String openId) {
         MessageResult<StationRemind> msgResult = new MessageResult<>();
 
         try {
@@ -78,8 +80,11 @@ public class StationRemindApiController {
                 stationRemind.setAdvanceStationId(advanceStation.getId());
             }
 
+
+            stationRemind.setEndStationId(endStationId);
             stationRemind.setRemindType(remindType);
             stationRemind.setVehicleShiftId(vehicleShiftId);
+            stationRemind.setRouteId(routeId);
             stationRemind.setOpenId(openId);
             stationRemind.setDelFlag(false);
             stationRemind.setCreateBy(openId);