longz
2026-04-21 7b6b14baf6a1081d2b7bcc8b803e0f834c5f165d
获取可改派司机列表
1个文件已添加
8个文件已修改
256 ■■■■■ 已修改文件
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/controller/CrossCityShiftController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/LineShiftDriverMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/mapping/LineShiftDriverMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/mapping/OrderCrossCityMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/ILineShiftDriverService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/warpper/OrderWarpper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/warpper/OtherDriverShiftWarpper.java 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/controller/CrossCityShiftController.java
@@ -5,6 +5,7 @@
import com.stylefeng.guns.modular.crossCity.server.ILineShiftDriverService;
import com.stylefeng.guns.modular.crossCity.warpper.DriverShiftListWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.LineShiftItemWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.OtherDriverShiftWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.ScanOrderDetailWarpper;
import com.stylefeng.guns.modular.system.service.IDriverService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
@@ -68,13 +69,13 @@
    }
    /**
     * 【202604】获取司机城际专线排班列表
     * 【202604】获取司机本人排班列表
     * @param request
     * @return
     */
    @ResponseBody
    @PostMapping("/queryMyDriverShiftList")
    @ApiOperation(value = "【202604】获取司机城际专线排班列表", tags = {"司机端-首页"}, notes = "获取司机在今天之后(包含今天)的城际专线排班信息")
    @ApiOperation(value = "【202604】获取司机本人排班列表", tags = {"司机端-首页"}, notes = "date为空查今天及之后,不为空仅查当天,支持分页")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "日期(yyyy-MM-dd),默认无", name = "date", required = false, dataType = "String"),
            @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
