package com.hzya.frame.plugin.ht.plugin;

import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.zxBank.plugin.ZxBankResultPluginInitializer;
import com.hzya.frame.seeyon.invoice.service.impl.InvoiceServiceImpl;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

public class QueryInputInvoiceResultPluginInitializer extends PluginBaseEntity {
    Logger logger = LoggerFactory.getLogger(QueryInputInvoiceResultPluginInitializer.class);

    @Autowired
    private InvoiceServiceImpl invoiceService;

    @Override
    public void initialize() {
        logger.info(getPluginLabel() + "執行初始化方法initialize()");
    }

    @Override
    public void destroy() {
        logger.info(getPluginLabel() + "執行銷毀方法destroy()");
    }

    @Override
    public String getPluginId() {
        return "QueryInputInvoiceResultPluginInitializer";
    }

    @Override
    public String getPluginName() {
        return "查询发票批量录入返回结果插件";
    }

    @Override
    public String getPluginLabel() {
        return "QueryInputInvoiceResultPluginInitializer";
    }

    @Override
    public String getPluginType() {
        return "1";
    }
    @Override
    public JsonResultEntity executeBusiness(JSONObject requestJson) {
        try {
            logger.info("======开始执行查询税务进项发票批量录入返回结果========");
            return invoiceService.queryInputInvoiceResult(requestJson);
        }catch (Exception e){
            logger.info("======执行查询税务进项发票批量录入返回结果失败:{}========",e.getMessage());
            e.printStackTrace();
        }
        return null;
    }
}
