package com.dsk.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.dtos.OpRegionalEconomicDataV1Dto;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.system.mapper.OpRegionalEconomicDataV1Mapper;
import com.dsk.system.service.EconomicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * @ClassName EconomicServiceImpl
 * @Description 经济大全实现
 * @Author Dgm
 * @Date 2023/5/18 10:23
 * @Version
 */
@Service
public class EconomicServiceImpl implements EconomicService {

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;

    @Autowired
    private OpRegionalEconomicDataV1Mapper mapper;

    @Override
    public AjaxResult nationalList(OpRegionalEconomicDataV1Dto dto) {
        // SELECT
        //	id,
        //	`year`,
        //	province,
        //	city,
        //	area,
        //	gdp,
        //	gdp_add_value,
        //	gdp_growth,
        //	gdp_per_capita,
        //	pi_add_value,
        //	si_add_value,
        //	ti_add_value,
        //	population,
        //	population_growth_rate,
        //	population_add_value,
        //	industry_add_value,
        //	industry_total_value,
        //	fixed_investment,
        //	real_estate_investment,
        //	exim_total_value,
        //	trscg,
        //	urban_pcdi,
        //	gbr,
        //	gbr_growth,
        //	tax_income,
        //	transfer_income,
        //	superior_subsidy_income,
        //	gbe,
        //	gov_fund_income,
        //	land_transfer_income,
        //	gov_fund_expenditure,
        //	soecoi,
        //	soecoe,
        //	gov_debt_balance,
        //	general_debt_balance,
        //	special_debt_balance,
        //	gov_debt_limit,
        //	uip_interest_bearing_debt,
        //	fiscal_self_sufficiency_rate,
        //	gov_debt_to_gdp_rate,
        //	gov_debt_to_gdp_rate_wild,
        //	gov_debt_rate,
        //	gov_debt_rate_wild,
        //	is_deal,
        //	is_statua
        //FROM
        //	`op_regional_economic_data_v1`;
        Map<String, Object> map = dskOpenApiUtil.requestBody("/xx",  BeanUtil.beanToMap(dto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult details(Integer id) {
        Map<String, Object> bodyMap = new HashMap<>(1);
        bodyMap.put("id", id);
        Map<String, Object> map = dskOpenApiUtil.requestBody("/xx", bodyMap);
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult statisticsRegional(OpRegionalEconomicDataV1Dto dto) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/xx",  BeanUtil.beanToMap(dto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult regionalList(OpRegionalEconomicDataV1Dto dto) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/xx",  BeanUtil.beanToMap(dto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

    @Override
    public AjaxResult regionalComparison(OpRegionalEconomicDataV1Dto dto) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/xx",  BeanUtil.beanToMap(dto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

}
