|
@@ -188,8 +188,20 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
continue;
|
|
|
}
|
|
|
TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
|
|
|
- BigDecimal paidMoney = car.getMoney();
|
|
|
|
|
|
+ //thisCarAllFeeList是当前放行记录的车辆的所有日期的白天停车和夜间停车明细
|
|
|
+ List<TbFeeDetails> thisCarAllFeeList = getByBusinessCarIdAndCarNoAndFeeType(car.getId(), car.getCarNo(), TbFeeDetails.fee.PARK_FEE.getCode());
|
|
|
+ //不是当前日期,当前放行记录的车辆在之前的日期付的钱
|
|
|
+ BigDecimal notToDayMoney = new BigDecimal(0);
|
|
|
+ for (TbFeeDetails d : thisCarAllFeeList) {
|
|
|
+ if(!StrUtil.equals(payDay, d.getPayDay())){
|
|
|
+ notToDayMoney = notToDayMoney.add(d.getItemPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //当前日期付的钱 = 改放行记录总的停车费-之前日前的钱
|
|
|
+ BigDecimal thisDayMoney = car.getMoney().subtract(notToDayMoney);
|
|
|
+
|
|
|
+ //oldFeeList是当前日期的白天停车和夜间停车明细
|
|
|
List<TbFeeDetails> oldFeeList = getByBusinessCarIdAndCarNoAndFeeTypeAndPayDay(car.getId(), car.getCarNo(), TbFeeDetails.fee.PARK_FEE.getCode(), payDay);
|
|
|
TbFeeDetails nightParkFee = new TbFeeDetails();
|
|
|
TbFeeDetails dayParkFee = new TbFeeDetails();
|
|
@@ -210,7 +222,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
transactionIdStr = transactionIdStr.equals("") ? transactionId : transactionIdStr + "," + transactionId;
|
|
|
outTradeNoStr = outTradeNoStr.equals("") ? outTradeNo : outTradeNoStr + "," + outTradeNo;
|
|
|
BigDecimal baseNightPrice = partConfig.getBasePrice().add(partConfig.getExtraPrice());
|
|
|
- BigDecimal[] qr = paidMoney.divideAndRemainder(baseNightPrice);//商和余数的数组,商为夜间停车次数,余数为白天停车费用。
|
|
|
+ BigDecimal[] qr = thisDayMoney.divideAndRemainder(baseNightPrice);//商和余数的数组,商为夜间停车次数,余数为白天停车费用。
|
|
|
BigDecimal nightFeeNum = qr[0];
|
|
|
if(nightFeeNum.compareTo(BigDecimal.valueOf(0)) > 0){
|
|
|
nightParkFee.setNum(nightFeeNum.intValue()).setItemTypeName("夜间停车")
|
|
@@ -231,7 +243,6 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
|
|
|
private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now){
|
|
|
-
|
|
|
String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
|
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
parkFee.setTaxRate(partConfig.getTaxRate());
|