package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.common.annotation.SysLog;
import com.kym.entity.admin.queryParams.CommonQueryParam;
import com.kym.service.miniapp.RefundLogService;
import com.kym.service.wechat.WxPayService;
import org.springframework.web.bind.annotation.*;

/**
 * @author skyline
 * @description 财务
 * @date 2023-09-14 16:21
 */
@RestController
@RequestMapping("/finance")
public class FinanceController {

    private final WxPayService wxPayService;

    private final RefundLogService refundLogService;

    public FinanceController(WxPayService wxPayService, RefundLogService refundLogService) {
        this.wxPayService = wxPayService;
        this.refundLogService = refundLogService;
    }

    @SysLog("退款申请列表")
    @GetMapping("/listRefundLog")
    R<?> listRefundLog(@ModelAttribute CommonQueryParam params) {
        return R.success(refundLogService.listRefundLog(params));
    }

    @SysLog("处理用户微信退款")
    @GetMapping("/customWxRefund/{refundLogId}")
    R<?> customWxRefund(@PathVariable("refundLogId") long refundLogId) {
        wxPayService.wxRefund(refundLogId);
        return R.success();
    }


}
