add 到账开票-标协项目-审核 可以正常来款并且自动判断税额

This commit is contained in:
lijiarao
2022-08-03 15:49:55 +08:00
parent 0cc2f47df1
commit 1e10417306
2 changed files with 39 additions and 6 deletions
@@ -102,12 +102,7 @@ public class PayPaymentCheckController extends JeroController<PayPaymentRecordSu
@PostMapping(value = "/check")
@RequiresPermissions("incomePaymentAndInvoiving:audit")
public Result<?> check(@RequestBody PayPaymentRecord payPaymentRecord) {
try{
payPaymentCheckService.check(payPaymentRecord);
}catch (Exception e){
log.error("审核异常",e);
return Result.error(e.getMessage());
}
payPaymentCheckService.check(payPaymentRecord);
return Result.OK("操作成功");
}
@@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
/**
@@ -553,6 +554,19 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
if(PaymentStatusEnum.COMPLETED.getCode().equals(payPaymentRecord.getPaymentStatus())) {
//已同意
//如果没有发票就存入0
BigDecimal noTaxAmount;
BigDecimal tax;
BigDecimal amountReceived = payPaymentRecord.getAmountReceived();
if (tbMember.getInvoiceRequirements() == 0) {
noTaxAmount = amountReceived;
tax = BigDecimal.ZERO;
}else {
noTaxAmount = amountReceived.divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount);
}
payPaymentRecord.setTax(tax);
payPaymentRecord.setNoTaxAmount(noTaxAmount);
//来款条件校验
payPaymentRecordService.amountReceivedVerification( payPaymentRecord, ProjectCommon.PAYMENT_FLAG2);
@@ -565,7 +579,12 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
//插入来款记录表
payPaymentRecord.setId(null);
payPaymentRecord.setPaymentStatus(paymentStatus);
payPaymentRecord.setNoTaxAmount(noTaxAmount);
payPaymentRecord.setTax(tax);
payPaymentRecordMapper.insert(payPaymentRecord);
//保存税额
tbMember.setConfirmTax(tax);
tbMember.setConfirmNoTaxAmount(noTaxAmount);
tbCheckVo.setCheckResult(PayProjectCommon.YES);
//发消息
@@ -611,6 +630,19 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
if(PaymentStatusEnum.COMPLETED.getCode().equals(payPaymentRecord.getPaymentStatus())) {
//已同意
//如果没有发票就存入0
BigDecimal noTaxAmount;
BigDecimal tax;
BigDecimal amountReceived = payPaymentRecord.getAmountReceived();
if (tbMemberCertificate.getInvoiceRequirements() == 0) {
noTaxAmount = amountReceived;
tax = BigDecimal.ZERO;
}else {
noTaxAmount = amountReceived.divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP);
tax = amountReceived.subtract(noTaxAmount);
}
payPaymentRecord.setTax(tax);
payPaymentRecord.setNoTaxAmount(noTaxAmount);
//来款条件校验
payPaymentRecordService.amountReceivedVerification( payPaymentRecord, ProjectCommon.PAYMENT_FLAG2);
@@ -622,9 +654,15 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl<PayPaymentCheckMappe
tbMemberCertificate.setPaymentStatus(paymentStatus);
//插入来款记录表
payPaymentRecord.setId(null);
payPaymentRecord.setNoTaxAmount(noTaxAmount);
payPaymentRecord.setTax(tax);
payPaymentRecord.setPaymentStatus(paymentStatus);
payPaymentRecordMapper.insert(payPaymentRecord);
//保存税额
tbMemberCertificate.setConfirmTax(tax);
tbMemberCertificate.setConfirmNoTaxAmount(noTaxAmount);
tbCheckCerVo.setCheckResult(PayProjectCommon.YES);
//发消息