package com.dsk.jsk.service;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.jsk.domain.bo.ComposeQueryDto;
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 BusinessOpportunityRadarService {

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;

    public AjaxResult jskBidNewsPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBid/news/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult findByName(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBid/news/findByName", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult jskBidTenderPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBidTender/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult establishmentPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/establishment/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult jskBidPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBid/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult landMarketPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/landMarket/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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

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

    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);
    }

    public AjaxResult bondProjectPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/bondProject/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    public AjaxResult jskBidPlanPage(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBidPlan/page", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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

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

    public AjaxResult bidSourceList(JSONObject object) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/jskBid/source", object);
        return BeanUtil.toBean(map, AjaxResult.class);
    }
}
