package com.stylefeng.guns.modular.specialTrain.server.impl;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.stylefeng.guns.core.util.ToolUtil;
|
import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper;
|
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
|
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
|
import com.stylefeng.guns.modular.system.dao.CarServiceMapper;
|
import com.stylefeng.guns.modular.system.dao.RegionMapper;
|
import com.stylefeng.guns.modular.system.dao.SystemPriceMapper;
|
import com.stylefeng.guns.modular.system.model.*;
|
import com.stylefeng.guns.modular.system.service.*;
|
import com.stylefeng.guns.modular.system.util.*;
|
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
|
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
|
import org.gavaghan.geodesy.Ellipsoid;
|
import org.gavaghan.geodesy.GeodeticCalculator;
|
import org.gavaghan.geodesy.GeodeticCurve;
|
import org.gavaghan.geodesy.GlobalCoordinates;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.math.BigDecimal;
|
import java.math.BigInteger;
|
import java.util.*;
|
|
|
@Service
|
public class OrderPrivateCarServiceImpl extends ServiceImpl<OrderPrivateCarMapper, OrderPrivateCar> implements IOrderPrivateCarService {
|
|
@Resource
|
private OrderPrivateCarMapper orderPrivateCarMapper;
|
|
@Resource
|
private SystemPriceMapper systemPriceMapper;
|
|
@Autowired
|
private IDriverService driverService;
|
|
@Autowired
|
private PushUtil pushUtil;
|
|
@Autowired
|
private GDFalconUtil gdFalconUtil;
|
|
@Autowired
|
private GDMapGeocodingUtil gdMapGeocodingUtil;
|
|
@Autowired
|
private ChinaMobileUtil chinaMobileUtil;
|
|
@Resource
|
private RegionMapper regionMapper;
|
|
@Autowired
|
private ISystemNoticeService systemNoticeService;
|
|
@Autowired
|
private IOrderPositionService orderPositionService;
|
|
@Autowired
|
private GDMapElectricFenceUtil gdMapElectricFenceUtil;
|
|
@Autowired
|
private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
|
|
@Autowired
|
private IOrderTaxiService orderTaxiService;
|
|
@Autowired
|
private GeodesyUtil geodesyUtil;
|
|
@Autowired
|
private IOrderAdditionalFeeService orderAdditionalFeeService;
|
|
@Autowired
|
private IAdditionalFeeService additionalFeeService;
|
|
@Autowired
|
private ICompanyService companyService;
|
|
@Value("${pushMinistryOfTransport}")
|
private boolean pushMinistryOfTransport;
|
|
@Autowired
|
private ICarService carService;
|
|
@Resource
|
private CarServiceMapper carServiceMapper;
|
|
|
|
|
|
/**
|
* 获取司机端首页订单列表
|
* @param state 1=服务中,2=待服务(30分钟定义预约)
|
* @param driverId
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId) throws Exception {
|
return orderPrivateCarMapper.queryOrderList(state, driverId);
|
}
|
|
/**
|
* 获取司机端我的订单列表
|
* @param state 1=全部,2=待支付,3=已取消
|
* @param uid
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid) throws Exception {
|
return orderPrivateCarMapper.queryMyAllOrder(state, uid);
|
}
|
|
|
/**
|
* 获取司机抢单页面的订单详情
|
* @param orderId
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public Map<String, Object> queryPushOrder(Integer orderId) throws Exception {
|
return orderPrivateCarMapper.queryPushOrder(orderId);
|
}
|
|
|
|
/**
|
* 抢单操作
|
* @param orderId
|
* @param uid
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public synchronized ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
if(null == orderPrivateCar){
|
return ResultUtil.error("订单已被抢了");
|
}
|
//处理摆渡车的情况
|
if(orderPrivateCar.getType() == 2){
|
//查看用户下的摆渡车是否已被人抢了
|
List<OrderPrivateCar> list = this.selectList(
|
new EntityWrapper<OrderPrivateCar>()
|
.eq("type", 2)
|
.eq("userId", orderPrivateCar.getUserId())
|
.ne("state", 1)
|
.eq("crossCityOrderId", orderPrivateCar.getCrossCityOrderId())
|
.eq("place", orderPrivateCar.getPlace())
|
);
|
List<OrderTaxi> list1 = orderTaxiService.selectList(
|
new EntityWrapper<OrderTaxi>()
|
.eq("type", 2)
|
.eq("userId", orderPrivateCar.getUserId())
|
.ne("state", 1)
|
.eq("crossCityOrderId", orderPrivateCar.getCrossCityOrderId())
|
.eq("place", orderPrivateCar.getPlace())
|
);
|
if(list.size() > 0 || list1.size() > 0){
|
return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
|
}
|
}
|
|
if(orderPrivateCar.getState() == 10){
|
return ResultUtil.error("订单已取消");
|
}
|
if(orderPrivateCar.getState() != 1){
|
return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
|
}
|
Driver driver = driverService.selectById(uid);
|
if(orderPrivateCar.getType() == 3){
|
//批量订单
|
CarService carService = new CarService();
|
carService.setCarId(driver.getCarId());
|
carService.setType(1);
|
CarService carService1 = carServiceMapper.selectOne(carService);
|
orderPrivateCar.setServerCarModelId(carService1.getServerCarModelId());
|
//1=独享,2=一口价
|
String serverCarModel = orderPrivateCar.getServerCarModel();
|
JSONArray jsonArray = JSON.parseArray(serverCarModel);
|
Integer rideType1 = null;
|
for (int i = 0; i < jsonArray.size(); i++) {
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
Integer serverCarModelId = jsonObject.getInteger("serverCarModelId");
|
Integer rideType = jsonObject.getInteger("rideType");
|
if(serverCarModelId.equals(carService1.getServerCarModelId())){
|
rideType1 = rideType;
|
if(rideType == 1){
|
break;
|
}
|
}
|
}
|
orderPrivateCar.setRideType(rideType1);
|
}
|
orderPrivateCar.setDriverId(uid);
|
orderPrivateCar.setCarId(driver.getCarId());
|
orderPrivateCar.setCompanyId(driver.getFranchiseeId() != null && driver.getFranchiseeId() != 0 ? driver.getFranchiseeId() : (
|
driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1));
|
orderPrivateCar.setState(2);
|
orderPrivateCar.setSnatchOrderTime(new Date());
|
|
//调用高德创建轨迹
|
String s = gdFalconUtil.selectTerminal(driver.getPhone());
|
String track = gdFalconUtil.createTrack(s);
|
orderPrivateCar.setTrackId(track);
|
|
//调用移动的小号接口
|
Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), (System.currentTimeMillis() + 86400000));
|
if(String.valueOf(map.get("code")).equals("200")){
|
orderPrivateCar.setTelX(map.get("telX"));
|
orderPrivateCar.setBindId(map.get("bindId"));
|
}
|
|
this.updateById(orderPrivateCar);
|
|
//处理摆渡车的情况
|
if(orderPrivateCar.getType() == 2){
|
//查看用户下的摆渡车是否已被人抢了
|
List<OrderPrivateCar> list = this.selectList(
|
new EntityWrapper<OrderPrivateCar>()
|
.eq("type", 2)
|
.eq("userId", orderPrivateCar.getUserId())
|
.ne("state", 1)
|
.eq("crossCityOrderId", orderPrivateCar.getCrossCityOrderId())
|
.eq("place", orderPrivateCar.getPlace()).ne("id", orderPrivateCar.getId())
|
);
|
List<OrderTaxi> list1 = orderTaxiService.selectList(
|
new EntityWrapper<OrderTaxi>()
|
.eq("type", 2)
|
.eq("userId", orderPrivateCar.getUserId())
|
.ne("state", 1)
|
.eq("crossCityOrderId", orderPrivateCar.getCrossCityOrderId())
|
.eq("place", orderPrivateCar.getPlace())
|
);
|
for(OrderPrivateCar orderPrivateCar1 : list){
|
orderPrivateCar1.setState(10);
|
this.updateById(orderPrivateCar1);
|
}
|
for(OrderTaxi orderTaxi : list1){
|
orderTaxi.setState(10);
|
orderTaxiService.updateById(orderTaxi);
|
}
|
}
|
|
//如果是预约单,则不修改司机为服务中
|
if(orderPrivateCar.getOrderType() != 2 || (orderPrivateCar.getOrderType() == 2 && orderPrivateCar.getTravelTime().getTime() < System.currentTimeMillis() + 600000)){
|
//修改司机为服务中
|
driver.setState(3);
|
driverService.updateById(driver);
|
}
|
|
//推送相关代码------------------start----------------
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
|
pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
|
if(orderPrivateCar.getType() == 2){
|
pushUtil.pushFerryOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 2);
|
}
|
}
|
}).start();
|
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushDriverPosition(orderId, 1);
|
}
|
}).start();
|
|
systemNoticeService.addSystemNotice(2, "您已成功抢得快车订单,请及时联系客户!", orderPrivateCar.getDriverId(), 1);
|
systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getName().substring(0, 1) + "师傅,请保持电话畅通!", orderPrivateCar.getUserId(), 1);
|
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
if(pushMinistryOfTransport){
|
//上传数据
|
pushMinistryOfTransportUtil.orderCreate(orderId);
|
pushMinistryOfTransportUtil.orderMatch(orderId);
|
}
|
}
|
}).start();
|
|
return ResultUtil.success(orderPrivateCar.getId());
|
}
|
|
|
@Autowired
|
private RedisUtil redisUtil;
|
|
/**
|
* 获取订单详情页(服务中的页面)
|
* @param orderId
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public Map<String, Object> queryOrderInfo(Integer orderId) throws Exception {
|
List<Map<String, Object>> orders = new ArrayList<>();
|
|
OrderPrivateCar orderPrivateCar = this.baseMapper.selectById(orderId);
|
if(orderPrivateCar.getPid()==null){
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderId,4,null,null);
|
for (Map<String, Object> map : order) {
|
String phone = map.get("phone").toString();
|
String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 );
|
map.put("realPhone", s);
|
}
|
if(order!=null){
|
orders.addAll(order);
|
}
|
String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
|
order = this.baseMapper.queryOrderInfo(orderId,5,value.split(",")[0],value.split(",")[1]);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
|
order = this.baseMapper.queryOrderInfo(orderId,6,null,null);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
}else{
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),4,null,null);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
|
order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),5,value.split(",")[0],value.split(",")[1]);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
|
order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),6,null,null);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("line", "");
|
map.put("peopleNumber", 0);
|
map.put("orderNumber","");
|
map.put("totalMoney", 0d);
|
map.put("serverMoney", 0d);
|
map.put("emergencyCall", "110");
|
map.put("orders", JSON.toJSONString(orders));
|
return map;
|
//return orderPrivateCarMapper.queryOrderInfo(orderId);
|
}
|
|
@Override
|
public Map<String, Object> queryOrderInfo2(Integer orderId) throws Exception {
|
/*List<Map<String, Object>> orders = new ArrayList<>();
|
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderId,4,null,null);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
OrderPrivateCar orderPrivateCar = this.baseMapper.selectById(orderId);
|
String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
|
order = this.baseMapper.queryOrderInfo(orderId,5,value.split(",")[0],value.split(",")[1]);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
|
order = this.baseMapper.queryOrderInfo(orderId,6,null,null);
|
if(order!=null){
|
orders.addAll(order);
|
}
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("line", "");
|
map.put("peopleNumber", 0);
|
map.put("orderNumber","");
|
map.put("totalMoney", 0d);
|
map.put("serverMoney", 0d);
|
map.put("emergencyCall", "110");
|
map.put("orders", JSON.toJSONString(orders));
|
return map;*/
|
Map<String,Object> map = orderPrivateCarMapper.queryOrderInfo2(orderId);
|
OrderPrivateCar orderPrivateCar = this.baseMapper.selectById(orderId);
|
Integer canOperation=1;
|
if(orderPrivateCar.getState()<5){
|
if(orderPrivateCar.getPid()==null) {
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderId, 4, null, null);
|
if (order != null && order.size()>0) {
|
if(!order.get(0).get("orderId").equals(orderId)){
|
canOperation=0;
|
}
|
}
|
}else {
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),4,null,null);
|
if(order!=null && order.size()>0){
|
if(!order.get(0).get("orderId").equals(orderId)){
|
canOperation=0;
|
}
|
}
|
}
|
}
|
map.put("canOperation",canOperation);
|
System.out.println(map);
|
String phone = map.get("phone").toString();
|
String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 );
|
map.put("realPhone", s);
|
return map;
|
}
|
|
/**
|
* 走订单流程操作
|
* @param orderId
|
* @param state
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
Integer canOperation=1;
|
if(state<5){
|
if(orderPrivateCar.getPid()==null) {
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderId, 4, null, null);
|
if (order != null && order.size()>0) {
|
if(!order.get(0).get("orderId").equals(orderId)){
|
canOperation=0;
|
}
|
}
|
}else {
|
List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),4,null,null);
|
if(order!=null && order.size()>0){
|
if(!order.get(0).get("orderId").equals(orderId)){
|
canOperation=0;
|
}
|
}
|
}
|
if(canOperation==0){
|
return ResultUtil.error("当前订单不能操作");
|
}
|
}
|
switch (state){
|
case 3://出发前往预约点
|
orderPrivateCar.setState(3);
|
orderPrivateCar.setSetOutTime(new Date());
|
systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderPrivateCar.getUserId(), 1);
|
break;
|
case 4://到达预约点,等待客户上车
|
orderPrivateCar.setState(4);
|
orderPrivateCar.setArriveTime(new Date());
|
systemNoticeService.addSystemNotice(1, "司机已到达您设置的预约地点,请及时上车", orderPrivateCar.getUserId(), 1);
|
break;
|
case 5://开始服务
|
orderPrivateCar.setBoardingLon(lon);
|
orderPrivateCar.setBoardingLat(lat);
|
orderPrivateCar.setBoardingAddress(address);
|
orderPrivateCar.setBoardingTime(new Date());
|
orderPrivateCar.setState(5);
|
orderPrivateCar.setStartServiceTime(new Date());
|
|
pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位
|
|
break;
|
case 6://结束服务(专车可以返回继续服务)不修改状态
|
orderPrivateCar.setGetoffLon(lon);
|
orderPrivateCar.setGetoffLat(lat);
|
orderPrivateCar.setGetoffAddress(address);
|
orderPrivateCar.setGetoffTime(new Date());
|
orderPrivateCar.setEndServiceTime(new Date());
|
break;
|
}
|
this.updateById(orderPrivateCar);
|
|
// TODO: 2020/6/5 推送状态
|
OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushOrderState(1, finalOrderPrivateCar.getUserId(), finalOrderPrivateCar.getId(), 1, finalOrderPrivateCar.getState());
|
pushUtil.pushOrderState(2, finalOrderPrivateCar.getDriverId(), finalOrderPrivateCar.getId(), 1, finalOrderPrivateCar.getState());
|
if(finalOrderPrivateCar.getState() == 5 && pushMinistryOfTransport){//上传数据
|
pushMinistryOfTransportUtil.operateDepart(orderId);
|
}
|
if(finalOrderPrivateCar.getState()==5 || finalOrderPrivateCar.getState()==6){
|
if(finalOrderPrivateCar.getSpellSuccess()==1){
|
if(finalOrderPrivateCar.getPid()==null){
|
List<OrderPrivateCar> orderList1 = orderPrivateCarMapper.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid",finalOrderPrivateCar.getId()));
|
for(OrderPrivateCar orderPrivateCar3:orderList1){
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
}else{
|
List<OrderPrivateCar> orderList1 = orderPrivateCarMapper.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid",finalOrderPrivateCar.getPid()));
|
for(OrderPrivateCar orderPrivateCar3:orderList1){
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
OrderPrivateCar orderPrivateCar3 = orderPrivateCarMapper.selectById(finalOrderPrivateCar.getPid());
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
}
|
}
|
}
|
}).start();
|
return ResultUtil.success();
|
}
|
|
|
|
/**
|
* 确认费用操作
|
* @param orderId
|
* @param type
|
* @param parkingFee
|
* @param crossingFee
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil confirmFees(Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用
|
orderPrivateCar.setPayManner(type);
|
if (crossingFee!=null){
|
String s = crossingFee.toString();
|
BigDecimal trave = new BigDecimal(s);
|
orderPrivateCar.setRoadTollMoney(trave.setScale(2, BigDecimal.ROUND_DOWN).doubleValue());
|
}else{
|
orderPrivateCar.setRoadTollMoney(0.0);
|
}
|
if (parkingFee!=null){
|
String s1 = parkingFee.toString();
|
BigDecimal parking = new BigDecimal(s1);
|
orderPrivateCar.setParkMoney(parking.setScale(2, BigDecimal.ROUND_DOWN).doubleValue());
|
}else{
|
orderPrivateCar.setParkMoney(0.0);
|
|
}
|
orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney() + orderPrivateCar.getParkMoney() + orderPrivateCar.getRoadTollMoney());
|
orderPrivateCar.setState(7);
|
this.updateById(orderPrivateCar);
|
|
pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
|
systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId(), 1);
|
|
//回滚司机状态为空闲
|
if(orderPrivateCar.getSpellSuccess()==0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}else{
|
if(orderPrivateCar.getPid()==null){
|
Integer number = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
if(number<=0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}
|
}else{
|
Integer number = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
Integer number1 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()).lt("state",6));
|
if(number<=0 && number1<=0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}
|
}
|
}
|
|
//修改总订单人数
|
OrderPrivateCar orderPrivateCar2 = new OrderPrivateCar();
|
orderPrivateCar2.setTotalPeopleNum(orderPrivateCar.getTotalPeopleNum()-orderPrivateCar.getPeopleNum());
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
//
|
OrderPrivateCar finalOrderTaxi = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
}
|
}).start();
|
if(orderPrivateCar.getSpellSuccess()==1){
|
List<OrderPrivateCar> orderList1 = this.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()));
|
for(OrderPrivateCar orderPrivateCar3:orderList1){
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
OrderPrivateCar orderPrivateCar3 = this.selectById(orderPrivateCar.getPid());
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
if(pushMinistryOfTransport){//上传交通数据
|
pushMinistryOfTransportUtil.baseInfoVehicleTotalMile(finalOrderPrivateCar.getCarId());
|
pushMinistryOfTransportUtil.operateArrive(orderId);
|
}
|
}
|
}).start();
|
|
|
return ResultUtil.success();
|
}
|
|
@Override
|
public ResultUtil cancleOrder(Integer orderId) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
orderPrivateCar.setState(10);
|
orderPrivateCar.setDriverCancle(1);
|
this.updateById(orderPrivateCar);
|
|
pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
|
systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId(), 1);
|
|
//回滚司机状态为空闲
|
if(orderPrivateCar.getSpellSuccess()==0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}else{
|
if(orderPrivateCar.getPid()==null){
|
Integer number = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
if(number<=0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}
|
}else{
|
Integer number = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
Integer number1 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()).lt("state",6));
|
if(number<=0 && number1<=0){
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
}
|
}
|
}
|
|
Integer number1 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
Integer number2 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
if(number1+number2==1){
|
OrderPrivateCar orderPrivateCar2 = new OrderPrivateCar();
|
orderPrivateCar2.setTotalPeopleNum(orderPrivateCar.getTotalPeopleNum()-orderPrivateCar.getPeopleNum());
|
orderPrivateCar2.setSpellSuccess(0);
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
|
}else{
|
OrderPrivateCar orderPrivateCar2 = new OrderPrivateCar();
|
orderPrivateCar2.setTotalPeopleNum(orderPrivateCar.getTotalPeopleNum()-orderPrivateCar.getPeopleNum());
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
this.update(orderPrivateCar2,new EntityWrapper<OrderPrivateCar>().eq("id",orderPrivateCar.getPid()==null?orderPrivateCar.getId():orderPrivateCar.getPid()).lt("state",6));
|
}
|
OrderPrivateCar finalOrderTaxi = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
//pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
}
|
}).start();
|
if(orderPrivateCar.getSpellSuccess()==1){
|
if(orderPrivateCar.getPid()==null){
|
List<OrderPrivateCar> orderList1 = this.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getId()));
|
for(OrderPrivateCar orderPrivateCar3:orderList1){
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
// pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 13);
|
}else{
|
List<OrderPrivateCar> orderList1 = this.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getPid()));
|
for(OrderPrivateCar orderPrivateCar3:orderList1){
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
OrderPrivateCar orderPrivateCar3 = this.selectById(orderPrivateCar.getPid());
|
pushUtil.pushOrderState(1, orderPrivateCar3.getUserId(), orderPrivateCar3.getId(), 1, 13);
|
}
|
}
|
return ResultUtil.success();
|
}
|
|
|
@Override
|
public ResultUtil updatePeopleNum(Integer orderId, Integer peopleNum) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
orderPrivateCar.setPeopleNum(peopleNum);
|
if(peopleNum==4){
|
orderPrivateCar.setRideType(1);
|
}
|
this.updateById(orderPrivateCar);
|
return ResultUtil.success();
|
}
|
|
@Override
|
public ResultUtil confirmFees1(Integer orderId, Integer type, String additionalFee) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用
|
orderPrivateCar.setPayManner(type);
|
orderPrivateCar.setParkMoney(0D);
|
orderPrivateCar.setRoadTollMoney(0D);
|
Company company = companyService.selectById(orderPrivateCar.getCompanyId());
|
orderPrivateCar.setHolidayFee(null == company.getHolidayFee() ? 0D : company.getHolidayFee());
|
|
Double t = 0D;
|
if(ToolUtil.isNotEmpty(additionalFee)){//附加费
|
JSONArray jsonArray = JSON.parseArray(additionalFee);
|
for(int i = 0; i < jsonArray.size(); i++){
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
Integer id = jsonObject.getInteger("id");
|
Double amount = jsonObject.getDouble("amount");
|
OrderAdditionalFee orderAdditionalFee = new OrderAdditionalFee();
|
orderAdditionalFee.setOrderType(1);
|
orderAdditionalFee.setOrderId(orderId);
|
orderAdditionalFee.setAdditionalFeeId(id);
|
orderAdditionalFee.setAmount(amount);
|
orderAdditionalFeeService.insert(orderAdditionalFee);
|
t += amount;
|
}
|
}
|
orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney() + orderPrivateCar.getParkMoney() + orderPrivateCar.getRoadTollMoney() + orderPrivateCar.getHolidayFee() + t);
|
orderPrivateCar.setState(7);
|
this.updateById(orderPrivateCar);
|
|
pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
|
systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId(), 1);
|
|
//回滚司机状态为空闲
|
Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
|
driver.setState(2);
|
driverService.updateById(driver);
|
|
OrderPrivateCar finalOrderTaxi = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
|
}
|
}).start();
|
|
OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
if(pushMinistryOfTransport){//上传交通数据
|
pushMinistryOfTransportUtil.baseInfoVehicleTotalMile(finalOrderPrivateCar.getCarId());
|
pushMinistryOfTransportUtil.operateArrive(orderId);
|
}
|
}
|
}).start();
|
|
|
return ResultUtil.success();
|
}
|
|
|
|
/**
|
* 获取订单费用明细
|
* @param orderId
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
if(orderPrivateCar.getState() == 5){//服务中的时候获取实时费用数据
|
orderPrivateCar=this.setMoney(orderPrivateCar, 0D, 0D);
|
}
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("orderMoney", orderPrivateCar.getOrderMoney());//订单金额
|
map.put("startMileage", orderPrivateCar.getStartMileage());//起步价
|
map.put("startMoney", orderPrivateCar.getStartMoney());//起步价
|
map.put("mileageKilometers", orderPrivateCar.getMileageKilometers());//里程费
|
map.put("mileageMoney", orderPrivateCar.getMileageMoney());//里程费
|
map.put("duration", orderPrivateCar.getDuration());//时长费
|
map.put("durationMoney", orderPrivateCar.getDurationMoney());//时长费
|
map.put("wait", orderPrivateCar.getWait());//等待费
|
map.put("waitMoney", orderPrivateCar.getWaitMoney());//等待费
|
map.put("longDistance", orderPrivateCar.getLongDistance());//远途费
|
map.put("longDistanceMoney", orderPrivateCar.getLongDistanceMoney());//远途费
|
map.put("parkMoney", orderPrivateCar.getParkMoney());//停车费
|
map.put("roadTollMoney", orderPrivateCar.getRoadTollMoney());//过路费
|
map.put("redPacketMoney", orderPrivateCar.getRedPacketMoney());//红包抵扣金额
|
map.put("couponMoney", orderPrivateCar.getCouponMoney());//优惠券抵扣金额
|
map.put("discountMoney", orderPrivateCar.getDiscountMoney());//折扣抵扣金额
|
map.put("discount", orderPrivateCar.getDiscount());//折扣
|
map.put("holidayFee", orderPrivateCar.getHolidayFee());//节假日费
|
|
List<OrderAdditionalFee> orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper<OrderAdditionalFee>().eq("orderType", 1).eq("orderId", orderId));
|
List<Map<String, Object>> list = new ArrayList<>();
|
orderAdditionalFees.forEach(orderAdditionalFee -> {
|
AdditionalFee additionalFee = additionalFeeService.selectById(orderAdditionalFee.getAdditionalFeeId());
|
Map<String, Object> map1 = new HashMap<>();
|
map1.put("name", additionalFee.getName());
|
map1.put("amount", orderAdditionalFee.getAmount());
|
list.add(map1);
|
});
|
map.put("additionalFee", list);
|
return map;
|
}
|
|
/**
|
* 计算已服务的实时里程
|
* @param orderId
|
* @param lon
|
* @param lat
|
*/
|
@Override
|
public boolean calculateMileage(Integer orderId, String lon, String lat) throws Exception {
|
OrderPrivateCar orderPrivateCar = this.selectById(orderId);
|
OrderPosition orderPosition = orderPositionService.queryNew(orderId, 1);
|
String now = lon + "," + lat;
|
String old = null;
|
if(null != orderPosition){
|
old = orderPosition.getLon() + "," + orderPosition.getLat();
|
}else{
|
orderPrivateCar.setMileage(0D);
|
this.updateById(orderPrivateCar);
|
// return true;//第一条数据不作处理,直接存储
|
}
|
Map<String, Double> distance = geodesyUtil.getDistance(now, old);
|
if(null != distance){
|
Double distance1 = distance.get("WGS84");
|
if(distance1 < 50){
|
return false;
|
}
|
if(orderPrivateCar.getState() == 5){//大于50米表示在移动,且在服务中的时候记录里程
|
double v = new BigDecimal(Objects.isNull(orderPrivateCar.getMileage()) ? 0 : orderPrivateCar.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
|
orderPrivateCar.setMileage(v);
|
this.updateById(orderPrivateCar);
|
// return true;
|
}
|
// return false;
|
}else{
|
System.err.println("调用高德计算距离出错");
|
}
|
return true;
|
}
|
// private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){
|
// //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离
|
// GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo);
|
// return geoCurve.getEllipsoidalDistance();
|
// }
|
// public static void main(String[] args) {
|
//
|
// String lonlat = "[{\"altitude\":\"999.39\",\"directionAngle\":\"101.0\",\"driverId\":2604,\"insertTime\":1707200436134,\"lat\":\"40.75779317419233\",\"lon\":\"107.42503672835745\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.17\",\"directionAngle\":\"150.0\",\"driverId\":2604,\"insertTime\":1707200441150,\"lat\":\"40.757521862988256\",\"lon\":\"107.42524497028445\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.6\",\"directionAngle\":\"147.8000030517578\",\"driverId\":2604,\"insertTime\":1707200446156,\"lat\":\"40.75726909799932\",\"lon\":\"107.42543479419442\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.76\",\"directionAngle\":\"147.0\",\"driverId\":2604,\"insertTime\":1707200451153,\"lat\":\"40.75703067403478\",\"lon\":\"107.4256351001227\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.29\",\"directionAngle\":\"165.10000610351562\",\"driverId\":2604,\"insertTime\":1707200456204,\"lat\":\"40.756903769256084\",\"lon\":\"107.4257114630914\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.2\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200461184,\"lat\":\"40.756851081610215\",\"lon\":\"107.42574739217866\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.4\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200466207,\"lat\":\"40.75684567726123\",\"lon\":\"107.42574777133517\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.36\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200475018,\"lat\":\"40.75684683002156\",\"lon\":\"107.42574535316311\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.34\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200476160,\"lat\":\"40.756846749820404\",\"lon\":\"107.42574553302774\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.21\",\"directionAngle\":\"147.5\",\"driverId\":2604,\"insertTime\":1707200481174,\"lat\":\"40.75684800820627\",\"lon\":\"107.4257615418673\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.65\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200486172,\"lat\":\"40.75684378237975\",\"lon\":\"107.4257649290251\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.1\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200491180,\"lat\":\"40.75683965202859\",\"lon\":\"107.42576143105475\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.36\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200496286,\"lat\":\"40.75684092222789\",\"lon\":\"107.42576239051274\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.37\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200501205,\"lat\":\"40.756841012059944\",\"lon\":\"107.42576269031063\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.37\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200506211,\"lat\":\"40.75684093194499\",\"lon\":\"107.42576276025271\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.26\",\"directionAngle\":\"147.5\",\"driverId\":2604,\"insertTime\":1707200511230,\"lat\":\"40.75685172136616\",\"lon\":\"107.42576106260151\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.51\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200516221,\"lat\":\"40.756859236034764\",\"lon\":\"107.42576229253426\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.98\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200521242,\"lat\":\"40.75686561301089\",\"lon\":\"107.42575949518891\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.16\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200526347,\"lat\":\"40.75686617331329\",\"lon\":\"107.42575964514279\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.16\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200531252,\"lat\":\"40.7568662333583\",\"lon\":\"107.42575964514918\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.16\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200536261,\"lat\":\"40.75686628341935\",\"lon\":\"107.42575961517568\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.16\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200541262,\"lat\":\"40.756866283411505\",\"lon\":\"107.42575962516864\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.03\",\"directionAngle\":\"135.8000030517578\",\"driverId\":2604,\"insertTime\":1707200546274,\"lat\":\"40.756846674681114\",\"lon\":\"107.42579022145209\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"46.290000915527344\",\"driverId\":2604,\"insertTime\":1707200551285,\"lat\":\"40.75680230663571\",\"lon\":\"107.42589775026643\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.78\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200557046,\"lat\":\"40.75684039488447\",\"lon\":\"107.42592340598091\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.73\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200558148,\"lat\":\"40.7568423955373\",\"lon\":\"107.42592447542859\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.03\",\"directionAngle\":\"22.5\",\"driverId\":2604,\"insertTime\":1707200559327,\"lat\":\"40.75684502819147\",\"lon\":\"107.42592361632427\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.03\",\"directionAngle\":\"22.5\",\"driverId\":2604,\"insertTime\":1707200559359,\"lat\":\"40.75684502819147\",\"lon\":\"107.42592361632427\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.46\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200564353,\"lat\":\"40.7568407763259\",\"lon\":\"107.42592194706589\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1005.5\",\"directionAngle\":\"22.5\",\"driverId\":2604,\"insertTime\":1707200569353,\"lat\":\"40.75684316180153\",\"lon\":\"107.42591729065246\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1005.24\",\"directionAngle\":\"22.5\",\"driverId\":2604,\"insertTime\":1707200574362,\"lat\":\"40.75683522381543\",\"lon\":\"107.42589458603544\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1004.86\",\"directionAngle\":\"337.6000061035156\",\"driverId\":2604,\"insertTime\":1707200579368,\"lat\":\"40.75684838575838\",\"lon\":\"107.42587930834135\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.34\",\"directionAngle\":\"327.2900085449219\",\"driverId\":2604,\"insertTime\":1707200584368,\"lat\":\"40.756936733433164\",\"lon\":\"107.4258013731563\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"331.20001220703125\",\"driverId\":2604,\"insertTime\":1707200589394,\"lat\":\"40.757029268793545\",\"lon\":\"107.42571729237147\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.49\",\"directionAngle\":\"343.20001220703125\",\"driverId\":2604,\"insertTime\":1707200594382,\"lat\":\"40.75707303250807\",\"lon\":\"107.42569057580535\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.58\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200599399,\"lat\":\"40.757081180586134\",\"lon\":\"107.42566244638797\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.42\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200604393,\"lat\":\"40.757079839869355\",\"lon\":\"107.42566207650397\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.54\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200609413,\"lat\":\"40.757079970138584\",\"lon\":\"107.42566185667172\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.57\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200614505,\"lat\":\"40.75707994003024\",\"lon\":\"107.42566196659158\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.57\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200619435,\"lat\":\"40.75707997012298\",\"lon\":\"107.42566187665773\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.58\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200624463,\"lat\":\"40.757080040198915\",\"lon\":\"107.42566184668618\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.58\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200629454,\"lat\":\"40.75708019029586\",\"lon\":\"107.42566186668819\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.58\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200634477,\"lat\":\"40.757080190342684\",\"lon\":\"107.42566180673015\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.58\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200639516,\"lat\":\"40.75708017037449\",\"lon\":\"107.42566174676999\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.57\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200644494,\"lat\":\"40.757080070346284\",\"lon\":\"107.4256616868013\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.57\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200649504,\"lat\":\"40.75707998031776\",\"lon\":\"107.42566163682669\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.57\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200654511,\"lat\":\"40.75707993028804\",\"lon\":\"107.42566162682834\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.56\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200659514,\"lat\":\"40.75707989024243\",\"lon\":\"107.4256616468101\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.56\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200664555,\"lat\":\"40.757079880219315\",\"lon\":\"107.42566166679504\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.55\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200669594,\"lat\":\"40.75707981019801\",\"lon\":\"107.42566162681555\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.54\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200674576,\"lat\":\"40.75707969014697\",\"lon\":\"107.42566157683774\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.54\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200679595,\"lat\":\"40.75707961008695\",\"lon\":\"107.42566157682921\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.53\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200684594,\"lat\":\"40.75707950004342\",\"lon\":\"107.42566152685247\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.53\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200689615,\"lat\":\"40.7570794200068\",\"lon\":\"107.4256614968649\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.53\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200694638,\"lat\":\"40.7570794399984\",\"lon\":\"107.42566152684607\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.52\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200699617,\"lat\":\"40.75707943998279\",\"lon\":\"107.42566154683207\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.51\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200704693,\"lat\":\"40.757079399913756\",\"lon\":\"107.42566159679284\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.5\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200709636,\"lat\":\"40.75707933986093\",\"lon\":\"107.42566160677943\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.5\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200714655,\"lat\":\"40.75707926987864\",\"lon\":\"107.42566151683492\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.49\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200719677,\"lat\":\"40.757079219895736\",\"lon\":\"107.42566144687856\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.48\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200724659,\"lat\":\"40.75707920991165\",\"lon\":\"107.42566141689849\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200729678,\"lat\":\"40.757079199950965\",\"lon\":\"107.42566135693939\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200734809,\"lat\":\"40.757079169990874\",\"lon\":\"107.42566127699216\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200739698,\"lat\":\"40.7570791900449\",\"lon\":\"107.42566122702927\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200744742,\"lat\":\"40.757079240105824\",\"lon\":\"107.42566119705558\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.43\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200749718,\"lat\":\"40.757079310150544\",\"lon\":\"107.42566120705605\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.43\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200754741,\"lat\":\"40.757079300127444\",\"lon\":\"107.42566122704099\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.43\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200759763,\"lat\":\"40.75707929006531\",\"lon\":\"107.42566129699097\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200764753,\"lat\":\"40.757079269995685\",\"lon\":\"107.42566136693986\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200769758,\"lat\":\"40.75707922995006\",\"lon\":\"107.4256613869216\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200774738,\"lat\":\"40.75707917990474\",\"lon\":\"107.42566139690928\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.46\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200779747,\"lat\":\"40.75707905985371\",\"lon\":\"107.42566134693146\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200784757,\"lat\":\"40.757078989785576\",\"lon\":\"107.42566136691\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200789780,\"lat\":\"40.757078949732154\",\"lon\":\"107.42566139688476\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200794889,\"lat\":\"40.757078869648716\",\"lon\":\"107.42566142685524\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200799799,\"lat\":\"40.75707880958809\",\"lon\":\"107.42566144683485\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200804838,\"lat\":\"40.75707879954157\",\"lon\":\"107.42566149679881\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200809841,\"lat\":\"40.757078759488145\",\"lon\":\"107.42566152677357\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.47\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200814884,\"lat\":\"40.757078659420905\",\"lon\":\"107.42566151676989\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.46\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200820390,\"lat\":\"40.757078569353375\",\"lon\":\"107.4256615167603\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.46\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200824984,\"lat\":\"40.75707843926363\",\"lon\":\"107.42566150675344\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200829878,\"lat\":\"40.75707832918889\",\"lon\":\"107.4256614967487\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200834904,\"lat\":\"40.75707826915168\",\"lon\":\"107.4256614867493\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200839920,\"lat\":\"40.757078229137264\",\"lon\":\"107.42566146675904\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200844920,\"lat\":\"40.757078209114454\",\"lon\":\"107.42566147674991\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200849920,\"lat\":\"40.75707819909914\",\"lon\":\"107.42566148674184\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.44\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200854960,\"lat\":\"40.757078169076635\",\"lon\":\"107.42566148673865\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.43\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200859924,\"lat\":\"40.75707813903852\",\"lon\":\"107.42566150672145\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.42\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200864961,\"lat\":\"40.757078109000396\",\"lon\":\"107.42566152670427\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.97\",\"directionAngle\":\"340.1000061035156\",\"driverId\":2604,\"insertTime\":1707200870004,\"lat\":\"40.75708082023016\",\"lon\":\"107.42566255627266\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.85\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200874983,\"lat\":\"40.75707520086134\",\"lon\":\"107.42566916104903\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.0\",\"directionAngle\":\"328.0\",\"driverId\":2604,\"insertTime\":1707200879954,\"lat\":\"40.75708087982255\",\"lon\":\"107.42566313587328\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.53\",\"directionAngle\":\"330.2900085449219\",\"driverId\":2604,\"insertTime\":1707200884976,\"lat\":\"40.75720313702273\",\"lon\":\"107.42554030443152\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.94\",\"directionAngle\":\"329.70001220703125\",\"driverId\":2604,\"insertTime\":1707200889981,\"lat\":\"40.75733078438575\",\"lon\":\"107.42546059304932\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.79\",\"directionAngle\":\"328.70001220703125\",\"driverId\":2604,\"insertTime\":1707200895007,\"lat\":\"40.75740699453066\",\"lon\":\"107.42540477946116\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.27\",\"directionAngle\":\"321.3900146484375\",\"driverId\":2604,\"insertTime\":1707200899987,\"lat\":\"40.757469592491745\",\"lon\":\"107.42535136260005\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.99\",\"directionAngle\":\"337.5\",\"driverId\":2604,\"insertTime\":1707200905056,\"lat\":\"40.75761922379188\",\"lon\":\"107.42524791867466\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.86\",\"directionAngle\":\"328.7900085449219\",\"driverId\":2604,\"insertTime\":1707200910023,\"lat\":\"40.75773943950801\",\"lon\":\"107.42516169943903\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.45\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200915152,\"lat\":\"40.75775210066618\",\"lon\":\"107.4251463110838\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.65\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200920107,\"lat\":\"40.75775931452798\",\"lon\":\"107.42514836048261\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.67\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200925064,\"lat\":\"40.75776211680477\",\"lon\":\"107.42514813093483\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.66\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200930103,\"lat\":\"40.757762847421105\",\"lon\":\"107.4251480410728\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.65\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200935065,\"lat\":\"40.7577627573308\",\"lon\":\"107.42514807104317\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.64\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200940097,\"lat\":\"40.757762677255585\",\"lon\":\"107.42514809102127\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.62\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707200945220,\"lat\":\"40.75776262721047\",\"lon\":\"107.42514810100926\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.14\",\"directionAngle\":\"313.3900146484375\",\"driverId\":2604,\"insertTime\":1707200950108,\"lat\":\"40.757828308583065\",\"lon\":\"107.42507918394823\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.3\",\"directionAngle\":\"277.70001220703125\",\"driverId\":2604,\"insertTime\":1707200955134,\"lat\":\"40.757880590155146\",\"lon\":\"107.42486253204672\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.2\",\"directionAngle\":\"241.0\",\"driverId\":2604,\"insertTime\":1707200960154,\"lat\":\"40.757729673470045\",\"lon\":\"107.42439023674089\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.53\",\"directionAngle\":\"239.0\",\"driverId\":2604,\"insertTime\":1707200965121,\"lat\":\"40.757519476030765\",\"lon\":\"107.42392687620543\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.13\",\"directionAngle\":\"239.8000030517578\",\"driverId\":2604,\"insertTime\":1707200970161,\"lat\":\"40.75731706273899\",\"lon\":\"107.42346656167648\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.75\",\"directionAngle\":\"239.60000610351562\",\"driverId\":2604,\"insertTime\":1707200975147,\"lat\":\"40.75700108154661\",\"lon\":\"107.42275175704675\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.05\",\"directionAngle\":\"239.5\",\"driverId\":2604,\"insertTime\":1707200980176,\"lat\":\"40.756679773512204\",\"lon\":\"107.4220368606946\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.07\",\"directionAngle\":\"239.5\",\"driverId\":2604,\"insertTime\":1707200985219,\"lat\":\"40.75637971766792\",\"lon\":\"107.42137452243888\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.63\",\"directionAngle\":\"241.88999938964844\",\"driverId\":2604,\"insertTime\":1707200990169,\"lat\":\"40.756172565226294\",\"lon\":\"107.42090172077897\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.93\",\"directionAngle\":\"238.88999938964844\",\"driverId\":2604,\"insertTime\":1707200995171,\"lat\":\"40.755894067483574\",\"lon\":\"107.42024744591967\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.79\",\"directionAngle\":\"267.0\",\"driverId\":2604,\"insertTime\":1707201000208,\"lat\":\"40.75576579043462\",\"lon\":\"107.41988999042434\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.1\",\"directionAngle\":\"314.7900085449219\",\"driverId\":2604,\"insertTime\":1707201005295,\"lat\":\"40.75581680837902\",\"lon\":\"107.41971634531507\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.73\",\"directionAngle\":\"326.6000061035156\",\"driverId\":2604,\"insertTime\":1707201010184,\"lat\":\"40.7560640781289\",\"lon\":\"107.41947084258874\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1004.5\",\"directionAngle\":\"329.8900146484375\",\"driverId\":2604,\"insertTime\":1707201015205,\"lat\":\"40.75638620021586\",\"lon\":\"107.41920715973531\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1004.42\",\"directionAngle\":\"327.2900085449219\",\"driverId\":2604,\"insertTime\":1707201020202,\"lat\":\"40.75663874822396\",\"lon\":\"107.41902450153154\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1006.14\",\"directionAngle\":\"328.5\",\"driverId\":2604,\"insertTime\":1707201025242,\"lat\":\"40.75691099866063\",\"lon\":\"107.41875893670124\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1006.75\",\"directionAngle\":\"329.20001220703125\",\"driverId\":2604,\"insertTime\":1707201030204,\"lat\":\"40.757163058316564\",\"lon\":\"107.41854245246111\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1007.57\",\"directionAngle\":\"329.20001220703125\",\"driverId\":2604,\"insertTime\":1707201035319,\"lat\":\"40.75732842608877\",\"lon\":\"107.41840294652398\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.52\",\"directionAngle\":\"329.5\",\"driverId\":2604,\"insertTime\":1707201040240,\"lat\":\"40.7576922668982\",\"lon\":\"107.41818496986197\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.1\",\"directionAngle\":\"326.1000061035156\",\"driverId\":2604,\"insertTime\":1707201045223,\"lat\":\"40.757984805505146\",\"lon\":\"107.41791307502942\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.6\",\"directionAngle\":\"329.0\",\"driverId\":2604,\"insertTime\":1707201050258,\"lat\":\"40.75818963740289\",\"lon\":\"107.41775396221631\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.72\",\"directionAngle\":\"328.7900085449219\",\"driverId\":2604,\"insertTime\":1707201055260,\"lat\":\"40.75831371037568\",\"lon\":\"107.41765972565214\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.34\",\"directionAngle\":\"329.70001220703125\",\"driverId\":2604,\"insertTime\":1707201060241,\"lat\":\"40.75840056436862\",\"lon\":\"107.41759102930195\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.63\",\"directionAngle\":\"329.3900146484375\",\"driverId\":2604,\"insertTime\":1707201065369,\"lat\":\"40.75852148151026\",\"lon\":\"107.4175035501013\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.86\",\"directionAngle\":\"328.3900146484375\",\"driverId\":2604,\"insertTime\":1707201070272,\"lat\":\"40.75859881409676\",\"lon\":\"107.41744408025382\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.95\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201075264,\"lat\":\"40.75862230988583\",\"lon\":\"107.41742423668417\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1000.97\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201080306,\"lat\":\"40.75861152015089\",\"lon\":\"107.41742821474888\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.87\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201085350,\"lat\":\"40.75860906842838\",\"lon\":\"107.41742792454481\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.84\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201090281,\"lat\":\"40.758609598908784\",\"lon\":\"107.41742772464083\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.84\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201095436,\"lat\":\"40.75860963895116\",\"lon\":\"107.41742769465102\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.84\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201100307,\"lat\":\"40.75860960894912\",\"lon\":\"107.41742764465769\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.84\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201105303,\"lat\":\"40.75860966899832\",\"lon\":\"107.41742763466607\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"999.84\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201110389,\"lat\":\"40.7586097190441\",\"lon\":\"107.41742761467535\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.15\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201115353,\"lat\":\"40.75861187522293\",\"lon\":\"107.41741648709832\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.26\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201120403,\"lat\":\"40.75860740321907\",\"lon\":\"107.41741317727244\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.32\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201125343,\"lat\":\"40.75860652333163\",\"lon\":\"107.41741128754995\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.19\",\"directionAngle\":\"328.3900146484375\",\"driverId\":2604,\"insertTime\":1707201130389,\"lat\":\"40.75862093719211\",\"lon\":\"107.4174038705418\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.25\",\"directionAngle\":\"328.8900146484375\",\"driverId\":2604,\"insertTime\":1707201135350,\"lat\":\"40.75871386651037\",\"lon\":\"107.41733140449044\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1001.62\",\"directionAngle\":\"328.70001220703125\",\"driverId\":2604,\"insertTime\":1707201140375,\"lat\":\"40.75875595109447\",\"lon\":\"107.41729937508129\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.15\",\"directionAngle\":\"329.1000061035156\",\"driverId\":2604,\"insertTime\":1707201145338,\"lat\":\"40.75881278003905\",\"lon\":\"107.41725907873072\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.9\",\"directionAngle\":\"329.2900085449219\",\"driverId\":2604,\"insertTime\":1707201150367,\"lat\":\"40.75890373261943\",\"lon\":\"107.41719861963065\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.45\",\"directionAngle\":\"329.0\",\"driverId\":2604,\"insertTime\":1707201155401,\"lat\":\"40.758977930349204\",\"lon\":\"107.41714345756849\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.78\",\"directionAngle\":\"329.5\",\"driverId\":2604,\"insertTime\":1707201160430,\"lat\":\"40.75905529866735\",\"lon\":\"107.41709250491435\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.0\",\"directionAngle\":\"328.8900146484375\",\"driverId\":2604,\"insertTime\":1707201165380,\"lat\":\"40.75916918725721\",\"lon\":\"107.4170085417027\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.43\",\"directionAngle\":\"330.2900085449219\",\"driverId\":2604,\"insertTime\":1707201170487,\"lat\":\"40.7591968454228\",\"lon\":\"107.41698965788629\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.43\",\"directionAngle\":\"330.5\",\"driverId\":2604,\"insertTime\":1707201175483,\"lat\":\"40.75936302759481\",\"lon\":\"107.41686771596963\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1002.87\",\"directionAngle\":\"330.1000061035156\",\"driverId\":2604,\"insertTime\":1707201180422,\"lat\":\"40.759487548194286\",\"lon\":\"107.4167710547456\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1003.45\",\"directionAngle\":\"311.3900146484375\",\"driverId\":2604,\"insertTime\":1707201185458,\"lat\":\"40.75955754799402\",\"lon\":\"107.41669934334054\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1004.17\",\"directionAngle\":\"186.10000610351562\",\"driverId\":2604,\"insertTime\":1707201190435,\"lat\":\"40.75947782254243\",\"lon\":\"107.41652664036752\",\"orderId\":6263,\"orderType\":1},{\"altitude\":\"1004.96\",\"directionAngle\":\"0.0\",\"driverId\":2604,\"insertTime\":1707201195438,\"lat\":\"40.759447852057754\",\"lon\":\"107.41654813409465\",\"orderId\":6263,\"orderType\":1}]";
|
//
|
// JSONArray jsonArray = JSONObject.parseArray(lonlat);
|
//
|
// String toLonLat = "";
|
// double sum = 0;
|
// for (Object o : jsonArray) {
|
// String s = JSONObject.toJSONString(o);
|
// JSONObject jsonObject = JSONObject.parseObject(s);
|
// String lon = jsonObject.getString("lon");
|
// String lat = jsonObject.getString("lat");
|
// String fromLonLat = lon+","+lat;
|
// if(ToolUtil.isNotEmpty(fromLonLat) && ToolUtil.isNotEmpty(toLonLat)){
|
// String[] from = fromLonLat.split(",");
|
// String[] to = toLonLat.split(",");
|
// GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0]));
|
// GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0]));
|
// double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere);
|
// double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84);
|
// double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80);
|
// double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67);
|
// double ANS = getDistanceMeter(source, target, Ellipsoid.ANS);
|
// double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72);
|
// double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858);
|
// double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880);
|
//// System.out.println("Sphere坐标系计算结果:"+Sphere + "米");
|
// System.err.println("WGS84坐标系计算结果:"+WGS84 + "米");
|
// sum += WGS84;
|
//// System.out.println("GRS80坐标系计算结果:"+GRS80 + "米");
|
//// System.out.println("GRS67坐标系计算结果:"+GRS67 + "米");
|
//// System.out.println("ANS坐标系计算结果:"+ANS + "米");
|
//// System.out.println("WGS72坐标系计算结果:"+WGS72 + "米");
|
//// System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米");
|
//// System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米");
|
// }
|
// toLonLat = fromLonLat;
|
// }
|
// System.err.println("=========="+sum);
|
// }
|
|
@Override
|
public List<OrderPrivateCar> query(Integer driverId, Integer... state) throws Exception {
|
return orderPrivateCarMapper.query(Arrays.asList(state), driverId);
|
}
|
|
|
/**
|
* 获取所有快到期的预约单(出行时间在30分钟内)
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<OrderPrivateCar> queryMaturity() throws Exception {
|
return orderPrivateCarMapper.queryMaturity();
|
}
|
|
|
@Override
|
public List<OrderPrivateCar> taskMidAxbUnBindSend() throws Exception {
|
return this.baseMapper.taskMidAxbUnBindSend();
|
}
|
|
/**
|
* 计算价格
|
* @param orderPrivateCar
|
* @param parkingFee
|
* @param crossingFee
|
* @return
|
* @throws Exception
|
*/
|
public OrderPrivateCar setMoney(OrderPrivateCar orderPrivateCar, Double parkingFee, Double crossingFee) throws Exception {
|
Map<String, Object> query1 = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId());
|
//开始根据不同的方式计算金额
|
double amount = 0;
|
JSONObject jsonObject = JSON.parseObject(String.valueOf(query1.get("content")));
|
|
JSONObject contentPutOne = JSON.parseObject(query1.get("contentPutOne").toString());//一人拼成
|
JSONObject contentNotOne = JSON.parseObject(query1.get("contentNotOne").toString());//一人未拼成
|
JSONObject contentPutTwo = JSON.parseObject(query1.get("contentPutTwo").toString());//2人拼成
|
JSONObject contentNotTwo = JSON.parseObject(query1.get("contentNotTwo").toString());//2人未拼成
|
JSONObject contentPutThree = JSON.parseObject(query1.get("contentPutThree").toString());//3人拼成
|
JSONObject contentNotThree = JSON.parseObject(query1.get("contentNotThree").toString());//3人未拼成
|
JSONObject contentExclusive = JSON.parseObject(query1.get("contentExclusive").toString());//独享
|
JSONObject contentPrice = JSON.parseObject(query1.get("contentPrice").toString());//一口价
|
System.out.println("一口价内容"+contentPrice);
|
//乘车类型(1=独享,2=一口价,3=拼车)
|
orderPrivateCar.setWaitRule(jsonObject.toJSONString());
|
if(orderPrivateCar.getRideType()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentExclusive,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else if(orderPrivateCar.getRideType()==2){
|
double d = (null == orderPrivateCar.getMileage() ? 0D : orderPrivateCar.getMileage());
|
System.out.println("行驶里程数"+d);
|
double estimateMileage = (null == orderPrivateCar.getEstimateMileage() ? 0D : orderPrivateCar.getEstimateMileage());
|
System.out.println("预估里程数"+estimateMileage);
|
//在价格区间按照一口价算,不在区间按实时价格算
|
if(d<estimateMileage+contentPrice.getDouble("num29")*1000 && d>estimateMileage-contentPrice.getDouble("num32")*1000){
|
System.out.println("在区间===============");
|
orderPrivateCar = calculationPrice1(orderPrivateCar,contentPrice,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
System.out.println("返回订单数据"+orderPrivateCar);
|
}else{
|
System.out.println("不在区间====================");
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentExclusive,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
System.out.println("返回订单数据"+orderPrivateCar);
|
}
|
}else{
|
//判断是否是拼单
|
if(orderPrivateCar.getSpellSuccess()==0){
|
if(orderPrivateCar.getPeopleNum()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotOne,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentPutOne.toJSONString());
|
}else if(orderPrivateCar.getPeopleNum()==2){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotTwo,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentPutTwo.toJSONString());
|
}else{
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotThree,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentPutThree.toJSONString());
|
}
|
}else{
|
if(orderPrivateCar.getPeopleNum()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutOne,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentNotOne.toJSONString());
|
}else if(orderPrivateCar.getPeopleNum()==2){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutTwo,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentNotTwo.toJSONString());
|
}else{
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutThree,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
orderPrivateCar.setChargeRules(contentNotThree.toJSONString());
|
}
|
}
|
/*if(orderPrivateCar.getPid()==null){
|
Integer number = orderPrivateCarMapper.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid",orderPrivateCar.getId()).ne("state",10).ne("state",12));
|
if(number<=0){
|
if(orderPrivateCar.getPeopleNum()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotOne,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else if(orderPrivateCar.getPeopleNum()==2){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotTwo,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else{
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentNotThree,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}
|
}else{
|
if(orderPrivateCar.getPeopleNum()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutOne,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else if(orderPrivateCar.getPeopleNum()==2){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutTwo,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else{
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutThree,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}
|
}
|
}else{
|
if(orderPrivateCar.getPeopleNum()==1){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutOne,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else if(orderPrivateCar.getPeopleNum()==2){
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutTwo,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}else{
|
orderPrivateCar = calculationPrice(orderPrivateCar,contentPutThree,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
|
}
|
}*/
|
}
|
return orderPrivateCar;
|
}
|
|
public OrderPrivateCar calculationPrice(OrderPrivateCar orderPrivateCar,JSONObject rule, long wait,Double waitMoney, Double parkingFee, Double crossingFee) throws Exception {
|
orderPrivateCar.setChargeRule(rule.toJSONString());
|
double amount = 0.0;
|
//等待费
|
Date date = new Date();
|
if(orderPrivateCar.getEndServiceTime()==null)orderPrivateCar.setEndServiceTime(date);
|
double d = (null == orderPrivateCar.getMileage() ? 0D : orderPrivateCar.getMileage()) / 1000;//实际公里
|
double t = ((orderPrivateCar.getEndServiceTime().getTime() - orderPrivateCar.getStartServiceTime().getTime()) / 60000) + 1;//实际时间(不满一分钟按一分钟算)
|
double d1 = (d - rule.getDouble("num2")) < 0 ? 0 : d - rule.getDouble("num2");//超出起步里程的公里
|
double t1 = (t - rule.getDouble("num3")) < 0 ? 0 : t - rule.getDouble("num3");//超过起步分钟数的时间
|
double w = ((orderPrivateCar.getStartServiceTime().getTime() - orderPrivateCar.getArriveTime().getTime()) / 60000) + 1;//等待分钟(不满一分钟按一分钟算)
|
double w1 = (w - wait) < 0 ? 0 : new BigDecimal(w - wait).setScale(0, BigDecimal.ROUND_UP).doubleValue();//超出等待时间的时间
|
double yt1 = 0;//远途1段
|
double yt2 = 0;//远途2段
|
double yt3 = 0;//远途3段
|
|
|
//夜间服务处理逻辑
|
Calendar s = Calendar.getInstance();
|
s.setTime(date);
|
s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[0]));
|
s.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[1]));
|
|
Calendar e = Calendar.getInstance();
|
e.setTime(date);
|
e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[0]));
|
e.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[1]));
|
|
if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num18") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num18") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num19") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num18") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num19") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num20") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num15") + (d1 * rule.getDouble("num16")) + (t1 * rule.getDouble("num17")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num15"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num16")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num17")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}else{
|
Calendar s1 = Calendar.getInstance();
|
s1.setTime(date);
|
s1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num21").split(" - ")[0].split(":")[0]));
|
s1.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num21").split(" - ")[0].split(":")[1]));
|
|
Calendar e1 = Calendar.getInstance();
|
e1.setTime(date);
|
e1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[0]));
|
e1.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[1]));
|
|
Calendar s2 = Calendar.getInstance();
|
s2.setTime(date);
|
s2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[0]));
|
s2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[1]));
|
|
Calendar e2 = Calendar.getInstance();
|
e2.setTime(date);
|
e2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[0]));
|
e2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[1]));
|
//高峰时段处理逻辑
|
if((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())){
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num26") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num26") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num27") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num26") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num27") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num28") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num23") + (d1 * rule.getDouble("num24")) + (t1 * rule.getDouble("num25")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num23"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num24")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num25")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
// amount = new BigDecimal(orderPrivateCar.getStartMoney())
|
// .add(new BigDecimal(orderPrivateCar.getMileageMoney()))
|
// .add(new BigDecimal(orderPrivateCar.getDurationMoney()))
|
// .add(new BigDecimal(orderPrivateCar.getWaitMoney()))
|
// .add(new BigDecimal(orderPrivateCar.getLongDistanceMoney()));
|
// orderPrivateCar.setOrderMoney(amount.add(new BigDecimal(parkingFee)).add(new BigDecimal(parkingFee)).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}else{
|
//其他时间段的计算
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num8") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num8") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num11") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num8") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num11") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num13") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num1") + (d1 * rule.getDouble("num4")) + (t1 * rule.getDouble("num5")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num1"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num4")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num5")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}
|
}
|
return orderPrivateCar;
|
}
|
|
|
|
public OrderPrivateCar calculationPrice1(OrderPrivateCar orderPrivateCar,JSONObject rule, long wait,Double waitMoney, Double parkingFee, Double crossingFee) throws Exception {
|
double amount = 0.0;
|
//等待费
|
Date date = new Date();
|
double d = (null == orderPrivateCar.getEstimateMileage() ? 0D : orderPrivateCar.getEstimateMileage()) / 1000;//实际公里
|
double t = orderPrivateCar.getEstimateTime();//实际时间(不满一分钟按一分钟算)
|
System.out.println("d================================"+d);
|
System.out.println("t================================"+t);
|
double d1 = (d - rule.getDouble("num2")) < 0 ? 0 : d - rule.getDouble("num2");//超出起步里程的公里
|
double t1 = (t - rule.getDouble("num3")) < 0 ? 0 : t - rule.getDouble("num3");//超过起步分钟数的时间
|
System.out.println("d1================================"+d1);
|
System.out.println("t1================================"+t1);
|
double w = ((orderPrivateCar.getStartServiceTime().getTime() - orderPrivateCar.getArriveTime().getTime()) / 60000) + 1;//等待分钟(不满一分钟按一分钟算)
|
double w1 = (w - wait) < 0 ? 0 : new BigDecimal(w - wait).setScale(0, BigDecimal.ROUND_UP).doubleValue();//超出等待时间的时间
|
double yt1 = 0;//远途1段
|
double yt2 = 0;//远途2段
|
double yt3 = 0;//远途3段
|
|
|
//夜间服务处理逻辑
|
Calendar s = Calendar.getInstance();
|
s.setTime(date);
|
s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[0]));
|
s.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[0].split(":")[1]));
|
|
Calendar e = Calendar.getInstance();
|
e.setTime(date);
|
e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[0]));
|
e.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num14").split(" - ")[1].split(":")[1]));
|
|
if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
|
System.out.println("夜间服务处理逻辑");
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num18") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num18") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num19") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num18") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num19") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num20") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num15") + (d1 * rule.getDouble("num16")) + (t1 * rule.getDouble("num17")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num15"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num16")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num17")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}else{
|
System.out.println("非夜间服务处理逻辑");
|
Calendar s1 = Calendar.getInstance();
|
s1.setTime(date);
|
s1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num21").split(" - ")[0].split(":")[0]));
|
s1.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num21").split(" - ")[0].split(":")[1]));
|
|
Calendar e1 = Calendar.getInstance();
|
e1.setTime(date);
|
e1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[0]));
|
e1.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num21").split(" - ")[1].split(":")[1]));
|
|
Calendar s2 = Calendar.getInstance();
|
s2.setTime(date);
|
s2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[0]));
|
s2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[0].split(":")[1]));
|
|
Calendar e2 = Calendar.getInstance();
|
e2.setTime(date);
|
e2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[0]));
|
e2.set(Calendar.MINUTE, Integer.valueOf(rule.getString("num22").split(" - ")[1].split(":")[1]));
|
//高峰时段处理逻辑
|
if((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())){
|
System.out.println("高峰时段处理逻辑");
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num26") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num26") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num27") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num26") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num27") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num28") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num23") + (d1 * rule.getDouble("num24")) + (t1 * rule.getDouble("num25")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num23"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num24")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num25")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}else{
|
System.out.println("其他时间段的计算");
|
//其他时间段的计算
|
if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
|
yt1 = rule.getDouble("num8") * d;
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num9") && d < rule.getDouble("num10")){
|
yt1 = rule.getDouble("num8") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num11") * (d - rule.getDouble("num9"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num9")) ? d - rule.getDouble("num9") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
if(d > rule.getDouble("num12")){
|
yt1 = rule.getDouble("num8") * rule.getDouble("num7");
|
yt2 = rule.getDouble("num11") * (rule.getDouble("num10") - rule.getDouble("num9"));
|
yt3 = rule.getDouble("num13") * (d - rule.getDouble("num12"));
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num12")) ? d - rule.getDouble("num12") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
}
|
// amount = rule.getDouble("num1") + (d1 * rule.getDouble("num4")) + (t1 * rule.getDouble("num5")) + (w1 * waitMoney) + yt1 + yt2 + yt3;
|
orderPrivateCar.setStartMileage(rule.getDouble("num2"));
|
orderPrivateCar.setStartMoney(rule.getDouble("num1"));//起步价
|
orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setMileageMoney(new BigDecimal(d1 * rule.getDouble("num4")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//里程费
|
orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setDurationMoney(new BigDecimal(t1 * rule.getDouble("num5")).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//时长费
|
orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setWaitMoney(new BigDecimal(w1 * waitMoney).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//等待费
|
// orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
|
orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
|
orderPrivateCar.setParkMoney(parkingFee);//停车费
|
orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
|
orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
|
orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
|
orderPrivateCar.setDiscount(0D);//优惠抵扣
|
orderPrivateCar.setPayMoney(0D);//支付金额
|
amount = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() +
|
orderPrivateCar.getDurationMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getLongDistanceMoney();
|
orderPrivateCar.setOrderMoney(amount+orderPrivateCar.getParkMoney()+orderPrivateCar.getRoadTollMoney());
|
}
|
}
|
return orderPrivateCar;
|
}
|
}
|