package com.benyun.core.controller;

import com.benyun.core.entity.bo.BrandSearch;
import com.benyun.core.entity.vo.BrandListQueryBody;
import com.benyun.core.service.BrandService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/brand")
public class BrandController extends BaseController {
    @Autowired
    private BrandService brandService;

//    获取品牌信息列表
    @GetMapping("/search")
    public R search(String text){
        List<BrandSearch> list = brandService.searchByLikeName(text);
        return R.ok(list);
    }

//    获取品牌信息列表
    @GetMapping("/list")
    public R list(BrandListQueryBody body){
        return R.ok(brandService.searchListByMulti(body));
    }

//    获取品牌详细信息
    @GetMapping("/info")
    public R info(String brandId){
        return R.ok(brandService.searchByBrandId(brandId));
    }

//    获取品牌物业信息
    @GetMapping("/property")
    public R property(String brandId){
        return R.ok(brandService.searchPropertyByBrandId(brandId));
    }

//    获取品牌城市分布词云
    @GetMapping("/distribution")
    public R distribution(String brandId){
        return R.ok(brandService.searchDisCloudByBrandId(brandId));
    }

//    获取相似品牌
    @GetMapping("/similar")
    public R similar(String brandId){
        return R.ok(brandService.searchSimilarByBrandId(brandId));
    }

//    获取品牌网点营业状态分布
    @GetMapping("/status")
    public R statusDistribution(String brandId){
        return R.ok(brandService.searchStatusByBrandId(brandId));
    }

//    获取品牌网点地图信息
    @GetMapping("/area")
    public R area(String brandId){
        return R.ok(brandService.searchProvinceByBrandId(brandId));
    }

//    获取品牌网点数量及其城市数量分布
    @GetMapping("/shopCount")
    public R shopCount(String brandId){
        return R.ok(brandService.searchDistributionByBrandId(brandId));
    }

//    获取所有品牌网点数量
    @GetMapping("/total")
    public R total(){
        return R.ok(brandService.searchTotal());
    }

//    获取品牌均分分布
    @GetMapping("/average")
    public R average(String brandId){
        return R.ok(brandService.searchAvgScoreByBrandId(brandId));
    }

//    获取各地区品牌网点数量分布情况
    @GetMapping("/countDistribution")
    public R categoryDis(BrandListQueryBody body){
        List<String> addrCode = body.getAddrCode();
        return R.ok(brandService.searchAddrDistribution(addrCode));
    }
}
