客户余额额度初始化始终为0
This commit is contained in:
+1
-10
@@ -26,18 +26,9 @@ public interface BmsCustomerMapper
|
||||
/** 轻量查询客户当前状态;不存在或已逻辑删除时返回 null。 */
|
||||
public BmsCustomer selectCustomerStatusByCustomerId(Long customerId);
|
||||
|
||||
/**
|
||||
* 只取客户档案物理额度列(credit_ed 在通用查询里是账户可用额度的子查询别名,
|
||||
* 账户首次初始化时必须读取档案原始值)
|
||||
*
|
||||
* @param customerId 客户ID
|
||||
* @return 仅含 creditEd/tempEd 的客户对象
|
||||
*/
|
||||
public BmsCustomer selectRawCreditByCustomerId(Long customerId);
|
||||
|
||||
/**
|
||||
* 查询客户主列表
|
||||
*
|
||||
*
|
||||
* @param bmsCustomer 客户主
|
||||
* @return 客户主集合
|
||||
*/
|
||||
|
||||
+19
-29
@@ -49,7 +49,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
|
||||
|
||||
/** 本位币币种 */
|
||||
private static final String BASE_CURRENCY = BmsExchangeRate.BASE_CURRENCY;
|
||||
/** 新客户默认总额度(CNY):默认0,信用额度一律通过「申请-审批」分配 */
|
||||
/** 账户初始化额度(CNY):信用额度/临时额度一律初始化为0,不取客户档案录入值;额度仅在「客户余额-额度管理」调整时变化 */
|
||||
private static final BigDecimal DEFAULT_CREDIT = BigDecimal.ZERO;
|
||||
/** 金额保留位数 */
|
||||
private static final int MONEY_SCALE = 2;
|
||||
@@ -111,27 +111,20 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
BmsCustomer customer = bmsCustomerMapper.selectRawCreditByCustomerId(customerId);
|
||||
BmsCustomer customer = bmsCustomerMapper.selectBmsCustomerByCustomerId(customerId);
|
||||
if (customer == null)
|
||||
{
|
||||
throw new ServiceException("客户不存在");
|
||||
}
|
||||
BigDecimal initCredit = nz(customer.getCreditEd());
|
||||
if (initCredit.compareTo(BigDecimal.ZERO) < 0)
|
||||
{
|
||||
initCredit = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal initTemp = nz(customer.getTempEd());
|
||||
account = createCnyAccount(customerId, initCredit, initTemp, username);
|
||||
// 档案额度与实际初始额度保持一致
|
||||
bmsCustomerMapper.updateCustomerCredit(customerId, initCredit, initTemp, username);
|
||||
// 初始化口径(2026-09-30):信用额度/临时额度一律初始化为0,不从客户档案取值;
|
||||
// 额度仅在「客户余额-额度管理」调整时变化
|
||||
account = createCnyAccount(customerId, DEFAULT_CREDIT, DEFAULT_CREDIT, username);
|
||||
// 档案物理额度列同步为0,与账户初始额度保持一致
|
||||
bmsCustomerMapper.updateCustomerCredit(customerId, DEFAULT_CREDIT, DEFAULT_CREDIT, username);
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_CREDIT,
|
||||
initCredit, null, null, username, "新客户初始化账户,默认信用额度0(需通过额度申请审批分配)");
|
||||
if (initTemp.compareTo(BigDecimal.ZERO) > 0)
|
||||
{
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_TEMP,
|
||||
initTemp, null, null, username, "新客户初始化临时额度");
|
||||
}
|
||||
DEFAULT_CREDIT, null, null, username, "新客户初始化账户,信用额度默认0,需在客户余额-额度管理中调整");
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_TEMP,
|
||||
DEFAULT_CREDIT, null, null, username, "新客户初始化账户,临时额度默认0,需在客户余额-额度管理中调整");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -506,7 +499,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
|
||||
return account;
|
||||
}
|
||||
|
||||
/** 行锁获取客户CNY账户,不存在则按客户档案当前额度初始化创建 */
|
||||
/** 行锁获取客户CNY账户,不存在则初始化创建(信用/临时额度一律初始化为0,不取客户档案值) */
|
||||
private CustomerAccount getOrInitCnyAccount(Long customerId, String username)
|
||||
{
|
||||
CustomerAccount account = customerMoneyMapper.selectAccountForUpdate(customerId, BASE_CURRENCY);
|
||||
@@ -514,23 +507,20 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
|
||||
{
|
||||
return account;
|
||||
}
|
||||
BmsCustomer customer = bmsCustomerMapper.selectRawCreditByCustomerId(customerId);
|
||||
BmsCustomer customer = bmsCustomerMapper.selectBmsCustomerByCustomerId(customerId);
|
||||
if (customer == null)
|
||||
{
|
||||
throw new ServiceException("客户不存在");
|
||||
}
|
||||
BigDecimal initCredit = nz(customer.getCreditEd());
|
||||
BigDecimal initTemp = nz(customer.getTempEd());
|
||||
try
|
||||
{
|
||||
account = createCnyAccount(customerId, initCredit, initTemp, username);
|
||||
account = createCnyAccount(customerId, DEFAULT_CREDIT, DEFAULT_CREDIT, username);
|
||||
// 档案物理额度列同步为0,与账户初始额度保持一致
|
||||
bmsCustomerMapper.updateCustomerCredit(customerId, DEFAULT_CREDIT, DEFAULT_CREDIT, username);
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_CREDIT,
|
||||
initCredit, null, null, username, "首次创建CNY账户,从客户档案同步初始额度");
|
||||
if (initTemp.compareTo(BigDecimal.ZERO) > 0)
|
||||
{
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_TEMP,
|
||||
initTemp, null, null, username, "首次创建CNY账户,从客户档案同步临时额度");
|
||||
}
|
||||
DEFAULT_CREDIT, null, null, username, "首次创建CNY账户,信用额度默认0,需在客户余额-额度管理中调整");
|
||||
writeInitFlow(account, CustomerCreditFlow.CREDIT_TYPE_TEMP,
|
||||
DEFAULT_CREDIT, null, null, username, "首次创建CNY账户,临时额度默认0,需在客户余额-额度管理中调整");
|
||||
return account;
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
@@ -598,7 +588,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
|
||||
return account;
|
||||
}
|
||||
|
||||
/** 账户首次初始化时写额度 INIT 流水(从客户档案额度同步) */
|
||||
/** 账户首次初始化时写额度 INIT 流水(初始化额度固定为0) */
|
||||
private void writeInitFlow(CustomerAccount account, String creditType,
|
||||
BigDecimal initAmount, Date effectiveDate, Date expireDate,
|
||||
String username, String remark)
|
||||
|
||||
@@ -236,15 +236,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where customer_id = #{customerId}
|
||||
</update>
|
||||
|
||||
<!-- 只取档案物理额度列(列表查询里的 credit_ed 是账户可用额度子查询) -->
|
||||
<select id="selectRawCreditByCustomerId" resultType="BmsCustomer">
|
||||
select customer_id as customerId,
|
||||
credit_ed as creditEd,
|
||||
temp_ed as tempEd
|
||||
from ctr_customer
|
||||
where customer_id = #{customerId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteBmsCustomerAttachmentByAttachmentIds" parameterType="String">
|
||||
update ctr_customer_attachment set del_flag = '2' where attachment_id in
|
||||
<foreach item="attachmentId" collection="attachmentIds" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user