Merge pull request 'demand: 现金/月结客户额度临时额度查询/过滤调整' (#24) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/24
This commit is contained in:
smshen 2025-05-13 18:28:36 +08:00
commit 58bee0de44
4 changed files with 131 additions and 24 deletions

View File

@ -67,12 +67,6 @@ public class EmisCreditCustomerServiceImpl extends EmisBaseService
public List<EmisCreditCustomer> selectEmisCreditCustomerList(EmisCreditCustomer emisCreditCustomer) {
log.info("开始查询客户信用额度列表, 查询条件: {}", emisCreditCustomer);
List<EmisCreditCustomer> list = emisCreditCustomerMapper.selectEmisCreditCustomerList(emisCreditCustomer);
// 计算每个记录的临时额度总额
for (EmisCreditCustomer item : list) {
item.setTempCreditMoney(calculateCustomerTempCreditMoney(item));
}
log.info("查询到{}条客户信用额度记录", list.size());
return list;
}

View File

@ -66,14 +66,7 @@ public class EmisCreditSalesmenServiceImpl extends EmisBaseService implements IE
@Override
public List<EmisCreditSalesmen> selectEmisCreditSalesmenList(EmisCreditSalesmen emisCreditSalesmen) {
log.info("开始查询销售信用额度列表");
List<EmisCreditSalesmen> list = emisCreditSalesmenMapper.selectEmisCreditSalesmenList(emisCreditSalesmen);
// 计算每个记录的临时额度总额
for (EmisCreditSalesmen item : list) {
item.setTempCreditMoney(calculateSalesmenTempCreditMoney(item));
}
return list;
return emisCreditSalesmenMapper.selectEmisCreditSalesmenList(emisCreditSalesmen);
}
/**

View File

@ -30,7 +30,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEmisCreditCustomerList" parameterType="EmisCreditCustomer" resultMap="EmisCreditCustomerResult">
select
a.id,a.acc_code, a.customer_code, a.monthly_pay_code,a.use_money,
a.credit_money, a.currency, a.trans_type, a.start_date, a.end_date,
a.credit_money,
COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) as temp_credit_money,
a.currency, a.trans_type, a.start_date, a.end_date,
a.bl_open, a.remark, a.tenant_id, a.del_flag, a.create_by, a.create_time,
a.update_by, a.update_time, a.create_site, a.update_site,
b.customer_name,b.salesmen,b.payee
@ -58,17 +68,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
<if test="params.beginCurMoney != null and params.beginCurMoney != ''">
and (a.credit_money-a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
and (COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
</if>
<if test="params.endCurMoney != null and params.endCurMoney != ''">
and (a.credit_money-a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
and (COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
</if>
<if test="params.beginCurMoneyRate != null and params.beginCurMoneyRate != ''">
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
and ((COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money)/(COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
)))*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
</if>
<if test="params.endCurMoneyRate != null and params.endCurMoneyRate != ''">
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
and ((COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money)/(COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_customer t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
)))*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
</if>
<if test="params.sendDate != null ">

View File

@ -24,7 +24,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectEmisCreditSalesmenList" parameterType="EmisCreditSalesmen" resultMap="EmisCreditSalesmenResult">
select id, acc_code, salesmen, credit_money, use_money, over_term_money, in_term_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
select
a.id, a.acc_code, a.salesmen, a.credit_money,
COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) as temp_credit_money,
a.use_money, a.over_term_money, a.in_term_money, a.currency,
a.trans_type, a.start_date, a.end_date, a.bl_open,
a.remark, a.tenant_id, a.del_flag, a.create_by,
a.create_time, a.update_by, a.update_time, a.create_site, a.update_site
from emis_credit_salesmen a
<where>
del_flag='0'
@ -48,17 +62,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="params.beginCurMoney != null and params.beginCurMoney != ''">
and (a.credit_money-a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
and (COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
</if>
<if test="params.endCurMoney != null and params.endCurMoney != ''">
and (a.credit_money-a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
and (COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
</if>
<if test="params.beginCurMoneyRate != null and params.beginCurMoneyRate != ''">
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
and ((COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money)/(COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
)))*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
</if>
<if test="params.endCurMoneyRate != null and params.endCurMoneyRate != ''">
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
and ((COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
) - a.use_money)/(COALESCE(a.credit_money, 0) + COALESCE(
(select temp_credit_money_adjust
from emis_temp_credit_salesmen t
where t.acc_code = a.acc_code
and t.del_flag = '0'
and NOW() between t.start_date and t.end_date
order by t.create_time desc
limit 1), 0
)))*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
</if>
<if test="params.sendDate != null ">