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.dtos.ComposeQueryDto;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.web.controller.search.service.BusinessOpportunityRadarService;
import com.dsk.web.controller.search.service.MarketAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

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

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;


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


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

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

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

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

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

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


    @Override
    public AjaxResult enterpriseByName(String keyword){
        Map<String,Object> params = new HashMap<>();
        params.put("keyword",keyword);
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/enterprice/findByName", params);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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

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

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

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

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