@@ -96,6 +97,32 @@
    }
    /**
     * 【202604】根据司机排班ID查询同班次其他司机信息
     * @param request
     * @return
     */
    @ResponseBody
    @GetMapping("/queryOtherDriverShiftListWithShiftId")
    @ApiOperation(value = "【202604】查询同班次其他司机信息", tags = {"司机端-首页"}, notes = "根据driverShiftId查询同lineShiftId且同day的其他司机信息")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "司机排班记录ID", name = "driverShiftId", required = true, dataType = "long"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<OtherDriverShiftWarpper>> queryOtherDriverShiftListWithShiftId(long driverShiftId, HttpServletRequest request) {
        try {
            Integer driverId = driverService.getUserIdFormRedis(request);
            if (null == driverId) {
                return ResultUtil.tokenErr();
            }
            List<OtherDriverShiftWarpper> result = lineShiftDriverService.queryOtherDriverShiftListWithShiftId(driverShiftId);
            return ResultUtil.success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    /**
     * 验证日期有效性
     * @param dateStr
     * @return
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/LineShiftDriverMapper.java
@@ -55,4 +55,11 @@
                                                     @Param("startDate") String startDate,
                                                     @Param("offset") Integer offset,
                                                     @Param("size") Integer size);
    /**
     * 【202604】根据司机排班id查询同班次其他司机信息
     * @param driverShiftId 司机排班id
     * @return 其他司机列表
     */
    List<Map<String, Object>> queryOtherDriverShiftListWithShiftId(@Param("driverShiftId") Long driverShiftId);
}
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/mapping/LineShiftDriverMapper.xml
@@ -182,4 +182,35 @@
        ORDER BY lsd.day ASC, ls.startTime ASC, lsd.id ASC
        LIMIT #{offset}, #{size}
    </select>
    <select id="queryOtherDriverShiftListWithShiftId" resultType="java.util.Map">
        SELECT
            other.id as lineShiftDriverId,
            d.headImgUrl as headImgUrl,
            d.name as driverName,
            c.carLicensePlate as carLicensePlate,
            CONCAT(IFNULL(cb.name, ''), IFNULL(cm.name, '')) as carModel,
            IFNULL(c.carColor, '') as carColor,
            other.laveSeat as laveSeat,
            other.totalSeat as totalSeat,
            IFNULL((
                SELECT ROUND(AVG(oe.fraction), 2)
                FROM t_order_evaluate oe
                WHERE oe.driverId = other.driverId
            ), 0) as score,
            ls.startTime as startTime
        FROM t_line_shift_driver cur
        INNER JOIN t_line_shift_driver other
            ON other.lineShiftId = cur.lineShiftId
            AND other.day = cur.day
            AND other.id != cur.id
        LEFT JOIN t_line_shift ls ON other.lineShiftId = ls.id
        LEFT JOIN t_driver d ON other.driverId = d.id
        LEFT JOIN t_car c ON d.carId = c.id
        LEFT JOIN t_car_brand cb ON c.carBrandId = cb.id
        LEFT JOIN t_car_model cm ON c.carModelId = cm.id
        WHERE cur.id = #{driverShiftId}
          AND ls.state = 1
        ORDER BY ls.startTime ASC, other.id ASC
    </select>
</mapper>
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/dao/mapping/OrderCrossCityMapper.xml
@@ -226,7 +226,8 @@
        a.peopleNumber as peopleNumber,
        a.payMoney as payMoney,
        a.payManner as payManner,
        a.seatNumber as seatNumber
        a.seatNumber as seatNumber,
        a.lineShiftDriverId as lineShiftDriverId
        from t_order_cross_city a
        left join t_user b on (a.userId = b.id)
        left join t_line_shift_driver c on (a.lineShiftDriverId = c.id)
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/ILineShiftDriverService.java
@@ -4,6 +4,7 @@
import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver;
import com.stylefeng.guns.modular.crossCity.warpper.DriverShiftListWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.LineShiftItemWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.OtherDriverShiftWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.ScanOrderDetailWarpper;
import com.stylefeng.guns.modular.system.util.ResultUtil;
@@ -41,6 +42,14 @@
     * @throws Exception
     */
    List<LineShiftItemWarpper> queryMyDriverShiftList(Integer driverId, String date, Integer pageNum, Integer size) throws Exception;
    /**
     * 【202604】根据司机排班id查询同班次其他司机信息
     * @param driverShiftId 司机排班id
     * @return 其他司机列表
     * @throws Exception
     */
    List<OtherDriverShiftWarpper> queryOtherDriverShiftListWithShiftId(Long driverShiftId) throws Exception;
    /**
     * 【202601】查询班次详情
     * @param lineShiftDriverId 班次id
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java
@@ -19,6 +19,7 @@
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
import com.stylefeng.guns.modular.crossCity.warpper.DriverShiftListWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.LineShiftItemWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.OtherDriverShiftWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.ScanOrderDetailWarpper;
import com.stylefeng.guns.modular.system.dao.CarModelMapper;
import com.stylefeng.guns.modular.system.dao.CarServiceMapper;
@@ -437,6 +438,15 @@
    }
    @Override
    public List<OtherDriverShiftWarpper> queryOtherDriverShiftListWithShiftId(Long driverShiftId) throws Exception {
        if (driverShiftId == null) {
            return new ArrayList<>();
        }
        List<Map<String, Object>> rows = lineShiftDriverMapper.queryOtherDriverShiftListWithShiftId(driverShiftId);
        return OtherDriverShiftWarpper.fromMaps(rows);
    }
    @Override
    public ResultUtil<ScanOrderDetailWarpper> getDetail(Integer lineShiftDriverId) {
        // 1. 查询基础数据
        Map<String, Object> data = lineShiftDriverMapper.getDetail(lineShiftDriverId);
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java
@@ -263,6 +263,9 @@
        OpenCity openCity = openCityService.openCity1(orderCrossCity.getStartLon().toString(), orderCrossCity.getStartLat().toString());
        Phone phone = phoneMapper.queryInfo(openCity.getId(), 1, 1);
        map.put("emergencyCall", null != phone ? phone.getPhone() : "110");
        if (!order.isEmpty()){
            map.put("lineShiftDriverId", order.get(0).get("lineShiftDriverId"));
        }
        map.put("orders", JSON.toJSONString(order));
        System.out.println("map"+map);
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/warpper/OrderWarpper.java
@@ -25,6 +25,8 @@
    private String realPhone;
    @ApiModelProperty("个人收入")
    private Double personalIncome;
    @ApiModelProperty("线路司机预约id")
    private Long lineShiftDriverId;
    public String getRealPhone() {
        return realPhone;
@@ -101,6 +103,14 @@
        this.personalIncome = personalIncome;
    }
    public Long getLineShiftDriverId() {
        return lineShiftDriverId;
    }
    public void setLineShiftDriverId(Long lineShiftDriverId) {
        this.lineShiftDriverId = lineShiftDriverId;
    }
    public static OrderWarpper getOrderWarpper(Map<String, Object> map){
        OrderWarpper orderWarpper = new OrderWarpper();
        if(null != map){
@@ -113,6 +123,7 @@
            orderWarpper.setEmergencyCall(null != map.get("emergencyCall") ? map.get("emergencyCall").toString() : "");
            orderWarpper.setRealPhone(null != map.get("realPhone") ? map.get("realPhone").toString() : "");
            orderWarpper.setPersonalIncome(null != map.get("personalIncome") ? Double.valueOf(map.get("personalIncome").toString()) : 0);
            orderWarpper.setLineShiftDriverId(null != map.get("lineShiftDriverId") ? Long.valueOf(map.get("lineShiftDriverId").toString()) : 0);
        }
        return orderWarpper;
    }
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/warpper/OtherDriverShiftWarpper.java
New file
@@ -0,0 +1,151 @@
package com.stylefeng.guns.modular.crossCity.warpper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ApiModel("同班次其他司机信息")
public class OtherDriverShiftWarpper {
    @ApiModelProperty("司机排班记录id")
    private Integer lineShiftDriverId;
    @ApiModelProperty("司机头像")
    private String headImgUrl;
    @ApiModelProperty("司机姓名")
    private String driverName;
    @ApiModelProperty("车牌号")
    private String carLicensePlate;
    @ApiModelProperty("车型")
    private String carModel;
    @ApiModelProperty("车辆颜色")
    private String carColor;
    @ApiModelProperty("可乘车人数")
    private Integer laveSeat;
    @ApiModelProperty("总人数")
    private Integer totalSeat;
    @ApiModelProperty("评分")
    private Double score;
    @ApiModelProperty("发车时间")
    private String startTime;
    public Integer getLineShiftDriverId() {
        return lineShiftDriverId;
    }
    public void setLineShiftDriverId(Integer lineShiftDriverId) {
        this.lineShiftDriverId = lineShiftDriverId;
    }
    public String getHeadImgUrl() {
        return headImgUrl;
    }
    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }
    public String getDriverName() {
        return driverName;
    }
    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }
    public String getCarLicensePlate() {
        return carLicensePlate;
    }
    public void setCarLicensePlate(String carLicensePlate) {
        this.carLicensePlate = carLicensePlate;
    }
    public String getCarModel() {
        return carModel;
    }
    public void setCarModel(String carModel) {
        this.carModel = carModel;
    }
    public String getCarColor() {
        return carColor;
    }
    public void setCarColor(String carColor) {
        this.carColor = carColor;
    }
    public Integer getLaveSeat() {
        return laveSeat;
    }
    public void setLaveSeat(Integer laveSeat) {
        this.laveSeat = laveSeat;
    }
    public Integer getTotalSeat() {
        return totalSeat;
    }
    public void setTotalSeat(Integer totalSeat) {
        this.totalSeat = totalSeat;
    }
    public Double getScore() {
        return score;
    }
    public void setScore(Double score) {
        this.score = score;
    }
    public String getStartTime() {
        return startTime;
    }
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    public static OtherDriverShiftWarpper fromMap(Map<String, Object> map) {
        OtherDriverShiftWarpper warpper = new OtherDriverShiftWarpper();
        if (map == null) {
            return warpper;
        }
        warpper.setLineShiftDriverId(map.get("lineShiftDriverId") == null ? null : Integer.valueOf(map.get("lineShiftDriverId").toString()));
        warpper.setHeadImgUrl(map.get("headImgUrl") == null ? "" : map.get("headImgUrl").toString());
        warpper.setDriverName(map.get("driverName") == null ? "" : map.get("driverName").toString());
        warpper.setCarLicensePlate(map.get("carLicensePlate") == null ? "" : map.get("carLicensePlate").toString());
        warpper.setCarModel(map.get("carModel") == null ? "" : map.get("carModel").toString());
        warpper.setCarColor(map.get("carColor") == null ? "" : map.get("carColor").toString());
        warpper.setLaveSeat(map.get("laveSeat") == null ? 0 : Integer.valueOf(map.get("laveSeat").toString()));
        warpper.setTotalSeat(map.get("totalSeat") == null ? 0 : Integer.valueOf(map.get("totalSeat").toString()));
        warpper.setScore(map.get("score") == null ? 0D : Double.valueOf(map.get("score").toString()));
        warpper.setStartTime(map.get("startTime") == null ? "" : map.get("startTime").toString());
        return warpper;
    }
    public static List<OtherDriverShiftWarpper> fromMaps(List<Map<String, Object>> maps) {
        List<OtherDriverShiftWarpper> list = new ArrayList<>();
        if (maps == null) {
            return list;
        }
        for (Map<String, Object> map : maps) {
            list.add(fromMap(map));
        }
        return list;
    }
}