package cn.superdesk.uniorder.service.marketing.impl;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.marketing.UnifiedStatisticsVirt;
import cn.superdesk.uniorder.dao.mapper.marketing.UnifiedStatisticsVirtDimMonthMapperEx;
import cn.superdesk.uniorder.dao.mapper.marketing.UnifiedStatisticsVirtMapper;
import cn.superdesk.uniorder.dao.mapper.marketing.UnifiedStatisticsVirtMapperCommon;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedCustomerTJ;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedOrderLastMonth;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedStatisticsVirtSum;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedStatisticsVirtVo;
import cn.superdesk.uniorder.dto.vo.wechat.WxBillVirt;
import cn.superdesk.uniorder.dto.vo.wechat.WxBillVirtItem;
import cn.superdesk.uniorder.service.marketing.UnifiedStatisticsVirtCommonService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Service
public class UnifiedStatisticsVirtCommonServiceImpl implements UnifiedStatisticsVirtCommonService {


    @Autowired
    private UnifiedStatisticsVirtMapper           unifiedStatisticsVirtMapper;
    @Autowired
    private UnifiedStatisticsVirtDimMonthMapperEx unifiedStatisticsVirtDimMonthMapperEx;


    @Autowired
    private UnifiedStatisticsVirtMapperCommon unifiedStatisticsVirtMapperCommon;


    @Override
    public int insertSelective(UnifiedStatisticsVirt t) {

        return unifiedStatisticsVirtMapper.insertSelective(t);
    }

    @Override
    public int updateByPrimaryKeySelective(UnifiedStatisticsVirt t) {

        return unifiedStatisticsVirtMapper.updateByPrimaryKeySelective(t);
    }

    @Override
    public void deleteObj(Long id) {

        unifiedStatisticsVirtMapper.deleteByPrimaryKey(id);
    }

    @Override
    public UnifiedStatisticsVirt findById(Long id) {

        return unifiedStatisticsVirtMapper.selectByPrimaryKey(id);
    }


    @Override
    public List<UnifiedStatisticsVirt> findAll(Map<String, Object> queryMap) {

        return unifiedStatisticsVirtMapperCommon.findAll(queryMap);
    }


    @Override
    public PageInfo<UnifiedStatisticsVirt> findByPaging(Map<String, Object> params, Integer pageNo, Integer pageSize) {

        return null;
    }


    @Override
    public List<UnifiedStatisticsVirt> getVirtOrderReturnStatistical(Map<String, Object> queryMap) {
        return unifiedStatisticsVirtMapperCommon.getVirtOrderReturnStatistical(queryMap);
    }

    @Override
    public List<UnifiedStatisticsVirtVo> findAllVo(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.findAllVo(params);
    }

    @Override
    public UnifiedOrderLastMonth getlastmonth() {

        return unifiedStatisticsVirtMapperCommon.getlastmonth();
    }

    @Override
    public BigDecimal getReturnAmount(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getReturnAmount(params);
    }

    @Override
    public BigDecimal getundzamount(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getundzamount(params);
    }

    @Override
    public BigDecimal getuninvamount(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getuninvamount(params);
    }

    @Override
    public BigDecimal getunpaymoney(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getunpaymoney(params);
    }

    @Override
    public BigDecimal getOrderAmountByAreaItem(Map<String, Object> queryTJ) {

        return unifiedStatisticsVirtMapperCommon.getOrderAmountByAreaItem(queryTJ);
    }

    @Override
    public BigDecimal getreturnAmountByAreaItem(Map<String, Object> queryTJ) {

        return unifiedStatisticsVirtMapperCommon.getreturnAmountByAreaItem(queryTJ);
    }

    @Override
    public WxBillVirt getVirtBill(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getVirtBill(params);
    }

    @Override
    public List<WxBillVirtItem> getVirtItemBill(Map<String, Object> params) {

        return unifiedStatisticsVirtMapperCommon.getVirtItemBill(params);
    }

    @Override
    public R<List<UnifiedCustomerTJ>> getDataByPage(Map<String, Object> params, int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);

        List<UnifiedCustomerTJ> ls = unifiedStatisticsVirtMapperCommon.getData(params);

        PageInfo<UnifiedCustomerTJ> page = new PageInfo<UnifiedCustomerTJ>(ls);
        PageHelper.clearPage();
        return new R<List<UnifiedCustomerTJ>>(page.getPageNum(), page.getPageSize(), (int) page.getTotal(), ls);

    }

    @Override
    public List<UnifiedCustomerTJ> getStatisticsVirtData(Map<String, Object> params) {
        return unifiedStatisticsVirtMapperCommon.getData(params);
    }

    @Override
    public BigDecimal getOrderCostAmount(Map<String, Object> costQuery) {
        return unifiedStatisticsVirtMapperCommon.getOrderCostAmount(costQuery);
    }

    /**
     * 参数说明
     * syear
     * smonth
     * areaId-会得出这个区域下包含的粘企业的数据
     *
     * @param query
     * @return
     */
    @Override
    public UnifiedStatisticsVirtSum getStatisticsSum(Map<String, Object> query) {


        return unifiedStatisticsVirtMapperCommon.getStatisticsSum(query);
    }


}
