• Java项目:毕业设计管理系统(java+SSM+JSP+jQuery+mysql)


    源码获取:俺的博客首页 "资源" 里下载!

    项目介绍


    本项目包含三种角色:管理员、学生用户角色与教师角色。
    管理员角色包含以下功能:
    学生信息管理、教师信息管理。
    用户角色包含以下功能:
    查看通知公告,登录,登录后学生主页面,选择课题,选择课题后状态为等待老师去人状态,填写开题报告,提交中期检查,提交免答辩申请,上传论文等功能。
    教师角色包含以下功能:
    教师角色登录,教师首页,申报课题,审批学生选题,审核开题报告,审核中期检查,初审免答辩申请,审核论文是否过关,综合打分等功能。


    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
    5.数据库:5.7/8.0版本均可;
    6.是否Maven项目:是;


    技术栈

    1. 后端:Spring+SpringMVC+Mybatis
    2. 前端:JSP+CSS+JavaScript+jQuery


    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
    4. 运行项目,输入localhost:8080/ 登录

     

     

     

     

     

    用户管理控制层:

    1. @Controller
    2. public class UserController {
    3. @Autowired
    4. private StudentService studentService;
    5. @Autowired
    6. private TeacherService teacherService;
    7. @Autowired
    8. private AdminService adminService;
    9. /**
    10. * 用户登录
    11. */
    12. @RequestMapping(value = "/login.action", method = RequestMethod.POST)
    13. public String login(String usercode, String password, String role, Model model, HttpSession session) {
    14. if(role.equals("学生")) {
    15. Student student = studentService.findStudent(usercode, password);
    16. if(student!=null) {
    17. User user = new User();
    18. user.setRole(role);
    19. session.setAttribute("USER", user);
    20. session.setAttribute("USER_INFO", student);
    21. return "redirect:student/toindex.action";
    22. }
    23. }
    24. else if(role.equals("教师")) {
    25. Teacher teacher = teacherService.findTeacher(usercode, password);
    26. if(teacher!=null) {
    27. User user = new User();
    28. user.setRole(role);
    29. session.setAttribute("USER", user);
    30. session.setAttribute("USER_INFO", teacher);
    31. return "redirect:teacher/roleset.action";
    32. }
    33. }
    34. else if(role.equals("管理员")) {
    35. Admin admin = adminService.findAdmin(usercode, password);
    36. if(admin!=null) {
    37. User user = new User();
    38. user.setRole(role);
    39. session.setAttribute("USER", user);
    40. session.setAttribute("USER_INFO", admin);
    41. return "redirect:admin/toindex.action";
    42. }
    43. }
    44. model.addAttribute("msg", "账号或密码错误,请重新输入!");
    45. return "login";
    46. }
    47. /**
    48. * 退出登录
    49. */
    50. @RequestMapping(value = "/logout.action")
    51. public String logout(HttpSession session) {
    52. // 清除Session
    53. session.invalidate();
    54. // 重定向到登录页面的跳转方法
    55. return "redirect:tologin.action";
    56. }
    57. /**
    58. * 向用户登陆页面跳转
    59. */
    60. @RequestMapping(value = "/tologin.action", method = RequestMethod.GET)
    61. public String toLogin() {
    62. return "login";
    63. }
    64. }

    学生管理控制层:

    1. @Controller
    2. public class StudentController {
    3. private static final int PAGE_SIZE = 5;
    4. @Autowired
    5. private StudentService studentService;
    6. @Autowired
    7. private TitleService titleService;
    8. @Autowired
    9. private TeacherService teacherService;
    10. @Autowired
    11. private SelectTitleService selectTitleService;
    12. @Autowired
    13. private ProjBookService projBookService;
    14. @Autowired
    15. private OpenReportService openReportService;
    16. @Autowired
    17. private MidCheckService midCheckService;
    18. @Autowired
    19. private ThesisService thesisService;
    20. @Autowired
    21. private ThesisAttachmentService thesisAttachmentService;
    22. @Autowired
    23. private ScoreProportionService scoreProportionService;
    24. /**
    25. * 向学生主页面跳转
    26. */
    27. @RequestMapping(value = "/student/toindex.action", method = RequestMethod.GET)
    28. public ModelAndView toIndex(HttpSession session) {
    29. Student student = (Student)session.getAttribute("USER_INFO");
    30. int sum = titleService.findTitleSum(student.getMajor(),"已审批");
    31. int s = selectTitleService.findSelTitleListByState(student.getMajor(),"同意");
    32. int s1 = selectTitleService.findSelTitleListByState(student.getMajor(),"待同意");
    33. ModelAndView mv = new ModelAndView();
    34. mv.addObject("sum", sum);
    35. mv.addObject("s", s);
    36. mv.addObject("s1", s1);
    37. mv.setViewName("views/user/student/index");
    38. return mv;
    39. }
    40. /**
    41. * 向个人信息修改页面跳转(学生)
    42. */
    43. @RequestMapping(value = "/student/topersonInfo.action")
    44. public String topersonInfo(HttpSession session) {
    45. Student student = (Student)session.getAttribute("USER_INFO");
    46. student = studentService.findStudent(student.getsId(), student.getsPwd());
    47. session.setAttribute("USER_INFO", student);
    48. return "views/user/student/personInfo";
    49. }
    50. /**
    51. * 学生信息修改
    52. */
    53. @RequestMapping(value = "/student/editInfo.action")
    54. @ResponseBody
    55. public String editInfo(Student student) {
    56. int rows =0;
    57. try{
    58. rows = studentService.editInfo(student);
    59. }catch(Exception e){
    60. rows =0;
    61. }
    62. if(rows > 0){
    63. System.out.println("OK");
    64. return "OK";
    65. }else{
    66. System.out.println("FAIL");
    67. return "FAIL";
    68. }
    69. }
    70. /**
    71. * 向密码修改页面跳转(学生)
    72. */
    73. @RequestMapping(value = "/student/toeditPwd.action")
    74. public String toeditPwd(HttpSession session) {
    75. Student student = (Student)session.getAttribute("USER_INFO");
    76. student = studentService.findStudentById(student.getsId());
    77. session.setAttribute("USER_INFO", student);
    78. return "views/user/student/editPwd";
    79. }
    80. /**
    81. * 学生密码修改
    82. */
    83. @RequestMapping(value = "/student/editPwd.action")
    84. @ResponseBody
    85. public String editPwd(Student student) {
    86. int rows =0;
    87. try{
    88. rows = studentService.editInfo(student);
    89. }catch(Exception e){
    90. rows =0;
    91. }
    92. if(rows > 0){
    93. return "OK";
    94. }else{
    95. return "FAIL";
    96. }
    97. }
    98. /**
    99. * 向选题页面跳转(学生)
    100. */
    101. @RequestMapping(value = "/student/totitlelist.action")
    102. public ModelAndView totitlelist(HttpSession session, @ModelAttribute("title") Title title,
    103. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    104. // pageNo 页码 pageSize 每页记录数
    105. PageHelper.startPage(pageNum, PAGE_SIZE);
    106. Student student = (Student)session.getAttribute("USER_INFO");
    107. List<Title>list = titleService.findTitleListByMajor(title ,(String)student.getMajor());
    108. PageInfo<Title> pageInfo = new PageInfo<>(list,5);
    109. ModelAndView mv = new ModelAndView();
    110. mv.addObject("title", title);
    111. mv.addObject("pageInfo", pageInfo);
    112. mv.setViewName("views/user/student/titlelist");
    113. return mv;
    114. }
    115. /**
    116. * 查看课题详情ById(学生)
    117. */
    118. @RequestMapping("/student/getTitleInfoById.action")
    119. @ResponseBody
    120. public Title getTitleInfoById(Long titlId) {
    121. Title titleInfo = titleService.findTitleById(titlId);
    122. System.out.println(titleInfo.getMajor());
    123. return titleInfo;
    124. }
    125. /**
    126. * 选择课题(学生)
    127. */
    128. @RequestMapping("/student/selecttitle.action")
    129. @ResponseBody
    130. public String Selecttitle(HttpSession session, SelectTitle selectTitle) {
    131. Student student = (Student)session.getAttribute("USER_INFO");
    132. selectTitle.setsId(student.getsId());
    133. SelectTitle result = selectTitleService.getSelectTitle(selectTitle);
    134. if(result!=null) {
    135. return "FAIL1";
    136. }
    137. Title title = new Title();
    138. title.setTitlId(selectTitle.getTitlId());
    139. List<SelectTitle> list = selectTitleService.findSelTitleListBysIdAndState(student.getsId(), "待同意");
    140. if(list.size()!=0) {
    141. return "FAIL4" ;
    142. }
    143. list = selectTitleService.findSelTitleListBysIdAndState(student.getsId(), "同意");
    144. if(list.size()!=0) {
    145. return "FAIL2" ;
    146. }
    147. else {
    148. int rows = 0;
    149. try{
    150. selectTitle.setSeltitlState("待同意");
    151. rows = selectTitleService.createSelectTitle(selectTitle);
    152. }catch(Exception e){
    153. rows = 0;
    154. }
    155. if(rows > 0){
    156. System.out.println("选择课题成功!!!!");
    157. return "OK";
    158. }else{
    159. System.out.println("选择课题失败!!!!");
    160. return "FAIL3";
    161. }
    162. }
    163. }
    164. /**
    165. * 查看已选课题(学生)
    166. */
    167. @RequestMapping("/student/selTitleById.action")
    168. @ResponseBody
    169. public ModelAndView selTitleById(HttpSession session, @ModelAttribute("title") Title title,
    170. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    171. // pageNo 页码 pageSize 每页记录数
    172. PageHelper.startPage(pageNum, PAGE_SIZE);
    173. Student student = (Student)session.getAttribute("USER_INFO");
    174. List<Title>list = titleService.findTitleList(title, (String)student.getsId());
    175. PageInfo<Title> pageInfo = new PageInfo<>(list,5);
    176. ModelAndView mv = new ModelAndView();
    177. List<Teacher> list1 = teacherService.findTeacherBydept(student.getDept());
    178. int i = selectTitleService.findSelTitle(student.getsId());
    179. mv.addObject("title", title);
    180. mv.addObject("i", i);
    181. mv.addObject("Teacher", list1);
    182. mv.addObject("pageInfo", pageInfo);
    183. mv.setViewName("views/user/student/selecttitlelist");
    184. return mv;
    185. }
    186. /**
    187. * 删除已选课题(学生退选)
    188. */
    189. @RequestMapping("/student/delTitleInfoById.action")
    190. @ResponseBody
    191. public String delTitleInfoById(HttpSession session ,Long id) {
    192. Student student = (Student)session.getAttribute("USER_INFO");
    193. int rows = selectTitleService.deleteCustomer(id,(String)student.getsId());
    194. if(rows > 0){
    195. Title title = new Title();
    196. title.setTitlId(id);
    197. if(titleService.findTitleById(id).getTitlState().equals("待指导教师审批")) {
    198. titleService.deleteTitle(id);
    199. }
    200. else {
    201. title.setSelState("未被选择");
    202. titleService.updateTitleSelStateById(title);
    203. }
    204. return "OK";
    205. }else{
    206. return "FAIL";
    207. }
    208. }
    209. /**
    210. * 任务书文件列表(学生)
    211. */
    212. @RequestMapping("/student/projBooklist.action")
    213. public ModelAndView projBooklist(HttpSession session ,@ModelAttribute("projBook") ProjBook projBook ,
    214. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    215. PageHelper.startPage(pageNum, PAGE_SIZE);
    216. Student student = (Student)session.getAttribute("USER_INFO");
    217. List<ProjBook>list = projBookService.findProjBookList(projBook, (String)student.getsId());
    218. int i = selectTitleService.findSelectTitle(student.getsId());
    219. List<ProjBook> list2 = projBookService.findProjBookBysIdAndAgree(student.getsId(), "通过");
    220. int i2 = 0;
    221. if(list2.size()!=0) {
    222. i2 = 1;
    223. }
    224. PageInfo<ProjBook> pageInfo = new PageInfo<>(list,5);
    225. ModelAndView mv = new ModelAndView();
    226. mv.addObject("pageInfo", pageInfo);
    227. mv.addObject("i", i);
    228. mv.addObject("i2", i2);
    229. mv.setViewName("views/user/student/projbooklist");
    230. return mv;
    231. }
    232. /**
    233. * 开题报告文件列表(学生)
    234. */
    235. @RequestMapping("/student/openReportlist.action")
    236. public ModelAndView openReportlist(HttpSession session ,@ModelAttribute("openReport") OpenReport openReport ,
    237. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    238. PageHelper.startPage(pageNum, PAGE_SIZE);
    239. Student student = (Student)session.getAttribute("USER_INFO");
    240. List<OpenReport>list = openReportService.findOpenReportList(openReport, (String)student.getsId());
    241. List<ProjBook> list2 = projBookService.findProjBookBysIdAndAgree(student.getsId(), "通过");
    242. List<OpenReport> list3 = openReportService.findOpenReportBysIdAndAgree(student.getsId(), "通过");
    243. int i = 0;
    244. int i2 = 0;
    245. if(list2.size()!=0) {
    246. i = 1;
    247. }
    248. if(list3.size()!=0) {
    249. i2 = 1;
    250. }
    251. PageInfo<OpenReport> pageInfo = new PageInfo<>(list,5);
    252. ModelAndView mv = new ModelAndView();
    253. mv.addObject("pageInfo", pageInfo);
    254. mv.addObject("i", i);
    255. mv.addObject("i2", i2);
    256. mv.setViewName("views/user/student/openReportlist");
    257. return mv;
    258. }
    259. /**
    260. * 中期检查文件列表(学生)
    261. */
    262. @RequestMapping("/student/midChecklist.action")
    263. public ModelAndView midChecklist(HttpSession session ,@ModelAttribute("midCheck") MidCheck midCheck ,
    264. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    265. PageHelper.startPage(pageNum, PAGE_SIZE);
    266. Student student = (Student)session.getAttribute("USER_INFO");
    267. List<MidCheck>list = midCheckService.findMidCheckList(midCheck, (String)student.getsId());
    268. List<OpenReport> list2 = openReportService.findOpenReportBysIdAndAgree(student.getsId(), "通过");
    269. List<MidCheck> list3 = midCheckService.findMidCheckBysIdAndAgree(student.getsId(), "通过");
    270. int i = 0;
    271. int i2 = 0;
    272. if(list2.size()!=0) {
    273. i = 1;
    274. }
    275. if(list3.size()!=0) {
    276. i2 = 1;
    277. }
    278. PageInfo<MidCheck> pageInfo = new PageInfo<>(list,5);
    279. ModelAndView mv = new ModelAndView();
    280. mv.addObject("pageInfo", pageInfo);
    281. mv.addObject("i", i);
    282. mv.addObject("i2", i2);
    283. mv.setViewName("views/user/student/midchecklist");
    284. return mv;
    285. }
    286. /**
    287. * 论文文件列表(学生)
    288. */
    289. @RequestMapping("/student/thesislist.action")
    290. public ModelAndView thesislist(HttpSession session ,@ModelAttribute("thesis") Thesis thesis ,
    291. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    292. PageHelper.startPage(pageNum, PAGE_SIZE);
    293. Student student = (Student)session.getAttribute("USER_INFO");
    294. List<Thesis>list = thesisService.findThesisList(thesis, (String)student.getsId());
    295. List<MidCheck> list2 = midCheckService.findMidCheckBysIdAndAgree(student.getsId(), "通过");
    296. List<Thesis> list3 = thesisService.findThesisBysIdAndAgree(student.getsId(), "通过");
    297. int i = 0;
    298. int i2 = 0;
    299. if(list2.size()!=0) {
    300. i = 1;
    301. }
    302. if(list3.size()!=0) {
    303. i2 = 1;
    304. }
    305. PageInfo<Thesis> pageInfo = new PageInfo<>(list,5);
    306. ModelAndView mv = new ModelAndView();
    307. mv.addObject("pageInfo", pageInfo);
    308. mv.addObject("i", i);
    309. mv.addObject("i2", i2);
    310. mv.setViewName("views/user/student/thesislist");
    311. return mv;
    312. }
    313. /**
    314. * 附件列表(学生)
    315. */
    316. @RequestMapping("/student/thesisAttachmentlist.action")
    317. public ModelAndView thesisAttachmentlist(HttpSession session ,@ModelAttribute("thesisAttachment") ThesisAttachment thesisAttachment ,
    318. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    319. PageHelper.startPage(pageNum, PAGE_SIZE);
    320. Student student = (Student)session.getAttribute("USER_INFO");
    321. List<ThesisAttachment>list = thesisAttachmentService.findThesisAttachmentList(thesisAttachment, (String)student.getsId());
    322. List<Thesis> list3 = thesisService.findThesisBysIdAndAgree(student.getsId(), "通过");
    323. int i2 = 0;
    324. if(list3.size()!=0) {
    325. i2 = 1;
    326. }
    327. PageInfo<ThesisAttachment> pageInfo = new PageInfo<>(list,5);
    328. ModelAndView mv = new ModelAndView();
    329. mv.addObject("pageInfo", pageInfo);
    330. mv.addObject("i2", i2);
    331. mv.setViewName("views/user/student/thesisAttachmentlist");
    332. return mv;
    333. }
    334. /**
    335. * 成绩总评(学生)
    336. */
    337. @RequestMapping("/student/studentScore.action")
    338. public ModelAndView studentScore (HttpSession session,@RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum){
    339. Student student = (Student)session.getAttribute("USER_INFO");
    340. List<SelectTitle> list = selectTitleService.findSelTitleListBysIdAndState(student.getsId(), "同意");
    341. ScoreProportion scoreProportion = scoreProportionService.getScoreProportion("1");
    342. ModelAndView mv = new ModelAndView();
    343. PageInfo<SelectTitle> pageInfo = new PageInfo<>(list,5);
    344. mv.addObject("pageInfo", pageInfo);
    345. mv.addObject("scoreProportion", scoreProportion);
    346. mv.setViewName("views/user/student/studentscore");
    347. return mv;
    348. }
    349. }

    教师管理控制层:

    1. @Controller
    2. public class TeacherController {
    3. private static final int PAGE_SIZE = 5;
    4. @Autowired
    5. private TeacherService teacherService;
    6. @Autowired
    7. private BaseMajorService baseMajorService;
    8. @Autowired
    9. private TitleService titleService;
    10. @Autowired
    11. private StudentService studentService;
    12. @Autowired
    13. private SelectTitleService selectTitleService;
    14. @Autowired
    15. private ProjBookService projBookService;
    16. @Autowired
    17. private OpenReportService openReportService;
    18. @Autowired
    19. private MidCheckService midCheckService;
    20. @Autowired
    21. private ThesisService thesisService;
    22. @Autowired
    23. private ThesisAttachmentService thesisAttachmentService;
    24. @Autowired
    25. private ReplyGroupService replyGroupService;
    26. @Autowired
    27. private ReviewService reviewService;
    28. @Autowired
    29. private ScoreProportionService scoreProportionService;
    30. @InitBinder
    31. protected void initBinder(WebDataBinder binder) {
    32. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    33. binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
    34. }
    35. /**
    36. * 向教师权限选择页面跳转
    37. */
    38. @RequestMapping(value = "/teacher/roleset.action", method = RequestMethod.GET)
    39. public String roleset(HttpSession session) {
    40. return "views/user/teacher/roleset";
    41. }
    42. /**
    43. * 向教师主页面跳转
    44. */
    45. @RequestMapping(value = "/teacher/toindex.action", method = RequestMethod.GET)
    46. public ModelAndView toIndex(HttpSession session) {
    47. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    48. int sum = titleService.findTitleSum1(teacher.gettId(),"已审批");
    49. int s = selectTitleService.findSelTitleListByState2(teacher.gettId(),"同意");
    50. int s1 = selectTitleService.findSelTitleListByState2(teacher.gettId(),"待同意");
    51. int sumProjBook = 0;
    52. int sumOpenReport = 0;
    53. int sumMidCheck = 0;
    54. int sumThesis = 0;
    55. List<ProjBook> list = projBookService.findProjBookBytIdAndAgree1(null, teacher.gettId(), "通过");
    56. if(list!=null) {
    57. sumProjBook = list.size();
    58. }
    59. List<OpenReport> list1 = openReportService.findOpenReportBytIdAndAgree1(null, teacher.gettId(), "通过");
    60. if(list1!=null) {
    61. sumOpenReport = list1.size();
    62. }
    63. List<MidCheck> list2 = midCheckService.findMidCheckBytIdAndAgree1(null, teacher.gettId(), "通过");
    64. if(list2!=null) {
    65. sumMidCheck = list2.size();
    66. }
    67. List<Thesis> list3 = thesisService.findThesisBytIdAndAgree1(null, teacher.gettId(), "通过");
    68. if(list3!=null) {
    69. sumThesis = list3.size();
    70. }
    71. ModelAndView mv = new ModelAndView();
    72. mv.addObject("sum", sum);
    73. mv.addObject("s", s);
    74. mv.addObject("s1", s1);
    75. mv.addObject("sumProjBook", sumProjBook);
    76. mv.addObject("sumOpenReport", sumOpenReport);
    77. mv.addObject("sumMidCheck", sumMidCheck);
    78. mv.addObject("sumThesis", sumThesis);
    79. mv.setViewName("views/user/teacher/index");
    80. return mv;
    81. }
    82. /**
    83. * 向教师课题页面跳转
    84. */
    85. @RequestMapping(value = "/teacher/totitlelist.action")
    86. public ModelAndView totitlelist(HttpSession session, @ModelAttribute("title") Title title,
    87. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    88. // pageNo 页码 pageSize 每页记录数
    89. PageHelper.startPage(pageNum, PAGE_SIZE);
    90. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    91. List<Title1>list = titleService.findTitleListBytId(title ,(String)teacher.gettId());
    92. List <BaseMajor> list1 = baseMajorService.findMajorBydeptId(teacher.getDeptId());
    93. PageInfo<Title1> pageInfo = new PageInfo<>(list,5);
    94. ModelAndView mv = new ModelAndView();
    95. mv.addObject("title", title);
    96. mv.addObject("BaseMajor", list1);
    97. mv.addObject("pageInfo", pageInfo);
    98. mv.setViewName("views/user/teacher/titlelist");
    99. return mv;
    100. }
    101. /**
    102. * 获取选题学生信息
    103. */
    104. @RequestMapping(value = "/teacher/getStudentInfoById.action")
    105. @ResponseBody
    106. public Student getStudentInfoById(String sId) {
    107. Student student = studentService.findStudentById(sId);
    108. return student;
    109. }
    110. /**
    111. * 删除课题(教师)
    112. */
    113. @RequestMapping(value = "/teacher/titledelete.action")
    114. @ResponseBody
    115. public String titledelete(Long titlId) {
    116. int rows = titleService.deleteTitle(titlId);
    117. if(rows > 0){
    118. return "OK";
    119. }else{
    120. return "FAIL";
    121. }
    122. }
    123. /**
    124. * 教师申请新课题
    125. */
    126. @RequestMapping("/teacher/createTitle.action")
    127. @ResponseBody
    128. public String createTitle(Title title,HttpSession session) {
    129. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    130. title.settId(teacher.gettId());
    131. title.setTitlState("待审批");
    132. title.setSelState("未被选择");
    133. int rows = titleService.createTitle(title);
    134. if(rows > 0){
    135. return "OK";
    136. }else{
    137. return "FAIL";
    138. }
    139. }
    140. /**
    141. * 学生申请新课题
    142. */
    143. @RequestMapping("/teacher/createTitle1.action")
    144. @ResponseBody
    145. public String createTitle1(Title title) {
    146. String sId = title.getsId();
    147. title.setTitlState("待指导教师审批");
    148. title.setSelState("已被选择");
    149. title.setsId(null);
    150. int rows = titleService.createTitle(title);
    151. System.out.println(title.getTitlId());
    152. if(rows > 0){
    153. SelectTitle selectTitle = new SelectTitle();
    154. selectTitle.setsId(sId);
    155. selectTitle.setTitlId(title.getTitlId());
    156. selectTitle.setSeltitlState("待同意");
    157. selectTitleService.createSelectTitle(selectTitle);
    158. return "OK";
    159. }else{
    160. return "FAIL";
    161. }
    162. }
    163. /**
    164. * 向选题学生页面跳转
    165. */
    166. @RequestMapping(value = "/teacher/toSelecttitlelist.action")
    167. public ModelAndView toSelecttitlelist(HttpSession session, @ModelAttribute("title") Title title,
    168. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    169. // pageNo 页码 pageSize 每页记录数
    170. PageHelper.startPage(pageNum, PAGE_SIZE);
    171. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    172. List<Title> list = selectTitleService.findSelTitleListByState3(title, teacher.gettId(), "待同意");
    173. PageInfo<Title> pageInfo = new PageInfo<>(list,5);
    174. ModelAndView mv = new ModelAndView();
    175. mv.addObject("title", title);
    176. mv.addObject("pageInfo", pageInfo);
    177. mv.setViewName("views/user/teacher/selectTitlelist");
    178. return mv;
    179. }
    180. /**
    181. * 对学生选题情况进行操作
    182. */
    183. @RequestMapping(value = "/teacher/editSelTitle.action")
    184. @ResponseBody
    185. public String editSelTitle(SelectTitle selectTitle) {
    186. String titlState = titleService.findTitleById(selectTitle.getTitlId()).getTitlState();
    187. int rows = selectTitleService.updateSelTitle(selectTitle);
    188. if(rows > 0){
    189. Title title = new Title();
    190. title.setTitlId(selectTitle.getTitlId());
    191. if(selectTitle.getSeltitlState().equals("同意") && titlState.equals("待指导教师审批")) {
    192. title.setTitlState("待审批");
    193. titleService.updateTitleById(title);
    194. SelectTitle selectTitle2 = new SelectTitle();
    195. selectTitle2.setsId(selectTitle.getsId());
    196. selectTitle2.setTitlId(selectTitle.getTitlId());
    197. selectTitle2.setSeltitlState("待专业负责人审批");
    198. selectTitleService.updateSelTitle(selectTitle2);
    199. }
    200. if(selectTitle.getSeltitlState().equals("同意")) {
    201. title.setSelState("已被选择");
    202. titleService.updateTitleSelStateById(title);
    203. SelectTitle selectTitle1 = new SelectTitle();
    204. selectTitle1.setTitlId(selectTitle.getTitlId());
    205. selectTitle1.setSeltitlState("待同意");
    206. selectTitleService.updateSelTitle1(selectTitle1);
    207. }
    208. if(selectTitle.getSeltitlState().equals("拒绝") && titlState.equals("待指导教师审批")) {
    209. title.setTitlState("审批不通过");
    210. titleService.updateTitleById(title);
    211. }
    212. return "OK";
    213. }else{
    214. return "FAIL";
    215. }
    216. }
    217. /**
    218. * 学生任务书列表(已审核)
    219. */
    220. @RequestMapping("/teacher/projBooklist.action")
    221. public ModelAndView projBooklist(HttpSession session ,@ModelAttribute("projBook") ProjBook projBook ,
    222. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    223. PageHelper.startPage(pageNum, PAGE_SIZE);
    224. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    225. List<ProjBook>list = projBookService.findProjBookBytIdAndAgree(projBook, teacher.gettId(),"待通过");
    226. PageInfo<ProjBook> pageInfo = new PageInfo<>(list,5);
    227. ModelAndView mv = new ModelAndView();
    228. mv.addObject("pageInfo", pageInfo);
    229. mv.setViewName("views/user/teacher/projbooklist");
    230. return mv;
    231. }
    232. /**
    233. * 学生任务书列表(待审核)
    234. */
    235. @RequestMapping("/teacher/projBooklist1.action")
    236. public ModelAndView projBooklist1(HttpSession session ,@ModelAttribute("projBook") ProjBook projBook ,
    237. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    238. PageHelper.startPage(pageNum, PAGE_SIZE);
    239. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    240. List<ProjBook>list = projBookService.findProjBookBytIdAndAgree1(projBook, teacher.gettId(),"待通过");
    241. PageInfo<ProjBook> pageInfo = new PageInfo<>(list,5);
    242. ModelAndView mv = new ModelAndView();
    243. mv.addObject("pageInfo", pageInfo);
    244. mv.setViewName("views/user/teacher/projbooklist1");
    245. return mv;
    246. }
    247. /**
    248. * 学生开题报告列表(已审核)
    249. */
    250. @RequestMapping("/teacher/openReportlist.action")
    251. public ModelAndView openReportlist(HttpSession session ,@ModelAttribute("openReport") OpenReport openReport ,
    252. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    253. PageHelper.startPage(pageNum, PAGE_SIZE);
    254. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    255. List<OpenReport>list = openReportService.findOpenReportBytIdAndAgree(openReport, teacher.gettId(),"待通过");
    256. PageInfo<OpenReport> pageInfo = new PageInfo<>(list,5);
    257. ModelAndView mv = new ModelAndView();
    258. mv.addObject("pageInfo", pageInfo);
    259. mv.setViewName("views/user/teacher/openReportlist");
    260. return mv;
    261. }
    262. /**
    263. * 学生开题报告列表(待审核)
    264. */
    265. @RequestMapping("/teacher/openReportlist1.action")
    266. public ModelAndView openReportlist1(HttpSession session ,@ModelAttribute("openReport") OpenReport openReport ,
    267. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    268. PageHelper.startPage(pageNum, PAGE_SIZE);
    269. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    270. List<OpenReport>list = openReportService.findOpenReportBytIdAndAgree1(openReport, teacher.gettId(),"待通过");
    271. PageInfo<OpenReport> pageInfo = new PageInfo<>(list,5);
    272. ModelAndView mv = new ModelAndView();
    273. mv.addObject("pageInfo", pageInfo);
    274. mv.setViewName("views/user/teacher/openReportlist1");
    275. return mv;
    276. }
    277. /**
    278. * 学生中期检查列表(已审核)
    279. */
    280. @RequestMapping("/teacher/midChecklist.action")
    281. public ModelAndView midChecklist(HttpSession session ,@ModelAttribute("midCheck") MidCheck midCheck ,
    282. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    283. PageHelper.startPage(pageNum, PAGE_SIZE);
    284. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    285. List<MidCheck>list = midCheckService.findMidCheckBytIdAndAgree(midCheck, teacher.gettId(),"待通过");
    286. PageInfo<MidCheck> pageInfo = new PageInfo<>(list,5);
    287. ModelAndView mv = new ModelAndView();
    288. mv.addObject("pageInfo", pageInfo);
    289. mv.setViewName("views/user/teacher/midChecklist");
    290. return mv;
    291. }
    292. /**
    293. * 学生中期检查列表(待审核)
    294. */
    295. @RequestMapping("/teacher/midChecklist1.action")
    296. public ModelAndView midChecklist1(HttpSession session ,@ModelAttribute("midCheck") MidCheck midCheck ,
    297. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    298. PageHelper.startPage(pageNum, PAGE_SIZE);
    299. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    300. List<MidCheck>list = midCheckService.findMidCheckBytIdAndAgree1(midCheck, teacher.gettId(),"待通过");
    301. PageInfo<MidCheck> pageInfo = new PageInfo<>(list,5);
    302. ModelAndView mv = new ModelAndView();
    303. mv.addObject("pageInfo", pageInfo);
    304. mv.setViewName("views/user/teacher/midChecklist1");
    305. return mv;
    306. }
    307. /**
    308. * 学生论文列表(已审核)
    309. */
    310. @RequestMapping("/teacher/thesislist.action")
    311. public ModelAndView thesislist(HttpSession session ,@ModelAttribute("thesis") Thesis thesis ,
    312. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    313. PageHelper.startPage(pageNum, PAGE_SIZE);
    314. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    315. List<Thesis>list = thesisService.findThesisBytIdAndAgree(thesis, teacher.gettId(),"待通过");
    316. PageInfo<Thesis> pageInfo = new PageInfo<>(list,5);
    317. ModelAndView mv = new ModelAndView();
    318. mv.addObject("pageInfo", pageInfo);
    319. mv.setViewName("views/user/teacher/thesislist");
    320. return mv;
    321. }
    322. /**
    323. * 学生论文列表(待审核)
    324. */
    325. @RequestMapping("/teacher/thesislist1.action")
    326. public ModelAndView thesislist1(HttpSession session ,@ModelAttribute("thesis") Thesis thesis ,
    327. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    328. PageHelper.startPage(pageNum, PAGE_SIZE);
    329. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    330. List<Thesis>list = thesisService.findThesisBytIdAndAgree1(thesis, teacher.gettId(),"待通过");
    331. PageInfo<Thesis> pageInfo = new PageInfo<>(list,5);
    332. ModelAndView mv = new ModelAndView();
    333. mv.addObject("pageInfo", pageInfo);
    334. mv.setViewName("views/user/teacher/thesislist1");
    335. return mv;
    336. }
    337. /**
    338. * 学生附件列表
    339. */
    340. @RequestMapping("/teacher/thesisAttachmentlist.action")
    341. public ModelAndView thesisAttachmentlist(HttpSession session ,@ModelAttribute("thesisAttachment") ThesisAttachment thesisAttachment ,
    342. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    343. PageHelper.startPage(pageNum, PAGE_SIZE);
    344. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    345. List<ThesisAttachment>list = thesisAttachmentService.findThesisAttachmentList1(thesisAttachment, (String)teacher.gettId());
    346. PageInfo<ThesisAttachment> pageInfo = new PageInfo<>(list,5);
    347. ModelAndView mv = new ModelAndView();
    348. mv.addObject("pageInfo", pageInfo);
    349. mv.setViewName("views/user/teacher/thesisAttachmentlist");
    350. return mv;
    351. }
    352. /**
    353. * 学生成绩总评(教师视图)
    354. */
    355. @RequestMapping("/teacher/studentScore.action")
    356. public ModelAndView studentScore (HttpSession session,@RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum){
    357. PageHelper.startPage(pageNum, 10);
    358. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    359. List<Title1>list = titleService.findTitleListBytId11((String)teacher.gettId());
    360. ScoreProportion scoreProportion = scoreProportionService.getScoreProportion("1");
    361. PageInfo<Title1> pageInfo = new PageInfo<>(list,10);
    362. ModelAndView mv = new ModelAndView();
    363. mv.addObject("pageInfo", pageInfo);
    364. mv.addObject("scoreProportion", scoreProportion);
    365. mv.setViewName("views/user/teacher/studentscore");
    366. return mv;
    367. }
    368. /**
    369. * 修改评语和学生成绩(教师视图)
    370. */
    371. @RequestMapping("/teacher/editStudentScore.action")
    372. @ResponseBody
    373. public String studentScore (SelectTitle selectTitle){
    374. System.out.println(selectTitle.getsId());
    375. System.out.println(selectTitle.getTitlId());
    376. System.out.println(selectTitle.gettScore());
    377. int rows = 0;
    378. try {
    379. rows = selectTitleService.updateSelTitle(selectTitle);
    380. } catch(Exception e) {
    381. }
    382. if(rows > 0){
    383. return "OK";
    384. }else{
    385. return "FAIL";
    386. }
    387. }
    388. /**
    389. * 向个人信息修改页面跳转(教师)
    390. */
    391. @RequestMapping(value = "/teacher/topersonInfo.action")
    392. public String topersonInfo(HttpSession session) {
    393. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    394. teacher = teacherService.findTeacher(teacher.gettId(), teacher.gettPwd());
    395. session.setAttribute("USER_INFO", teacher);
    396. return "views/user/teacher/personInfo";
    397. }
    398. /**
    399. * 教师信息修改
    400. */
    401. @RequestMapping(value = "/teacher/editInfo.action")
    402. @ResponseBody
    403. public String editInfo(Teacher teacher) {
    404. int rows =0;
    405. try{
    406. rows = teacherService.editInfo(teacher);
    407. }catch(Exception e){
    408. rows =0;
    409. }
    410. if(rows > 0){
    411. System.out.println("OK");
    412. return "OK";
    413. }else{
    414. System.out.println("FAIL");
    415. return "FAIL";
    416. }
    417. }
    418. /**
    419. * 向密码修改页面跳转(教师)
    420. */
    421. @RequestMapping(value = "/teacher/toeditPwd.action")
    422. public String toeditPwd(HttpSession session) {
    423. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    424. teacher = teacherService.findTeacherById(teacher.gettId());
    425. session.setAttribute("USER_INFO", teacher);
    426. return "views/user/teacher/editPwd";
    427. }
    428. /**
    429. * 教师密码修改
    430. */
    431. @RequestMapping(value = "/teacher/editPwd.action")
    432. @ResponseBody
    433. public String editPwd(Teacher teacher) {
    434. int rows =0;
    435. try{
    436. rows = teacherService.editInfo(teacher);
    437. }catch(Exception e){
    438. }
    439. if(rows > 0){
    440. return "OK";
    441. }else{
    442. return "FAIL";
    443. }
    444. }
    445. /**
    446. * 向专业负责人页面跳转
    447. */
    448. @RequestMapping(value = "/teacher/leading/Index.action", method = RequestMethod.GET)
    449. public ModelAndView Index(HttpSession session) {
    450. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    451. int sum = studentService.findStudentSum(teacher.getMajor());
    452. int s = titleService.findTitleSum2(teacher.getMajor(),"已被选择");
    453. int s1 = sum - s;
    454. int sumProjBook = 0;
    455. int sumOpenReport = 0;
    456. int sumMidCheck = 0;
    457. int sumThesis = 0;
    458. List<ProjBook> list = projBookService.findProjBookByMajorAndAgree(null, teacher.getMajor(), "通过");
    459. if(list!=null) {
    460. sumProjBook = list.size();
    461. }
    462. List<OpenReport> list1 = openReportService.findOpenReportByMajorAndAgree(null, teacher.getMajor(), "通过");
    463. if(list1!=null) {
    464. sumOpenReport = list1.size();
    465. }
    466. List<MidCheck> list2 = midCheckService.findMidCheckByMajorAndAgree(null, teacher.getMajor(), "通过");
    467. if(list2!=null) {
    468. sumMidCheck = list2.size();
    469. }
    470. List<Thesis> list3 = thesisService.findThesisByMajorAndAgree(null, teacher.getMajor(), "通过");
    471. if(list3!=null) {
    472. sumThesis = list3.size();
    473. }
    474. ModelAndView mv = new ModelAndView();
    475. mv.addObject("sum", sum);
    476. mv.addObject("s", s);
    477. mv.addObject("s1", s1);
    478. mv.addObject("sumProjBook",sumProjBook);
    479. mv.addObject("sumOpenReport",sumOpenReport);
    480. mv.addObject("sumMidCheck",sumMidCheck);
    481. mv.addObject("sumThesis",sumThesis);
    482. mv.setViewName("views/user/teacher/leading/Index");
    483. return mv;
    484. }
    485. /**
    486. * 向已审核课题页面跳转
    487. */
    488. @RequestMapping(value = "/teacher/leading/totitlelist.action")
    489. public ModelAndView titlelist(HttpSession session, @ModelAttribute("title") Title title,
    490. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    491. // pageNo 页码 pageSize 每页记录数
    492. PageHelper.startPage(pageNum, 10);
    493. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    494. title.setMajor(teacher.getMajor());
    495. title.setTitlState("待审批");
    496. List<Title1>list = titleService.findTitleListBytitlState(title);
    497. List<Student> list1= studentService.findStudnetBySeltitlState(teacher.getMajor());
    498. PageInfo<Title1> pageInfo = new PageInfo<>(list,10);
    499. ModelAndView mv = new ModelAndView();
    500. mv.addObject("title", title);
    501. mv.addObject("list1", list1);
    502. mv.addObject("pageInfo", pageInfo);
    503. mv.setViewName("views/user/teacher/leading/titlelist");
    504. return mv;
    505. }
    506. /**
    507. * 向待审核课题页面跳转
    508. */
    509. @RequestMapping(value = "/teacher/leading/totitlelist1.action")
    510. public ModelAndView titlelist1(HttpSession session, @ModelAttribute("title") Title title,
    511. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    512. // pageNo 页码 pageSize 每页记录数
    513. PageHelper.startPage(pageNum, 10);
    514. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    515. title.setMajor(teacher.getMajor());
    516. title.setTitlState("待审批");
    517. List<Title1>list = titleService.findTitleListBytitlState1(title);
    518. PageInfo<Title1> pageInfo = new PageInfo<>(list,10);
    519. ModelAndView mv = new ModelAndView();
    520. mv.addObject("title", title);
    521. mv.addObject("pageInfo", pageInfo);
    522. mv.setViewName("views/user/teacher/leading/titlelist1");
    523. return mv;
    524. }
    525. /**
    526. * 专业负责人审核课题
    527. */
    528. @RequestMapping(value = "/teacher/leading/checkTitle.action")
    529. @ResponseBody
    530. public String checkTitle(Title title) {
    531. SelectTitle selectTitle = new SelectTitle();
    532. selectTitle = selectTitleService.findBytitlId(title.getTitlId());
    533. if(selectTitle!=null) {
    534. if(title.getTitlState().equals("审批不通过") && selectTitle.getSeltitlState().equals("待专业负责人审批")) {
    535. selectTitle.setSeltitlState("拒绝");
    536. selectTitleService.updateSelTitle(selectTitle);
    537. }
    538. if(title.getTitlState().equals("已审批") && selectTitle.getSeltitlState().equals("待专业负责人审批")) {
    539. selectTitle.setSeltitlState("同意");
    540. selectTitleService.updateSelTitle(selectTitle);
    541. }
    542. }
    543. int rows = titleService.updateTitleById(title);
    544. if(rows > 0){
    545. return "OK";
    546. }else{
    547. return "FAIL";
    548. }
    549. }
    550. /**
    551. * 给本专业未选择课题的学生手动分配课题
    552. */
    553. @RequestMapping(value = "/teacher/leading/setStudent.action")
    554. @ResponseBody
    555. public String setStudent(HttpSession session,HttpServletRequest request,SelectTitle selectTitle) {
    556. selectTitle.setSeltitlState("同意");
    557. int rows =0;
    558. try{
    559. rows = selectTitleService.createSelectTitle(selectTitle);
    560. }catch(Exception e){
    561. }
    562. if(rows > 0){
    563. Title title = new Title();
    564. title.setTitlId(selectTitle.getTitlId());
    565. title.setSelState("已被选择");
    566. titleService.updateTitleSelStateById(title);
    567. return "OK";
    568. }else{
    569. return "FAIL";
    570. }
    571. }
    572. /**
    573. * 查询已被指导教师审核通过的任务书
    574. */
    575. @RequestMapping("/teacher/leading/projBooklist.action")
    576. public ModelAndView ProjBooklist(HttpSession session ,@ModelAttribute("projBook") ProjBook projBook ,
    577. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    578. PageHelper.startPage(pageNum, 10);
    579. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    580. List<ProjBook>list = projBookService.findProjBookByMajorAndAgree(projBook, teacher.getMajor(), "通过");
    581. PageInfo<ProjBook> pageInfo = new PageInfo<>(list,10);
    582. ModelAndView mv = new ModelAndView();
    583. mv.addObject("pageInfo", pageInfo);
    584. mv.setViewName("views/user/teacher/leading/projbooklist");
    585. return mv;
    586. }
    587. /**
    588. * 查询已被指导教师审核通过的开题报告
    589. */
    590. @RequestMapping("/teacher/leading/openReportlist.action")
    591. public ModelAndView OpenReportlist(HttpSession session ,@ModelAttribute("openReport") OpenReport openReport ,
    592. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    593. PageHelper.startPage(pageNum, 10);
    594. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    595. List<OpenReport>list = openReportService.findOpenReportByMajorAndAgree(openReport, teacher.getMajor(),"通过");
    596. PageInfo<OpenReport> pageInfo = new PageInfo<>(list,10);
    597. ModelAndView mv = new ModelAndView();
    598. mv.addObject("pageInfo", pageInfo);
    599. mv.setViewName("views/user/teacher/leading/openReportlist");
    600. return mv;
    601. }
    602. /**
    603. * 查询已被指导教师审核通过的中期检查
    604. */
    605. @RequestMapping("/teacher/leading/midChecklist.action")
    606. public ModelAndView MidCheckList(HttpSession session ,@ModelAttribute("midCheck") MidCheck midCheck ,
    607. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    608. PageHelper.startPage(pageNum, 10);
    609. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    610. List<MidCheck>list = midCheckService.findMidCheckByMajorAndAgree(midCheck, teacher.getMajor(),"通过");
    611. PageInfo<MidCheck> pageInfo = new PageInfo<>(list,10);
    612. ModelAndView mv = new ModelAndView();
    613. mv.addObject("pageInfo", pageInfo);
    614. mv.setViewName("views/user/teacher/leading/midChecklist");
    615. return mv;
    616. }
    617. /**
    618. * 查询已被指导教师审核通过的论文
    619. */
    620. @RequestMapping("/teacher/leading/thesislist.action")
    621. public ModelAndView Thesislist(HttpSession session ,@ModelAttribute("thesis") Thesis thesis ,
    622. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    623. PageHelper.startPage(pageNum, 10);
    624. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    625. List<Thesis>list = thesisService.findThesisByMajorAndAgree(thesis, teacher.getMajor(),"通过");
    626. PageInfo<Thesis> pageInfo = new PageInfo<>(list,10);
    627. ModelAndView mv = new ModelAndView();
    628. mv.addObject("pageInfo", pageInfo);
    629. mv.setViewName("views/user/teacher/leading/thesislist");
    630. return mv;
    631. }
    632. /**
    633. * 查询学生上传的论文附件
    634. */
    635. @RequestMapping("/teacher/leading/thesisAttachmentlist.action")
    636. public ModelAndView ThesisAttachmentlist(HttpSession session ,@ModelAttribute("thesisAttachment") ThesisAttachment thesisAttachment ,
    637. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    638. PageHelper.startPage(pageNum, 10);
    639. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    640. List<ThesisAttachment>list = thesisAttachmentService.findThesisAttachmentListByMajor(thesisAttachment, (String)teacher.getMajor());
    641. PageInfo<ThesisAttachment> pageInfo = new PageInfo<>(list,10);
    642. ModelAndView mv = new ModelAndView();
    643. mv.addObject("pageInfo", pageInfo);
    644. mv.setViewName("views/user/teacher/leading/thesisAttachmentlist");
    645. return mv;
    646. }
    647. /**
    648. * 学生成绩总评(专业负责人视图)
    649. */
    650. @RequestMapping("/teacher/leading/studentScore.action")
    651. public ModelAndView StudentScore (HttpSession session,@ModelAttribute("title") Title title,
    652. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum){
    653. PageHelper.startPage(pageNum, 10);
    654. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    655. List<Title1>list = titleService.findTitleListBymajor(title,teacher.getMajor());
    656. ScoreProportion scoreProportion = scoreProportionService.getScoreProportion("1");
    657. PageInfo<Title1> pageInfo = new PageInfo<>(list,10);
    658. ModelAndView mv = new ModelAndView();
    659. mv.addObject("list", list);
    660. mv.addObject("pageInfo", pageInfo);
    661. mv.addObject("scoreProportion", scoreProportion);
    662. mv.setViewName("views/user/teacher/leading/studentScore");
    663. return mv;
    664. }
    665. /**
    666. * 修改答辩评语和学生成绩(专业负责人视图)
    667. */
    668. @RequestMapping("/teacher/leading/editStudentScore.action")
    669. @ResponseBody
    670. public String editStudentScore (SelectTitle selectTitle){
    671. int rows = 0;
    672. try {
    673. rows = selectTitleService.updateSelTitle(selectTitle);
    674. } catch(Exception e) {
    675. }
    676. if(rows > 0){
    677. return "OK";
    678. }else{
    679. return "FAIL";
    680. }
    681. }
    682. /**
    683. * 向答辩安排页面跳转(专业负责人)
    684. */
    685. @RequestMapping(value = "/teacher/leading/toreply.action")
    686. public ModelAndView reply(HttpSession session,@RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    687. PageHelper.startPage(pageNum, 10);
    688. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    689. List <ReplyGroup> list = replyGroupService.replyGrouplist(teacher.gettId());
    690. PageInfo<ReplyGroup> pageInfo = new PageInfo<>(list,10);
    691. ModelAndView mv = new ModelAndView();
    692. mv.addObject("pageInfo", pageInfo);
    693. mv.setViewName("views/user/teacher/leading/reply");
    694. return mv;
    695. }
    696. /**
    697. * 向创建答辩组页面跳转(专业负责人)
    698. */
    699. @RequestMapping(value = "/teacher/leading/tocreateReply.action")
    700. public ModelAndView tocreateReply(HttpSession session) {
    701. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    702. List<Teacher> list= teacherService.findTeacherBydept(teacher.getDept());
    703. ModelAndView mv = new ModelAndView();
    704. mv.addObject("list", list);
    705. mv.setViewName("views/user/teacher/leading/newReply");
    706. return mv;
    707. }
    708. /**
    709. * 创建答辩组(专业负责人)
    710. */
    711. @RequestMapping(value = "/teacher/leading/createReply.action")
    712. @ResponseBody
    713. public String createReply(ReplyGroup replyGroup) {
    714. int rows = 0;
    715. try {
    716. rows = replyGroupService.createReply(replyGroup);
    717. }catch(Exception e) {
    718. rows = 0;
    719. }
    720. if(rows > 0){
    721. String replyMember = replyGroup.getReplyMember();
    722. int l = replyMember.length();
    723. String s = replyMember.replaceAll(",","");
    724. int ll = s.length();
    725. int cc = l - ll + 1;
    726. String []member = new String[2];
    727. for(int i = 0;i < cc;i++) {
    728. member[i] = replyMember.substring(0, replyMember.indexOf(" "));
    729. System.out.println("评阅教师"+member[i]);
    730. replyMember = replyMember.substring(replyMember.indexOf(",") + 1,replyMember.length()-1);
    731. }
    732. String replyStudent = replyGroup.getReplyStudent();
    733. int l1 = replyStudent.length();
    734. String s1 = replyStudent.replaceAll(",","");
    735. int l2 = s1.length();
    736. int c = l1 - l2 + 1;
    737. String []student = new String[4];
    738. for(int i = 0;i < c;i++) {
    739. student[i] = replyStudent.substring(0, replyStudent.indexOf(" "));
    740. List<Thesis> list = thesisService.findThesisBytIdAndAgreeAndBatch(student[i], "通过",replyGroup.getBatch());
    741. for(int m = 0;m < list.size();m++) {
    742. Review review = new Review();
    743. review.setsId(list.get(m).getsId());
    744. review.setMemberTId(replyGroup.getReplyLeader().substring(0, replyGroup.getReplyLeader().indexOf(" ")));
    745. review.setReplyId(replyGroup.getReplyId());
    746. review.setReviewScore(0);
    747. review.setReviewType("答辩组长评分");
    748. reviewService.insertReview(review);
    749. }
    750. for(int j = 0;j < cc;j++) {
    751. for(int k = 0;k < list.size();k++) {
    752. Review review = new Review();
    753. review.setsId(list.get(k).getsId());
    754. review.setMemberTId(member[j]);
    755. review.setReplyId(replyGroup.getReplyId());
    756. review.setReviewScore(0);
    757. review.setReviewType("评阅教师评分");
    758. reviewService.insertReview(review);
    759. }
    760. }
    761. System.out.println("答辩学生"+student[i]+"所带学生");
    762. replyStudent = replyStudent.substring(replyStudent.indexOf(",") + 1,replyStudent.length()-1);
    763. }
    764. return "OK";
    765. }else{
    766. return "FAIL";
    767. }
    768. }
    769. /**
    770. * 删除答辩组(专业负责人)
    771. */
    772. @RequestMapping(value = "/teacher/leading/replydelete.action")
    773. @ResponseBody
    774. public String replydelete(String replyId) {
    775. int rows = replyGroupService.deleteReply(replyId);
    776. if(rows > 0){
    777. return "OK";
    778. }else{
    779. return "FAIL";
    780. }
    781. }
    782. /**
    783. * 向个人信息修改页面跳转(专业负责人)
    784. */
    785. @RequestMapping(value = "/teacher/leading/topersonInfo.action")
    786. public String TopersonInfo(HttpSession session) {
    787. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    788. teacher = teacherService.findTeacher(teacher.gettId(), teacher.gettPwd());
    789. session.setAttribute("USER_INFO", teacher);
    790. return "views/user/teacher/leading/personInfo";
    791. }
    792. /**
    793. * 向密码修改页面跳转(专业负责人)
    794. */
    795. @RequestMapping(value = "/teacher/leading/toeditPwd.action")
    796. public String ToeditPwd(HttpSession session) {
    797. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    798. teacher = teacherService.findTeacherById(teacher.gettId());
    799. session.setAttribute("USER_INFO", teacher);
    800. return "views/user/teacher/leading/editPwd";
    801. }
    802. // 导出学生成绩信息
    803. @RequestMapping("/teacher/leading/export.action")
    804. public void export(HttpSession session,HttpServletResponse response) {
    805. HSSFWorkbook book = new HSSFWorkbook();
    806. //创建sheet
    807. HSSFSheet sheet = book.createSheet("学生成绩表");
    808. sheet.setDefaultColumnWidth(15);
    809. sheet.setColumnWidth(3, 40*256);
    810. sheet.setColumnWidth(5, 40*256);
    811. sheet.setColumnWidth(8, 40*256);
    812. sheet.setColumnWidth(11, 40*256);
    813. sheet.setColumnWidth(14, 40*256);
    814. //创建标题列
    815. HSSFRow titleRow = sheet.createRow(0);
    816. //创建表单单元格并设置值
    817. titleRow.createCell(0).setCellValue("编号");
    818. titleRow.createCell(1).setCellValue("学号");
    819. titleRow.createCell(2).setCellValue("学生姓名");
    820. titleRow.createCell(3).setCellValue("题目");
    821. titleRow.createCell(4).setCellValue("指导教师");
    822. titleRow.createCell(5).setCellValue("指导教师评语");
    823. titleRow.createCell(6).setCellValue("指导教师评分");
    824. titleRow.createCell(7).setCellValue("答辩组组长");
    825. titleRow.createCell(8).setCellValue("答辩组组长评语");
    826. titleRow.createCell(9).setCellValue("答辩组组长评分");
    827. titleRow.createCell(10).setCellValue("评阅教师");
    828. titleRow.createCell(11).setCellValue("评阅教师评语");
    829. titleRow.createCell(12).setCellValue("评阅教师评分");
    830. titleRow.createCell(13).setCellValue("评阅教师");
    831. titleRow.createCell(14).setCellValue("评阅教师评语");
    832. titleRow.createCell(15).setCellValue("评阅教师评分");
    833. titleRow.createCell(16).setCellValue("总成绩");
    834. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    835. List<Title1>list = titleService.findTitleListBymajor2(teacher.getMajor());
    836. for (int i = 0; i < list.size(); i++) {
    837. Title1 title = list.get(i);
    838. HSSFRow row = sheet.createRow(i+1);
    839. row.createCell(0).setCellValue(i+1);
    840. row.createCell(1).setCellValue(title.getsId());
    841. row.createCell(2).setCellValue(title.getsName());
    842. row.createCell(3).setCellValue(title.getTitlName());
    843. row.createCell(4).setCellValue(title.gettName());
    844. if(title.gettComments()==null) {
    845. row.createCell(5).setCellValue("");
    846. }else {
    847. row.createCell(5).setCellValue(title.gettComments());
    848. }
    849. if(title.gettScore()==0) {
    850. row.createCell(6).setCellValue("");
    851. }else {
    852. row.createCell(6).setCellValue(title.gettScore());
    853. }
    854. if(title.getReplyScore()==null) {
    855. row.createCell(7).setCellValue("");
    856. row.createCell(8).setCellValue("");
    857. row.createCell(9).setCellValue("");
    858. row.createCell(10).setCellValue("");
    859. row.createCell(11).setCellValue("");
    860. row.createCell(12).setCellValue("");
    861. row.createCell(13).setCellValue("");
    862. row.createCell(14).setCellValue("");
    863. row.createCell(15).setCellValue("");
    864. }else {
    865. List<Review1> list1 = reviewService.findBySId(title.getsId());
    866. row.createCell(7).setCellValue(list1.get(0).getMemberTName());
    867. row.createCell(8).setCellValue(list1.get(0).getReviewComments());
    868. row.createCell(9).setCellValue(list1.get(0).getReviewScore());
    869. row.createCell(10).setCellValue(list1.get(1).getMemberTName());
    870. row.createCell(11).setCellValue(list1.get(1).getReviewComments());
    871. row.createCell(12).setCellValue(list1.get(1).getReviewScore());
    872. row.createCell(13).setCellValue(list1.get(2).getMemberTName());
    873. row.createCell(14).setCellValue(list1.get(2).getReviewComments());
    874. row.createCell(15).setCellValue(list1.get(2).getReviewScore());
    875. }
    876. if(title.gettScore()==0 ||title.getReplyScore()==null) {
    877. row.createCell(16).setCellValue("成绩未全");
    878. }
    879. else {
    880. row.createCell(16).setCellValue(title.gettScore()*0.5 + title.getReplyScore());
    881. }
    882. }
    883. try {
    884. //设置响应头,响应的内容是为附件形式
    885. response.addHeader("Content-Disposition",
    886. "attachment;filename=" + new String("学生成绩表.xls".getBytes(), "ISO-8859-1"));
    887. book.write(response.getOutputStream());
    888. } catch (Exception e) {
    889. e.printStackTrace();
    890. }
    891. }
    892. /**
    893. * 向评阅教师页面跳转
    894. */
    895. @RequestMapping(value = "/teacher/toreview.action")
    896. public ModelAndView review(HttpSession session,@ModelAttribute("review") Review1 review,
    897. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    898. PageHelper.startPage(pageNum, 10);
    899. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    900. List <Review1> list = reviewService.findByMemberId(review,teacher.gettId());
    901. String replyLeader = teacher.gettId()+" "+teacher.gettName();
    902. List <Review1> list2 = reviewService.findByReplyLeader(replyLeader);
    903. int i = 0;
    904. PageInfo<Review1> pageInfo = new PageInfo<>(list,10);
    905. ModelAndView mv = new ModelAndView();
    906. if(list2.size()!=0) {
    907. i = 1;
    908. }
    909. mv.addObject("i", i);
    910. mv.addObject("pageInfo", pageInfo);
    911. mv.setViewName("views/user/teacher/review");
    912. return mv;
    913. }
    914. /**
    915. * 评阅教师获取学生评分详情
    916. */
    917. @RequestMapping(value = "/teacher/editReviewScore.action")
    918. @ResponseBody
    919. public String editReviewScore (Review review){
    920. int rows = 0;
    921. try {
    922. rows = reviewService.updateReview(review);
    923. } catch(Exception e) {
    924. }
    925. if(rows > 0){
    926. return "OK";
    927. }else{
    928. return "FAIL";
    929. }
    930. }
    931. /**
    932. * 答辩组长获取答辩组学生评分列表
    933. */
    934. @RequestMapping(value = "/teacher/toReplyleader.action")
    935. public ModelAndView toReplyleader(HttpSession session,@ModelAttribute("review") Review1 review,
    936. @RequestParam(value="pageNum",required=false,defaultValue="1") int pageNum) {
    937. PageHelper.startPage(pageNum, 10);
    938. Teacher teacher = (Teacher)session.getAttribute("USER_INFO");
    939. String replyLeader = teacher.gettId()+" "+teacher.gettName();
    940. List <Review1> list2 = reviewService.findReviewByRLer(review,replyLeader);
    941. int i = 0;
    942. PageInfo<Review1> pageInfo = new PageInfo<>(list2,10);
    943. ModelAndView mv = new ModelAndView();
    944. if(list2.size()!=0) {
    945. i = 1;
    946. }
    947. mv.addObject("i", i);
    948. mv.addObject("pageInfo", pageInfo);
    949. mv.setViewName("views/user/teacher/replyLeader");
    950. return mv;
    951. }
    952. /**
    953. * 获取答辩学生评语详情
    954. */
    955. @RequestMapping(value = "/teacher/getReviewBySId.action")
    956. @ResponseBody
    957. public List<Review1> getReviewBySId(String sId){
    958. List<Review1> list = null;
    959. try{
    960. list = reviewService.findBySId(sId);
    961. }catch(Exception e){
    962. }
    963. return list;
    964. }
    965. /**
    966. * 保存学生答辩成绩
    967. */
    968. @RequestMapping(value = "/teacher/saveScore.action")
    969. @ResponseBody
    970. public String saveScore(String sId,Long titlId){
    971. int rows = 0;
    972. List<Review1> list = null;
    973. int flag = 0;
    974. try {
    975. list = reviewService.findBySId(sId);
    976. } catch(Exception e) {
    977. }
    978. for(int i = 0;i<list.size();i++) {
    979. if(list.get(i).getReviewScore()==0) {
    980. flag = 1;
    981. }
    982. }
    983. if(flag == 1) {
    984. return "FAIL1";
    985. }
    986. int score1 = 0;
    987. int score2 = 0;
    988. int count = 0;
    989. for(int i = 0;i<list.size();i++) {
    990. if(i == 0) {
    991. score1 = list.get(i).getReviewScore();
    992. }else {
    993. score2 += list.get(i).getReviewScore();
    994. count++;
    995. }
    996. }
    997. ScoreProportion scoreProportion = scoreProportionService.getScoreProportion("1");
    998. double replyScore = score1 * scoreProportion.getLeaderScoreProportion() + (score2/count)*(scoreProportion.getReviewScoreProportion());
    999. DecimalFormat df = new DecimalFormat("#.00");
    1000. replyScore = Double.parseDouble(df.format(replyScore));
    1001. try {
    1002. SelectTitle selectTitle = new SelectTitle();
    1003. selectTitle.setsId(sId);
    1004. selectTitle.setTitlId(titlId);
    1005. selectTitle.setReplyScore(replyScore);
    1006. rows = selectTitleService.updateReplyScore(selectTitle);
    1007. } catch(Exception e) {
    1008. }
    1009. if(rows > 0){
    1010. return "OK";
    1011. }else{
    1012. return "FAIL";
    1013. }
    1014. }
    1015. }

     源码获取:俺的博客首页 "资源" 里下载!

  • 相关阅读:
    设计模式 实践案例
    设计模式之享元模式
    PostgreSQL修炼之道笔记之准备篇(四)
    java面试(多线程)
    UOS服务器操作系统部署EFK
    2022-09-18 Docker 基础命令
    阿里云ACP知识点(三)
    MySQL中BETWEEN AND(范围查询)
    neo4j安装、运行以及项目的构建和功能实现
    HTML期末作业——基于html实现娱乐音乐资讯发布平台HTML模板(22页面)
  • 原文地址:https://blog.csdn.net/m0_66863468/article/details/124998526