| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderAdditionalFee; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Resource |
| | | private OrderTaxiMapper orderTaxiMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GeodesyUtil geodesyUtil; |
| | | |
| | |
| | | orderTaxi.setArriveTime(date); |
| | | orderTaxi.setStartServiceTime(date); |
| | | orderTaxi.setBoardingTime(date); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + uid); |
| | | if (ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(split[0], split[1]); |
| | | orderTaxi.setBoardingAddress(geocode1.get("address")); |
| | | orderTaxi.setBoardingLon(Double.valueOf(split[0])); |
| | | orderTaxi.setBoardingLat(Double.valueOf(split[1])); |
| | | } |
| | | |
| | | |
| | | //调用高德创建轨迹 |
| | | String s = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | String track = gdFalconUtil.createTrack(s); |
| | |
| | | } |
| | | }).start(); |
| | | //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | jsonArray = JSON.parseArray(vehicle); |
| | | } |
| | | jsonArray.add(orderTaxi.getDriverId()); |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | |
| | | orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney()); |
| | | orderTaxi1.setState(8); |
| | | OrderTaxiServiceImpl.this.updateById(orderTaxi1); |
| | | |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | }).start(); |
| | | |
| | | //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | jsonArray = JSON.parseArray(vehicle); |
| | | } |
| | | jsonArray.add(orderTaxi.getDriverId()); |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | |
| | | orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney()); |
| | | orderTaxi1.setState(8); |
| | | OrderTaxiServiceImpl.this.updateById(orderTaxi1); |
| | | |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | }else{ |
| | | orderTaxi.setMileage(0D); |
| | | this.updateById(orderTaxi); |
| | | // return true;//第一条数据不作处理,直接存储 |
| | | return true;//第一条数据不作处理,直接存储 |
| | | } |
| | | Map<String, Double> distance = geodesyUtil.getDistance(now, old); |
| | | if(null != distance){ |
| | |
| | | if(orderTaxi.getState() == 5){//大于50米表示在移动,且正在服务中的时候存入里程 |
| | | orderTaxi.setMileage(new BigDecimal(orderTaxi.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderTaxi); |
| | | // return true; |
| | | return true; |
| | | } |
| | | // return false; |
| | | }else{ |
| | | System.err.println("调用高德计算距离出错"); |
| | | } |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | |