From 833d0bda5727273b6c9af805a37b159a6d0d9430 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Tue, 3 Feb 2026 08:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=AF=BC=E4=BA=BA=E5=91=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/reportformsServiceImpl.java | 5 ++ .../mapper/reportforms/OrgConsumerMapper.xml | 48 +++++++++++++------ .../mapper/reportforms/placeMapper.xml | 3 ++ 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java index e73ed213..84832519 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java @@ -8,6 +8,7 @@ import com.bonus.canteen.core.reportforms.mapper.OrgConsumeMapper; import com.bonus.canteen.core.reportforms.mapper.PlaceMapper; import com.bonus.canteen.core.reportforms.service.reportformsService; import com.bonus.common.houqin.utils.SM4EncryptUtils; +import com.github.pagehelper.PageHelper; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -332,6 +333,10 @@ public class reportformsServiceImpl implements reportformsService { @Override public List placeexportExcel(ReportOrderInfoVo orgConsume) { checkCommonOrg(orgConsume); + // 导出前,清分页参数 + orgConsume.setPageNum(null); + orgConsume.setPageSize(null); + List reportOrderInfoVos = placemapper.placeexportExcel(orgConsume) .stream() .peek(c -> { 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 ae348564..02857fcb 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 @@ -536,16 +536,27 @@ f.ord_time, f.pay_time, f.cust_id, - atwd.wallet_id AS walletId, -- 加上别名 + wd.wallet_id AS walletId, f.remark FROM report_account_flow f - LEFT JOIN acc_trade_wallet_detail atwd ON atwd.trade_id = f.flow_id + LEFT JOIN ( + SELECT d.trade_id, MIN(d.wallet_id) AS wallet_id + FROM acc_trade_wallet_detail d + WHERE d.trade_id IN ( + SELECT flow_id + FROM report_account_flow + WHERE pay_time >= #{startPayTime} + AND pay_time < #{endPayTime} + AND flow_type = 110 + AND status = 1 + ) + GROUP BY d.trade_id + ) wd ON wd.trade_id = f.flow_id LEFT JOIN device_info di ON f.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id - WHERE - f.pay_time >= #{startPayTime} + WHERE f.pay_time >= #{startPayTime} AND f.pay_time < #{endPayTime} AND f.flow_type = 110 AND f.status = 1 @@ -554,43 +565,52 @@ UNION ALL + /* =============== 退款 =============== */ SELECT aa.canteen_name, aac.area_name, - f.flow_id AS flow_id, + f.flow_id, 130 AS flow_type, at.actual_amount AS amount, f.ord_time, at.trade_time AS pay_time, at.cust_id, - atwd_refund.wallet_id AS walletId, -- 加上别名 + wd.wallet_id AS walletId, CONCAT('退款-', f.remark) AS remark FROM acc_trade at INNER JOIN report_account_flow f ON at.origin_trade_id = f.flow_id AND f.flow_type = 110 - LEFT JOIN acc_trade_wallet_detail atwd_refund - ON atwd_refund.trade_id = at.id + LEFT JOIN ( + SELECT d.trade_id, MIN(d.wallet_id) AS wallet_id + FROM acc_trade_wallet_detail d + WHERE d.trade_id IN ( + SELECT id + FROM acc_trade + WHERE trade_time >= #{startPayTime} + AND trade_time < #{endPayTime} + AND trade_type = 130 + AND trade_state = 2 + ) + GROUP BY d.trade_id + ) wd ON wd.trade_id = at.id LEFT JOIN device_info di ON f.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id - WHERE - at.trade_time >= #{startPayTime} - AND at.trade_time < #{endPayTime} + WHERE at.trade_time >= #{startPayTime} + AND at.trade_time <#{endPayTime} AND at.trade_type = 130 AND at.trade_state = 2 AND (at.machine_sn IS NULL OR at.machine_sn = '') AND f.status = 1 AND (f.source_type IS NULL OR f.source_type = 0 OR f.source_type = '') AND f.remark LIKE '%支付%' - ) t LEFT JOIN cust_info u ON t.cust_id = u.cust_id LEFT JOIN cust_org co ON u.org_id = co.org_id WHERE t.area_name LIKE CONCAT('%', #{orgName}, '%') - ORDER BY t.pay_time DESC; - + ORDER BY t.pay_time DESC