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

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONObject;
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("/nationzj/marketAnalysis/areaGroupByProvince", null);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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


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


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

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

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