更新10.15

This commit is contained in:
许允枞 2024-10-15 13:37:56 +08:00
parent 76d32ab70b
commit 921b5666d5
3 changed files with 23 additions and 5 deletions

View File

@ -103,4 +103,6 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
// IPage<CardValueOrdersVo> getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo);
IPage<AllOrderInfoUniVo> queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfoUniVo allOrderInfo);
Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime);
}

View File

@ -841,6 +841,16 @@
and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if>
</select>
<select id="getCountMemberBalance" resultType="java.lang.Double">
SELECT
SUM(CASE WHEN content like '%充值%' THEN pay_money ELSE 0 END) -
SUM(CASE WHEN content like '%订单%' and type = '3' THEN pay_money ELSE 0 END) AS net_pay_money
FROM
all_order_info
WHERE
store_id = #{storeId}
AND pay_time &lt; #{endTime};
</select>
<!-- <where>-->
<!-- store_id = #{order.storeId}-->

View File

@ -2057,12 +2057,16 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
List<String> oilNames = new ArrayList<>();
List<Map<String, Object>> oilData = new ArrayList<>();
oilNames.add("油品交易额");
oilNames.add("会员充值金额");
oilNames.add("非油品交易额");
oilNames.add("会员充值金额");
oilNames.add("会员消费金额");
oilNames.add("会员余额");
//查询会员余额
for (String time : allDatesBetween) {
DateTime dateTime = DateUtil.beginOfDay(DateUtil.parse(time));
DateTime dateTime1 = DateUtil.endOfDay(dateTime);
Double memberBalance = allOrderInfoMapper.getCountMemberBalance(nowAccountInfo.getStoreId(), dateTime1.toString());
Map<String, Object> params = new HashMap<>();
params.put("time", time);
List<Double> money = new ArrayList<>();
@ -2070,18 +2074,20 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
List<AllOrderInfo> oilOrder = filterOrders(allOrderInfos, dateTime, dateTime1, "1", null, null);
double sum = oilOrder.stream().mapToDouble(AllOrderInfo::getPayMoney).sum();
money.add(sum);
//会员充值金额
List<AllOrderInfo> mtTopUp = filterOrders(allOrderInfos, dateTime, dateTime1, null, "充值", null);
double mtSum = mtTopUp.stream().mapToDouble(AllOrderInfo::getPayMoney).sum();
money.add(mtSum);
//非油品交易额
List<AllOrderInfo> otherOrder = filterOrders(allOrderInfos, dateTime, dateTime1, null, null, "2");
double otherSum = otherOrder.stream().mapToDouble(AllOrderInfo::getPayMoney).sum();
money.add(otherSum);
//会员充值金额
List<AllOrderInfo> mtTopUp = filterOrders(allOrderInfos, dateTime, dateTime1, null, "充值", null);
double mtSum = mtTopUp.stream().mapToDouble(AllOrderInfo::getPayMoney).sum();
money.add(mtSum);
//会员消费金额
List<AllOrderInfo> userOrder = filterOrders(allOrderInfos, dateTime, dateTime1, null, "订单", null);
double userSum = userOrder.stream().mapToDouble(AllOrderInfo::getPayMoney).sum();
money.add(userSum);
//会员余额
money.add(memberBalance);
params.put("money", money);
oilData.add(params);