This commit is contained in:
zhaohengkun 2024-10-11 11:30:30 +08:00
parent 70fa9bfe1e
commit 920f67828c
5 changed files with 99 additions and 64 deletions

View File

@ -46,11 +46,11 @@
<div class="wrap-boxs">
<div class="k_" id="k_1">
<div class="size_" >活跃油站汇总数/合作油站汇总数</div>
<div class="title_">{{ orderStatistics.storeId?orderStatistics.storeId:0 }}/{{orderStatistics.sumOil}}</div>
<div class="title_">{{ orderStatistics.allOrderStoreId?orderStatistics.allOrderStoreId:0 }}/{{orderStatistics.totalCount}}</div>
</div>
<div class="k_" id="k_2">
<div class="size_" >交易金额汇总数/交易笔数</div>
<div class="title_">{{ orderStatistics.payMoney?orderStatistics.payMoney:0 }}/{{orderStatistics.count}}</div>
<div class="title_">{{ orderStatistics.totalPayMoney?orderStatistics.totalPayMoney:0 }}/{{orderStatistics.totalTransactionCount}}</div>
</div>
<div class="k_" id="k_3">
<div class="size_">退款金额/退款笔数</div>
@ -58,7 +58,7 @@
</div>
<div class="k_" id="k_4">
<div class="size_">新增油站数</div>
<div class="title_">{{ orderStatistics.sumOil?orderStatistics.sumOil:0 }}</div>
<div class="title_">{{ orderStatistics.totalCount?orderStatistics.totalCount:0 }}</div>
</div>
</div>
</div>
@ -69,7 +69,7 @@
style="width: 100%">
<el-table-column type="index" width="50" align="center" label="序号"/>
<el-table-column prop="storeName" align="center" label="机构名称"></el-table-column>
<el-table-column prop="parentName" align="center" label="所属机构"></el-table-column>
<el-table-column prop="deptName" align="center" label="所属机构"></el-table-column>
<el-table-column prop="payMoney" align="center" label="累计交易金额(元)">
<template slot-scope="scope">
<span>{{scope.row.payMoney|| 0}}</span>

View File

@ -33,6 +33,9 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
Map<String, Object> getFenxiByDailiBydata(@Param("order") AllOrderInfo allOrderInfo);
Map<String, Object> getFenxiByDailiTypeBydata(@Param("order") AllOrderInfo allOrderInfo);
String getAllOrderInfoCountByStoreId(@Param("order") AllOrderInfo allOrderInfo);
List<AllOrderInfoVo> getFenxiByDaili2ByData(@Param("order") AllOrderInfo allOrderInfo);
String sumPayMoney(@Param("allOrderInfo") AllOrderInfo allOrderInfo);

View File

