package com.ruoyi.novel.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//# 分账结算接口
// NovelFinanceController.java
@RestController
@RequestMapping("/finance")
public class NovelFinanceController {

    @Autowired
    private IFinanceService financeService;

    @GetMapping("/royalty")
    public AjaxResult getRoyalty(
            @RequestParam Long authorId,
            @RequestParam @DateTimeFormat(pattern="yyyy-MM") String month) {

        RoyaltyReport report = financeService.calculateRoyalty(authorId, month);
        return AjaxResult.success(report);
    }
}