puzhibing
2023-02-24 b4d8cb69ff3a3d35a10a7e5c487ff683b31cc9f1
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java
@@ -104,15 +104,13 @@
         * 司机上线且空闲,下单直接给当前司机,其余进大厅
         * 司机下的订单不需要创建新用户,且只能走线下支付
         */
        int count = this.selectCount(new EntityWrapper<Order>().eq("userPhone", addOrderWarpper.getPhone()).eq("status", 1).in("state", Arrays.asList(101, 102, 103, 104, 105, 106, 201)));
        if(count > 0){
            return ResultUtil.error("该用户还有未完成的订单");
        }
        Driver driver = driverService.selectById(uid);
        DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1));
        if(null == driverWork){
            return ResultUtil.error("请先上班");
        }
        Order order1 = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201)));
        Order order = new Order();
        if(driverWork != null && null == order1){
@@ -577,8 +575,19 @@
    }
    /**
     * 获取订单详情
     * @param orderId
     * @return
     * @throws Exception
     */
    @Override
    public OrderInfoWarpper queryOrderInfo(Long orderId) throws Exception {
        return null;
    public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception {
        OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(orderId);
        String value = redisUtil.getValue("DRIVER" + uid);
        Map<String, Double> distance = GeodesyUtil.getDistance(orderInfoWarpper.getStartLng() + "," + orderInfoWarpper.getStartLat(), value);
        Double wgs84 = distance.get("WGS84");
        orderInfoWarpper.setCurrentDistance(wgs84);
        return orderInfoWarpper;
    }
}