| | |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId()); |
| | | if (null != value) { |
| | | // Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 0);//计算距离 |
| | | // Integer d = Integer.valueOf(distance1.get("distance")); |
| | | String[] split = value.split(","); |
| | | double distance = GDMapGeocodingUtil.getDistance(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | int d = Double.valueOf(distance).intValue(); |
| | | Map<String, Double> distance1 = geodesyUtil.getDistance(orderPrivateCar.getStartLat() + "," + orderPrivateCar.getStartLon(), value); |
| | | int d = distance1.get("WGS84").intValue(); |
| | | if ((0 == m && null == driver) || (d < m)) { |
| | | driver = drivers.get(j); |
| | | m = d; |
| | |
| | | for (Driver driver : ds) { |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if (null != value) { |
| | | Map<String, Double> distance = geodesyUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if ((0 == m && null == dr) || (wgs84.intValue() < m.intValue())) { |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLon + "," + startLat, value, 1); |
| | | int distance1 = Integer.parseInt(distance.get("distance")); |
| | | if ((0 == m && null == dr) || (distance1 < m.intValue())) { |
| | | dr = driver; |
| | | m = wgs84.intValue(); |
| | | m = distance1; |
| | | } |
| | | } |
| | | } |
| | |
| | | dr.setState(3); |
| | | } |
| | | driverService.updateById(dr); |
| | | redisUtil.setStrValue("DRIVER_ORDER" + dr.getId(), orderPrivateCar.getId().toString(), 600); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | if(!lock){ |
| | | return ResultUtil.error("系统繁忙,请稍后重试"); |
| | | } |
| | | String key = orderId + "_during_payment"; |
| | | if(redisUtil.hasKey(key)){ |
| | | return ResultUtil.error("支付中,不能重复发起支付"); |
| | | } |
| | | redisUtil.setStrValue(key, UUIDUtil.getRandomCode(), 10); |
| | | try { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){ |
| | |
| | | if(!lock){ |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 1, type, null); |
| | | if(null != query){ |
| | |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_driver |
| | | where flag != 3 and state = 2 and authState = 2 |
| | | where flag != 3 and state in (2, 3) and authState = 2 |
| | | <if test="null != companyId"> |
| | | <choose> |
| | | <when test="companyId != 1"> |
| | |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDMapGeocodingUtil; |
| | | import com.stylefeng.guns.modular.system.util.GeodesyUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | @Autowired |
| | | private GeodesyUtil geodesyUtil; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | |
| | | if(0 != count){ |
| | | continue; |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | // double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | double d = gdMapElectricFenceUtil.getDrivingRoute(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | if(d < (distance * 1000)){ |
| | | Map<String, Double> distance1 = geodesyUtil.getDistance(lon + "," + lat, value); |
| | | Double wgs84 = distance1.get("WGS84"); |
| | | if(wgs84 < (distance * 1000)){ |
| | | list.add(driver); |
| | | } |
| | | } |
| | |
| | | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); |
| | | } |
| | | } |
| | | |
| | | |
| | | public boolean hasKey(String key){ |
| | | return redisTemplate.hasKey(key); |
| | | } |
| | | |
| | | |
| | | /** |