|
@@ -28,6 +28,8 @@ import com.pj.project.tb_business_item.TbBusinessItem;
|
|
|
import com.pj.project.tb_fee_details.ExportFeeDetailDTO;
|
|
|
import com.pj.project.tb_fee_details.TbFeeDetails;
|
|
|
import com.pj.project.tb_fee_details.TbFeeDetailsService;
|
|
|
+import com.pj.project.tb_item_type.TbItemType;
|
|
|
+import com.pj.project.tb_item_type.TbItemTypeService;
|
|
|
import com.pj.project4sp.uploadfile.UploadUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -64,6 +66,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
private PartConfig partConfig;
|
|
|
@Resource
|
|
|
private MyConfig myConfig;
|
|
|
+ @Resource
|
|
|
+ private TbItemTypeService tbItemTypeService;
|
|
|
|
|
|
/**
|
|
|
* 增
|
|
@@ -102,31 +106,13 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
|
|
|
List<TbFeeStatistics> getMonth(SoMap so) {
|
|
|
List<TbFeeStatistics> monthFees = tbFeeStatisticsMapper.getMonth(so);
|
|
|
- for (TbFeeStatistics fee : monthFees) {
|
|
|
- BigDecimal taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue());
|
|
|
- if(fee.getFeeType() == TbFeeStatistics.FeeTypeEnum.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) {
|
|
|
List<TbFeeStatistics> yearFees = tbFeeStatisticsMapper.getYear(so);
|
|
|
- for (TbFeeStatistics fee : yearFees) {
|
|
|
- BigDecimal taxRate = BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue());
|
|
|
- if(fee.getFeeType() == TbFeeStatistics.FeeTypeEnum.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;
|
|
|
}
|
|
|
|
|
@@ -164,12 +150,15 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
return;
|
|
|
}
|
|
|
parkFee.setNum(totalNum).setTaxMoney(parkFee.getTaxMoney().add(totalPrice));
|
|
|
- BigDecimal taxes = parkFee.getTaxMoney()
|
|
|
+ BigDecimal taxes = totalPrice
|
|
|
.divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(parkFee.getTaxRate());
|
|
|
- BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(taxes);
|
|
|
-// BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(parkFee.getTaxMoney().multiply(parkFee.getTaxRate()));
|
|
|
- parkFee.setNoTaxMoney(noTaxMoney).setTaxes(taxes);
|
|
|
+ taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal noTaxMoney = totalPrice.subtract(taxes);
|
|
|
+ noTaxMoney = noTaxMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ parkFee.setNoTaxMoney(parkFee.getNoTaxMoney().add(noTaxMoney))
|
|
|
+ .setTaxes(parkFee.getTaxes().add(taxes));
|
|
|
+
|
|
|
parkFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
|
|
|
.setFeeType(TbFeeStatistics.FeeTypeEnum.PARK_FEE.getCode()).setItemTypeName(TbFeeStatistics.FeeTypeEnum.PARK_FEE.getDesc())
|
|
|
.setPayType(3);
|
|
@@ -200,33 +189,39 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
String thisYear = StrUtil.sub(toDay, 0, 4);
|
|
|
String thisMonth = StrUtil.sub(toDay, 0, 7);
|
|
|
for (TbBusinessItem item : items) {
|
|
|
- int feeType = -1;
|
|
|
+ Integer feeType = item.getPayType();
|
|
|
String itemType = item.getItemTypeName();
|
|
|
- if (itemType.contains("核酸")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.NUCLEIC_FEE.getCode();
|
|
|
- } else if (itemType.contains("消毒") || itemType.contains("消杀")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.DISINFECT_FEE.getCode();
|
|
|
- } else if (itemType.contains("装卸")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
|
|
|
- } else if (StrUtil.equals(itemType, "特殊车辆") || StrUtil.equals(itemType, "汽车吊")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
|
|
|
- } else if (itemType.contains("入场管理")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.MANAGE_FEE.getCode();
|
|
|
- } else if(StrUtil.equals(itemType, "充电打冷")) {
|
|
|
- feeType = TbFeeStatistics.FeeTypeEnum.CHARGE_FEE.getCode();
|
|
|
+ if(StrUtil.isNotEmpty(itemType)){
|
|
|
+ if (itemType.contains("核酸")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.NUCLEIC_FEE.getCode();
|
|
|
+ } else if (itemType.contains("消毒") || itemType.contains("消杀")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.DISINFECT_FEE.getCode();
|
|
|
+ } else if (itemType.contains("装卸")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
|
|
|
+ } else if (StrUtil.equals(itemType, "特殊车辆") || StrUtil.equals(itemType, "汽车吊")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
|
|
|
+ } else if (itemType.contains("入场管理")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.MANAGE_FEE.getCode();
|
|
|
+ } else if(StrUtil.equals(itemType, "充电打冷")) {
|
|
|
+ feeType = TbFeeStatistics.FeeTypeEnum.CHARGE_FEE.getCode();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ Double taxRate = item.getTaxRate();
|
|
|
+
|
|
|
TbFeeStatistics businessFee = this.getByDayAndFeeType(toDay, feeType);
|
|
|
if (businessFee == null) {
|
|
|
businessFee = new TbFeeStatistics();
|
|
|
- businessFee.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue()));
|
|
|
+ businessFee.setTaxRate(BigDecimal.valueOf(taxRate));
|
|
|
}
|
|
|
businessFee.setTaxMoney(businessFee.getTaxMoney().add(item.getTotal()));//含税收入
|
|
|
- //businessFee.setNum(businessFee.getNum() + 1);
|
|
|
businessFee.setNum(businessFee.getNum() + Integer.valueOf(item.getNum()));
|
|
|
BigDecimal taxes = businessFee.getTaxMoney()
|
|
|
.divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(businessFee.getTaxRate());
|
|
|
+ taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(taxes);
|
|
|
+ noTaxMoney = noTaxMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
businessFee.setNoTaxMoney(noTaxMoney).setTaxes(taxes);
|
|
|
businessFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
|
|
@@ -241,13 +236,15 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
TbFeeDetails businessFeeDetail = null;
|
|
|
if (businessFeeDetail == null) {
|
|
|
businessFeeDetail = new TbFeeDetails();
|
|
|
- businessFeeDetail.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue()));
|
|
|
+ businessFeeDetail.setTaxRate(BigDecimal.valueOf(taxRate));
|
|
|
}
|
|
|
|
|
|
BigDecimal taxPrice = item.getItemPrice()
|
|
|
.divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(businessFeeDetail.getTaxRate());
|
|
|
+ taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxPrice = item.getItemPrice().subtract(taxPrice);
|
|
|
+ noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
String carNo = business.getCardNo();
|
|
|
if(StrUtil.isEmpty(business.getCardNo())){
|
|
|
carNo = business.getChinaCarNo();
|