This commit is contained in:
parent
4e11900438
commit
286e153a43
|
@ -12,7 +12,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public interface OrdersService extends IService<Orders> {
|
public interface OrdersService extends IService<Orders> {
|
||||||
|
|
||||||
Map<String,Object> selectTaxiMoney(Long artificerId, String latitude, String longitude, String city);
|
// Map<String,Object> selectTaxiMoney(Long artificerId, String latitude, String longitude, String city);
|
||||||
|
|
||||||
Result insertOrders(Orders orders);
|
Result insertOrders(Orders orders);
|
||||||
|
|
||||||
|
|
|
@ -165,90 +165,90 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
|
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Map<String, Object> selectTaxiMoney(Long artificerId, String latitude, String longitude, String city) {
|
// public Map<String, Object> selectTaxiMoney(Long artificerId, String latitude, String longitude, String city) {
|
||||||
|
//
|
||||||
Artificer artificer = artificerService.getById(artificerId);
|
// Artificer artificer = artificerService.getById(artificerId);
|
||||||
GlobalCoordinates source = new GlobalCoordinates(Double.parseDouble(latitude), Double.parseDouble(longitude));
|
// GlobalCoordinates source = new GlobalCoordinates(Double.parseDouble(latitude), Double.parseDouble(longitude));
|
||||||
GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(artificer.getLatitude()), Double.parseDouble(artificer.getLongitude()));
|
// GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(artificer.getLatitude()), Double.parseDouble(artificer.getLongitude()));
|
||||||
Integer distances = (int) LonLatUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
// Integer distances = (int) LonLatUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
||||||
|
//
|
||||||
//起步价
|
// //起步价
|
||||||
String tripPrice;
|
// String tripPrice;
|
||||||
//每公里价格
|
// //每公里价格
|
||||||
String tripMoney;
|
// String tripMoney;
|
||||||
//起步公里数
|
// //起步公里数
|
||||||
String tripNum;
|
// String tripNum;
|
||||||
Trip trip = tripService.getOne(new QueryWrapper<Trip>().like("city", city));
|
// Trip trip = tripService.getOne(new QueryWrapper<Trip>().like("city", city));
|
||||||
if (trip == null) {
|
// if (trip == null) {
|
||||||
return Result.error("当前地址暂无出行方式,请更换其他地址!");
|
// return Result.error("当前地址暂无出行方式,请更换其他地址!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//获取城市名称
|
// //获取城市名称
|
||||||
JSONObject mapRes = CommonMapUtils.calcTaxiMoneyInfo(artificer.getTripWay(), longitude, latitude, artificer.getLongitude(), artificer.getLatitude());//根据出行方式计算距离
|
// JSONObject mapRes = CommonMapUtils.calcTaxiMoneyInfo(artificer.getTripWay(), longitude, latitude, artificer.getLongitude(), artificer.getLatitude());//根据出行方式计算距离
|
||||||
|
//
|
||||||
//判断技师的出行方式
|
// //判断技师的出行方式
|
||||||
if (artificer.getTripWay() == null || artificer.getTripWay() == 1) {
|
// if (artificer.getTripWay() == null || artificer.getTripWay() == 1) {
|
||||||
//公交
|
// //公交
|
||||||
tripPrice = trip.getBusStartingFare();
|
// tripPrice = trip.getBusStartingFare();
|
||||||
tripMoney = trip.getBusKmMoney();
|
// tripMoney = trip.getBusKmMoney();
|
||||||
tripNum = trip.getBusStartingKm();
|
// tripNum = trip.getBusStartingKm();
|
||||||
distances = mapRes.getInteger("distance");
|
// distances = mapRes.getInteger("distance");
|
||||||
} else if (artificer.getTripWay() == 2) {
|
// } else if (artificer.getTripWay() == 2) {
|
||||||
//出租
|
// //出租
|
||||||
tripPrice = trip.getTaxiStartingFare();
|
// tripPrice = trip.getTaxiStartingFare();
|
||||||
tripMoney = trip.getTaxiKmMoney();
|
// tripMoney = trip.getTaxiKmMoney();
|
||||||
tripNum = trip.getTaxiStartingKm();
|
// tripNum = trip.getTaxiStartingKm();
|
||||||
distances = mapRes.getInteger("distance");
|
// distances = mapRes.getInteger("distance");
|
||||||
} else {
|
// } else {
|
||||||
tripPrice = "0";
|
// tripPrice = "0";
|
||||||
tripMoney = "0";
|
// tripMoney = "0";
|
||||||
tripNum = "1";
|
// tripNum = "1";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
int i = Integer.parseInt(tripNum);
|
// int i = Integer.parseInt(tripNum);
|
||||||
i = i * 1000;
|
// i = i * 1000;
|
||||||
BigDecimal taxiMoney = new BigDecimal(tripPrice);
|
// BigDecimal taxiMoney = new BigDecimal(tripPrice);
|
||||||
if (artificer.getTripWay() == null || artificer.getTripWay() == 1 || artificer.getTripWay() == 2) {
|
// if (artificer.getTripWay() == null || artificer.getTripWay() == 1 || artificer.getTripWay() == 2) {
|
||||||
if (distances > i) {
|
// if (distances > i) {
|
||||||
int distancess = distances;
|
// int distancess = distances;
|
||||||
//大于起步公里
|
// //大于起步公里
|
||||||
distances = distances - i;
|
// distances = distances - i;
|
||||||
BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
// BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
||||||
double downd = Math.ceil(bigDecimal.doubleValue());
|
// double downd = Math.ceil(bigDecimal.doubleValue());
|
||||||
distances = new Double(downd).intValue();
|
// distances = new Double(downd).intValue();
|
||||||
BigDecimal xuMoney = BigDecimal.valueOf(distances).multiply(new BigDecimal(tripMoney));
|
// BigDecimal xuMoney = BigDecimal.valueOf(distances).multiply(new BigDecimal(tripMoney));
|
||||||
taxiMoney = taxiMoney.add(xuMoney);
|
// taxiMoney = taxiMoney.add(xuMoney);
|
||||||
distances = distancess;
|
// distances = distancess;
|
||||||
bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
// bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
||||||
downd = Math.ceil(bigDecimal.doubleValue());
|
// downd = Math.ceil(bigDecimal.doubleValue());
|
||||||
distances = new Double(downd).intValue();
|
// distances = new Double(downd).intValue();
|
||||||
} else {
|
// } else {
|
||||||
BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
// BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
||||||
double downd = Math.ceil(bigDecimal.doubleValue());
|
// double downd = Math.ceil(bigDecimal.doubleValue());
|
||||||
distances = new Double(downd).intValue();
|
// distances = new Double(downd).intValue();
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
// BigDecimal bigDecimal = BigDecimal.valueOf(distances).divide(BigDecimal.valueOf(1000), 0, BigDecimal.ROUND_UP);
|
||||||
double downd = Math.ceil(bigDecimal.doubleValue());
|
// double downd = Math.ceil(bigDecimal.doubleValue());
|
||||||
distances = new Double(downd).intValue();
|
// distances = new Double(downd).intValue();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String value = commonInfoService.findOne(426).getValue();
|
// String value = commonInfoService.findOne(426).getValue();
|
||||||
if ("是".equals(value)) {
|
// if ("是".equals(value)) {
|
||||||
distances = distances * 2;
|
// distances = distances * 2;
|
||||||
taxiMoney = taxiMoney.multiply(BigDecimal.valueOf(2));
|
// taxiMoney = taxiMoney.multiply(BigDecimal.valueOf(2));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Map<String, Object> result = new HashMap<>();
|
// Map<String, Object> result = new HashMap<>();
|
||||||
result.put("tripPrice", tripPrice);
|
// result.put("tripPrice", tripPrice);
|
||||||
result.put("tripNum", tripNum);
|
// result.put("tripNum", tripNum);
|
||||||
result.put("distances", distances);
|
// result.put("distances", distances);
|
||||||
result.put("xuMoney", tripMoney);
|
// result.put("xuMoney", tripMoney);
|
||||||
result.put("taxiMoney", taxiMoney);
|
// result.put("taxiMoney", taxiMoney);
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result insertOrders(Orders orders) {
|
public Result insertOrders(Orders orders) {
|
||||||
|
@ -4511,7 +4511,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
BigDecimal storageRate = BigDecimal.ONE.subtract(rate);
|
BigDecimal storageRate = BigDecimal.ONE.subtract(rate);
|
||||||
//钱包支付技师提成
|
//钱包支付技师提成
|
||||||
BigDecimal taxiMoney = BigDecimal.ZERO;
|
BigDecimal taxiMoney = BigDecimal.ZERO;
|
||||||
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
|
||||||
|
taxiMoney = BigDecimal.ZERO;
|
||||||
|
}else{
|
||||||
taxiMoney = orders.getTaxiMoney();
|
taxiMoney = orders.getTaxiMoney();
|
||||||
}
|
}
|
||||||
if(taxiMoney==null){
|
if(taxiMoney==null){
|
||||||
|
@ -4545,7 +4547,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
|
|
||||||
BigDecimal subtract = BigDecimal.ZERO;
|
BigDecimal subtract = BigDecimal.ZERO;
|
||||||
//用户支付减去通行费用
|
//用户支付减去通行费用
|
||||||
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
subtract = orders.getPayMoney();
|
subtract = orders.getPayMoney();
|
||||||
}else{
|
}else{
|
||||||
subtract = orders.getPayMoney().subtract(taxiMoney);
|
subtract = orders.getPayMoney().subtract(taxiMoney);
|
||||||
|
@ -4591,10 +4593,13 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
orders.setShopMoney(shopMoney);
|
orders.setShopMoney(shopMoney);
|
||||||
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
artificerPrice = artificerPrice.subtract(shopMoney);
|
artificerPrice = artificerPrice.subtract(shopMoney);
|
||||||
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
|
|
||||||
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
|
}else{
|
||||||
//用户收益加上通行费用
|
//用户收益加上通行费用
|
||||||
artificerPrice = artificerPrice.add(artificerTaxiPrice);
|
artificerPrice = artificerPrice.add(artificerTaxiPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
orders.setArtificerMoney(artificerPrice);
|
orders.setArtificerMoney(artificerPrice);
|
||||||
orders.setSumArtificerMoney(artificerPrice);
|
orders.setSumArtificerMoney(artificerPrice);
|
||||||
|
|
||||||
|
@ -4860,7 +4865,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
|
|
||||||
BigDecimal subtract = BigDecimal.ZERO;
|
BigDecimal subtract = BigDecimal.ZERO;
|
||||||
//用户支付减去通行费用
|
//用户支付减去通行费用
|
||||||
if(orders.getIsSupplement()!=null && orders.getIsSupplement() == 2){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
subtract = orders.getPayMoney();
|
subtract = orders.getPayMoney();
|
||||||
}else{
|
}else{
|
||||||
subtract = orders.getPayMoney().subtract(taxiMoney);
|
subtract = orders.getPayMoney().subtract(taxiMoney);
|
||||||
|
@ -4906,7 +4911,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
orders.setShopMoney(shopMoney);
|
orders.setShopMoney(shopMoney);
|
||||||
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
artificerPrice = artificerPrice.subtract(shopMoney);
|
artificerPrice = artificerPrice.subtract(shopMoney);
|
||||||
if(orders.getIsSupplement()!=null && !orders.getIsSupplement().equals(2)){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
|
}else{
|
||||||
//用户收益加上通行费用
|
//用户收益加上通行费用
|
||||||
artificerPrice = artificerPrice.add(artificerTaxiPrice);
|
artificerPrice = artificerPrice.add(artificerTaxiPrice);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue