package com.sckw.payment.controller;

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

/**
 * 结算-线下记录（交易订单结算/物流订单结算）
 *
 * @author Aick Spt
 * @date 2023-07-20 11:42
 */
@RestController
@RequestMapping(name = "结算-线下记录", path = "/kwpSettlementOffline")
public class KwpSettlementOfflineController {

    @Resource
    private KwpSettlementOfflineService kwpSettlementOfflineService;

    //  =========  运费收款  =========

    @PostMapping(name = "物流-线下付款(运费收款)记录-列表", path = "pageListLogisticsCollection")
    public HttpResult pageListLogisticsCollection(@RequestBody @Valid SettlementOfflineReq settlementOfflineReq) {
        return HttpResult.ok(kwpSettlementOfflineService.pageListLogisticsCollection(settlementOfflineReq));
    }

    @GetMapping(name = "物流-线下付款(运费收款)记录-详情", path = "detailLogisticsCollection")
    public HttpResult detailLogisticsCollection(@RequestParam("id") Long id) {
        return HttpResult.ok(kwpSettlementOfflineService.detailLogisticsCollection(id));
    }

    @GetMapping(name = "物流-线下付款(运费收款)记录-新增", path = "confirmLogisticsCollection")
    public HttpResult confirmLogisticsCollection(@RequestParam("id") Long id, @RequestParam("price") Float price) {
        return HttpResult.ok(kwpSettlementOfflineService.confirmLogisticsCollection(id, price));
    }


    //  =========  销售收款  =========

    @PostMapping(name = "交易-线下付款(销售收款)记录-列表", path = "pageListTradeCollection")
    public HttpResult pageListTradeCollection(@RequestBody @Valid SettlementOfflineReq settlementOfflineReq) {
        return HttpResult.ok(kwpSettlementOfflineService.pageListTradeCollection(settlementOfflineReq));
    }

    @GetMapping(name = "交易-线下付款(销售收款)记录-新增",path = "confirmTradeCollection")
    public HttpResult confirmTradeCollection(@RequestParam("id") Long id,@RequestParam("price") Float price){
        return HttpResult.ok(kwpSettlementOfflineService.confirmTradeCollection(id,price));
    }

}
