update 编辑参会人的金额和税率

This commit is contained in:
lijiarao
2022-11-11 14:00:51 +08:00
parent 60eeba1dfe
commit d5bedfddd1
7 changed files with 46 additions and 14 deletions
@@ -4,6 +4,8 @@ import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
/** /**
* 设置静态参数初始化 * 设置静态参数初始化
*/ */
@@ -22,12 +24,19 @@ public class StaticConfig {
@Value(value = "${spring.mail.host}") @Value(value = "${spring.mail.host}")
private String host; private String host;
/**
public static String TAX_RATE; * 税率
*/
public static BigDecimal TAX_RATE;
/**
* 税率计算
*/
public static BigDecimal TAX_RATE_CALCULATE;
@Value("${tax_rate}") @Value("${tax_rate}")
public void setTaxRate(String taxRate) { public void setTaxRate(String taxRate) {
StaticConfig.TAX_RATE = taxRate; StaticConfig.TAX_RATE = new BigDecimal(taxRate);
StaticConfig.TAX_RATE_CALCULATE = new BigDecimal(taxRate).add(BigDecimal.ONE);
} }
@@ -803,7 +803,7 @@ public class PayMailBillServiceImpl extends ServiceImpl<PayMailBillMapper, PayMa
BigDecimal noTaxAmount = payMailBillProject.getNoTaxAmount(); BigDecimal noTaxAmount = payMailBillProject.getNoTaxAmount();
BigDecimal tax = payMailBillProject.getTax(); BigDecimal tax = payMailBillProject.getTax();
if (noTaxAmount == null || tax == null){ if (noTaxAmount == null || tax == null){
noTaxAmount = invoiceAmount.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = invoiceAmount.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = invoiceAmount.subtract(noTaxAmount); tax = invoiceAmount.subtract(noTaxAmount);
} }
payPaymentRecordService.isTax(noTaxAmount,tax,invoiceAmount); payPaymentRecordService.isTax(noTaxAmount,tax,invoiceAmount);
@@ -1140,7 +1140,7 @@ public class PayMailBillServiceImpl extends ServiceImpl<PayMailBillMapper, PayMa
BigDecimal noTaxAmount = bm.getNoTaxAmount(); BigDecimal noTaxAmount = bm.getNoTaxAmount();
BigDecimal tax = bm.getTax(); BigDecimal tax = bm.getTax();
if (noTaxAmount == null || tax == null){ if (noTaxAmount == null || tax == null){
noTaxAmount = thisInvoiceAmount.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = thisInvoiceAmount.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = thisInvoiceAmount.subtract(noTaxAmount); tax = thisInvoiceAmount.subtract(noTaxAmount);
bm.setNoTaxAmount(noTaxAmount); bm.setNoTaxAmount(noTaxAmount);
bm.setTax(tax); bm.setTax(tax);
@@ -30,6 +30,7 @@ import com.jero.company.entity.PayCompanyManagement;
import com.jero.company.entity.PayContactsManagement; import com.jero.company.entity.PayContactsManagement;
import com.jero.company.service.IPayCompanyManagementService; import com.jero.company.service.IPayCompanyManagementService;
import com.jero.company.service.IPayContactsManagementService; import com.jero.company.service.IPayContactsManagementService;
import com.jero.config.StaticConfig;
import com.jero.contract.common.PayIncomeContractCommon; import com.jero.contract.common.PayIncomeContractCommon;
import com.jero.contract.entity.PayIncomeContract; import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.entity.PayIncomeContractAssociated; import com.jero.contract.entity.PayIncomeContractAssociated;
@@ -77,6 +78,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -972,7 +974,10 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
if (ObjectUtil.isNull(payMeetingSituation)) { if (ObjectUtil.isNull(payMeetingSituation)) {
throw new JeroBootException("参会人错误!"); throw new JeroBootException("参会人错误!");
} }
payMeetingSituationVO.setAmountReceivable(payMeetingSituation.getAmountReceivable()); BigDecimal amountReceivable = payMeetingSituationVO.getAmountReceivable();
if (amountReceivable == null){
payMeetingSituationVO.setAmountReceivable(BigDecimal.ZERO);
}
BeanUtils.copyProperties(payMeetingSituationVO, payMeetingSituation); BeanUtils.copyProperties(payMeetingSituationVO, payMeetingSituation);
//处理校验参会人信息 //处理校验参会人信息
PayMeetingSituation payMeetingSituation1; PayMeetingSituation payMeetingSituation1;
@@ -1234,6 +1239,21 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
payMeetingSituation1.setCheckInHotel(payMeetingSituation.getCheckInHotel()); payMeetingSituation1.setCheckInHotel(payMeetingSituation.getCheckInHotel());
payMeetingSituation1.setArrivalTime(payMeetingSituation.getArrivalTime()); payMeetingSituation1.setArrivalTime(payMeetingSituation.getArrivalTime());
payMeetingSituation1.setDepartureTime(payMeetingSituation.getDepartureTime()); payMeetingSituation1.setDepartureTime(payMeetingSituation.getDepartureTime());
//处理默认税率
BigDecimal amountReceivable = payMeetingSituation1.getAmountReceivable();
BigDecimal taxRate = payMeetingSituation.getTaxRate();
if (taxRate == null){
payMeetingSituation1.setTaxRate(StaticConfig.TAX_RATE);
BigDecimal noTaxAmount = amountReceivable.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
BigDecimal tax = amountReceivable.subtract(noTaxAmount);
payMeetingSituation1.setNoTaxAmount(noTaxAmount);
payMeetingSituation1.setTax(tax);
}else {
payMeetingSituation1.setTaxRate(taxRate);
payMeetingSituation1.setNoTaxAmount(payMeetingSituation.getNoTaxAmount());
payMeetingSituation1.setTax(payMeetingSituation.getTax());
}
payMeetingSituation1.setAmountReceivable(payMeetingSituation.getAmountReceivable());
//其他会议的嘉宾和内部企业 //其他会议的嘉宾和内部企业
} else { } else {
CommonGuestVO commonGuestVO = new CommonGuestVO(); CommonGuestVO commonGuestVO = new CommonGuestVO();
@@ -1297,6 +1317,9 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
payMeetingSituation1.setPaidNoTaxAmount(BigDecimal.ZERO); payMeetingSituation1.setPaidNoTaxAmount(BigDecimal.ZERO);
payMeetingSituation1.setPayMode(0); payMeetingSituation1.setPayMode(0);
payMeetingSituation1.setTaxRate(BigDecimal.ZERO);
payMeetingSituation1.setTax(BigDecimal.ZERO);
payMeetingSituation1.setNoTaxAmount(BigDecimal.ZERO);
} }
/** /**
@@ -56,7 +56,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
BigDecimal tax = payConfirmPaymentRecord.getTax(); BigDecimal tax = payConfirmPaymentRecord.getTax();
BigDecimal amountReceived = payConfirmPaymentRecord.getAmountReceived(); BigDecimal amountReceived = payConfirmPaymentRecord.getAmountReceived();
if (noTaxAmount == null || tax == null){ if (noTaxAmount == null || tax == null){
noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount); tax = amountReceived.subtract(noTaxAmount);
payConfirmPaymentRecord.setNoTaxAmount(noTaxAmount); payConfirmPaymentRecord.setNoTaxAmount(noTaxAmount);
payConfirmPaymentRecord.setTax(tax); payConfirmPaymentRecord.setTax(tax);
@@ -565,7 +565,7 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
noTaxAmount = amountReceived; noTaxAmount = amountReceived;
tax = BigDecimal.ZERO; tax = BigDecimal.ZERO;
}else { }else {
noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount); tax = amountReceived.subtract(noTaxAmount);
} }
payPaymentRecord.setTax(tax); payPaymentRecord.setTax(tax);
@@ -642,7 +642,7 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
noTaxAmount = amountReceived; noTaxAmount = amountReceived;
tax = BigDecimal.ZERO; tax = BigDecimal.ZERO;
}else { }else {
noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount); tax = amountReceived.subtract(noTaxAmount);
} }
payPaymentRecord.setTax(tax); payPaymentRecord.setTax(tax);
@@ -213,7 +213,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
BigDecimal tax1 = payPaymentRecord.getTax(); BigDecimal tax1 = payPaymentRecord.getTax();
if (noTaxAmount1 == null || tax1 == null){ if (noTaxAmount1 == null || tax1 == null){
BigDecimal amountReceived = payPaymentRecord.getAmountReceived(); BigDecimal amountReceived = payPaymentRecord.getAmountReceived();
BigDecimal noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); BigDecimal noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
BigDecimal tax = amountReceived.subtract(noTaxAmount); BigDecimal tax = amountReceived.subtract(noTaxAmount);
payPaymentRecord.setNoTaxAmount(noTaxAmount); payPaymentRecord.setNoTaxAmount(noTaxAmount);
payPaymentRecord.setTax(tax); payPaymentRecord.setTax(tax);
@@ -367,7 +367,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
BigDecimal noTaxAmount; BigDecimal noTaxAmount;
List<PayContactsManagementTemporary> listId = new ArrayList<>(); List<PayContactsManagementTemporary> listId = new ArrayList<>();
BigDecimal divide = payPaymentRecord.getAmountReceived().divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); BigDecimal divide = payPaymentRecord.getAmountReceived().divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
//累加主列表实收金额 //累加主列表实收金额
//来款条件校验 //来款条件校验
amountReceivedVerification( payPaymentRecord, flag); amountReceivedVerification( payPaymentRecord, flag);
@@ -642,7 +642,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
noTaxAmount = amountReceived; noTaxAmount = amountReceived;
tax = BigDecimal.ZERO; tax = BigDecimal.ZERO;
}else { }else {
noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount); tax = amountReceived.subtract(noTaxAmount);
} }
//保存税额 //保存税额
@@ -696,7 +696,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
noTaxAmount = amountReceived; noTaxAmount = amountReceived;
tax = BigDecimal.ZERO; tax = BigDecimal.ZERO;
}else { }else {
noTaxAmount = amountReceived.divide(new BigDecimal(StaticConfig.TAX_RATE), 2, RoundingMode.HALF_UP); noTaxAmount = amountReceived.divide(StaticConfig.TAX_RATE_CALCULATE, 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount); tax = amountReceived.subtract(noTaxAmount);
} }
//保存税额 //保存税额
@@ -339,4 +339,4 @@ singleSignON:
client_secret: 3a381f2432d648879ebd10ba7b54a8ae client_secret: 3a381f2432d648879ebd10ba7b54a8ae
client_url: https://iam.catarc.ac.cn client_url: https://iam.catarc.ac.cn
tax_rate: 1.06 tax_rate: 0.06