From aa72a1d1d8c792b322281f5ab01996bc62820b13 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 16 九月 2025 15:31:07 +0800
Subject: [PATCH] 修改bug及数据加密传输

---
 UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java |  328 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 226 insertions(+), 102 deletions(-)

diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
index 8b50879..a42183a 100644
--- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
+++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
@@ -1,61 +1,59 @@
 package com.stylefeng.guns.modular.system.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.stylefeng.guns.modular.system.dao.ServerCarModelMapper;
 import com.stylefeng.guns.modular.system.dao.SystemPriceMapper;
 import com.stylefeng.guns.modular.system.model.Company;
 import com.stylefeng.guns.modular.system.model.OpenCity;
-import com.stylefeng.guns.modular.system.model.OpenCityBusiness;
 import com.stylefeng.guns.modular.system.model.ServerCarModel;
-import com.stylefeng.guns.modular.system.service.ICompanyCityService;
-import com.stylefeng.guns.modular.system.service.IOpenCityBusinessService;
-import com.stylefeng.guns.modular.system.service.IOpenCityService;
-import com.stylefeng.guns.modular.system.service.IServerCarModelService;
+import com.stylefeng.guns.modular.system.model.SystemPriceCity;
+import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil;
 import com.stylefeng.guns.modular.system.util.GDMapGeocodingUtil;
 import com.stylefeng.guns.modular.system.util.ResultUtil;
+import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
 import com.stylefeng.guns.modular.system.warpper.ServerCarModelWarpper;
