|
@@ -241,7 +241,6 @@ public class DataUploadService {
|
|
|
if (papers != null && papers.size() > 0) {
|
|
|
throw new Exception("已有采集数据,不能导入考生数据");
|
|
|
}
|
|
|
- examQuestionRepo.deleteByWorkId(workId);
|
|
|
List<Student> studentList = new ArrayList<>();
|
|
|
|
|
|
ExcelReader excelReader = new ExcelReader(StudentDTO.class);
|
|
@@ -266,6 +265,7 @@ public class DataUploadService {
|
|
|
|
|
|
long isExist = examQuestionRepo.countByWorkIdAndAreaCode(workId, dto.getAreaCode());
|
|
|
if (isExist == 0) {
|
|
|
+ examQuestionRepo.deleteByWorkIdAndAreaCode(workId, dto.getAreaCode());
|
|
|
if (!imageConfig.isCustomSubject()) {
|
|
|
for (Subject subject : Subject.values()) {
|
|
|
ExamQuestion question = new ExamQuestion(dto.getAreaCode(), subject, workId, dto.getAreaName());
|
|
@@ -643,15 +643,19 @@ public class DataUploadService {
|
|
|
Long random = 0L;
|
|
|
while (true) {
|
|
|
random = randomUtil.getRandomMap().get(workId).get(new Random().nextInt(randomUtil.getRandomMap().get(workId).size()));
|
|
|
-// random = RandomUtil.randomList.get(new Random().nextInt(RandomUtil.randomList.size()));
|
|
|
result = paperRepo.countByWorkIdAndExamNumberAndRandomSeq(workId, examNumber, random);
|
|
|
- if (result == 0 && random != Long.parseLong(examNumber.substring(3, examNumber.length()))) {
|
|
|
+ String examNumberSub;
|
|
|
+ if(examNumber.length() > 3){
|
|
|
+ examNumberSub = examNumber.substring(3);
|
|
|
+ } else {
|
|
|
+ examNumberSub = examNumber;
|
|
|
+ }
|
|
|
+ if (result == 0 && !random.toString().equals(examNumberSub)) {
|
|
|
break;
|
|
|
} else {
|
|
|
count++;
|
|
|
}
|
|
|
if (count > 1000) {
|
|
|
-// throw new Exception("重复几率较高,建议重新生成随机号");
|
|
|
randomUtil.getRandom(workId, true);
|
|
|
getRandom(workId, examNumber);
|
|
|
}
|