|
@@ -88,11 +88,33 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
|
|
|
List<TbFeeStatistics> getMonth(SoMap so) {
|
|
|
- return tbFeeStatisticsMapper.getMonth(so);
|
|
|
+ List<TbFeeStatistics> monthFees = tbFeeStatisticsMapper.getMonth(so);
|
|
|
+ for (TbFeeStatistics fee : monthFees) {
|
|
|
+ BigDecimal taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue());
|
|
|
+ if(fee.getFeeType() == TbFeeStatistics.feeType.PARK_FEE.getCode()){
|
|
|
+ taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.PARK.getValue());
|
|
|
+ }
|
|
|
+ BigDecimal taxes = fee.getStatisticsMoney().divide(taxRate.add(BigDecimal.valueOf(1)),2, BigDecimal.ROUND_HALF_UP).multiply(taxRate);
|
|
|
+ taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal noTaxMoney = fee.getStatisticsMoney().subtract(taxes);
|
|
|
+ fee.setTaxRate(taxRate).setTaxes(taxes).setNoTaxMoney(noTaxMoney);
|
|
|
+ }
|
|
|
+ return monthFees;
|
|
|
}
|
|
|
|
|
|
List<TbFeeStatistics> getYear(SoMap so) {
|
|
|
- return tbFeeStatisticsMapper.getYear(so);
|
|
|
+ List<TbFeeStatistics> yearFees = tbFeeStatisticsMapper.getYear(so);
|
|
|
+ for (TbFeeStatistics fee : yearFees) {
|
|
|
+ BigDecimal taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue());
|
|
|
+ if(fee.getFeeType() == TbFeeStatistics.feeType.PARK_FEE.getCode()){
|
|
|
+ taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.PARK.getValue());
|
|
|
+ }
|
|
|
+ BigDecimal taxes = fee.getStatisticsMoney().divide(taxRate.add(BigDecimal.valueOf(1)),2, BigDecimal.ROUND_HALF_UP).multiply(taxRate);
|
|
|
+ taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal noTaxMoney = fee.getStatisticsMoney().subtract(taxes);
|
|
|
+ fee.setTaxRate(taxRate).setTaxes(taxes).setNoTaxMoney(noTaxMoney);
|
|
|
+ }
|
|
|
+ return yearFees;
|
|
|
}
|
|
|
|
|
|
public TbFeeStatistics getByDayAndFeeType(String day, Integer feeType) {
|
|
@@ -135,7 +157,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
.multiply(parkFee.getTaxRate());
|
|
|
BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(taxes);
|
|
|
// BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(parkFee.getTaxMoney().multiply(parkFee.getTaxRate()));
|
|
|
- parkFee.setNoTaxMoney(noTaxMoney);
|
|
|
+ parkFee.setNoTaxMoney(noTaxMoney).setTaxes(taxes);
|
|
|
parkFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
|
|
|
.setFeeType(TbFeeStatistics.feeType.PARK_FEE.getCode()).setItemTypeName(TbFeeStatistics.feeType.PARK_FEE.getDesc())
|
|
|
.setPayType(3);
|
|
@@ -178,7 +200,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
.multiply(businessFee.getTaxRate());
|
|
|
BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(taxes);
|
|
|
|
|
|
- businessFee.setNoTaxMoney(noTaxMoney);
|
|
|
+ businessFee.setNoTaxMoney(noTaxMoney).setTaxes(taxes);
|
|
|
businessFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
|
|
|
.setFeeType(feeType)
|
|
|
//.setItemTypeName(itemType)
|
|
@@ -221,5 +243,20 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public TbFeeStatistics updateParkNum(String day){
|
|
|
+ QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
|
|
|
+ qw.like("create_time", day);
|
|
|
+ List<TbFeeDetails> list = tbFeeDetailsService.list(qw);
|
|
|
+ Integer totalNum = 0;
|
|
|
+ for (TbFeeDetails feeDetail : list) {
|
|
|
+ if(feeDetail.getFeeType() == TbFeeStatistics.feeType.PARK_FEE.getCode()){
|
|
|
+ totalNum = totalNum + feeDetail.getNum();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TbFeeStatistics feeStatistics = getByDayAndFeeType(day, TbFeeStatistics.feeType.PARK_FEE.getCode());
|
|
|
+ feeStatistics.setNum(totalNum);
|
|
|
+ this.updateById(feeStatistics);
|
|
|
+ return feeStatistics;
|
|
|
+ }
|
|
|
|
|
|
}
|