+import lombok.Data;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
+import java.math.RoundingMode;
 import java.util.*;
 
 
 @Service
 public class ServerCarModelServiceImpl extends ServiceImpl<ServerCarModelMapper, ServerCarModel> implements IServerCarModelService {
-
+    
     @Resource
     private ServerCarModelMapper serverCarModelMapper;
-
+    
+    @Resource
+    private ISystemPriceCityService systemPriceCityService;
+    
     @Resource
     private SystemPriceMapper systemPriceMapper;
-
+    
     @Autowired
     private GDMapElectricFenceUtil gdMapElectricFenceUtil;
-
+    
     @Autowired
     private GDMapGeocodingUtil gdMapGeocodingUtil;
-
+    
     @Autowired
     private ICompanyCityService companyCityService;
-
+    
     @Autowired
     private IOpenCityService openCityService;
-
+    
     @Autowired
     private IOpenCityBusinessService openCityBusinessService;
-
-
-
-
-
-
+    
+    
     /**
      * 根据起点和终点获取车型
      * @param startLonLat
@@ -75,27 +73,44 @@
         if(type == 1 && query.getIsSpe() == 2){
             return ResultUtil.success(new ArrayList<>());
         }
-
-        // TODO: 2023/11/4 无法修改
+    
         Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLonLat, endLonLat, 1);
-        if(null == distance){
+        if (null == distance) {
             return ResultUtil.error("获取预估距离出错", new ArrayList<>());
         }
         String distance1 = distance.get("distance");//距离(米)
         double distance1_ = Double.valueOf(distance1).doubleValue();
         String duration = distance.get("duration");//时间(秒)
         long duration_ = Long.valueOf(duration).longValue();
-
-        List<ServerCarModelWarpper> price = this.getPrice(query.getId(), distance1_, duration_, 0, 1);
-        //添加出租车车型和价格
-        ServerCarModelWarpper serverCarModelWarpper = this.getTextPrice(query.getId(), distance1_, duration_, 0, 2);
-        price.add(serverCarModelWarpper);
+        OpenCity openCity = openCityService.openCity1(geocode.get("districtCode"));
+        if(null == openCity){
+            return ResultUtil.error("起点暂未开通");
+        }
+    
+        //专车车型
+        List<ServerCarModelWarpper> price = new ArrayList<>();
+        List<BaseWarpper> baseWarppers = openCityBusinessService.queryBusinessById(openCity.getId());
+        Optional<BaseWarpper> first = baseWarppers.stream().filter(s->s.getId() == 1).findFirst();
+        if(first.isPresent()){
+            price = this.getPrice(query.getId(), distance1_, duration_, 0, 1, geocode);
+        }
+        
+        //出租车车型
+        ServerCarModelWarpper serverCarModelWarpper = null;
+        first = baseWarppers.stream().filter(s->s.getId() == 2).findFirst();
+        if(first.isPresent()){
+            serverCarModelWarpper = this.getTextPrice(query.getId(), distance1_, duration_, 0, 2, geocode);
+            if(serverCarModelWarpper!=null){
+                price.add(serverCarModelWarpper);
+            }
+        }
         return ResultUtil.success(price);
     }
-
-
+    
+    
     /**
      * 获取业务类型对应的所有服务车型
+     *
      * @param type
      * @return
      */
@@ -103,10 +118,11 @@
     public List<Map<String, Object>> queryServerCarModels(Integer type) {
         return serverCarModelMapper.queryServerCarModel(type);
     }
-
-
+    
+    
     /**
      * 计算价格
+     *
      * @param companyId
      * @param distance
      * @param duration
@@ -115,18 +131,29 @@
      * @return
      * @throws Exception
      */
-    public List<ServerCarModelWarpper> getPrice(Integer companyId, double distance, long duration, long wait, Integer type) throws Exception {
+    public List<ServerCarModelWarpper> getPrice(Integer companyId, double distance, long duration, long wait, Integer type, Map<String, String> geocode) throws Exception {
+        System.err.println("预估里程:" + distance);
+        System.err.println("预估时间:" + duration);
+        String provinceCode = geocode.get("provinceCode");
+        String cityCode = geocode.get("cityCode");
+        String districtCode = geocode.get("districtCode");
+        //获取匹配的城市价格配置
+        SystemPriceCity systemPriceCity = systemPriceCityService.queryOne(provinceCode, cityCode, districtCode);
+        System.err.println("获取匹配的城市价格配置:" + systemPriceCity);
+        if (null == systemPriceCity) {
+            return new ArrayList<>();
+        }
         List<Map<String, Object>> list = serverCarModelMapper.queryServerCarModel(type);
+        System.err.println("获取匹配的城市价格配置111:" + list);
         List<ServerCarModelWarpper> data = new ArrayList<>();
-        for(Map<String, Object> map : list){
-            Map<String, Object> query1 = systemPriceMapper.query(companyId, type, Integer.valueOf(map.get("id").toString()));
-            if(null == query1){//排除没有设置价格的车型
+        for (Map<String, Object> map : list) {
+            Map<String, Object> query1 = systemPriceMapper.query(companyId, type, Integer.valueOf(map.get("id").toString()), systemPriceCity.getId());
+            if (null == query1) {//排除没有设置价格的车型
                 continue;
             }
             //开始根据不同的方式计算金额
             double amount = 0;
-            if(type == 1){//专车
-
+            if (type == 1) {//专车
                 double d = distance / 1000;//实际公里
                 double t = duration / 60;//实际时间
                 JSONObject jsonObject = JSON.parseObject(query1.get("content").toString());//等待费
@@ -146,25 +173,26 @@
                 serverCarModelWarpper.setFareTypeNote3(query1.get("fareTypeNote3").toString());
                 serverCarModelWarpper.setContentPutOne(contentPutOne);
                 serverCarModelWarpper.setContentNotOne(contentNotOne);
-
+                
                 serverCarModelWarpper.setContentPutTwo(contentPutTwo);
                 serverCarModelWarpper.setContentNotTwo(contentNotTwo);
-
+                
                 serverCarModelWarpper.setContentPutThree(contentPutThree);
                 serverCarModelWarpper.setContentNotThree(contentNotThree);
-
-
+                
+                
                 serverCarModelWarpper.setContentExclusive(contentExclusive);
                 serverCarModelWarpper.setContentPrice(contentPrice);
-
-                serverCarModelWarpper.setAmount(new BigDecimal(this.calculationPrice(contentExclusive,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setBuyNowAmount(new BigDecimal(this.calculationPrice(contentPrice,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setPutTogetherOneAmount(new BigDecimal(this.calculationPrice(contentPutOne,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setNotAssembledOneAmount(new BigDecimal(this.calculationPrice(contentNotOne,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setPutTogetherTwoAmount(new BigDecimal(this.calculationPrice(contentPutTwo,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setNotAssembledTwoAmount(new BigDecimal(this.calculationPrice(contentNotTwo,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setPutTogetherThreeAmount(new BigDecimal(this.calculationPrice(contentPutThree,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
-                serverCarModelWarpper.setNotAssembledThreeAmount(new BigDecimal(this.calculationPrice(contentNotThree,distance,duration,wait,waitMoney)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue());
+                serverCarModelWarpper.setWaitPrice(jsonObject);
+                
+                serverCarModelWarpper.setAmount(this.calculationPrice(contentExclusive, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setBuyNowAmount(this.calculationPrice(contentPrice, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setPutTogetherOneAmount(this.calculationPrice(contentPutOne, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setNotAssembledOneAmount(this.calculationPrice(contentNotOne, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setPutTogetherTwoAmount(this.calculationPrice(contentPutTwo, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setNotAssembledTwoAmount(this.calculationPrice(contentNotTwo, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setPutTogetherThreeAmount(this.calculationPrice(contentPutThree, distance, duration, wait, waitMoney));
+                serverCarModelWarpper.setNotAssembledThreeAmount(this.calculationPrice(contentNotThree, distance, duration, wait, waitMoney));
                 serverCarModelWarpper.setMileage(d);
                 serverCarModelWarpper.setDuration(t);
                 serverCarModelWarpper.setIsOpen(Integer.parseInt(query1.get("isOpen").toString()));
@@ -180,27 +208,33 @@
         }
         return data;
     }
-
-
-
-
-    public ServerCarModelWarpper getTextPrice(Integer companyId, double distance, long duration, long wait, Integer type) throws Exception {
-        Map<String, Object> query1 = systemPriceMapper.query(companyId, type, null);
-        if(null == query1){//排除没有设置价格的车型
+    
+    
+    public ServerCarModelWarpper getTextPrice(Integer companyId, double distance, long duration, long wait, Integer type, Map<String, String> geocode) throws Exception {
+        String provinceCode = geocode.get("provinceCode");
+        String cityCode = geocode.get("cityCode");
+        String districtCode = geocode.get("districtCode");
+        //获取匹配的城市价格配置
+        SystemPriceCity systemPriceCity = systemPriceCityService.queryOne(provinceCode, cityCode, districtCode);
+        if (null == systemPriceCity) {
             return null;
         }
+        Map<String, Object> query1 = systemPriceMapper.query(companyId, type, null, systemPriceCity.getId());
+        if (null == query1) {//排除没有设置价格的车型
+            return null;
+        }
+        Map<String, Object> map = new HashMap<>();
         double d = distance / 1000;//实际公里
         double t = duration / 60;//实际时间
         JSONObject jsonObject = JSON.parseObject(query1.get("content").toString());//等待费
         Double num1 = jsonObject.getDouble("num1");
         Double num2 = jsonObject.getDouble("num2");
-        Double num3 = jsonObject.getDouble("num3");
+        JSONArray mileageList = jsonObject.getJSONArray("mileageList");
         Double num4 = jsonObject.getDouble("num4");
         Double num5 = jsonObject.getDouble("num5");
         String num6 = jsonObject.getString("num6");
         Double num7 = jsonObject.getDouble("num7");
         Double num8 = jsonObject.getDouble("num8");
-        Double num9 = jsonObject.getDouble("num9");
 
         String[] split = num6.split(" - ");
         Integer time1 = Integer.valueOf(split[0].replace(":", ""));
@@ -240,24 +274,90 @@
         }
 
         Double amount = 0D;
-        if(System.currentTimeMillis() > start_date && System.currentTimeMillis() <= end_date){
+        if (System.currentTimeMillis() > start_date && System.currentTimeMillis() <= end_date) {
             amount = num7;
-            if(d > num8){
-                BigDecimal multiply = new BigDecimal(d).subtract(new BigDecimal(num8)).multiply(new BigDecimal(num9));
-                if(d > num4){
-                    multiply = new BigDecimal(d).subtract(new BigDecimal(num4)).multiply(new BigDecimal(num5)).add(multiply);
+            BigDecimal multiply = BigDecimal.ZERO;
+            BigDecimal yt = BigDecimal.ZERO;
+            if (d > num8) {
+
+                if(null != mileageList){
+                    List<MileageObject> list = new ArrayList<>();
+                    for (int i = 0; i < mileageList.size(); i++) {
+                        MileageObject mileageObject = mileageList.getObject(i, MileageObject.class);
+                        list.add(mileageObject);
+                    }
+                    //根据配置的里程倒序排序
+                    list.sort(new Comparator<MileageObject>() {
+                        @Override
+                        public int compare(MileageObject o1, MileageObject o2) {
+                            return o1.getMileage().compareTo(o2.getMileage()) * -1;
+                        }
+                    });
+                    //计算每个阶段的增加费用
+                    Double last = new BigDecimal(d).setScale(0, RoundingMode.DOWN).doubleValue();
+                    for (int i = 0; i < list.size(); i++) {
+                        Double mileage = list.get(i).getMileage();
+                        Double price = list.get(i).getPrice();
+                        if(d > mileage){
+                            if(last <= num2){
+                                break;
+                            }
+                            multiply = multiply.add((new BigDecimal(last).subtract(new BigDecimal(mileage))).multiply(new BigDecimal(price)));
+                            last = mileage;
+                        }
+                    }
                 }
-                amount = new BigDecimal(num7).add(multiply).setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
+                if (d > num4) {
+                    yt = new BigDecimal(d).subtract(new BigDecimal(num4)).multiply(new BigDecimal(num5));
+                }
+                amount = new BigDecimal(num7).add(multiply).add(yt).setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
             }
-        }else{
+            map.put("qibujia", num7);
+            map.put("lichengfei", multiply.doubleValue());
+            map.put("yuantufei", yt.doubleValue());
+            map.put("zongfeiyong", amount);
+        } else {
             amount = num1;
-            if(d > num2){
-                BigDecimal multiply = new BigDecimal(d).subtract(new BigDecimal(num2)).multiply(new BigDecimal(num3));
-                if(d > num4){
-                    multiply = new BigDecimal(d).subtract(new BigDecimal(num4)).multiply(new BigDecimal(num5)).add(multiply);
+            BigDecimal multiply = BigDecimal.ZERO;
+            BigDecimal yt = BigDecimal.ZERO;
+            if (d > num2) {
+                if(null != mileageList){
+                    List<MileageObject> list = new ArrayList<>();
+                    for (int i = 0; i < mileageList.size(); i++) {
+                        MileageObject mileageObject = mileageList.getObject(i, MileageObject.class);
+                        list.add(mileageObject);
+                    }
+                    //根据配置的里程倒序排序
+                    list.sort(new Comparator<MileageObject>() {
+                        @Override
+                        public int compare(MileageObject o1, MileageObject o2) {
+                            return o1.getMileage().compareTo(o2.getMileage()) * -1;
+                        }
+                    });
+                    //计算每个阶段的增加费用
+                    Double last = new BigDecimal(d).setScale(0, RoundingMode.DOWN).doubleValue();
+                    for (int i = 0; i < list.size(); i++) {
+                        Double mileage = list.get(i).getMileage();
+                        Double price = list.get(i).getPrice();
+                        if(d > mileage){
+                            if(last <= num2){
+                                break;
+                            }
+                            multiply = multiply.add((new BigDecimal(last).subtract(new BigDecimal(mileage))).multiply(new BigDecimal(price)));
+                            last = mileage;
+                        }
+                    }
                 }
-                amount = new BigDecimal(num1).add(multiply).setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
+
+                if (d > num4) {
+                    yt = new BigDecimal(d).subtract(new BigDecimal(num4)).multiply(new BigDecimal(num5));
+                }
+                amount = new BigDecimal(num1).add(multiply).add(yt).setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
             }
+            map.put("qibujia", num1);
+            map.put("lichengfei", multiply.doubleValue());
+            map.put("yuantufei", yt.doubleValue());
+            map.put("zongfeiyong", amount);
         }
         List<Map<String, Object>> list = serverCarModelMapper.queryServerCarModel(4);
         String isCheck = "0";
@@ -268,7 +368,7 @@
         ServerCarModelWarpper serverCarModelWarpper = new ServerCarModelWarpper();
         serverCarModelWarpper.setId(0);
         serverCarModelWarpper.setName("出租车");
-        serverCarModelWarpper.setAmount(amount);
+        serverCarModelWarpper.setAmount(map);
         serverCarModelWarpper.setDx_check(Integer.valueOf(isCheck));
         serverCarModelWarpper.setContentPutOne(new JSONObject());
         serverCarModelWarpper.setContentNotOne(new JSONObject());
@@ -276,17 +376,15 @@
         serverCarModelWarpper.setContentNotTwo(new JSONObject());
         serverCarModelWarpper.setContentPutThree(new JSONObject());
         serverCarModelWarpper.setContentNotThree(new JSONObject());
-        serverCarModelWarpper.setContentExclusive(new JSONObject());
+        serverCarModelWarpper.setContentExclusive(jsonObject);
         serverCarModelWarpper.setContentPrice(new JSONObject());
-
+        
         return serverCarModelWarpper;
     }
-
-
-
-
-    public Double  calculationPrice(JSONObject rule, double distance, long duration, long wait,Double waitMoney) throws Exception {
-        double amount = 0;
+    
+    
+    public Map<String, Object> calculationPrice(JSONObject rule, double distance, long duration, long wait, Double waitMoney) throws Exception {
+        Map<String, Object> map = new HashMap<>();
         //等待费
         Date date = new Date();
         double d = distance / 1000;//实际公里
@@ -296,30 +394,36 @@
         double yt1 = 0;//远途1段
         double yt2 = 0;//远途2段
         double yt3 = 0;//远途3段
-
-
+        
+        
         //夜间服务处理逻辑
         Calendar s = Calendar.getInstance();
         s.setTime(date);
         s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[0]));
         s.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[1]));
-
+        
         Calendar e = Calendar.getInstance();
         e.setTime(date);
         e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[0]));
         e.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[1]));
-
-        if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
-            if(d > rule.getDouble("num6")){
+        
+        if (date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()) {
+            if (d > rule.getDouble("num6")) {
                 yt1 = rule.getDouble("num18") * (d - rule.getDouble("num6"));
             }
-            if(d >  rule.getDouble("num9")){
+            if (d > rule.getDouble("num9")) {
                 yt2 = rule.getDouble("num19") * (d - rule.getDouble("num9"));
             }
-            if(d > rule.getDouble("num12")){
+            if (d > rule.getDouble("num12")) {
                 yt3 = rule.getDouble("num20") * (d - rule.getDouble("num12"));
             }
-            amount = rule.getDouble("num15") + (d1 * rule.getDouble("num16")) + (t1 * rule.getDouble("num17")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+            double amount = rule.getDouble("num15") + (d1 * rule.getDouble("num16")) + (t1 * rule.getDouble("num17")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+            map.put("qibujia", rule.getDouble("num15"));
+            map.put("lichengfei", d1 * rule.getDouble("num16"));
+            map.put("shichangfei", t1 * rule.getDouble("num17"));
+            map.put("dengdaifei", wait * waitMoney);
+            map.put("yuantufei", yt1 + yt2 + yt3);
+            map.put("zongfeiyong", amount);
         }else{
             Calendar s1 = Calendar.getInstance();
             s1.setTime(date);
@@ -330,42 +434,62 @@
             e1.setTime(date);
             e1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[0]));
             e1.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[1]));
-
+            
             Calendar s2 = Calendar.getInstance();
             s2.setTime(date);
             s2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[0]));
             s2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[1]));
-
+            
             Calendar e2 = Calendar.getInstance();
             e2.setTime(date);
             e2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[0]));
             e2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[1]));
             //高峰时段处理逻辑
-            if((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())){
-                if(d > rule.getDouble("num6")){
+            if ((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())) {
+                if (d > rule.getDouble("num6")) {
                     yt1 = rule.getDouble("num26") * (d - rule.getDouble("num6"));
                 }
-                if(d >  rule.getDouble("num9")){
+                if (d > rule.getDouble("num9")) {
                     yt2 = rule.getDouble("num27") * (d - rule.getDouble("num9"));
                 }
-                if(d > rule.getDouble("num12")){
+                if (d > rule.getDouble("num12")) {
                     yt3 = rule.getDouble("num28") * (d - rule.getDouble("num12"));
                 }
-                amount = rule.getDouble("num23") + (d1 * rule.getDouble("num24")) + (t1 * rule.getDouble("num25")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+                double amount = rule.getDouble("num23") + (d1 * rule.getDouble("num24")) + (t1 * rule.getDouble("num25")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+                map.put("qibujia", rule.getDouble("num23"));
+                map.put("lichengfei", d1 * rule.getDouble("num24"));
+                map.put("shichangfei", t1 * rule.getDouble("num25"));
+                map.put("dengdaifei", wait * waitMoney);
+                map.put("yuantufei", yt1 + yt2 + yt3);
+                map.put("zongfeiyong", amount);
             }else{
                 //其他时间段的计算
-                if(d > rule.getDouble("num6")){
+                if (d > rule.getDouble("num6")) {
                     yt1 = rule.getDouble("num8") * (d - rule.getDouble("num6"));
                 }
-                if(d >  rule.getDouble("num9")){
+                if (d > rule.getDouble("num9")) {
                     yt2 = rule.getDouble("num11") * (d - rule.getDouble("num9"));
                 }
-                if(d > rule.getDouble("num12")){
+                if (d > rule.getDouble("num12")) {
                     yt3 = rule.getDouble("num13") * (d - rule.getDouble("num12"));
                 }
-                amount = rule.getDouble("num1") + (d1 * rule.getDouble("num4")) + (t1 * rule.getDouble("num5")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+                double amount = rule.getDouble("num1") + (d1 * rule.getDouble("num4")) + (t1 * rule.getDouble("num5")) + (wait * waitMoney) + yt1 + yt2 + yt3;
+                map.put("qibujia", rule.getDouble("num1"));
+                map.put("lichengfei", d1 * rule.getDouble("num4"));
+                map.put("shichangfei", t1 * rule.getDouble("num5"));
+                map.put("dengdaifei", wait * waitMoney);
+                map.put("yuantufei", yt1 + yt2 + yt3);
+                map.put("zongfeiyong", amount);
             }
         }
-        return amount;
+        return map;
+    }
+
+
+    @Data
+    public static class MileageObject{
+        private Double mileage;
+        private Double price;
+
     }
 }

--
Gitblit v1.7.1