免费公里数
This commit is contained in:
parent
68ad7921f8
commit
c6d740cc26
|
@ -225,6 +225,9 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
public TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude, String serveTime, Integer tripWay){
|
||||
Artificer artificerInfo = artificerService.getById(artificerId);
|
||||
Integer mfgls = artificerInfo.getTripWayNum();//免费公里数
|
||||
if(mfgls == null){
|
||||
mfgls = 0;
|
||||
}
|
||||
BigDecimal freeKilometers = new BigDecimal(mfgls);
|
||||
String longitude = artificerInfo.getLongitude();
|
||||
String latitude = artificerInfo.getLatitude();
|
||||
|
@ -276,7 +279,9 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
// fixedPrice = NumberUtil.mul(fixedPrice, 2);
|
||||
// }
|
||||
//最终价格
|
||||
vo.setTravelPrice(NumberUtil.decimalFormat("0.00", fixedPrice));
|
||||
// vo.setTravelPrice(NumberUtil.decimalFormat("0", fixedPrice));
|
||||
fixedPrice = fixedPrice.setScale(0,BigDecimal.ROUND_UP);
|
||||
vo.setTravelPrice(fixedPrice.toString());
|
||||
}else if(TravelEnum.PricingType.TRENDS.getValue().equals(pricingType)){
|
||||
//动态的
|
||||
BigDecimal nightTravelExpenses = new BigDecimal("0");//白天
|
||||
|
@ -295,7 +300,9 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
//最终价格
|
||||
//计算公式为【起步价 + 夜间出行费 + ((公里数 -起步公里数 - 免费公里数) * 每公里价格)= 最终价格】
|
||||
BigDecimal travelPrice = NumberUtil.add(startingPrice, nightTravelExpenses, NumberUtil.mul(NumberUtil.sub(NumberUtil.sub(kilometerNum,startKilometers), freeKilometers), pricePerKilometer));
|
||||
vo.setTravelPrice(NumberUtil.decimalFormat("0.00", travelPrice));
|
||||
// vo.setTravelPrice(NumberUtil.decimalFormat("0.00", travelPrice));
|
||||
travelPrice = travelPrice.setScale(0,BigDecimal.ROUND_UP);
|
||||
vo.setTravelPrice(travelPrice.toString());
|
||||
}
|
||||
return vo;
|
||||
|
||||
|
|
Loading…
Reference in New Issue