package com.dsk.system.dskService;

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.core.domain.model.*;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.utils.DskOpenApiUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @ClassName enterpriseService
 * @Description TODO
 * @Author Dgm
 * @Date 2023/5/15 12:00
 * @Version 1.0
 */
@Service
public class IndexService {

    private static final Logger log = LoggerFactory.getLogger(IndexService.class);

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;

    public R winningBidsRanking(Map<String, Object> paramMap) throws Exception {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterpriseProject/winningBidsRanking", paramMap);
        return BeanUtil.toBean(map, R.class);
    }

    public R rankingProjectType(Map<String, Object> paramMap) throws Exception {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterpriseProject/rankingProjectType", paramMap);
        return BeanUtil.toBean(map, R.class);
    }

    public TableDataInfo bigWinningBidsPage(IndexBigWinningBidsPageBody body) throws Exception {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterpriseProject/bigWinningBidsPage", BeanUtil.beanToMap(body, false, false));
        return dskOpenApiUtil.responsePage(map);
    }

    public TableDataInfo bigBidPage(IndexBigBidPageBody body) throws Exception {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterpriseProject/bigBidPage", BeanUtil.beanToMap(body, false, false));
        return dskOpenApiUtil.responsePage(map);
    }

    public R bigBidProjectType(Map<String, Object> paramMap) throws Exception {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterpriseProject/bigBidProjectType", paramMap);
        return BeanUtil.toBean(map, R.class);
    }

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

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