package cn.iocoder.yudao.module.member.controller.app.business;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.controller.admin.business.vo.BusinessRespVO;
import cn.iocoder.yudao.module.member.controller.app.business.vo.BusinessDataVO;
import cn.iocoder.yudao.module.member.dal.dataobject.business.BusinessDO;
import cn.iocoder.yudao.module.member.service.business.BusinessService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import java.util.ArrayList;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;


@Tag(name = "管理后台 - 营业统计")
@RestController
@RequestMapping("/t/business")
@Validated
public class AppBusinessController {

    @Resource
    private BusinessService businessService;



    @GetMapping("/data")
    @Operation(summary = "获得营业统计")
    public CommonResult<BusinessDataVO> getBusinessPage(String time,Long carteenId,Integer type) {
        BusinessDataVO result = new BusinessDataVO();
        switch (type){
            case 0:
                result = businessService.getDay(time, carteenId);
                break;
            case 1:
                result = businessService.getWeek(time, carteenId);
                break;
            case 2:
                result = businessService.getMonth(time, carteenId);
                break;
            default:
                break;
        }

        return success(result);
    }
}