@@ -1,7 +1,7 @@ | |||||
=========================== | =========================== | ||||
EasyPoi Excel和 Word简易工具类 | EasyPoi Excel和 Word简易工具类 | ||||
=========================== | =========================== | ||||
easypoi功能如同名字easy,主打的功能就是易容,让一个没见接触过poi的人员 | |||||
easypoi功能如同名字easy,主打的功能就是容易,让一个没见接触过poi的人员 | |||||
就可以方便的写出Excel导出,Excel模板导出,Excel导入,Word模板导出,通过简单的注解和模板 | 就可以方便的写出Excel导出,Excel模板导出,Excel导入,Word模板导出,通过简单的注解和模板 | ||||
语言(熟悉的表达式语法),完成以前复杂的写法 | 语言(熟悉的表达式语法),完成以前复杂的写法 | ||||
@@ -77,8 +77,9 @@ public class ExcelImportUtil { | |||||
* @return | * @return | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
public static ExcelImportResult importExcelVerify(InputStream inputstream, Class<?> pojoClass, | |||||
ImportParams params) throws Exception { | |||||
public static <T> ExcelImportResult<T> importExcelVerify(InputStream inputstream, | |||||
Class<?> pojoClass, ImportParams params) | |||||
throws Exception { | |||||
return new ExcelImportServer().importExcelByIs(inputstream, pojoClass, params); | return new ExcelImportServer().importExcelByIs(inputstream, pojoClass, params); | ||||
} | } | ||||
@@ -91,8 +92,8 @@ public class ExcelImportUtil { | |||||
* @return | * @return | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
public static ExcelImportResult importExcelVerify(File file, Class<?> pojoClass, | |||||
ImportParams params) { | |||||
public static <T> ExcelImportResult<T> importExcelVerify(File file, Class<?> pojoClass, | |||||
ImportParams params) { | |||||
FileInputStream in = null; | FileInputStream in = null; | ||||
try { | try { | ||||
in = new FileInputStream(file); | in = new FileInputStream(file); | ||||
@@ -1,17 +1,24 @@ | |||||
package org.jeecgframework.poi.excel.annotation; | package org.jeecgframework.poi.excel.annotation; | ||||
import java.lang.annotation.ElementType; | |||||
import java.lang.annotation.Retention; | |||||
import java.lang.annotation.RetentionPolicy; | |||||
import java.lang.annotation.Target; | |||||
/** | /** | ||||
* Excel 导入校验 | * Excel 导入校验 | ||||
* | * | ||||
* @author JueYue | * @author JueYue | ||||
* @date 2014年6月23日 下午10:46:26 | * @date 2014年6月23日 下午10:46:26 | ||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | |||||
@Target(ElementType.FIELD) | |||||
public @interface ExcelVerify { | public @interface ExcelVerify { | ||||
/** | /** | ||||
* 接口校验 | * 接口校验 | ||||
* @return | * @return | ||||
*/ | */ | ||||
public boolean interHandler() default true; | |||||
public boolean interHandler() default false; | |||||
/** | /** | ||||
* 是电子邮件 | * 是电子邮件 | ||||
@@ -10,13 +10,12 @@ import org.apache.poi.ss.usermodel.Workbook; | |||||
* @author JueYue | * @author JueYue | ||||
* @date 2014年6月29日 下午5:12:10 | * @date 2014年6月29日 下午5:12:10 | ||||
*/ | */ | ||||
@SuppressWarnings("rawtypes") | |||||
public class ExcelImportResult { | |||||
public class ExcelImportResult<T> { | |||||
/** | /** | ||||
* 结果集 | * 结果集 | ||||
*/ | */ | ||||
private List list; | |||||
private List<T> list; | |||||
/** | /** | ||||
* 是否存在校验失败 | * 是否存在校验失败 | ||||
@@ -27,16 +26,18 @@ public class ExcelImportResult { | |||||
* 数据源 | * 数据源 | ||||
*/ | */ | ||||
private Workbook workbook; | private Workbook workbook; | ||||
public ExcelImportResult() { | public ExcelImportResult() { | ||||
} | } | ||||
public ExcelImportResult(List list, boolean verfiyFail, Workbook workbook) { | |||||
public ExcelImportResult(List<T> list, boolean verfiyFail, Workbook workbook) { | |||||
this.list = list; | this.list = list; | ||||
this.verfiyFail = verfiyFail; | this.verfiyFail = verfiyFail; | ||||
this.workbook = workbook; | this.workbook = workbook; | ||||
} | } | ||||
public List getList() { | |||||
public List<T> getList() { | |||||
return list; | return list; | ||||
} | } | ||||
@@ -48,7 +49,7 @@ public class ExcelImportResult { | |||||
return verfiyFail; | return verfiyFail; | ||||
} | } | ||||
public void setList(List list) { | |||||
public void setList(List<T> list) { | |||||
this.list = list; | this.list = list; | ||||
} | } | ||||
@@ -21,6 +21,8 @@ import org.apache.poi.openxml4j.opc.OPCPackage; | |||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | import org.apache.poi.poifs.filesystem.POIFSFileSystem; | ||||
import org.apache.poi.ss.formula.functions.T; | import org.apache.poi.ss.formula.functions.T; | ||||
import org.apache.poi.ss.usermodel.Cell; | import org.apache.poi.ss.usermodel.Cell; | ||||
import org.apache.poi.ss.usermodel.CellStyle; | |||||
import org.apache.poi.ss.usermodel.Font; | |||||
import org.apache.poi.ss.usermodel.PictureData; | import org.apache.poi.ss.usermodel.PictureData; | ||||
import org.apache.poi.ss.usermodel.Row; | import org.apache.poi.ss.usermodel.Row; | ||||
import org.apache.poi.ss.usermodel.Sheet; | import org.apache.poi.ss.usermodel.Sheet; | ||||
@@ -35,6 +37,8 @@ import org.jeecgframework.poi.excel.entity.result.ExcelImportResult; | |||||
import org.jeecgframework.poi.excel.entity.result.ExcelVerifyHanlderResult; | import org.jeecgframework.poi.excel.entity.result.ExcelVerifyHanlderResult; | ||||
import org.jeecgframework.poi.excel.imports.base.ImportBaseService; | import org.jeecgframework.poi.excel.imports.base.ImportBaseService; | ||||
import org.jeecgframework.poi.excel.imports.verifys.VerifyHandlerServer; | import org.jeecgframework.poi.excel.imports.verifys.VerifyHandlerServer; | ||||
import org.jeecgframework.poi.exception.excel.ExcelImportException; | |||||
import org.jeecgframework.poi.exception.excel.enums.ExcelImportEnum; | |||||
import org.jeecgframework.poi.util.POIPublicUtil; | import org.jeecgframework.poi.util.POIPublicUtil; | ||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
@@ -55,6 +59,10 @@ public class ExcelImportServer extends ImportBaseService { | |||||
private VerifyHandlerServer verifyHandlerServer; | private VerifyHandlerServer verifyHandlerServer; | ||||
private boolean verfiyFail = false; | private boolean verfiyFail = false; | ||||
/** | |||||
* 异常数据styler | |||||
*/ | |||||
private CellStyle errorCellStyle; | |||||
public ExcelImportServer() { | public ExcelImportServer() { | ||||
this.cellValueServer = new CellValueServer(); | this.cellValueServer = new CellValueServer(); | ||||
@@ -190,22 +198,29 @@ public class ExcelImportServer extends ImportBaseService { | |||||
} | } | ||||
} else { | } else { | ||||
object = POIPublicUtil.createObject(pojoClass, targetId); | object = POIPublicUtil.createObject(pojoClass, targetId); | ||||
for (int i = row.getFirstCellNum(), le = row.getLastCellNum(); i < le; i++) { | |||||
Cell cell = row.getCell(i); | |||||
String titleString = (String) titlemap.get(i); | |||||
if (excelParams.containsKey(titleString)) { | |||||
if (excelParams.get(titleString).getType() == 2) { | |||||
picId = row.getRowNum() + "_" + i; | |||||
saveImage(object, picId, excelParams, titleString, pictures, params); | |||||
} else { | |||||
saveFieldValue(params, object, cell, excelParams, titleString, row); | |||||
try { | |||||
for (int i = row.getFirstCellNum(), le = row.getLastCellNum(); i < le; i++) { | |||||
Cell cell = row.getCell(i); | |||||
String titleString = (String) titlemap.get(i); | |||||
if (excelParams.containsKey(titleString)) { | |||||
if (excelParams.get(titleString).getType() == 2) { | |||||
picId = row.getRowNum() + "_" + i; | |||||
saveImage(object, picId, excelParams, titleString, pictures, params); | |||||
} else { | |||||
saveFieldValue(params, object, cell, excelParams, titleString, row); | |||||
} | |||||
} | } | ||||
} | } | ||||
for (ExcelCollectionParams param : excelCollection) { | |||||
addListContinue(object, param, row, titlemap, targetId, pictures, params); | |||||
} | |||||
collection.add(object); | |||||
} catch (ExcelImportException e) { | |||||
if (!e.getType().equals(ExcelImportEnum.VERIFY_ERROR)) { | |||||
throw new ExcelImportException(e.getType(), e); | |||||
} | |||||
} | } | ||||
for (ExcelCollectionParams param : excelCollection) { | |||||
addListContinue(object, param, row, titlemap, targetId, pictures, params); | |||||
} | |||||
collection.add(object); | |||||
} | } | ||||
} | } | ||||
return collection; | return collection; | ||||
@@ -237,6 +252,7 @@ public class ExcelImportServer extends ImportBaseService { | |||||
} else if (POIXMLDocument.hasOOXMLHeader(inputstream)) { | } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) { | ||||
book = new XSSFWorkbook(OPCPackage.open(inputstream)); | book = new XSSFWorkbook(OPCPackage.open(inputstream)); | ||||
} | } | ||||
createErrorCellStyle(book); | |||||
Map<String, PictureData> pictures; | Map<String, PictureData> pictures; | ||||
for (int i = 0; i < params.getSheetNum(); i++) { | for (int i = 0; i < params.getSheetNum(); i++) { | ||||
if (LOGGER.isDebugEnabled()) { | if (LOGGER.isDebugEnabled()) { | ||||
@@ -271,7 +287,6 @@ public class ExcelImportServer extends ImportBaseService { | |||||
* @param cell | * @param cell | ||||
* @param excelParams | * @param excelParams | ||||
* @param titleString | * @param titleString | ||||
* @param excelParams2 | |||||
* @param row | * @param row | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
@@ -288,7 +303,9 @@ public class ExcelImportServer extends ImportBaseService { | |||||
} else { | } else { | ||||
Cell errorCell = row.createCell(row.getLastCellNum()); | Cell errorCell = row.createCell(row.getLastCellNum()); | ||||
errorCell.setCellValue(verifyResult.getMsg()); | errorCell.setCellValue(verifyResult.getMsg()); | ||||
errorCell.setCellStyle(errorCellStyle); | |||||
verfiyFail = true; | verfiyFail = true; | ||||
throw new ExcelImportException(ExcelImportEnum.VERIFY_ERROR); | |||||
} | } | ||||
} | } | ||||
@@ -330,4 +347,11 @@ public class ExcelImportServer extends ImportBaseService { | |||||
} | } | ||||
} | } | ||||
private void createErrorCellStyle(Workbook workbook) { | |||||
errorCellStyle = workbook.createCellStyle(); | |||||
Font font = workbook.createFont(); | |||||
font.setColor(Font.COLOR_RED); | |||||
errorCellStyle.setFont(font); | |||||
} | |||||
} | } |
@@ -19,14 +19,12 @@ public class BaseVerifyHandler { | |||||
private static String MIN_LENGHT = "小于规定长度"; | private static String MIN_LENGHT = "小于规定长度"; | ||||
private static String MAX_LENGHT = "超过规定长度"; | private static String MAX_LENGHT = "超过规定长度"; | ||||
private static Pattern mobilePattern = Pattern | |||||
.compile("/^[+]{0,1}(\\d){1,3}[ ]?([-]?((\\d)|[ ]){1,12})+$/"); | |||||
private static Pattern mobilePattern = Pattern.compile("^[1][3,4,5,8,7][0-9]{9}$"); | |||||
private static Pattern telPattern = Pattern | |||||
.compile("/^[+]{0,1}(\\d){1,3}[ ]?([-]?((\\d)|[ ]){1,12})+$/"); | |||||
private static Pattern telPattern = Pattern.compile("^([0][1-9]{2,3}-)?[0-9]{5,10}$"); | |||||
private static Pattern emailPattern = Pattern | private static Pattern emailPattern = Pattern | ||||
.compile(" /^([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$/"); | |||||
.compile("^([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$"); | |||||
/** | /** | ||||
* email校验 | * email校验 | ||||
@@ -107,7 +105,7 @@ public class BaseVerifyHandler { | |||||
* @return | * @return | ||||
*/ | */ | ||||
public static ExcelVerifyHanlderResult notNull(String name, Object val) { | public static ExcelVerifyHanlderResult notNull(String name, Object val) { | ||||
if (val == null) { | |||||
if (val == null || val.toString().equals("")) { | |||||
return new ExcelVerifyHanlderResult(false, name + NOT_NULL); | return new ExcelVerifyHanlderResult(false, name + NOT_NULL); | ||||
} | } | ||||
return new ExcelVerifyHanlderResult(true); | return new ExcelVerifyHanlderResult(true); | ||||
@@ -12,11 +12,16 @@ import org.jeecgframework.poi.handler.inter.IExcelVerifyHandler; | |||||
* @date 2014年6月29日 下午4:37:56 | * @date 2014年6月29日 下午4:37:56 | ||||
*/ | */ | ||||
public class VerifyHandlerServer { | public class VerifyHandlerServer { | ||||
private void addVerifyResult(ExcelVerifyHanlderResult temp, ExcelVerifyHanlderResult result) { | |||||
if (!temp.isSuccess()) { | |||||
private final static ExcelVerifyHanlderResult DEFAULT_RESULT = new ExcelVerifyHanlderResult( | |||||
true); | |||||
private void addVerifyResult(ExcelVerifyHanlderResult hanlderResult, | |||||
ExcelVerifyHanlderResult result) { | |||||
if (!hanlderResult.isSuccess()) { | |||||
result.setSuccess(false); | result.setSuccess(false); | ||||
result.setMsg(result.getMsg() + temp.getMsg()); | |||||
result.setMsg((StringUtils.isEmpty(result.getMsg()) ? "" : result.getMsg() + " , ") | |||||
+ hanlderResult.getMsg()); | |||||
} | } | ||||
} | } | ||||
@@ -27,27 +32,24 @@ public class VerifyHandlerServer { | |||||
* @param value | * @param value | ||||
* @param titleString | * @param titleString | ||||
* @param verify | * @param verify | ||||
* @param iExcelVerifyHandler | |||||
* @param excelVerifyHandler | |||||
*/ | */ | ||||
public ExcelVerifyHanlderResult verifyData(Object object, Object value, String name, | public ExcelVerifyHanlderResult verifyData(Object object, Object value, String name, | ||||
ExcelVerifyEntity verify, | ExcelVerifyEntity verify, | ||||
IExcelVerifyHandler iExcelVerifyHandler) { | |||||
ExcelVerifyHanlderResult result = new ExcelVerifyHanlderResult(true, ""); | |||||
IExcelVerifyHandler excelVerifyHandler) { | |||||
if (verify == null) { | if (verify == null) { | ||||
return result; | |||||
return DEFAULT_RESULT; | |||||
} | |||||
ExcelVerifyHanlderResult result = new ExcelVerifyHanlderResult(true, ""); | |||||
if (verify.isNotNull()) { | |||||
addVerifyResult(BaseVerifyHandler.notNull(name, value), result); | |||||
} | } | ||||
if (verify.isEmail()) { | if (verify.isEmail()) { | ||||
addVerifyResult(BaseVerifyHandler.isEmail(name, value), result); | addVerifyResult(BaseVerifyHandler.isEmail(name, value), result); | ||||
} | } | ||||
if (verify.isInterHandler()) { | |||||
addVerifyResult(iExcelVerifyHandler.verifyHandler(object, name, value), result); | |||||
} | |||||
if (verify.isMobile()) { | if (verify.isMobile()) { | ||||
addVerifyResult(BaseVerifyHandler.isMobile(name, value), result); | addVerifyResult(BaseVerifyHandler.isMobile(name, value), result); | ||||
} | } | ||||
if (verify.isNotNull()) { | |||||
addVerifyResult(BaseVerifyHandler.notNull(name, value), result); | |||||
} | |||||
if (verify.isTel()) { | if (verify.isTel()) { | ||||
addVerifyResult(BaseVerifyHandler.isTel(name, value), result); | addVerifyResult(BaseVerifyHandler.isTel(name, value), result); | ||||
} | } | ||||
@@ -62,6 +64,9 @@ public class VerifyHandlerServer { | |||||
BaseVerifyHandler.regex(name, value, verify.getRegex(), verify.getRegexTip()), | BaseVerifyHandler.regex(name, value, verify.getRegex(), verify.getRegexTip()), | ||||
result); | result); | ||||
} | } | ||||
if (verify.isInterHandler()) { | |||||
addVerifyResult(excelVerifyHandler.verifyHandler(object, name, value), result); | |||||
} | |||||
return result; | return result; | ||||
} | } | ||||
@@ -7,7 +7,7 @@ package org.jeecgframework.poi.exception.excel.enums; | |||||
*/ | */ | ||||
public enum ExcelImportEnum { | public enum ExcelImportEnum { | ||||
GET_VALUE_ERROR("Excel 值获取失败"); | |||||
GET_VALUE_ERROR("Excel 值获取失败"), VERIFY_ERROR("值校验失败"); | |||||
private String msg; | private String msg; | ||||
@@ -44,7 +44,6 @@ public class ParseWord07 { | |||||
* @param currentRun | * @param currentRun | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
@SuppressWarnings("deprecation") | |||||
private void addAnImage(WordImageEntity obj, XWPFRun currentRun) throws Exception { | private void addAnImage(WordImageEntity obj, XWPFRun currentRun) throws Exception { | ||||
Object[] isAndType = POIPublicUtil.getIsAndType(obj); | Object[] isAndType = POIPublicUtil.getIsAndType(obj); | ||||
String picId; | String picId; | ||||
@@ -1,13 +1,13 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<classpath> | <classpath> | ||||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | |||||
<classpathentry kind="src" output="target/test-classes" path="src/main/java"> | |||||
<attributes> | <attributes> | ||||
<attribute name="optional" value="true"/> | <attribute name="optional" value="true"/> | ||||
<attribute name="maven.pomderived" value="true"/> | <attribute name="maven.pomderived" value="true"/> | ||||
</attributes> | </attributes> | ||||
</classpathentry> | </classpathentry> | ||||
<classpathentry kind="src" path="src/test"/> | <classpathentry kind="src" path="src/test"/> | ||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | |||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/main/resources"> | |||||
<attributes> | <attributes> | ||||
<attribute name="maven.pomderived" value="true"/> | <attribute name="maven.pomderived" value="true"/> | ||||
</attributes> | </attributes> | ||||
@@ -0,0 +1 @@ | |||||
/read |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi; | |||||
package org.jeecgframework.poi.test; | |||||
public class UtilTest { | public class UtilTest { | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import java.util.List; | import java.util.List; | ||||
@@ -0,0 +1,124 @@ | |||||
package org.jeecgframework.poi.test.entity; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | |||||
import org.jeecgframework.poi.excel.annotation.ExcelVerify; | |||||
/** | |||||
* Excel导入校验类 | |||||
* @author JueYue | |||||
* @date 2015年2月24日 下午2:21:07 | |||||
*/ | |||||
public class ExcelVerifyEntity { | |||||
/** | |||||
* Email校验 | |||||
*/ | |||||
@Excel(name = "Email", width = 25) | |||||
@ExcelVerify(isEmail = true, notNull = true) | |||||
private String email; | |||||
/** | |||||
* 手机号校验 | |||||
*/ | |||||
@Excel(name = "Mobile", width = 20) | |||||
@ExcelVerify(isMobile = true, notNull = true) | |||||
private String mobile; | |||||
/** | |||||
* 电话校验 | |||||
*/ | |||||
@Excel(name = "Tel", width = 20) | |||||
@ExcelVerify(isTel = true, notNull = true) | |||||
private String tel; | |||||
/** | |||||
* 最长校验 | |||||
*/ | |||||
@Excel(name = "MaxLength") | |||||
@ExcelVerify(maxLength = 15) | |||||
private String maxLength; | |||||
/** | |||||
* 最短校验 | |||||
*/ | |||||
@Excel(name = "MinLength") | |||||
@ExcelVerify(minLength = 3) | |||||
private String minLength; | |||||
/** | |||||
* 非空校验 | |||||
*/ | |||||
@Excel(name = "NotNull") | |||||
@ExcelVerify(notNull = true) | |||||
private String notNull; | |||||
/** | |||||
* 正则校验 | |||||
*/ | |||||
@Excel(name = "Regex") | |||||
@ExcelVerify(regex = "[\u4E00-\u9FA5]*", regexTip = "不是中文") | |||||
private String regex; | |||||
/** | |||||
* 接口校验 | |||||
*/ | |||||
private String interHandler; | |||||
public String getEmail() { | |||||
return email; | |||||
} | |||||
public void setEmail(String email) { | |||||
this.email = email; | |||||
} | |||||
public String getMobile() { | |||||
return mobile; | |||||
} | |||||
public void setMobile(String mobile) { | |||||
this.mobile = mobile; | |||||
} | |||||
public String getTel() { | |||||
return tel; | |||||
} | |||||
public void setTel(String tel) { | |||||
this.tel = tel; | |||||
} | |||||
public String getMaxLength() { | |||||
return maxLength; | |||||
} | |||||
public void setMaxLength(String maxLength) { | |||||
this.maxLength = maxLength; | |||||
} | |||||
public String getMinLength() { | |||||
return minLength; | |||||
} | |||||
public void setMinLength(String minLength) { | |||||
this.minLength = minLength; | |||||
} | |||||
public String getNotNull() { | |||||
return notNull; | |||||
} | |||||
public void setNotNull(String notNull) { | |||||
this.notNull = notNull; | |||||
} | |||||
public String getRegex() { | |||||
return regex; | |||||
} | |||||
public void setRegex(String regex) { | |||||
this.regex = regex; | |||||
} | |||||
public String getInterHandler() { | |||||
return interHandler; | |||||
} | |||||
public void setInterHandler(String interHandler) { | |||||
this.interHandler = interHandler; | |||||
} | |||||
} |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import java.util.Date; | import java.util.Date; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import java.util.Date; | import java.util.Date; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | import org.jeecgframework.poi.excel.annotation.Excel; | ||||
import org.jeecgframework.poi.excel.annotation.ExcelTarget; | import org.jeecgframework.poi.excel.annotation.ExcelTarget; |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity; | |||||
package org.jeecgframework.poi.test.entity; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | import org.jeecgframework.poi.excel.annotation.Excel; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity.statistics; | |||||
package org.jeecgframework.poi.test.entity.statistics; | |||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity.temp; | |||||
package org.jeecgframework.poi.test.entity.temp; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | import org.jeecgframework.poi.excel.annotation.Excel; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity.temp; | |||||
package org.jeecgframework.poi.test.entity.temp; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | import org.jeecgframework.poi.excel.annotation.Excel; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.entity.temp; | |||||
package org.jeecgframework.poi.test.entity.temp; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.util.List; | import java.util.List; |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.template; | |||||
package org.jeecgframework.poi.test.excel.template; | |||||
import static org.junit.Assert.*; | import static org.junit.Assert.*; | ||||
@@ -11,15 +11,15 @@ import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.statistics.StatisticEntity; | |||||
import org.jeecgframework.poi.entity.temp.BudgetAccountsEntity; | |||||
import org.jeecgframework.poi.entity.temp.PayeeEntity; | |||||
import org.jeecgframework.poi.entity.temp.TemplateExcelExportEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams; | import org.jeecgframework.poi.excel.entity.TemplateExportParams; | ||||
import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerBorderImpl; | import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerBorderImpl; | ||||
import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerColorImpl; | import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerColorImpl; | ||||
import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; | import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; | ||||
import org.jeecgframework.poi.test.entity.statistics.StatisticEntity; | |||||
import org.jeecgframework.poi.test.entity.temp.BudgetAccountsEntity; | |||||
import org.jeecgframework.poi.test.entity.temp.PayeeEntity; | |||||
import org.jeecgframework.poi.test.entity.temp.TemplateExcelExportEntity; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl; | import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.FileNotFoundException; | import java.io.FileNotFoundException; | ||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import static org.junit.Assert.*; | import static org.junit.Assert.*; | ||||
@@ -10,13 +10,13 @@ import java.util.Date; | |||||
import java.util.List; | import java.util.List; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.MsgClient; | |||||
import org.jeecgframework.poi.entity.MsgClientGroup; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.ExportParams; | import org.jeecgframework.poi.excel.entity.ExportParams; | ||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | ||||
import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; | import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.MsgClient; | |||||
import org.jeecgframework.poi.test.entity.MsgClientGroup; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
/** | /** | ||||
* 当行大数据量测试 | * 当行大数据量测试 |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
@@ -8,12 +8,12 @@ import java.util.Date; | |||||
import java.util.List; | import java.util.List; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.statistics.StatisticEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.ExportParams; | import org.jeecgframework.poi.excel.entity.ExportParams; | ||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; | import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; | ||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | ||||
import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; | import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; | ||||
import org.jeecgframework.poi.test.entity.statistics.StatisticEntity; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
public class ExcelExportStatisticTest { | public class ExcelExportStatisticTest { |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
@@ -9,12 +9,12 @@ import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.StudentEntity; | |||||
import org.jeecgframework.poi.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams; | import org.jeecgframework.poi.excel.entity.TemplateExportParams; | ||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; | import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.StudentEntity; | |||||
import org.jeecgframework.poi.test.entity.TeacherEntity; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
@@ -7,11 +7,11 @@ import java.util.List; | |||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.StudentEntity; | |||||
import org.jeecgframework.poi.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.ExportParams; | import org.jeecgframework.poi.excel.entity.ExportParams; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.StudentEntity; | |||||
import org.jeecgframework.poi.test.entity.TeacherEntity; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
@@ -7,11 +7,11 @@ import java.util.List; | |||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.StudentEntity; | |||||
import org.jeecgframework.poi.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.ExportParams; | import org.jeecgframework.poi.excel.entity.ExportParams; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.StudentEntity; | |||||
import org.jeecgframework.poi.test.entity.TeacherEntity; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel.test; | |||||
package org.jeecgframework.poi.test.excel.test; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
@@ -8,13 +8,13 @@ import java.util.HashMap; | |||||
import java.util.List; | import java.util.List; | ||||
import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.StudentEntity; | |||||
import org.jeecgframework.poi.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.excel.ExcelExportUtil; | import org.jeecgframework.poi.excel.ExcelExportUtil; | ||||
import org.jeecgframework.poi.excel.entity.ExportParams; | import org.jeecgframework.poi.excel.entity.ExportParams; | ||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams; | import org.jeecgframework.poi.excel.entity.TemplateExportParams; | ||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.StudentEntity; | |||||
import org.jeecgframework.poi.test.entity.TeacherEntity; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.excel; | |||||
package org.jeecgframework.poi.test.read; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
@@ -8,10 +8,11 @@ import java.util.List; | |||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.commons.lang.builder.ReflectionToStringBuilder; | import org.apache.commons.lang.builder.ReflectionToStringBuilder; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.TestEntity; | |||||
import org.jeecgframework.poi.entity.statistics.StatisticEntity; | |||||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||||
import org.jeecgframework.poi.excel.entity.ImportParams; | import org.jeecgframework.poi.excel.entity.ImportParams; | ||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.TestEntity; | |||||
import org.jeecgframework.poi.test.entity.statistics.StatisticEntity; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
public class ExcelImportUtilTest { | public class ExcelImportUtilTest { |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.word; | |||||
package org.jeecgframework.poi.test.word; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
@@ -9,10 +9,11 @@ import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.poi.xwpf.usermodel.XWPFDocument; | import org.apache.poi.xwpf.usermodel.XWPFDocument; | ||||
import org.jeecgframework.poi.entity.CourseEntity; | |||||
import org.jeecgframework.poi.entity.StudentEntity; | |||||
import org.jeecgframework.poi.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.word.entity.Person; | |||||
import org.jeecgframework.poi.test.entity.CourseEntity; | |||||
import org.jeecgframework.poi.test.entity.StudentEntity; | |||||
import org.jeecgframework.poi.test.entity.TeacherEntity; | |||||
import org.jeecgframework.poi.test.word.entity.Person; | |||||
import org.jeecgframework.poi.word.WordExportUtil; | |||||
import org.jeecgframework.poi.word.entity.params.ExcelListEntity; | import org.jeecgframework.poi.word.entity.params.ExcelListEntity; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; |
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.word; | |||||
package org.jeecgframework.poi.test.word; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
@@ -9,7 +9,8 @@ import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.poi.xwpf.usermodel.XWPFDocument; | import org.apache.poi.xwpf.usermodel.XWPFDocument; | ||||
import org.jeecgframework.poi.word.entity.Person; | |||||
import org.jeecgframework.poi.test.word.entity.Person; | |||||
import org.jeecgframework.poi.word.WordExportUtil; | |||||
import org.jeecgframework.poi.word.entity.WordImageEntity; | import org.jeecgframework.poi.word.entity.WordImageEntity; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.word; | |||||
package org.jeecgframework.poi.test.word; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
@@ -7,6 +7,7 @@ import java.util.HashMap; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.poi.xwpf.usermodel.XWPFDocument; | import org.apache.poi.xwpf.usermodel.XWPFDocument; | ||||
import org.jeecgframework.poi.word.WordExportUtil; | |||||
import org.jeecgframework.poi.word.entity.WordImageEntity; | import org.jeecgframework.poi.word.entity.WordImageEntity; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -1,4 +1,4 @@ | |||||
package org.jeecgframework.poi.word.entity; | |||||
package org.jeecgframework.poi.test.word.entity; | |||||
import org.jeecgframework.poi.excel.annotation.Excel; | import org.jeecgframework.poi.excel.annotation.Excel; | ||||