报表功能查看

This commit is contained in:
lizhenhua 2025-10-15 09:15:46 +08:00
parent 27b5367b09
commit 5962104d4b
3 changed files with 527 additions and 488 deletions

View File

@ -35,11 +35,11 @@ public class reportformsServiceImpl implements reportformsService {
.anyMatch(record -> "宏源工业园食堂".equals(record.get("orgName"))); .anyMatch(record -> "宏源工业园食堂".equals(record.get("orgName")));
// 如果没有找到食堂重新查询并赋值 // 如果没有找到食堂重新查询并赋值
if (!containsCanteen) { /* if (!containsCanteen) {
List<Map<String, Object>> newReserveRecords = mapper.selectReserveRecordsFromDatabase(orgConsume); List<Map<String, Object>> newReserveRecords = mapper.selectReserveRecordsFromDatabase(orgConsume);
// 插入新的记录到原有的数据列表 // 插入新的记录到原有的数据列表
reserveRecords.addAll(newReserveRecords); // 保证格式一致直接合并 reserveRecords.addAll(newReserveRecords); // 保证格式一致直接合并
} }*/
//针对特殊食堂退款的问题进行处理专门写一个方法 //针对特殊食堂退款的问题进行处理专门写一个方法
//查询区域关联的字段信息 //查询区域关联的字段信息

View File

@ -34,48 +34,51 @@
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, 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,
a.flow_real_amount AS real_amount, a.pay_time, case when bd.area_id is not null then bd.area_id when ac.area_id is not null then ac.area_id
CASE when cdp.dining_place_id is not null then cdp.dining_place_id
WHEN bd.canteen_id IS NOT NULL THEN bd.canteen_id else a.canteen_id end as area_id,CONCAT(a.cust_id,a.ord_time) as id
WHEN roi.canteen_id IS NOT NULL THEN roi.canteen_id ,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, else a.canteen_id end as canteen_id
CONCAT(a.cust_id,a.ord_time) AS id, ,a.mch_sn as mch_sn
a.mch_sn AS mch_sn from (select * from report_account_flow a where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120 )
FROM report_account_flow a AND a.pay_time &lt;= #{endTime} ) 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 LEFT JOIN (select * from report_order_info a where a.pay_time >= #{startTime}
ON CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time) AND a.pay_time &lt;= #{endTime} ) roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
WHERE a.pay_time >= #{startTime} LEFT JOIN alloc_canteen ac ON ac.canteen_id = roi.canteen_id
AND a.flow_type IN (110, 120, 130) left join cust_dining_place cdp on a.cust_id=cdp.cust_id and cdp.type = 'area'
AND a.pay_time &lt;= #{endTime} union
AND (a.remark NOT LIKE '%支付' OR a.remark IS NULL) 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.area_id is not null then bd.area_id when ac.area_id is not null then ac.area_id
UNION ALL when cdp.dining_place_id is not null then cdp.dining_place_id
else a.canteen_id end as area_id,CONCAT(a.cust_id,a.ord_time) as id
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, bd.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
a.mch_sn AS mch_sn from (select * from report_account_flow a where a.pay_time >= #{startTime} AND a.flow_type IN ( 130 )
FROM report_account_flow a AND a.pay_time &lt;= #{endTime} ) a
LEFT JOIN device_info di ON a.mch_sn = di.device_sn left join acc_trade atr on a.flow_id=atr.id
left join (select * from report_account_flow a where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120 )
AND a.pay_time &lt;= #{endTime} ) aa on atr.origin_trade_id=aa.flow_id
LEFT JOIN device_info di ON aa.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 >= #{startTime} LEFT JOIN (select * from report_order_info a where a.pay_time >= #{startTime}
AND a.flow_type IN (110, 120, 130) AND a.pay_time &lt;= #{endTime} ) roi on CONCAT(aa.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
AND a.pay_time &lt;= #{endTime} LEFT JOIN alloc_canteen ac ON ac.canteen_id = roi.canteen_id
AND a.remark LIKE '%支付' left join cust_dining_place cdp on aa.cust_id=cdp.cust_id and cdp.type = 'area'
) 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
LEFT JOIN cust_org co ON co.org_id = ci.org_id LEFT JOIN cust_org co ON co.org_id = ci.org_id
JOIN cust_dining_place p ON p.cust_id = ci.cust_id AND p.type = 'area' JOIN cust_dining_place p ON p.cust_id = ci.cust_id AND p.type = 'area'
LEFT JOIN alloc_area ar ON ar.area_id = ac.area_id LEFT JOIN alloc_area ar ON ar.area_id = a.area_id
LEFT JOIN alloc_area ap ON ap.area_id = p.dining_place_id LEFT JOIN alloc_area ap ON ap.area_id = p.dining_place_id
WHERE ac.area_id != p.dining_place_id WHERE ar.area_id != p.dining_place_id
<!-- 判断消费地 --> <!-- 判断消费地 -->
<if test="selectedOrg != null and selectedOrg.length > 0"> <if test="selectedOrg != null and selectedOrg.length > 0">
AND ac.area_id IN AND ar.area_id IN
<foreach collection="selectedOrg" item="id" open="(" separator="," close=")"> <foreach collection="selectedOrg" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>