easypoi excle 사용자 정의 데이터 검증

1968 단어 자바
easypoi 문서  http://easypoi.mydoc.io/#text_202981
//    
public class user implements IExcelModel, IExcelDataModel{

    //    get/set
    @Excel(name = "  ")
    @NotNull(message="      ")
    private String name;

    //    
    private String errorMsg;

    //    
    private int rowNum;

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
         this.errorMsg = errorMsg;
    }




} 

 
 
 
//        
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(1);
params.setImportFields(importFields);
//     
params.setVerifyHandler(new ReduceApplyExcelVerifyHandler());
params.setNeedVerfiy(true);
//  IExcelVerifyHandler       excle       
public class ReduceApplyExcelVerifyHandler implements IExcelVerifyHandler {

	@Override
	public ExcelVerifyHandlerResult verifyHandler(ReduceApply obj) {
		
                //                ,                       

                //      
		List list = new ArrayList<>(14);
		list.add("    ");
		list.add("       ");
		list.add("      ");
		list.add("    ");
		list.add("    ");
		list.add("    ");
		list.add("  ");
		list.add("       ");
		list.add("     ");
		list.add("     ");
		list.add("       ");
		list.add("       ");
		list.add("   、       ");
		list.add("          ");
		if(!list.contains(obj.getReduceRsn().trim())) {
			return new ExcelVerifyHandlerResult(false,"        !");
		}
		return new  ExcelVerifyHandlerResult(true);
	}

}

좋은 웹페이지 즐겨찾기