package com.fs.crm.service;

import com.alibaba.fastjson.JSONObject;
import com.fs.common.core.domain.R;
import com.fs.crm.domain.CrmCustomer;
import com.fs.crm.param.*;
import com.fs.crm.vo.*;
import com.fs.qwApi.param.QwCustomerDetailParam;

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

/**
 * 客户Service接口
 *
 * @author fs
 * @date 2022-12-21
 */
public interface ICrmCustomerService
{
    /**
     * 查询客户
     *
     * @param customerId 客户ID
     * @return 客户
     */
    public CrmCustomer selectCrmCustomerById(Long customerId);

    /**
     *   根据userid和外部联系人id获取到客户详情
     */
    public CrmCustomer getCustomerDetailsH5(QwCustomerDetailParam param);

    public CrmCustomer selectCrmCustomerByMobile(CrmCustomer customer);

    /**
     * 查询客户列表
     *
     * @param crmCustomer 客户
     * @return 客户集合
     */
    public List<CrmCustomer> selectCrmCustomerList(CrmCustomer crmCustomer);

    /**
    *  获取所有CRM里面关联了企业微信，然后未加为好友的客户列表
    */
    public List<CrmCustomerListQueryFriendVO> getFriendAssistantListVO(CrmCustomerQueryFriendParam param);

    /**
     * 新增客户
     *
     * @param crmCustomer 客户
     * @return 结果
     */
    public int insertCrmCustomer(CrmCustomer crmCustomer);

    /**
     * 修改客户
     *
     * @param crmCustomer 客户
     * @return 结果
     */
    public int updateCrmCustomer(CrmCustomer crmCustomer);



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

    /**
     * 删除客户信息
     *
     * @param customerId 客户ID
     * @return 结果
     */
    public int deleteCrmCustomerById(Long customerId);

    List<CrmFullCustomerListQueryVO> selectCrmFullCustomerListQuery(CrmFullCustomerListQueryParam param);

    CrmCustomerQueryVO selectCrmFullCustomerQueryByCustomerId(Long customerId);

    String importLineCustomer(List<CrmLineCustomerImportParam> list, String operName);

    List<CrmCustomerListVO> selectCrmCustomerListVO(CrmCustomer crmCustomer);

    List<CrmCustomerListVO> selectCrmCustomerListQueryParam(CrmCustomerListQueryParam crmCustomer);

    List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(CrmMyCustomerListQueryParam param);

    List<CrmCustomerListQueryVO> selectCrmCustomerListQuery(CrmCustomerListQueryParam param);

    List<CrmLineCustomerListQueryVO> selectCrmLineCustomerListQuery(CrmLineCustomerListQueryParam param);


    R receive(CrmCustomeReceiveParam param, String operName);

    R recover(CrmCustomeRecoverParam param, String operName);

    R assignUser(CrmCustomeAssignUserParam param, String operName);

    Integer selectCrmCustomerCountByType(Long companyId, int type);

    R editTags(CrmCustomerEditTagsParam param);

    Long selectCrmCustomerCount(int type, Long companyId);

    List<JSONObject> selectCrmCustomerCounts(Map<String, Object> toMap);

    List<CrmCustomerStatisticsVO> selectCrmCustomerStatisticsList(CrmCustomerStatisticsParam param);

    String importCompanyLineCustomer(List<CrmCompanyLineCustomerImportParam> list, String operName, Long companyId, Long companyUserId);

    R assignToUser(String operUserName, Long operUserId, CrmCustomeAssignParam param);

    R assignCompany(CrmCustomeAssignCompanyParam crmCustomer, String operUserName, Long operUserId);

    R assignCompanys(CrmCompanyAssignParam param, String operUserName, Long operUserId);


    int updateCrmCustomerSource(CrmCustomerEditSourceParam param);

    List<CrmCustomer> selectCrmCustomerListByIds(String customerIds);

    List<CrmCustomerExportVO> selectCrmCustomerExportListQuery(CrmCustomerListQueryParam param);

    List<CrmCustomerExportVO> selectCrmCustomerExportListByIds(Long[] customerIds);

    List<CrmCustomer> selectCrmCustomerListBySearch(CrmCustomerSearchParam param);

    int check(String customerCode);

    int checkCrmThirdFeiyuClue(CrmThirdFeiyuCluesSearchParam param);

    int updateBuyCount(Long customerId);

    String importVisitCustomer(List<CrmCustomerVisitImportParam> list, Long companyId);

    List<CrmCustomerNumStatisticsVO> selectCrmCustomerNumStatisticsList(CrmCustomerStatisticsParam param);

    List<JSONObject> selectCrmCustomerNumCounts(Map<String, Object> map);

    List<CrmCustomerRateStatisticsVO> selectCrmCustomerRateStatisticsList(CrmCustomerStatisticsParam param);

    List<JSONObject> selectCrmCustomerRateCounts(Map<String, Object> map);

    List<CrmCustomerSourceStatisticsVO> selectCrmCustomerSourceStatisticsList(CrmCustomerStatisticsParam param);

    List<CrmCustomerMapStatisticsVO> selectCrmCustomerMapStatisticsList(CrmCustomerStatisticsParam param);

    Map<String, Object> selectIndexData(CrmCustomerStatisticsParam param);

    List<CrmCustomerStatisticsVO> selectCrmCustomerFullStatisticsList(CrmCustomerStatisticsParam param);

    List<JSONObject> selectCustomerFullCounts(Map<String, Object> map);

    List<CrmCustomerCycleStatisticsVO> selectCrmCustomerCycleStatisticsList(CrmCustomerStatisticsParam param);

    List<JSONObject> selectCrmCustomerCycleCounts(Map<String, Object> map);
}
