CustomerStatisticsMapper.java 6.87 KB
package cn.com.glsx.entmicro.mapper;

import cn.com.glsx.entmicro.entity.CustomerStatistics;
import cn.com.glsx.entmicro.model.CustomerStaticRequest;
import cn.com.glsx.entmicro.model.CustomerStatisticModel;
import cn.com.glsx.entmicro.model.response.*;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface CustomerStatisticsMapper extends CommonBaseMapper<CustomerStatistics> {
    @MapKey("dateTime")
    Map<String, ChartDayResponse> getDaysDataByMerchantIds(@Param("dates") List<String> dates, @Param("merchantIds") List<Integer> merchantIds);

    ShopCollectViewResponse getShopCollectViewByMerchantIds(@Param("date") Date date, @Param("merchantIds") List<Integer> merchantIds);

    StoreCollectViewResponse getStoreCollectViewByMerchantIds(@Param("date") Date date, @Param("merchantIds") List<Integer> merchantIds);

    @MapKey("dateTime")
    Map<String, ShopLineChart> getShopLineChartByMerchantIds(@Param("dates") List<String> dates, @Param("merchantIds") List<Integer> merchantIds);

    List<ShopCustSort> getShopCustSortAdd(@Param("merchantIds") List<Integer> merchantIds);

    List<ShopCustSort> getShopCustSortAddActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    List<ShopCustSort> getShopCustSortYesterAdd(@Param("merchantIds") List<Integer> merchantIds);

    List<ShopCustSort> getShopCustSortDayAddActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    List<ShopCustSort> getShopCustSortLose(@Param("merchantIds") List<Integer> merchantIds);

    List<ShopCustSort> getShopCustSortLoseActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天之前客户
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getCustomerBeforeYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时客户,<=dateTime
    Integer getCustomerCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时客户,=dateTime
    Integer getCustomerDateTimeCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天新增客户
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getCustomeYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天之前企微客户数
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getEntmicroCustomerBeforeYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时企微客户数,<=dateTime
    Integer getEntmicroCustomerCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时企微客户数 =dateTime
    Integer getEntmicroCustomerDayTimeCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天新增企微客户数
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getEntmicroCustomerYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天之前流失客户数
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getLostCustomerBeforeYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时流失客户数 <=dateTime
    Integer getLostCustomerCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //实时流失客户数 =dateTime
    Integer getLostCustomerDateTimeCountActual(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    //商户号,昨天流失企微客户数
    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> getLostCustomerYesterDayCount(@Param("merchantIds") List<Integer> merchantIds, @Param("dateTime") String dateTime);

    @MapKey("dateTime")
    Map<String, LineChartMonthResponse> getCustMonthsCount(@Param("merchantIds") List<Integer> merchantIds, @Param("months") Set<String> months);

    CustomerStatisResponse getPurposeAndPurchaseYester(@Param("merchantIds") List<Integer> merchantIds);

    CustomerStatisResponse getPurposeAndPurchaseToday(@Param("merchantIds") List<Integer> merchantIds);

    CustomerYesterStatisResponse getCustomerToday(@Param("merchantIds") List<Integer> merchantIds);

    CustomerYesterStatisResponse getCustomerYesterday(@Param("merchantIds") List<Integer> merchantIds);

    String getCreateCustomerMinDay(@Param("datalist") List<Integer> datalist);

    List<Integer> findFirst(@Param("minDay") String minDay, @Param("datalist") List<Integer> datalist);

    List<String> getExistDates(@Param("datalist") List<Integer> datalist);

    @MapKey("merchantId")
    Map<Integer, CustomerStatistics> findStaticsDataByDate(@Param("datalist") List<String> datalist, @Param("dateTime") String dateTime);

    int batchUpdate(@Param("datalist") List<CustomerStatistics> datalist);

    List<CustomerStatisticModel> findCustomerStatistic(@Param("customerStaticRequest") CustomerStaticRequest customerStaticRequest);

    List<CustomerStatisticModel> findLostCustomerStatistic(@Param("customerStaticRequest") CustomerStaticRequest customerStaticRequest);

    @MapKey("dateTime")
    Map<String, Map> getDaysAddCountDataByMerchantIds(@Param("dates") List<String> dates, @Param("merchantIds") List<Integer> merchantIds);

    @MapKey("dateTime")
    Map<String, Map> getDaysAddEntCountDataByMerchantIds(@Param("dates") List<String> dates, @Param("merchantIds") List<Integer> merchantIds);

    @MapKey("dateTime")
    Map<String, Map> getDaysLostEntCountDataByMerchantIds(@Param("dates") List<String> dates, @Param("merchantIds") List<Integer> merchantIds);

    /**
     * 查询活码客户新增数据
     *
     * @param customerStaticRequest
     * @return
     */
    List<CustomerStatisticModel> findCodeStatistic(@Param("customerStaticRequest") CustomerStaticRequest customerStaticRequest);

    @MapKey("dateTime")
    Map<String, Map> getMonAddCountDataByMerchantIds(@Param("months") Set<String> months, @Param("merchantIds") List<Integer> merchantIds);

    @MapKey("dateTime")
    Map<String, Map> getMonAddEntCountDataByMerchantIds(@Param("months") Set<String> months, @Param("merchantIds") List<Integer> merchantIds);

    @MapKey("dateTime")
    Map<String, Map> getMonLostEntCountDataByMerchantIds(@Param("months") Set<String> months, @Param("merchantIds") List<Integer> merchantIds);

    List<CustomerStatisticModel> findCustomerStatisticGroupMerchantId(@Param("customerStaticRequest") CustomerStaticRequest customerStaticRequest);
}