package com.hzya.frame.plugin.kekao.plugin;

import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.kekao.service.ICreditauditService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 信用额度审批单保存提交
 *
 * @author makejava
 * @since 2024-06-21 13:52:35
 */
public class CreditauditPluginInitializer extends PluginBaseEntity{
    Logger logger = LoggerFactory.getLogger(CreditauditPluginInitializer.class);
    @Autowired
    private ICreditauditService creditauditService;

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

    @Override
    public void destroy() {
        logger.info(getPluginLabel() + "执行销毁方法destroy()");
    }

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

    @Override
    public String getPluginName() {
        return "CreditauditPlugin插件";
    }

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

    @Override
    public String getPluginType() {
        return "1";
    }
    @Override
    public JsonResultEntity executeBusiness(JSONObject requestJson) {
        try {
            logger.info("======开始执行信用额度审批单保存提交同步========");
            return creditauditService.sendCreditauditData(requestJson);
        }catch (Exception e){
            logger.info("======执行信用额度审批单保存提交同步失败:{}========",e.getMessage());
        }
        return null;
    }
}
