package com.benyun.core.service;

import com.benyun.core.entity.bo.BrandAddrDistribution;
import com.benyun.core.entity.bo.BrandSearch;
import com.benyun.core.entity.vo.BrandListQueryBody;
import com.github.pagehelper.PageInfo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;
import java.util.List;

@SpringBootTest
public class BrandServiceImplTest {
    @Autowired
    BrandService brandService;

    @Test
    public void searchByLikeNameTest(){
        List<BrandSearch> list = brandService.searchByLikeName("益禾堂");
        System.out.println(list);
        list = brandService.searchByLikeName("sdfasdfasdf");
        System.out.println(list);
    }

    @Test
    public void searchInfoByBrandIdTest(){
        String brandId1 = "0b793eea1b4d414ca163a1151e730daa";
        System.out.println(brandService.searchByBrandId(brandId1));
        String brandId2 = "0b793eea1b4d4";
        System.out.println(brandService.searchByBrandId(brandId2));
    }

    @Test
    public void searchPropertyByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchPropertyByBrandId(brandId1));
    }

    @Test
    public void searchSimilarByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchSimilarByBrandId(brandId1));
    }

    @Test
    public void searchStatusByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchStatusByBrandId(brandId1));
    }

    @Test
    public void searchDistributionByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchDistributionByBrandId(brandId1));
    }

    @Test
    public void searchProvinceByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchProvinceByBrandId(brandId1));
    }

    @Test
    public void searchDisCloudByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchDisCloudByBrandId(brandId1));
    }

    @Test
    public void searchListByMultiTest(){
        BrandListQueryBody body = new BrandListQueryBody();
        body.setText("益禾堂");
        List<String> industryCode = new ArrayList<>();
        industryCode.add("199");
        industryCode.add("28");
        body.setIndustryCode(industryCode);
        List<String> wdCount = new ArrayList<>();
        wdCount.add("1");
        wdCount.add("99999");
        body.setWdCount(wdCount);
        List<String> coverCityCount = new ArrayList<>();
        coverCityCount.add("1");
        coverCityCount.add("999");
        body.setCoverCityCount(coverCityCount);
//        "check_first_time"：最近更新
//        "total"：网点数量
//        "custom"：智能排序
        body.setOrderBy("check_first_time");
        body.setPageNum(1);
        body.setPageSize(10);
        PageInfo<List<BrandSearch>> list = brandService.searchListByMulti(body);
        System.out.println(list);
    }

    @Test
    public void searchTotalTest(){
        System.out.println(brandService.searchTotal());
    }

    @Test
    public void searchAvgScoreByBrandIdTest(){
        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
        System.out.println(brandService.searchAvgScoreByBrandId(brandId1));
    }

    @Test
    public void searchAddrTypeDisByMultiTest(){
        List<String> addrCodes = new ArrayList<>();
        addrCodes.add("410105000000");
        addrCodes.add("420111000000");
        List<BrandAddrDistribution> list = brandService.searchAddrDistribution(addrCodes);
        System.out.println(list);
    }
}
