org.jeecgframework.poi.excel.entity.result.ExcelVerifyHanlderResult Java Examples
The following examples show how to use
org.jeecgframework.poi.excel.entity.result.ExcelVerifyHanlderResult.
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 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 #2
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 #3
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 #4
Source File: VerifyHandlerServer.java From autopoi with Apache License 2.0 | 5 votes |
/** * 校驗數據 * * @param object * @param value * @param titleString * @param verify * @param excelVerifyHandler */ public ExcelVerifyHanlderResult verifyData(Object object, Object value, String name, ExcelVerifyEntity verify, IExcelVerifyHandler excelVerifyHandler) { if (verify == null) { return DEFAULT_RESULT; } ExcelVerifyHanlderResult result = new ExcelVerifyHanlderResult(true, ""); if (verify.isNotNull()) { addVerifyResult(BaseVerifyHandler.notNull(name, value), result); } if (verify.isEmail()) { addVerifyResult(BaseVerifyHandler.isEmail(name, value), result); } if (verify.isMobile()) { addVerifyResult(BaseVerifyHandler.isMobile(name, value), result); } if (verify.isTel()) { addVerifyResult(BaseVerifyHandler.isTel(name, value), result); } if (verify.getMaxLength() != -1) { addVerifyResult(BaseVerifyHandler.maxLength(name, value, verify.getMaxLength()), result); } if (verify.getMinLength() != -1) { addVerifyResult(BaseVerifyHandler.minLength(name, value, verify.getMinLength()), result); } if (StringUtils.isNotEmpty(verify.getRegex())) { addVerifyResult(BaseVerifyHandler.regex(name, value, verify.getRegex(), verify.getRegexTip()), result); } if (verify.isInterHandler()) { addVerifyResult(excelVerifyHandler.verifyHandler(object, name, value), result); } return result; }
Example #5
Source File: VerifyHandlerServer.java From jeasypoi with Apache License 2.0 | 5 votes |
/** * 校驗數據 * * @param object * @param value * @param titleString * @param verify * @param excelVerifyHandler */ public ExcelVerifyHanlderResult verifyData(Object object, Object value, String name, ExcelVerifyEntity verify, IExcelVerifyHandler excelVerifyHandler) { if (verify == null) { return DEFAULT_RESULT; } ExcelVerifyHanlderResult result = new ExcelVerifyHanlderResult(true, ""); if (verify.isNotNull()) { addVerifyResult(BaseVerifyHandler.notNull(name, value), result); } if (verify.isEmail()) { addVerifyResult(BaseVerifyHandler.isEmail(name, value), result); } if (verify.isMobile()) { addVerifyResult(BaseVerifyHandler.isMobile(name, value), result); } if (verify.isTel()) { addVerifyResult(BaseVerifyHandler.isTel(name, value), result); } if (verify.getMaxLength() != -1) { addVerifyResult(BaseVerifyHandler.maxLength(name, value, verify.getMaxLength()), result); } if (verify.getMinLength() != -1) { addVerifyResult(BaseVerifyHandler.minLength(name, value, verify.getMinLength()), result); } if (StringUtils.isNotEmpty(verify.getRegex())) { addVerifyResult(BaseVerifyHandler.regex(name, value, verify.getRegex(), verify.getRegexTip()), result); } if (verify.isInterHandler()) { addVerifyResult(excelVerifyHandler.verifyHandler(object, name, value), result); } return result; }
Example #6
Source File: VerifyHandlerServer.java From easypoi with Apache License 2.0 | 5 votes |
/** * 校驗數據 * * @param object * @param value * @param titleString * @param verify * @param excelVerifyHandler */ public ExcelVerifyHanlderResult verifyData(Object object, Object value, String name, ExcelVerifyEntity verify, IExcelVerifyHandler excelVerifyHandler) { if (verify == null) { return DEFAULT_RESULT; } ExcelVerifyHanlderResult result = new ExcelVerifyHanlderResult(true, ""); if (verify.isNotNull()) { addVerifyResult(BaseVerifyHandler.notNull(name, value), result); } if (verify.isEmail()) { addVerifyResult(BaseVerifyHandler.isEmail(name, value), result); } if (verify.isMobile()) { addVerifyResult(BaseVerifyHandler.isMobile(name, value), result); } if (verify.isTel()) { addVerifyResult(BaseVerifyHandler.isTel(name, value), result); } if (verify.getMaxLength() != -1) { addVerifyResult(BaseVerifyHandler.maxLength(name, value, verify.getMaxLength()), result); } if (verify.getMinLength() != -1) { addVerifyResult(BaseVerifyHandler.minLength(name, value, verify.getMinLength()), result); } if (StringUtils.isNotEmpty(verify.getRegex())) { addVerifyResult( BaseVerifyHandler.regex(name, value, verify.getRegex(), verify.getRegexTip()), result); } if (verify.isInterHandler()) { addVerifyResult(excelVerifyHandler.verifyHandler(object, name, value), result); } return result; }
Example #7
Source File: VerifyHandlerServer.java From easypoi with Apache License 2.0 | 5 votes |
private void addVerifyResult(ExcelVerifyHanlderResult hanlderResult, ExcelVerifyHanlderResult result) { if (!hanlderResult.isSuccess()) { result.setSuccess(false); result.setMsg((StringUtils.isEmpty(result.getMsg()) ? "" : result.getMsg() + " , ") + hanlderResult.getMsg()); } }
Example #8
Source File: VerifyHandlerServer.java From jeasypoi with Apache License 2.0 | 4 votes |
private void addVerifyResult(ExcelVerifyHanlderResult hanlderResult, ExcelVerifyHanlderResult result) { if (!hanlderResult.isSuccess()) { result.setSuccess(false); result.setMsg((StringUtils.isEmpty(result.getMsg()) ? "" : result.getMsg() + " , ") + hanlderResult.getMsg()); } }
Example #9
Source File: VerifyHandlerServer.java From autopoi with Apache License 2.0 | 4 votes |
private void addVerifyResult(ExcelVerifyHanlderResult hanlderResult, ExcelVerifyHanlderResult result) { if (!hanlderResult.isSuccess()) { result.setSuccess(false); result.setMsg((StringUtils.isEmpty(result.getMsg()) ? "" : result.getMsg() + " , ") + hanlderResult.getMsg()); } }
Example #10
Source File: BaseVerifyHandler.java From jeasypoi with Apache License 2.0 | 3 votes |
/** * 电话校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isTel(String name, Object val) { if (!telPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_TEL); } return new ExcelVerifyHanlderResult(true); }
Example #11
Source File: BaseVerifyHandler.java From easypoi with Apache License 2.0 | 3 votes |
/** * 非空校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult notNull(String name, Object val) { if (val == null || val.toString().equals("")) { return new ExcelVerifyHanlderResult(false, name + NOT_NULL); } return new ExcelVerifyHanlderResult(true); }
Example #12
Source File: BaseVerifyHandler.java From easypoi with Apache License 2.0 | 3 votes |
/** * 电话校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isTel(String name, Object val) { if (!telPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_TEL); } return new ExcelVerifyHanlderResult(true); }
Example #13
Source File: BaseVerifyHandler.java From easypoi with Apache License 2.0 | 3 votes |
/** * 手机校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isMobile(String name, Object val) { if (!mobilePattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_MOBILE); } return new ExcelVerifyHanlderResult(true); }
Example #14
Source File: BaseVerifyHandler.java From easypoi with Apache License 2.0 | 3 votes |
/** * email校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isEmail(String name, Object val) { if (!emailPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_EMAIL); } return new ExcelVerifyHanlderResult(true); }
Example #15
Source File: BaseVerifyHandler.java From jeasypoi with Apache License 2.0 | 3 votes |
/** * 非空校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult notNull(String name, Object val) { if (val == null || val.toString().equals("")) { return new ExcelVerifyHanlderResult(false, name + NOT_NULL); } return new ExcelVerifyHanlderResult(true); }
Example #16
Source File: BaseVerifyHandler.java From jeasypoi with Apache License 2.0 | 3 votes |
/** * 手机校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isMobile(String name, Object val) { if (!mobilePattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_MOBILE); } return new ExcelVerifyHanlderResult(true); }
Example #17
Source File: BaseVerifyHandler.java From jeasypoi with Apache License 2.0 | 3 votes |
/** * email校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isEmail(String name, Object val) { if (!emailPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_EMAIL); } return new ExcelVerifyHanlderResult(true); }
Example #18
Source File: BaseVerifyHandler.java From autopoi with Apache License 2.0 | 3 votes |
/** * 非空校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult notNull(String name, Object val) { if (val == null || val.toString().equals("")) { return new ExcelVerifyHanlderResult(false, name + NOT_NULL); } return new ExcelVerifyHanlderResult(true); }
Example #19
Source File: BaseVerifyHandler.java From autopoi with Apache License 2.0 | 3 votes |
/** * 电话校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isTel(String name, Object val) { if (!telPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_TEL); } return new ExcelVerifyHanlderResult(true); }
Example #20
Source File: BaseVerifyHandler.java From autopoi with Apache License 2.0 | 3 votes |
/** * 手机校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isMobile(String name, Object val) { if (!mobilePattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_MOBILE); } return new ExcelVerifyHanlderResult(true); }
Example #21
Source File: BaseVerifyHandler.java From autopoi with Apache License 2.0 | 3 votes |
/** * email校验 * * @param name * @param val * @return */ public static ExcelVerifyHanlderResult isEmail(String name, Object val) { if (!emailPattern.matcher(String.valueOf(val)).matches()) { return new ExcelVerifyHanlderResult(false, name + IS_EMAIL); } return new ExcelVerifyHanlderResult(true); }
Example #22
Source File: IExcelVerifyHandler.java From jeasypoi with Apache License 2.0 | 2 votes |
/** * 导出处理方法 * * @param obj * 当前对象 * @param name * 当前字段名称 * @param value * 当前值 * @return */ public ExcelVerifyHanlderResult verifyHandler(Object obj, String name, Object value);
Example #23
Source File: IExcelVerifyHandler.java From autopoi with Apache License 2.0 | 2 votes |
/** * 导出处理方法 * * @param obj * 当前对象 * @param name * 当前字段名称 * @param value * 当前值 * @return */ public ExcelVerifyHanlderResult verifyHandler(Object obj, String name, Object value);
Example #24
Source File: IExcelVerifyHandler.java From easypoi with Apache License 2.0 | 2 votes |
/** * 导出处理方法 * * @param obj * 当前对象 * @param name * 当前字段名称 * @param value * 当前值 * @return */ public ExcelVerifyHanlderResult verifyHandler(Object obj, String name, Object value);