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.数据库:MySql 5.7版本;
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. 运行项目,前台地址:http://localhost:8080/snack/shop/index 
后台地址:http://localhost:8080/snack/admin/login/adminLogin
 

 

 

 

 

 

后台用户管理控制层: 

@Controller
@RequestMapping("/admin/user/")
public class AdminUserControll {
	
	@Autowired
	private adminUserService adminUserService;
	
	@RequestMapping("mainToUserinfo")
	public String mainToUserinfo(){
		return "admin/user/adminUserinfo";
	}
	
	//加载用户
	@RequestMapping("adminUserinfoLimit")
	@ResponseBody
	public DataTables adminUserinfoLimit(HttpServletRequest request,int start,int length,Userinfo userinfo){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Userinfo> pageHelp= adminUserService.selectAdminUserinfoLimit(map,userinfo);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除用户
	@RequestMapping("delUserinfoById")
	@ResponseBody
	public String delUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.delUserinfoById(uId));
	}
	
	//更新加载用户
	@RequestMapping("updateGoUserinfoById")
	@ResponseBody
	public String updateGoUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.updateGoUserinfoById(uId));
	}
	
	//更新用户
	@RequestMapping("updateUserinfoById")
	@ResponseBody
	public String updateUserinfoById(Userinfo userinfo){
		return ResponseUtil.successToClient(adminUserService.updateUserinfoById(userinfo));
	}
	
	@RequestMapping("mainToAdmin")
	public String mainToAdmin(){
		return "admin/user/adminAdmin";
	}
	
	//加载用户
	@RequestMapping("adminAdminLimit")
	@ResponseBody
	public DataTables adminAdminLimit(HttpServletRequest request,int start,int length,DoAdmin doAdmin){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Admin> pageHelp= adminUserService.selectAdminLimit(map,doAdmin);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//新建
	@RequestMapping("addNewAdmin")
	@ResponseBody
	public String addNewAdmin(Admin admin){
		return ResponseUtil.successToClient(adminUserService.addAdmin(admin));
	}
	
	//删除用户
	@RequestMapping("delAdminById")
	@ResponseBody
	public String delAdminById(Admin admin){
		return ResponseUtil.successToClient(adminUserService.delAdmin(admin));
	}
	
	//更新加载用户
	@RequestMapping("updateGoAdminById")
	@ResponseBody
	public String updateGoAdminById(HttpServletRequest request,Admin admin){
		return ResponseUtil.successToClient(adminUserService.selectAdminByOne(admin));
	}
	
	//更新用户
	@RequestMapping("updateAdminById")
	@ResponseBody
	public String updateAdminById(Admin admin){
		return ResponseUtil.successToClient(adminUserService.updateAdmin(admin));
	}

}

用户管理控制层:

@Controller
@RequestMapping("/user/")
public class UserControll {
	
	@Autowired
	private userService userService;
	
	@Autowired
	private sorderService sorderService;
	
	@Autowired
	private adminOrderService adminOrderService;
	
	//跳转注册
	@RequestMapping("userRegisterGet")
	public String gotoRegister(){
		return "user/register";
	}	
	
	//注册判断用户名存在
	@RequestMapping("selectUserOne")
	@ResponseBody
	public AjaxResult getUserOne(Userinfo userinfo){
		AjaxResult aj=new AjaxResult();
		 Userinfo rs = userService.selectUserOne(userinfo);
		 aj.setTag(rs);
		 return aj;
	}
	
	//注册
	@RequestMapping("addUserRegister")
	@ResponseBody
	public AjaxResult addUserOne(Userinfo userinfo){
		 AjaxResult aj=new AjaxResult();
		 int rs = userService.addUserOne(userinfo);
		 aj.setTag(rs);
		 return aj;
	}
	
	//查登陆的用户
	@RequestMapping("readUserinfo")
	@ResponseBody
	public AjaxResult readUserinfo(Userinfo userinfo,HttpServletRequest request){
		 AjaxResult aj=new AjaxResult();
		 Userinfo usr= userService.selectUserinfoById(userinfo);
		 if(usr!=null){
			 aj.setTag(usr);
		 }
		 return aj;
	}
	
	//修改个人信息
	@RequestMapping("editUserinfo")
	@ResponseBody
	public int editUserinfo(Userinfo userinfo){
		 int rs= userService.updateUserinfoById(userinfo);
		 return rs;
	}
	
	//跳转注册
	@RequestMapping("userPersonalInfo")
	public String gotoPersonalInfo(){
		return "user/personalInfo";
	}
	
	//加载个人信息界面
	@RequestMapping("userInfo")
	public String gotoUserInfo(){
		return "user/userInfo";
	}
	
	//跳转个人积分页面
	@RequestMapping("userIntegral")
	public String userIntegral(){
		return "user/integral";
	}
	
	//跳转个人图片
	@RequestMapping("userGerenImg")
	public String userGerenImg(){
		return "user/gerenImg";
	}
	
	//加载个人积分
	@RequestMapping("userIntegralLimit")
	@ResponseBody
	public DataTables userIntegralLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Integral> pageHelp= userService.selectIntegralLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//跳转个人账户页面
	@RequestMapping("userAccount")
	public String userAccount(){
		return "user/account";
	}
	
	//加载个人积分
	@RequestMapping("userAccountLimit")
	@ResponseBody
	public DataTables userAccountLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Account> pageHelp= userService.selectAccountLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//获得金额
	@RequestMapping("getMoneyAcount")
	@ResponseBody
	public Object getMoneyAcount(HttpServletRequest request){
		return request.getSession().getAttribute("money");
	}
	
