add 如果没有填写税额就存入默认税额

This commit is contained in:
lijiarao
2022-08-01 17:54:07 +08:00
parent 5561ee0f72
commit 0c4681cd88
@@ -1,5 +1,6 @@
package com.jero.payment.service.impl;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -74,6 +75,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.DecimalMax;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
@@ -204,6 +206,18 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
public void addAmountReceived(List<PayPaymentRecord> list,Integer flag,String checkOrRecord){
List<TbCheckVo> typr5List = new ArrayList<>();
List<TbCheckVo> typr6List = new ArrayList<>();
//如果没有填写税额就存入默认税额
list.forEach(payPaymentRecord ->{
BigDecimal noTaxAmount1 = payPaymentRecord.getNoTaxAmount();
BigDecimal tax1 = payPaymentRecord.getTax();
if (noTaxAmount1 == null || tax1 == null){
BigDecimal amountReceived = payPaymentRecord.getAmountReceived();
BigDecimal noTaxAmount = amountReceived.divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP);
BigDecimal tax = amountReceived.subtract(noTaxAmount);
payPaymentRecord.setNoTaxAmount(noTaxAmount);
payPaymentRecord.setTax(tax);
}
});
for(PayPaymentRecord payPaymentRecord : list){
addOneAmountReceived(payPaymentRecord,typr5List,typr6List,flag,checkOrRecord);
@@ -352,6 +366,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
BigDecimal noTaxAmount;
List<PayContactsManagementTemporary> listId = new ArrayList<>();
BigDecimal divide = payPaymentRecord.getAmountReceived().divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP);
//累加主列表实收金额
//来款条件校验
amountReceivedVerification( payPaymentRecord, flag);
@@ -372,7 +387,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(payCommonProject.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(payCommonProject.getReceivableAmount(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(payCommonProject.getReceivableAmount(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(payCommonProject.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(payCommonProject.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
payCommonProject.setPaidTax(tax);
payCommonProject.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
payCommonProject.setPaidAmount(newPaidAmount);
payCommonProject.setInAccount(inAccount);
@@ -400,7 +418,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(payWorking.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(payWorking.getReceivableAmount(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(payWorking.getReceivableAmount(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(payWorking.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(payWorking.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
payWorking.setPaidTax(tax);
payWorking.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
payWorking.setPaidAmount(newPaidAmount);
payWorking.setInAccount(inAccount);
@@ -426,7 +447,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(meeting.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(meeting.getAmountReceivable(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(meeting.getAmountReceivable(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(meeting.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(meeting.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
meeting.setPaidTax(tax);
meeting.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
meeting.setPaidAmount(newPaidAmount);
meeting.setInAccount(inAccount);
@@ -450,7 +474,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(member.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(member.getAmountReceivable(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(member.getAmountReceivable(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(member.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(member.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
member.setPaidTax(tax);
member.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
member.setPaidAmount(newPaidAmount);
@@ -477,7 +504,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(tbMember.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(tbMember.getAmountReceivable(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(tbMember.getAmountReceivable(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(tbMember.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(tbMember.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
tbMember.setPaidTax(tax);
tbMember.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
tbMember.setPaidAmount(newPaidAmount);
tbMember.setInAccount(inAccount);
@@ -510,7 +540,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(tbMemberCertificate.getPaidAmount(),payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(tbMemberCertificate.getAmountReceivable(), newPaidAmount);//到账状态
paymentStatus = payPaymentCheckService.getPaymentStatus(tbMemberCertificate.getAmountReceivable(), newPaidAmount, PaymentStatusEnum.COMPLETED.getCode());//缴费状态
tax = addPaidAmount(tbMemberCertificate.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(tbMemberCertificate.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
tbMemberCertificate.setPaidTax(tax);
tbMemberCertificate.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
tbMemberCertificate.setPaidAmount(newPaidAmount);
tbMemberCertificate.setInAccount(inAccount);
@@ -788,6 +821,9 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
if(paidAmount == null){
paidAmount = new BigDecimal("0");
}
if (amountReceived == null){
amountReceived = BigDecimal.ZERO;
}
return paidAmount.add(amountReceived).setScale(2, RoundingMode.HALF_UP);
}
@@ -901,7 +937,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
BigDecimal newPaidAmount;
BigDecimal paidAmount;
Integer inAccount;
BigDecimal tax;
BigDecimal noTaxAmount;
//税额是否正确
isTax(payPaymentRecord.getTax(),payPaymentRecord.getNoTaxAmount(),payPaymentRecord.getAmountReceived());
switch (String.valueOf(payPaymentRecord.getProjectType())){
// 普通项目
case PayIncomeContractCommon.PROJECT_TYPE1:
@@ -914,7 +953,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(paidAmount,payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(receivableAmount, newPaidAmount);//到账状态
tax = addPaidAmount(payCommonProject.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(payCommonProject.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
payCommonProject.setPaidTax(tax);
payCommonProject.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
payCommonProject.setPaidAmount(newPaidAmount);
payCommonProject.setInAccount(inAccount);
@@ -933,7 +975,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(paidAmount,payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(receivableAmount, newPaidAmount);//到账状态
tax = addPaidAmount(payWorking.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(payWorking.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
payWorking.setPaidTax(tax);
payWorking.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
payWorking.setPaidAmount(newPaidAmount);
payWorking.setInAccount(inAccount);
@@ -955,7 +1000,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(paidAmount,payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(receivableAmount, newPaidAmount);//到账状态
tax = addPaidAmount(meeting.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(meeting.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
meeting.setPaidTax(tax);
meeting.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
meeting.setPaidAmount(newPaidAmount);
meeting.setInAccount(inAccount);
@@ -974,7 +1022,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
newPaidAmount =addPaidAmount(paidAmount,payPaymentRecord.getAmountReceived());//累加实收
inAccount = getInAccount(receivableAmount, newPaidAmount);//到账状态
tax = addPaidAmount(member.getPaidTax(),payPaymentRecord.getTax());
noTaxAmount = addPaidAmount(member.getPaidNoTaxAmount(),payPaymentRecord.getNoTaxAmount());
member.setPaidTax(tax);
member.setPaidNoTaxAmount(noTaxAmount);
//更新主列表
member.setPaidAmount(newPaidAmount);
member.setInAccount(inAccount);