报表相关 增加退款后,报表中需要体现
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
where
|
||||
( u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1) and (bo.payment_method='1' or bo.payment_method='2') and bo.create_time>='2026-05-06 00:00:00') )
|
||||
and bo.order_status in (1,2,3,4) and sp.goods_type != '05' and bo.real_money > 0
|
||||
and bo.order_status in (1,2,3,4,6) and sp.goods_type != '05' and bo.real_money > 0
|
||||
<if test="orderType != null and orderType!= ''">
|
||||
<if test="orderType == 'lsorder' ">
|
||||
and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >= 37867))
|
||||
@@ -90,7 +90,47 @@
|
||||
) s
|
||||
group by payType
|
||||
</select>
|
||||
|
||||
<select id="getRefund" resultType="map">
|
||||
select payType,count(1) count,SUM(price) totalPrice from (
|
||||
select q.*,pzo.trade_no zfbOrder
|
||||
from (
|
||||
select t.createTime,t.name,t.tel,t.orderSn,t.orderStatus,t.payType,t.refundFee,
|
||||
t.refundFee-(select IF(SUM(if(sp2.activity_price<sp2.price,sp2.activity_price,sp2.price)) is NULL,0,SUM(if(sp2.activity_price<sp2.price,sp2.activity_price,sp2.price))) from shop_product sp2 where sp2.goods_type = '05' and sp2.product_id in (GROUP_CONCAT(sp.product_id SEPARATOR ','))) price,
|
||||
GROUP_CONCAT(sp.product_name SEPARATOR ', ') productName,t.remark
|
||||
from (
|
||||
select bo.order_id,DATE_FORMAT(bor.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,bo.order_sn orderSn,
|
||||
IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝',IF(bo.payment_method=4,'天医币','0'))) payType,
|
||||
'已退款' orderStatus,bor.fee refundFee,if(bo.remark like '%退%',bo.remark,'') remark
|
||||
from buy_order_refund bor
|
||||
inner join buy_order bo on bo.order_id = bor.order_id and bo.del_flag = 0
|
||||
left join user u on u.id = bo.user_id
|
||||
left join buy_order_product bop on bop.order_id = bo.order_id
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
where
|
||||
( u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1) and (bo.payment_method='1' or bo.payment_method='2') and bo.create_time>='2026-05-06 00:00:00') )
|
||||
and bo.order_status = '6' and sp.goods_type != '05' and bo.real_money > 0
|
||||
<if test="orderType != null and orderType!= ''">
|
||||
<if test="orderType == 'lsorder' ">
|
||||
and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >= 37867))
|
||||
and bo.order_type = 'lsorder'
|
||||
</if>
|
||||
<if test="orderType == 'order' ">
|
||||
and (bo.order_type = 'order'
|
||||
or (bo.order_type = 'lsorder' and bo.payment_method = '4')
|
||||
or (bo.order_type = 'lsorder' and bo.payment_method = '2' and bo.order_id < 37867))
|
||||
</if>
|
||||
</if>
|
||||
and DATE_FORMAT(bor.create_time,'%Y-%m') = SUBSTR(#{date},1,7)
|
||||
group by bo.order_sn
|
||||
) t
|
||||
left join buy_order_product bop on bop.order_id = t.order_id
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
group by t.orderSn
|
||||
) q
|
||||
left join pay_zfb_order pzo on pzo.relevanceOid = q.orderSn and pzo.trade_no is not null
|
||||
) s
|
||||
group by payType
|
||||
</select>
|
||||
<select id="exportPhysicalBuyOrderInfo" resultType="map">
|
||||
select q.*,pzo.trade_no zfbOrder
|
||||
from (
|
||||
@@ -110,7 +150,7 @@
|
||||
and bo.order_status in (1,2,3,4,6) and sp.goods_type != '05' and bo.real_money > 0
|
||||
<if test="orderType != null and orderType!= ''">
|
||||
<if test="orderType == 'lsorder' ">
|
||||
and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >37867))
|
||||
and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >= 37867))
|
||||
and bo.order_type = 'lsorder'
|
||||
</if>
|
||||
<if test="orderType == 'order' ">
|
||||
@@ -128,6 +168,44 @@
|
||||
) q
|
||||
left join pay_zfb_order pzo on pzo.relevanceOid = q.orderSn and pzo.trade_no is not null
|
||||
</select>
|
||||
<select id="exportPhysicalBuyOrderRefundInfo" resultType="map">
|
||||
select q.*,pzo.trade_no zfbOrder
|
||||
from (
|
||||
select t.createTime,t.name,t.tel,t.orderSn,t.orderStatus,t.payType,t.orderPrice,
|
||||
t.orderPrice-(select IF(SUM(if(sp2.activity_price<sp2.price,sp2.activity_price,sp2.price)) is NULL,0,SUM(if(sp2.activity_price<sp2.price,sp2.activity_price,sp2.price))) from shop_product sp2 where sp2.goods_type = '05' and sp2.product_id in (GROUP_CONCAT(sp.product_id SEPARATOR ','))) price,
|
||||
GROUP_CONCAT(sp.product_name SEPARATOR ', ') productName,IF(count(1)=1,bop.quantity,'') quantity,t.remark,t.refund_no
|
||||
from (
|
||||
select bo.order_id,DATE_FORMAT(bor.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,bo.order_sn orderSn,
|
||||
IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝',IF(bo.payment_method=4,'天医币','0'))) payType,
|
||||
'已退款' orderStatus,bor.fee orderPrice,if(bo.remark like '%退%',bo.remark,'') remark,IFNULL(bor.wx_refund_no,bor.refund_no) as refund_no
|
||||
from buy_order_refund bor
|
||||
inner join buy_order bo on bo.order_id = bor.order_id and bo.del_flag = 0
|
||||
left join user u on u.id = bo.user_id
|
||||
left join buy_order_product bop on bop.order_id = bo.order_id
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
where
|
||||
( u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1) and (bo.payment_method='1' or bo.payment_method='2') and bo.create_time>='2026-05-06 00:00:00') )
|
||||
and bo.order_status = '6' and sp.goods_type != '05' and bo.real_money > 0
|
||||
<if test="orderType != null and orderType!= ''">
|
||||
<if test="orderType == 'lsorder' ">
|
||||
and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >= 37867))
|
||||
and bo.order_type = 'lsorder'
|
||||
</if>
|
||||
<if test="orderType == 'order' ">
|
||||
and (bo.order_type = 'order'
|
||||
or (bo.order_type = 'lsorder' and bo.payment_method = '4')
|
||||
or (bo.order_type = 'lsorder' and bo.payment_method = '2' and bo.order_id < 37867))
|
||||
</if>
|
||||
</if>
|
||||
and DATE_FORMAT(bor.create_time,'%Y-%m') = SUBSTR(#{date},1,7)
|
||||
group by bo.order_sn
|
||||
) t
|
||||
left join buy_order_product bop on bop.order_id = t.order_id
|
||||
left join shop_product sp on sp.product_id = bop.product_id
|
||||
group by t.orderSn
|
||||
) q
|
||||
left join pay_zfb_order pzo on pzo.relevanceOid = q.orderSn and pzo.trade_no is not null
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryListByOrderIds" resultType="com.peanut.modules.common.entity.BuyOrder">
|
||||
|
||||
Reference in New Issue
Block a user