删掉异常处理。

main
tamguo 7 years ago
parent b183266074
commit ef26f5a7da

@ -32,13 +32,14 @@ public class PaperCrawler {
private final String COURSE_ID = "likeshuxue"; private final String COURSE_ID = "likeshuxue";
// 110000 北京 | 310000 上海 | 500000 重庆 | 120100 天津 | 370000 山东 | 410000 河南 | 420000 湖北 | 320000 江苏 | 330000 浙江 // 110000 北京 | 310000 上海 | 500000 重庆 | 120100 天津 | 370000 山东 | 410000 河南 | 420000 湖北 | 320000 江苏 | 330000 浙江
// 140000 山西 | 350000 福建 | 340000 安徽 | 220000 吉林 | 150000 内蒙古 | 640000 宁夏 | 650000 新疆 | 广西 450000 | 210000 辽宁 // 140000 山西 | 350000 福建 | 340000 安徽 | 220000 吉林 | 150000 内蒙古 | 640000 宁夏 | 650000 新疆 | 广西 450000 | 210000 辽宁
private final String AREA_ID = "210000"; // 230000 黑龙江
private final String AREA_ID = "230000";
// 年份 // 年份
private final String YEAR = "2015"; private final String YEAR = "2016";
// 真题试卷 类型(1:真题试卷,2:模拟试卷,3:押题预测,4:名校精品) // 真题试卷 类型(1:真题试卷,2:模拟试卷,3:押题预测,4:名校精品)
private final String PAPER_TYPE = "3"; private final String PAPER_TYPE = "4";
// 开始采集的URL // 开始采集的URL
private final String START_URL = "https://tiku.baidu.com/tikupc/paperlist/1bfd700abb68a98271fefa04-16-2-2015-1180-1-download"; private final String START_URL = "https://tiku.baidu.com/tikupc/paperlist/1bfd700abb68a98271fefa04-16-7-2016-1247-1-download";
private RunData runData; private RunData runData;

@ -61,7 +61,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HOT_PAPER); List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HOT_PAPER);
if(paperList == null){ if(paperList == null){
Page<PaperEntity> page = new Page<>(1 , 10); Page<PaperEntity> page = new Page<>(1 , 10);
paperList = paperMapper.selectPage(page, Condition.create().eq("area_id", areaId).orderDesc(Arrays.asList("id"))); paperList = paperMapper.selectPage(page, Condition.create().orderDesc(Arrays.asList("id")));
cacheService.setObject(SystemConstant.HOT_PAPER, paperList , 2 * 60 * 60); cacheService.setObject(SystemConstant.HOT_PAPER, paperList , 2 * 60 * 60);
} }
return paperList; return paperList;

