WANG 6 anni fa
parent
commit
e541088677

+ 17 - 17
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -176,14 +176,14 @@ public class ExamController extends ControllerSupport {
 			@RequestParam(required = true) Long courseId) {
 
 		if (null == examId) {
-			throw new StatusException("E-001251", "examId is null");
+			throw new StatusException("001251", "examId is null");
 		}
 		if (null == courseId) {
-			throw new StatusException("E-001252", "courseId is null");
+			throw new StatusException("001252", "courseId is null");
 		}
 		ExamEntity one = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == one) {
-			throw new StatusException("E-001253", "examId is wrong");
+			throw new StatusException("001253", "examId is wrong");
 		}
 
 		validateRootOrgIsolation(one.getRootOrgId());
@@ -201,7 +201,7 @@ public class ExamController extends ControllerSupport {
 
 		ExamEntity one = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == one) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(one.getRootOrgId());
 
@@ -361,7 +361,7 @@ public class ExamController extends ControllerSupport {
 
 				if (CollectionUtils.isNotEmpty(etList)) {
 					if (10 < examTypeList.size()) {
-						throw new StatusException("E-001120", "too many examTypes");
+						throw new StatusException("001120", "too many examTypes");
 					}
 					if (1 == examTypeList.size()) {
 						predicates.add(cb.equal(root.get("examType"), etList.get(0)));
@@ -452,7 +452,7 @@ public class ExamController extends ControllerSupport {
 	public ExamDomain getExamById(@PathVariable Long examId) {
 		ExamEntity one = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == one) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(one.getRootOrgId());
 
@@ -568,7 +568,7 @@ public class ExamController extends ControllerSupport {
 
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
@@ -595,7 +595,7 @@ public class ExamController extends ControllerSupport {
 	public String getExamProperty(@PathVariable Long examId, @PathVariable String key) {
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 		DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
@@ -620,7 +620,7 @@ public class ExamController extends ControllerSupport {
 		User accessUser = getAccessUser();
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
@@ -642,12 +642,12 @@ public class ExamController extends ControllerSupport {
 	public String getExamOrgProperty(@PathVariable Long examId, @PathVariable Long orgId, @PathVariable String key) {
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
 		if (null == orgId) {
-			throw new StatusException("E-001251", "orgId is null");
+			throw new StatusException("001251", "orgId is null");
 		}
 
 		GetOrgReq getOrgReq = new GetOrgReq();
@@ -895,11 +895,11 @@ public class ExamController extends ControllerSupport {
 
 		Long examId = examOrgDomain.getExamId();
 		if (null == examOrgDomain.getExamId()) {
-			throw new StatusException("E-001210", "examId is null");
+			throw new StatusException("001210", "examId is null");
 		}
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
@@ -969,7 +969,7 @@ public class ExamController extends ControllerSupport {
 		User accessUser = getAccessUser();
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
@@ -1045,7 +1045,7 @@ public class ExamController extends ControllerSupport {
 
 		ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == examEntity) {
-			throw new StatusException("E-001250", "examId is wrong");
+			throw new StatusException("001250", "examId is wrong");
 		}
 		validateRootOrgIsolation(examEntity.getRootOrgId());
 
@@ -1157,7 +1157,7 @@ public class ExamController extends ControllerSupport {
 
 		ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == exam) {
-			throw new StatusException("E-001010", "考试不存在");
+			throw new StatusException("001010", "考试不存在");
 		}
 
 		validateRootOrgIsolation(exam.getRootOrgId());
@@ -1216,7 +1216,7 @@ public class ExamController extends ControllerSupport {
 	public Map<String, Object> ipLimit(HttpServletRequest request, @PathVariable Long examId) {
 		ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		if (null == exam) {
-			throw new StatusException("E-001010", "考试不存在");
+			throw new StatusException("001010", "考试不存在");
 		}
 
 		Map<String, Object> map = Maps.newHashMap();

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

@@ -277,7 +277,7 @@ public class ExamStudentController extends ControllerSupport {
 	public ExamStudentEntity getExamStudentById(@PathVariable Long id) {
 		ExamStudentEntity es = GlobalHelper.getEntity(examStudentRepo, id, ExamStudentEntity.class);
 		if (null == es) {
-			throw new StatusException("E-520001", "考生不存在");
+			throw new StatusException("520001", "考生不存在");
 		}
 		return es;
 	}

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

@@ -169,10 +169,10 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		Long rootOrgId = req.getRootOrgId();
 		String name = req.getName();
 		if (null == id && StringUtils.isBlank(name)) {
-			throw new StatusException("E-002002", "id,name不能都为空");
+			throw new StatusException("002002", "id,name不能都为空");
 		}
 		if (null != id && StringUtils.isNotBlank(name)) {
-			throw new StatusException("E-002003", "id,name不能都不为空");
+			throw new StatusException("002003", "id,name不能都不为空");
 		}
 		ExamEntity exam = null;
 
@@ -180,13 +180,13 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 			exam = GlobalHelper.getEntity(examRepo, id, ExamEntity.class);
 		} else if (StringUtils.isNotBlank(name)) {
 			if (null == rootOrgId) {
-				throw new StatusException("E-002004", "rootOrgId is null");
+				throw new StatusException("002004", "rootOrgId is null");
 			}
 			exam = examRepo.findByNameAndRootOrgId(name, rootOrgId);
 		}
 
 		if (null == exam) {
-			throw new StatusException("E-002005", "考试不存在");
+			throw new StatusException("002005", "考试不存在");
 		}
 		GetExamResp examResp = new GetExamResp();
 		examResp.setId(exam.getId());
@@ -280,7 +280,7 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 			try {
 				et = ExamType.valueOf(examType);
 			} catch (Exception e) {
-				throw new StatusException("E-002005", "examType is wrong");
+				throw new StatusException("002005", "examType is wrong");
 			}
 		}
 
@@ -364,15 +364,15 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		List<Long> examIdList = req.getExamIdList();
 
 		if (CollectionUtils.isEmpty(examIdList)) {
-			throw new StatusException("E-002003", "examIdList is empty");
+			throw new StatusException("002003", "examIdList is empty");
 		}
 		for (Long examId : examIdList) {
 			if (null == examId) {
-				throw new StatusException("E-002001", "examId is null");
+				throw new StatusException("002001", "examId is null");
 			}
 			ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 			if (null == exam) {
-				throw new StatusException("E-002002", "ExamEntity is null");
+				throw new StatusException("002002", "ExamEntity is null");
 			}
 			exam.setExamStudentLocked(true);
 			examRepo.save(exam);
@@ -391,16 +391,16 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		List<Long> examIdList = req.getExamIdList();
 
 		if (CollectionUtils.isEmpty(examIdList)) {
-			throw new StatusException("E-002003", "examIdList is empty");
+			throw new StatusException("002003", "examIdList is empty");
 		}
 
 		for (Long examId : examIdList) {
 			if (null == examId) {
-				throw new StatusException("E-002001", "examId is null");
+				throw new StatusException("002001", "examId is null");
 			}
 			ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 			if (null == exam) {
-				throw new StatusException("E-002002", "ExamEntity is null");
+				throw new StatusException("002002", "ExamEntity is null");
 			}
 			exam.setExamStudentLocked(false);
 			examRepo.save(exam);
@@ -675,7 +675,7 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		String name = req.getPropertyName();
 
 		if (StringUtils.isBlank(name)) {
-			throw new StatusException("E-003005", "propertyName is blank");
+			throw new StatusException("003005", "propertyName is blank");
 		}
 
 		if (name.equals("examSite")) {
@@ -691,7 +691,7 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		} else if (name.equals("ext5")) {
 			valueList = examStudentRepo.queryExt5List(examId, start);
 		} else {
-			throw new StatusException("E-003006", "propertyName is wrong");
+			throw new StatusException("003006", "propertyName is wrong");
 		}
 
 		GetExamStudentPropertyValueListResp resp = new GetExamStudentPropertyValueListResp();

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

@@ -162,23 +162,23 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 		Long examId2 = req.getExamId2();
 
 		if (null == examId1) {
-			throw new StatusException("E-210001", "examId1 is null");
+			throw new StatusException("210001", "examId1 is null");
 		}
 		if (null == examId2) {
-			throw new StatusException("E-210002", "examId2 is null");
+			throw new StatusException("210002", "examId2 is null");
 		}
 
 		ExamEntity exam1 = GlobalHelper.getEntity(examRepo, examId1, ExamEntity.class);
 		ExamEntity exam2 = GlobalHelper.getEntity(examRepo, examId2, ExamEntity.class);
 		if (null == exam1) {
-			throw new StatusException("E-210003", "ExamEntity is null");
+			throw new StatusException("210003", "ExamEntity is null");
 		}
 		if (null == exam2) {
-			throw new StatusException("E-210004", "ExamEntity is null");
+			throw new StatusException("210004", "ExamEntity is null");
 		}
 
 		if (!exam1.getRootOrgId().equals(exam2.getRootOrgId())) {
-			throw new StatusException("E-210005", "examId1 and examId2  is not matched");
+			throw new StatusException("210005", "examId1 and examId2  is not matched");
 		}
 
 		final Long rootOrgId = exam1.getRootOrgId();
@@ -315,7 +315,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 		Integer pageSize = req.getPageSize();
 
 		if (null == rootOrgId) {
-			throw new StatusException("E-210005", "rootOrgId is null");
+			throw new StatusException("210005", "rootOrgId is null");
 		}
 
 		Specification<ExamStudentEntity> specification = (root, query, cb) -> {

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

@@ -97,15 +97,15 @@ public class ExamServiceImpl implements ExamService {
 		ExamType examType = examInfo.getExamType();
 
 		if (null == examType) {
-			throw new StatusException("E-001005", "考试类型不能为空");
+			throw new StatusException("001005", "考试类型不能为空");
 		}
 
 		if (StringUtils.isBlank(code)) {
-			throw new StatusException("E-001005", "考试编码不能为空");
+			throw new StatusException("001005", "考试编码不能为空");
 		}
 
 		if (null == rootOrgId) {
-			throw new StatusException("E-001005", "rootOrgId is null");
+			throw new StatusException("001005", "rootOrgId is null");
 		}
 
 		GetOrgReq getOrgReq = new GetOrgReq();
@@ -123,7 +123,7 @@ public class ExamServiceImpl implements ExamService {
 		if (curd.equals(CURD.UPDATE)) {
 			exam = examRepo.findByCodeAndRootOrgId(code, rootOrgId);
 			if (null == exam) {
-				throw new StatusException("E-002001", "code is wrong");
+				throw new StatusException("002001", "code is wrong");
 			}
 			realStatus = CURD.UPDATE;
 		}
@@ -148,23 +148,23 @@ public class ExamServiceImpl implements ExamService {
 
 		if (realStatus.equals(CURD.CREATION)) {
 			if (null == examInfo.getBeginTime()) {
-				throw new StatusException("E-002006", "beginTime is null");
+				throw new StatusException("002006", "beginTime is null");
 			}
 			if (null == examInfo.getEndTime()) {
-				throw new StatusException("E-002006", "endTime is null");
+				throw new StatusException("002006", "endTime is null");
 			}
 			if (StringUtils.isBlank(name)) {
-				throw new StatusException("E-002004", "name is blank");
+				throw new StatusException("002004", "name is blank");
 			}
 
 			ExamEntity examByCode = examRepo.findByCodeAndRootOrgId(code, rootOrgId);
 			if (null != examByCode) {
-				throw new StatusException("E-002005", "考试编码已存在");
+				throw new StatusException("002005", "考试编码已存在");
 			}
 
 			ExamEntity examByName = examRepo.findByNameAndRootOrgId(name, rootOrgId);
 			if (null != examByName) {
-				throw new StatusException("E-002005", "考试名称已存在");
+				throw new StatusException("002005", "考试名称已存在");
 			}
 
 			exam.setCode(code);
@@ -173,10 +173,10 @@ public class ExamServiceImpl implements ExamService {
 			exam.setEnable(true);
 		} else if (realStatus.equals(CURD.UPDATE)) {
 			if (!exam.getRootOrgId().equals(rootOrgId)) {
-				throw new StatusException("E-002003", "rootOrgId is wrong");
+				throw new StatusException("002003", "rootOrgId is wrong");
 			}
 			if (!exam.getExamType().equals(examType)) {
-				throw new StatusException("E-002100", "examType is wrong");
+				throw new StatusException("002100", "examType is wrong");
 			}
 		}
 
@@ -273,27 +273,27 @@ public class ExamServiceImpl implements ExamService {
 			try {
 				de = manager.getByName(key);
 			} catch (Exception e) {
-				throw new StatusException("E-001004", "考试属性错误. key=" + key);
+				throw new StatusException("001004", "考试属性错误. key=" + key);
 			}
 			if (!de.isLegal(value)) {
-				throw new StatusException("E-001200", "考试属性值非法. key=" + key);
+				throw new StatusException("001200", "考试属性值非法. key=" + key);
 			}
 			map.put(de, value);
 		}
 
 		String beforeExamRemark = properties.get("BEFORE_EXAM_REMARK");
 		if (null != beforeExamRemark && beforeExamRemark.length() > 250000) {
-			throw new StatusException("E-001002", "考前说明内容过大");
+			throw new StatusException("001002", "考前说明内容过大");
 		}
 
 		String afterExamRemark = properties.get("AFTER_EXAM_REMARK");
 		if (null != afterExamRemark && afterExamRemark.length() > 250000) {
-			throw new StatusException("E-001002", "考后说明内容过大");
+			throw new StatusException("001002", "考后说明内容过大");
 		}
 
 		String cheatingRemark = properties.get("CHEATING_REMARK");
 		if (null != cheatingRemark && cheatingRemark.length() > 250000) {
-			throw new StatusException("E-001002", "作弊说明内容过大");
+			throw new StatusException("001002", "作弊说明内容过大");
 		}
 
 		return map;
@@ -318,7 +318,7 @@ public class ExamServiceImpl implements ExamService {
 		Date endTime = examSpecialInfo.getEndTime();
 
 		if (!new Boolean(null == beginTime).equals(new Boolean(null == endTime))) {
-			throw new StatusException("E-001101", "beginTime & endTime  wrong");
+			throw new StatusException("001101", "beginTime & endTime  wrong");
 		}
 
 		ExamEntity examEntity = examRepo.getOne(examId);
@@ -333,7 +333,7 @@ public class ExamServiceImpl implements ExamService {
 			examOrgEntity = GlobalHelper.getEntity(examSpecialSettingsRepo, examSpecialInfo.getId(),
 					ExamSpecialSettingsEntity.class);
 			if (null == examOrgEntity) {
-				throw new StatusException("E-001101", "id is wrong");
+				throw new StatusException("001101", "id is wrong");
 			}
 		}
 

+ 8 - 8
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamStudentServiceImpl.java

@@ -116,7 +116,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		for (ExamStudentEntity examStudent : examStudents) {
 			// 网考判断
 			if ((!forceDeleteExamStudent()) && isStarted(examStudent.getExamId(), null, null)) {
-				throw new StatusException("E-150112", examStudent.getName() + "已开始考试,不能删除");
+				throw new StatusException("150112", examStudent.getName() + "已开始考试,不能删除");
 			}
 			examStudentRepo.delete(examStudent);
 
@@ -165,7 +165,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 		// 已经开考
 		if ((!forceDeleteExamStudent()) && isStarted(exam.getId(), null, null)) {
-			throw new StatusException("E-150113", "该考试已开始,不能删除");
+			throw new StatusException("150113", "该考试已开始,不能删除");
 		}
 		examStudentRepo.deleteByExamId(examId);
 		examCourseRelationRepo.deleteByExamId(examId);
@@ -193,7 +193,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		if (StringUtils.isBlank(paperType)) {
 			paperType = "X";
 		} else if (!paperType.matches("[A-Z]")) {
-			throw new StatusException("E-100020", "试卷类型必须为一个大写的英文字母");
+			throw new StatusException("100020", "试卷类型必须为一个大写的英文字母");
 		}
 
 		Long rootOrgId = examStudentInfo.getRootOrgId();
@@ -202,7 +202,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		GetOrgResp getOrgResp = orgCloudService.getOrg(getOrgReq);
 		OrgBean rootOrg = getOrgResp.getOrg();
 		if (null != rootOrg.getParentId()) {
-			throw new StatusException("E-100001", "rootOrgId is wrong");
+			throw new StatusException("100001", "rootOrgId is wrong");
 		}
 
 		ExamEntity exam = null;
@@ -212,21 +212,21 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		if (null != examId) {
 			exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 			if (null == exam) {
-				throw new StatusException("E-100020", "examId is wrong");
+				throw new StatusException("100020", "examId is wrong");
 			}
 		} else if (StringUtils.isNotBlank(examName)) {
 			exam = examRepo.findByNameAndRootOrgId(examName, rootOrgId);
 			if (null == exam) {
-				throw new StatusException("E-100005", "考试不存在");
+				throw new StatusException("100005", "考试不存在");
 			}
 		} else {
-			throw new StatusException("E-100002", "examId & examName are both blank");
+			throw new StatusException("100002", "examId & examName are both blank");
 		}
 
 		String identityNumber = examStudentInfo.getIdentityNumber();
 
 		if (StringUtils.isBlank(identityNumber)) {
-			throw new StatusException("E-100003", "identityNumber is null");
+			throw new StatusException("100003", "identityNumber is null");
 		}
 		GetStudentReq getStudentReq = new GetStudentReq();
 		getStudentReq.setRootOrgId(rootOrgId);