rk
2 天以前 467fe3b3ec6aa9d449b094bdd9df4611323d88d1
server/services/src/main/java/com/doumee/service/business/impl/RevenueServiceImpl.java
@@ -10,14 +10,8 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.RevenueMapper;
import com.doumee.dao.business.WithdrawalOrdersMapper;
import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.ShopInfoMapper;
import com.doumee.dao.business.model.Revenue;
import com.doumee.dao.business.model.ShopInfo;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.WithdrawalOrders;
import com.doumee.dao.business.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.dto.RevenueQueryDTO;
import com.doumee.dao.vo.RevenueStatisticsVO;
import com.doumee.dao.vo.RevenueSummaryVO;
@@ -26,6 +20,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Driver;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -49,6 +44,9 @@
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private DriverInfoMapper driverInfoMapper;
    @Override
    public Integer create(Revenue revenue) {
@@ -173,17 +171,16 @@
        if (shop == null || Constants.equalsInteger(shop.getDeleted(), Constants.ONE)) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "门店不存在");
        }
        Integer memberId = shop.getRegionMemberId();
        return buildRevenueStatistics(memberId, Constants.TWO, shop.getBalance());
        return buildRevenueStatistics(shop.getId(), Constants.TWO, shop.getBalance());
    }
    @Override
    public RevenueStatisticsVO getDriverRevenueStatistics(Integer memberId) {
        Member member = memberMapper.selectById(memberId);
        if (member == null) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "用户不存在");
        DriverInfo driverInfo = driverInfoMapper.selectById(memberId);
        if (driverInfo == null) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "司机信息不存在");
        }
        return buildRevenueStatistics(memberId, Constants.ONE, member.getAmount());
        return buildRevenueStatistics(memberId, Constants.ONE, driverInfo.getBalance());
    }
    /**
@@ -257,7 +254,7 @@
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        IPage<Revenue> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<Revenue> qw = buildRevenueQueryWrapper(pageWrap.getModel(), shop.getRegionMemberId());
        QueryWrapper<Revenue> qw = buildRevenueQueryWrapper(pageWrap.getModel(), shop.getId());
        PageData<Revenue> result = PageData.from(revenueMapper.selectPage(page, qw));
        if (result != null && result.getRecords() != null) {
            for (Revenue model : result.getRecords()) {
@@ -278,7 +275,7 @@
        if (shop == null || Constants.equalsInteger(shop.getDeleted(), Constants.ONE)) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        return buildRevenueSummary(queryDTO, shop.getRegionMemberId());
        return buildRevenueSummary(queryDTO, shop.getId());
    }
    private QueryWrapper<Revenue> buildRevenueQueryWrapper(RevenueQueryDTO query, Integer memberId) {