报表功能查看

This commit is contained in:
lizhenhua 2025-09-29 18:04:03 +08:00
parent af1e58dc52
commit 27b5367b09
1 changed files with 37 additions and 27 deletions

View File

@ -830,11 +830,11 @@
<select id="selectOrderMismatchList" <select id="selectOrderMismatchList"
resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo"> resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo">
SELECT SELECT
cust_num, ANY_VALUE(cust_num) AS cust_num,
cust_name, ANY_VALUE(cust_name) AS cust_name,
mobile, ANY_VALUE(mobile) AS mobile,
org_name, ANY_VALUE(org_name) AS org_name,
org_full_name, ANY_VALUE(org_full_name) AS org_full_name,
COUNT(1) AS tradeNum, COUNT(1) AS tradeNum,
order_type, order_type,
SUM(payable_amount) AS payable_amount, SUM(payable_amount) AS payable_amount,
@ -860,27 +860,37 @@
ap.area_name AS work_area_name, ap.area_name AS work_area_name,
a.mch_sn a.mch_sn
FROM ( FROM (
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, SELECT a.flow_id AS order_id, a.cust_id, a.flow_amount AS payable_amount,
case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id a.flow_real_amount AS real_amount, a.pay_time,
else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id CASE
,a.mch_sn as mch_sn WHEN bd.canteen_id IS NOT NULL THEN bd.canteen_id
from report_account_flow a 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_info di ON a.mch_sn = di.device_sn
LEFT JOIN device_bind bd ON di.device_id = bd.device_id 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) LEFT JOIN report_order_info roi
where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 ) ON CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
AND a.pay_time &lt;= #{vo.endTime} and (a.remark not like '%支付' or a.remark is null) WHERE a.pay_time >= #{vo.startTime}
AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{vo.endTime}
AND (a.remark NOT LIKE '%支付' OR a.remark IS NULL)
UNION ALL 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 SELECT a.flow_id AS order_id, a.cust_id, a.flow_amount AS payable_amount,
,CONCAT(a.cust_id,a.ord_time) as id a.flow_real_amount AS real_amount, a.pay_time, bd.canteen_id,
,a.mch_sn as mch_sn CONCAT(a.cust_id,a.ord_time) AS id,
from report_account_flow a 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_info di ON a.mch_sn = di.device_sn
LEFT JOIN device_bind bd ON di.device_id = bd.device_id LEFT JOIN device_bind bd ON di.device_id = bd.device_id
where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 ) WHERE a.pay_time >= #{vo.startTime}
AND a.pay_time &lt;= #{vo.endTime} and a.remark like '%支付' AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{vo.endTime}
AND a.remark LIKE '%支付'
) a ) a
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_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_info ci ON ci.cust_id = a.cust_id
@ -896,7 +906,6 @@
#{id} #{id}
</foreach> </foreach>
</if> </if>
<!-- 判断工作地 --> <!-- 判断工作地 -->
<if test="vo.gzselectedOrg != null and vo.gzselectedOrg.length > 0"> <if test="vo.gzselectedOrg != null and vo.gzselectedOrg.length > 0">
AND p.dining_place_id IN AND p.dining_place_id IN
@ -906,9 +915,10 @@
</if> </if>
) a ) a
GROUP BY cust_id, area_name, work_area_name, order_type GROUP BY cust_id, area_name, work_area_name, order_type
ORDER BY a.pay_time DESC ORDER BY MAX(a.pay_time) DESC
LIMIT #{offset}, #{pageSize} LIMIT #{offset}, #{pageSize}
</select> </select>
<!-- 查询总数 --> <!-- 查询总数 -->
<select id="selectOrderMismatchListCount" resultType="int"> <select id="selectOrderMismatchListCount" resultType="int">
SELECT COUNT(1) FROM ( SELECT COUNT(1) FROM (
@ -966,7 +976,7 @@
resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo"> resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo">
SELECT SELECT
SUM(tradeNum) AS tradeNum, SUM(tradeNum) AS tradeNum,
SUM(payable_amount) AS payableAmount, SUM(real_amount) AS payableAmount,
SUM(real_amount) AS realAmount SUM(real_amount) AS realAmount
FROM ( FROM (
SELECT SELECT