| | |
| | | Long appUserId = xpOrder.getAppUserId(); |
| | | // 查询车辆 |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | // 订单的状态 status =1 ( 状态 0=已取消,1=待接单,2=待出发,3=接驾中,4=待客上车,5=乘客已上车,6=服务中,7=待客下车,8=待付款,9=待评价,10=已完成) |
| | | switch (status) { |
| | | case 0://去掉订单 优惠卷需要返回 |
| | | |
| | | case 0://去掉订单 优惠卷需要返回 @todo yyy 这里可能不需要这个步骤 |
| | | //取消订单会将优惠卷 从占用修改成未使用 |
| | | if(xpOrder.getCouponId() != null){ |
| | | UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | useUserCouponDto.setUserCouponId(xpOrder.getCouponId() ); |
| | | xpAppUserCouponClient.backUserCoupon(useUserCouponDto); |
| | | } |
| | | break; |
| | | case 4: |
| | | // 查询起点点位 |
| | |
| | | jobMaps |
| | | ); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | xpOrder.setStatus(status); |
| | | xpOrder.setAppUserId(null); |
| | |
| | | // 查询车辆 |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | Long appUserId = xpOrder.getAppUserId(); |
| | | |
| | | xpOrder.setCarAbnormal(true);//车辆是否故障 0-否 1-是 |
| | | xpOrder.setGetoffTime(LocalDateTime.now()); |
| | | // 解析下车地点 |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | |
| | | this.updateById(xpOrder); |
| | | //结束行程,修改状态和计算费用 |
| | | this.endTrip(xpOrder.getId(),appUserId.toString()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | order.setOrderMoney(totalPrice); |
| | | order.setAppUserId(null); |
| | | baseMapper.updateById(order); |
| | | } else { |
| | | } |
| | | else { |
| | | //动态计费 |
| | | if (pricing.getPricingType() == 1) { |
| | | |
| | |
| | | order.setStatus(9); |
| | | order.setAppUserId(null); |
| | | |
| | | |
| | | if(order.getCouponId()!=null){ |
| | | UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | R<BigDecimal> decimalR = xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | if(decimalR.getCode()==200){ |
| | | order.setCouponMoney(decimalR.getData()); |
| | | if(order.getCouponMoney().compareTo(order.getOrderMoney())>0){ |
| | | order.setPayMoney(BigDecimal.ZERO); |
| | | order.setCouponMoney(order.getOrderMoney()); |
| | | }else { |
| | | order.setPayMoney(order.getOrderMoney().subtract(decimalR.getData())); |
| | | if(order.getCarAbnormal()){//是故障单 支付金额未0 @todo yyy 这里应该有问题 |
| | | order.setPayMoney(BigDecimal.ZERO); |
| | | }else{ |
| | | if(order.getCouponId()!=null){ |
| | | UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | R<BigDecimal> decimalR = xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | if(decimalR.getCode()==200){ |
| | | order.setCouponMoney(decimalR.getData()); |
| | | if(order.getCouponMoney().compareTo(order.getOrderMoney())>0){ |
| | | order.setPayMoney(BigDecimal.ZERO); |
| | | order.setCouponMoney(order.getOrderMoney()); |
| | | }else { |
| | | order.setPayMoney(order.getOrderMoney().subtract(decimalR.getData())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | baseMapper.updateById(order); |
| | | redisService.setCacheObject("ORDER_STATUS:" + order.getId(), 9, 24L, TimeUnit.HOURS); |
| | | return R.ok(); |