package com.engine.organization.wrapper;

import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.service.ImportCommonService;
import com.engine.organization.service.impl.ImportCommonServiceImpl;
import weaver.hrm.User;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author:dxfeng
 * @createTime: 2022/06/29
 * @version: 1.0
 */
public class ImportCommonWrapper extends Service {

    private ImportCommonService getImportCommonService(User user) {
        return ServiceUtil.getService(ImportCommonServiceImpl.class, user);
    }


    /**
     * 选择导入字段
     *
     * @return
     */
    public Map<String, Object> getImportFields(String importType) {
        return getImportCommonService(user).getImportFields(importType);
    }

    /**
     * 获取导入表单
     *
     * @param importType
     * @param columns
     * @return
     */
    public Map<String, Object> getImportForm(String importType, String columns) {
        return getImportCommonService(user).getImportForm(importType, columns);
    }

    /**
     * 导入数据
     *
     * @param params
     * @param request
     * @return
     */
    public Map<String, Object> saveImport(Map<String, Object> params, HttpServletRequest request) {
        return getImportCommonService(user).saveImport(params, request);
    }

    /**
     * 导入错误日志
     *
     * @param params
     * @return
     */
    public Map<String, Object> getImportResult(Map<String, Object> params) {
        return getImportCommonService(user).getImportResult(params);
    }

    public Map<String, Object> getHasRight() {
        return getImportCommonService(user).getHasRight();
    }
    public Map<String, Object> saveCommonImport(Map<String, Object> params) {
        return getImportCommonService(user).saveCommonImport(params);
    }

    public Map<String, Object> getCommonForm(String importModule) {
        return getImportCommonService(user).getCommonForm(importModule);
    }
}
