| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Phone; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IPhoneService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IPhoneService phoneService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "当前定位纬度", name = "lat", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "当前定位经度", name = "lnt", required = true, dataType = "double"), |
| | | }) |
| | | public ResultUtil queryCustomerPhone(Double lat, Double lnt){ |
| | | public ResultUtil queryCustomerPhone(Double lat, Double lnt, HttpServletRequest request){ |
| | | try { |
| | | Map<String, Object> map = phoneService.queryCustomerPhone(lat, lnt); |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | Map<String, Object> map = phoneService.queryCustomerPhone(uid, lat, lnt); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | flag as flag, |
| | | upload as upload, |
| | | insertTime as insertTime |
| | | from t_company where flag != 3 and state = 0 and id in ( |
| | | from t_company where flag != 3 and state = 0 and id in |
| | | <foreach collection="ids" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | <if test="null != type"> |
| | | and type = #{type} |
| | | </if> |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryCustomerPhone(Double lat, Double lnt) throws Exception; |
| | | Map<String, Object> queryCustomerPhone(Integer uid, Double lat, Double lnt) throws Exception; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | if(collect.size() == 0){ |
| | | return null; |
| | | } |
| | | List<Company> query = companyMapper.queryList(collect, 3); |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList(collect, 2); |
| | |
| | | Integer state = privateCar.getState(); |
| | | String tripId = privateCar.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if("" == trip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | |
| | | Integer state = orderLogistics.getState(); |
| | | String tripId = orderLogistics.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if("" == trip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 获取所有系统电话 |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryCustomerPhone(Double lat, Double lnt) throws Exception { |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lat, null); |
| | | if(null == reverseGeocode){ |
| | | System.err.println("获取地图信息出错"); |
| | | return new HashMap<>(); |
| | | } |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] city = new String[addressComponentsVos.length]; |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | city[i] = addressComponentsVos[i].getLongName(); |
| | | } |
| | | |
| | | public Map<String, Object> queryCustomerPhone(Integer uid, Double lat, Double lnt) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //平台电话 |
| | | Phone query = phoneMapper.query(2, 1, null, null, null); |
| | | map.put("platform", null != query ? query.getPhone() : ""); |
| | | |
| | | Company companies = companyCityService.query(city); |
| | | Company companies = companyCityService.query1(uid, lnt.toString(), lat.toString()); |
| | | if(null != companies){ |
| | | Integer id = companies.getId(); |
| | | Phone phone = this.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", id)); |
| | | map.put("company", phone.getPhone()); |
| | | map.put("company", null == phone ? "" : phone.getPhone()); |
| | | phone = this.selectOne(new EntityWrapper<Phone>().eq("type", 3).eq("companyId", id)); |
| | | map.put("scheduling", phone.getPhone()); |
| | | map.put("scheduling", null == phone ? "" : phone.getPhone()); |
| | | } |
| | | |
| | | return map; |
| | |
| | | List<Driver> list = driverService.queryIdleDriver(orderPrivateCar.getUserId(), 1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | System.err.println("【" + orderPrivateCar.getId() + "】空闲司机:" + JSON.toJSONString(list)); |
| | | if(list.size() > 0){ |
| | | Optional<Driver> optional = list.stream().filter(d -> !d.getId().equals(reassign.getOrderId())).findFirst(); |
| | | Optional<Driver> optional = list.stream().filter(d -> !d.getId().equals(orderPrivateCar.getDriverId())).findFirst(); |
| | | if(optional.isPresent()){ |
| | | Driver driver1 = optional.get(); |
| | | String text = ""; |
| | |
| | | List<Driver> list1 = driverService.queryIdleDriver(orderLogistics.getUserId(), orderLogistics.getType(), orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder1.getPushDistance(), null);//所有附近空闲司机 |
| | | System.err.println("【" + orderLogistics.getId() + "】空闲司机:" + JSON.toJSONString(list1)); |
| | | if(list1.size() > 0){ |
| | | Optional<Driver> optional = list1.stream().filter(d -> !d.getId().equals(reassign.getOrderId())).findFirst(); |
| | | Optional<Driver> optional = list1.stream().filter(d -> !d.getId().equals(orderLogistics.getDriverId())).findFirst(); |
| | | if(optional.isPresent()){ |
| | | Driver driver1 = optional.get(); |
| | | reassign.setState(3); |
| | |
| | | return updateTrip(tripStatus, vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | if(code == 404){ |
| | | return true; |
| | | } |
| | | logger.error("修改行程异常: tripId={} body={}", tripId, response.body()); |
| | | return false; |
| | | } |
| | |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return null; |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |