demand: 1.超期额度计算时间规则只取天数(不精确到时分秒),2.小数点去除问题修复

committer: heyu
This commit is contained in:
aike 2025-04-30 14:57:43 +08:00
parent 1d3a29721f
commit c93db40daf
2 changed files with 10 additions and 8 deletions

View File

@ -43,6 +43,8 @@ package com.xdadan.erp.emis.service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -1592,7 +1594,7 @@ public class EmisBaseService {
// 账期内金额 // 账期内金额
BigDecimal inTermMoney = getInTermMoney(emisWaybillList); BigDecimal inTermMoney = getInTermMoney(emisWaybillList);
// 超期金额 // 超期金额
BigDecimal overTermMoney = BigDecimal.valueOf(useMoney.subtract(inTermMoney).stripTrailingZeros().longValue()); BigDecimal overTermMoney = new BigDecimal(useMoney.subtract(inTermMoney).stripTrailingZeros().toPlainString());
EmisCreditSalesmen emisCreditSalesmen = new EmisCreditSalesmen(); EmisCreditSalesmen emisCreditSalesmen = new EmisCreditSalesmen();
emisCreditSalesmen.setId(item.getId()); emisCreditSalesmen.setId(item.getId());
emisCreditSalesmen.setUseMoney(useMoney); emisCreditSalesmen.setUseMoney(useMoney);
@ -1634,11 +1636,11 @@ public class EmisBaseService {
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
log.info("query emisSettleSubBillList , emisSettleSubBillList,{}", emisSettleSubBillList); log.info("query emisSettleSubBillList , emisSettleSubBillList,{}", emisSettleSubBillList);
BigDecimal inTermMoney = BigDecimal.valueOf(emisSettleSubBillList.stream() BigDecimal inTermMoney = new BigDecimal(emisSettleSubBillList.stream()
.map(EmisSettleSubBill::getBillFee) .map(EmisSettleSubBill::getBillFee)
.filter(i -> i != null) .filter(i -> i != null)
.reduce(BigDecimal.ZERO, BigDecimal::add) .reduce(BigDecimal.ZERO, BigDecimal::add)
.stripTrailingZeros().longValue()); .stripTrailingZeros().toPlainString());
log.info("success.getInTermMoney , inTermMoney,{}", inTermMoney); log.info("success.getInTermMoney , inTermMoney,{}", inTermMoney);
return inTermMoney; return inTermMoney;
} }
@ -1650,7 +1652,7 @@ public class EmisBaseService {
} }
List<EmisWaybill> overTermList = list.stream() List<EmisWaybill> overTermList = list.stream()
.filter(item -> item.getSendDate() != null) .filter(item -> item.getSendDate() != null)
.filter(item -> (System.currentTimeMillis() - item.getSendDate().getTime()) > (10 * 1000 * 60 * 60 * 24)) .filter(item -> ChronoUnit.DAYS.between(item.getSendDate().toInstant(), Instant.now()) > 10)
.collect(Collectors.toList()); .collect(Collectors.toList());
log.info("success.filterOverTermEmisWaybillList , overTermList,{}", overTermList); log.info("success.filterOverTermEmisWaybillList , overTermList,{}", overTermList);
return overTermList; return overTermList;

View File

@ -1378,11 +1378,11 @@
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 --> <!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1"> <if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null and a.send_date is not null
and (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(a.send_date)) > (10 * 24 * 60 * 60) and DATEDIFF(NOW(), a.send_date) > 10
</if> </if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2"> <if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null and a.send_date is not null
and (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(a.send_date)) <![CDATA[ <= ]]> (10 * 24 * 60 * 60) and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if> </if>
<if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " > <if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " >
@ -1767,11 +1767,11 @@
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 --> <!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1"> <if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null and a.send_date is not null
and (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(a.send_date)) > (10 * 24 * 60 * 60) and DATEDIFF(NOW(), a.send_date) > 10
</if> </if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2"> <if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null and a.send_date is not null
and (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(a.send_date)) <![CDATA[ <= ]]> (10 * 24 * 60 * 60) and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if> </if>