package com.izouma.jiashanxia.web;

import com.izouma.jiashanxia.dto.StatisticDTO;
import com.izouma.jiashanxia.service.StatisticService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@AllArgsConstructor
@RestController
@RequestMapping("/statistic")
public class StatisticController {
    private final StatisticService statisticService;

    @ApiOperation("数据总浏")
    @GetMapping("/data")
    public Map<String, Object> dataOverview() {
        return statisticService.dataOverview();
    }

    @ApiOperation("金额日销售额")
    @GetMapping("/dayAdd")
    public List<StatisticDTO> dayAdd(Integer day) {
        return statisticService.dayData(day);
    }

    @ApiOperation("订单日销售额")
    @GetMapping("/dayAdd2")
    public List<StatisticDTO> dayAdd2(Integer day) {
        return statisticService.dayData2(day);
    }

    @ApiOperation("员工订单日销售")
    @GetMapping("/dayAddEmployee")
    public List<StatisticDTO> dayAddEmployee(String start, Long userId) {
        return statisticService.employeeOrder(start, userId);
    }

    @ApiOperation("员工订单金额日销售")
    @GetMapping("/dayAddEmployee1")
    public List<StatisticDTO> dayAddEmployee1(String start, Long userId) {
        return statisticService.employeeOrderFee(start, userId);
    }

    @ApiOperation("员工收益金额日销售")
    @GetMapping("/dayAddEmployee2")
    public List<StatisticDTO> dayAddEmployee2(String start, Long userId) {
        return statisticService.employeeCommission(start, userId);
    }

}
