package com.uas.platform.b2b.publicapi.controller;

import com.uas.platform.b2b.publicapi.model.Turnover;
import com.uas.platform.b2b.publicapi.service.TurnoverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ERP查询平台贸易数据
 *
 * Created by hejq on 2018-05-31.
 */
@RequestMapping("/public/turnover")
@RestController
public class TurnoverController {

    @Autowired
    private TurnoverService turnoverService;

    /**
     * 获取年度代采订单交易额
     *
     * @return
     */
    @RequestMapping(value = "/substitute", method = RequestMethod.GET)
    public List<Turnover> findSubstitute() {
        return turnoverService.findSubstitute();
    }

    /**
     * 获取年度代采订单交易额
     *
     * @return
     */
    @RequestMapping(value = "/substitute/RMB", method = RequestMethod.GET)
    public List<Turnover> findRMBSubstitute() {
        return turnoverService.findSubstituteByRMB();
    }

    /**
     * B2B年度交易总额折合RMB
     *
     * @return
     */
    @RequestMapping(value = "/orderAmount/RMB", method = RequestMethod.GET)
    public List<Turnover> findRMBOrderAmount() {
        return turnoverService.findRMBOrderAmount();
    }

    /**
     * B2B商务本年度交易总金额
     *
     * @return
     */
    @RequestMapping(value = "/orderAmount", method = RequestMethod.GET)
    public List<Turnover> findOrderAmount() {
        return turnoverService.findOrderAmount();
    }

    /**
     *上月订单交易额汇总
     *
     * @return
     */
    @RequestMapping(value = "/orderAmount/lastMonth", method = RequestMethod.GET)
    public List<Turnover> findLastMonthOrderAmount() {
        return turnoverService.findLastMonthOrderAmount();
    }

    /**
     * 上月订单数
     *
     * @return
     */
    @RequestMapping(value = "/orderCount/lastMonth", method = RequestMethod.GET)
    public List<Turnover> findLastMonthOrderCount() {
        return turnoverService.findLastMonthOrderCount();
    }

    /**
     *订单交易额汇总
     *
     * @return
     */
    @RequestMapping(value = "/orderAmount/thisMonth", method = RequestMethod.GET)
    public List<Turnover> findThisMonthOrderAmount() {
        return turnoverService.findThisMonthOrderAmount();
    }

    /**
     * 上月订单数
     *
     * @return
     */
    @RequestMapping(value = "/orderCount/thisMonth", method = RequestMethod.GET)
    public List<Turnover> findThisMonthOrderCount() {
        return turnoverService.findThisMonthOrderCount();
    }
}
