main
tamguo 7 years ago
parent e5f9e16752
commit b431257102

@ -36,6 +36,7 @@ public class CourseController {
@RequestMapping(value = {"course/{uid}"}, method = RequestMethod.GET) @RequestMapping(value = {"course/{uid}"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable String uid , ModelAndView model) { public ModelAndView index(@PathVariable String uid , ModelAndView model) {
try {
CourseEntity course = iCourseService.find(uid); CourseEntity course = iCourseService.find(uid);
SubjectEntity subject = iSubjectService.find(course.getSubjectId()); SubjectEntity subject = iSubjectService.find(course.getSubjectId());
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(uid); List<ChapterEntity> chapterList = iChapterService.findCourseChapter(uid);
@ -48,6 +49,10 @@ public class CourseController {
model.setViewName("chapter"); model.setViewName("chapter");
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"course/findChapter"}, method = RequestMethod.GET) @RequestMapping(value = {"course/findChapter"}, method = RequestMethod.GET)

@ -46,6 +46,7 @@ public class PaperController {
@RequestMapping(value = {"paperlist/{subjectId}-{courseId}-{paperType}-{year}-{area}-{pageNum}"}, method = RequestMethod.GET) @RequestMapping(value = {"paperlist/{subjectId}-{courseId}-{paperType}-{year}-{area}-{pageNum}"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , @PathVariable String courseId , @PathVariable String paperType, public ModelAndView indexAction(@PathVariable String subjectId , @PathVariable String courseId , @PathVariable String paperType,
@PathVariable String year , @PathVariable String area , @PathVariable Integer pageNum, ModelAndView model) { @PathVariable String year , @PathVariable String area , @PathVariable Integer pageNum, ModelAndView model) {
try {
model.setViewName("paperlist"); model.setViewName("paperlist");
CourseEntity course = iCourseService.find(courseId); CourseEntity course = iCourseService.find(courseId);
@ -68,10 +69,16 @@ public class PaperController {
model.addObject("year", year); model.addObject("year", year);
model.addObject("area", area); model.addObject("area", area);
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"/paper/{paperId}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"/paper/{paperId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String paperId , ModelAndView model){ public ModelAndView indexAction(@PathVariable String paperId , ModelAndView model){
try {
model.setViewName("paper"); model.setViewName("paper");
PaperEntity paper = iPaperService.find(paperId); PaperEntity paper = iPaperService.find(paperId);
model.addObject("paper", paper); model.addObject("paper", paper);
@ -85,6 +92,11 @@ public class PaperController {
model.addObject("yatiPaperList", iPaperService.featuredPaper(TamguoConstant.YATI_PAPER_ID, paper.getSubjectId())); model.addObject("yatiPaperList", iPaperService.featuredPaper(TamguoConstant.YATI_PAPER_ID, paper.getSubjectId()));
model.addObject("hotPaperList", iPaperService.findHotPaper(paper.getSubjectId(), paper.getCourseId())); model.addObject("hotPaperList", iPaperService.findHotPaper(paper.getSubjectId(), paper.getCourseId()));
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"/paper/area/{areaId}-{type}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"/paper/area/{areaId}-{type}.html"}, method = RequestMethod.GET)

@ -35,6 +35,7 @@ public class QuestionContrller {
@RequestMapping(value = {"questionlist/{chapterId}-{offset}-{limit}"}, method = RequestMethod.GET) @RequestMapping(value = {"questionlist/{chapterId}-{offset}-{limit}"}, method = RequestMethod.GET)
public ModelAndView questionList(@PathVariable String chapterId , @PathVariable Integer offset , public ModelAndView questionList(@PathVariable String chapterId , @PathVariable Integer offset ,
@PathVariable Integer limit , ModelAndView model){ @PathVariable Integer limit , ModelAndView model){
try {
model.setViewName("questionList"); model.setViewName("questionList");
ChapterEntity chapter = iChapterService.findById(chapterId); ChapterEntity chapter = iChapterService.findById(chapterId);
@ -56,6 +57,11 @@ public class QuestionContrller {
model.addObject("subjectId", course.getSubjectId()); model.addObject("subjectId", course.getSubjectId());
model.addObject("courseId", course.getUid()); model.addObject("courseId", course.getUid());
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
/** /**
@ -66,6 +72,7 @@ public class QuestionContrller {
*/ */
@RequestMapping(value = {"/question/{uid}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"/question/{uid}.html"}, method = RequestMethod.GET)
public ModelAndView question(@PathVariable String uid , ModelAndView model){ public ModelAndView question(@PathVariable String uid , ModelAndView model){
try {
model.setViewName("question"); model.setViewName("question");
QuestionEntity question = iQuestionService.findNormalQuestion(uid); QuestionEntity question = iQuestionService.findNormalQuestion(uid);
question.setQuestionType(QuestionType.getQuestionType(question.getQuestionType()).getDesc()); question.setQuestionType(QuestionType.getQuestionType(question.getQuestionType()).getDesc());
@ -74,9 +81,14 @@ public class QuestionContrller {
// 推荐试题 // 推荐试题
model.addObject("featuredQuestionList", iQuestionService.featuredQuestion(question.getSubjectId(),question.getCourseId())); model.addObject("featuredQuestionList", iQuestionService.featuredQuestion(question.getSubjectId(),question.getCourseId()));
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"/question/getQuestion/{uid}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"question/getQuestion/{uid}"}, method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Result getQuestion(@PathVariable String uid , ModelAndView model){ public Result getQuestion(@PathVariable String uid , ModelAndView model){
return Result.successResult(iQuestionService.select(uid)); return Result.successResult(iQuestionService.select(uid));

@ -24,7 +24,7 @@ public class SchoolController {
@Autowired @Autowired
private ISchoolService iSchoolService; private ISchoolService iSchoolService;
@RequestMapping(value = {"/school/area/{areaId}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"school/area/{areaId}"}, method = RequestMethod.GET)
@ResponseBody @ResponseBody
public List<SchoolEntity> findSchoolByAreaId(@PathVariable String areaId , ModelAndView model){ public List<SchoolEntity> findSchoolByAreaId(@PathVariable String areaId , ModelAndView model){
return iSchoolService.findEliteSchoolPaper(areaId); return iSchoolService.findEliteSchoolPaper(areaId);
@ -35,7 +35,7 @@ public class SchoolController {
* @param areaId * @param areaId
* @return * @return
*/ */
@RequestMapping(value = {"/school/findByAreaId.html"}, method = RequestMethod.GET) @RequestMapping(value = {"school/findByAreaId"}, method = RequestMethod.GET)
@ResponseBody @ResponseBody
public List<SchoolEntity> findSchoolByAreaId(String areaId){ public List<SchoolEntity> findSchoolByAreaId(String areaId){
return iSchoolService.findSchoolByAreaId(areaId); return iSchoolService.findSchoolByAreaId(areaId);

@ -36,6 +36,7 @@ public class SubjectController {
@RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , ModelAndView model) { public ModelAndView indexAction(@PathVariable String subjectId , ModelAndView model) {
try {
SubjectEntity subject = iSubjectService.find(subjectId); SubjectEntity subject = iSubjectService.find(subjectId);
// 获取第一个科目 // 获取第一个科目
CourseEntity course = subject.getCourseList().get(0); CourseEntity course = subject.getCourseList().get(0);
@ -47,6 +48,11 @@ public class SubjectController {
model.addObject("chapterList" , chapterList); model.addObject("chapterList" , chapterList);
model.addObject("areaList", iAreaService.findRootArea()); model.addObject("areaList", iAreaService.findRootArea());
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"subject/getCourseTree.html"}, method = RequestMethod.GET) @RequestMapping(value = {"subject/getCourseTree.html"}, method = RequestMethod.GET)

Loading…
Cancel
Save