| | |
| | | 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; |
| | |
| | | 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<>()); |
| | |
| | | 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); |
| | | if(serverCarModelWarpper!=null){ |
| | | price.add(serverCarModelWarpper); |
| | | } |
| | | } |
| | | return ResultUtil.success(price); |
| | | } |
| | | |
| | |
| | | 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()), systemPriceCity.getId()); |