package com.fs.store.service;

import java.util.List;
import java.util.Map;

import com.fs.common.core.domain.R;
import com.fs.common.core.domain.ResponseResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.company.vo.CompanyQueryVo;
import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
import com.fs.course.vo.newfs.FsCourseAnalysisVO;
import com.fs.qw.param.QwFsUserParam;
import com.fs.qw.vo.QwFsUserVO;
import com.fs.store.domain.FsStoreOrder;
import com.fs.store.domain.FsStoreOrderItem;
import com.fs.store.domain.FsUser;
import com.fs.store.dto.FsUserTransferParamDTO;
import com.fs.store.param.SelectCusListPageParam;
import com.fs.store.param.h5.CourseAnalysisParam;
import com.fs.store.param.h5.FsUserPageListParam;
import com.fs.store.param.h5.UserStatisticsCommonParam;
import com.fs.store.vo.FSUserVO;
import com.fs.store.vo.FsCompanyUserListQueryVO;
import com.fs.store.vo.FsUserTuiVO;
import com.fs.store.vo.h5.FsUserPageListVO;
import com.fs.store.vo.h5.UserDetailsVO;
import com.fs.store.vo.h5.UserListPageVO;
import com.fs.store.vo.h5.*;

import java.util.List;

/**
 * 用户Service接口
 *
 * @author fs
 * @date 2022-03-15
 */
public interface IFsUserService
{
    /**
     * 查询用户
     *
     * @param userId 用户ID
     * @return 用户
     */
    public FsUser selectFsUserById(Long userId);

    /**

     * 查询用户
     *
     * @param userId 用户ID
     * @return FSUserVO
     */
    public FSUserVO selectFsUserByUserId(Long userId);

    /**
     * 查询用户列表
     *
     * @param fsUser 用户
     * @return 用户集合
     */
    public List<FsUser> selectFsUserList(FsUser fsUser);

    /**
     * 查询用户列表
     *
     * @param fsUser 用户
     * @return 用户集合
     */
    public List<FSUserVO> selectFsUserVOList(FsUser fsUser);

    /**
     * 新增用户
     *
     * @param fsUser 用户
     * @return 结果
     */
    public int insertFsUser(FsUser fsUser);

    /**
     * 修改用户
     *
     * @param fsUser 用户
     * @return 结果
     */
    public int updateFsUser(FsUser fsUser);

    /**
     * 批量删除用户
     *
     * @param userIds 需要删除的用户ID
     * @return 结果
     */
    public int deleteFsUserByIds(Long[] userIds);

    /**
     * 删除用户信息
     *
     * @param userId 用户ID
     * @return 结果
     */
    public int deleteFsUserById(Long userId);

    int decIntegral( Long uid,  double usedIntegral);

    int incPayCount(Long userId);

    FsUser selectFsUserByPhone(String phone);

    TableDataInfo selectCusListPage(SelectCusListPageParam param);

    List<FsCompanyUserListQueryVO> selectFsCompanyUserListQuery(FsUser fsUser);

    List<FsUserTuiVO> selectFsUserTuiList(String userId);

    Long selectFsUserCount(int type,Long companyId);

    void addTuiMoney(FsStoreOrder order, List<FsStoreOrderItem> items);

    void subTuiMoney(FsStoreOrder order);

    void addMoney(FsStoreOrder order);

    FsUser selectFsUserByMaOpenId(String openid);

    FsUser selectFsUserByMpOpenId(String openid);

    FsUser selectFsUserByUnionId(String unionId);


    FsUser selectFsUserByUserCode(String userCode);

    //CRM客户绑定 小程序客户之 查询小程序客户
    List<QwFsUserVO> selecQwFsUserListVO(QwFsUserParam qwFsUserParam);

    List<QwFsUserVO> selectQwFsUserListVO(QwFsUserParam qwFsUserParam);

    R clearUserVip(Long l);

    FsUser selectFsUserByUnionid(String unionId);

    List<FsUser> getUserListLimit(FsUser fsUser);

    List<FsUserPageListVO> selectFsUserPageList(FsUserPageListParam param);
    List<FsUserPageListVO> selectFsUserPageListNew(FsUserPageListParam param);
    Long selectFsUserCount(FsUserPageListParam param);

    UserListPageVO getUserNumber(Long userId);

    UserDetailsVO getUserDetails(Long userId, Long fsUserId, String dateTag);

    Boolean disabledUser(String[] ids, boolean status);

    void transfer(FsUserTransferParamDTO param);

    /**
     * 查询销售会员总数,今日新增会员数
     * @param companyUserId 销售ID
     * @return map
     */
    Map<String, Long> getUserVipCountByCompanyUserId(Long companyUserId);

    /**
     * 首页-获取用户总数
     * @param userId 登录用户id
     * @return vo
     */
    FsUserSummaryCountVO userSummaryCount(Long userId);

    /**
     * 首页数据统计-课程、答题、红包统计
     * @param param 查询参数
     * @return vo
     */
    FsUserStatisticsVO userStatistics(UserStatisticsCommonParam param);

    /**
     * 数据详情统计-根据课程id 视频id进行详情统计
     * @param param 查询参数
     * @return vo
     */
    FsUserStatisticsVO userStatisticsDetails(UserStatisticsCommonParam param);

    /**
     * 首页数据/详情-获取群管排行榜统计
     * @param userId 登录用户id
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param periodId 营期id
     * @param videoId 视频id
     * @param order 排序，asc-正序，desc-倒序
     * @param type 类型，1-按完播率，2-按正确率
     * @return vo
     */
    List<FsUserRankingVO> userRanking(Long userId, String startTime, String endTime, String periodId, String videoId, String order, Integer type);

    /**
     * 首页数据/详情-获取课程排行榜统计
     * @param userId 登录用户id
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param periodId 营期id
     * @param videoId 视频id
     * @param order 排序，asc-正序，desc-倒序
     * @param type 类型，1-按完播率，2-按正确率
     * @return vo
     */
    List<FsCourseRankingVO> courseRanking(Long userId, String startTime, String endTime, String periodId, String videoId, String order, Integer type);

    /**
     *
     * @param param 查询参数
     * @return vo
     */
    List<FsUserGraphicStatisticsVO> graphicStatistics(UserStatisticsCommonParam param);

    /**
     * 课程分析查询-某销售下课程视频的观看和答题情况统计
     * @param param 参数
     * @return vo
     */
    List<FsCourseAnalysisVO> courseAnalysis(CourseAnalysisParam param);

    /**
     * 查询某个群管（二级销售）的会员统计
     * @param userId 登录用户id
     * @param companyUserId 销售id
     * @return vo
     */
    CompanyUserSummaryCountVO companyUserSummaryCount(Long userId, String companyUserId);

    /**
     * 成为销售的会员
     * @param param
     * @return 是否成功
     */
    ResponseResult<Boolean> becomeMember(FsUserCourseBeMemberParam param);

}
