| | |
| | | // 先判断今日是否节假日 |
| | | boolean holiday = holidayUtil.isHoliday(); |
| | | if (holiday) { |
| | | if (realDistance > rule.getDouble("num6")) { |
| | | if (realDistance > rule.getDouble("num6") && realDistance < rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num32") * (realDistance - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | |
| | | } |
| | | if (realDistance > rule.getDouble("num9")) { |
| | | if (realDistance > rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num32") * (rule.getDouble("num7") - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num9") && realDistance < rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num33") * (realDistance - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num33") * (rule.getDouble("num10") - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num12")) { |
| | | longDistanceThree = rule.getDouble("num34") * (realDistance - rule.getDouble("num12")); |
| | | longDistanceThree = new BigDecimal(longDistanceThree).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | |
| | | |
| | | } else { |
| | | if (date.getTime() > calendarNight.getTimeInMillis() && date.getTime() < calendar.getTimeInMillis()) { |
| | | if (realDistance > rule.getDouble("num6")) { |
| | | if (realDistance > rule.getDouble("num6") && realDistance < rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num18") * (realDistance - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num9")) { |
| | | if (realDistance > rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num18") * (rule.getDouble("num7") - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num9") && realDistance < rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num19") * (realDistance - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num19") * (rule.getDouble("num10") - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num12")) { |
| | | longDistanceThree = rule.getDouble("num20") * (realDistance - rule.getDouble("num12")); |
| | | longDistanceThree = new BigDecimal(longDistanceThree).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | |
| | | e2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[1])); |
| | | //高峰时段处理逻辑 |
| | | if ((date.getTime() > calendarStart.getTimeInMillis() && date.getTime() < calendarEnd.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())) { |
| | | if (realDistance > rule.getDouble("num6")) { |
| | | if (realDistance > rule.getDouble("num6") && realDistance < rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num26") * (realDistance - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num9")) { |
| | | if (realDistance > rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num26") * (rule.getDouble("num7") - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num9") && realDistance < rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num27") * (realDistance - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num27") * (rule.getDouble("num10") - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num12")) { |
| | | longDistanceThree = rule.getDouble("num28") * (realDistance - rule.getDouble("num12")); |
| | | longDistanceThree = new BigDecimal(longDistanceThree).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | |
| | | |
| | | } else { |
| | | //其他时间段的计算 |
| | | if (realDistance > rule.getDouble("num6")) { |
| | | if (realDistance > rule.getDouble("num6") && realDistance < rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num8") * (realDistance - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num9")) { |
| | | if (realDistance > rule.getDouble("num7")) { |
| | | longDistanceOne = rule.getDouble("num8") * (rule.getDouble("num7") - rule.getDouble("num6")); |
| | | longDistanceOne = new BigDecimal(longDistanceOne).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num9") && realDistance < rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num11") * (realDistance - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | if (realDistance > rule.getDouble("num10")) { |
| | | longDistanceTwo = rule.getDouble("num11") * (rule.getDouble("num10") - rule.getDouble("num9")); |
| | | longDistanceTwo = new BigDecimal(longDistanceTwo).setScale(2,RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | |
| | | if (realDistance > rule.getDouble("num12")) { |
| | | longDistanceThree = rule.getDouble("num13") * (realDistance - rule.getDouble("num12")); |
| | | longDistanceThree = new BigDecimal(longDistanceThree).setScale(2,RoundingMode.HALF_UP).doubleValue(); |