基于javaweb的SSM在线视频教育系统(java+ssm+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

230023572402

240023572402

250023572402

260023572402

270023572402

280023572402

基于javaweb的SSM在线视频教育系统(java+ssm+jsp+mysql)

项目介绍

基于SSM的在线视频教育系统设计与实现.系统分为管理员与普通用户两种角色。

1)登录模块 在进入系统首页后,首先看到的是登录界面,该界面会提供注册用户的功能,在登陆界面,输入用户名之后,首先要发送ajax请求验证用户名是否存在,第一时间内给用户提示。 2)客户端模块 本模块分为密钥管理,角色管理,权限管理,个人信息,课程信息等组成。 3)后台管理模块 本模块包括用户管理,作品信息管理等。 用户管理:提供管理员查询用户,锁定解锁用户,修改用户信息,充值余额。 课程信息管理:提供管理员增加删除修改功能。 系统日志查看:查看所有系统的动作信息。 访问ip管理:提供对访问IP的管理,可以进行拉黑IP等操作。

环境需要

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版本;

技术栈

  1. 后端:SSM(Spring SpringMVC MyBatis)

使用说明

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
		if (isvip = true) {
for (int a = 0; a < reviews.size(); a++) {
reviews.get(a).setVip(1);
}
}
reviewBiz.updateByPrimaryKeySelective(reviews);
userBiz.updateByPrimaryKeySelective(loginUser);
Map map = new HashMap<String, String>();
map.put("username", loginUser.getUsername());
map.put("password", loginUser.getPassword());
session.setAttribute("loginUser", userBiz.selectLoginUser(map));

response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();

out.println(data);

}
}
package com.gdp.mooc.util;



/**
* 文件上传包装类
* jpg文件与其他文件分开存放
*
*/
public class UploadFile {
// 上传文件存储目录
private static final String UPLOAD_DIRECTORY = "style\\video";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
                for (FileItem item : formItems) {
// 处理不在表单中的字段
if (!item.isFormField()) {
String fileName = new File(item.getName()).getName();
String fileExtName = fileName.substring(fileName.lastIndexOf(".") + 1);
String filePath = uploadPath + File.separator + refilename + "." + fileExtName;
if (fileExtName.equals("jpg")) {
filePath = uploadImagePath + File.separator + refilename + "." + fileExtName;
}
File storeFile = new File(filePath);
// 在控制台输出文件的上传路径
System.out.println(filePath);
// 保存文件到硬盘
item.write(storeFile);
System.out.println("文件上传成功!");
/*request.setAttribute("message",
"文件上传成功!");*/
}
}
}
} catch (Exception ex) {
System.err.println("错误信息: " + ex.getMessage());
/* request.setAttribute("message",
"错误信息: " + ex.getMessage());*/
}
if (pmap.get("id") != null && !pmap.get("id").equals("")) {
course.setId(Integer.parseInt(pmap.get("id")));
}
course.setName(pmap.get("name"));
course.setContext(pmap.get("context"));
course.setType(pmap.get("type"));
course.setPrice("1");
return course;
}
}
package com.gdp.mooc.controller;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 设置最大请求值 (包含文件和表单数据)
upload.setSizeMax(MAX_REQUEST_SIZE);

// 中文处理
upload.setHeaderEncoding("UTF-8");

// 构造临时路径来存储上传的文件
// 这个路径相对当前应用的目录
String uploadPath = request.getServletContext().getRealPath("./") + File.separator + UPLOAD_DIRECTORY;
String uploadImagePath = request.getServletContext().getRealPath("./") + File.separator + UPLOADImage_DIRECTORY;


