| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Autowired |
| | | private DriverInfoMapper driverInfoMapper; |
| | | |
| | | @Override |
| | | public Integer create(Revenue revenue) { |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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()) { |
| | |
| | | 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) { |