package com.sptg.gateway.controller.estate;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.security.annotation.Security;
import com.sptg.estate.api.constant.EstateSecurityToken;
import com.sptg.pay.api.dto.PayCertificateDto;
import com.sptg.pay.api.entity.PayCertificate;
import com.sptg.pay.api.feigns.PayCertificateFeign;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author xuanyan
 * @date 2020/6/22 18:20
 */
@RestController
@RequestMapping("/estate/payCertificate")
@RequiredArgsConstructor
public class PayCertificateController {

    private final PayCertificateFeign payCertificateFeign;

    /**
     * 功能描述:支付凭证管理页面
     * @return ModelAndView
     *
     *
     */
    @GetMapping("/index")
    @Security(token = EstateSecurityToken.ESTATE_PAY_CERTIFICATE_MANAGE)
    public ModelAndView index(){
        return new ModelAndView("estate/pay-certificate-manage");
    }

    @GetMapping(value = "/showPayCertificatePage")
    public ResultBean<Page<PayCertificate>> showPayCertificatePage(PayCertificateDto dto, Page<PayCertificate> page){
        dto.setPage(page);
        return this.payCertificateFeign.showPayCertificatePage(dto);
    }
}
