Przeglądaj źródła

命题任务批量导入

caozixuan 3 lat temu
rodzic
commit
fb71be241b

+ 16 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -533,6 +533,21 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     blurryUserDtoList = listUsers(examTaskTemp.getCourseCode(), null);
                 }
                 examTaskDto.setUsers(blurryUserDtoList);
+                String userName = examTaskTempDto.getUserName();
+                String userAccount = examTaskTempDto.getUserAccount();
+                if (SystemConstant.strNotNull(userName) && SystemConstant.strNotNull(userAccount)){
+                    List<BlurryUserDto> match = blurryUserDtoList.stream()
+                            .filter(e -> e.getLoginName().equals(userAccount) && e.getName().equals(userName))
+                            .collect(Collectors.toList());
+                    if (match.size() > 1){
+                        throw ExceptionResultEnum.ERROR.exception("数据异常");
+                    }
+                    if (match.size() == 1){
+                        BlurryUserDto tmp = match.get(0);
+                        examTaskDto.setUserId(String.valueOf(tmp.getId()));
+                        examTaskDto.setUserName(tmp.getName());
+                    }
+                }
 
 //                // 校验命题老师
 //                if (StringUtils.isBlank(examTaskTemp.getUserAccount())) {
@@ -556,6 +571,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 tasks.add(examTaskDto);
             }
         }
+
         // 设置重复信息,页面做二次校验
         examTaskImportDto.setErrorMsg(stringJoiner.toString());
         examTaskImportDto.setTasks(tasks);