package com.sckw.payment.controller;

import com.sckw.core.web.response.HttpResult;
import com.sckw.payment.model.vo.req.SettlementReq;
import com.sckw.payment.model.vo.req.SettlementWalletReq;
import com.sckw.payment.service.KwpSettlementWalletService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * 结算-电子钱包结算记录（交易订单结算/物流订单结算）
 *
 * @author Aick Spt
 * @date 2023-07-20 14:42
 */
@RestController
@RequestMapping(name = "结算-电子钱包结算记录", path = "/kwpSettlementWallet")
public class KwpSettlementWalletController {

    //  =========  物流付款  =========

    @Resource
    private KwpSettlementWalletService kwpSettlementWalletService;

    @PostMapping(name = "物流-电子钱包付款（货到付款）结算记录-列表", path = "pageListLogisticsPayment")
    public HttpResult pageListLogisticsPayment(SettlementWalletReq settlementWalletReq) {
        return HttpResult.ok(kwpSettlementWalletService.pageListLogisticsPayment(settlementWalletReq));
    }

    @GetMapping(name = "物流-电子钱包付款（货到付款）结算记录-详情", path = "detailLogisticsPayment")
    public HttpResult detailLogisticsPayment(@RequestParam("id") Long id) {
        return HttpResult.ok(kwpSettlementWalletService.detailLogisticsPayment(id));
    }

    /**
     * @param id    结算单id
     * @param price 本次付款金额
     * @author Aick Spt
     * @date 2023-07-25 09:55
     */
    @GetMapping(name = "物流-电子钱包付款（货到付款）结算记录-新增", path = "confirmLogisticsPayment")
    public HttpResult confirmLogisticsPayment(@RequestParam("id") Long id, @RequestParam("price") Float price) {
        return HttpResult.ok(kwpSettlementWalletService.confirmLogisticsPayment(id, price));
    }



    //  =========  销售收付款  =========
    @PostMapping(name = "销售-付款记录列表（采购电子钱包结算记录）", path = "pageListTradePayment")
    public HttpResult pageListTradePayment(SettlementWalletReq settlementWalletReq) {
        return HttpResult.ok(kwpSettlementWalletService.pageListTradePayment(settlementWalletReq));
    }

    /**
     * @param id    结算单id
     * @param price 本次付款金额
     * @author Aick Spt
     * @date 2023-07-25 09:55
     */
    @GetMapping(name = "销售-付款确认-(新增电子钱包记录-采购货到付款)", path = "confirmTradePayment")
    public HttpResult confirmTradePayment(@RequestParam("id") Long id, @RequestParam("price") Float price) {
        return HttpResult.ok(kwpSettlementWalletService.confirmTradePayment(id, price));
    }

    @PostMapping(name = "销售-收款记录列表-预付款(电子钱包)", path = "pageListTradeCollection")
    public HttpResult pageListTradeCollection(SettlementWalletReq settlementWalletReq) {
        return HttpResult.ok(kwpSettlementWalletService.pageListTradeCollection(settlementWalletReq));
    }

    /**
     * @param id    结算单id
     * @param price 本次付款金额
     * @author Aick Spt
     * @date 2023-07-25 09:55
     */
    @GetMapping(name = "销售-收款确认-预付款(电子钱包)", path = "confirmTradeCollection")
    public HttpResult confirmTradeCollection(@RequestParam("id") Long id, @RequestParam("price") Float price) {
        return HttpResult.ok(kwpSettlementWalletService.confirmTradeCollection(id, price));
    }


}
