/**
 * @filename:PaymentBasicController 2024-10-28
 * @project KJT v1.1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.admin.business.payment.controller;

import com.trade.admin.business.payment.dto.PaymentApproveDto;
import com.trade.admin.business.payment.dto.PaymentSearchDto;
import com.trade.admin.business.payment.service.PaymentBasicService;
import com.trade.admin.business.payment.vo.PaymentDetailPageVo;
import com.trade.admin.business.payment.vo.PaymentOperatePageVo;
import com.trade.admin.business.payment.vo.PaymentPageVo;
import com.trade.common.core.domain.ResponseResult;
import com.trade.common.core.page.GridPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;

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

/**
 * <p>
 * 说明： 支付基础表API接口层
 * </P>
 * 
 * @version: v1.1.0
 * @author: wanglang
 * @time 2024-10-28
 */
@Api(tags = "支付管理", value = "支付管理")
@RestController
@RequestMapping("/paymentBasic")
public class PaymentBasicController {

    @Resource
    private PaymentBasicService paymentBasicService;

    /**
     * 获取支付列表分页信息
     *
     * @param searchDto 支付列表分页信息条件
     * @return 支付列表分页信息
     */
    @ApiOperation(value = "获取支付分页", notes = "获取支付分页")
    @PostMapping("/get/page")
    @PreAuthorize("@ss.hasPermi('business.payment:pages')")
    public ResponseResult<GridPage<PaymentPageVo>> getPaymentPage(@RequestBody PaymentSearchDto searchDto) {
        return ResponseResult.success(paymentBasicService.queryListByPage(searchDto));
    }

    /**
     * 获取支付编辑信息
     *
     * @param id 主键id
     * @return 支付编辑信息
     */
    @ApiOperation(value = "获取支付编辑信息", notes = "获取支付编辑信息")
    @GetMapping("/get/editPage")
    @PreAuthorize("@ss.hasPermi('business.payment:editPage')")
    public ResponseResult<PaymentOperatePageVo> getPaymentEditPage(Long id) {
        return ResponseResult.success(paymentBasicService.getPaymentOperatePage(id));
    }

    /**
     * 获取支付审批信息
     *
     * @param id 主键id
     * @return 支付审批信息
     */
    @ApiOperation(value = "获取支付审批信息", notes = "获取支付审批信息")
    @GetMapping("/get/approvePage")
    @PreAuthorize("@ss.hasPermi('business.payment:approvePage')")
    public ResponseResult<PaymentOperatePageVo> getPaymentApprovePage(Long id) {
        return ResponseResult.success(paymentBasicService.getPaymentOperatePage(id));
    }

    /**
     * 获取支付详情信息
     *
     * @param id 主键id
     * @return 支付详情信息
     */
    @ApiOperation(value = "获取支付详情信息", notes = "获取支付详情信息")
    @GetMapping("/get/detailPage")
    @PreAuthorize("@ss.hasPermi('business.payment:detailPage')")
    public ResponseResult<PaymentDetailPageVo> getPaymentDetailPage(Long id) {
        return ResponseResult.success(paymentBasicService.getPaymentDetailPage(id));
    }

    /**
     * 审批支付操作接口
     *
     * @param approveDto 审批信息
     * @return true/false
     */
    @ApiOperation(value = "审批支付操作接口", notes = "审批支付操作接口")
    @PostMapping("/approve")
    @PreAuthorize("@ss.hasPermi('business.payment:approve')")
    public ResponseResult<Boolean> approvePayment(@RequestBody @Valid PaymentApproveDto approveDto) {
        return ResponseResult.success(paymentBasicService.approvePayment(approveDto));
    }
}
