package com.dsk.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.dtos.SpecialBondInformationDetailsDto;
import com.dsk.common.dtos.SpecialBondInformationPageDto;
import com.dsk.common.dtos.SpecialPurposeBondsDto;
import com.dsk.common.dtos.SpecialPurposeBondsPageDto;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.system.service.SpecialPurposeBondsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @ClassName EconomicServiceImpl
 * @Description 专项债项目业务层实现
 * @Author Dgm
 * @Date 2023/5/18 10:23
 * @Version
 */
@Service
public class SpecialPurposeBondsServiceImpl implements SpecialPurposeBondsService {

    @Autowired
    private DskOpenApiUtil dskOpenApiUtil;

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

    @Override
    public AjaxResult details(SpecialBondInformationDetailsDto detailsDto) {
        Map<String, Object> map = dskOpenApiUtil.requestBody("/specialPurposeBonds/details", BeanUtil.beanToMap(detailsDto, false, false));
        return BeanUtil.toBean(map, AjaxResult.class);
    }

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

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