	//查看当前订单
	@RequestMapping("userOrderLimit")
	@ResponseBody
	public DataTables userOrderLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<DoMyOrder> pageHelp= userService.selectOrderLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//跳转订单页面
	@RequestMapping("userGoOrder")
	public String userGoOrder(HttpSession session){
		return "user/myOrder";
	}
	
	//跳转历史订单
	@RequestMapping("userGoSuccessOrder")
	public String userGoSuccessOrder(){
		return "user/myOrderSuccess";
	}
	
	//查看当前订单
	@RequestMapping("userSucOrderLimit")
	@ResponseBody
	public DataTables userSucOrderLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<DoMyOrder> pageHelp= userService.selectMySuccessOrderLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//请确认收货
	@RequestMapping("userOrderConfirm")
	@ResponseBody
	public String userOrderConfirm(HttpServletRequest request,int id,int typeNum){
		int eId;
		if(typeNum==0){
		    eId = (int)request.getSession().getAttribute("adminId");
		}else{
			eId=0;
		}
	return ResponseUtil.successToClient(userService.upDateByorderConfirm(id,typeNum,eId));
	}
	
	//去付款
	@RequestMapping("userOrderPayMoney")
	@ResponseBody
	public String userOrderPayMoney(HttpServletRequest request,String oId){
		DoPayMoney dpm=new DoPayMoney();
		Userinfo selectUserinfoMoney = userService.selectUserinfoMoney((int)request.getSession().getAttribute("frontuserId"));
		Double selectOrderdetailPayMoney = sorderService.selectOrderdetailPayMoney(oId);
		dpm.setPayMoney(selectOrderdetailPayMoney.toString());
		dpm.setuMoney(selectUserinfoMoney.getuMoney());
	return ResponseUtil.successToClient(dpm);
	}
	
	//确认付款
	@RequestMapping("userOrderPayMoneyConfirm")
	@ResponseBody
	public String userOrderPayMoneyConfirm(HttpServletRequest request,Float payNumber,Float uMoney,String uPasword,String oId){
		Userinfo userinfo = (Userinfo)request.getSession().getAttribute("exituser");
		if(userinfo.getuPassword().equals(uPasword)){
			sorderService.updateOrderByoId(oId);
			userService.updateUserinfoBypay(userinfo.getuId(), uMoney-payNumber);
		}else{
			return ResponseUtil.errorToClient();
		}
	   return ResponseUtil.successToClient();
	}
	
	//删除订单
		@RequestMapping("deleteMyOrder")
		@ResponseBody
		public String deleteAdminOrder(String oId){
			return ResponseUtil.successToClient(adminOrderService.deleteAdminOrder(oId));
		} 
	
	//跳转管理员信息
	@RequestMapping("mainToAdminuser")
	public String mainToAdminuser(){
		return "admin/persionInfo/adminInfo";
	}
	//加载管理员信息
	@RequestMapping("mainSelectAdminuser")
	@ResponseBody
	public String mainSelectAdminuser(HttpServletRequest request){
		int adId =(int)request.getSession().getAttribute("adminId");
		return ResponseUtil.successToClient(userService.selectAdminInfo(adId));
	}
	
	//更新管理员信息
	@RequestMapping("mainUpdateAdminuser")
	@ResponseBody
	public String mainUpdateAdminuser(DoAdminInfo admin){
		return ResponseUtil.successToClient(userService.updateAdminInfo(admin));
	}
}

登录管理控制层:

@Controller
@RequestMapping("/admin/login/")
public class AdminLogin {
	
	@Autowired
	private adminLoginService adminLoginService;
	
	@Autowired
	private AccountMapper accountMapper;

	@Autowired
	private typeService typeService;
	
	//登录login
	@RequestMapping("adminLogin")
	public String adminLogin(){
		System.out.println("存储过程相加:"+accountMapper.selectNum(4, 6));
		return "admin/adminLogin";
	}
	
	//登录
	@RequestMapping("adminGoLogin")
	public String adminGoLogin(HttpServletRequest request,Admin admin){
		List<Admin> adminSelect = adminLoginService.adminLogin(admin);
		if(adminSelect.size()==1){
			request.getSession().setAttribute("adminName", adminSelect.get(0).getAdUsername());
			request.getSession().setAttribute("adminId", adminSelect.get(0).getAdId());
			List<Permission> allPer = adminLoginService.selectAllPermission();
			List<Permission> userPer = adminLoginService.selectRolePermission(adminSelect.get(0).getRoleId());
			request.getSession().setAttribute("allPer", allPer);
			request.getSession().setAttribute("userPer", userPer);
			return "redirect:adminGoMain";
		}
		request.setAttribute("msg","用户名或密码错误");
		return "admin/adminLogin";
	}
	
	//登录Main
	@RequestMapping("adminGoMain")
	public String adminLogin(HttpServletRequest request){
		List<Type> typeList = typeService.getall();
		request.setAttribute("adminMenu",adminLoginService.selectAllAdminMenu());
		request.setAttribute("adminMenuChild",adminLoginService.selectAllAdminMenuChild());
		request.getSession().setAttribute("type",typeList);
		return "admin/adminMain";
	}
	
	//退出
	@RequestMapping("adminMainToLoginOut")
	@ResponseBody
	public String adminMainToLoginOut(HttpServletRequest request){
		request.getSession().removeAttribute("adminName");
		return ResponseUtil.successToClient();
	}
}

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beyondwild

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值