| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | BigDecimal longDistancemoney = BigDecimal.ZERO;// 远途费 |
| | | BigDecimal redPacketMoney = BigDecimal.ZERO;// 红包抵扣金额 |
| | | BigDecimal couponMoney = BigDecimal.ZERO;// 优惠券抵扣金额 |
| | | if (pricingType==1){ |
| | | if (pricingType == 1) { |
| | | |
| | | }else{ |
| | | } else { |
| | | |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(basicPricingJson)){ |
| | | if (org.springframework.util.StringUtils.hasLength(basicPricingJson)) { |
| | | |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(startingFareJson)){ |
| | | if (org.springframework.util.StringUtils.hasLength(startingFareJson)) { |
| | | |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(dynamicPricingJson)){ |
| | | if (org.springframework.util.StringUtils.hasLength(dynamicPricingJson)) { |
| | | |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(priceRule)){ |
| | | if (org.springframework.util.StringUtils.hasLength(priceRule)) { |
| | | |
| | | } |
| | | // 计算完价格后 挑选优惠券 |
| | |
| | | order.setCouponId(userCouponVo.getId()); |
| | | order.setCouponMoney(BigDecimal.valueOf(userCouponVo.getMoney())); |
| | | } |
| | | order.setTripEnd(LocalDateTime.now()); |
| | | baseMapper.updateById(order); |
| | | // 解绑用户与车辆关系 |
| | | CancelTaxiPassengerVo cancelTaxiPassengerVo = new CancelTaxiPassengerVo(); |
| | |
| | | XpOrder order = this.getById(orderId); |
| | | FareBreakdownVo fareBreakdownVo = new FareBreakdownVo(); |
| | | BeanUtils.copyProperties(order, fareBreakdownVo); |
| | | fareBreakdownVo.setTotalKilometers( |
| | | BigDecimal.valueOf(order.getStartMileage() + order.getMileageKilometers() + order.getLongDistance()) |
| | | ); |
| | | LocalDateTime createTime = order.getCreateTime(); |
| | | LocalDateTime tripEnd = order.getTripEnd(); |
| | | // 计算行程时间 单位分钟 |
| | | |
| | | // 计算时间差 |
| | | Duration duration = Duration.between(createTime, tripEnd); |
| | | |
| | | // 转换为分钟并保留一位小数 |
| | | BigDecimal minutes = BigDecimal.valueOf(duration.getSeconds()) |
| | | .divide(BigDecimal.valueOf(60), 1, RoundingMode.HALF_UP); |
| | | |
| | | fareBreakdownVo.setTotalTime(minutes); |
| | | return R.ok(fareBreakdownVo); |
| | | } |
| | | |