/**
 * @filename:0ayableAccountsController 2024-11-05
 * @project KJT v1.1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.client.accounts.payableaccounts.controller;

import com.trade.client.accounts.payableaccounts.dto.PaymentConfirmDto;
import com.trade.client.accounts.payableaccounts.service.BPayableAccountsService;
import com.trade.client.accounts.payableaccounts.vo.PayableAccountsDetail;
import com.trade.common.core.domain.ResponseResult;
import com.trade.common.core.page.GridPage;
import com.trade.service.business.payableaccounts.domain.PayableAccounts;
import com.trade.service.business.payableaccounts.dto.PayableAccountsSearchDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;

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

/**
 * <p>
 * </p>
 * <p>
 * 说明： 应付账款表API接口层
 * </P>
 * 
 * @version: v1.1.0
 * @author: wanglang
 * @time 2024-11-05
 */
@Api(tags = "应付账款关联表", value = "应付账款关联表")
@RestController
@RequestMapping("/payableAccounts")
public class PayableAccountsController {

    @Resource
    private BPayableAccountsService bPayableAccountsService;

    /**
     * 获取我的付款列表分页
     *
     * @param searchDto 我的付款列表分页信息条件
     * @return 我的付款列表分页信息
     */
    @ApiOperation(value = "获取我的付款列表分页", notes = "获取我的付款列表分页")
    @PostMapping("/get/page")
    public ResponseResult<GridPage<PayableAccounts>> queryListByPage(@RequestBody PayableAccountsSearchDto searchDto) {
        return ResponseResult.success(bPayableAccountsService.queryListByPage(searchDto));
    }

    /**
     * 提交付款确认
     *
     * @param paymentConfirmDto 付款确认信息
     * @return true/false
     */
    @ApiOperation(value = "提交付款确认", notes = "提交付款确认")
    @PostMapping("/submit")
    public ResponseResult<Boolean> queryListByPage(@RequestBody @Valid PaymentConfirmDto paymentConfirmDto) {
        return ResponseResult.success(bPayableAccountsService.submitPaymentConfirm(paymentConfirmDto));
    }

    /**
     * 查询付款记录详情
     *
     * @param id 我的详情id
     * @return 查询付款记录详情
     */
    @ApiOperation(value = "查询付款记录详情", notes = "查询付款记录详情")
    @GetMapping("/get/detail")
    public ResponseResult<PayableAccountsDetail> queryDetail(Long id) {
        return ResponseResult.success(bPayableAccountsService.queryDetail(id));
    }
}
