Pārlūkot izejas kodu

Merge branch 'master' of http://git.qmth.com.cn/ExamCloud-2/examcloud-core-examwork.git

wangwei 6 gadi atpakaļ
vecāks
revīzija
10f060a0b5

+ 9 - 1
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamStudentController.java

@@ -117,6 +117,7 @@ public class ExamStudentController extends ControllerSupport {
 			@RequestParam(required = false) Long examId,
 			@RequestParam(required = false) String studentName,
 			@RequestParam(required = false) String studentCode,
+			@RequestParam(required = false) Long courseId,
 			@RequestParam(required = false) String courseCode,
 			@RequestParam(required = false) String courseLevel,
 			@RequestParam(required = false) String courseName,
@@ -143,6 +144,9 @@ public class ExamStudentController extends ControllerSupport {
 			if (StringUtils.isNotEmpty(studentCode)) {
 				predicates.add(cb.like(root.get("studentCode"), toSqlSearchPattern(studentCode)));
 			}
+			if (null != courseId) {
+				predicates.add(cb.equal(root.get("courseId"), courseId));
+			}
 			if (StringUtils.isNotEmpty(courseCode)) {
 				predicates.add(cb.equal(root.get("courseCode"), courseCode));
 			}
@@ -217,8 +221,10 @@ public class ExamStudentController extends ControllerSupport {
 			bean.setStudentName(cur.getName());
 			bean.setStudentCode(cur.getStudentCode());
 			bean.setIdentityNumber(cur.getIdentityNumber());
+			bean.setCourseId(cur.getCourseId());
 			bean.setCourseCode(cur.getCourseCode());
 			bean.setCourseName(cur.getCourseName());
+			bean.setCourseLevel(cur.getCourseLevel());
 			bean.setInfoCollector(cur.getInfoCollector());
 			bean.setOrgId(cur.getOrgId());
 			bean.setOrgCode(org.getCode());
@@ -231,7 +237,8 @@ public class ExamStudentController extends ControllerSupport {
 			bean.setExamType(exam.getExamType().name());
 			bean.setUpdateTime(cur.getUpdateTime());
 			bean.setEnable(cur.getEnable());
-			bean.setLocked(exam.getExamStudentLocked());
+			bean.setLocked(
+					null == exam.getExamStudentLocked() ? false : exam.getExamStudentLocked());
 			bean.setStarted(started);
 
 			ret.add(bean);
@@ -316,6 +323,7 @@ public class ExamStudentController extends ControllerSupport {
 		Long studentId = saveStudentResp.getStudentId();
 
 		ExamStudentInfo info = new ExamStudentInfo();
+		info.setCourseId(examStudent.getCourseId());
 		info.setCourseCode(examStudent.getCourseCode());
 		info.setCourseLevel(examStudent.getCourseLevel());
 		info.setCourseName(examStudent.getCourseName());

+ 10 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/bean/ExamStudentDomain.java

@@ -39,6 +39,8 @@ public class ExamStudentDomain implements JsonSerializable {
 
 	private String examNumber;
 
+	private Long courseId;
+
 	private String courseCode;
 
 	private String courseName;
@@ -295,4 +297,12 @@ public class ExamStudentDomain implements JsonSerializable {
 		this.started = started;
 	}
 
+	public Long getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Long courseId) {
+		this.courseId = courseId;
+	}
+
 }

+ 27 - 2
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamStudentCloudServiceProvider.java

@@ -30,12 +30,16 @@ import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
 import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
+import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
+import cn.com.qmth.examcloud.core.examwork.dao.ExamPaperTypeRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamCourseRelationEntity;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationEntity;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
+import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
-import cn.com.qmth.examcloud.core.examwork.service.impl.ExamStudentServiceImpl;
 import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
 import cn.com.qmth.examcloud.examwork.api.request.CopyExamStudentsReq;
@@ -71,7 +75,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 	OrgCloudService orgCloudService;
 
 	@Autowired
-	ExamStudentServiceImpl examStudentService;
+	ExamStudentService examStudentService;
 
 	@Autowired
 	StudentCloudService studentCloudService;
@@ -82,6 +86,12 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 	@Autowired
 	CourseCloudService courseCloudService;
 
+	@Autowired
+	ExamCourseRelationRepo examCourseRelationRepo;
+
+	@Autowired
+	ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
+
 	@ApiOperation(value = "保存考生")
 	@PostMapping("saveExamStudent")
 	@Override
@@ -215,6 +225,21 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 				one.setInfoCollector(es.getInfoCollector());
 
 				ExamStudentEntity saved = examStudentRepo.save(one);
+
+				ExamCourseRelationEntity relation = new ExamCourseRelationEntity();
+				relation.setExamId(saved.getExamId());
+				relation.setCourseId(saved.getCourseId());
+				relation.setCourseLevel(saved.getCourseLevel());
+				relation.setCourseCode(saved.getCourseCode());
+				relation.setCourseName(saved.getCourseName());
+				examCourseRelationRepo.save(relation);
+
+				ExamPaperTypeRelationEntity pt = new ExamPaperTypeRelationEntity();
+				pt.setCourseId(saved.getCourseId());
+				pt.setExamId(saved.getExamId());
+				pt.setPageType(saved.getPaperType());
+				examPaperTypeRelationRepo.save(pt);
+
 				examStudentIds.add(saved.getId());
 			}
 

+ 1 - 1
examcloud-core-examwork-service/pom.xml

@@ -23,7 +23,7 @@
 
 		<dependency>
 			<groupId>cn.com.qmth.examcloud.rmi</groupId>
-			<artifactId>examcloud-core-oe-admin-client</artifactId>
+			<artifactId>examcloud-core-oe-admin-api-client</artifactId>
 			<version>${examcloud.version}</version>
 		</dependency>
 

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

@@ -144,16 +144,13 @@ public class ExamServiceImpl implements ExamService {
 		for (Entry<String, String> entry : properties.entrySet()) {
 			String key = entry.getKey();
 			String value = entry.getValue();
-			if (StringUtils.isBlank(value)) {
-				continue;
-			}
 			DynamicEnum de = null;
 			try {
 				de = manager.getByName(key);
 			} catch (Exception e) {
 				throw new StatusException("E-001004", "考试属性错误");
 			}
-			map.put(de, value.trim());
+			map.put(de, value);
 		}
 
 		String beforeExamRemark = properties.get("BEFORE_EXAM_REMARK");
@@ -213,6 +210,11 @@ public class ExamServiceImpl implements ExamService {
 		for (Entry<DynamicEnum, String> entry : map.entrySet()) {
 			DynamicEnum de = entry.getKey();
 			String value = entry.getValue();
+			if (StringUtils.isBlank(value)) {
+				value = null;
+			} else {
+				value = value.trim();
+			}
 			ExamOrgPropertyEntity entity = examOrgPropertyRepo
 					.findByexamIdAndOrgIdAndKeyId(saved.getExamId(), saved.getOrgId(), de.getId());
 			if (null == entity) {

+ 1 - 1
examcloud-core-examwork-starter/src/main/resources/application-dev.properties

@@ -11,4 +11,4 @@ $log.level.default=debug
 
 $tempDir=D:/Temp/examcloud//tempDir
 
-$deleteExamStudent.force=true
+$deleteExamStudent.force=false

+ 1 - 1
examcloud-core-examwork-starter/src/main/resources/application-test.properties

@@ -13,4 +13,4 @@ $log.level.default=debug
 
 $tempDir=/home/qmth/project/examcloud/examcloud-core-examwork/tempDir
 
-$deleteExamStudent.force=true
+$deleteExamStudent.force=false