|
|
@@ -12,7 +12,6 @@ import nju.seec.helper.enums.ExceptionType;
|
|
|
import nju.seec.helper.enums.UserType;
|
|
|
import nju.seec.helper.exception.HelperException;
|
|
|
import nju.seec.helper.service.CourseService;
|
|
|
-import nju.seec.helper.util.EncryptUtils;
|
|
|
import nju.seec.helper.vo.CourseVO;
|
|
|
import nju.seec.helper.vo.UserVO;
|
|
|
import org.springframework.dao.DataIntegrityViolationException;
|
|
|
@@ -46,8 +45,7 @@ public class CourseServiceImpl implements CourseService {
|
|
|
.setTeacher(userDAO.findUserById(teacher.getId()))
|
|
|
.setName(courseDTO.getName())
|
|
|
.setBio(courseDTO.getBio())
|
|
|
- .setCode(EncryptUtils.encode(courseDTO.getCode()))
|
|
|
- )
|
|
|
+ .setCode(courseDTO.getCode()))
|
|
|
);
|
|
|
} catch (DataIntegrityViolationException e) {
|
|
|
throw HelperException.of(ExceptionType.CONFLICT, "创建失败,请检查课程信息是否正确且不与已有课程冲突");
|
|
|
@@ -68,7 +66,7 @@ public class CourseServiceImpl implements CourseService {
|
|
|
courseDAO.save(
|
|
|
course.setName(courseDTO.getName())
|
|
|
.setBio(courseDTO.getBio())
|
|
|
- .setCode(EncryptUtils.encode(courseDTO.getCode()))
|
|
|
+ .setCode(courseDTO.getCode())
|
|
|
)
|
|
|
);
|
|
|
} catch (DataIntegrityViolationException e) {
|
|
|
@@ -98,7 +96,7 @@ public class CourseServiceImpl implements CourseService {
|
|
|
throw HelperException.of(ExceptionType.CONFLICT, "您已选课");
|
|
|
}
|
|
|
|
|
|
- if (!courseDAO.existsByIdAndCode(courseId, EncryptUtils.encode(chooseDTO.getCode()))) {
|
|
|
+ if (!courseDAO.existsByIdAndCode(courseId, chooseDTO.getCode())) {
|
|
|
throw HelperException.of(ExceptionType.NOT_FOUND, "选课码错误");
|
|
|
}
|
|
|
|
|
|
@@ -142,7 +140,7 @@ public class CourseServiceImpl implements CourseService {
|
|
|
throw HelperException.of(ExceptionType.FORBIDDEN, "您无权获取该课程选课码");
|
|
|
}
|
|
|
|
|
|
- return EncryptUtils.decode(course.getCode());
|
|
|
+ return course.getCode();
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = true)
|