一、项目简述
功能: 用户管理模块:用户登录、用户注册、修改密码 榜单列表模块:动态地从数据库中获取歌曲的链接和数据 在榜单中显示 歌曲搜索模块:在首页的搜索框中可以输入关键字进行歌 曲的模糊搜索 歌曲收藏模块:在榜单列表中或搜索页面中可以点击歌曲 进行收藏 我的音乐模块:收藏的歌曲会被添加到我的音乐列表中, 在我的音乐列表中也可以对歌曲进行删除操作 音乐播放器模块:在榜单、搜索页面和我的音乐列表等地 方点击歌曲可以炼专到播放页面进行播放。播放页面显示 播放进度条,删除歌曲,暂停等操作。播放页面背景为模 糊背景,根据歌手的专辑图片自动变化。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + Bootstrap+ maven 等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
String field = null;
if (condition.size() > 0) {
condition.put(condition.entrySet().iterator().next().getKey(), "");
}
int count = this.userService.getCount(condition, field);
if (order != null && order.length() > 0 & "desc".equals(desc)) {
order = order + " desc";
}
List<User> list = this.userService.getList(condition, pageNo, pageSize, order, field);
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("total", count);
int size = list.size();
if (size > 0) {
List<User> listFont = new ArrayList<User>();
User vo;
User voFont = new User();
for (int i = 0; i < size; i++) {
vo = list.get(i);
BeanUtils.copyProperties(vo, voFont);
listFont.add(voFont);
voFont = new User();
}
map.put("list", listFont);
data = map;
statusMsg = "根据条件获取分页数据成功!!!";
@RequestMapping(value = "/addUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse addUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
String user_name, String user_password) {
Object data = null;
String statusMsg = "";
Integer statusCode = 200;
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("user_name", user_name);
paramMap.put("user_password", user_password);
data = paramMap;
if (user_name == null || "".equals(user_name.trim()) || user_password == null
|| "".equals(user_password.trim())) {
statusMsg = " 参数为空错误!!!!";
statusCode = 201;
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
/*
*
*/
private WebResponse addOrEditUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
Object data, User user, String user_name, String user_password, boolean isAdd) {
String statusMsg = "";
Integer statusCode = 200;
if (user_name != null && !("".equals(user_name.trim()))) {
if (user_name.length() > 255) {
statusMsg = " 参数长度过长错误,testName";
statusCode = 201;
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
// 重要,建立数据,以便后期数据库能调用数据
user.setUser_name(user_name); // 建立用户名
user.setUser_password(user_password); // 建立密码
}
if (user_name == null || "".equals(user_name.trim()) || user_password == null
|| "".equals(user_password.trim())) {
statusMsg = " 参数为空错误!!!!";
statusCode = 201;
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
if (user_name.length() > 255 || user_password.length() > 65535) {
statusMsg = " 参数长度过长错误!!!";
statusCode = 201;
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
User user = new User();
boolean isAdd = true;
return this.addOrEditUser(request, response, session, data, user, user_name, user_password, isAdd);
}
@RequestMapping(value = "/editUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse editUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
String user_id, @RequestParam(required = false) String user_name,
@RequestParam(required = false) String user_password) {
Object data = null;
String statusMsg = "";
Integer statusCode = 200;
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("user_id", user_id);
paramMap.put("user_name", user_name);
paramMap.put("user_password", user_password);
@RequestParam(defaultValue = "test_id", required = false) String order,
@RequestParam(defaultValue = "desc", required = false) String desc) {
Object data = null;
String statusMsg = "";
int statusCode = 200;
LinkedHashMap<String, String> condition = new LinkedHashMap<String, String>();
if (tbStatus != null && tbStatus.length() > 0) {
condition.put("tb_status='" + tbStatus + "'", "and");
}
if (keyword != null && keyword.length() > 0) {
StringBuffer buf = new StringBuffer();
buf.append("(");
buf.append("test_name like '%").append(keyword).append("%'");
buf.append(" or ");
buf.append("info like '%").append(keyword).append("%'");
buf.append(" or ");
buf.append("other like '%").append(keyword).append("%'");
buf.append(")");
}
System.out.println("判断用户是否重复:" + rearchName);
if (user_id == null || user_id.length() == 0) {
return this.addUser(request, response, session, user_name, user_password);
} else {
return this.editUser(request, response, session, user_id, user_name, user_password);
}
}
// 添加用户
@RequestMapping(value = "/addUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse addUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
String user_name, String user_password) {
Object data = null;
String statusMsg = "";
Integer statusCode = 200;
statusMsg = " 参数长度过长错误!!!";
statusCode = 201;
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
User user = new User();
boolean isAdd = true;
return this.addOrEditUser(request, response, session, data, user, user_name, user_password, isAdd);
}
@RequestMapping(value = "/editUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse editUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
String user_id, @RequestParam(required = false) String user_name,
@RequestParam(required = false) String user_password) {
Object data = null;
String statusMsg = "";
Integer statusCode = 200;
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("user_id", user_id);
paramMap.put("user_name", user_name);
paramMap.put("user_password", user_password);
data = paramMap;
webResponse.setStatusCode(statusCode);
return webResponse;
}
// 从数据库中获取歌曲数据,在我的音乐中显示
@RequestMapping(value = "/getMyMusicList", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse getMyMusicList(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@RequestParam(defaultValue = "1", required = false) Integer pageNo,
@RequestParam(defaultValue = "10", required = false) Integer pageSize,
@RequestParam(defaultValue = "正常", required = false) String tbStatus,
@RequestParam(required = false) String keyword,
@RequestParam(defaultValue = "ml_id", required = false) String order,
@RequestParam(defaultValue = "desc", required = false) String desc,
@RequestParam(required = false) String user_name, @RequestParam(required = false) String user_password
) {
// System.out.println("我的音乐显示列表前收藏的歌曲id:" + song_id);
String user_Id = null;
try {
user_Id = myMusicService.getUserById(user_name, user_password);
} catch (Exception e) {
}
int userId = 0;
*/
if (keyword != null && keyword.length() > 0) {
StringBuffer buf = new StringBuffer();
buf.append("(");
buf.append("test_name like '%").append(keyword).append("%'");
buf.append(" or ");
buf.append("info like '%").append(keyword).append("%'");
buf.append(" or ");
buf.append("other like '%").append(keyword).append("%'");
buf.append(")");
condition.put(buf.toString(), "and");
}
String field = null;
if (condition.size() > 0) {
condition.put(condition.entrySet().iterator().next().getKey(), "");
}
// int count = this.myMusicService.getCount(condition, field);
if (order != null && order.length() > 0 & "desc".equals(desc)) {
order = order + " desc";
}
// List<MyMusic> list = this.myMusicService.getList(condition, pageNo, pageSize,
// order, field);
try {
List<MyMusic> list = this.myMusicService.getMyMusicList(userId);
Map<Object, Object> map = new HashMap<Object, Object>();
// map.put("total", count);
vo = list.get(i);
BeanUtils.copyProperties(vo, voFont);
listFont.add(voFont);
voFont = new User();
}
map.put("list", listFont);
data = map;
statusMsg = "根据条件获取分页数据成功!!!";
} else {
map.put("list", list);
data = map;
statusCode = 202;
statusMsg = "no record!!!";
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
@RequestMapping(value = "/getAdminUserList", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String getAdminTestList(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@RequestParam(defaultValue = "1", required = false) Integer pageNo,
@RequestParam(defaultValue = "10", required = false) Integer pageSize,