package cn.superdesk.uniorder.dubbo.consumer.thirdpart.szhtxx.electronicInvoice;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.invoice.customer.InvoiceApply;
import cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify;
import cn.superdesk.uniorder.dao.entity.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxx;
import cn.superdesk.uniorder.dto.param.thirdpart.szhtxx.common.singleBilling.SzhtxxInvoiceFptxxOpSingleBillingForm;
import cn.superdesk.uniorder.dto.param.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxOpSendEmailPdfAttachmentForm;
import cn.superdesk.uniorder.dto.param.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxParam;
import cn.superdesk.uniorder.dto.param.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxQueryCriteria;
import cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxDetailVo;
import cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxHeadDataVo;
import cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxListItemVo;
import cn.superdesk.uniorder.dubbo.facade.thirdpart.szhtxx.electronicInvoice.DubboSzhtxxElectronicInvoiceFptxxService;
import cn.superdesk.uniorder.openapicall.thirdpart.szhtxx.electronicInvoice.dto.request.SingleBillingRequestBodyKpContent;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: linjinyu
 * @Email linjinyu@avic-s.com
 * @CreateDate: 2022-01-24 11:50:43
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022-01-24 11:50:43
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Component
public class SzhtxxElectronicInvoiceFptxxDubboConsumerService {

    @Reference(version = "1.0.0", timeout = 60000, retries = -1)
    private DubboSzhtxxElectronicInvoiceFptxxService dubboSzhtxxElectronicInvoiceFptxxService;


    /****************************************** extends BaseService 部分 start ******************************************/

    public int insertSelective(SzhtxxElectronicInvoiceFptxx entity) {

        return dubboSzhtxxElectronicInvoiceFptxxService.insertSelective(entity);

    }

    public int updateByPrimaryKeySelective(SzhtxxElectronicInvoiceFptxx entity) {

        return dubboSzhtxxElectronicInvoiceFptxxService.updateByPrimaryKeySelective(entity);
    }

    public void deleteObj(Long id) {

        dubboSzhtxxElectronicInvoiceFptxxService.deleteObj(id);
    }

    public SzhtxxElectronicInvoiceFptxx findById(Long id) {

        return dubboSzhtxxElectronicInvoiceFptxxService.findById(id);
    }

    public PageInfo<SzhtxxElectronicInvoiceFptxx> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize) {

        return dubboSzhtxxElectronicInvoiceFptxxService.findByPaging(conditions, pageNun, pageSize);
    }

    public List<SzhtxxElectronicInvoiceFptxx> findAll(Map<String, Object> queryMap) {

        return dubboSzhtxxElectronicInvoiceFptxxService.findAll(queryMap);
    }

    /****************************************** extends BaseService 部分   end ******************************************/


    public int addSzhtxxElectronicInvoiceFptxx(SzhtxxElectronicInvoiceFptxxParam param) {

        return dubboSzhtxxElectronicInvoiceFptxxService.addSzhtxxElectronicInvoiceFptxx(param);
    }


    public int updateSzhtxxElectronicInvoiceFptxx(SzhtxxElectronicInvoiceFptxxParam param) {

        return dubboSzhtxxElectronicInvoiceFptxxService.updateSzhtxxElectronicInvoiceFptxx(param);
    }


    public int deleteSzhtxxElectronicInvoiceFptxx(Long id) {
        return dubboSzhtxxElectronicInvoiceFptxxService.deleteSzhtxxElectronicInvoiceFptxx(id);
    }


    public SzhtxxElectronicInvoiceFptxx findSzhtxxElectronicInvoiceFptxxById(Long id) {

        return dubboSzhtxxElectronicInvoiceFptxxService.findSzhtxxElectronicInvoiceFptxxById(id);
    }


    public R<List<SzhtxxElectronicInvoiceFptxx>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize) {

        return dubboSzhtxxElectronicInvoiceFptxxService.pageQuery(conditions, pageNun, pageSize);
    }


    public R<List<SzhtxxElectronicInvoiceFptxxListItemVo>> pageQueryGenericParam(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.pageQueryGenericParam(queryCriteria, loginSysUser);
    }

    public List<SzhtxxElectronicInvoiceFptxxListItemVo> queryGenericParam(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.queryGenericParam(queryCriteria, loginSysUser);
    }

    public SzhtxxElectronicInvoiceFptxxListItemVo queryOneByFpqqlsh(String fpqqlsh, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.queryOneByFpqqlsh(fpqqlsh, loginSysUser);
    }

    public String exportExcelSzhtxxElectronicInvoiceFptxxList(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.exportExcelSzhtxxElectronicInvoiceFptxxList(queryCriteria, loginSysUser);
    }


    public SzhtxxElectronicInvoiceFptxxHeadDataVo headDataGenericParam(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.headDataGenericParam(queryCriteria, loginSysUser);
    }

    public SzhtxxElectronicInvoiceFptxxDetailVo detailGenericParamSzhtxxElectronicInvoiceFptxx(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.detailGenericParam(queryCriteria, loginSysUser);
    }

    public String exportExcelSzhtxxElectronicInvoiceDetail(SzhtxxElectronicInvoiceFptxxQueryCriteria queryCriteria, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.exportExcelSzhtxxElectronicInvoiceDetail(queryCriteria, loginSysUser);
    }

    /**************************************** 深圳航信电子票 start ****************************************/

    /**
     * 红冲
     *
     * @param form
     * @param token
     * @return
     */
    public SingleBillingRequestBodyKpContent opRedWritePre(
            SzhtxxInvoiceFptxxOpSingleBillingForm form,
            SzhtxxElectronicInvoiceFptxxListItemVo fptxxListItemVo,
            String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.opRedWritePre(form, fptxxListItemVo, loginSysUser);
    }

    public SysNotify opRedWrite(
            SzhtxxInvoiceFptxxOpSingleBillingForm form,
            SzhtxxElectronicInvoiceFptxxListItemVo fptxxListItemVo,
            InvoiceApply invoiceApplyEntity,
            String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.opRedWrite(form, fptxxListItemVo, invoiceApplyEntity, loginSysUser);
    }


    /**************************************** 调用 深圳航信电子票 start ****************************************/

    public SysNotify callDeliverApi(SzhtxxElectronicInvoiceFptxxOpSendEmailPdfAttachmentForm form, SzhtxxElectronicInvoiceFptxxListItemVo fptxxListItemVo, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.callDeliverApi(form, fptxxListItemVo, loginSysUser);
    }

    public SysNotify callTaxInfoApi(String nsrsbh, String token) {

        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

        return dubboSzhtxxElectronicInvoiceFptxxService.callTaxInfoApi(nsrsbh, loginSysUser);
    }

    /**************************************** 调用 深圳航信电子票   end ****************************************/


}
