| | |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | |
| | | |
| | | public ResponseWarpper<> queryOrderInfo(Long orderId, HttpServletRequest request){ |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ServiceLog(name = "获取订单详情", url = "/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取订单详情", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderInfoWarpper> queryOrderInfo(Long orderId, HttpServletRequest request){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.receiveOrder(uid, orderId); |
| | | return ResponseWarpper.success(resultUtil); |
| | | OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); |
| | | return ResponseWarpper.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public ResponseWarpper driverProcessOperations(Long orderId, Integer state, HttpServletRequest request){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | if(null == state){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("state")); |
| | | } |
| | | try { |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<HallOrderList> queryOrderHall(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(@Param("orderId") Long orderId); |
| | | } |
| | |
| | | left join t_app_user b on (a.userId = b.id) |
| | | where a.`status` = 1 and a.hallOrder = 1 order by a.createTime desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryOrderInfo" resultType="com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper"> |
| | | select |
| | | a.id, |
| | | b.avatar, |
| | | a.userName, |
| | | a.userPhone, |
| | | (select count(1) from t_order where userPhone = a.userPhone and state in (107, 108)) as orderTimes, |
| | | (select count(1) from t_order where userPhone = a.userPhone and state in (301)) as cancelTimes, |
| | | a.source, |
| | | UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, |
| | | a.startAddress, |
| | | a.startLat, |
| | | a.startLng, |
| | | a.endAddress, |
| | | a.endLat, |
| | | a.endLng, |
| | | a.estimatedPrice, |
| | | a.estimatedMileage, |
| | | a.startPrice, |
| | | a.waitTime, |
| | | a.actualMileage, |
| | | a.state, |
| | | (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(a.startTime)) / 60 as travelTime |
| | | from t_order a |
| | | left join t_app_user b on (a.userId = b.id) |
| | | where a.id = #{orderId} |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.BaseWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | ResultUtil receiveOrder(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | |
| | | queryOrderInfo(Long orderId) throws Exception; |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception; |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | |
| | | @Override |
| | | public List<HallOrderList> queryOrderHall(Integer uid, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | List<HallOrderList> hallOrderLists = this.baseMapper.queryOrderHall(pageNum, pageSize); |
| | | hallOrderLists.forEach(hallOrderList -> { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(hallOrderList.getStartLng() + "," + hallOrderList.getStartLat(), hallOrderList.getEndLng() + "," + hallOrderList.getEndLat()); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(hallOrderList.getStartLng() + "," + hallOrderList.getStartLat(), value); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | hallOrderList.setCurrentDistance(wgs84); |
| | | }); |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | 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; |
| | | } |
| | | } |
| | |
| | | private Double estimatedMileage; |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("等待时长") |
| | | private Integer waitTime; |
| | | @ApiModelProperty("行驶里程") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("行驶时间") |
| | | private Integer travelTime; |
| | | @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待评价,108=已完成,201=转单中,301=已取消)") |
| | | private Integer state; |
| | | } |