You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
Java
63 lines
1.9 KiB
Java
package com.engine.organization.enums;
|
|
|
|
import com.engine.organization.exception.OrganizationRunTimeException;
|
|
import com.engine.organization.util.saveimport.PostInfoImportUtil;
|
|
import com.engine.organization.util.saveimport.StaffInfoImportUtil;
|
|
import weaver.hrm.User;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @author:dxfeng
|
|
* @createTime: 2022/09/15
|
|
* @version: 1.0
|
|
*/
|
|
public enum OrgImportEnum implements OrgImportAdapter {
|
|
STAFF("staff") {
|
|
@Override
|
|
public Map<String, Object> orgImport(Map<String, Object> params, User user) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
String excelFile = (String) params.get("excelfile");
|
|
resultMap.put("pId", StaffInfoImportUtil.saveImport("add", excelFile, user));
|
|
return resultMap;
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> orgForm(User user) {
|
|
return StaffInfoImportUtil.importForm(user);
|
|
}
|
|
},
|
|
POSTINFO("postInfo"){
|
|
@Override
|
|
public Map<String, Object> orgImport(Map<String, Object> params, User user) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
String excelFile = (String) params.get("excelfile");
|
|
resultMap.put("pId", PostInfoImportUtil.saveImport("add", excelFile, user));
|
|
return resultMap;
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> orgForm(User user) {
|
|
return PostInfoImportUtil.importForm(user);
|
|
}
|
|
};
|
|
|
|
|
|
private String tableName;
|
|
|
|
OrgImportEnum(String tableName) {
|
|
this.tableName = tableName;
|
|
}
|
|
|
|
public static OrgImportEnum getOrgImportUtil(String tableName) {
|
|
for (OrgImportEnum item : OrgImportEnum.values()) {
|
|
if (item.tableName.equalsIgnoreCase(tableName)) {
|
|
return item;
|
|
}
|
|
}
|
|
throw new OrganizationRunTimeException("不支持的导入类型");
|
|
}
|
|
}
|