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

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.member.controller.app.business.vo.BusinessDataVO;
import cn.iocoder.yudao.module.member.service.storebusiness.StoreBusinessService;
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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "APP超市 - 超市营业统计")
@RestController
@RequestMapping("/member/store-business")
@Validated
public class AppStoreBusinessController {

    @Resource
    private StoreBusinessService storeBusinessService;

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

        return success(result);
    }

}