package com.brilliance.isc.common.whj.service.impl;

import com.brilliance.isc.common.esb.finance.IFinanceFeign;
import com.brilliance.isc.common.whj.service.WhjZxbInterService;
import com.brilliance.isc.common.whj.vo.InvoicesNoticesQueryVo;
import com.brilliance.isc.common.whj.vo.NoticeInvoicesQueryVo;
import com.brilliance.isc.esb.model.inner.InnerReq;
import com.brilliance.isc.esb.model.inner.InnerReqWhj;
import com.brilliance.isc.esb.model.inner.InnerRes;
import com.brilliance.isc.esb.model.inner.InnerResWhj;
import com.brilliance.isc.esb.model.whj.ReqMsgData;
import com.brilliance.isc.esb.model.whj.content.sinosure.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WhjZxbInterServiceImpl implements WhjZxbInterService {

    @Autowired(required = false)
    private IFinanceFeign financeFeign;

    @Override
    public InnerRes<InnerResWhj> qureyInvoicesNotices(InvoicesNoticesQueryVo invoicesNoticesQueryVo) {
        InvoicesNoticesContent invoicesNoticesContent = new InvoicesNoticesContent();
        invoicesNoticesContent.setInvoiceIds(invoicesNoticesQueryVo.getInelst());
        invoicesNoticesContent.setPolicyNo(invoicesNoticesQueryVo.getPolicyNo());

        ReqMsgData<InvoicesNoticesContent> reqMsgData = new ReqMsgData<>(invoicesNoticesContent);
        reqMsgData.method = "/v1/asset/invoices-notices";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> qureyNoticeInvoices(NoticeInvoicesQueryVo noticeInvoicesQueryVo) {
        NoticeInvoicesContent noticeInvoicesContent = new NoticeInvoicesContent();
        noticeInvoicesContent.setNoticeId(noticeInvoicesQueryVo.getNoticeId());
        noticeInvoicesContent.setPolicyNo(noticeInvoicesQueryVo.getPolicyNo());

        ReqMsgData<NoticeInvoicesContent> reqMsgData = new ReqMsgData<>(noticeInvoicesContent);
        reqMsgData.method = "/v1/asset/notice-invoices";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoBankApply(SinoBankApplyContent sinoBankApplyContent) {
        ReqMsgData<SinoBankApplyContent> reqMsgData = new ReqMsgData<>(sinoBankApplyContent);
        reqMsgData.method = "/v1/asset/bank-apply";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> bankApplySupplement(BankApplySupplementContent bankApplySupplementContent) {
        ReqMsgData<BankApplySupplementContent> reqMsgData = new ReqMsgData<>(bankApplySupplementContent);
        reqMsgData.method = "/v1/asset/bank-apply-supplement";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoCheck(SinoCheckContent sinoCheckContent) {
        ReqMsgData<SinoCheckContent> reqMsgData = new ReqMsgData<>(sinoCheckContent);
        reqMsgData.method = "/v1/asset/check";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> applyNotice(ApplyNoticeContent applyNoticeContent) {
        ReqMsgData<ApplyNoticeContent> reqMsgData = new ReqMsgData<>(applyNoticeContent);
        reqMsgData.method = "/v1/asset/applyNotice";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoPay(SinoPayContent sinoPayContent) {
        ReqMsgData<SinoPayContent> reqMsgData = new ReqMsgData<>(sinoPayContent);
        reqMsgData.method = "/v1/asset/directLink/pay";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoRecOnce(SinoRecOnceContent sinoRecOnceContent) {
        ReqMsgData<SinoRecOnceContent> reqMsgData = new ReqMsgData<>(sinoRecOnceContent);
        reqMsgData.method = "/v1/asset/directLink/recOnce";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoCorrect(SinoCorrectContent sinoCorrectContent) {
        ReqMsgData<SinoCorrectContent> reqMsgData = new ReqMsgData<>(sinoCorrectContent);
        reqMsgData.method = "/v1/asset/correct";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoDetail(SinoCheckContent SinoCheckContent) {
        ReqMsgData<SinoCheckContent> reqMsgData = new ReqMsgData<>(SinoCheckContent);
        reqMsgData.method = "/v1/asset/detail";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoRetry(SinoCheckContent SinoCheckContent) {
        ReqMsgData<SinoCheckContent> reqMsgData = new ReqMsgData<>(SinoCheckContent);
        reqMsgData.method = "/v1/asset/retry";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> changeToExport(SinoCheckContent SinoCheckContent) {
        ReqMsgData<SinoCheckContent> reqMsgData = new ReqMsgData<>(SinoCheckContent);
        reqMsgData.method = "/v1/asset/change-to-export";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> bankApplyUpdate(BankApplyUpdateContent bankApplyUpdateContent) {
        ReqMsgData<BankApplyUpdateContent> reqMsgData = new ReqMsgData<>(bankApplyUpdateContent);
        reqMsgData.method = "/v1/asset/bank-apply-update";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> sinoAbandon(SinoAbandonContent sinoAbandonContent) {
        ReqMsgData<SinoAbandonContent> reqMsgData = new ReqMsgData<>(sinoAbandonContent);
        reqMsgData.method = "/v1/asset/abandon";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }

    @Override
    public InnerRes<InnerResWhj> rejectAccept(SinoAcceptContent sinoAcceptContent) {
        ReqMsgData<SinoAcceptContent> reqMsgData = new ReqMsgData<>(sinoAcceptContent);
        reqMsgData.method = "/v1/asset/reject-accept";
        reqMsgData.service = "SINOSURE";
        reqMsgData.bankSafeCode = "";

        InnerReqWhj innerReqWhj = new InnerReqWhj();
        innerReqWhj.serviceType = "SINOSUREREQ";
        innerReqWhj.reqMsgData = reqMsgData;

        InnerReq<InnerReqWhj> innerReqWhjInnerReq = new InnerReq<>(innerReqWhj);

        InnerRes<InnerResWhj> innerRes = financeFeign.callWhj(innerReqWhjInnerReq);

        return innerRes;
    }
}
