源码获取:俺的博客首页 "资源" 里下载!
项目介绍
该系统主要分为前台和后台两大功能模块,共包含三个角色:管理员、老师、家长。
具体的系统功能如下:
1.前台功能
前台为家长与老师登录,主要功能包含如下:
前台首页、学校公告、园况介绍、课程信息、论坛信息、教学特色、个人中心等功能。
2.后台功能
后台为管理员、家长与老师登录,主要功能包含如下:
后台系统登陆、个人中心、老师管理、家长管理、班级管理、学校公告管理、园况介绍管理、课程信息管理、家长沟通管理、沟通回复管理、论坛管理、系统管理等功能。
环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、MyBatis
UI界面:JSP、jQuery、vue、echarts
数据库:MySQL
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置;
3. 将项目中config.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入
前台路径地址:http://localhost:8080/ssmhc41t/front/index.html
老师:老师1 密码:123456
家长:家长1 密码:123456
后台路径地址:http://localhost:8080/ssmhc41t/admin/dist/index.html
管理员:abo 密码:abo
老师:老师1 密码:123456
家长:家长1 密码:123456
用户管理控制层:
@SuppressWarnings({ "unchecked", "rawtypes" })
@Controller
@RequestMapping("/user")
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
private final ResultMap resultMap;
@Autowired
private UserService userService;
@Autowired
private UserRoleService userRoleService;
@Autowired
public UserController(ResultMap resultMap) {
this.resultMap = resultMap;
}
@RequestMapping(value = "/getMessage", method = RequestMethod.GET)
public ResultMap getMessage() {
return resultMap.success().message("您拥有用户权限,可以获得该接口的信息!");
}
@RequestMapping(value = "/editUserPage")
public String editUserPage(String userId, Model model) {
model.addAttribute("manageUser", userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
}
return "user/userEdit";
}
@ResponseBody
@RequestMapping("/updateUser")
public String updateUser(User user) {
return userService.updateUser(user);
}
// 任务
/**
* Description: 查询所有管理员 <BR>
*
* @return List<Project>
*/
@ResponseBody
@RequestMapping(value = "/getAdmins")
public List<User> getAdmins() {
return userService.getAdmins();
}
/**
* Description: 查询所有授权用户<BR>
*
* @return List<User>
*/
@ResponseBody
@RequestMapping(value = "/getAllUser")
public List<User> getAllUser() {
return userService.getAllUser();
}
}
登录管理控制层:
@Controller
public class LoginController {
@Autowired
private ResultMap resultMap;
@Autowired
private UserService userService;// 用户登录service
@Autowired
private PageService pageService;
private final Logger logger = LoggerFactory.getLogger(LoginController.class);
@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
@ResponseBody
public ResultMap notLogin() {
logger.warn("尚未登陆!");
return resultMap.success().message("您尚未登陆!");
}
@RequestMapping(value = "/notRole", method = RequestMethod.GET)
@ResponseBody
public ResultMap notRole() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (user != null) {
logger.info("{}---没有权限!", user.getUserName());
}
return resultMap.success().message("您没有权限!");
}
/**
* Method name: logout <BR>
* Description: 退出登录 <BR>
* @return String<BR>
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
logger.info("{}---退出登录!", user.getUserName());
}
subject.logout();
return "login";
}
/**
* Method name: login <BR>
* Description: 登录验证 <BR>
* Remark: <BR>
*
* @param username 用户名
* @param password 密码
* @return ResultMap<BR>
*/
@RequestMapping(value = "/login")
@ResponseBody
public ResultMap login(String username, String password) {
return userService.login(username, password);
}
/**
* Method name: login <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/index")
public String login() {
return "login";
}
/**
* Method name: index <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/")
public String index(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute("user", user);
List<Page> pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute("pageList", pageList);
return "index";
} else {
return "login";
}
}
/**
* Method name: main <BR>
* Description: 进入主页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping(value = "/main")
public String main(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute("user", user);
} else {
return "login";
}
List<Page> pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute("pageList", pageList);
return "index";
}
/**
* Method name: checkUserPassword <BR>
* Description: 检测旧密码是否正确 <BR>
*
* @param password 旧密码
* @return boolean 是否正确<BR>
*/
@RequestMapping(value = "/user/checkUserPassword")
@ResponseBody
public boolean checkUserPassword(String password) {
return userService.checkUserPassword(password);
}
/**
* Method name: updatePassword <BR>
* Description: 更新密码 <BR>
*
* @param password 旧密码
* @return String 是否成功<BR>
*/
@RequestMapping(value = "/user/updatePassword")
@ResponseBody
public String updatePassword(String password) {
return userService.updatePassword(password);
}
}
教师管理控制层:
@Controller
@RequestMapping(value = "/ls")
public class TeacherController {
@Autowired
private StudentService studentService;
@Autowired
private ClassService classService;
@Autowired
private NoticeService noticeService;
@Autowired
private SignService signService;
@Autowired
private UserService userService;
@Autowired
private UserChildrenService userChildrenService;
@Autowired
private CourseService courseService;
@RequestMapping("/stu")
public String stu(Model model) {
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
return "ls/stuPage";
}
//学生管理
/**
* Method name: teacherPage <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/stuMG")
public String teaMG(Model model) {
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
return "ls/student";
}
/**
* Method name: getAllStudentByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllStudentByLimit")
@ResponseBody
public Object getAllStudentByLimit(Children stuParameter) {
return studentService.getAllStudentByLimit(stuParameter);
}
/**
* Method name: addStuPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addStuPage")
public String addStuPage(Integer id, Model model) {
model.addAttribute("manageStu", id);
if (null != id) {
Children student = studentService.selectByPrimaryKey(id);
//UserChildren userChild = userChildrenService.selectById(id);
model.addAttribute("manageStu", student);
//model.addAttribute("manageChild", userChild);
UserChildren uc = userChildrenService.selectByUCId(student.getId());
model.addAttribute("uc", uc);
}
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
List<User> user=userService.selectAllJiazhang();
model.addAttribute("user", user);
return "ls/stuPageAdd";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addStu")
public String addStu(Children student) {
try {
studentService.addStudent(student);
addUserChildren(student);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
public void addUserChildren(Children student) {
UserChildren userChildern = new UserChildren();
userChildern.setChildrenId(student.getId());
userChildern.setUserId(student.getUserId());
userChildern.setIsFaMa(student.getIsFaMa());
userChildern.setIsJinji(student.getIsJinji());
userChildrenService.addUserChildren(userChildern);
}
/**
* Method name: updateStudent <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateStudent")
public String updateStudent(Children studnet) {
UserChildren uc = new UserChildren();
uc.setId(studnet.getUcId());
uc.setChildrenId(studnet.getId());
uc.setIsFaMa(studnet.getIsFaMa());
uc.setIsJinji(studnet.getIsJinji());
uc.setUserId(studnet.getUserId());
userChildrenService.updateUC(uc);
return studentService.updateStu(studnet);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delStudent")
@ResponseBody
@Transactional
public String delStudent(String[] ids) {
try {
for (String id : ids) {
studentService.delStudentById(Integer.parseInt(id));
}
return "SUCCESS";
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
//公告管理
/**
* Method name: gg <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/gg")
public String gg() {
return "ls/notice";
}
/**
* Method name: getAllNoticeByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllNoticeByLimit")
@ResponseBody
public Object getAllNoticeByLimit(Notice noticeParameter) {
return noticeService.getAllNoticeByLimit(noticeParameter);
}
/**
* Method name: addStuPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addNoticePage")
public String addNoticePage(Integer id, Model model) {
model.addAttribute("manageNotice", id);
if (null != id) {
Notice notice = noticeService.selectByPrimaryKey(id);
model.addAttribute("manageNotice", notice);
}
return "ls/noticeAdd";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addNotice")
public String addNotice(Notice notice) {
try {
notice.setCreatTime(new Date());
noticeService.addNotice(notice);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateStudent <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateNotice")
public String updateNotice(Notice notice) {
return noticeService.updateStu(notice);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delNotice")
@ResponseBody
@Transactional
public String delNotice(String[] ids) {
try {
for (String id : ids) {
noticeService.delNoticeById(Integer.parseInt(id));
}
return "SUCCESS";
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
//考勤管理
/**
* Method name: lskq <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/lskq")
public String lskq() {
return "ls/sign";
}
/**
* Method name: getAllSignByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllSignByLimit")
@ResponseBody
public Object getAllSignByLimit(Sign signParameter) {
return signService.getAllSignByLimit(signParameter);
}
//打卡
@RequestMapping(value = "/qianDaoTui")
public String qianDaoTui() {
return "ls/daKa";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addSign")
public String addSign(Sign sign) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
Date date=new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a");
String time = formatter.format(date).split(" ")[2];
String time1 = formatter.format(date).split(" ")[1];
String s=PropertyUtil.getConfigureProperties("startTime");
if(time.equals("上午") && time1.compareTo(s)>0) {
sign.setState(1);
}else {
sign.setState(3);
}
sign.setType(1);
sign.setSignIn(date);
sign.setKqrId(user.getUserId());
sign.setKqrType(user.getUserState());
signService.addSign(sign);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addQianTui")
public String addQianTui(Sign sign) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
Date date=new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a");
String time = formatter.format(date).split(" ")[2];
String time1 = formatter.format(date).split(" ")[1];
String s=PropertyUtil.getConfigureProperties("endTime");
if(time.equals("下午") && time1.compareTo(s)<0) {
sign.setState(1);
}else{
sign.setState(2);
}
sign.setType(2);
sign.setSignIn(date);
sign.setKqrId(user.getUserId());
sign.setKqrType(user.getUserState());
signService.addSign(sign);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
//学生考勤
@RequestMapping(value = "/xskq")
public String xskq() {
return "ls/childSign";
}
/**
* Method name: getAllSignByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllChildSignByLimit")
@ResponseBody
public Object getAllChildSignByLimit(Sign signParameter) {
return signService.getAllChildSignByLimit(signParameter);
}
//所有老师签到的总次数统计
@RequestMapping(value = "/kqtj")
public String kqtj(Model model) {
List<TongJi> ts = signService.getAllTeacherCount();
List<String> names = new ArrayList<>();
List<Integer> zc = new ArrayList<>();
List<Integer> tq = new ArrayList<>();
List<Integer> cd = new ArrayList<>();
for (TongJi tongJi : ts) {
names.add(tongJi.getUserName());
zc.add(tongJi.getZhengChang());
tq.add(tongJi.getTiQian());
cd.add(tongJi.getChiDao());
}
model.addAttribute("names", names);
model.addAttribute("zc", zc);
model.addAttribute("tq", tq);
model.addAttribute("cd", cd);
return "ls/tongJi";
}
//所有学生签到的总次数统计
@RequestMapping(value = "/tongJiXueSheng")
public String tongJiXueSheng(Model model) {
List<TongJi> ts = signService.getAllChildCount();
List<String> names = new ArrayList<>();
List<Integer> zc = new ArrayList<>();
List<Integer> tq = new ArrayList<>();
List<Integer> cd = new ArrayList<>();
for (TongJi tongJi : ts) {
names.add(tongJi.getUserName());
zc.add(tongJi.getZhengChang());
tq.add(tongJi.getTiQian());
cd.add(tongJi.getChiDao());
}
model.addAttribute("names", names);
model.addAttribute("zc", zc);
model.addAttribute("tq", tq);
model.addAttribute("cd", cd);
return "ls/tongJiXueSheng";
}
@RequestMapping(value = "/course")
public String course(Model model) {
return "ls/course";
}
//课程
@RequestMapping(value = "/courseAdd")
public String courseAdd(Model model) {
List<User> users = userService.selectAllTea();
model.addAttribute("users", users);
List<Classes> clas = classService.selectAllClasses();
model.addAttribute("cla", clas);
return "ls/courseAdd";
}
@RequestMapping("/getAllCourseByLimit")
@ResponseBody
public Object getAllCourseByLimit(Course course) {
return courseService.getAllCourseByLimit(course);
}
@ResponseBody
@RequestMapping("/addCourse")
public String addCourse(Course course) {
course.setCreateTime(new Date());
try {
courseService.addCourse(course);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
@ResponseBody
@RequestMapping("/delCourse")
public String delCourse(Integer id) {
try {
courseService.delCourse(id);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
}
源码获取:俺的博客首页 "资源" 里下载!