报表功能查看

This commit is contained in:
lizhenhua 2025-09-29 16:31:56 +08:00
parent 6d9b376040
commit af1e58dc52
3 changed files with 36 additions and 27 deletions

View File

@ -14,6 +14,5 @@ import java.util.Map;
@Mapper
public interface PlaceMapper {
List<ReportOrderInfoVo> placeexportExcel(ReportOrderInfoVo orgConsume);
}

View File

@ -178,6 +178,7 @@ public class reportformsServiceImpl implements reportformsService {
totalRow.setCustNum("合计");
totalRow.setTradeNum(totalVo.getTradeNum());
totalRow.setPayableAmount(totalVo.getPayableAmount());
totalRow.setRealAmount(totalRow.getRealAmount());
// 其它字段按需填充空或默认值
reportOrderInfoVos.add(totalRow);
}

View File

@ -4,15 +4,15 @@
<select id="placeexportExcel" 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(real_amount) AS payable_amount,
SUM(real_amount) AS real_amount,
area_name,
work_area_name
FROM (
@ -34,27 +34,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 >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
AND a.pay_time &lt;= #{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 >= #{startTime}
AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{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 >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
AND a.pay_time &lt;= #{endTime} and a.remark like '%支付'
WHERE a.pay_time >= #{startTime}
AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{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
@ -70,16 +80,15 @@
#{id}
</foreach>
</if>
<!-- 判断工作地 -->
<if test="gzselectedOrg != null and gzselectedOrg.length > 0">
<if test="gzselectedOrg != null and gzselectedOrg.length > 0">
AND p.dining_place_id IN
<foreach collection="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
</select>
</mapper>