微信支付回调 回扫去掉退款和退款中状态的修改,报表统计修改
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
select r.*
|
||||
,ROUND(fee-alreadyTanxiao-currentTanxiao,2) surplusTanxiao
|
||||
from (select e.*
|
||||
,ROUND(if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)),2) currentTanxiao
|
||||
,ROUND(if(CHAR_LENGTH(IFNULL(endTime,'')) < 10, if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)), if(DATEDIFF(#{date}, LEFT(endTime,10)) >= 0, 0, if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)))),2) currentTanxiao
|
||||
from (select w.name,w.tel,w.ctitle,w.cctitle,if(w.startTime is null,'',w.startTime) startTime,if(w.endTime is null,'',w.endTime) endTime,w.totalDays
|
||||
,w.type,w.payType,w.payTime,w.orderSn,w.zfbOrder,w.days,w.fee,w.remark,w.dayAmount,w.alreadyDay,w.currentDay
|
||||
,IF(beginDay=0,startTime,IF(startTime is NULL,startTime,DATE_ADD(startTime,INTERVAL beginDay-1 day))) startTanxiaoTime
|
||||
,ROUND(if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)),2) alreadyTanxiao
|
||||
,ROUND(if(CHAR_LENGTH(IFNULL(endTime,'')) < 10, if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)), if(DATEDIFF(#{date}, LEFT(endTime,10)) >= 0, fee, if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)))),2) alreadyTanxiao
|
||||
from (
|
||||
select q.*,alreadyDay*dayAmount alreadyDayAmount
|
||||
,IF(days-alreadyDay=0,0,IF(beginDay=0,IF(startTime is NULL,0,IF(days-alreadyDay>=monthDays,if(DATE_FORMAT(startTime,'%Y-%m')=SUBSTR(#{date},1,7),DATEDIFF(#{date},startTime)+1,if(DATE_FORMAT(startTime,'%Y-%m')>SUBSTR(#{date},1,7),0,monthDays)),if(DATE_FORMAT(startTime, '%Y-%m')=SUBSTR(#{date},1,7),if(DATEDIFF(#{date},startTime)+1>days,days,DATEDIFF(#{date},startTime)+1),if(DATE_FORMAT(startTime, '%Y-%m') < SUBSTR(#{date},1,7),days-alreadyDay,0)))), if(alreadyTotalDay+monthDays>beginDay,if(alreadyDay>0,if(days-alreadyDay>monthDays,monthDays,monthDays-(days-alreadyDay)),monthDays-(totalDays-days-alreadyTotalDay)),0) )) currentDay
|
||||
@@ -41,12 +41,28 @@
|
||||
</select>
|
||||
|
||||
<select id="getIncome" resultType="map">
|
||||
select ucbl.pay_type,SUM(ucbl.fee) fee
|
||||
from user_course_buy_log ucbl
|
||||
left join buy_order bo on bo.order_sn = ucbl.order_sn
|
||||
where DATE_FORMAT(ucbl.pay_time,'%Y-%m') = SUBSTR(#{date},1,7) and ucbl.del_flag = 0
|
||||
and (ucbl.user_id not in (select id from user where tester_flag = 1) or ( ucbl.user_id in (select id from user where tester_flag = 1) and ucbl.pay_type in ('微信','支付宝') and ucbl.create_time>='2026-05-06 00:00:00'))
|
||||
GROUP BY ucbl.pay_type
|
||||
select pay_type, SUM(fee) fee
|
||||
from (
|
||||
select ucbl.pay_type, ucbl.fee
|
||||
from user_course_buy_log ucbl
|
||||
left join buy_order bo on bo.order_sn = ucbl.order_sn
|
||||
where DATE_FORMAT(ucbl.pay_time,'%Y-%m') = SUBSTR(#{date},1,7) and ucbl.del_flag = 0
|
||||
and (ucbl.user_id not in (select id from user where tester_flag = 1) or ( ucbl.user_id in (select id from user where tester_flag = 1) and ucbl.pay_type in ('微信','支付宝') and ucbl.create_time>='2026-05-06 00:00:00'))
|
||||
union all
|
||||
select IF(bo.payment_method='1','微信',IF(bo.payment_method='2','支付宝',IF(bo.payment_method='4','天医币','其他'))) pay_type,
|
||||
bo.real_money fee
|
||||
from buy_order bo
|
||||
where bo.order_type = 'relearn' and bo.del_flag = 0
|
||||
and bo.order_status not in ('5','6')
|
||||
and DATE_FORMAT(IF(bo.success_time is null,bo.create_time,bo.success_time),'%Y-%m') = SUBSTR(#{date},1,7)
|
||||
and not exists (
|
||||
select 1 from user_course_buy_log ucbl
|
||||
where ucbl.order_sn = bo.order_sn and ucbl.del_flag = 0
|
||||
)
|
||||
and (bo.user_id not in (select id from user where tester_flag = 1)
|
||||
or (bo.user_id in (select id from user where tester_flag = 1) and bo.payment_method in ('1','2') and bo.create_time>='2026-05-06 00:00:00'))
|
||||
) t
|
||||
GROUP BY pay_type
|
||||
</select>
|
||||
<select id="getRefund" resultType="map">
|
||||
select pay_type,SUM(fee) fee
|
||||
@@ -59,11 +75,11 @@
|
||||
and DATE_FORMAT(bor.create_time,'%Y-%m') = SUBSTR(#{date},1,7)
|
||||
and (bo.user_id not in (select id from user where tester_flag = 1)
|
||||
or (bo.user_id in (select id from user where tester_flag = 1) and bo.payment_method in ('1','2') and bo.create_time>='2026-05-06 00:00:00'))
|
||||
and exists (
|
||||
and (bo.order_type = 'relearn' or exists (
|
||||
select 1 from buy_order_product bop
|
||||
inner join shop_product sp on sp.product_id = bop.product_id
|
||||
where bop.order_id = bo.order_id and sp.goods_type = '05'
|
||||
)
|
||||
))
|
||||
) t
|
||||
GROUP BY pay_type
|
||||
</select>
|
||||
@@ -79,11 +95,11 @@
|
||||
and DATE_FORMAT(IF(bo.success_time is null,bo.create_time,bo.success_time),'%Y-%m') = SUBSTR(#{date},1,7)
|
||||
and (bo.user_id not in (select id from user where tester_flag = 1)
|
||||
or (bo.user_id in (select id from user where tester_flag = 1) and bo.payment_method in ('1','2') and bo.create_time>='2026-05-06 00:00:00'))
|
||||
and exists (
|
||||
and (bo.order_type = 'relearn' or exists (
|
||||
select 1 from buy_order_product bop
|
||||
inner join shop_product sp on sp.product_id = bop.product_id
|
||||
where bop.order_id = bo.order_id and sp.goods_type = '05'
|
||||
)
|
||||
))
|
||||
) t
|
||||
GROUP BY pay_type
|
||||
</select>
|
||||
@@ -159,11 +175,11 @@
|
||||
select r.*
|
||||
,ROUND(fee-alreadyTanxiao-currentTanxiao,2) surplusTanxiao
|
||||
from (select e.*
|
||||
,ROUND(if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)),2) currentTanxiao
|
||||
,ROUND(if(CHAR_LENGTH(IFNULL(endTime,'')) < 10, if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)), if(DATEDIFF(#{date}, LEFT(endTime,10)) >= 0, 0, if(alreadyDay+currentDay>=days,fee-alreadyTanxiao,if(alreadyTanxiao+currentDay*dayAmount>fee,fee-alreadyTanxiao,currentDay*dayAmount)))),2) currentTanxiao
|
||||
from (select w.name,w.tel,w.ctitle,w.cctitle,if(w.startTime is null,'',w.startTime) startTime,if(w.endTime is null,'',w.endTime) endTime,w.totalDays
|
||||
,w.type,w.payType,w.payTime,w.orderSn,w.zfbOrder,w.days,w.fee,w.remark,w.dayAmount,w.alreadyDay,w.currentDay
|
||||
,IF(beginDay=0,startTime,IF(startTime is NULL,startTime,DATE_ADD(startTime,INTERVAL beginDay-1 day))) startTanxiaoTime
|
||||
,ROUND(if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)),2) alreadyTanxiao
|
||||
,ROUND(if(CHAR_LENGTH(IFNULL(endTime,'')) < 10, if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)), if(DATEDIFF(#{date}, LEFT(endTime,10)) >= 0, fee, if(alreadyDay=days,fee,if(alreadyDayAmount>fee,fee,alreadyDayAmount)))),2) alreadyTanxiao
|
||||
from (
|
||||
select q.*,alreadyDay*dayAmount alreadyDayAmount
|
||||
,IF(days-alreadyDay=0,0,IF(beginDay=0,IF(startTime is NULL,0,IF(days-alreadyDay>=monthDays,if(DATE_FORMAT(startTime,'%Y-%m')=SUBSTR(#{date},1,7),DATEDIFF(#{date},startTime)+1,if(DATE_FORMAT(startTime,'%Y-%m')>SUBSTR(#{date},1,7),0,monthDays)),if(DATE_FORMAT(startTime, '%Y-%m')=SUBSTR(#{date},1,7),if(DATEDIFF(#{date},startTime)+1>days,days,DATEDIFF(#{date},startTime)+1),if(DATE_FORMAT(startTime, '%Y-%m') < SUBSTR(#{date},1,7),days-alreadyDay,0)))), if(alreadyTotalDay+monthDays>beginDay,if(alreadyDay>0,if(days-alreadyDay>monthDays,monthDays,monthDays-(days-alreadyDay)),monthDays-(totalDays-days-alreadyTotalDay)),0) )) currentDay
|
||||
|
||||
Reference in New Issue
Block a user