All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.founder.sdk.utils.CatalogImportUtil Maven / Gradle / Ivy

There is a newer version: 3.6.1.9
Show newest version
package com.founder.sdk.utils;

import com.founder.core.log.MyLog;
import com.founder.service.CatalogMappingService;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class CatalogImportUtil {

    private static final MyLog _log = MyLog.getLog(CatalogImportUtil.class);

    public static  List importFromFile(String localfile, Class clazz) {
        List list = new ArrayList<>();
        _log.info("本地文件:" + localfile);
        try {
            CatalogMappingService catalogMappingService = ApplicationContextUtil.getBean(CatalogMappingService.class);
            File file = new File(localfile);
            InputStream buffer = new FileInputStream(file);
            HashMap> map = catalogMappingService.getCatalogMapping(clazz);
            list = DownLoadZipUtil.downloadToList(buffer, map, clazz);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            _log.error(e,e.getMessage());
            throw new RuntimeException(e);
        }
        return list;
    }

    public static void main(String[] args) {

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy