package com.hzs.report.member.service.impl;
/**
 * @Description:
 * @Author: yuhui
 * @Time: 2023/8/26 9:51
 * @Classname: MemberReportServiceImpl
 * @PackageName: com.hzs.report.member.service.Impl
 */

import com.hzs.common.core.utils.DateUtils;
import com.hzs.report.member.mapper.MemberReportMapper;
import com.hzs.report.member.service.MemberReportService;
import com.hzs.report.member.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 *@BelongsProject: hzs_cloud
 *@BelongsPackage: com.hzs.report.member.service.Impl
 *@Author: yh
 *@CreateTime: 2023-08-26  09:51
 *@Description: TODO
 *@Version: 1.0
 */
@Slf4j
@Service
public class MemberReportServiceImpl implements MemberReportService {


    @Autowired
    private MemberReportMapper  memberReportMapper;
    /**
     * 查询伞下直推新增业绩
     * @return
     */
    @Override
    public List<DirectPushNewVo> directPushNewList(Long pkMember, String memberName, Integer pkAwards, Integer pkTeamCode, Integer pkCountry, Date startPayTime, Date endPayTime,Integer pkVertex) {
        return memberReportMapper.directPushNewList( pkMember,  memberName,  pkAwards,  pkTeamCode,  pkCountry,  startPayTime,  endPayTime, pkVertex);
    }

    /**
     * @description: 查询伞下直推新增业绩-业绩
     * @author: zhang jing
     * @date: 2023/9/6 14:16
     * @param: [pkMember, startPayTime, endPayTime]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    @Override
    public List<DirectPushNewVo> directPushNewAchieList(Long pkMember, Date startPayTime, Date endPayTime,List<Integer> orderType,Integer pkCountry) {
        return memberReportMapper.directPushNewAchieList( pkMember, startPayTime,endPayTime,orderType,pkCountry);
    }

    /**
     * @description: 查询个人直推新增业绩
     * @author: zhang jing
     * @date: 2024/4/7 10:55
     * @param: [pkMember, startPayTime, endPayTime, orderType, pkCountry]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    @Override
    public List<DirectPushNewVo> personDirectPushAchieList(Long pkMember, Date startPayTime, Date endPayTime, List<Integer> orderType, Integer pkCountry) {
        return memberReportMapper.personDirectPushAchieList( pkMember, startPayTime,endPayTime,orderType,pkCountry);
    }


    /**
     * 用户消费统计
     * @param memberCode 用户编号
     * @param memberName 用户姓名
     * @param startPayTime 开始支付时间
     * @param endPayTime   结束支付时间
     * @param pkWares 商品主键
     * @return
     */
    @Override
    public List<MemberConsumptionVo> memberConsumptionList(String memberCode, String memberName, Date startPayTime, Date endPayTime, Integer pkWares) {
        return memberReportMapper.memberConsumptionList(memberCode,memberName,startPayTime,endPayTime,pkWares);
    }

    /**
     * 伞下新增安置业绩
     * @return
     */
    @Override
    public List<MemberResettleAchieveVo> memberResettleAchieve(Long pkMember, String memberName,Date startPayTime,Date endPayTime,Integer pkVertex,Integer pkTeamCode,Integer pkCountry,Integer pkAwards, List<Integer> orderTypeList) {
        return memberReportMapper.memberResettleAchieve(pkMember,memberName,startPayTime,endPayTime,pkVertex,pkTeamCode,pkCountry,pkAwards,orderTypeList);
    }


    /**
     * 订单币种查询
     * @param memberCode  会员编号
     * @param memberName  会员名称
     * @param orderCode  订单编号
     * @param orderType 订单类型
     * @return
     */
    @Override
    public List<OrderCurrencyVo> getOrderCurrencyList(String memberCode, String memberName, String orderCode, Integer orderType) {
        return memberReportMapper.getOrderCurrencyList(memberCode,memberName,orderCode,orderType);
    }

