数据导入1.2,对数据进行检查
This commit is contained in:
parent
1c7cca09c9
commit
1526d304bc
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
||||||
|
|
||||||
|
|
||||||
import com.linuxense.javadbf.DBFReader;
|
import com.linuxense.javadbf.DBFReader;
|
||||||
|
import org.jeecg.common.util.DateUtils;
|
||||||
import org.jeecg.modules.anno.AttributeName;
|
import org.jeecg.modules.anno.AttributeName;
|
||||||
import org.jeecg.modules.entity.CET;
|
import org.jeecg.modules.entity.CET;
|
||||||
import org.jeecg.modules.mapper.CetMapper;
|
import org.jeecg.modules.mapper.CetMapper;
|
||||||
|
@ -17,6 +18,7 @@ import java.sql.Timestamp;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DBFImporter {
|
public class DBFImporter {
|
||||||
|
@ -48,8 +50,13 @@ public class DBFImporter {
|
||||||
field.set(cet, String.valueOf(value));
|
field.set(cet, String.valueOf(value));
|
||||||
if (field.getName().equals("id")) {
|
if (field.getName().equals("id")) {
|
||||||
// System.out.println(field.getName());
|
// System.out.println(field.getName());
|
||||||
String s = String.valueOf(value);
|
String entryDate = String.valueOf(value);
|
||||||
cet.setEntrydate(s.substring(0, 4));
|
//对学生信息进行检查
|
||||||
|
int entry = Integer.parseInt(entryDate);
|
||||||
|
int year = DateUtils.getYear();
|
||||||
|
if (entry<2015||entry>year+1||Pattern.compile("[a-zA-Z]").matcher(entryDate).find()) continue;
|
||||||
|
|
||||||
|
cet.setEntrydate(entryDate.substring(0, 4));
|
||||||
}
|
}
|
||||||
} else if (fieldType == int.class || fieldType == Integer.class) {
|
} else if (fieldType == int.class || fieldType == Integer.class) {
|
||||||
Object value = rowValues[fieldIndex - 1];
|
Object value = rowValues[fieldIndex - 1];
|
||||||
|
|
Loading…
Reference in New Issue