wangwei hace 6 años
padre
commit
34eb2918f4

+ 25 - 21
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamCloudServiceProvider.java

@@ -51,6 +51,7 @@ import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamCourseRelationBean;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamPaperTypeRelation;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamSpecialSettingsBean;
 import cn.com.qmth.examcloud.examwork.api.request.CountExamStudentReq;
 import cn.com.qmth.examcloud.examwork.api.request.GetExamCourseListReq;
 import cn.com.qmth.examcloud.examwork.api.request.GetExamCoursePaperTypeListReq;
@@ -290,10 +291,11 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 			predicates.add(cb.equal(root.get("examEnable"), enable));
 			predicates.add(cb.isNull(root.get("courseId")));
 
-			Predicate pr1 = cb.isNull(root.get("orgId"));
-			Predicate pr2 = cb.equal(root.get("orgId"), orgId);
-
-			predicates.add(cb.or(pr1, pr2));
+			if (null != orgId) {
+				Predicate pr1 = cb.isNull(root.get("orgId"));
+				Predicate pr2 = cb.equal(root.get("orgId"), orgId);
+				predicates.add(cb.or(pr1, pr2));
+			}
 
 			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
@@ -306,10 +308,12 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		List<ExamSpecialSettingsEntity> resultList = Lists.newArrayList();
 		Map<String, ExamSpecialSettingsEntity> examMap = Maps.newHashMap();
 		for (ExamSpecialSettingsEntity cur : entityList) {
-			resultList.add(cur);
-			if (null == cur.getOrgId() || null == cur.getCourseId()) {
+			if (null == cur.getOrgId() && null == cur.getCourseId()) {
 				examMap.put(String.valueOf(cur.getExamId()), cur);
 			}
+			if (null != cur.getBeginTime() && null != cur.getEndTime()) {
+				resultList.add(cur);
+			}
 		}
 		for (ExamSpecialSettingsEntity cur : entityList) {
 			if ((null != cur.getOrgId() || null != cur.getCourseId()) && null != cur.getEndTime()) {
@@ -320,25 +324,25 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 			}
 		}
 
-		List<ExamBean> list = Lists.newArrayList();
-		for (ExamSpecialSettingsEntity cur : entityList) {
-			ExamBean bean = new ExamBean();
+		List<ExamSpecialSettingsBean> list = Lists.newArrayList();
+		for (ExamSpecialSettingsEntity cur : resultList) {
+			ExamSpecialSettingsBean bean = new ExamSpecialSettingsBean();
 			list.add(bean);
-			ExamEntity exam = examRepo.findOne(cur.getExamId());
-			bean.setId(exam.getId());
-			bean.setBeginTime(exam.getBeginTime());
-			bean.setDuration(exam.getDuration());
-			bean.setEnable(exam.getEnable());
-			bean.setEndTime(exam.getEndTime());
-			bean.setExamTimes(exam.getExamTimes());
-			bean.setExamType(exam.getExamType().name());
-			bean.setName(exam.getName());
-			bean.setRemark(exam.getRemark());
-			bean.setRootOrgId(exam.getRootOrgId());
+			bean.setId(cur.getId());
+			bean.setOrgId(cur.getOrgId());
+			cur.setRootOrgId(cur.getRootOrgId());
+			cur.setUpdateTime(cur.getUpdateTime());
+			bean.setBeginTime(cur.getBeginTime());
+			bean.setCourseId(cur.getCourseId());
+			bean.setEndTime(cur.getEndTime());
+			bean.setExamEnable(cur.getExamEnable());
+			bean.setExamId(cur.getExamId());
+			bean.setExamLimit(cur.getExamLimit());
+			bean.setExamType(cur.getExamType().name());
 		}
 
 		GetOngoingExamListResp resp = new GetOngoingExamListResp();
-		resp.setExamList(list);
+		resp.setExamSpecialSettingsList(list);
 		return resp;
 	}
 

+ 7 - 0
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamServiceImpl.java

@@ -327,6 +327,13 @@ public class ExamServiceImpl implements ExamService {
 		ExamSpecialSettingsEntity examOrgEntity = null;
 
 		Long examId = examSpecialInfo.getExamId();
+		Date beginTime = examSpecialInfo.getBeginTime();
+		Date endTime = examSpecialInfo.getEndTime();
+
+		if (new Boolean(null == beginTime).equals(new Boolean(null == endTime))) {
+			throw new StatusException("E-001101", "beginTime & endTime  wrong");
+		}
+
 		ExamEntity examEntity = examRepo.getOne(examId);
 
 		if (null == examSpecialInfo.getId()) {