package com.yida.data.mall.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.mall.service.EduBillStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 缴费账单统计 Controller(不鉴权)
 *
 * @author ZYJ
 * @date 2022/7/28
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "缴费账单统计")
@RequestMapping("in/bill/billStatistics")
public class InEduBillStatisticsController {

    private final EduBillStatisticsService eduBillStatisticsService;

    @GetMapping(value = "updateBillStatistics")
    @ApiOperation(value = "更新缴费统计数据")
    public ResultBean<String> updateBillStatistics() {
        eduBillStatisticsService.updateBillStatistics();
        return ResultBean.buildSuccess();
    }

    @GetMapping(value = "updateBillPayDetail")
    @ApiOperation(value = "更新缴费账单明细数据")
    public ResultBean<String> updateBillPayDetail() {
        eduBillStatisticsService.updateBillPayDetail(null);
        return ResultBean.buildSuccess();
    }

    @GetMapping(value = "updateChooseBillPayDetail")
    @ApiOperation(value = "更新指定缴费账单明细数据")
    public ResultBean<String> updateChooseBillPayDetail(@RequestParam Long billId) {
        eduBillStatisticsService.updateBillPayDetail(billId);
        return ResultBean.buildSuccess();
    }
}
