用户开始骑行
This commit is contained in:
parent
65fdc87447
commit
cb685a5fe4
@ -4,7 +4,6 @@ import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
|
||||
import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
||||
import com.cdzy.user.model.entity.EbikeOrder;
|
||||
import com.cdzy.user.model.vo.EbikeOrderVo;
|
||||
import com.cdzy.user.service.EbikeOrderService;
|
||||
import com.ebike.feign.model.dto.FeignEbikeDto;
|
||||
import com.ebike.feign.model.dto.FeignEbikeUserBikeInfo;
|
||||
|
||||
@ -81,29 +81,27 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
||||
.orderType(OrderType.ONCE)
|
||||
.startLocation(orderDto.getStartPoint())
|
||||
.startTime(LocalDateTime.now())
|
||||
.orderStatus(OrderStatus.IN_PROGRESS)
|
||||
.createTime(LocalDateTime.now())
|
||||
.build();
|
||||
save(order);
|
||||
return order;
|
||||
// try {
|
||||
// // 尝试开锁
|
||||
// EbikeUnlockResultDto unlockResult = attemptUnlockWithValidation(bikeCode, userId);
|
||||
// if (!unlockResult.isSuccess()) {
|
||||
// throw new EbikeException("开锁失败: " + unlockResult.getErrorMsg());
|
||||
// }
|
||||
// // 开锁成功
|
||||
// EbikeOrder orders = EbikeOrder.builder()
|
||||
// .orderId(order.getOrderId())
|
||||
// .orderStatus(OrderStatus.IN_PROGRESS)
|
||||
// .updateTime(LocalDateTime.now())
|
||||
// .build();
|
||||
// updateById(orders);
|
||||
// return orders;
|
||||
// } catch (Exception e) {
|
||||
// log.error("开锁失败, userId={}, bikeCode={}", userId, bikeCode, e);
|
||||
// throw new RuntimeException("开锁失败", e);
|
||||
// }
|
||||
try {
|
||||
// 尝试开锁
|
||||
EbikeUnlockResultDto unlockResult = attemptUnlockWithValidation(bikeCode, userId);
|
||||
if (!unlockResult.isSuccess()) {
|
||||
throw new EbikeException("开锁失败: " + unlockResult.getErrorMsg());
|
||||
}
|
||||
// 开锁成功
|
||||
EbikeOrder orders = EbikeOrder.builder()
|
||||
.orderId(order.getOrderId())
|
||||
.orderStatus(OrderStatus.IN_PROGRESS)
|
||||
.updateTime(LocalDateTime.now())
|
||||
.build();
|
||||
updateById(orders);
|
||||
return orders;
|
||||
} catch (Exception e) {
|
||||
log.error("开锁失败, userId={}, bikeCode={}", userId, bikeCode, e);
|
||||
throw new RuntimeException("开锁失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user