package com.dsk.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.dtos.UrbanInvestmentPlatformDto;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.system.service.UrbanInvestmentPlatformService;
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 UrbanInvestmentPlatformServiceImpl implements UrbanInvestmentPlatformService {

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;

    @Override
    public AjaxResult page(UrbanInvestmentPlatformDto pageDto) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/api/urbanInvestment/page", BeanUtil.beanToMap(pageDto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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

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