订单增加代金券之前的金额
This commit is contained in:
parent
286e153a43
commit
35aa3fecf6
|
@ -356,6 +356,12 @@ public class Orders implements Serializable {
|
||||||
* 项目金额或项目差额
|
* 项目金额或项目差额
|
||||||
*/
|
*/
|
||||||
private BigDecimal massageMoney;
|
private BigDecimal massageMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目金额减代金卷之前
|
||||||
|
*/
|
||||||
|
private BigDecimal massageCouponMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拒单内容
|
* 拒单内容
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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) {
|
||||||
|
@ -4056,6 +4056,12 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
public Result selectOrdersDetails(Long ordersId) {
|
public Result selectOrdersDetails(Long ordersId) {
|
||||||
Integer minutes = Integer.valueOf(commonInfoService.findOne(452).getValue());
|
Integer minutes = Integer.valueOf(commonInfoService.findOne(452).getValue());
|
||||||
Orders orders = baseMapper.selectById(ordersId);
|
Orders orders = baseMapper.selectById(ordersId);
|
||||||
|
BigDecimal couponMoney = orders.getCouponMoney();
|
||||||
|
if(couponMoney != null){
|
||||||
|
orders.setMassageCouponMoney(orders.getMassageMoney().add(couponMoney));
|
||||||
|
}else{
|
||||||
|
orders.setMassageCouponMoney(orders.getMassageMoney());
|
||||||
|
}
|
||||||
String serveTime = orders.getServeTime();
|
String serveTime = orders.getServeTime();
|
||||||
Date serveTimeDate = DateUtils.stringToDate(serveTime,"yyyy-MM-dd HH:mm");
|
Date serveTimeDate = DateUtils.stringToDate(serveTime,"yyyy-MM-dd HH:mm");
|
||||||
serveTimeDate = DateUtils.addDateMinutes(serveTimeDate,minutes);
|
serveTimeDate = DateUtils.addDateMinutes(serveTimeDate,minutes);
|
||||||
|
|
Loading…
Reference in New Issue