@ -40,7 +40,6 @@ public class BookController {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping(value = {"book/{uid}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"book/{uid}.html"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable String uid , ModelAndView model , HttpServletRequest request) { public ModelAndView index(@PathVariable String uid , ModelAndView model , HttpServletRequest request) {
try {
// request url // request url
logger.info("request url :{} " , request.getRequestURI()); logger.info("request url :{} " , request.getRequestURI());
BookEntity book = iBookService.selectById(uid); BookEntity book = iBookService.selectById(uid);
@ -57,10 +56,6 @@ public class BookController {
model.addObject("bookList", bookList); model.addObject("bookList", bookList);
model.setViewName("book"); model.setViewName("book");
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
} }

@ -46,7 +46,6 @@ public class CourseController {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping(value = {"course/{uid}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"course/{uid}.html"}, method = RequestMethod.GET)
public ModelAndView index(HttpServletRequest request , @PathVariable String uid , ModelAndView model) { public ModelAndView index(HttpServletRequest request , @PathVariable String uid , ModelAndView model) {
try {
// request url // request url
logger.info("request url :{}" , request.getRequestURI()); logger.info("request url :{}" , request.getRequestURI());
CourseEntity course = iCourseService.selectById(uid); CourseEntity course = iCourseService.selectById(uid);
@ -68,10 +67,6 @@ public class CourseController {
model.addObject("book" , book); model.addObject("book" , book);
model.setViewName("chapter"); model.setViewName("chapter");
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@RequestMapping(value = {"course/findChapter.html"}, method = RequestMethod.GET) @RequestMapping(value = {"course/findChapter.html"}, method = RequestMethod.GET)

@ -54,7 +54,6 @@ public class PaperController {
@RequestMapping(value = {"paperlist/{subjectId}-{courseId}-{paperType}-{year}-{area}-{pageNum}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"paperlist/{subjectId}-{courseId}-{paperType}-{year}-{area}-{pageNum}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(HttpServletRequest request , @PathVariable String subjectId , @PathVariable String courseId , @PathVariable String paperType, public ModelAndView indexAction(HttpServletRequest request , @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 {
// request url // request url
logger.info("request url :{}" , request.getRequestURI()); logger.info("request url :{}" , request.getRequestURI());
CourseEntity course = iCourseService.selectById(courseId); CourseEntity course = iCourseService.selectById(courseId);
@ -102,11 +101,6 @@ public class PaperController {
model.setViewName("paperlist"); model.setViewName("paperlist");
} }
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

@ -46,7 +46,6 @@ public class QuestionContrller {
@RequestMapping(value = {"questionlist/{chapterId}-{current}-{size}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"questionlist/{chapterId}-{current}-{size}.html"}, method = RequestMethod.GET)
public ModelAndView questionList(@PathVariable String chapterId , @PathVariable Integer current , public ModelAndView questionList(@PathVariable String chapterId , @PathVariable Integer current ,
@PathVariable Integer size , ModelAndView model , HttpServletRequest request){ @PathVariable Integer size , ModelAndView model , HttpServletRequest request){
try {
// request url // request url
logger.info("request url :{} " , request.getRequestURI()); logger.info("request url :{} " , request.getRequestURI());
model.setViewName("questionList"); model.setViewName("questionList");
@ -70,11 +69,6 @@ public class QuestionContrller {
model.addObject("subjectId", course.getSubjectId()); model.addObject("subjectId", course.getSubjectId());
model.addObject("courseId", course.getId()); model.addObject("courseId", course.getId());
return model; return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
} }
/** /**
@ -86,7 +80,6 @@ public class QuestionContrller {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping(value = {"/question/{uid}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"/question/{uid}.html"}, method = RequestMethod.GET)
public ModelAndView question(@PathVariable String uid , ModelAndView model , HttpServletRequest request){ public ModelAndView question(@PathVariable String uid , ModelAndView model , HttpServletRequest request){
try {
// request url // request url
logger.info("request url :{}" , request.getRequestURI()); logger.info("request url :{}" , request.getRequestURI());
model.setViewName("question"); model.setViewName("question");
@ -96,11 +89,6 @@ public class QuestionContrller {
model.addObject("course", iCourseService.selectById(question.getCourseId())); model.addObject("course", iCourseService.selectById(question.getCourseId()));
model.addObject("answerList", iQuestionAnswerService.selectList(Condition.create().eq("question_id", uid).orderDesc(Arrays.asList("create_date")))); model.addObject("answerList", iQuestionAnswerService.selectList(Condition.create().eq("question_id", uid).orderDesc(Arrays.asList("create_date"))));
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}.html"}, method = RequestMethod.GET)

@ -54,7 +54,6 @@ public class SubjectController {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET) @RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , HttpServletRequest request , ModelAndView model) { public ModelAndView indexAction(@PathVariable String subjectId , HttpServletRequest request , ModelAndView model) {
try {
// request url // request url
logger.info("request url :{} " , request.getRequestURI() ); logger.info("request url :{} " , request.getRequestURI() );
SubjectEntity subject = iSubjectService.selectById(subjectId); SubjectEntity subject = iSubjectService.selectById(subjectId);
@ -78,14 +77,8 @@ public class SubjectController {
}else { }else {
model.setViewName("subject"); model.setViewName("subject");
} }
return model;
} catch (Exception e) {
logger.error(e.getMessage() , e);
model.setViewName("500");
return model; return model;
} }
}
// [{"value":"11","label":"北京市","children":[{"value":"1101","label":"市辖区"}]}] // [{"value":"11","label":"北京市","children":[{"value":"1101","label":"市辖区"}]}]
@RequestMapping(value = {"subject/getCourseCascaderTree.html"}, method = RequestMethod.GET) @RequestMapping(value = {"subject/getCourseCascaderTree.html"}, method = RequestMethod.GET)

Loading…
Cancel
Save