package com.dxhy.core.job.thread;

import com.dxhy.common.utils.SpringContextUtils;
import com.dxhy.core.job.service.InvoiceDownService;
import com.dxhy.core.job.service.InvoiceInterfaceService;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author user
 */
@Slf4j
public class InvoiceDownParseHandle extends Thread {
    @Resource
    private InvoiceDownService invoiceDownService;

    private final String taxno;
    private final String db;

    /**
     * 入参，执行接口方法
     *
     * @param taxno
     *            税号
     * @param db
     *            数据库
     */
    public InvoiceDownParseHandle(String taxno, String db) {
        this.taxno = taxno;
        this.db = db;
    }

    @Override
    public void run() {
        invoiceDownService = (InvoiceDownService)SpringContextUtils.getBean("InvoiceDownService");
        try {
            invoiceDownService.parse(taxno, db);
        } catch (IOException e) {
           log.info("业务处理异常：{}", e);
        }
    }
}
