From 0c4681cd88b24a172bd8d8eaab0090206e25043c Mon Sep 17 00:00:00 2001 From: lijiarao Date: Mon, 1 Aug 2022 17:53:55 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E7=A8=8E=E9=A2=9D=E5=B0=B1=E5=AD=98=E5=85=A5?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=A8=8E=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PayPaymentRecordServiceImpl.java | 73 ++++++++++++++++--- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java index b2315a13..25eef66a 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java @@ -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 list,Integer flag,String checkOrRecord){ List typr5List = new ArrayList<>(); List 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 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