    /**
     * 查询订单币种
     * @param orderCodeList
     * @return
     */
    @Override
    public List<MemberTradeVo> getBySourceCodeMemberTradeList(List<String> orderCodeList) {
        return memberReportMapper.getBySourceCodeMemberTradeList(orderCodeList);
    }
    /**
     * 查询省订单
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param pkCountry 所属国家
     * @return
     */
    @Override
    public List<OrderDistribution> getByProvinceOrderDistribution( Date startTime, Date endTime,Integer pkCountry) {
        return memberReportMapper.getByProvinceOrderDistribution(startTime,endTime,pkCountry);
    }
    /**
     * 查询市订单
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param pkCountry 所属国家
     * @return
     */
    @Override
    public List<OrderDistribution> getByCityOrderDistribution(Date startTime, Date endTime, Integer pkCountry) {
        return memberReportMapper.getByCityOrderDistribution(startTime,endTime,pkCountry);
    }
    /**
     * 查询区县订单
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param pkCountry 所属国家
     * @return
     */
    @Override
    public List<OrderDistribution> getByDistrictOrderDistribution(Date startTime, Date endTime, Integer pkCountry) {
        return memberReportMapper.getByDistrictOrderDistribution(startTime,endTime,pkCountry);
    }
    /**
     * 出货明细汇总
     * @param productName
     * @param pkClassify
     * @param startTime
     * @param endTime
     * @return
     */
    @Override
    public List<ProductOrderInfoVo> getProductOrderInfo(String productName, Integer pkClassify,Date startTime,Date endTime,Integer pkCountry,List<Integer> orderTypeList) {
        if (startTime != null){
            startTime = DateUtils.getStartTime(startTime);
        }
        if (endTime != null){
            endTime = DateUtils.getEndTime(endTime);
        }
        return memberReportMapper.getProductOrderInfo(productName,pkClassify,startTime,endTime,pkCountry, orderTypeList);
    }
    /**
     * 报单汇总
     * @return
     */
    @Override
    public List<ReportSummaryVo> reportSummaryList(ReportSummaryVo reportSummaryVo) {
        return memberReportMapper.reportSummaryList(reportSummaryVo);
    }

    /**
     * 出货明细汇总统计详情
     * @param pkProduct
     * @param productName
     * @return
     */
    @Override
    public List<ProductShippingDetailsInfoVo> productShippingDetailsList(Integer pkProduct, String productName,Integer pkClassify,Integer pkAwards,Integer pkCountry,Integer orderType) {
        return memberReportMapper.productShippingDetailsList(pkProduct,productName, pkClassify, pkAwards,pkCountry,orderType);
    }
    /**
     * 伞下新增安置业绩
     * @param pkMember  会员主键
     * @param memberName  会员名称
     * @param startPayTime 开始支付时间
     * @param endPayTime 结束支付时间
     * @param pkVertex 体系
     * @param pkTeamCode 团队
     * @param pkCountry 所属国家
     * @param pkAwards 奖衔
     * @param orderTypeList 订单类型列表
     * @return
     */
    @Override
    public MemberResettleAchieveVo memberResettleAchieveInfo(Long pkMember, String memberName, Date startPayTime, Date endPayTime, Integer pkVertex, Integer pkTeamCode, Integer pkCountry, Integer pkAwards, List<Integer> orderTypeList) {
        return memberReportMapper.memberResettleAchieveInfo(pkMember,memberName,startPayTime,endPayTime,pkVertex,pkTeamCode,pkCountry,pkAwards,orderTypeList);
    }

    /**
     * 查询会员所有的相关部门
     * @param pkMember
     * @return
     */
    @Override
    public List<Integer> queryMemberPlaceDeptList(Long pkMember) {
        return memberReportMapper.queryMemberPlaceDeptList(pkMember);
    }
    /**
     * 会员所属部门业绩
     * @param pkMember
     * @param placeDept
     * @return
     */
    @Override
    public MemberAchieveVO queryMemberPlaceDeptAchieve(Long pkMember,Integer placeDept,Integer pkCountry,String memberName ,Date startPayTime,Date endPayTime,Integer pkVertex,Integer pkTeamCode,Integer pkAwards,List<Integer> orderTypeList) {
        return memberReportMapper.queryMemberPlaceDeptAchieve(pkMember,placeDept,pkCountry,memberName ,startPayTime,endPayTime,pkVertex,pkTeamCode,pkAwards,orderTypeList);
    }

    /**
     * 会员活跃度统计
     * @return
     */
    @Override
    public List<ActivationVO> memberActiveList(Date startTime ,Date endTime,Integer pkCountry) {
        return memberReportMapper.memberActiveList(startTime,endTime ,pkCountry);
    }
}
