后端 BUG
This commit is contained in:
parent
1ee96d674e
commit
c274a7f9e1
@ -317,11 +317,11 @@
|
|||||||
<select id="getAmountAndConsume" resultType="java.util.Map">
|
<select id="getAmountAndConsume" resultType="java.util.Map">
|
||||||
select
|
select
|
||||||
count(*) as consumeNum,
|
count(*) as consumeNum,
|
||||||
sum(amount) as amount
|
sum(COALESCE(amount, 0)) as amount
|
||||||
from card_value_record
|
from card_value_record
|
||||||
<where>
|
where
|
||||||
mt_user_id = #{mtUserId}
|
mt_user_id = #{mtUserId}
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
<!-- where store_id = #{storeId} and mt_user_id = #{userId}-->
|
<!-- where store_id = #{storeId} and mt_user_id = #{userId}-->
|
||||||
<!-- group by chain_store_id
|
<!-- group by chain_store_id
|
||||||
|
@ -87,6 +87,8 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
|
|||||||
|
|
||||||
Map<String, Object> getLeiJiInfo(@Param("order") UserBalanceVo record);
|
Map<String, Object> getLeiJiInfo(@Param("order") UserBalanceVo record);
|
||||||
Map<String, Object> getShuJuVipInfo(@Param("order") UserBalanceVo record);
|
Map<String, Object> getShuJuVipInfo(@Param("order") UserBalanceVo record);
|
||||||
|
String getCardGift(@Param("order") UserBalanceVo record);
|
||||||
|
|
||||||
|
|
||||||
AllOrderInfoVo getPaymentChannelData(Integer storeId);
|
AllOrderInfoVo getPaymentChannelData(Integer storeId);
|
||||||
|
|
||||||
|
@ -8,37 +8,37 @@
|
|||||||
<where>
|
<where>
|
||||||
pay_type != 'CASH'
|
pay_type != 'CASH'
|
||||||
and store_id IN
|
and store_id IN
|
||||||
<foreach collection="list" item="list" separator="," open="(" close=")">
|
<foreach collection="list" item="list" separator="," open="(" close=")">
|
||||||
#{list.storeId}
|
#{list.storeId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="getTradingPage" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getTradingPage" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
select
|
select
|
||||||
aoi.id AS id,
|
aoi.id AS id,
|
||||||
aoi.order_no AS orderNo,
|
aoi.order_no AS orderNo,
|
||||||
aoi.type AS type,
|
aoi.type AS type,
|
||||||
aoi.transaction_id AS transactionId,
|
aoi.transaction_id AS transactionId,
|
||||||
aoi.store_id AS storeId,
|
aoi.store_id AS storeId,
|
||||||
aoi.goods_money AS goodsMoney,
|
aoi.goods_money AS goodsMoney,
|
||||||
aoi.pay_money AS payMoney,
|
aoi.pay_money AS payMoney,
|
||||||
aoi.pay_time AS payTime,
|
aoi.pay_time AS payTime,
|
||||||
aoi.pay_type AS payType,
|
aoi.pay_type AS payType,
|
||||||
aoi.user_id AS userId,
|
aoi.user_id AS userId,
|
||||||
aoi.pay_channel AS payChannel,
|
aoi.pay_channel AS payChannel,
|
||||||
aoi.status AS status,
|
aoi.status AS status,
|
||||||
aoi.content AS orderContent,
|
aoi.content AS orderContent,
|
||||||
aoi.create_time AS createTime,
|
aoi.create_time AS createTime,
|
||||||
aoi.create_by AS createBy,
|
aoi.create_by AS createBy,
|
||||||
aoi.update_time AS updateTime,
|
aoi.update_time AS updateTime,
|
||||||
aoi.update_by AS updateBy,
|
aoi.update_by AS updateBy,
|
||||||
aoi.reason_Refund AS reasonRefund,
|
aoi.reason_Refund AS reasonRefund,
|
||||||
aoi.ref_order_no AS refOrderNo,
|
aoi.ref_order_no AS refOrderNo,
|
||||||
aoi.ref_money AS refMoney,
|
aoi.ref_money AS refMoney,
|
||||||
aoi.ref_by AS refBy,
|
aoi.ref_by AS refBy,
|
||||||
aoi.discount_amount AS discountAmount,
|
aoi.discount_amount AS discountAmount,
|
||||||
mu.name userName,
|
mu.name userName,
|
||||||
mu.mobile userMobile
|
mu.mobile userMobile
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
left join mt_user mu ON aoi.user_id = mu.id
|
left join mt_user mu ON aoi.user_id = mu.id
|
||||||
<where>
|
<where>
|
||||||
@ -55,10 +55,10 @@
|
|||||||
<if test="allOrderInfo.payType != null and allOrderInfo.payType != ''">
|
<if test="allOrderInfo.payType != null and allOrderInfo.payType != ''">
|
||||||
and aoi.pay_type = #{allOrderInfo.payType}
|
and aoi.pay_type = #{allOrderInfo.payType}
|
||||||
</if>
|
</if>
|
||||||
<if test="allOrderInfo.status != null and allOrderInfo.status != ''">
|
<if test="allOrderInfo.status != null and allOrderInfo.status != ''">
|
||||||
and aoi.status = #{allOrderInfo.status}
|
and aoi.status = #{allOrderInfo.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="allOrderInfo.staffId != null and allOrderInfo.staffId != ''">
|
<if test="allOrderInfo.staffId != null and allOrderInfo.staffId != ''">
|
||||||
and aoi.staff_id = #{allOrderInfo.staffId}
|
and aoi.staff_id = #{allOrderInfo.staffId}
|
||||||
</if>
|
</if>
|
||||||
<if test="allOrderInfo.params.beginTime != null and allOrderInfo.params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="allOrderInfo.params.beginTime != null and allOrderInfo.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
@ -83,8 +83,8 @@
|
|||||||
COALESCE(SUM(pay_money), 0) AS amount,
|
COALESCE(SUM(pay_money), 0) AS amount,
|
||||||
COALESCE(COUNT(*), 0) AS strokeCount,
|
COALESCE(COUNT(*), 0) AS strokeCount,
|
||||||
CASE
|
CASE
|
||||||
WHEN COUNT(*) = 0 THEN 0
|
WHEN COUNT(*) = 0 THEN 0
|
||||||
ELSE SUM(pay_money) / COUNT(*)
|
ELSE SUM(pay_money) / COUNT(*)
|
||||||
END AS unitPrice
|
END AS unitPrice
|
||||||
|
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
@ -104,10 +104,10 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- sum(pay_money) amount,-->
|
<!-- sum(pay_money) amount,-->
|
||||||
<!-- count(*) strokeCount,-->
|
<!-- count(*) strokeCount,-->
|
||||||
<!-- SUM(pay_money) / COUNT(*) AS unitPrice,-->
|
<!-- SUM(pay_money) / COUNT(*) AS unitPrice,-->
|
||||||
<!-- store_id storeId,-->
|
<!-- store_id storeId,-->
|
||||||
<select id="getStoreNDynamic" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getStoreNDynamic" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
select
|
select
|
||||||
COUNT(DISTINCT aoi.store_id) AS storeCount
|
COUNT(DISTINCT aoi.store_id) AS storeCount
|
||||||
@ -130,10 +130,10 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!-- -- aoi.store_id = #{allOrderInfo.storeId}-->
|
<!-- -- aoi.store_id = #{allOrderInfo.storeId}-->
|
||||||
<select id="sumPayMoney" resultType="java.lang.String">
|
<select id="sumPayMoney" resultType="java.lang.String">
|
||||||
select
|
select
|
||||||
sum(aoi.pay_money) sumPayMoney
|
sum(aoi.pay_money) sumPayMoney
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
left join mt_user mu ON aoi.user_id = mu.id
|
left join mt_user mu ON aoi.user_id = mu.id
|
||||||
where aoi.store_id = #{allOrderInfo.storeId}
|
where aoi.store_id = #{allOrderInfo.storeId}
|
||||||
@ -161,7 +161,6 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getPageList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getPageList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
select
|
select
|
||||||
aoi.id AS id,
|
aoi.id AS id,
|
||||||
@ -244,23 +243,23 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!-- SUM(CASE WHEN payType = 'balance' THEN pay_money ELSE 0 END) AS balance,-->
|
<!-- SUM(CASE WHEN payType = 'balance' THEN pay_money ELSE 0 END) AS balance,-->
|
||||||
|
|
||||||
<select id="getRunningWaterByDay" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getRunningWaterByDay" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
DATE(pay_time) AS pay_time,
|
DATE(pay_time) AS pay_time,
|
||||||
COUNT(DISTINCT aoi.store_id) AS storeCount,
|
COUNT(DISTINCT aoi.store_id) AS storeCount,
|
||||||
COALESCE(SUM(pay_money), 0) AS amount,
|
COALESCE(SUM(pay_money), 0) AS amount,
|
||||||
COALESCE(SUM(goods_money), 0) AS goodsMoney,
|
COALESCE(SUM(goods_money), 0) AS goodsMoney,
|
||||||
COALESCE(COUNT(*), 0) AS strokeCount,
|
COALESCE(COUNT(*), 0) AS strokeCount,
|
||||||
COALESCE(SUM(discount_amount), 0) AS discountAmount,
|
COALESCE(SUM(discount_amount), 0) AS discountAmount,
|
||||||
SUM(CASE WHEN status = 'refund' THEN ref_money ELSE 0 END) AS refund,
|
SUM(CASE WHEN status = 'refund' THEN ref_money ELSE 0 END) AS refund,
|
||||||
SUM(CASE WHEN content = '储值卡充值' THEN pay_money ELSE 0 END) AS vipAmount,
|
SUM(CASE WHEN content = '储值卡充值' THEN pay_money ELSE 0 END) AS vipAmount,
|
||||||
SUM(CASE WHEN pay_type = 'balance' THEN pay_money ELSE 0 END) AS balance,
|
SUM(CASE WHEN pay_type = 'balance' THEN pay_money ELSE 0 END) AS balance,
|
||||||
ROUND(
|
ROUND(
|
||||||
CASE WHEN COUNT(*) = 0 THEN 0 ELSE SUM(pay_money) / COUNT(*) END,
|
CASE WHEN COUNT(*) = 0 THEN 0 ELSE SUM(pay_money) / COUNT(*) END,
|
||||||
2
|
2
|
||||||
) AS unitPrice
|
) AS unitPrice
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
WHERE
|
WHERE
|
||||||
date_format(aoi.pay_time, '%y%m%d') BETWEEN date_format(#{allOrderInfo.params.beginTime}, '%y%m%d')
|
date_format(aoi.pay_time, '%y%m%d') BETWEEN date_format(#{allOrderInfo.params.beginTime}, '%y%m%d')
|
||||||
@ -281,18 +280,19 @@
|
|||||||
|
|
||||||
<select id="getRunningWaterByDayData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getRunningWaterByDayData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT DATE(pay_time) AS pay_time,
|
SELECT DATE(pay_time) AS pay_time,
|
||||||
COUNT(DISTINCT aoi.store_id) storeCount,
|
COUNT(DISTINCT aoi.store_id) storeCount,
|
||||||
COALESCE(SUM(pay_money), 0) AS amount,
|
COALESCE(SUM(pay_money), 0) AS amount,
|
||||||
COALESCE(COUNT(*), 0) AS strokeCount,
|
COALESCE(COUNT(*), 0) AS strokeCount,
|
||||||
ROUND(
|
ROUND(
|
||||||
CASE
|
CASE
|
||||||
WHEN COUNT(*) = 0 THEN 0
|
WHEN COUNT(*) = 0 THEN 0
|
||||||
ELSE SUM(pay_money) / COUNT(*)
|
ELSE SUM(pay_money) / COUNT(*)
|
||||||
END,
|
END,
|
||||||
2
|
2
|
||||||
) AS unitPrice
|
) AS unitPrice
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
WHERE date_format(aoi.pay_time,'%y%m%d') BETWEEN date_format(#{allOrderInfo.params.beginTime},'%y%m%d') AND date_format(#{allOrderInfo.params.endTime},'%y%m%d')
|
WHERE date_format(aoi.pay_time,'%y%m%d') BETWEEN date_format(#{allOrderInfo.params.beginTime},'%y%m%d') AND
|
||||||
|
date_format(#{allOrderInfo.params.endTime},'%y%m%d')
|
||||||
<if test="allOrderInfo.storeIds != null">
|
<if test="allOrderInfo.storeIds != null">
|
||||||
and aoi.store_id in
|
and aoi.store_id in
|
||||||
<foreach collection="allOrderInfo.storeIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="allOrderInfo.storeIds" item="item" open="(" close=")" separator=",">
|
||||||
@ -307,11 +307,11 @@
|
|||||||
COALESCE(SUM(pay_money), 0) AS amount,
|
COALESCE(SUM(pay_money), 0) AS amount,
|
||||||
COALESCE(COUNT(*), 0) AS strokeCount,
|
COALESCE(COUNT(*), 0) AS strokeCount,
|
||||||
ROUND(
|
ROUND(
|
||||||
CASE
|
CASE
|
||||||
WHEN COUNT(*) = 0 THEN 0
|
WHEN COUNT(*) = 0 THEN 0
|
||||||
ELSE SUM(pay_money) / COUNT(*)
|
ELSE SUM(pay_money) / COUNT(*)
|
||||||
END,
|
END,
|
||||||
2
|
2
|
||||||
) AS unitPrice
|
) AS unitPrice
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
<where>
|
<where>
|
||||||
@ -332,64 +332,64 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getHandoverByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getHandoverByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
select
|
select aoi.id AS id,
|
||||||
aoi.id AS id,
|
aoi.order_no AS orderNo,
|
||||||
aoi.order_no AS orderNo,
|
aoi.type AS type,
|
||||||
aoi.type AS type,
|
aoi.transaction_id AS transactionId,
|
||||||
aoi.transaction_id AS transactionId,
|
aoi.store_id AS storeId,
|
||||||
aoi.store_id AS storeId,
|
aoi.goods_money AS goodsMoney,
|
||||||
aoi.goods_money AS goodsMoney,
|
aoi.pay_money AS payMoney,
|
||||||
aoi.pay_money AS payMoney,
|
aoi.pay_time AS payTime,
|
||||||
aoi.pay_time AS payTime,
|
aoi.pay_type AS payType,
|
||||||
aoi.pay_type AS payType,
|
aoi.user_id AS userId,
|
||||||
aoi.user_id AS userId,
|
aoi.pay_channel AS payChannel,
|
||||||
aoi.pay_channel AS payChannel,
|
aoi.status AS status,
|
||||||
aoi.status AS status,
|
aoi.content AS orderContent,
|
||||||
aoi.content AS orderContent,
|
aoi.create_time AS createTime,
|
||||||
aoi.create_time AS createTime,
|
aoi.create_by AS createBy,
|
||||||
aoi.create_by AS createBy,
|
aoi.update_time AS updateTime,
|
||||||
aoi.update_time AS updateTime,
|
aoi.update_by AS updateBy,
|
||||||
aoi.update_by AS updateBy,
|
aoi.reason_Refund AS reasonRefund,
|
||||||
aoi.reason_Refund AS reasonRefund,
|
aoi.ref_order_no AS refOrderNo,
|
||||||
aoi.ref_order_no AS refOrderNo,
|
aoi.ref_money AS refMoney,
|
||||||
aoi.ref_money AS refMoney,
|
aoi.ref_by AS refBy,
|
||||||
aoi.ref_by AS refBy,
|
mu.name userName,
|
||||||
mu.name userName,
|
mu.mobile userMobile
|
||||||
mu.mobile userMobile
|
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
left join mt_user mu ON aoi.user_id = mu.id
|
left join mt_user mu ON aoi.user_id = mu.id
|
||||||
where
|
where order_no like concat('%', #{allOrderInfo.orderNo}, '%')
|
||||||
order_no like concat('%', #{allOrderInfo.orderNo}, '%')
|
|
||||||
|
|
||||||
|
|
||||||
order by aoi.create_time desc
|
order by aoi.create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="getTradingData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getTradingData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
select
|
select
|
||||||
SUM(CASE WHEN pay_type = 'CASH' THEN pay_money ELSE 0 END) AS CASH,
|
SUM(CASE WHEN pay_type = 'CASH' THEN pay_money ELSE 0 END) AS CASH,
|
||||||
SUM(CASE WHEN pay_type = 'WECHAT' THEN pay_money ELSE 0 END) AS WECHAT,
|
SUM(CASE WHEN pay_type = 'WECHAT' THEN pay_money ELSE 0 END) AS WECHAT,
|
||||||
SUM(CASE WHEN pay_type = 'ALIPAY' THEN pay_money ELSE 0 END) AS ALIPAY,
|
SUM(CASE WHEN pay_type = 'ALIPAY' THEN pay_money ELSE 0 END) AS ALIPAY,
|
||||||
SUM(CASE WHEN pay_type = 'balance' THEN pay_money ELSE 0 END) AS balance,
|
SUM(CASE WHEN pay_type = 'balance' THEN pay_money ELSE 0 END) AS balance,
|
||||||
COUNT(CASE WHEN pay_type = 'CASH' THEN 0 END) AS CASHCount,
|
COUNT(CASE WHEN pay_type = 'CASH' THEN 0 END) AS CASHCount,
|
||||||
COUNT(CASE WHEN pay_type = 'WECHAT' THEN 0 END) AS WECHATCount,
|
COUNT(CASE WHEN pay_type = 'WECHAT' THEN 0 END) AS WECHATCount,
|
||||||
COUNT(CASE WHEN pay_type = 'ALIPAY' THEN 0 END) AS ALIPAYCount,
|
COUNT(CASE WHEN pay_type = 'ALIPAY' THEN 0 END) AS ALIPAYCount,
|
||||||
COUNT(CASE WHEN pay_type = 'balance' THEN 0 END) AS balanceCount,
|
COUNT(CASE WHEN pay_type = 'balance' THEN 0 END) AS balanceCount,
|
||||||
SUM(CASE WHEN aoi.status = 'refund' THEN pay_money ELSE 0 END) AS refBalance,
|
SUM(CASE WHEN aoi.status = 'refund' THEN pay_money ELSE 0 END) AS refBalance,
|
||||||
COUNT(CASE WHEN aoi.status = 'refund' THEN 0 END) AS refBalanceCount,
|
COUNT(CASE WHEN aoi.status = 'refund' THEN 0 END) AS refBalanceCount,
|
||||||
|
|
||||||
SUM(pay_money) AS sumBalance,
|
|
||||||
count(*) AS countBalance,
|
|
||||||
SUM(CASE WHEN aoi.content = '储值卡订单' THEN pay_money ELSE 0 END) AS userBalance,
|
|
||||||
COUNT(CASE WHEN aoi.content = '储值卡订单' THEN 0 END) AS userBalanceCount,
|
|
||||||
SUM(CASE WHEN aoi.content = '油品充值' THEN pay_money ELSE 0 END) AS oilBalance,
|
|
||||||
COUNT(CASE WHEN aoi.content = '油品充值' THEN 0 END) AS oilBalanceCount,
|
|
||||||
|
|
||||||
SUM(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'WECHAT' THEN pay_money ELSE 0 END) AS userBalanceByWechat,
|
|
||||||
COUNT(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'WECHAT' THEN 0 END) AS userBalanceCountByWechat,
|
|
||||||
SUM(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'ALIPAY' THEN pay_money ELSE 0 END) AS userBalanceByAli,
|
|
||||||
COUNT(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'ALIPAY' THEN 0 END) AS userBalanceCountByali
|
|
||||||
|
|
||||||
|
SUM(pay_money) AS sumBalance,
|
||||||
|
count(*) AS countBalance,
|
||||||
|
SUM(CASE WHEN aoi.content = '储值卡订单' THEN pay_money ELSE 0 END) AS userBalance,
|
||||||
|
COUNT(CASE WHEN aoi.content = '储值卡订单' THEN 0 END) AS userBalanceCount,
|
||||||
|
SUM(CASE WHEN aoi.content = '油品充值' THEN pay_money ELSE 0 END) AS oilBalance,
|
||||||
|
COUNT(CASE WHEN aoi.content = '油品充值' THEN 0 END) AS oilBalanceCount,
|
||||||
|
|
||||||
|
SUM(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'WECHAT' THEN pay_money ELSE 0 END)
|
||||||
|
AS userBalanceByWechat,
|
||||||
|
COUNT(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'WECHAT' THEN 0 END) AS
|
||||||
|
userBalanceCountByWechat,
|
||||||
|
SUM(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'ALIPAY' THEN pay_money ELSE 0 END)
|
||||||
|
AS userBalanceByAli,
|
||||||
|
COUNT(CASE WHEN (aoi.content = '储值卡订单' or aoi.content = '油品充值') and pay_type = 'ALIPAY' THEN 0 END) AS
|
||||||
|
userBalanceCountByali
|
||||||
|
|
||||||
|
|
||||||
from all_order_info aoi
|
from all_order_info aoi
|
||||||
@ -427,26 +427,24 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getIndexData4Pos" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getIndexData4Pos" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT SUM(pay_money) AS totalPayMoney,
|
||||||
SUM(pay_money) AS totalPayMoney,
|
COUNT(*) AS totalCount,
|
||||||
COUNT(*) AS totalCount,
|
COUNT(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) AS totalRefund -- 计算退款订单的总数
|
||||||
COUNT(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) AS totalRefund -- 计算退款订单的总数
|
|
||||||
|
|
||||||
-- SUM(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) AS totalRefund
|
-- SUM(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) AS totalRefund
|
||||||
FROM
|
FROM all_order_info
|
||||||
all_order_info
|
|
||||||
where store_id = #{allOrderInfo.storeId}
|
where store_id = #{allOrderInfo.storeId}
|
||||||
AND DATE(pay_time) = CURDATE()
|
AND DATE (pay_time) = CURDATE()
|
||||||
</select>
|
</select>
|
||||||
<select id="getHandOverList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getHandOverList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(pay_money) AS totalPayMoney,
|
SUM(pay_money) AS totalPayMoney,
|
||||||
COUNT(*) AS totalCount,
|
COUNT(*) AS totalCount,
|
||||||
COUNT(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) AS totalRefund -- 计算退款订单的总数
|
COUNT(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) AS totalRefund -- 计算退款订单的总数
|
||||||
|
|
||||||
-- SUM(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) AS totalRefund
|
-- SUM(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) AS totalRefund
|
||||||
FROM
|
FROM
|
||||||
all_order_info
|
all_order_info
|
||||||
<where>
|
<where>
|
||||||
staff_id = #{staffId}
|
staff_id = #{staffId}
|
||||||
|
|
||||||
@ -460,8 +458,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOneByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getOneByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT *
|
||||||
*
|
|
||||||
from all_order_info
|
from all_order_info
|
||||||
where order_no = #{orderNo}
|
where order_no = #{orderNo}
|
||||||
</select>
|
</select>
|
||||||
@ -517,42 +514,64 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getLeiJiInfo" resultType="java.util.Map">
|
<select id="getLeiJiInfo" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(CASE WHEN type = 3 THEN pay_money ELSE 0 END) AS leijiMoney, -- 累计消费金额
|
-- 总消费
|
||||||
COUNT(CASE WHEN type = 3 THEN 0 END) AS leijiNum,
|
COALESCE(SUM(CASE WHEN type NOT IN (3, 5) AND ref_by IS NULL THEN pay_money ELSE 0 END), 0) AS s1,
|
||||||
SUM(CASE WHEN type = 3 and status = 'refund' THEN ref_money ELSE 0 END) AS leijiMoneyRef, -- 累计退款金额
|
COUNT(CASE WHEN type NOT IN (3, 5) AND ref_by IS NULL THEN pay_money ELSE 0 END) AS s1c,
|
||||||
COUNT(CASE WHEN type = 3 and status = 'refund' THEN 0 END) AS leijiNum
|
-- 总充值
|
||||||
|
COALESCE(SUM(CASE WHEN type = 3 AND ref_by IS NULL THEN pay_money ELSE 0 END), 0) AS s2,
|
||||||
from all_order_info
|
COUNT(CASE WHEN type = 3 AND ref_by IS NULL THEN pay_money ELSE 0 END) AS s2c,
|
||||||
|
-- 退款总金额 次数
|
||||||
|
COALESCE(SUM(CASE WHEN ref_by IS NOT NULL THEN ref_money ELSE 0 END), 0) AS s3,
|
||||||
|
COUNT(CASE WHEN ref_by IS NOT NULL THEN ref_money ELSE 0 END) AS s3c
|
||||||
|
FROM all_order_info
|
||||||
where user_id = #{order.mtUserId}
|
where user_id = #{order.mtUserId}
|
||||||
</select>
|
</select>
|
||||||
<!-- group by user_id-->
|
<!-- group by user_id-->
|
||||||
|
|
||||||
<select id="getShuJuVipInfo" resultType="java.util.Map">
|
<select id="getShuJuVipInfo" resultType="java.util.Map">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
SUM(CASE WHEN content = "储值卡充值" THEN pay_money ELSE 0 END) AS tongjMoney, -- 累计充值金额
|
-- 总消费
|
||||||
SUM(CASE WHEN type = 3 THEN pay_money ELSE 0 END) AS tongjXfMoney -- 累计消费金额
|
SUM(CASE WHEN all_order_info.type NOT IN (3, 5) AND all_order_info.ref_by IS NULL THEN all_order_info.pay_money
|
||||||
from all_order_info
|
ELSE 0 END) AS tongjXfMoney,
|
||||||
<where>
|
-- 总充值
|
||||||
<if test="order.storeIds != null">
|
SUM(CASE WHEN all_order_info.type = 3 AND all_order_info.ref_by IS NULL THEN all_order_info.pay_money ELSE 0
|
||||||
store_id in
|
END) AS tongjMoney
|
||||||
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
|
FROM all_order_info
|
||||||
#{item}
|
INNER JOIN (
|
||||||
</foreach>
|
SELECT mt_user.*
|
||||||
</if>
|
FROM mt_user_balance
|
||||||
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
|
LEFT JOIN mt_user ON mt_user_balance.mt_user_id = mt_user.id
|
||||||
and date_format(create_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d')
|
WHERE mt_user_balance.user_status = 0 AND mt_user_balance.store_id IN
|
||||||
</if>
|
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
|
||||||
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
|
#{item}
|
||||||
and date_format(create_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d')
|
</foreach>
|
||||||
</if>
|
) AS mtUser ON mtUser.id = all_order_info.user_id;
|
||||||
</where>
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getCardGift" resultType="java.lang.String">
|
||||||
|
select
|
||||||
|
SUM(CASE WHEN card_gift.status=1 THEN card_gift.card_amount ELSE 0 END) as cardGiftMoney
|
||||||
|
from card_gift
|
||||||
|
JOIN (
|
||||||
|
SELECT mt_user.*
|
||||||
|
FROM mt_user_balance
|
||||||
|
LEFT JOIN mt_user ON mt_user_balance.mt_user_id = mt_user.id
|
||||||
|
WHERE mt_user_balance.user_status = 0 AND mt_user_balance.store_id IN
|
||||||
|
<foreach collection="order.storeIds" item="item" index="index" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
) AS mtUser ON mtUser.id = card_gift.user_id;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getFenxiByDaili" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getFenxiByDaili" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
store_id storeId,
|
store_id storeId,
|
||||||
SUM(pay_money) payMoney,
|
SUM(pay_money) payMoney,
|
||||||
count(*) count
|
count(*) count
|
||||||
from all_order_info
|
from all_order_info
|
||||||
<where>
|
<where>
|
||||||
<if test="order.storeIds != null">
|
<if test="order.storeIds != null">
|
||||||
@ -581,15 +600,15 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getFenxiByDailiType" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getFenxiByDailiType" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
store_id storeId,
|
store_id storeId,
|
||||||
SUM(pay_money) payMoney,
|
SUM(pay_money) payMoney,
|
||||||
count(*) count,
|
count(*) count,
|
||||||
sum(CASE WHEN pay_type = 'WECHAT' THEN pay_money ELSE 0 END) wechatMoney,
|
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 = '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 = 'balance' THEN pay_money ELSE 0 END) balanceMoney,
|
||||||
sum(CASE WHEN pay_type = 'ALIPAY' THEN pay_money ELSE 0 END) alipayMoney,
|
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,
|
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
|
||||||
# count(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refCount
|
# count(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refCount
|
||||||
count(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) refCount
|
count(CASE WHEN status = 'refund' THEN 1 ELSE NULL END) refCount
|
||||||
from all_order_info
|
from all_order_info
|
||||||
<where>
|
<where>
|
||||||
@ -609,25 +628,24 @@
|
|||||||
group by store_id
|
group by store_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getFenxiByDaili2" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getFenxiByDaili2" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT payment_channel paymentChannel,
|
||||||
payment_channel paymentChannel,
|
SUM(pay_money) payMoneyChannel,
|
||||||
SUM(pay_money) payMoneyChannel,
|
count(*) countChannel
|
||||||
count(*) countChannel
|
|
||||||
from all_order_info
|
from all_order_info
|
||||||
group by payment_channel
|
group by payment_channel
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <select id="getFenxiByDailiBydata" resultType="com.fuint.business.order.vo.AllOrderInfoVo">-->
|
<!-- <select id="getFenxiByDailiBydata" resultType="com.fuint.business.order.vo.AllOrderInfoVo">-->
|
||||||
<!-- SELECT-->
|
<!-- SELECT-->
|
||||||
<!-- SUM(pay_amount) payAmount,-->
|
<!-- SUM(pay_amount) payAmount,-->
|
||||||
<!-- count(*)-->
|
<!-- count(*)-->
|
||||||
<!-- from all_order_info-->
|
<!-- from all_order_info-->
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
<select id="getFenxiByDaili2ByData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getFenxiByDaili2ByData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
payment_channel paymentChannel,
|
payment_channel paymentChannel,
|
||||||
SUM(pay_money) payMoneyChannel,
|
SUM(pay_money) payMoneyChannel,
|
||||||
count(*) countChannel
|
count(*) countChannel
|
||||||
from all_order_info
|
from all_order_info
|
||||||
<where>
|
<where>
|
||||||
<if test="order.storeIds != null">
|
<if test="order.storeIds != null">
|
||||||
@ -647,8 +665,8 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getFenxiByDailiBydata" resultType="java.util.Map">
|
<select id="getFenxiByDailiBydata" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(pay_money) payMoney,
|
SUM(pay_money) payMoney,
|
||||||
count(*) count
|
count(*) count
|
||||||
from all_order_info
|
from all_order_info
|
||||||
<where>
|
<where>
|
||||||
<if test="order.storeIds != null">
|
<if test="order.storeIds != null">
|
||||||
@ -667,9 +685,8 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getFenxiByDailiTypeDaty" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getFenxiByDailiTypeDaty" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT SUM(pay_money) payMoney,
|
||||||
SUM(pay_money) payMoney,
|
count(*) count,
|
||||||
count(*) count,
|
|
||||||
|
|
||||||
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
|
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
|
||||||
count(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refCount
|
count(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refCount
|
||||||
@ -678,11 +695,11 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getFenxiByDailiTypeBydata" resultType="java.util.Map">
|
<select id="getFenxiByDailiTypeBydata" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
count(distinct store_id) storeId,
|
count(distinct store_id) storeId,
|
||||||
SUM(pay_money) payMoney,
|
SUM(pay_money) payMoney,
|
||||||
count(*) count,
|
count(*) count,
|
||||||
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
|
sum(CASE WHEN status = 'refund' THEN pay_money ELSE 0 END) refMoney,
|
||||||
count(CASE WHEN status = 'refund' THEN 1 ELSE 0 END) refCount
|
count(CASE WHEN status = 'refund' THEN 1 ELSE 0 END) refCount
|
||||||
from all_order_info
|
from all_order_info
|
||||||
<where>
|
<where>
|
||||||
<if test="order.storeIds != null">
|
<if test="order.storeIds != null">
|
||||||
@ -701,7 +718,6 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getPaymentChannelData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="getPaymentChannelData" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
sum(CASE WHEN payment_channel = '富友' THEN pay_money ELSE 0 END) fuYouAmount,
|
sum(CASE WHEN payment_channel = '富友' THEN pay_money ELSE 0 END) fuYouAmount,
|
||||||
@ -715,11 +731,10 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="runningWaterByInstituion2" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
<select id="runningWaterByInstituion2" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
|
||||||
SELECT
|
SELECT SUM(pay_money) payMoney,
|
||||||
SUM(pay_money) payMoney,
|
SUM(goods_money) goodsMoney,
|
||||||
SUM(goods_money) goodsMoney,
|
SUM(ref_money) refMoney,
|
||||||
SUM(ref_money) refMoney,
|
count(*) count,
|
||||||
count(*) count,
|
|
||||||
count(CASE WHEN status = 'refund' THEN 1 ELSE 0 END) AS refund,
|
count(CASE WHEN status = 'refund' THEN 1 ELSE 0 END) AS refund,
|
||||||
|
|
||||||
content content
|
content content
|
||||||
@ -753,33 +768,34 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <where>-->
|
<!-- <where>-->
|
||||||
<!-- store_id = #{order.storeId}-->
|
<!-- store_id = #{order.storeId}-->
|
||||||
<!-- <if test="order.params.beginTime != null and order.params.beginTime != ''"><!– 开始时间检索 –>-->
|
<!-- <if test="order.params.beginTime != null and order.params.beginTime != ''"><!– 开始时间检索 –>-->
|
||||||
<!-- and date_format(create_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d')-->
|
<!-- and date_format(create_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d')-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- <if test="order.params.endTime != null and order.params.endTime != ''"><!– 结束时间检索 –>-->
|
<!-- <if test="order.params.endTime != null and order.params.endTime != ''"><!– 结束时间检索 –>-->
|
||||||
<!-- and date_format(create_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d')-->
|
<!-- and date_format(create_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d')-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- </where>-->
|
<!-- </where>-->
|
||||||
<!-- SUM(CASE WHEN transaction_type = 'sale' THEN amount ELSE 0 END) AS total_sales-->
|
<!-- SUM(CASE WHEN transaction_type = 'sale' THEN amount ELSE 0 END) AS total_sales-->
|
||||||
|
|
||||||
<!-- COUNT(CASE WHEN pay_type = 'WECHAT' THEN 0 END) AS wechat, -- 微信-->
|
<!-- COUNT(CASE WHEN pay_type = 'WECHAT' THEN 0 END) AS wechat, -- 微信-->
|
||||||
|
|
||||||
<!-- WHERE-->
|
<!-- WHERE-->
|
||||||
<!-- DATE(pay_time) = CURDATE();-->
|
<!-- DATE(pay_time) = CURDATE();-->
|
||||||
<!-- <if test="startTime != null "><!– 开始时间检索 –>-->
|
<!-- <if test="startTime != null "><!– 开始时间检索 –>-->
|
||||||
<!-- and date_format(pay_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')-->
|
<!-- and date_format(pay_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- <if test="endTime != null "><!– 结束时间检索 –>-->
|
<!-- <if test="endTime != null "><!– 结束时间检索 –>-->
|
||||||
<!-- and date_format(pay_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')-->
|
<!-- and date_format(pay_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
|
|
||||||
|
|
||||||
<!-- <if test="startTime1 != null and startTime1 != ''">-->
|
<!-- <if test="startTime1 != null and startTime1 != ''">-->
|
||||||
<!-- AND pay_time >= #{startTime1} -- 开始时间检索-->
|
<!-- AND pay_time >= #{startTime1} -- 开始时间检索-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- <if test="endTime1 != null and endTime1 != ''">-->
|
<!-- <if test="endTime1 != null and endTime1 != ''">-->
|
||||||
<!-- AND pay_time <= #{endTime} -- 结束时间检索-->
|
<!-- AND pay_time <= #{endTime} -- 结束时间检索-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -41,10 +41,13 @@
|
|||||||
mub.store_id storeId,
|
mub.store_id storeId,
|
||||||
mub.card_balance cardBalance,
|
mub.card_balance cardBalance,
|
||||||
mub.create_time,
|
mub.create_time,
|
||||||
mu.id mtUserId
|
mu.id mtUserId,
|
||||||
|
mub.grade_id
|
||||||
|
|
||||||
from mt_user_balance mub
|
from mt_user_balance mub
|
||||||
left join mt_user mu on mub.mt_user_id = mu.id
|
left join mt_user mu on mub.mt_user_id = mu.id
|
||||||
<where>
|
<where>
|
||||||
|
mub.user_status = 0 and
|
||||||
mub.store_id in
|
mub.store_id in
|
||||||
<foreach collection="user.storeIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="user.storeIds" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
@ -58,8 +61,13 @@
|
|||||||
count(*) sumnum,
|
count(*) sumnum,
|
||||||
sum(mub.card_balance) balanceSum
|
sum(mub.card_balance) balanceSum
|
||||||
from mt_user_balance mub
|
from mt_user_balance mub
|
||||||
left join mt_user mu on mub.mt_user_id = mu.id
|
left join mt_user mu on mub.mt_user_id = mu.id
|
||||||
|
where
|
||||||
|
mub.user_status = 0 and
|
||||||
|
mub.store_id in
|
||||||
|
<foreach collection="storeIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectHoverBalance" resultType="java.util.Map">
|
<select id="selectHoverBalance" resultType="java.util.Map">
|
||||||
select
|
select
|
||||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||||
@ -97,16 +98,17 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
|||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
user.setDeptId(nowAccountInfo.getDeptId());
|
user.setDeptId(nowAccountInfo.getDeptId());
|
||||||
}
|
}
|
||||||
|
// 查询指定id部门下所有子部门id
|
||||||
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(user.getDeptId());
|
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(user.getDeptId());
|
||||||
|
// 根据部门id 查询 店铺id
|
||||||
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
|
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
|
||||||
user.setStoreIds(longs);
|
user.setStoreIds(longs);
|
||||||
IPage<UserBalanceVo> userBalanceVoIPage = userBalanceMapper.listByZt(page, user);
|
IPage<UserBalanceVo> userBalanceVoIPage = userBalanceMapper.listByZt(page, user);
|
||||||
for (UserBalanceVo record : userBalanceVoIPage.getRecords()) {
|
for (UserBalanceVo record : userBalanceVoIPage.getRecords()) {
|
||||||
|
// 店铺名称
|
||||||
LJStore ljStore = storeService.selectStoreByIdUni(record.getStoreId());
|
LJStore ljStore = storeService.selectStoreByIdUni(record.getStoreId());
|
||||||
if (ObjectUtil.isNotEmpty(ljStore)) {
|
if (ObjectUtil.isNotEmpty(ljStore)) {
|
||||||
record.setStoreName(ljStore.getName());
|
record.setStoreName(ljStore.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
// 会员等级
|
// 会员等级
|
||||||
LJUserGrade ljUserGrade = ljUserGradeMapper.selectById(record.getGradeId());
|
LJUserGrade ljUserGrade = ljUserGradeMapper.selectById(record.getGradeId());
|
||||||
@ -115,34 +117,23 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
|||||||
} else {
|
} else {
|
||||||
record.setGradeName("--");
|
record.setGradeName("--");
|
||||||
}
|
}
|
||||||
// 累计充值金额
|
|
||||||
Map<String, Object> amountAndConsume = cardValueRecordMapper.getAmountAndConsume(record);
|
|
||||||
if (ObjectUtil.isNotEmpty(amountAndConsume)) {
|
|
||||||
record.setCountNum(amountAndConsume.get("consumeNum").toString()); // 累计重置次数
|
|
||||||
record.setAmount(ObjectUtil.isNotEmpty(amountAndConsume.get("amount")) ? amountAndConsume.get("amount").toString() : "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> leiJiInfo = allOrderInfoMapper.getLeiJiInfo(record);
|
Map<String, Object> leiJiInfo = allOrderInfoMapper.getLeiJiInfo(record);
|
||||||
if (ObjectUtil.isNotEmpty(leiJiInfo)) {
|
if (ObjectUtil.isNotEmpty(leiJiInfo)) {
|
||||||
// log.info("累计消费信息:"+JSON.toJSONString(leiJiInfo));
|
// public String leijiMoney; 消费总金额
|
||||||
if (ObjectUtil.isNotEmpty(leiJiInfo.get("leijiMoneyRef"))) {
|
// public String leijiNum; 消费次数
|
||||||
record.setLeijiMoney(leiJiInfo.get("leijiMoney").toString());// 累计消费金额
|
// amount 累计充值金额
|
||||||
}
|
// CountNum 次数
|
||||||
if (ObjectUtil.isNotEmpty(leiJiInfo.get("leijiMoneyRef"))) {
|
// public String leijiMoneyRef; 退款总金额
|
||||||
record.setLeijiNum(leiJiInfo.get("leijiNum").toString()); // 累计消费次数
|
// public String leijiNumRef; 退款次数
|
||||||
}
|
record.setLeijiMoney(leiJiInfo.get("s1").toString());
|
||||||
if (ObjectUtil.isNotEmpty(leiJiInfo.get("leijiMoneyRef"))) {
|
record.setLeijiNum(leiJiInfo.get("s1c").toString());
|
||||||
record.setLeijiMoneyRef(leiJiInfo.get("leijiMoneyRef").toString()); // 累计退款余额
|
record.setAmount(leiJiInfo.get("s2").toString());
|
||||||
}
|
record.setCountNum(leiJiInfo.get("s2c").toString());
|
||||||
if (ObjectUtil.isNotEmpty(leiJiInfo.get("leijiNumRef"))) {
|
record.setLeijiMoneyRef(leiJiInfo.get("s3").toString());
|
||||||
record.setLeijiNumRef(leiJiInfo.get("leijiNum").toString()); // 累计退款笔数
|
record.setLeijiNumRef(leiJiInfo.get("s3c").toString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 电子礼品卡余额
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return userBalanceVoIPage;
|
return userBalanceVoIPage;
|
||||||
}
|
}
|
||||||
@ -152,13 +143,18 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
|||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
user.setDeptId(nowAccountInfo.getDeptId());
|
user.setDeptId(nowAccountInfo.getDeptId());
|
||||||
}
|
}
|
||||||
|
// 查询指定id部门下所有子部门id
|
||||||
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(user.getDeptId());
|
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(user.getDeptId());
|
||||||
|
// 查询所有店铺id
|
||||||
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
|
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
|
||||||
user.setStoreIds(longs);
|
user.setStoreIds(longs);
|
||||||
|
// 会员总数 sumnum 累计储值卡余额 balanceSum
|
||||||
Map<String, Object> dataByZt = userBalanceMapper.getDataByZt(user);
|
Map<String, Object> dataByZt = userBalanceMapper.getDataByZt(user);
|
||||||
|
// 累计总消费金额 累计总充值金额 注: 店铺统计的时候 要把注销的会员去掉
|
||||||
Map<String, Object> leiJiInfo = allOrderInfoMapper.getShuJuVipInfo(user);
|
Map<String, Object> leiJiInfo = allOrderInfoMapper.getShuJuVipInfo(user);
|
||||||
|
// 累计礼品卡余额
|
||||||
|
String cardGift = allOrderInfoMapper.getCardGift(user);
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(dataByZt)) {
|
if (ObjectUtil.isEmpty(dataByZt)) {
|
||||||
dataByZt = new HashMap<>();
|
dataByZt = new HashMap<>();
|
||||||
}
|
}
|
||||||
@ -168,8 +164,9 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
|||||||
leiJiInfo.put("tongjMoney", "0");
|
leiJiInfo.put("tongjMoney", "0");
|
||||||
|
|
||||||
}
|
}
|
||||||
dataByZt.put("tongjMoney", ObjectUtil.isNotEmpty(leiJiInfo.get("tongjMoney")) ? convertYuanToWanYuan((BigDecimal) leiJiInfo.get("tongjMoney")) : "0");
|
dataByZt.put("tongjMoney", ObjectUtil.isNotEmpty(leiJiInfo.get("tongjMoney")) ? leiJiInfo.get("tongjMoney") : "0");
|
||||||
dataByZt.put("tongjXfMoney", ObjectUtil.isNotEmpty(leiJiInfo.get("tongjXfMoney")) ? convertYuanToWanYuan((BigDecimal) leiJiInfo.get("tongjXfMoney")) : "0");
|
dataByZt.put("tongjXfMoney", ObjectUtil.isNotEmpty(leiJiInfo.get("tongjXfMoney")) ? leiJiInfo.get("tongjXfMoney") : "0");
|
||||||
|
dataByZt.put("cardGift", ObjectUtil.isNotEmpty(cardGift) ? cardGift : "0");
|
||||||
return dataByZt;
|
return dataByZt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user