基于javaweb+springboot的教务管理系统(java+JSP+Spring+SpringBoot+layui+maven)
基于javaweb+springboot的教务管理系统(java+JSP+Spring+SpringBoot+layui+maven)一、项目简述功能包括:三角色教师 管理员,学生教务管理系统,包括院系管理,课题综合管理,信息管理,以及差旅管理,学生选题等等。二、项目运行环境配置:Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,
·
基于javaweb+springboot的教务管理系统(java+JSP+Spring+SpringBoot+layui+maven)
一、项目简述
功能包括:
三角色教师 管理员,学生教务管理系统,包括院系管理,课题综合管理,信息管理,以及差旅管理,学生选题等等。
二、项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
modelMap.addAttribute("specialties", specialties);
return "teacher/graduation/upload";
}
// 上传课题
@PostMapping("/up_project")
@ResponseBody
public Msg fun20(String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam("file") MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {
if (file == null) {
return Msg.fail().add("msg","文件上传失败");
}
Student student = (Student) request.getSession().getAttribute("student");
MyClass idclass = indexService.studentinfo(student.getIdClass());
model.addAttribute("tclass", idclass);
return "student/studentinfo";
}
/**
* 将查看的个人信息放到信息修改页面
*/
@RequestMapping("/modifyinfo")
public String modifyinfo(Model model) {
Student student = (Student) request.getSession().getAttribute("student");
MyClass idclass = indexService.studentinfo(student.getIdClass());
model.addAttribute("tclass", idclass);
return "student/modifyinfo";
}
}
} else {
return "300";
}
}
@RequestMapping("/index")
public String index(Model model, HttpSession httpSession) {
Student student = (Student) request.getSession().getAttribute("student");
Subject project = indexService.indexinfo(student.getId());
String str = null;
Long flag = null;
if (project == null) {
model.addAttribute("projectName", "未选课题");
model.addAttribute("flag", "未选题");
model.addAttribute("teacher", "无");
httpSession.removeAttribute("");
} else {
httpSession.setAttribute("XZproject", project.getProjectname());
model.addAttribute("XZproject", project.getProjectname());
model.addAttribute("projectName", project.getProjectname());
flag = indexService.projectselectedstuflag(student.getId());
return Msg.fail();
}
}
ServletContext servletContext = request.getSession().getServletContext();
String uploadFileName = file.getOriginalFilename(); // 获取上传文件的原名
uploadFileName = uploadFileName.substring(uploadFileName.lastIndexOf(File.separator) + 1);
File path = new File(ResourceUtils.getURL("target").getPath());
// String savePath = path.getAbsolutePath() + "\\classes\\static\\model\\" + teacher.getId();
// String saveFileName = savePath + "\\" + uploadFileName;
String savePath =
path.getAbsolutePath() + File.separator+"classes+"+File.separator+"static"
+File.separator+"model"+File.separator + teacher.getId();
String saveFileName = savePath +File.separator + uploadFileName;
File dirs = new File(savePath);
//判断路径是否存在,如果不存在就创建一个
if (!dirs.exists()) {
dirs.mkdirs();
}
file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件
SubjectWithBLOBs project = subject1;
project.setProjectname(projectName);
project.setIdProjecttype(idProjecttype);
project.setIdProjectsource(idProjectsource);
return "teacher/graduation/upload";
}
// 上传课题
@PostMapping("/up_project")
@ResponseBody
public Msg fun20(String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam("file") MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {
if (file == null) {
return Msg.fail().add("msg","文件上传失败");
}
if(teacherService.selectProjectByName(projectName).size()>0){
System.out.println("上传失败");
return Msg.fail().add("msg","课题名已存在");
}
@Autowired
private StudentService studentService;
@Autowired
private HttpServletRequest request;
@Autowired
private LoginServiceImpl loginService;
@Autowired
IndexServiceImpl indexService;
@Autowired
AdminService adminService;
@Autowired
TopicsService topicsService;
//Session过期时间
private final Integer SAVE_TIME = 60*60*24;
@GetMapping("/login")
public String login(){
return "student/login";
}
@PostMapping(value = "/login")
@ResponseBody
public String login(String name, String pwd, Model model, HttpServletResponse response) {
name = name.trim();
List<Student> student = studentService.selectByName(name);
* 201对不起密码错误
* 202对不起输入框为空
* 203新密码不一致
* 204修改失败
*/
@RequestMapping(value = "/changepassword", method = RequestMethod.PUT)
@ResponseBody
public String changepswdao(String oldpassword, String newpassword, String newpassword1) {
if(!verifypassword(newpassword)){
return "206";
}
if(!verifypassword(newpassword1)){
return "206";
}
Student student = (Student) request.getSession().getAttribute("student");
Student studentdao = loginService.selectByName(student.getUsername());
//修改教师信息
@PostMapping("/teacherupdeteinfo")
@ResponseBody
public Msg updateinfo(String name, String gender, HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
teacher.setName(name);
teacher.setGender(gender);
teacherService.teacherupdateInfo(teacher);
return Msg.success();
}
//教师出差模块
//查询所有教师出差申请信息
@GetMapping("/select_work_all")
@ResponseBody
public Msg fun1(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请成功教师出差申请
@GetMapping("/select_work_success")
ProjectWithBLOBs project = new ProjectWithBLOBs();
project.setProjectname(projectName);
project.setIdProjecttype(idProjecttype);
project.setIdProjectsource(idProjectsource);
project.setIdTeacher(teacher.getId());
project.setFilepath(saveFileName);
project.setMarchspecialty(marchspecialty.trim());
project.setTeachernames(teachernames);
project.setSelectcount(0);
project.setSelectFlag(0);
project.setVerifyprojectFlag(0);
project.setReleaseFlag(0);
int i = teacherService.insert_project(project);
return Msg.success();
}
//查看自己的课题发布记录
@GetMapping("/cxmyProject")
public String fun21(ModelMap modelMap, HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<Projecttype> projecttypes = teacherService.select_allProjecttype();
List<Projectsource> projectsources = teacherService.select_allProjectsource();
List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());
@RequestMapping("/student")
public class StudentController {
private static final Logger LOGGER = LoggerFactory.getLogger(StudentController.class);
@Autowired
private StudentService studentService;
@Autowired
private HttpServletRequest request;
@Autowired
private LoginServiceImpl loginService;
@Autowired
IndexServiceImpl indexService;
@Autowired
AdminService adminService;
@Autowired
TopicsService topicsService;
//Session过期时间
private final Integer SAVE_TIME = 60*60*24;
@GetMapping("/login")
public String login(){
return "student/login";
}
@PostMapping(value = "/login")
@ResponseBody
@GetMapping("/select_technical_personnel_year")
@ResponseBody
public Msg fun18(HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
List<TechnicalPersonnel> list = teacherService.selectTechnicalPersonnelByYear(teacher.getId());
if (list.isEmpty()) {
return Msg.fail();
} else {
return Msg.success().add("year", list);
}
}
//查询度专业技术人员考核表信息
@GetMapping("/select_technicalpersonnel_year_info")
}
}
学生管理控制层:
@Authority(roles = {Role.STUDENT})
@Controller
@RequestMapping("/student")
public class StudentController {
private static final Logger LOGGER = LoggerFactory.getLogger(StudentController.class);
@Autowired
private StudentService studentService;
@Autowired
private HttpServletRequest request;
public String Topics(Model model,HttpSession httpSession) {
Student student = (Student) request.getSession().getAttribute("student");
removeSession();
List<topicsinfo> topicsinfolist = topicsService.topics(student.getIdClass());
System.out.println(topicsinfolist);
model.addAttribute("topicsinfolist", topicsinfolist);
return "student/topicsinfo";
}
/**
* 课题具体信息
*/
@RequestMapping("/topicsto")
public String Topicsto(Long project_id,int selectFlag,String projectName, Model model, HttpSession httpSession) {
List<topicsto> topicstos = topicsService.topicsinfo(project_id);
Student student = (Student) request.getSession().getAttribute("student");
Long flag = topicsService.state(student);
Long flagto = topicsService.flag(project_id);
if (flagto != 0) {
flag = 3L;
}
model.addAttribute("selectFlag",selectFlag);
model.addAttribute("flag", flag);
model.addAttribute("topicstos", topicstos);
model.addAttribute("projectName", projectName);
return "201";
}
}
/**
* 取消选报
*/
@RequestMapping("/cancel")
@ResponseBody()
public String cancel(Long project_id, Model model, HttpSession httpSession) {
System.out.println(1);
String projectName = topicsService.selectprojectname(project_id);
Student student = (Student) request.getSession().getAttribute("student");
List<Subjectselected> subjectselected = subjectselectedMapper.selectBystudentid(student.getId());
if (subjectselected != null && subjectselected.size() != 0 && subjectselected.get(0).getStuselectFlag() != 3
&& project_id.equals(subjectselected.get(0).getIdProject())) {
topicsService.deleteprojectselectedid(student.getId());
httpSession.removeAttribute("XZproject");
model.addAttribute("XZproject", null);
return "teacher/workapproval/seewdata";
}
//填写表格页面
@GetMapping("/term_debriefing")
public String termDebriefing() {
return "teacher/fillouttable/termdebriefing";
}
@GetMapping("/year_debriefing")
public String yearDebriefing() {
return "teacher/fillouttable/yeardebriefing";
}
@GetMapping("/annual_assessment")
public String annualAssessment() {
return "teacher/fillouttable/annualassessment";
}
@GetMapping("/work_load")
public String workLoad() {
return "teacher/fillouttable/workload";
}
if (oldFile.exists()) {
//删除成功
if (oldFile.delete()) {
} else {
return Msg.fail();
}
}
ServletContext servletContext = request.getSession().getServletContext();
String uploadFileName = file.getOriginalFilename(); // 获取上传文件的原名
uploadFileName = uploadFileName.substring(uploadFileName.lastIndexOf(File.separator) + 1);
File path = new File(ResourceUtils.getURL("target").getPath());
// String savePath = path.getAbsolutePath() + "\\classes\\static\\model\\" + teacher.getId();
// String saveFileName = savePath + "\\" + uploadFileName;
String savePath =
path.getAbsolutePath() + File.separator+"classes+"+File.separator+"static"
+File.separator+"model"+File.separator + teacher.getId();
String saveFileName = savePath +File.separator + uploadFileName;
File dirs = new File(savePath);
//判断路径是否存在,如果不存在就创建一个
if (!dirs.exists()) {
String end = sdf.format(workapproval.getEndDate());
String time = start + " - " + end;
model.addAttribute("workapproval", workapproval);
model.addAttribute("time", time);
return "teacher/workapproval/fillwdata";
}
//上传出差报告
@PostMapping("/fill_in_w")
@ResponseBody
public Msg fun7(@RequestParam("id_work") Long idWork, @RequestParam("news") String news, @RequestParam("flag") Integer flag,
@RequestParam("file") MultipartFile file) throws IOException {
//判断file的值是否为空
if (file.isEmpty()) {
return Msg.error();
}
String fileName = file.getOriginalFilename();// 获取上传文件的原名
int size = (int) file.getSize();
System.out.println(fileName + "-->" + size);
File path = new File(ResourceUtils.getURL("target").getPath());
String savePath = path.getAbsolutePath() + "\\classes\\static\\model";
String saveFileName = savePath + "\\" + fileName;
public ResponseEntity<byte[]> downloadFile(String dataId, HttpServletRequest req, HttpServletResponse response) throws IOException {
Workapprovaldata workapprovaldata = null;
if (dataId != null) {
Long id = Long.valueOf(dataId);
workapprovaldata = teacherService.selectWorkDataById(id);
}
if (workapprovaldata != null) {
String filePath = workapprovaldata.getDatarar();
//设置文件路径
File file = new File(filePath);
if (!file.exists()) {
file.mkdirs();
}
String fileName = file.getName();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
String encodeFilename = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
headers.setContentDispositionFormData("attachment", encodeFilename);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
headers, HttpStatus.CREATED);
}
return null;
}
@GetMapping("/term_business")
public String termBusiness() {
return "teacher/fillouttable/termbusiness";
}
//查看表格页面
@GetMapping("/show_year_debriefing")
public String showYearDebriefing() {
return "teacher/showtable/yeardebriefing";
}
@GetMapping("/show_term_debriefing")
public String showTermDebriefing() {
return "teacher/showtable/termdebriefing";
}
@GetMapping("/show_annual_assessment")
public String showAnnualAssessment() {
return "teacher/showtable/annualassessment";
}
@GetMapping("/show_technical_personnel")
public String showTechnicalPersonnel() {
return "teacher/showtable/technicalpersonnel";
}
}
//查询指定年份的年度述职信息
@GetMapping("/select_debriefing_year_info")
@ResponseBody
public Msg fun12(Long year, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
DebriefingYearWithBLOBs debriefingYear = teacherService.selectYearDebriefingInfo(teacher.getId(), year);
return Msg.success().add("debriefingInfo", debriefingYear);
}
//查询学期述职中年份
@GetMapping("select_debriefing_term")
@ResponseBody
public Msg fun13() {
List<Debriefing> list = teacherService.selectDebriefingTermByYear();
List<Long> temp = new ArrayList<>();
//去除重复的年份
for (Debriefing s : list) {
String saveFileName = savePath +File.separator + uploadFileName;
File dirs = new File(savePath);
//判断路径是否存在,如果不存在就创建一个
if (!dirs.exists()) {
dirs.mkdirs();
}
file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件
SubjectWithBLOBs project = subject1;
project.setProjectname(projectName);
project.setIdProjecttype(idProjecttype);
project.setIdProjectsource(idProjectsource);
project.setFilepath(saveFileName);
project.setMarchspecialty(marchspecialty.trim());
project.setTeachernames(teachernames);
//修改后状态置 0
project.setSelectFlag(0);
//查询申请成功教师出差申请
@GetMapping("/select_work_success")
@ResponseBody
public Msg fun2(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSuccess(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请失败教师出差申请
@GetMapping("/select_work_failed")
@ResponseBody
public Msg fun3(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkFailed(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询已提交教师出差申请
@ResponseBody
public Msg fun14(Long year, String term, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
DebriefingWithBLOBs debriefing = teacherService.selectTermDebriefingInfo(teacher.getId(), year, term);
return Msg.success().add("debriefingInfo", debriefing);
}
//年度考核
@PostMapping("/upload_annual_assessment")
@ResponseBody
public Msg fun15(String personalSummary, String year, String remark, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
AnnualAssessmentWithBLOBs assessment = new AnnualAssessmentWithBLOBs();
assessment.setIdTeacher(teacher.getId());
assessment.setPersonalsummary(personalSummary);
assessment.setYear(year);
assessment.setRemark(remark);
Long flag = teacherService.selectAnnualAssessmentFlag(teacher.getId(), year);
if (flag == 1) {
int i = teacherService.updateAnnualAssessment(assessment);
} else {
* 203新密码不一致
* 204修改失败
*/
@RequestMapping(value = "/changepassword", method = RequestMethod.PUT)
@ResponseBody
public String changepswdao(String oldpassword, String newpassword, String newpassword1) {
if(!verifypassword(newpassword)){
return "206";
}
if(!verifypassword(newpassword1)){
}
// 工作量表相关
@GetMapping("/wordload")
public String wordloadPage() {
return "teacher/table/workload";
}
@GetMapping("/wordloadData")
@ResponseBody
public Msg wordloadData(
@RequestParam("year") String year,
@RequestParam("trem") String trem
) {
Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");
return Msg.success()
.add("teacher", teacher)
.add("workloadDTO", teacherService.getWorkload(teacher.getId(), year, trem));
}
private static final Logger LOGGER = LoggerFactory.getLogger(TeacherController.class);
@Autowired
HttpServletRequest request;
@PostMapping("/wordload")
@ResponseBody
public Msg wordloadSave(
@RequestBody WorkloadDTO workloadDTO
更多推荐
已为社区贡献1条内容
所有评论(0)