@ -599,32 +599,44 @@
group by store_id
</select>
<select id="getFenxiByDailiType" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
SELECT
store_id storeId,
SUM(pay_money) payMoney,
select
d.dept_name AS deptName,
s.name AS storeName,
SUM(COALESCE(a.pay_money, 0)) AS payMoney,
count(*) count,
sum(CASE WHEN pay_type = 'WECHAT' THEN pay_money ELSE 0 END) wechatMoney,
sum(CASE WHEN pay_type = 'CASH' THEN pay_money ELSE 0 END) cashMoney,
sum(CASE WHEN pay_type = 'balance' THEN pay_money ELSE 0 END) balanceMoney,
sum(CASE WHEN pay_type = 'ALIPAY' THEN pay_money ELSE 0 END) alipayMoney,
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
count(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) refCount
from all_order_info
<where>
<if test="order.storeIds != null">
store_id in
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d')
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if>
</where>
group by store_id
sum( CASE WHEN a.pay_type = 'WECHAT' THEN a.pay_money ELSE 0 END ) wechatMoney,
sum( CASE WHEN a.pay_type = 'CASH' THEN a.pay_money ELSE 0 END ) cashMoney,
sum( CASE WHEN a.pay_type = 'balance' THEN a.pay_money ELSE 0 END ) balanceMoney,
sum( CASE WHEN a.pay_type = 'ALIPAY' THEN a.pay_money ELSE 0 END ) alipayMoney,
sum( CASE WHEN a.STATUS = 'refund' THEN a.pay_money ELSE 0 END ) refMoney,
count( CASE WHEN a.STATUS = 'refund' THEN 1 ELSE NULL END ) refCount
from mt_store s
LEFT JOIN all_order_info a on s.id=a.store_id
LEFT JOIN sys_dept d on d.dept_id = s.contract_dept_id
where
<if test="order.storeIds != null">
s.id in
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and s.if_delete = '0'
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and (a.create_time IS NULL OR date_format(a.create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d'))
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and ( a.create_time IS NULL OR date_format(a.create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d') )
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and (s.create_time IS NULL OR date_format(s.create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d'))
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and ( s.create_time IS NULL OR date_format(s.create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d') )
</if>
GROUP BY s.id
ORDER BY payMoney DESC
</select>
<select id="getFenxiByDaili2" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
SELECT payment_channel paymentChannel,
@ -693,31 +705,42 @@
group by store_id
</select>
<select id="getFenxiByDailiTypeBydata" resultType="java.util.Map">
select
count( DISTINCT store_id ) storeId,
SELECT
-- 总条数,因为连表去重
COUNT(DISTINCT s.id) AS totalCount,
-- 交易总金额
SUM( pay_money ) payMoney,
SUM(COALESCE(a.pay_money, 0)) AS totalPayMoney,
-- 交易笔数
count(*) count,
COUNT(a.id) AS totalTransactionCount,
-- 退款金额
sum( CASE WHEN STATUS = 'refund' THEN pay_money ELSE 0 END ) refMoney,
SUM(CASE WHEN a.status = 'refund' THEN a.pay_money ELSE 0 END) AS refMoney,
-- 退款笔数
count( CASE WHEN STATUS = 'refund' THEN 1 ELSE NULL END ) refCount
from all_order_info
<where>
<if test="order.storeIds != null">
store_id in
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d')
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if>
</where>
COUNT(CASE WHEN a.status = 'refund' THEN 1 ELSE NULL END) AS refCount
FROM
mt_store s
LEFT JOIN
all_order_info a ON s.id = a.store_id
WHERE
<if test="order.storeIds != null">
s.id in
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and s.if_delete = '0'
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and (a.create_time IS NULL OR date_format(a.create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d'))
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and ( a.create_time IS NULL OR date_format(a.create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d') )
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and (s.create_time IS NULL OR date_format(s.create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d'))
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and ( s.create_time IS NULL OR date_format(s.create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d') )
</if>
</select>
@ -786,6 +809,23 @@
where info.id = #{orderId}
</select>
<select id="getAllOrderInfoCountByStoreId" resultType="java.lang.String">
select count(DISTINCT store_id ) FROM all_order_info
where
<if test="order.storeIds != null">
store_id in
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d')
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if>
</select>
<!-- <where>-->
<!-- store_id = #{order.storeId}-->
<!-- <if test="order.params.beginTime != null and order.params.beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->

View File

@ -204,13 +204,12 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
}
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(allOrderInfo.getDeptId());
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
// 活跃油站(有订单数据的油站) 油站总数 交易总金额 退款总金额 新增油站数(油站总数)
allOrderInfo.setStoreIds(longs);
Map<String, Object> fenxiByDailiTypeBydata = allOrderInfoMapper.getFenxiByDailiTypeBydata(allOrderInfo);
SysDept sysDept = sysDeptMapper.selectOilNum(allOrderInfo.getDeptId());
SysDept sysDept2 = sysDeptMapper.selectOilNum2(allOrderInfo);
fenxiByDailiTypeBydata.put("sumOil", sysDept.getValidNum());
fenxiByDailiTypeBydata.put("sumOil2", sysDept2.getValidNum());
// 单独查询活跃的油站店铺
String allOrderInfoCountByStoreId = allOrderInfoMapper.getAllOrderInfoCountByStoreId(allOrderInfo);
fenxiByDailiTypeBydata.put("allOrderStoreId", allOrderInfoCountByStoreId);
return fenxiByDailiTypeBydata;
}
@ -331,15 +330,6 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
allOrderInfo.setStoreIds(longs);
IPage<AllOrderInfoVo> fenxiByDaili = allOrderInfoMapper.getFenxiByDailiType(page, allOrderInfo);
for (AllOrderInfoVo record : fenxiByDaili.getRecords()) {
MtStore mtStore = mtStoreMapper.selectById(record.getStoreId());
if (ObjectUtil.isNotEmpty(mtStore)) {
SysDept byId = deptService.getById(mtStore.getContractDeptId());
SysDept byId2 = deptService.getById(byId.getParentId());
record.setStoreName(byId.getDeptName());
record.setParentName(byId2.getDeptName());
}
}
return fenxiByDaili;
}

View File

@ -14,6 +14,8 @@ public class AllOrderInfoVo extends AllOrderInfo {
private String orderStatus;
private Double sumPayMoney;
// 机构名称
private String deptName;
//交易金额
private String amount;
private String wechatMoney;