Ver Fonte

add logs.

deason há 1 ano atrás
pai
commit
d8febe142b

+ 18 - 3
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigServiceImpl.java

@@ -1428,11 +1428,12 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     	if(ExamType.OFFLINE.name().equals(examRes.getExamBean().getExamType())) {
     		throw new StatusException("不能对离线考试创建调卷规则");
     	}
+
     	// 从考务查询改考试下的所有课程
         List<ExamCourseRelationBean> courseInfoList = new ArrayList<>();
         GetExamCourseListReq req = new GetExamCourseListReq();
         req.setExamId(examRes.getExamBean().getId());
-        Long start = 1l;
+        Long start = 1L;
         for(;;) {
             req.setStart(start);
             GetExamCourseListResp resp = examCloudService.getExamCourseList(req);
@@ -1444,8 +1445,10 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
             }
         }
         if (CollectionUtils.isEmpty(courseInfoList)) {
+            LOG.warn("==>当前考试下课程列表为空!rootOrgId:{} examId:{}",examReq.getRootOrgId(),req.getExamId());
         	throw new StatusException("请先同步考生再创建调卷规则");
         }
+
         for(ExamCourseRelationBean course:courseInfoList) {
         	createByCourse(param.getRootOrgId(), examRes.getExamBean(), course);
         }
@@ -1454,11 +1457,14 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     private void createByCourse(Long rootOrgId,ExamBean examBean,ExamCourseRelationBean course) {
     	List<RandomPaperListVo> rps=randomPaperService.getList(rootOrgId,course.getCourseId());
     	if(CollectionUtils.isEmpty(rps)) {
+            LOG.warn("==>没有启用的随机抽题模板!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,examBean.getId(),course.getCourseCode());
     		throw new StatusException(course.getCourseName()+",没有启用的随机抽题模板");
     	}
     	if(rps.size()>1) {
+            LOG.warn("==>存在多个启用的随机抽题模板!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,examBean.getId(),course.getCourseCode());
     		throw new StatusException("存在多个启用的随机抽题模板");
     	}
+
     	ExtractConfig extractConfig=findConfig(examBean.getId(), course.getCourseCode());
     	if(extractConfig==null) {
 	    	extractConfig=new ExtractConfig();
@@ -1474,7 +1480,9 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     	extractConfig.setCallType(CallType.RANDOM_PAPER);
 		extractConfig.setPlayTime(1);
         extractConfigRepo.save(extractConfig);
-     // 清除缓存
+        LOG.warn("==>创建随机抽卷调卷规则成功!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,examBean.getId(),course.getCourseCode());
+
+        // 清除缓存
  		extractConfigCache.remove(extractConfig.getExamId(), extractConfig.getCourseCode());
     }
     private Course of(ExamCourseRelationBean course,Long rootOrgId) {
@@ -1519,16 +1527,21 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
         settingReq.setExamId(examRes.getExamBean().getId());
         settingReq.setCourseId(Long.valueOf(course.getId()));
         GetExamCourseResp settingResp = examCloudService.getExamCourseSetting(settingReq);
+
         if(settingResp.getBean()==null) {
+            LOG.warn("-->当前考试课程不存在!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,req.getExamId(),req.getCourseCode());
         	throw new StatusException("请先同步考生后再创建相应课程的调卷规则");
         }
     	List<RandomPaperListVo> rps=randomPaperService.getList(rootOrgId, Long.valueOf(course.getId()));
     	if(CollectionUtils.isEmpty(rps)) {
+            LOG.warn("-->没有启用的随机抽题模板!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,req.getExamId(),req.getCourseCode());
     		throw new StatusException("没有启用的随机抽题模板");
     	}
     	if(rps.size()>1) {
+            LOG.warn("-->存在多个启用的随机抽题模板!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,req.getExamId(),req.getCourseCode());
     		throw new StatusException("存在多个启用的随机抽题模板");
     	}
+
     	ExtractConfig extractConfig=findConfig(examRes.getExamBean().getId(), req.getCourseCode());
     	if(extractConfig==null) {
 	    	extractConfig=new ExtractConfig();
@@ -1544,7 +1557,9 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     	extractConfig.setRandomPaperId(rps.get(0).getId());
 		extractConfig.setPlayTime(1);
         extractConfigRepo.save(extractConfig);
-     // 清除缓存
+        LOG.warn("-->创建随机抽卷调卷规则成功!rootOrgId:{} examId:{} courseCode:{}",rootOrgId,req.getExamId(),req.getCourseCode());
+
+        // 清除缓存
  		extractConfigCache.remove(extractConfig.getExamId(), extractConfig.getCourseCode());
 	}
 }