From 6d9b376040063456df56642c2e9df6fbb47c8b97 Mon Sep 17 00:00:00 2001 From: jiask <1069621233@qq.com> Date: Sat, 27 Sep 2025 19:35:47 +0800 Subject: [PATCH] =?UTF-8?q?jsk=20=20=E9=87=8D=E4=BF=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A1=A8=20=20=E5=B0=86report=5Forder=5Finfo?= =?UTF-8?q?=20=E6=94=B9=E4=B8=BA=20=20report=5Faccount=5Fflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/reportforms/OrgConsumerMapper.xml | 95 ++++++++++--------- .../mapper/reportforms/placeMapper.xml | 31 +++--- 2 files changed, 67 insertions(+), 59 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml index faa4f1c7..37be007d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml @@ -860,27 +860,28 @@ ap.area_name AS work_area_name, a.mch_sn FROM ( - SELECT - a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn - FROM report_order_info a - WHERE a.order_refund_state='1' and a.pay_time >= #{vo.startTime} AND a.pay_time <= #{vo.endTime} + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time, + case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id + else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a + LEFT JOIN device_info di ON a.mch_sn = di.device_sn + LEFT JOIN device_bind bd ON di.device_id = bd.device_id + LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time) + where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{vo.endTime} and (a.remark not like '%支付' or a.remark is null) UNION ALL - SELECT - a.flow_id AS order_id, - a.cust_id, - a.flow_amount AS payable_amount, - replace(a.flow_real_amount,'-','') AS real_amount, - a.pay_time, - bd.canteen_id, - a.mch_sn - FROM report_account_flow a + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id + ,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a LEFT JOIN device_info di ON a.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id - WHERE a.pay_time >= #{vo.startTime} AND a.pay_time <= #{vo.endTime} AND a.remark LIKE '%支付' + where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{vo.endTime} and a.remark like '%支付' ) a - LEFT JOIN report_order_info_snapshot ros ON ros.order_id = a.order_id LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id LEFT JOIN cust_org co ON co.org_id = ci.org_id @@ -917,25 +918,27 @@ ac.canteen_type, p.dining_place_id FROM ( - SELECT - a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn - FROM report_order_info a - WHERE a.order_refund_state='1' and a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time, + case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id + else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a + LEFT JOIN device_info di ON a.mch_sn = di.device_sn + LEFT JOIN device_bind bd ON di.device_id = bd.device_id + LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time) + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null) UNION ALL - SELECT - a.flow_id AS order_id, - a.cust_id, - a.flow_amount AS payable_amount, - a.flow_real_amount AS real_amount, - a.pay_time, - bd.canteen_id, - a.mch_sn - FROM report_account_flow a + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id + ,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a LEFT JOIN device_info di ON a.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id - WHERE a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} AND a.remark LIKE '%支付' + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and a.remark like '%支付' ) a LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id JOIN cust_info ci ON ci.cust_id = a.cust_id @@ -980,23 +983,27 @@ a.canteen_id, a.mch_sn FROM ( - SELECT - order_id, cust_id, payable_amount, real_amount, pay_time, canteen_id, NULL AS mch_sn - FROM report_order_info - WHERE order_refund_state='1' and pay_time >= #{startTime} AND pay_time <= #{endTime} - UNION ALL - SELECT - flow_id AS order_id, - cust_id, - flow_amount AS payable_amount, - replace(flow_real_amount,'-','') AS real_amount, - pay_time, - bd.canteen_id, - mch_sn - FROM report_account_flow a + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time, + case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id + else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a LEFT JOIN device_info di ON a.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id - WHERE pay_time >= #{startTime} AND pay_time <= #{endTime} AND remark LIKE '%支付' + LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time) + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null) + + UNION ALL + + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id + ,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a + LEFT JOIN device_info di ON a.mch_sn = di.device_sn + LEFT JOIN device_bind bd ON di.device_id = bd.device_id + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and a.remark like '%支付' ) a LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml index 8f328f93..cbb18f50 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml @@ -34,27 +34,28 @@ ap.area_name AS work_area_name, a.mch_sn FROM ( - SELECT - a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn - FROM report_order_info a - WHERE a.order_refund_state='1' and a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time, + case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id + else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a + LEFT JOIN device_info di ON a.mch_sn = di.device_sn + LEFT JOIN device_bind bd ON di.device_id = bd.device_id + LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time) + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null) UNION ALL - SELECT - a.flow_id AS order_id, - a.cust_id, - a.flow_amount AS payable_amount, - replace(a.flow_real_amount,'-','') AS real_amount, - a.pay_time, - bd.canteen_id, - a.mch_sn - FROM report_account_flow a + select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id + ,CONCAT(a.cust_id,a.ord_time) as id + ,a.mch_sn as mch_sn + from report_account_flow a LEFT JOIN device_info di ON a.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id - WHERE a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} AND a.remark LIKE '%支付' + where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) + AND a.pay_time <= #{endTime} and a.remark like '%支付' ) a - LEFT JOIN report_order_info_snapshot ros ON ros.order_id = a.order_id LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id LEFT JOIN cust_org co ON co.org_id = ci.org_id