| | |
| | | } |
| | | @PostMapping("/inner/appUserCoupon/useUserCoupon") |
| | | public R useUserCoupon(@RequestBody UseUserCouponDto dto) { |
| | | XpAppUserCoupon appUserCoupon = xpAppUserCouponService.getById(dto.getUserId()); |
| | | XpAppUserCoupon appUserCoupon = xpAppUserCouponService.getById(dto.getUserCouponId()); |
| | | appUserCoupon.setStatus(2); |
| | | xpAppUserCouponService.updateById(appUserCoupon); |
| | | return R.ok(); |
| | |
| | | } |
| | | String durationAndMileage = key.split("\\|")[2]; |
| | | startDetail.setDuration(Double.valueOf(durationAndMileage.split("&")[0])); |
| | | startDetail.setMileage(new BigDecimal(durationAndMileage.split("&")[1])); |
| | | startDetail.setMileage(new BigDecimal(durationAndMileage.split("&")[1]).multiply(BigDecimal.valueOf(1000))); |
| | | start.add(startDetail); |
| | | } |
| | | // 封装里程费 |
| | |
| | | // 封装时长费 |
| | | FareBreakdownDetailVo timeDetail = new FareBreakdownDetailVo(); |
| | | if (key.contains("时长费")) { |
| | | timeDetail.setType(startDetail.getType()); |
| | | if(key.contains("普通时段")){ |
| | | timeDetail.setType(1); |
| | | } |
| | | if(key.contains("夜间行驶")){ |
| | | timeDetail.setType(2); |
| | | } |
| | | if(key.contains("高峰")){ |
| | | timeDetail.setType(3); |
| | | } |
| | | if(key.contains("节假")){ |
| | | timeDetail.setType(4); |
| | | } |
| | | |
| | | timeDetail.setMoney(stringBigDecimalEntry.getValue()); |
| | | timeDetail.setDuration(Double.valueOf(key.split("&")[1])); |
| | | duration.add(timeDetail); |
| | |
| | | if (key.contains("远途费")) { |
| | | longDetail.setType(startDetail.getType()); |
| | | longDetail.setMoney(stringBigDecimalEntry.getValue()); |
| | | longDetail.setMileage(new BigDecimal(key.split("&")[1])); |
| | | // longDetail.setMileage(new BigDecimal(key.split("&")[1])); |
| | | longDistance.add(longDetail); |
| | | } |
| | | } |
| | |
| | | order.setStatus(9); |
| | | order.setAppUserId(null); |
| | | baseMapper.updateById(order); |
| | | |
| | | if(order.getCouponId()!=null){ |
| | | UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | // 模拟总里程 25.0 km,以触发多级远途加价 |
| | | double totalMillige = 2.984; |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.set(2026, Calendar.APRIL, 11, 15, 58, 15); |
| | | cal.set(2026, Calendar.APRIL, 11, 15, 57, 50); |
| | | orderTime = cal.getTime(); |
| | | // 模拟 GPS 轨迹点 |
| | | List<GpsPoint> points = createMockGpsPoints(orderTime); |
| | |
| | | |
| | | private static PricingConfig setupMockConfig() { |
| | | PricingConfig config = new PricingConfig(); |
| | | config.peaks.add(new PricingRule("高峰期", "04:00", "05:00", 15, 1, 10, 4, 4)); |
| | | config.peaks.add(new PricingRule("高峰期", "15:00", "16:00", 15, 1, 10, 4, 4)); |
| | | config.night = new PricingRule("夜间行驶", "20:04", "23:00", 15, 1, 10, 3, 3); |
| | | config.holiday = new PricingRule("节假日", "00:00", "23:59", 20, 1, 10, 4, 4); |
| | | config.normals.add(new PricingRule("普通时段", "00:00", "23:59", 10.0, 1, 10.0, 3, 3)); |
| | | config.peaks.add(new PricingRule("高峰期", "04:00", "05:00", 15, 1, 1, 4, 4)); |
| | | config.peaks.add(new PricingRule("高峰期", "15:00", "16:00", 15, 1, 1, 4, 4)); |
| | | config.night = new PricingRule("夜间行驶", "20:04", "23:00", 15, 1, 1, 3, 3); |
| | | config.holiday = new PricingRule("节假日", "00:00", "23:59", 20, 1, 1, 4, 4); |
| | | config.normals.add(new PricingRule("普通时段", "00:00", "23:59", 10.0, 1, 1, 3, 3)); |
| | | |
| | | // --- 远途加价区间配置 (关键修改) --- |
| | | // 1. 超过 num1(12) 不足 num2(20), 加收 num3(1.2) |