org.jeecgframework.poi.excel.entity.ImportParams Java Examples
The following examples show how to use
org.jeecgframework.poi.excel.entity.ImportParams.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExcelImportServer.java From jeasypoi with Apache License 2.0 | 6 votes |
/*** * 向List里面继续添加元素 * * @param exclusions * @param object * @param param * @param row * @param titlemap * @param targetId * @param pictures * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, Row row, Map<Integer, String> titlemap, String targetId, Map<String, PictureData> pictures, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); String picId; boolean isUsed = false;// 是否需要加上这个对象 for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { Cell cell = row.getCell(i); String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { if (param.getExcelParams().get(titleString).getType() == 2) { picId = row.getRowNum() + "_" + i; saveImage(object, picId, param.getExcelParams(), titleString, pictures, params); } else { saveFieldValue(params, entity, cell, param.getExcelParams(), titleString, row); } isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #2
Source File: ExcelImportServer.java From jeasypoi with Apache License 2.0 | 6 votes |
/** * 保存字段值(获取值,校验值,追加错误信息) * * @param params * @param object * @param cell * @param excelParams * @param titleString * @param row * @throws Exception */ private void saveFieldValue(ImportParams params, Object object, Cell cell, Map<String, ExcelImportEntity> excelParams, String titleString, Row row) throws Exception { Object value = cellValueServer.getValue(params.getDataHanlder(), object, cell, excelParams, titleString); if (object instanceof Map) { if (params.getDataHanlder() != null) { params.getDataHanlder().setMapValue((Map) object, titleString, value); } else { ((Map) object).put(titleString, value); } } else { ExcelVerifyHanlderResult verifyResult = verifyHandlerServer.verifyData(object, value, titleString, excelParams.get(titleString).getVerify(), params.getVerifyHanlder()); if (verifyResult.isSuccess()) { setValues(excelParams.get(titleString), object, value); } else { Cell errorCell = row.createCell(row.getLastCellNum()); errorCell.setCellValue(verifyResult.getMsg()); errorCell.setCellStyle(errorCellStyle); verfiyFail = true; throw new ExcelImportException(ExcelImportEnum.VERIFY_ERROR); } } }
Example #3
Source File: SaxRowRead.java From easypoi with Apache License 2.0 | 6 votes |
/*** * 向List里面继续添加元素 * * @param exclusions * @param object * @param param * @param datas * @param titlemap * @param targetId * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, List<SaxReadCellEntity> datas, Map<Integer, String> titlemap, String targetId, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); boolean isUsed = false;// 是否需要加上这个对象 for (int i = 0; i < datas.size(); i++) { String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { saveFieldValue(params, entity, datas.get(i), param.getExcelParams(), titleString); isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #4
Source File: ExcelImportServer.java From easypoi with Apache License 2.0 | 6 votes |
/** * 保存字段值(获取值,校验值,追加错误信息) * * @param params * @param object * @param cell * @param excelParams * @param titleString * @param row * @throws Exception */ private void saveFieldValue(ImportParams params, Object object, Cell cell, Map<String, ExcelImportEntity> excelParams, String titleString, Row row) throws Exception { Object value = cellValueServer.getValue(params.getDataHanlder(), object, cell, excelParams, titleString); if (object instanceof Map) { if (params.getDataHanlder() != null) { params.getDataHanlder().setMapValue((Map) object, titleString, value); } else { ((Map) object).put(titleString, value); } } else { ExcelVerifyHanlderResult verifyResult = verifyHandlerServer.verifyData(object, value, titleString, excelParams.get(titleString).getVerify(), params.getVerifyHanlder()); if (verifyResult.isSuccess()) { setValues(excelParams.get(titleString), object, value); } else { Cell errorCell = row.createCell(row.getLastCellNum()); errorCell.setCellValue(verifyResult.getMsg()); errorCell.setCellStyle(errorCellStyle); verfiyFail = true; throw new ExcelImportException(ExcelImportEnum.VERIFY_ERROR); } } }
Example #5
Source File: SaxRowRead.java From autopoi with Apache License 2.0 | 6 votes |
/*** * 向List里面继续添加元素 * * @param exclusions * @param object * @param param * @param datas * @param titlemap * @param targetId * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, List<SaxReadCellEntity> datas, Map<Integer, String> titlemap, String targetId, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); boolean isUsed = false;// 是否需要加上这个对象 for (int i = 0; i < datas.size(); i++) { String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { saveFieldValue(params, entity, datas.get(i), param.getExcelParams(), titleString); isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #6
Source File: ExcelImportServer.java From autopoi with Apache License 2.0 | 6 votes |
/*** * 向List里面继续添加元素 * * @param object * @param param * @param row * @param titlemap * @param targetId * @param pictures * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, Row row, Map<Integer, String> titlemap, String targetId, Map<String, PictureData> pictures, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); String picId; boolean isUsed = false;// 是否需要加上这个对象 for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { Cell cell = row.getCell(i); String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { if (param.getExcelParams().get(titleString).getType() == 2) { picId = row.getRowNum() + "_" + i; saveImage(object, picId, param.getExcelParams(), titleString, pictures, params); } else { saveFieldValue(params, entity, cell, param.getExcelParams(), titleString, row); } isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #7
Source File: SaxRowRead.java From jeasypoi with Apache License 2.0 | 6 votes |
/*** * 向List里面继续添加元素 * * @param exclusions * @param object * @param param * @param datas * @param titlemap * @param targetId * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, List<SaxReadCellEntity> datas, Map<Integer, String> titlemap, String targetId, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); boolean isUsed = false;// 是否需要加上这个对象 for (int i = 0; i < datas.size(); i++) { String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { saveFieldValue(params, entity, datas.get(i), param.getExcelParams(), titleString); isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #8
Source File: ExcelImportServer.java From autopoi with Apache License 2.0 | 6 votes |
/** * 保存字段值(获取值,校验值,追加错误信息) * * @param params * @param object * @param cell * @param excelParams * @param titleString * @param row * @throws Exception */ private void saveFieldValue(ImportParams params, Object object, Cell cell, Map<String, ExcelImportEntity> excelParams, String titleString, Row row) throws Exception { Object value = cellValueServer.getValue(params.getDataHanlder(), object, cell, excelParams, titleString); if (object instanceof Map) { if (params.getDataHanlder() != null) { params.getDataHanlder().setMapValue((Map) object, titleString, value); } else { ((Map) object).put(titleString, value); } } else { ExcelVerifyHanlderResult verifyResult = verifyHandlerServer.verifyData(object, value, titleString, excelParams.get(titleString).getVerify(), params.getVerifyHanlder()); if (verifyResult.isSuccess()) { setValues(excelParams.get(titleString), object, value); } else { Cell errorCell = row.createCell(row.getLastCellNum()); errorCell.setCellValue(verifyResult.getMsg()); errorCell.setCellStyle(errorCellStyle); verfiyFail = true; throw new ExcelImportException(ExcelImportEnum.VERIFY_ERROR); } } }
Example #9
Source File: ExcelImportServer.java From easypoi with Apache License 2.0 | 5 votes |
/*** * 向List里面继续添加元素 * * @param exclusions * @param object * @param param * @param row * @param titlemap * @param targetId * @param pictures * @param params */ private void addListContinue(Object object, ExcelCollectionParams param, Row row, Map<Integer, String> titlemap, String targetId, Map<String, PictureData> pictures, ImportParams params) throws Exception { Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = PoiPublicUtil.createObject(param.getType(), targetId); String picId; boolean isUsed = false;// 是否需要加上这个对象 for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { Cell cell = row.getCell(i); String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { if (param.getExcelParams().get(titleString).getType() == 2) { picId = row.getRowNum() + "_" + i; saveImage(object, picId, param.getExcelParams(), titleString, pictures, params); } else { saveFieldValue(params, entity, cell, param.getExcelParams(), titleString, row); } isUsed = true; } } if (isUsed) { collection.add(entity); } }
Example #10
Source File: ImportBaseService.java From jeasypoi with Apache License 2.0 | 5 votes |
public void saveThisExcel(ImportParams params, Class<?> pojoClass, boolean isXSSFWorkbook, Workbook book) throws Exception { String path = PoiPublicUtil.getWebRootPath(getSaveExcelUrl(params, pojoClass)); File savefile = new File(path); if (!savefile.exists()) { savefile.mkdirs(); } SimpleDateFormat format = new SimpleDateFormat("yyyMMddHHmmss"); FileOutputStream fos = new FileOutputStream(path + "/" + format.format(new Date()) + "_" + Math.round(Math.random() * 100000) + (isXSSFWorkbook == true ? ".xlsx" : ".xls")); book.write(fos); fos.close(); }
Example #11
Source File: SaxReadExcel.java From jeasypoi with Apache License 2.0 | 5 votes |
public <T> List<T> readExcel(InputStream inputstream, Class<?> pojoClass, ImportParams params, ISaxRowRead rowRead, IExcelReadRowHanlder hanlder) { try { OPCPackage opcPackage = OPCPackage.open(inputstream); return readExcel(opcPackage, pojoClass, params, rowRead, hanlder); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example #12
Source File: SaxRowRead.java From jeasypoi with Apache License 2.0 | 5 votes |
public SaxRowRead(Class<?> pojoClass, ImportParams params, IExcelReadRowHanlder hanlder) { list = Lists.newArrayList(); this.params = params; this.pojoClass = pojoClass; cellValueServer = new CellValueServer(); this.hanlder = hanlder; initParams(pojoClass, params); }
Example #13
Source File: SaxRowRead.java From jeasypoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example #14
Source File: ImportBaseService.java From easypoi with Apache License 2.0 | 5 votes |
public void saveThisExcel(ImportParams params, Class<?> pojoClass, boolean isXSSFWorkbook, Workbook book) throws Exception { String path = PoiPublicUtil.getWebRootPath(getSaveExcelUrl(params, pojoClass)); File savefile = new File(path); if (!savefile.exists()) { savefile.mkdirs(); } SimpleDateFormat format = new SimpleDateFormat("yyyMMddHHmmss"); FileOutputStream fos = new FileOutputStream(path + "/" + format.format(new Date()) + "_" + Math.round(Math.random() * 100000) + (isXSSFWorkbook == true ? ".xlsx" : ".xls")); book.write(fos); fos.close(); }
Example #15
Source File: ImportBaseService.java From easypoi with Apache License 2.0 | 5 votes |
/** * 获取保存的Excel 的真实路径 * * @param params * @param pojoClass * @return * @throws Exception */ public String getSaveExcelUrl(ImportParams params, Class<?> pojoClass) throws Exception { String url = ""; if (params.getSaveUrl().equals("upload/excelUpload")) { url = pojoClass.getName().split("\\.")[pojoClass.getName().split("\\.").length - 1]; return params.getSaveUrl() + "/" + url; } return params.getSaveUrl(); }
Example #16
Source File: ImportBaseService.java From jeasypoi with Apache License 2.0 | 5 votes |
/** * 获取保存的Excel 的真实路径 * * @param params * @param pojoClass * @return * @throws Exception */ public String getSaveExcelUrl(ImportParams params, Class<?> pojoClass) throws Exception { String url = ""; if (params.getSaveUrl().equals("upload/excelUpload")) { url = pojoClass.getName().split("\\.")[pojoClass.getName().split("\\.").length - 1]; return params.getSaveUrl() + "/" + url; } return params.getSaveUrl(); }
Example #17
Source File: ExcelImportServer.java From easypoi with Apache License 2.0 | 5 votes |
/** * 获取表格字段列名对应信息 * @param rows * @param params * @param excelCollection * @return */ private Map<Integer, String> getTitleMap(Iterator<Row> rows, ImportParams params, List<ExcelCollectionParams> excelCollection) { Map<Integer, String> titlemap = new HashMap<Integer, String>(); Iterator<Cell> cellTitle; String collectionName = null; ExcelCollectionParams collectionParams = null; Row row = null; for (int j = 0; j < params.getHeadRows(); j++) { row = rows.next(); if(row == null){ continue; } cellTitle = row.cellIterator(); while (cellTitle.hasNext()) { Cell cell = cellTitle.next(); String value = getKeyValue(cell); int i = cell.getColumnIndex(); //用以支持重名导入 if (StringUtils.isNotEmpty(value)) { if (titlemap.containsKey(i)) { collectionName = titlemap.get(i); collectionParams = getCollectionParams(excelCollection, collectionName); titlemap.put(i, collectionName + "_" + value); } else if (StringUtils.isNotEmpty(collectionName) && collectionParams.getExcelParams().containsKey( collectionName + "_" + value)) { titlemap.put(i, collectionName + "_" + value); } else { collectionName = null; collectionParams = null; } if (StringUtils.isEmpty(collectionName)) { titlemap.put(i, value); } } } } return titlemap; }
Example #18
Source File: SaxReadExcel.java From easypoi with Apache License 2.0 | 5 votes |
public <T> List<T> readExcel(InputStream inputstream, Class<?> pojoClass, ImportParams params, ISaxRowRead rowRead, IExcelReadRowHanlder hanlder) { try { OPCPackage opcPackage = OPCPackage.open(inputstream); return readExcel(opcPackage, pojoClass, params, rowRead, hanlder); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example #19
Source File: SaxRowRead.java From easypoi with Apache License 2.0 | 5 votes |
public SaxRowRead(Class<?> pojoClass, ImportParams params, IExcelReadRowHanlder hanlder) { list = Lists.newArrayList(); this.params = params; this.pojoClass = pojoClass; cellValueServer = new CellValueServer(); this.hanlder = hanlder; initParams(pojoClass, params); }
Example #20
Source File: SaxRowRead.java From easypoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example #21
Source File: ExcelImportUtil.java From jeewx with Apache License 2.0 | 5 votes |
private static void saveThisExcel(ImportParams params,Class<?> pojoClass, boolean isXSSFWorkbook, Workbook book) throws Exception { String path = ContextHolderUtils.getRequest().getSession().getServletContext().getRealPath("\\")+getSaveExcelUrl(params,pojoClass); path = path.replace("WEB-INF/classes/",""); path = path.replace("file:/",""); File savefile = new File(path); if(!savefile.exists()){ savefile.mkdirs(); } SimpleDateFormat format = new SimpleDateFormat("yyyMMddHHmmss"); FileOutputStream fos = new FileOutputStream(path+"/"+format.format(new Date())+"_" +Math.round(Math.random()*100000)+(isXSSFWorkbook == true?".xlsx":".xls")); book.write(fos); fos.close(); }
Example #22
Source File: ExcelImportUtil.java From jeewx with Apache License 2.0 | 5 votes |
/** * 获取保存的Excel 的真实路径 * @param excelImportEntity * @param object * @return * @throws Exception */ private static String getSaveExcelUrl(ImportParams params, Class<?> pojoClass) throws Exception { String url = ""; if(params.getSaveUrl().equals("upload/excelUpload")){ url = pojoClass.getName().split("\\.")[pojoClass.getName().split("\\.").length-1]; return params.getSaveUrl()+"/"+url.substring(0, url.lastIndexOf("Entity")); } return params.getSaveUrl(); }
Example #23
Source File: ExcelImportUtil.java From jeewx with Apache License 2.0 | 5 votes |
/*** * 向List里面继续添加元素 * * @param object * @param param * @param row * @param titlemap * @param targetId * @param params * @param currentImageIndex * @param pictures */ @SuppressWarnings({ "rawtypes", "unchecked" }) private static void addListContinue(Object object, ExcelCollectionParams param, Row row, Map<Integer, String> titlemap, String targetId, Map<String, PictureData> pictures,ImportParams params) throws Exception { Collection collection = (Collection) ExcelPublicUtil.getMethod( param.getName(), object.getClass()).invoke(object, new Object[] {}); Object entity = ExcelPublicUtil.createObject(param.getType(), targetId); String picId; boolean isUsed = false;//是否需要加上这个对象 for(int i =row.getFirstCellNum() ;i<row.getLastCellNum();i++){ Cell cell = row.getCell(i); String titleString = (String) titlemap.get(i); if (param.getExcelParams().containsKey(titleString)) { if(param.getExcelParams().get(titleString).getType()==2){ picId = row.getRowNum()+"_"+i; saveImage(object,picId,param.getExcelParams(), titleString,pictures,params); }else{ judgeTypeAndSetValue(entity, cell, param.getExcelParams(), titleString); } isUsed = true; } } if(isUsed){ collection.add(entity); } }
Example #24
Source File: SysRoleServiceImpl.java From jeecg-cloud with Apache License 2.0 | 5 votes |
@Override public Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception { List<Object> listSysRoles = ExcelImportUtil.importExcel(file.getInputStream(), SysRole.class, params); int totalCount = listSysRoles.size(); List<String> errorStrs = new ArrayList<>(); // 去除 listSysRoles 中重复的数据 for (int i = 0; i < listSysRoles.size(); i++) { String roleCodeI =((SysRole)listSysRoles.get(i)).getRoleCode(); for (int j = i + 1; j < listSysRoles.size(); j++) { String roleCodeJ =((SysRole)listSysRoles.get(j)).getRoleCode(); // 发现重复数据 if (roleCodeI.equals(roleCodeJ)) { errorStrs.add("第 " + (j + 1) + " 行的 roleCode 值:" + roleCodeI + " 已存在,忽略导入"); listSysRoles.remove(j); break; } } } // 去掉 sql 中的重复数据 Integer errorLines=0; Integer successLines=0; List<String> list = ImportExcelUtil.importDateSave(listSysRoles, ISysRoleService.class, errorStrs, CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE); errorLines+=list.size(); successLines+=(listSysRoles.size()-errorLines); return ImportExcelUtil.imporReturnRes(errorLines,successLines,list); }
Example #25
Source File: SysRoleServiceImpl.java From jeecg-boot with Apache License 2.0 | 5 votes |
@Override public Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception { List<Object> listSysRoles = ExcelImportUtil.importExcel(file.getInputStream(), SysRole.class, params); int totalCount = listSysRoles.size(); List<String> errorStrs = new ArrayList<>(); // 去除 listSysRoles 中重复的数据 for (int i = 0; i < listSysRoles.size(); i++) { String roleCodeI =((SysRole)listSysRoles.get(i)).getRoleCode(); for (int j = i + 1; j < listSysRoles.size(); j++) { String roleCodeJ =((SysRole)listSysRoles.get(j)).getRoleCode(); // 发现重复数据 if (roleCodeI.equals(roleCodeJ)) { errorStrs.add("第 " + (j + 1) + " 行的 roleCode 值:" + roleCodeI + " 已存在,忽略导入"); listSysRoles.remove(j); break; } } } // 去掉 sql 中的重复数据 Integer errorLines=0; Integer successLines=0; List<String> list = ImportExcelUtil.importDateSave(listSysRoles, ISysRoleService.class, errorStrs, CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE); errorLines+=list.size(); successLines+=(listSysRoles.size()-errorLines); return ImportExcelUtil.imporReturnRes(errorLines,successLines,list); }
Example #26
Source File: SaxRowRead.java From autopoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example #27
Source File: ImportBaseService.java From autopoi with Apache License 2.0 | 5 votes |
public void saveThisExcel(ImportParams params, Class<?> pojoClass, boolean isXSSFWorkbook, Workbook book) throws Exception { String path = PoiPublicUtil.getWebRootPath(getSaveExcelUrl(params, pojoClass)); File savefile = new File(path); if (!savefile.exists()) { savefile.mkdirs(); } SimpleDateFormat format = new SimpleDateFormat("yyyMMddHHmmss"); FileOutputStream fos = new FileOutputStream(path + "/" + format.format(new Date()) + "_" + Math.round(Math.random() * 100000) + (isXSSFWorkbook == true ? ".xlsx" : ".xls")); book.write(fos); fos.close(); }
Example #28
Source File: ImportBaseService.java From autopoi with Apache License 2.0 | 5 votes |
/** * 获取保存的Excel 的真实路径 * * @param params * @param pojoClass * @return * @throws Exception */ public String getSaveExcelUrl(ImportParams params, Class<?> pojoClass) throws Exception { String url = ""; if (params.getSaveUrl().equals("upload/excelUpload")) { url = pojoClass.getName().split("\\.")[pojoClass.getName().split("\\.").length - 1]; return params.getSaveUrl() + "/" + url; } return params.getSaveUrl(); }
Example #29
Source File: ExcelImportServer.java From autopoi with Apache License 2.0 | 5 votes |
/** * 获取忽略的表头信息 * @param excelParams * @param params */ private void ignoreHeaderHandler(Map<String, ExcelImportEntity> excelParams,ImportParams params){ List<String> ignoreList = new ArrayList<>(); for(String key:excelParams.keySet()){ String temp = excelParams.get(key).getGroupName(); if(temp!=null && temp.length()>0){ ignoreList.add(temp); } } params.setIgnoreHeaderList(ignoreList); }
Example #30
Source File: SaxRowRead.java From autopoi with Apache License 2.0 | 5 votes |
public SaxRowRead(Class<?> pojoClass, ImportParams params, IExcelReadRowHanlder hanlder) { list = Lists.newArrayList(); this.params = params; this.pojoClass = pojoClass; cellValueServer = new CellValueServer(); this.hanlder = hanlder; initParams(pojoClass, params); }