import com.sdtool.common.api.NoSqlKeysService
import com.sdtool.common.datas.ESKeys
import com.dySweetFishPlugin.elasticsearch.ESClient
import com.sweetfish.util.Utility

static def createRunnable(ESClient esClient, NoSqlKeysService keysService, long supplierCode) {
    return {
        //操作日志
        esClient.checkIndexEx(ESKeys.ESOPLOG_INDEX + "_" + supplierCode, ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "oplog.json"))

        //region 站内通知和短信
        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPSYSMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessage.json"))

        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPSYSMSGTEXT_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagetext.json"))

        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPP2PMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessage.json"))

        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPP2PMSGTEXT_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagetext.json"))

        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPUSERMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagestatus.json"))
    } as Runnable
}

//groovy最后一个表达式的值为返回
createRunnable(esClient, keysService, supplierCode)