// 如果目录不存在则创建
File uploadDir = new File(uploadPath);
File uploadImageDir = new File(uploadImagePath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
if (!uploadImageDir.exists()) {
uploadImageDir.mkdir();
}
Map<String, String> pmap = new HashMap<>();
Course course = new Course();

try {
// 解析请求的内容提取文件数据
@SuppressWarnings("unchecked")
List<FileItem> formItems = upload.parseRequest(request);

if (formItems != null && formItems.size() > 0) {
// 迭代表单数据
for (FileItem item : formItems) {
// 处理在表单中的字段
if (item.isFormField()) {
pmap.put(item.getFieldName(), item.getString("utf-8"));
}

}
if (pmap.get("id") == null || pmap.get("id").equals("")) {
refilename = String.valueOf(Integer.parseInt(refilename) + 1);

} else {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
		if(type==0){//0为屏蔽用户
User user = userBiz.selectByPrimaryKey(userid);
user.setBuycase("1");
userBiz.updateByPrimaryKeySelective(user);
setlog(user,req.getRemoteAddr(),"屏蔽用户登录",loginUser.getUsername());
return "redirect:alluser.do?page=0";
}
if(type==1){//1为恢复用户
User user = userBiz.selectByPrimaryKey(userid);
user.setBuycase("0");
userBiz.updateByPrimaryKeySelective(user);
setlog(user,req.getRemoteAddr(),"恢复用户登录",loginUser.getUsername());
return "redirect:alluser.do?page=0";
}

}
return "redirect:alluser.do?page=0";
}
@RequestMapping(value = "rechargeindex")//充值余额界面
public String rechargeindex( HttpSession session) {
User loginUser = (User) session.getAttribute("loginUser");
if (loginUser == null) {
return "login";
}else if(!"admin".equals(loginUser.getMission())){
//添加管理员的再次验证
return "redirect:course.do";
}
return "admin/recharge";
}
@RequestMapping(value = "recharge")//充值余额
public void recharge(String userid,int collect, String paypassword,HttpServletRequest req,
HttpSession session,HttpServletResponse resp) throws IOException {
User loginUser = (User) session.getAttribute("loginUser");
resp.setCharacterEncoding("utf-8");
PrintWriter pw = resp.getWriter();
User user = userBiz.selectByPrimaryKey(userid);
if(user==null){
pw.print("用户ID不存在!请核实后再充值");
}else if(!paypassword.equals("123456")){
pw.print("0");
}else{
user.setCollect(user.getCollect()+collect);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
		List<Ipset> ipss = ipsetBiz.select();
int totalpage = 14;//一页的数量
List<Ipset> ips = new ArrayList<Ipset>();
session.setAttribute("maxpage", (ipss.size()-1)/totalpage);
for(int i = page*totalpage;i<page*totalpage+totalpage;i++){
if(ipss.size()==i){
session.setAttribute("ips", ips);
session.setAttribute("page", page);
return "admin/allip";
}
ips.add(ipss.get(i));
}
session.setAttribute("page", page);
session.setAttribute("ips", ips);
return "admin/allip";
}
}
@RequestMapping(value="ipset")//ip管理
public String ipset(HttpSession session,String ip,String onbaned){
if(onbaned!=null) {
Ipset ip1 = ipsetBiz.selectip(ip);
ip1.setType("0");
ip1.setBantime(null);
ipsetBiz.updateByPrimaryKeySelective(ip1);
return "redirect:allip.do?page=0";
}

session.setAttribute("ip", ipsetBiz.selectip(ip));
return "admin/ipset";
}
@RequestMapping(value="banip")//封禁ip
public void banip(HttpServletResponse resp,HttpSession session,String ip,String mark,String time) throws IOException{
Date date = new Date();
Ipset ip1 = ipsetBiz.selectip(ip);
boolean isnull = false;
if(ip1==null) {
ip1=new Ipset();
ip1.setIp(ip);
isnull =true;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
	}
if(type!=null&&seachusername!=null){
List<Log> logs = logBiz.selectadminlogbyusername(seachusername);
session.removeAttribute("type");
session.setAttribute("logss", logs);
session.setAttribute("logs", initlogpage(logs));
session.setAttribute("maxpage", (logs.size()-1)/15);
session.setAttribute("page", 0);
return "admin/log";
}
List<Log> logs = logBiz.select();
session.removeAttribute("type");
session.setAttribute("logss", logs);
session.setAttribute("logs", initlogpage(logs));
session.setAttribute("maxpage", (logs.size()-1)/15);
session.setAttribute("page", 0);
return "admin/log";
}

public List<Log> initlogpage(List<Log> logss){//第一次传输日志
int totalpage = 15;//一页的数量
List<Log> logs = new ArrayList<Log>();
for(int i = 0;i<totalpage;i++){
if(logss.size()==i)
return logs;
logs.add(logss.get(i));
}
return logs;
}

@RequestMapping(value = "logpage")//日志翻页
public String logpage(int page,HttpSession session){
List<Log> logss = (List<Log>) session.getAttribute("logss");
int rpage = (int) session.getAttribute("page");
int totalpage = 15;//一页的数量
List<Log> logs = new ArrayList<Log>();
for(int i = page*totalpage;i<page*totalpage+totalpage;i++){
if(logss.size()==i){
session.setAttribute("logs", logs);
session.setAttribute("page", page);
return "admin/log";
}
logs.add(logss.get(i));


项目链接:
https://javayms.github.io?id=461122572008200ua
https://javayms.pages.dev?id=461122572008200ua