| | |
| | | |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num21").split("-")[0], basicPricingJson.getString("num21").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num22").split("-")[0], basicPricingJson.getString("num22").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.night = new TaxiPricingDemoService.PricingRule("夜间行驶", basicPricingJson.getString("num14").split("-")[0], basicPricingJson.getString("num14").split("-")[1], Double.parseDouble(basicPricingJson.getString("num16")), Double.parseDouble(basicPricingJson.getString("num17")), Double.parseDouble(basicPricingJson.getString("num18")), Double.parseDouble(basicPricingJson.getString("num19")), Double.parseDouble(basicPricingJson.getString("num20"))); |
| | | config.holiday = new TaxiPricingDemoService.PricingRule("节假日", "00:00", "23:59", Double.parseDouble(basicPricingJson.getString("num30")), Double.parseDouble(basicPricingJson.getString("num31")), Double.parseDouble(basicPricingJson.getString("num32")), Double.parseDouble(basicPricingJson.getString("num33")), Double.parseDouble(basicPricingJson.getString("num234"))); |
| | | config.night = new TaxiPricingDemoService.PricingRule("夜间行驶", basicPricingJson.getString("num14").split("-")[0], basicPricingJson.getString("num14").split("-")[1], Double.parseDouble(basicPricingJson.getString("num16")), Double.parseDouble(basicPricingJson.getString("num17")), Double.parseDouble(basicPricingJson.getString("num18")), Double.parseDouble(basicPricingJson.getString("num19")), Double.parseDouble(basicPricingJson.getString("num20"))); |
| | | config.holiday = new TaxiPricingDemoService.PricingRule("节假日", "00:00", "23:59", Double.parseDouble(basicPricingJson.getString("num30")), Double.parseDouble(basicPricingJson.getString("num31")), Double.parseDouble(basicPricingJson.getString("num32")), Double.parseDouble(basicPricingJson.getString("num33")), Double.parseDouble(basicPricingJson.getString("num234"))); |
| | | for (Object o : startingFareJsonArray) { |
| | | // 转化为jsonObject |
| | | JSONObject jsonObject = (JSONObject) o; |
| | |
| | | BigDecimal totalAmount = bill.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | System.err.println("--------------------------"); |
| | | System.err.println("应付总额: " + totalAmount + " 元"); |
| | | BigDecimal startMoney = BigDecimal.ZERO; |
| | | // 封装费用明细数据 |
| | | for (Map.Entry<String, BigDecimal> stringBigDecimalEntry : bill.entrySet()) { |
| | | // 封装起步价 |
| | |
| | | if (key.contains("起步价")) { |
| | | startDetail.setTime(key.split("\\|")[1]); |
| | | startDetail.setMoney(stringBigDecimalEntry.getValue()); |
| | | startMoney = startMoney.add(stringBigDecimalEntry.getValue()); |
| | | if (key.contains("普通时段")) { |
| | | startDetail.setType(1); |
| | | } else if (key.contains("夜间")) { |
| | |
| | | } else if (key.contains("节假")) { |
| | | startDetail.setType(4); |
| | | } |
| | | startDetail.setDuration(Long.parseLong(key.split("=")[1])); |
| | | startDetail.setDuration(Double.valueOf(key.split("=")[1])); |
| | | startDetail.setMileage(new BigDecimal(key.split("&")[1])); |
| | | start.add(startDetail); |
| | | } |
| | | // 封装里程费 |
| | | if (!key.contains("起步")&&!key.contains("时长")&&!key.contains("远途")&&!key.contains("distance")) { |
| | | if (!key.contains("起步") && !key.contains("时长") && !key.contains("远途") && !key.contains("distance")) { |
| | | FareBreakdownDetailVo mileageDetail = new FareBreakdownDetailVo(); |
| | | if (key.contains("普通时段")){ |
| | | if (key.contains("普通时段")) { |
| | | mileageDetail.setType(1); |
| | | String key1 = "distance普通时段"+key.split("\\|")[1]; |
| | | String key2 = "普通时段"+key.split("\\|")[1]; |
| | | String key1 = "distance普通时段" + key.split("\\|")[1]; |
| | | String key2 = "普通时段" + key.split("\\|")[1]; |
| | | BigDecimal distance = bill.get(key1); |
| | | BigDecimal money = bill.get(key2); |
| | | mileageDetail.setMileage(distance); |
| | | mileageDetail.setMoney(money); |
| | | }else if (key.contains("夜间行驶")){ |
| | | } else if (key.contains("夜间行驶")) { |
| | | mileageDetail.setType(2); |
| | | String key1 = "distance夜间行驶"+key.split("\\|")[1]; |
| | | String key2 = "夜间行驶"+key.split("\\|")[1]; |
| | | String key1 = "distance夜间行驶" + key.split("\\|")[1]; |
| | | String key2 = "夜间行驶" + key.split("\\|")[1]; |
| | | BigDecimal distance = bill.get(key1); |
| | | BigDecimal money = bill.get(key2); |
| | | mileageDetail.setMileage(distance); |
| | | mileageDetail.setMoney(money); |
| | | } |
| | | else if (key.contains("高峰期")){ |
| | | } else if (key.contains("高峰期")) { |
| | | mileageDetail.setType(3); |
| | | String key1 = "distance高峰期"+key.split("\\|")[1]; |
| | | String key2 = "高峰期"+key.split("\\|")[1]; |
| | | String key1 = "distance高峰期" + key.split("\\|")[1]; |
| | | String key2 = "高峰期" + key.split("\\|")[1]; |
| | | BigDecimal distance = bill.get(key1); |
| | | BigDecimal money = bill.get(key2); |
| | | mileageDetail.setMileage(distance); |
| | | mileageDetail.setMoney(money); |
| | | } |
| | | else if (key.contains("节假")){ |
| | | } else if (key.contains("节假")) { |
| | | mileageDetail.setType(4); |
| | | String key1 = "distance节假日"+key.split("\\|")[1]; |
| | | String key2 = "节假日"+key.split("\\|")[1]; |
| | | String key1 = "distance节假日" + key.split("\\|")[1]; |
| | | String key2 = "节假日" + key.split("\\|")[1]; |
| | | BigDecimal distance = bill.get(key1); |
| | | BigDecimal money = bill.get(key2); |
| | | mileageDetail.setMileage(distance); |
| | |
| | | if (key.contains("时长费")) { |
| | | timeDetail.setType(startDetail.getType()); |
| | | timeDetail.setMoney(stringBigDecimalEntry.getValue()); |
| | | timeDetail.setDuration(Long.parseLong(key.split("&")[1])); |
| | | timeDetail.setDuration(Double.valueOf(key.split("&")[1])); |
| | | duration.add(timeDetail); |
| | | } |
| | | // 封装远途费 |
| | |
| | | for (FareBreakdownDetailVo fareBreakdownDetailVo : duration) { |
| | | order.setDurationType(fareBreakdownDetailVo.getType()); |
| | | order.setDurationMoney(fareBreakdownDetailVo.getMoney()); |
| | | order.setDuration(Double.parseDouble(fareBreakdownDetailVo.getDuration()+"")); |
| | | order.setDuration(Double.parseDouble(fareBreakdownDetailVo.getDuration() + "")); |
| | | } |
| | | for (FareBreakdownDetailVo fareBreakdownDetailVo : longDistance) { |
| | | order.setLongDistanceType(fareBreakdownDetailVo.getType()); |
| | | order.setLongDistance(fareBreakdownDetailVo.getMileage().doubleValue()); |
| | | order.setLongDistancemoney(fareBreakdownDetailVo.getMoney()); |
| | | } |
| | | BigDecimal orderMoney = startMoney.add(mileageMoney).add(order.getDurationMoney() != null ? order.getDurationMoney() : BigDecimal.ZERO) |
| | | .add(order.getLongDistancemoney() != null ? order.getLongDistancemoney() : BigDecimal.ZERO) |
| | | .add(order.getWaitMoney()!=null?order.getWaitMoney():BigDecimal.ZERO); |
| | | order.setOrderMoney(orderMoney); |
| | | baseMapper.updateById(order); |
| | | |
| | | if (order.getCouponId() != null) { |
| | | GetUserCouponDto useUserCouponDto = new GetUserCouponDto(); |
| | | useUserCouponDto.setUserId(Long.valueOf(uid)); |
| | | useUserCouponDto.setTotalAmount(order.getOrderMoney().doubleValue()); |
| | | useUserCouponDto.setOpenCityId(order.getCityId()); |
| | | useUserCouponDto.setOrderId(orderId); |
| | | useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // 计算时间差(单位:分钟) |
| | | long minutesDifference = Duration.between(startDateTime, endDateTime).toMinutes(); |
| | | fareBreakdownDetailVo.setDuration(minutesDifference); |
| | | fareBreakdownDetailVo.setDuration((double) minutesDifference); |
| | | fareBreakdownDetailVo.setMoney(new BigDecimal(num3)); |
| | | start.add(fareBreakdownDetailVo); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R<FareBreakdownVo> fareBreakdown(Long orderId, String uid) { |
| | | |
| | | XpOrder order = this.getById(orderId); |
| | | // 查询订单轨迹 |
| | | List<OrderTrajectory> trajectories = mongoTemplate.find( |
| | |
| | | .with(Sort.by(Sort.Direction.ASC, "locatetime")), |
| | | OrderTrajectory.class |
| | | ); |
| | | // 计算订单总行驶距离,单位米 |
| | | Double totalDistance = 0.00D; |
| | | for (OrderTrajectory trajectory : trajectories) { |
| | | |
| | | FareBreakdownVo res = new FareBreakdownVo(); |
| | | |
| | | List<FareBreakdownDetailVo> start = new ArrayList<>(); |
| | | List<FareBreakdownDetailVo> mileage = new ArrayList<>(); |
| | | |
| | | List<XpOrderDetail> xpOrderDetails = xpOrderDetailMapper.selectList(new LambdaQueryWrapper<XpOrderDetail>().eq(XpOrderDetail::getOrderId, orderId)); |
| | | for (XpOrderDetail xpOrderDetail : xpOrderDetails) { |
| | | FareBreakdownDetailVo detail = new FareBreakdownDetailVo(); |
| | | detail.setType(xpOrderDetail.getType()); |
| | | detail.setTime(xpOrderDetail.getTime()); |
| | | detail.setMileage(xpOrderDetail.getMileage()); |
| | | detail.setDuration(xpOrderDetail.getDuration()); |
| | | if (xpOrderDetail.getType() == 1){ |
| | | start.add(detail); |
| | | }else{ |
| | | mileage.add(detail); |
| | | } |
| | | } |
| | | FareBreakdownVo fareBreakdownVo = new FareBreakdownVo(); |
| | | // fareBreakdownVo.setStart(); |
| | | // fareBreakdownVo.setMileage(); |
| | | // fareBreakdownVo.setDuration(); |
| | | // fareBreakdownVo.setLongDistance(); |
| | | // fareBreakdownVo.setRedPacketMoney(); |
| | | // fareBreakdownVo.setCouponMoney(); |
| | | // fareBreakdownVo.setOrderMoney(); |
| | | List<FareBreakdownDetailVo> duration = new ArrayList<>(); |
| | | if (order.getDuration()!=null&&order.getDuration()>0){ |
| | | FareBreakdownDetailVo durationDetail = new FareBreakdownDetailVo(); |
| | | durationDetail.setType(order.getDurationType()); |
| | | durationDetail.setDuration(order.getDuration()); |
| | | durationDetail.setMoney(order.getDurationMoney()); |
| | | } |
| | | List<FareBreakdownDetailVo> longDistance = new ArrayList<>(); |
| | | |
| | | // 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); |
| | | if (order.getLongDistance()!=null&&order.getLongDistance()>0){ |
| | | FareBreakdownDetailVo longDistanceDetail = new FareBreakdownDetailVo(); |
| | | longDistanceDetail.setType(order.getLongDistanceType()); |
| | | longDistanceDetail.setMileage(BigDecimal.valueOf(order.getLongDistance())); |
| | | longDistanceDetail.setMoney(order.getLongDistancemoney()); |
| | | longDistance.add(longDistanceDetail); |
| | | } |
| | | res.setStart( start); |
| | | res.setMileage( mileage); |
| | | res.setDuration( duration); |
| | | res.setLongDistance( longDistance); |
| | | res.setRedPacketMoney(order.getRedPacketMoney()); |
| | | res.setCouponMoney(order.getCouponMoney()); |
| | | res.setOrderMoney(order.getOrderMoney()); |
| | | res.setKilometer(BigDecimal.valueOf(order.getMileageKilometers())); |
| | | LocalDateTime createTime = order.getCreateTime(); |
| | | LocalDateTime tripEnd = order.getTripEnd(); |
| | | // 计算行程时间 单位分钟 |
| | | // 计算时间差 |
| | | Duration durationBetween = Duration.between(createTime, tripEnd); |
| | | |
| | | // 转换为分钟并保留一位小数 |
| | | BigDecimal minutes = BigDecimal.valueOf(durationBetween.getSeconds()) |
| | | .divide(BigDecimal.valueOf(60), 1, RoundingMode.HALF_UP); |
| | | res.setTime(minutes); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | @Override |
| | |
| | | orderDetailVo.setFeedbackPictures(evaluate.getFeedbackPictures()); |
| | | orderDetailVo.setFeedbackContent(evaluate.getFeedbackContent()); |
| | | orderDetailVo.setOrderRating(evaluate.getOrderRating()); |
| | | if(evaluate.getFeedbackTypeId()!=null){ |
| | | if (evaluate.getFeedbackTypeId() != null) { |
| | | XpFeedbackType feedbackType = xpSystemSettingClient.getFeedbackTypeById(evaluate.getFeedbackTypeId()).getData(); |
| | | orderDetailVo.setFeedbackTypeName(feedbackType.getFeedbackType()); |
| | | } |
| | |
| | | addTaxiPassengerVo.setAppId(""); |
| | | |
| | | BaseVehicleUserDto baseVehicleUserDto = userVehicleClient.addTaxiPassenger(addTaxiPassengerVo); |
| | | if(baseVehicleUserDto.getCode()==200){ |
| | | if (baseVehicleUserDto.getCode() == 200) { |
| | | |
| | | // Redis弹出这个队列元素 |
| | | // value 订单Id_经纬度_状态_用户id_订单编号_距离_时间 |