package com.crm.manager.controller;

import com.crm.manager.service.ib.IndexFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.ib.daily.DailyDataDto;
import com.crm.rely.backend.core.dto.ib.index.IndexAmountDto;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.ib.daily.DailyDataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by max on 2020/8/18.
 */
@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IndexFeignService indexFeignService;

    @PostMapping("/daily/data")
    public BaseResultDto<List<DailyDataDto>> dailyData(@RequestBody DailyDataEntity entity, InfoEntity infoEntity) throws Exception {
        return indexFeignService.dailyData(entity);
    }

    /**
     * 首页客户数量和代理数量
     *
     * @param infoEntity
     * @return
     * @throws Exception
     */
    @PostMapping("/account")
    public BaseResultDto<IndexAmountDto> account(InfoEntity infoEntity) throws Exception {
        return indexFeignService.account();
    }


    /**
     * 首页月度信息
     *
     * @return
     * @throws Exception
     */
    @PostMapping("/amount")
    public BaseResultDto<DailyDataDto> amount(@RequestBody DailyDataEntity entity, InfoEntity infoEntity) throws Exception {
        return indexFeignService.amount(entity);
    }

}
