add 税额判断
This commit is contained in:
+18
-1
@@ -75,6 +75,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -329,6 +330,8 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
//税额是否正确
|
||||
isTax(payPaymentRecord.getTax(),payPaymentRecord.getNoTaxAmount(),payPaymentRecord.getAmountReceived());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,6 +348,8 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
String paymentStatus;
|
||||
String principalId = "";
|
||||
String project = "";
|
||||
BigDecimal tax;
|
||||
BigDecimal noTaxAmount;
|
||||
List<PayContactsManagementTemporary> listId = new ArrayList<>();
|
||||
|
||||
//累加主列表实收金额
|
||||
@@ -759,6 +764,18 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 税额是否正确
|
||||
* @param tax 税额
|
||||
* @param noTaxAmount 未税金额
|
||||
* @param amountReceived 总金额
|
||||
*/
|
||||
private void isTax(BigDecimal tax,BigDecimal noTaxAmount,BigDecimal amountReceived){
|
||||
if (amountReceived.compareTo(tax.add(noTaxAmount)) != 0) {
|
||||
throw new JeroBootException("税额和未税金额相加不等于总金额");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 累加实收并四舍五入
|
||||
* @param paidAmount 实收
|
||||
@@ -771,7 +788,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
if(paidAmount == null){
|
||||
paidAmount = new BigDecimal("0");
|
||||
}
|
||||
return paidAmount.add(amountReceived).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
return paidAmount.add(amountReceived).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user