package com.dsk.web.controller.search.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.R;
import com.dsk.common.dtos.ComposeQueryDto;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.http.HttpUtils;
import com.dsk.web.controller.search.service.MarketAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Author liujie
 * @ClassName MarketAnalysisServiceImpl
 * @Date 2023/5/15 16:40
 **/
@Service
public class MarketAnalysisServiceImpl implements MarketAnalysisService {

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;
    @Override
    public AjaxResult areaGroupByProvince() {

        Map<String, Object> map = dskOpenApiUtil.requestBody("/marketAnalysis/areaGroupByProvince", null);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult certGroupByMajorAndLevel() {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/marketAnalysis/certGroupByMajorAndLevel", null);
        return BeanUtil.toBean(map, AjaxResult.class);
    }


    @Override
    public AjaxResult certGroupByMajorProvinceLevel()  {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/marketAnalysis/certGroupByMajorProvinceLevel", null);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult countGroupByProvince(ComposeQueryDto compose) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/marketAnalysis/countGroupByProvince", BeanUtil.beanToMap(compose, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult countGroupByMonth(ComposeQueryDto compose) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/marketAnalysis/countGroupByDate", BeanUtil.beanToMap(compose, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }
}
