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