| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.pc.store.service.StoreService; |
| | | import com.oying.modules.rider.domain.RiderIncomeDetail; |
| | | import com.oying.modules.rider.domain.RiderInfo; |
| | | import com.oying.modules.rider.domain.RiderOrderRecord; |
| | | import com.oying.modules.rider.domain.RiderWalletInfo; |
| | | import com.oying.modules.rider.domain.*; |
| | | import com.oying.modules.rider.domain.vo.OrderRiderOperationVo; |
| | | import com.oying.modules.rider.service.RiderIncomeDetailService; |
| | | import com.oying.modules.rider.service.RiderInfoService; |
| | | import com.oying.modules.rider.service.RiderWalletInfoService; |
| | | import com.oying.modules.rider.service.*; |
| | | import com.oying.modules.rider.utils.Constants; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.rider.service.RiderOrderRecordService; |
| | | import com.oying.modules.rider.domain.dto.RiderOrderRecordQueryCriteria; |
| | | import com.oying.modules.rider.mapper.RiderOrderRecordMapper; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final RedisUtils redisUtils; |
| | | private final OrderService orderService; |
| | | private final RiderInfoService riderInfoService; |
| | | private final StoreService storeService; |
| | | private final RiderWalletInfoService riderWalletInfoService; |
| | | private final RiderIncomeDetailService riderIncomeDetailService; |
| | | private final RiderDeliveryPhotosService riderDeliveryPhotosService; |
| | | |
| | | @Override |
| | | public PageResult<RiderOrderRecord> queryAll(RiderOrderRecordQueryCriteria criteria, Page<Object> page) { |
| | |
| | | return R.fail(400, "订单信息不存在,请稍后重试"); |
| | | } |
| | | int orderStatus = orderResponse.getOrder().getOrderStatus(); |
| | | // 2商家已接单 4商家已备货 这两个状态可以接单 |
| | | if (orderStatus != 2 && orderStatus != 4) { |
| | | // 2商家已接单 3商家已备货 这两个状态可以接单 |
| | | if (orderStatus != 2 && orderStatus != 3) { |
| | | return R.fail(400, "订单已经被其他骑手接单或取消,请稍后重试"); |
| | | } |
| | | // 商家备货状态 查看是否存在骑手信息 |
| | |
| | | // 1.新增骑手接单记录 |
| | | addRiderOrderRecord(riderInfo, orderResponse); |
| | | // 2.新增订单接单流程信息 骑手接单流程新增 |
| | | orderService.operationLog(orderResponse, OrderStatusEnum.THREE, riderInfo.getCardName()); |
| | | orderService.operationLog(orderResponse, OrderStatusEnum.FOUR, riderInfo.getCardName()); |
| | | // 返回成功信息 |
| | | return R.success(orderResponse, "接单成功"); |
| | | } catch (Exception e) { |
| | |
| | | // riderOrderRecord.setDeliveryFeeId(orderResponse.getOrder().getDeliveryFeeId()); |
| | | riderOrderRecord.setOrderIncome(orderResponse.getOrder().getSendPrice()); |
| | | riderOrderRecord.setOrderTime(orderResponse.getOrder().getOrderTime()); |
| | | riderOrderRecord.setUserName(orderResponse.getOrder().getUsername()); |
| | | create(riderOrderRecord); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R riderCompleteOrder(String orderNum) { |
| | | // 是否上传送达照片 |
| | | RiderDeliveryPhotos riderDeliveryPhotos = riderDeliveryPhotosService.getOne( |
| | | new QueryWrapper<RiderDeliveryPhotos>().eq(RiderDeliveryPhotos.COL_ORDER_NUM, orderNum)); |
| | | if (riderDeliveryPhotos == null) { |
| | | return R.fail(400, "请上传送达照片"); |
| | | } |
| | | // 当前订单信息 |
| | | OrderResponse orderResponse = orderService.getByOrderNum(orderNum); |
| | | Order order = orderResponse.getOrder(); |