2025-02-27 13:36:55 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<mapper namespace="com.bonus.canteen.core.account.v3.mapper.AccTradeMapper">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
<!-- 移动端分页查询充值记录 -->
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<select id="queryTradeAppPage" resultType="com.bonus.canteen.core.account.v3.app.vo.AppAccTradePageVO">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
id AS tradeId,
|
|
|
|
|
|
amount,
|
|
|
|
|
|
acc_all_bal as walletBalTotal,
|
|
|
|
|
|
trade_type,
|
|
|
|
|
|
trade_time,
|
|
|
|
|
|
pay_state,
|
|
|
|
|
|
pay_type,
|
|
|
|
|
|
remark,
|
|
|
|
|
|
fail_reason
|
|
|
|
|
|
FROM acc_trade
|
|
|
|
|
|
<where>
|
|
|
|
|
|
cust_id = #{infoParam.custId}
|
|
|
|
|
|
<if test="infoParam.startDateTime != null">
|
|
|
|
|
|
and trade_time <![CDATA[ >= ]]> #{infoParam.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="infoParam.endDateTime != null">
|
|
|
|
|
|
and trade_time <![CDATA[ <= ]]> #{infoParam.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="infoParam.tradeTypeList != null and infoParam.tradeTypeList.size()>0 ">
|
|
|
|
|
|
and trade_type in
|
|
|
|
|
|
<foreach collection="infoParam.tradeTypeList" item="tradeType" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="infoParam.payStateList != null and infoParam.payStateList.size()>0 ">
|
|
|
|
|
|
and pay_state in
|
|
|
|
|
|
<foreach collection="infoParam.payStateList" item="payState" separator="," open="(" close=")">
|
|
|
|
|
|
#{payState}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY trade_time DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<!-- * 查询交易记录 场景:发送mq-->
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<select id="listAccTradeForSend" resultType="com.bonus.canteen.core.account.v3.mq.send.model.RepAccMqModel">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
atr.id AS flowId,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
2025-03-12 16:22:41 +08:00
|
|
|
|
ci.nick_name as cust_name,
|
2025-02-27 13:36:55 +08:00
|
|
|
|
atr.org_id,
|
2025-03-12 16:22:41 +08:00
|
|
|
|
co.dept_name as org_name,
|
2025-03-21 16:50:28 +08:00
|
|
|
|
co.dept_name AS org_full_name,
|
2025-02-27 13:36:55 +08:00
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.amount AS flowAmount,
|
|
|
|
|
|
atr.actual_amount AS flowRealAmount,
|
|
|
|
|
|
atr.manage_cost AS manageCost,
|
|
|
|
|
|
atr.wallet_bal_total AS accTotalBal,
|
|
|
|
|
|
atr.acc_all_bal AS accAllBal,
|
|
|
|
|
|
atr.trade_time AS payTime,
|
|
|
|
|
|
atr.trade_type AS flowType,
|
|
|
|
|
|
atr.remark,
|
|
|
|
|
|
atr.crby AS optname,
|
|
|
|
|
|
atr.recharge_source AS rechargeSource,
|
|
|
|
|
|
atr.machine_type AS machineType,
|
|
|
|
|
|
atr.pay_channel AS payChannel,
|
|
|
|
|
|
atr.pay_type AS payType,
|
|
|
|
|
|
atr.batch_num AS batchNum,
|
|
|
|
|
|
atr.recharge_operate AS rechargeOperate,
|
|
|
|
|
|
atr.machine_sn As mchSn,
|
|
|
|
|
|
atr.machine_sn,
|
|
|
|
|
|
atr.withdraw_source,
|
|
|
|
|
|
atr.operate_source,
|
|
|
|
|
|
atr.origin_trade_id
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade AS atr
|
2025-03-12 16:22:41 +08:00
|
|
|
|
LEFT JOIN sys_user AS ci ON atr.cust_id = ci.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept AS co ON atr.org_id = co.dept_id
|
2025-02-27 13:36:55 +08:00
|
|
|
|
LEFT JOIN cust_psn_type AS cpt ON atr.psn_type = cpt.psn_type
|
|
|
|
|
|
WHERE atr.id IN
|
|
|
|
|
|
<foreach collection="tradeIdList" item="tradeId" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
ORDER BY atr.trade_time,atr.id
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-03-12 16:22:41 +08:00
|
|
|
|
<!-- <select id="listAccTradeForSend" resultType="net.xnzn.core.account.v3.mq.send.model.RepAccMqModel">-->
|
|
|
|
|
|
<!-- SELECT-->
|
|
|
|
|
|
<!-- atr.id AS flowId,-->
|
|
|
|
|
|
<!-- atr.cust_id,-->
|
|
|
|
|
|
<!-- ci.cust_num,-->
|
|
|
|
|
|
<!-- ci.cust_name,-->
|
|
|
|
|
|
<!-- atr.org_id,-->
|
|
|
|
|
|
<!-- co.org_name,-->
|
|
|
|
|
|
<!-- co.org_full_name,-->
|
|
|
|
|
|
<!-- atr.psn_type,-->
|
|
|
|
|
|
<!-- cpt.psn_type_name,-->
|
|
|
|
|
|
<!-- atr.amount AS flowAmount,-->
|
|
|
|
|
|
<!-- atr.actual_amount AS flowRealAmount,-->
|
|
|
|
|
|
<!-- atr.manage_cost AS manageCost,-->
|
|
|
|
|
|
<!-- atr.wallet_bal_total AS accTotalBal,-->
|
|
|
|
|
|
<!-- atr.acc_all_bal AS accAllBal,-->
|
|
|
|
|
|
<!-- atr.trade_time AS payTime,-->
|
|
|
|
|
|
<!-- atr.trade_type AS flowType,-->
|
|
|
|
|
|
<!-- atr.remark,-->
|
|
|
|
|
|
<!-- atr.crby AS optname,-->
|
|
|
|
|
|
<!-- atr.recharge_source AS rechargeSource,-->
|
|
|
|
|
|
<!-- atr.machine_type AS machineType,-->
|
|
|
|
|
|
<!-- atr.pay_channel AS payChannel,-->
|
|
|
|
|
|
<!-- atr.pay_type AS payType,-->
|
|
|
|
|
|
<!-- atr.batch_num AS batchNum,-->
|
|
|
|
|
|
<!-- atr.recharge_operate AS rechargeOperate,-->
|
|
|
|
|
|
<!-- atr.machine_sn As mchSn,-->
|
|
|
|
|
|
<!-- atr.machine_sn,-->
|
|
|
|
|
|
<!-- atr.withdraw_source,-->
|
|
|
|
|
|
<!-- atr.operate_source,-->
|
|
|
|
|
|
<!-- atr.origin_trade_id-->
|
|
|
|
|
|
<!-- FROM-->
|
|
|
|
|
|
<!-- acc_trade AS atr-->
|
|
|
|
|
|
<!-- LEFT JOIN cust_info AS ci ON atr.cust_id = ci.cust_id-->
|
|
|
|
|
|
<!-- LEFT JOIN cust_org AS co ON atr.org_id = co.org_id-->
|
|
|
|
|
|
<!-- LEFT JOIN cust_psn_type AS cpt ON atr.psn_type = cpt.psn_type-->
|
|
|
|
|
|
<!-- WHERE atr.id IN-->
|
|
|
|
|
|
<!-- <foreach collection="tradeIdList" item="tradeId" separator="," open="(" close=")">-->
|
|
|
|
|
|
<!-- #{tradeId}-->
|
|
|
|
|
|
<!-- </foreach>-->
|
|
|
|
|
|
<!-- ORDER BY atr.trade_time,atr.id-->
|
|
|
|
|
|
<!-- </select>-->
|
|
|
|
|
|
|
2025-02-27 13:36:55 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 获取个人钱包充值汇总-->
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<select id="getAccRechargeSum" resultType="com.bonus.canteen.core.account.v3.api.vo.AccRechargeSumApiVO">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
count(*) AS sumCount,
|
|
|
|
|
|
SUM( amount ) AS sumAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = 10 and t1.pay_state = 3 and t1.trade_state = 2
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and t1.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payChannellList != null and param.payChannellList.size() > 0">
|
|
|
|
|
|
and t1.pay_channel in
|
|
|
|
|
|
<foreach collection="param.payChannellList" item="payChannel" separator="," open="(" close=")">
|
|
|
|
|
|
#{payChannel}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 移动端根据交易id获取交易记录-->
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<select id="getOneTradeApp" resultType="com.bonus.canteen.core.account.v3.app.vo.AppAccTradePageVO">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
id AS tradeId,
|
|
|
|
|
|
amount,
|
|
|
|
|
|
acc_all_bal as walletBalTotal,
|
|
|
|
|
|
trade_type,
|
|
|
|
|
|
trade_time,
|
|
|
|
|
|
pay_state,
|
|
|
|
|
|
pay_type,
|
|
|
|
|
|
remark
|
|
|
|
|
|
FROM acc_trade
|
|
|
|
|
|
WHERE id = #{tradeId}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询用户补贴交易明细-->
|
2025-02-27 13:46:27 +08:00
|
|
|
|
<select id="listAccSubsidyTrade" resultType="com.bonus.canteen.core.account.v3.model.AccTradeWalletDetail">
|
2025-02-27 13:36:55 +08:00
|
|
|
|
SELECT *
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade_wallet_detail
|
|
|
|
|
|
<where>
|
|
|
|
|
|
wallet_id = 2
|
|
|
|
|
|
and cust_id = #{custId}
|
|
|
|
|
|
<if test="tradeTypeList != null and tradeTypeList.size() > 0">
|
|
|
|
|
|
and trade_type in
|
|
|
|
|
|
<foreach collection="tradeTypeList" item="tradeType" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY trade_time DESC,trade_id DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-03-20 18:34:05 +08:00
|
|
|
|
<!-- 分页查询补贴充值记录-->
|
|
|
|
|
|
<select id="queryAccSubRechargeList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubRechargePageVO">
|
|
|
|
|
|
<include refid="query_sub_recharge_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询补贴充值记录sql -->
|
|
|
|
|
|
<sql id="query_sub_recharge_detail_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
2025-03-21 16:50:28 +08:00
|
|
|
|
co.dept_name AS org_full_name,
|
2025-03-20 18:34:05 +08:00
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId,
|
|
|
|
|
|
atr.trade_state,
|
|
|
|
|
|
atr.batch_num,
|
|
|
|
|
|
atr.remark,
|
|
|
|
|
|
atr.amount as rechargeAmount,
|
|
|
|
|
|
atwd.wallet_bal as rechargeAfterWalletBal,
|
|
|
|
|
|
atwd.validate_time
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="acc_recharge_sub_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc,atr.id desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴充值记录where条件-->
|
|
|
|
|
|
<sql id="acc_recharge_sub_page_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type = 20 and atr.pay_state = 3
|
|
|
|
|
|
<if test="param.accTradeId != null">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.batchNum != null and param.batchNum != ''">
|
|
|
|
|
|
and atr.batch_num = #{param.batchNum}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 关联用户模糊查询-->
|
|
|
|
|
|
<sql id="cust_fuzzy_query">
|
|
|
|
|
|
and (ci.cust_num LIKE CONCAT('%', #{param.keyword},'%')
|
2025-03-21 16:59:03 +08:00
|
|
|
|
or ci.nick_name = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
|
|
|
|
|
or ci.phonenumber = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
|
|
|
|
|
<!-- or ci.mobile_suffix = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler} -->
|
|
|
|
|
|
or ci.nick_name_like LIKE CONCAT('%',#{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.CipherQueryLikeHandler},'%')
|
2025-03-20 18:34:05 +08:00
|
|
|
|
)
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询补贴充值记录-合计金额-->
|
|
|
|
|
|
<select id="getTotalAccSubRechargePage" resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubRechargePageVO">
|
|
|
|
|
|
SELECT sum(atr.amount) rechargeAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="acc_recharge_sub_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询补贴清空记录-->
|
|
|
|
|
|
<select id="queryAccSubClearList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubClearPageVO">
|
|
|
|
|
|
<include refid="query_sub_clear_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴清空记录sql-->
|
|
|
|
|
|
<sql id="query_sub_clear_detail_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name AS cust_name,
|
|
|
|
|
|
ci.phonenumber AS mobile,
|
2025-03-21 16:50:28 +08:00
|
|
|
|
co.dept_name AS org_full_name,
|
2025-03-20 18:34:05 +08:00
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.amount as clearAmount,
|
|
|
|
|
|
atwd.wallet_bal as clearAfterWalletBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="acc_recharge_sub_clear_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc,atr.id desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴清空记录where条件-->
|
|
|
|
|
|
<sql id="acc_recharge_sub_clear_page_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type = 100 and atr.pay_state = 3
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.batchNum != null and param.batchNum != ''">
|
|
|
|
|
|
and atr.batch_num = #{param.batchNum}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询补贴清空记录 - 合计金额-->
|
|
|
|
|
|
<select id="getTotalAccSubClearPage" resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubClearPageVO">
|
|
|
|
|
|
SELECT SUM(atr.amount) clearAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="acc_recharge_sub_clear_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总-用户个人补贴汇总-导出-->
|
|
|
|
|
|
<select id="listAccSubRechargeCollectPageForCust"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubCollectVO">
|
|
|
|
|
|
<include refid="query_acc_sub_recharge_collect_cust_sql"></include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总-用户个人补贴汇总-sql-->
|
|
|
|
|
|
<sql id="query_acc_sub_recharge_collect_cust_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
ci.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
2025-03-21 16:50:28 +08:00
|
|
|
|
co.dept_name AS custOrgFullName,
|
2025-03-20 18:34:05 +08:00
|
|
|
|
IFNULL(t3.count,0) AS `times`,
|
|
|
|
|
|
IFNULL(t3.amount,0) AS `amount`,
|
|
|
|
|
|
IFNULL(t3.clearTimes,0) AS clearTimes,
|
|
|
|
|
|
IFNULL(t3.clearAmount,0) AS clearAmount,
|
|
|
|
|
|
IFNULL(t3.revocationTimes,0) AS revocationTimes,
|
|
|
|
|
|
IFNULL(t3.revocationAmount,0) AS revocationAmount,
|
|
|
|
|
|
IFNULL(t3.amount,0) + IFNULL(t3.clearAmount,0) + IFNULL(t3.revocationAmount,0) AS totalAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_user ci
|
|
|
|
|
|
INNER JOIN acc_info ai on ci.cust_id = ai.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON ci.dept_id = co.dept_id
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
(
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
t1.cust_id,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN 1 ELSE 0 END ) AS `count`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN t1.amount ELSE 0 END ) AS `amount`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN 1 ELSE 0 END ) AS revocationTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN - t1.amount ELSE 0 END ) AS revocationAmount,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN 1 ELSE 0 END ) AS clearTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN - t1.amount ELSE 0 END ) AS clearAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type IN (20,50,100)
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.cust_id
|
|
|
|
|
|
) t3 ON t3.cust_id = ci.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
and ci.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL,amount DESC,ci.cust_id
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总 - 人员类别汇总 集合-->
|
|
|
|
|
|
<select id="listAccSubRechargeCollectForCustPsn"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubCollectVO">
|
|
|
|
|
|
<include refid="query_acc_recharge_sum_psn_base_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总-人员类别汇总 sql -->
|
|
|
|
|
|
<sql id="query_acc_recharge_sum_psn_base_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
cpt.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
IFNULL(t3.count,0) AS `times`,
|
|
|
|
|
|
IFNULL(t3.amount,0) AS `amount`,
|
|
|
|
|
|
IFNULL(t3.clearTimes,0) AS clearTimes,
|
|
|
|
|
|
IFNULL(t3.clearAmount,0) AS clearAmount,
|
|
|
|
|
|
IFNULL(t3.revocationTimes,0) AS revocationTimes,
|
|
|
|
|
|
IFNULL(t3.revocationAmount,0) AS revocationAmount,
|
|
|
|
|
|
IFNULL(t3.amount,0) + IFNULL(t3.clearAmount,0) + IFNULL(t3.revocationAmount,0) AS totalAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
(SELECT psn_type_name, psn_type FROM cust_psn_type UNION ALL SELECT '—' AS psn_type_name, - 1 AS psn_type) cpt
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
(
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( t1.psn_type, - 1 ) AS psn_type,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN 1 ELSE 0 END ) AS `count`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN t1.amount ELSE 0 END ) AS `amount`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN 1 ELSE 0 END ) AS revocationTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN - t1.amount ELSE 0 END ) AS revocationAmount,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN 1 ELSE 0 END ) AS clearTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN - t1.amount ELSE 0 END ) AS clearAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type IN (20,50,100)
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.psn_type
|
|
|
|
|
|
) t3 ON t3.psn_type = cpt.psn_type
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
and cpt.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL, amount DESC, cpt.psn_type
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总 - 组织汇总 集合-->
|
|
|
|
|
|
<select id="listAccSubRechargeCollectPageCustOrg"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubCollectVO">
|
|
|
|
|
|
<include refid="query_acc_recharge_sum_org_base_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总组织汇总sql-->
|
|
|
|
|
|
<sql id="query_acc_recharge_sum_org_base_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
g.dept_id as org_id,
|
|
|
|
|
|
<!-- g.org_num, -->
|
2025-03-21 16:50:28 +08:00
|
|
|
|
g.dept_name AS org_full_name,
|
2025-03-20 18:34:05 +08:00
|
|
|
|
IFNULL(t3.count,0) AS `times`,
|
|
|
|
|
|
IFNULL(t3.amount,0) AS `amount`,
|
|
|
|
|
|
IFNULL(t3.clearTimes,0) AS clearTimes,
|
|
|
|
|
|
IFNULL(t3.clearAmount,0) AS clearAmount,
|
|
|
|
|
|
IFNULL(t3.revocationTimes,0) AS revocationTimes,
|
|
|
|
|
|
IFNULL(t3.revocationAmount,0) AS revocationAmount,
|
|
|
|
|
|
IFNULL(t3.amount,0) + IFNULL(t3.clearAmount,0) + IFNULL(t3.revocationAmount,0) AS totalAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_dept g
|
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( t1.org_id, - 1 ) AS org_id,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN 1 ELSE 0 END ) AS `count`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 20 THEN t1.amount ELSE 0 END ) AS `amount`,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN 1 ELSE 0 END ) AS revocationTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 50 THEN - t1.amount ELSE 0 END ) AS revocationAmount,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN 1 ELSE 0 END ) AS clearTimes,
|
|
|
|
|
|
SUM( CASE WHEN t1.trade_type = 100 THEN - t1.amount ELSE 0 END ) AS clearAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type IN ( 20, 50, 100 )
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.org_id
|
|
|
|
|
|
) t3 ON t3.org_id = g.dept_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
and g.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL,amount DESC,g.ancestors
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总-用户个人补贴汇总-->
|
|
|
|
|
|
<select id="getTotalAccSubRechargeCollectAmountForCust"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubCollectVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( a.times, 0 ) AS `times`,
|
|
|
|
|
|
IFNULL( a.amount, 0 ) AS `amount`,
|
|
|
|
|
|
IFNULL( a.clearTimes, 0 ) AS clearTimes,
|
|
|
|
|
|
IFNULL( a.clearAmount, 0 ) AS clearAmount,
|
|
|
|
|
|
IFNULL( a.revocationTimes, 0 ) AS revocationTimes,
|
|
|
|
|
|
IFNULL( a.revocationAmount, 0 ) AS revocationAmount,
|
|
|
|
|
|
IFNULL( a.amount, 0 ) + IFNULL( a.clearAmount, 0 ) + IFNULL( a.revocationAmount, 0 ) AS totalAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
(
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 20 THEN 1 ELSE 0 END ) AS `times`,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 20 THEN atr.amount ELSE 0 END ) AS `amount`,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 50 THEN 1 ELSE 0 END ) AS revocationTimes,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 50 THEN - atr.amount ELSE 0 END ) AS revocationAmount,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 100 THEN 1 ELSE 0 END ) AS clearTimes,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 100 THEN - atr.amount ELSE 0 END ) AS clearAmount
|
|
|
|
|
|
FROM sys_user ci
|
|
|
|
|
|
LEFT JOIN acc_trade atr ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type IN ( 20, 50, 100 )
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
AND atr.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
AND ci.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="'2'.toString() == authPO.roleType.toString()">
|
|
|
|
|
|
and EXISTS (
|
|
|
|
|
|
SELECT null
|
|
|
|
|
|
FROM sys_role_dept it1
|
|
|
|
|
|
LEFT JOIN sys_role it2 ON it2.role_id = it1.role_id
|
|
|
|
|
|
LEFT JOIN sys_user_role it3 ON it1.role_id = it3.role_id
|
|
|
|
|
|
WHERE it2.del_flag = 0
|
|
|
|
|
|
AND it2.role_key = #{authPO.roleCode}
|
|
|
|
|
|
<!-- AND it1.half_select = 1 -->
|
|
|
|
|
|
AND it3.user_id = #{authPO.userId}
|
|
|
|
|
|
AND it1.dept_id = ci.dept_id
|
|
|
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
) as a
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 补贴汇总 - 合计金额-->
|
|
|
|
|
|
<select id="getTotalAccSubRechargeCollectAmount"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubCollectVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( a.times, 0 ) AS `times`,
|
|
|
|
|
|
IFNULL( a.amount, 0 ) AS `amount`,
|
|
|
|
|
|
IFNULL( a.clearTimes, 0 ) AS clearTimes,
|
|
|
|
|
|
IFNULL( a.clearAmount, 0 ) AS clearAmount,
|
|
|
|
|
|
IFNULL( a.revocationTimes, 0 ) AS revocationTimes,
|
|
|
|
|
|
IFNULL( a.revocationAmount, 0 ) AS revocationAmount,
|
|
|
|
|
|
IFNULL( a.amount, 0 ) + IFNULL( a.clearAmount, 0 ) + IFNULL( a.revocationAmount, 0 ) AS totalAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
(
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 20 THEN 1 ELSE 0 END ) AS `times`,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 20 THEN atr.amount ELSE 0 END ) AS `amount`,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 50 THEN 1 ELSE 0 END ) AS revocationTimes,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 50 THEN - atr.amount ELSE 0 END ) AS revocationAmount,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 100 THEN 1 ELSE 0 END ) AS clearTimes,
|
|
|
|
|
|
SUM( CASE WHEN atr.trade_type = 100 THEN - atr.amount ELSE 0 END ) AS clearAmount
|
|
|
|
|
|
FROM acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type IN ( 20, 50, 100 )
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
AND atr.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
AND atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="'2'.toString() == authPO.roleType.toString()">
|
|
|
|
|
|
and EXISTS (
|
|
|
|
|
|
SELECT null
|
|
|
|
|
|
FROM sys_role_dept it1
|
|
|
|
|
|
LEFT JOIN sys_role it2 ON it2.role_id = it1.role_id
|
|
|
|
|
|
LEFT JOIN sys_user_role it3 ON it1.role_id = it3.role_id
|
|
|
|
|
|
WHERE it2.del_flag = 0
|
|
|
|
|
|
AND it2.role_key = #{authPO.roleCode}
|
|
|
|
|
|
<!-- AND it1.half_select = 1 -->
|
|
|
|
|
|
AND it3.user_id = #{authPO.userId}
|
|
|
|
|
|
AND it1.dept_id = atr.org_id
|
|
|
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
) as a
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getCustTimeForAdvanceReceiveSub" resultType="int">
|
|
|
|
|
|
SELECT COUNT(id)
|
|
|
|
|
|
FROM acc_trade
|
|
|
|
|
|
WHERE sub_time_rule_id = #{timeId}
|
|
|
|
|
|
AND trade_type = #{tradeType}
|
|
|
|
|
|
AND cust_id = #{custId}
|
|
|
|
|
|
AND trade_time <![CDATA[ >= ]]> #{firstDateTime}
|
|
|
|
|
|
AND trade_time <![CDATA[ <= ]]> #{nowTime}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据交易记录id和批次号查询交易记录-->
|
|
|
|
|
|
<select id="listAccTrade" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTradeAndDetailVO">
|
|
|
|
|
|
SELECT *
|
|
|
|
|
|
FROM acc_trade
|
|
|
|
|
|
<where>
|
|
|
|
|
|
trade_type = #{tradeType}
|
|
|
|
|
|
<if test="tradeIdList != null and tradeIdList.size() != 0">
|
|
|
|
|
|
and id in
|
|
|
|
|
|
<foreach collection="tradeIdList" item="tradeId" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="batchNum != null">
|
|
|
|
|
|
and batch_num = #{batchNum}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY trade_time DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询补贴撤销记录-导出-->
|
|
|
|
|
|
<select id="listRepealAccSubTrade" resultType="com.bonus.canteen.core.account.v3.web.vo.AccSubRepealPageVO">
|
|
|
|
|
|
<include refid="query_sub_repeal_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询个人钱包充值撤销记录sql-->
|
|
|
|
|
|
<sql id="query_sub_repeal_detail_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name AS cust_name,
|
|
|
|
|
|
ci.phonenumber AS mobile,
|
2025-03-21 16:50:28 +08:00
|
|
|
|
co.dept_name AS org_full_name
|
2025-03-20 18:34:05 +08:00
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atwd.amount as repealAmount,
|
|
|
|
|
|
atwd.wallet_bal as repealAfterWalletBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="query_recharge_repeal_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc,atr.id desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 充值撤销,补贴撤销where条件-->
|
|
|
|
|
|
<sql id="query_recharge_repeal_detail_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.pay_state = 3
|
|
|
|
|
|
<if test="param.walletId != null">
|
|
|
|
|
|
and atwd.wallet_id = #{param.walletId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.tradeType != null">
|
|
|
|
|
|
and atr.trade_type = #{param.tradeType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询个人钱包充值撤销记录 - 合计金额-->
|
|
|
|
|
|
<select id="getTotalRepealAccSubTradePage" resultType="java.math.BigDecimal">
|
|
|
|
|
|
SELECT SUM(atwd.amount)
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="query_recharge_repeal_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-03-21 13:25:25 +08:00
|
|
|
|
<!-- 获取本月提前领取补贴人员-->
|
|
|
|
|
|
<select id="listCustIdForAdvanceReceiveSub" resultType="java.lang.Long">
|
|
|
|
|
|
SELECT cust_id
|
|
|
|
|
|
FROM acc_trade
|
|
|
|
|
|
WHERE sub_time_rule_id = #{timeId}
|
|
|
|
|
|
AND trade_type = #{tradeType}
|
|
|
|
|
|
AND trade_time <![CDATA[ >= ]]> #{firstDateTime}
|
|
|
|
|
|
AND trade_time <![CDATA[ <= ]]> #{nowTime}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-03-21 16:50:28 +08:00
|
|
|
|
<!-- 提现查询最近的10条充值记录-->
|
|
|
|
|
|
<select id="queryRechargeListByCustIdForWithdraw" resultType="com.bonus.canteen.core.account.v3.model.AccTrade">
|
|
|
|
|
|
SELECT *
|
|
|
|
|
|
FROM acc_trade t1
|
|
|
|
|
|
WHERE trade_type = #{tradeType}
|
|
|
|
|
|
AND cust_id = #{custId}
|
|
|
|
|
|
AND trade_state = 2
|
|
|
|
|
|
<if test="lastRechargeId != null">
|
|
|
|
|
|
AND id <![CDATA[ < ]]> #{lastRechargeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
AND EXISTS (
|
|
|
|
|
|
SELECT it11.trade_id
|
|
|
|
|
|
FROM acc_trade_wallet_detail it11
|
|
|
|
|
|
WHERE it11.wallet_id = 1
|
|
|
|
|
|
AND t1.id = it11.trade_id
|
|
|
|
|
|
AND it11.trade_type = #{tradeType}
|
|
|
|
|
|
)
|
|
|
|
|
|
ORDER BY trade_time DESC,id DESC LIMIT 10
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现明细 - 无分页-->
|
|
|
|
|
|
<select id="listAccWithdrawDetails" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawDetailPageVO">
|
|
|
|
|
|
<include refid="query_acc_withdraw_detail_base_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现明细sql-->
|
|
|
|
|
|
<sql id="query_acc_withdraw_detail_base_sql">
|
|
|
|
|
|
SELECT t1.id AS tradeId,
|
|
|
|
|
|
t1.trade_time,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name AS cust_name,
|
|
|
|
|
|
ci.phonenumber AS mobile,
|
|
|
|
|
|
t6.dept_name AS org_full_name
|
|
|
|
|
|
t4.psn_type_name,
|
|
|
|
|
|
t1.amount AS withdrawAmount,
|
|
|
|
|
|
t5.wallet_id AS withdrawWalletType,
|
|
|
|
|
|
t5.wallet_bal AS withdrawWalletBal,
|
|
|
|
|
|
t1.trade_type,
|
|
|
|
|
|
t1.pay_channel,
|
|
|
|
|
|
t1.pay_type,
|
|
|
|
|
|
t1.withdraw_source,
|
|
|
|
|
|
t1.crby,
|
|
|
|
|
|
t1.crtime,
|
|
|
|
|
|
t1.remark
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type t4 ON t4.psn_type = t1.psn_type
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail t5 ON t1.id = t5.trade_id
|
|
|
|
|
|
LEFT JOIN sys_dept t6 ON t6.dept_id = t1.org_id
|
|
|
|
|
|
<include refid="withdraw_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY t1.trade_time desc,t1.id desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现明细where条件-->
|
|
|
|
|
|
<sql id="withdraw_detail_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = 30
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and t1.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payChannel != null">
|
|
|
|
|
|
and t1.pay_channel = #{param.payChannel}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and t1.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.withdrawSource != null">
|
|
|
|
|
|
and t1.withdraw_source = #{param.withdrawSource}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and t1.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现明细汇总提现金额-->
|
|
|
|
|
|
<select id="getTotalWithdrawAmount" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawDetailPageVO">
|
|
|
|
|
|
SELECT SUM(t1.amount) AS withdrawAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
|
|
|
|
<include refid="withdraw_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现方式汇总 - 集合-->
|
|
|
|
|
|
<select id="queryTradeTypeAccWithdrawSumList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawTradeTypePageVO">
|
|
|
|
|
|
<include refid="query_trade_type_acc_withdraw_sum_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 提现汇总数据展示sql-->
|
|
|
|
|
|
<sql id="query_trade_type_acc_withdraw_sum_sql">
|
|
|
|
|
|
SELECT t1.withdraw_source,
|
|
|
|
|
|
t1.pay_channel,
|
|
|
|
|
|
COUNT(t1.amount) payChannelNum,
|
|
|
|
|
|
SUM(t1.amount) payChannelAmount
|
|
|
|
|
|
FROM acc_trade t1
|
|
|
|
|
|
<include refid="query_trade_type_acc_withdraw_sum_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
GROUP BY t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
ORDER BY t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 提现汇总数据where/sql-->
|
|
|
|
|
|
<sql id="query_trade_type_acc_withdraw_sum_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = #{param.tradeType}
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payChannel != null">
|
|
|
|
|
|
and t1.pay_channel = #{param.payChannel}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.withdrawSource != null">
|
|
|
|
|
|
and t1.withdraw_source = #{param.withdrawSource}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询提现方式汇总 - 合计-->
|
|
|
|
|
|
<select id="queryTradeTypeAccWithdrawAmountSum"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawTradeTypePageVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
COUNT(t1.amount) payChannelNum,
|
|
|
|
|
|
SUM(t1.amount) payChannelAmount
|
|
|
|
|
|
FROM acc_trade t1
|
|
|
|
|
|
<include refid="query_trade_type_acc_withdraw_sum_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询人员类别提现汇总/组织提现汇总list-->
|
|
|
|
|
|
<select id="queryAccWithdrawListSum" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawPageVO">
|
|
|
|
|
|
<include refid="query_acc_withdraw_page_sum_base_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询人员类别提现汇总/组织提现汇总sql-->
|
|
|
|
|
|
<sql id="query_acc_withdraw_page_sum_base_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
<if test="param.type == 2">
|
|
|
|
|
|
IFNULL( min( t4.psn_type_name ), '未分类人员' ) AS psn_type_name,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.type == 3">
|
|
|
|
|
|
min(t3.dept_name) AS org_full_name,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
t1.withdraw_source,
|
|
|
|
|
|
t1.pay_channel,
|
|
|
|
|
|
COUNT(t1.amount) AS `count`,
|
|
|
|
|
|
SUM(t1.amount) AS amount
|
|
|
|
|
|
FROM acc_trade t1
|
|
|
|
|
|
LEFT JOIN sys_dept t3 ON t1.org_id = t3.dept_id
|
|
|
|
|
|
<if test="param.type == 2">
|
|
|
|
|
|
LEFT JOIN cust_psn_type t4 ON t4.psn_type = t1.psn_type
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<include refid="query_acc_withdraw_page_sum_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
<if test="param.type == 2">
|
|
|
|
|
|
GROUP BY t1.psn_type, t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
ORDER BY t1.psn_type, t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.type == 3">
|
|
|
|
|
|
GROUP BY t1.org_id, t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
ORDER BY t1.org_id, t1.withdraw_source, t1.pay_channel
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询人员类别提现汇总/组织提现汇总 where-->
|
|
|
|
|
|
<sql id="query_acc_withdraw_page_sum_where_sql">
|
|
|
|
|
|
WHERE t1.trade_type = #{param.tradeType}
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
AND t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
AND t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payChannel != null">
|
|
|
|
|
|
AND t1.pay_channel = #{param.payChannel}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.withdrawSource != null">
|
|
|
|
|
|
AND t1.withdraw_source = #{param.withdrawSource}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
AND t1.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
AND t1.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询人员类别提现汇总/组织提现汇总金额-->
|
|
|
|
|
|
<select id="queryAccWithdrawSumTotalAmount" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithdrawPageVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
COUNT(t1.amount) `count`,
|
|
|
|
|
|
SUM(t1.amount) amount
|
|
|
|
|
|
FROM acc_trade t1
|
|
|
|
|
|
<if test="param.type == 2">
|
|
|
|
|
|
LEFT JOIN cust_psn_type t4 ON t4.psn_type = t1.psn_type
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<include refid="query_acc_withdraw_page_sum_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 钱包转账记录-->
|
|
|
|
|
|
<select id="queryAccTransferList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTransferPageVO">
|
|
|
|
|
|
<include refid="acc_transfer_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 转账记录查询sql -->
|
|
|
|
|
|
<sql id="acc_transfer_detail_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name AS cust_name,
|
|
|
|
|
|
ci.phonenumber AS mobile,
|
|
|
|
|
|
co.dept_name AS org_full_name,
|
|
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.trade_type,
|
|
|
|
|
|
atwd.wallet_id,
|
|
|
|
|
|
atr.amount,
|
|
|
|
|
|
atwd.wallet_bal as walletBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="acc_transer_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 转账记录查询条件sql -->
|
|
|
|
|
|
<sql id="acc_transer_page_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.tradeType != null">
|
|
|
|
|
|
and atr.trade_type = #{param.tradeType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.tradeTypeList != null and param.tradeTypeList.size() > 0">
|
|
|
|
|
|
and atr.trade_type in
|
|
|
|
|
|
<foreach collection="param.tradeTypeList" item="tradeType" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
AND atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 钱包转账记录- 合计金额-->
|
|
|
|
|
|
<select id="getTotalAccTransferPage" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTransferPageVO">
|
|
|
|
|
|
SELECT sum(atr.amount) amount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="acc_transer_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询钱包冻结明细-->
|
|
|
|
|
|
<select id="queryAccFrozenPageList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccFrozenPageVO">
|
|
|
|
|
|
<include refid="query_acc_frozen_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询冻结,解冻明细sql-->
|
|
|
|
|
|
<sql id="query_acc_frozen_detail_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name AS cust_name,
|
|
|
|
|
|
ci.phonenumber AS mobile,
|
|
|
|
|
|
co.dept_name AS org_full_name,
|
|
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atwd.wallet_id,
|
|
|
|
|
|
atr.amount as frozenAmount,
|
|
|
|
|
|
atwd.wallet_bal as walletBal,
|
|
|
|
|
|
atwd.frozen_balance as walletFrozenBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON atr.org_id = co.dept_id
|
|
|
|
|
|
<include refid="query_acc_frozen_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 钱包冻结,解冻明细where条件-->
|
|
|
|
|
|
<sql id="query_acc_frozen_page_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.tradeType != null">
|
|
|
|
|
|
and atr.trade_type = #{param.tradeType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询钱包冻结解冻记录 - 合计金额-->
|
|
|
|
|
|
<select id="getTotalAccFrozenPage" resultType="java.math.BigDecimal">
|
|
|
|
|
|
SELECT sum(atr.amount)
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="query_acc_frozen_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询钱包解冻明细-->
|
|
|
|
|
|
<select id="queryAccUnFrozenPageList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccUnFrozenPageVO">
|
|
|
|
|
|
<include refid="query_acc_frozen_detail_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询红包发放记录-->
|
|
|
|
|
|
<select id="queryAccRedRechargeList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedRechargePageVO">
|
|
|
|
|
|
<include refid="query_acc_red_recharge_banse_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询红包发放记录-->
|
|
|
|
|
|
<sql id="query_acc_red_recharge_banse_sql">
|
|
|
|
|
|
SELECT atr.trade_time,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
|
|
|
|
|
co.dept_name as org_full_name,
|
|
|
|
|
|
atr.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.amount as rechargeAmount,
|
|
|
|
|
|
atwd.wallet_bal as rechargeAfterWalletBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.id as tradeId,
|
|
|
|
|
|
atr.remark
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN acc_trade_wallet_detail atwd ON atr.id = atwd.trade_id
|
|
|
|
|
|
<include refid="acc_recharge_red_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc,atr.id desc
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包充值where条件-->
|
|
|
|
|
|
<sql id="acc_recharge_red_page_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type = 140 and atr.pay_state = 3
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.batchNum != null and param.batchNum != ''">
|
|
|
|
|
|
and atr.batch_num = #{param.batchNum}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询红包发放记录 - 合计金额-->
|
|
|
|
|
|
<select id="getTotalAccRedRechargePage" resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedRechargePageVO">
|
|
|
|
|
|
SELECT sum(atr.amount) rechargeAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="acc_recharge_red_page_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放人员类别汇总 - 导出-->
|
|
|
|
|
|
<select id="listAccRedRechargeCollectPageForCustPsn"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedCollectVO">
|
|
|
|
|
|
<include refid="query_acc_red_recharge_collect_Psn_sql"></include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放人员类别汇总sql-->
|
|
|
|
|
|
<sql id="query_acc_red_recharge_collect_Psn_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
cpt.psn_type,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
IFNULL( t3.rechargeCount, 0 ) AS rechargeCount,
|
|
|
|
|
|
IFNULL( t3.rechargeAmount, 0 ) AS rechargeAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
(SELECT psn_type_name, psn_type FROM cust_psn_type UNION ALL SELECT '—' AS psn_type_name, - 1 AS psn_type) cpt
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
(
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( t1.psn_type, - 1 ) AS psn_type,
|
|
|
|
|
|
count(*) AS rechargeCount,
|
|
|
|
|
|
SUM( t1.amount ) AS rechargeAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = 140
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.psn_type
|
|
|
|
|
|
) t3 ON t3.psn_type = cpt.psn_type
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
and cpt.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL, rechargeAmount DESC, cpt.psn_type
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放用户组织汇总 导出-->
|
|
|
|
|
|
<select id="listAccRedRechargeCollectPageForCustOrg"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedCollectVO">
|
|
|
|
|
|
<include refid="query_acc_red_recharge_collect_org_sql"></include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放用户组织汇总sql-->
|
|
|
|
|
|
<sql id="query_acc_red_recharge_collect_org_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
g.dept_id as org_id,
|
|
|
|
|
|
<!-- g.org_num, -->
|
|
|
|
|
|
g.dept_name as org_full_name,
|
|
|
|
|
|
IFNULL( t3.rechargeCount, 0 ) AS rechargeCount,
|
|
|
|
|
|
IFNULL( t3.rechargeAmount, 0 ) AS rechargeAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_dept g
|
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
IFNULL( t1.org_id, - 1 ) AS org_id,
|
|
|
|
|
|
count(*) AS rechargeCount,
|
|
|
|
|
|
SUM( t1.amount ) AS rechargeAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = 140
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.org_id
|
|
|
|
|
|
) t3 ON t3.org_id = g.dept_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
and g.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL,rechargeAmount DESC,g.ancestors
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放用户个人汇总 导出-->
|
|
|
|
|
|
<select id="listAccRedRechargeCollectPageForCust"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedCollectVO">
|
|
|
|
|
|
<include refid="query_acc_red_recharge_collect_cust_sql"></include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放用户个人汇总sql-->
|
|
|
|
|
|
<sql id="query_acc_red_recharge_collect_cust_sql">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
ci.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
|
|
|
|
|
co.dept_name AS custOrgFullName,
|
|
|
|
|
|
IFNULL( t3.rechargeCount, 0 ) AS rechargeCount,
|
|
|
|
|
|
IFNULL( t3.rechargeAmount, 0 ) AS rechargeAmount,
|
|
|
|
|
|
t3.change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_user ci
|
|
|
|
|
|
INNER JOIN acc_info ai on ci.cust_id = ai.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON ci.dept_id = co.dept_id
|
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
t1.cust_id,
|
|
|
|
|
|
count(*) AS rechargeCount,
|
|
|
|
|
|
SUM( t1.amount ) AS rechargeAmount,
|
|
|
|
|
|
1 AS change_flag
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
<where>
|
|
|
|
|
|
t1.trade_type = 140
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t1.cust_id
|
|
|
|
|
|
) t3 ON t3.cust_id = ci.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
and ci.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY change_flag IS NULL,rechargeAmount DESC,ci.cust_id
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放汇总-合计-用户-->
|
|
|
|
|
|
<select id="queryAccRedRechargeCollectPageSumForCust" resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedCollectVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
count(*) AS rechargeCount,
|
|
|
|
|
|
SUM( atr.amount ) AS rechargeAmount
|
|
|
|
|
|
FROM sys_user ci
|
|
|
|
|
|
LEFT JOIN acc_trade atr ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type = 140
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
AND ci.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
AND ci.dept_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 红包发放汇总-合计-->
|
|
|
|
|
|
<select id="queryAccRedRechargeCollectPageSum"
|
|
|
|
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccRedCollectVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
count(*) AS rechargeCount,
|
|
|
|
|
|
SUM( atr.amount ) AS rechargeAmount
|
|
|
|
|
|
FROM acc_trade atr
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
atr.trade_type = 140
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
AND atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() != 0">
|
|
|
|
|
|
AND atr.psn_type in
|
|
|
|
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
|
|
|
|
#{psnType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() != 0">
|
|
|
|
|
|
AND atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询充值明细汇总充值金额-->
|
|
|
|
|
|
<select id="getTotalRechargeAmount" resultType="com.bonus.canteen.core.account.v3.web.vo.AccRechargeDetailPageVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM(t1.amount) rechargeAmount,
|
|
|
|
|
|
SUM(t1.actual_Amount) actualAmount,
|
|
|
|
|
|
SUM(t1.manage_cost) manageCost
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
|
|
|
|
<include refid="recharge_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询充值明细where条件-->
|
|
|
|
|
|
<sql id="recharge_detail_where_sql">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="param.timeType != null and param.timeType == 1 ">
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.crtime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.crtime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
<if test="param.tradeType != null">
|
|
|
|
|
|
and t1.trade_type = #{param.tradeType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payChannel != null">
|
|
|
|
|
|
and t1.pay_channel = #{param.payChannel}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.batchNum != null and param.batchNum != ''">
|
|
|
|
|
|
and t1.batch_num = #{param.batchNum}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId!= null">
|
|
|
|
|
|
and t1.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and t1.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.tradeStateList != null and param.tradeStateList.size() > 0">
|
|
|
|
|
|
and t1.trade_state in
|
|
|
|
|
|
<foreach collection="param.tradeStateList" item="tradeState" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeState}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.payStateList != null and param.payStateList.size() > 0">
|
|
|
|
|
|
and t1.pay_state in
|
|
|
|
|
|
<foreach collection="param.payStateList" item="payState" separator="," open="(" close=")">
|
|
|
|
|
|
#{payState}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and t1.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and t1.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询充值明细 导出使用-->
|
|
|
|
|
|
<select id="listAccRechargeDetails" resultType="com.bonus.canteen.core.account.v3.web.vo.AccRechargeDetailPageVO">
|
|
|
|
|
|
<include refid="query_acc_recharge_details_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询充值明细sql-->
|
|
|
|
|
|
<sql id="query_acc_recharge_details_sql">
|
|
|
|
|
|
SELECT t1.id tradeId,
|
|
|
|
|
|
t1.crtime,
|
|
|
|
|
|
t1.trade_time,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
|
|
|
|
|
t6.dept_name as org_full_name,
|
|
|
|
|
|
t4.psn_type_name,
|
|
|
|
|
|
t1.trade_type,
|
|
|
|
|
|
t1.pay_channel,
|
|
|
|
|
|
t1.pay_type,
|
|
|
|
|
|
t1.manage_cost,
|
|
|
|
|
|
t1.amount rechargeAmount,
|
|
|
|
|
|
t1.actual_Amount actualAmount,
|
|
|
|
|
|
t1.crby,
|
|
|
|
|
|
t1.recharge_source,
|
|
|
|
|
|
t1.pay_state,
|
|
|
|
|
|
t1.trade_state,
|
|
|
|
|
|
t1.fail_reason,
|
|
|
|
|
|
t1.canteen_id,
|
|
|
|
|
|
t1.machine_type,
|
|
|
|
|
|
t1.machine_sn,
|
|
|
|
|
|
t7.device_name,
|
|
|
|
|
|
t1.batch_num,
|
|
|
|
|
|
t5.canteen_name canteenName,
|
|
|
|
|
|
t1.remark
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade t1
|
|
|
|
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type t4 ON t4.psn_type = t1.psn_type
|
|
|
|
|
|
LEFT JOIN alloc_canteen t5 ON t5.canteen_id = t1.canteen_id
|
|
|
|
|
|
LEFT JOIN sys_dept t6 ON t6.dept_id = t1.org_id
|
|
|
|
|
|
LEFT JOIN device_info t7 ON t7.device_sn = t1.machine_sn
|
|
|
|
|
|
<include refid="recharge_detail_where_sql">
|
|
|
|
|
|
</include>
|
|
|
|
|
|
<if test="param.timeType != null and param.timeType == 1">
|
|
|
|
|
|
ORDER BY t1.crtime desc,t1.id desc
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.timeType != null and param.timeType == 2">
|
|
|
|
|
|
ORDER BY t1.trade_time desc,t1.id desc
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 个人钱包-充值撤销明细v4-合计-->
|
|
|
|
|
|
<select id="getWalletRepealAccTradePageTotal" resultType="com.bonus.canteen.core.account.v4.vo.AccWalletRepealV4PageVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM(atr.amount) AS repealAmount
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
INNER JOIN acc_trade_wallet_detail t2 ON t2.trade_id = atr.id
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
<include refid="list_wallet_repeal_where"></include>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="list_wallet_repeal_where">
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="param.startDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.endDateTime != null">
|
|
|
|
|
|
and atr.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.tradeTypeList != null and param.tradeTypeList.size() > 0">
|
|
|
|
|
|
and atr.trade_type in
|
|
|
|
|
|
<foreach collection="param.tradeTypeList" item="tradeType" separator="," open="(" close=")">
|
|
|
|
|
|
#{tradeType}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.crBy != null and param.crBy != ''">
|
|
|
|
|
|
and atr.crby like #{param.crBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
|
|
|
|
and atr.org_id in
|
|
|
|
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
|
|
|
|
#{orgId}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.custId != null">
|
|
|
|
|
|
and atr.cust_id = #{param.custId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.accTradeId != null and param.accTradeId != ''">
|
|
|
|
|
|
and atr.id = #{param.accTradeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.originalRechargeId != null and param.originalRechargeId != ''">
|
|
|
|
|
|
and atr.origin_trade_id = #{param.originalRechargeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.repealSourceList != null and param.repealSourceList.size() > 0">
|
|
|
|
|
|
and atr.recharge_source in
|
|
|
|
|
|
<foreach collection="param.repealSourceList" item="repealSource" separator="," open="(" close=")">
|
|
|
|
|
|
#{repealSource}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
|
|
|
|
<include refid="cust_fuzzy_query"></include>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 个人钱包-充值撤销明细v4-->
|
|
|
|
|
|
<select id="listWalletRepealAccTradeV4" resultType="com.bonus.canteen.core.account.v4.vo.AccWalletRepealV4PageVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
atr.trade_time,
|
|
|
|
|
|
atr.id AS tradeId,
|
|
|
|
|
|
atr.cust_id,
|
|
|
|
|
|
ci.cust_num,
|
|
|
|
|
|
ci.nick_name as cust_name,
|
|
|
|
|
|
ci.phonenumber as mobile,
|
|
|
|
|
|
co.dept_name as org_full_name,
|
|
|
|
|
|
cpt.psn_type_name,
|
|
|
|
|
|
atr.trade_type,
|
|
|
|
|
|
atr.amount AS repealAmount,
|
|
|
|
|
|
t2.wallet_id AS repealWalletType,
|
|
|
|
|
|
t2.wallet_bal AS repealAfterWalletBal,
|
|
|
|
|
|
atr.crby,
|
|
|
|
|
|
atr.recharge_source AS revokeSource,
|
|
|
|
|
|
atr.origin_trade_id
|
|
|
|
|
|
FROM
|
|
|
|
|
|
acc_trade atr
|
|
|
|
|
|
INNER JOIN acc_trade_wallet_detail t2 ON t2.trade_id = atr.id
|
|
|
|
|
|
LEFT JOIN sys_user ci ON ci.cust_id = atr.cust_id
|
|
|
|
|
|
LEFT JOIN sys_dept co ON co.dept_id = atr.org_id
|
|
|
|
|
|
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = atr.psn_type
|
|
|
|
|
|
<include refid="list_wallet_repeal_where"></include>
|
|
|
|
|
|
ORDER BY atr.trade_time desc,atr.id desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-02-27 13:36:55 +08:00
|
|
|
|
</mapper>
|