|
|
|
@ -24,6 +24,8 @@ import java.util.Set;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
|
import org.apache.commons.lang3.RegExUtils;
|
|
|
|
|
import org.apache.commons.lang3.reflect.FieldUtils;
|
|
|
|
@ -421,6 +423,12 @@ public class ExcelUtil<T>
|
|
|
|
|
// 从map中得到对应列的field.
|
|
|
|
|
Field field = (Field) entry.getValue()[0];
|
|
|
|
|
Excel attr = (Excel) entry.getValue()[1];
|
|
|
|
|
boolean rq = attr.required();
|
|
|
|
|
if(rq){
|
|
|
|
|
if(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString())) {
|
|
|
|
|
throw new ServiceException("第"+i+"行"+attr.name()+"单元格必填项未填写,请正确填写!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 取得类型,并根据对象类型设置值.
|
|
|
|
|
Class<?> fieldType = field.getType();
|
|
|
|
|
if (String.class == fieldType)
|
|
|
|
|