报表功能查看

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,15 +830,15 @@
<select id="selectOrderMismatchList"
resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo">
SELECT
cust_num,
cust_name,
mobile,
org_name,
org_full_name,
COUNT(1) AS tradeNum,
ANY_VALUE(cust_num) AS cust_num,
ANY_VALUE(cust_name) AS cust_name,
ANY_VALUE(mobile) AS mobile,
ANY_VALUE(org_name) AS org_name,
ANY_VALUE(org_full_name) AS org_full_name,
COUNT(1) AS tradeNum,
order_type,
SUM(payable_amount) AS payable_amount,
SUM(real_amount) AS real_amount,
SUM(payable_amount) AS payable_amount,
SUM(real_amount) AS real_amount,
area_name,
work_area_name
FROM (
@ -860,27 +860,37 @@
ap.area_name AS work_area_name,
a.mch_sn
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,
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
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 &lt;= #{vo.endTime} and (a.remark not like '%支付' or a.remark is null)
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 &lt;= #{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,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
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.flow_type IN ( 110, 120,130 )
AND a.pay_time &lt;= #{vo.endTime} and a.remark like '%支付'
WHERE a.pay_time >= #{vo.startTime}
AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{vo.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
@ -896,19 +906,19 @@
#{id}
</foreach>
</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
<foreach collection="vo.gzselectedOrg" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
) a
GROUP BY cust_id, area_name, work_area_name,order_type
ORDER BY a.pay_time DESC
GROUP BY cust_id, area_name, work_area_name, order_type
ORDER BY MAX(a.pay_time) DESC
LIMIT #{offset}, #{pageSize}
</select>
<!-- 查询总数 -->
<select id="selectOrderMismatchListCount" resultType="int">
SELECT COUNT(1) FROM (
@ -966,7 +976,7 @@
resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo">
SELECT
SUM(tradeNum) AS tradeNum,
SUM(payable_amount) AS payableAmount,
SUM(real_amount) AS payableAmount,
SUM(real_amount) AS realAmount
FROM (
SELECT