parent
43fe35cf1f
commit
94f0b157f5
@ -1,141 +0,0 @@
|
||||
package com.wb.excel.api.entity;
|
||||
|
||||
/**
|
||||
* WExcel 校验对象
|
||||
*/
|
||||
public class ExcelVerifyEntity {
|
||||
|
||||
/**
|
||||
* 接口校验
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean interHandler;
|
||||
|
||||
/**
|
||||
* 不允许空
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean notNull;
|
||||
|
||||
/**
|
||||
* 是13位移动电话
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isMobile;
|
||||
/**
|
||||
* 是座机号码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isTel;
|
||||
|
||||
/**
|
||||
* 是电子邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isEmail;
|
||||
|
||||
/**
|
||||
* 最小长度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int minLength;
|
||||
|
||||
/**
|
||||
* 最大长度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int maxLength;
|
||||
|
||||
/**
|
||||
* 正在表达式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String regex;
|
||||
/**
|
||||
* 正在表达式,错误提示信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String regexTip;
|
||||
|
||||
public int getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public int getMinLength() {
|
||||
return minLength;
|
||||
}
|
||||
|
||||
public String getRegex() {
|
||||
return regex;
|
||||
}
|
||||
|
||||
public String getRegexTip() {
|
||||
return regexTip;
|
||||
}
|
||||
|
||||
public boolean isEmail() {
|
||||
return isEmail;
|
||||
}
|
||||
|
||||
public boolean isInterHandler() {
|
||||
return interHandler;
|
||||
}
|
||||
|
||||
public boolean isMobile() {
|
||||
return isMobile;
|
||||
}
|
||||
|
||||
public boolean isNotNull() {
|
||||
return notNull;
|
||||
}
|
||||
|
||||
public boolean isTel() {
|
||||
return isTel;
|
||||
}
|
||||
|
||||
public void setEmail(boolean isEmail) {
|
||||
this.isEmail = isEmail;
|
||||
}
|
||||
|
||||
public void setInterHandler(boolean interHandler) {
|
||||
this.interHandler = interHandler;
|
||||
}
|
||||
|
||||
public void setMaxLength(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
public void setMinLength(int minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
|
||||
public void setMobile(boolean isMobile) {
|
||||
this.isMobile = isMobile;
|
||||
}
|
||||
|
||||
public void setNotNull(boolean notNull) {
|
||||
this.notNull = notNull;
|
||||
}
|
||||
|
||||
public void setRegex(String regex) {
|
||||
this.regex = regex;
|
||||
}
|
||||
|
||||
public void setRegexTip(String regexTip) {
|
||||
this.regexTip = regexTip;
|
||||
}
|
||||
|
||||
public void setTel(boolean isTel) {
|
||||
this.isTel = isTel;
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.wb.excel.api.util;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Excel工具类.
|
||||
* Created on 2014/9/1.
|
||||
*
|
||||
* @author
|
||||
* @since 0.1.0
|
||||
*/
|
||||
public class ExcelUtil {
|
||||
|
||||
/**
|
||||
* 获取单元格的值
|
||||
*
|
||||
* @param cell 要获取值的单元格
|
||||
* @return 单元格的值
|
||||
*/
|
||||
public static String getValue(Cell cell) {
|
||||
if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
|
||||
// 返回布尔类型的值
|
||||
return String.valueOf(cell.getBooleanCellValue());
|
||||
} else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC && !HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
// 返回数值类型的值
|
||||
return String.valueOf(cell.getNumericCellValue());
|
||||
} else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
// 返回数值类型的值
|
||||
Date value = cell.getDateCellValue();
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(value);
|
||||
} else {
|
||||
// 返回字符串类型的值
|
||||
return String.valueOf(cell.getStringCellValue());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue