数据统计加退款和充值 修改
This commit is contained in:
@@ -3,8 +3,7 @@ package cn.ysk.cashier.service.impl;
|
||||
import cn.ysk.cashier.dto.ShopSummaryDto;
|
||||
import cn.ysk.cashier.enums.PayTypeEnum;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbMemberIn;
|
||||
import cn.ysk.cashier.mybatis.service.TbMemberInService;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
|
||||
import cn.ysk.cashier.repository.ShopUserDutyDetailRepository;
|
||||
import cn.ysk.cashier.repository.ShopUserDutyRepository;
|
||||
import cn.ysk.cashier.repository.TbTokenRepository;
|
||||
@@ -15,7 +14,6 @@ import cn.ysk.cashier.service.SummaryService;
|
||||
import cn.ysk.cashier.utils.DateUtil;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.vo.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -55,7 +53,8 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
private TbTokenRepository tbTokenRepository;
|
||||
|
||||
@Resource
|
||||
private TbMemberInService tbMemberInService;
|
||||
private TbShopUserFlowService tbShopUserFlowService;
|
||||
|
||||
|
||||
@Override
|
||||
public SummaryVO selectSummary(Integer shopId) {
|
||||
@@ -368,19 +367,18 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
tPage.getContent().forEach(t -> {
|
||||
TbOrderPayCountByDayVo tbOrderPayCountByDayVo = (TbOrderPayCountByDayVo) t;
|
||||
|
||||
QueryWrapper<TbMemberIn> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", "7");
|
||||
queryWrapper.eq("shop_id", summaryDto.getShopId());
|
||||
queryWrapper.ge("create_time", tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00");
|
||||
queryWrapper.le("create_time", tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59");
|
||||
// 会员充值金额 amount 求和
|
||||
queryWrapper.select("IFNULL (sum(amount), 0) AS amountTotal");
|
||||
BigDecimal recharge = tbShopUserFlowService.sumUserFlowAmountByConditions(Long.valueOf(summaryDto.getShopId()),
|
||||
tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00",
|
||||
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59",
|
||||
Arrays.asList("cashMemberIn", "scanMemberIn"));
|
||||
tbOrderPayCountByDayVo.setRecharge(recharge);
|
||||
|
||||
Map<String, Object> map = tbMemberInService.getMap(queryWrapper);
|
||||
|
||||
tbOrderPayCountByDayVo.setRecharge(new BigDecimal(map.get("amountTotal").toString()));
|
||||
BigDecimal decimal = tbOrderInfoRepository.queryRefundOrderAmountByTradeDay(summaryDto.getShopId(), tbOrderPayCountByDayVo.getTradeDay());
|
||||
tbOrderPayCountByDayVo.setRefund(decimal == null ? new BigDecimal("0.00") : decimal);
|
||||
|
||||
BigDecimal total = (BigDecimal) tbOrderPayCountByDayVo.getTotal();
|
||||
BigDecimal refund = (BigDecimal) tbOrderPayCountByDayVo.getRefund();
|
||||
tbOrderPayCountByDayVo.setTotal(total.subtract(refund));
|
||||
});
|
||||
|
||||
return tPage;
|
||||
|
||||
Reference in New Issue
Block a user