Pu Zhibing
2025-08-01 38a87f638d7d0bf0a734053afc060b91bc742567
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
@@ -6,12 +6,14 @@
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.ServerCarModel;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -69,7 +71,6 @@
            return ResultUtil.success(new ArrayList<>());
        }
    
        // TODO: 2023/11/4 无法修改
        Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLonLat, endLonLat, 1);
        if (null == distance) {
            return ResultUtil.error("获取预估距离出错", new ArrayList<>());
@@ -78,10 +79,26 @@
        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, geocode);
        //添加出租车车型和价格
        ServerCarModelWarpper serverCarModelWarpper = this.getTextPrice(query.getId(), distance1_, duration_, 0, 2, geocode);
        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);
            price.add(serverCarModelWarpper);
        }
        return ResultUtil.success(price);
    }
    
@@ -157,6 +174,7 @@
                
                serverCarModelWarpper.setContentExclusive(contentExclusive);
                serverCarModelWarpper.setContentPrice(contentPrice);
                serverCarModelWarpper.setWaitPrice(jsonObject);
                
                serverCarModelWarpper.setAmount(this.calculationPrice(contentExclusive, distance, duration, wait, waitMoney));
                serverCarModelWarpper.setBuyNowAmount(this.calculationPrice(contentPrice, distance, duration, wait, waitMoney));
@@ -296,7 +314,7 @@
        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;