报表功能查看

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 @Mapper
public interface PlaceMapper { public interface PlaceMapper {
List<ReportOrderInfoVo> placeexportExcel(ReportOrderInfoVo orgConsume); List<ReportOrderInfoVo> placeexportExcel(ReportOrderInfoVo orgConsume);
} }

View File

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

View File

@ -4,14 +4,14 @@
<select id="placeexportExcel" resultType="com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo"> <select id="placeexportExcel" 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(real_amount) AS payable_amount,
SUM(real_amount) AS real_amount, SUM(real_amount) AS real_amount,
area_name, area_name,
work_area_name work_area_name
@ -34,27 +34,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 >= #{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;= #{endTime} and (a.remark not like '%支付' or a.remark is null) 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 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 >= #{startTime} AND a.flow_type IN ( 110, 120,130 ) WHERE a.pay_time >= #{startTime}
AND a.pay_time &lt;= #{endTime} and a.remark like '%支付' AND a.flow_type IN (110, 120, 130)
AND a.pay_time &lt;= #{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
@ -70,7 +80,6 @@
#{id} #{id}
</foreach> </foreach>
</if> </if>
<!-- 判断工作地 --> <!-- 判断工作地 -->
<if test="gzselectedOrg != null and gzselectedOrg.length > 0"> <if test="gzselectedOrg != null and gzselectedOrg.length > 0">
AND p.dining_place_id IN AND p.dining_place_id IN
@ -79,7 +88,7 @@
</foreach> </foreach>
</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
</select> </select>
</mapper> </mapper>