基于javaweb+mysql的ssm游戏装备系统(java+ssm+jsp+bootstrap+mysql)

基于javaweb+mysql的ssm游戏装备系统(java+ssm+jsp+bootstrap+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的SSM游戏装备系统(java+ssm+jsp+bootstrap+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.是否Maven项目: 是; 6.数据库:MySql 5.7等版本均可;

技术栈

  1. 后端:Spring+springmvc+mybatis 2. 前端:JSP+CSS+JavaScript+jQuery+Bootstrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ssm_hzp_site/ 登录 注:Tomcat中配置项目路径必须为ssm_hzp_site 用户账号/密码: user/123456 管理员账号/密码:admin/admin

login1.setPassword(passwords).setId(userIsExist.getId()).setMobilephone(null);

userInfo.setMobilephone(mobilephone).setPassword(passwords).setUserid(userIsExist.getUserid());

Integer integer = loginService.updateLogin(login1);

Integer integer1 = userInfoService.UpdateUserInfo(userInfo);

if (integer==1 && integer1==1){

return new ResultVo(true,StatusCode.OK,"重置密码成功");

return new ResultVo(false,StatusCode.ERROR,"重置密码失败");

return new ResultVo(false,StatusCode.ERROR,"验证码错误");

/**退出登陆*/

@GetMapping("/user/logout")

public String logout(HttpServletRequest request,HttpSession session){

String userid = (String)session.getAttribute("userid");

String username = (String)session.getAttribute("username");


@PutMapping("/admin/changecommstatus/{commid}/{commstatus}")

public ResultVo ChangeCommstatus(@PathVariable("commid") String commid, @PathVariable("commstatus") Integer commstatus) {

Integer i = commodityService.ChangeCommstatus(commid, commstatus);

if (i == 1){

/**发出商品审核结果的系统通知*/

Commodity commodity = commodityService.LookCommodity(new Commodity().setCommid(commid));

if (commstatus == 0){

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(commodity.getUserid()).setTpname("商品审核")

.setWhys("您的商品 <a href=/product-detail/"+commodity.getCommid()+" style=\"color:#08bf91\" target=\"_blank\" >"+commodity.getCommname()+"</a> 未通过审核,目前不支持公开发布。");

noticesService.insertNotices(notices);


if (i == 1){

userRoleService.UpdateUserRole(new UserRole().setUserid(userid).setRoleid(1).setIdentity("网站用户"));

/**发出设置为网站用户的系统通知*/

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")

.setWhys("您已被设置为网站用户,希望您再接再厉。");

noticesService.insertNotices(notices);

return new ResultVo(true, StatusCode.OK, "设置成员成功");

return new ResultVo(true, StatusCode.ERROR, "设置成员失败");

return new ResultVo(false,StatusCode.ACCESSERROR,"违规操作");

/**

* 将用户封号或解封(userstatus)
return new ResultVo(true, StatusCode.ERROR, "封号失败");

}else if (userstatus == 1){

Integer i = loginService.updateLogin(new Login().setUserid(userid).setUserstatus(userstatus));

Integer j = userInfoService.UpdateUserInfo(new UserInfo().setUserid(userid).setUserstatus(userstatus));

if (i ==1 && j == 1){

/**发出解封的系统通知*/

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")

.setWhys("您在该网站的账号已被解封,希望您保持良好的行为。");

noticesService.insertNotices(notices);

return new ResultVo(true, StatusCode.OK, "解封成功");

return new ResultVo(true, StatusCode.ERROR, "解封失败");

return new ResultVo(false,StatusCode.ACCESSERROR,"违规操作");

/**

* 管理员商品列表

* 分页查询不同角色用户信息

* roleid:1普通成员 2管理员

* userstatus:1正常 0封号

*/

@GetMapping("/admin/userlist/{roleid}/{userstatus}")

@ResponseBody

public LayuiPageVo userlist(int limit, int page,@PathVariable("roleid") Integer roleid,@PathVariable("userstatus") Integer userstatus) {

List<UserInfo> userInfoList = userInfoService.queryAllUserInfo((page - 1) * limit, limit,roleid,userstatus);

Integer dataNumber = userInfoService.queryAllUserCount(roleid);

return new LayuiPageVo("",0,dataNumber,userInfoList);

/**


return new ResultVo(false,StatusCode.ERROR,"请输入正确格式的手机号");

return new ResultVo(false,StatusCode.REMOTEERROR,"验证码发送失败");

/**重置密码

* 1.判断手机号格式是否正确

* 2.查询手机号是否存在

* 3.判断验证码是否有效或正确

* 4.重置密码

* */

@ResponseBody

@PostMapping("/user/resetpwd")

public  ResultVo resetpwd(@RequestBody Login login) {

String mobilephone=login.getMobilephone();


if (i ==1 && j == 1){

/**发出解封的系统通知*/

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")

.setWhys("您在该网站的账号已被解封,希望您保持良好的行为。");

noticesService.insertNotices(notices);

return new ResultVo(true, StatusCode.OK, "解封成功");

return new ResultVo(true, StatusCode.ERROR, "解封失败");

return new ResultVo(false,StatusCode.ACCESSERROR,"违规操作");

/**

* 管理员商品列表

* */

@GetMapping("/admin/product")
/**发出设置为网站用户的系统通知*/

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")

.setWhys("您已被设置为网站用户,希望您再接再厉。");

noticesService.insertNotices(notices);

return new ResultVo(true, StatusCode.OK, "设置成员成功");

return new ResultVo(true, StatusCode.ERROR, "设置成员失败");

return new ResultVo(false,StatusCode.ACCESSERROR,"违规操作");

/**

* 将用户封号或解封(userstatus)

* 0:封号  1:解封

*/


private static Map<String, String> phonecodemap1 = new HashMap<>();

/**手机号和重置密码验证码map集合*/

private static Map<String, String> phonecodemap2 = new HashMap<>();

/**

*图片验证码

* */

@RequestMapping(value = "/images", method = {RequestMethod.GET, RequestMethod.POST})

public void images(HttpServletResponse response) throws IOException {

response.setContentType("image/jpeg");

//禁止图像缓存。

response.setHeader("Pragma", "no-cache");

* 0:封号  1:解封

*/

@PutMapping("/admin/user/forbid/{userid}/{userstatus}")

@ResponseBody

public ResultVo adminuserlist(@PathVariable("userid") String userid,@PathVariable("userstatus") Integer userstatus) {

if (userstatus == 0){

Integer i = loginService.updateLogin(new Login().setUserid(userid).setUserstatus(userstatus));

Integer j = userInfoService.UpdateUserInfo(new UserInfo().setUserid(userid).setUserstatus(userstatus));

if (i ==1 && j == 1){

/**发出封号的系统通知*/

Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")


* 2.判断输入旧密码和系统旧密码是否相等

* 4.修改密码

*/

@ResponseBody

@PutMapping("/user/updatepwd")

public ResultVo updatepwd(HttpSession session, HttpServletRequest request) throws IOException {

JSONObject json = JsonReader.receivePost(request);

String oldpwd = json.getString("oldpwd");

String newpwd = json.getString("newpwd");

String userid = (String) session.getAttribute("userid");

Login login = new Login();


public void run() {

phonecodemap2.remove(phoneNum);

timer.cancel();

}, 5 * 60 * 1000);

*/

//执行定时任务

ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,

new BasicThreadFactory.Builder().namingPattern("example-schedule-pool-%d").daemon(true).build());

executorService.scheduleAtFixedRate(new Runnable() {

@Override

public void run() {

phonecodemap.remove(mobilephone);

((ScheduledThreadPoolExecutor) executorService).remove(this::run);


return new ResultVo(true, StatusCode.OK, "查询头像成功",userInfo);

/**

* 修改头像

* */

@PostMapping(value = "/user/updateuimg")

@ResponseBody

public JSONObject updateuimg(@RequestParam(value = "file", required = false) MultipartFile file, HttpSession session) throws IOException {

JSONObject res = new JSONObject();

JSONObject resUrl = new JSONObject();

String filename = UUID.randomUUID().toString().replaceAll("-", "");

String ext = FilenameUtils.getExtension(file.getOriginalFilename());//获得文件扩展名

String filenames = filename + "." + ext;//文件全名


return "/user/userinfo";

/**

* 跳转到完善个人信息

*/

@GetMapping("/user/perfectinfo")

public String perfectInfo(HttpSession session, ModelMap modelMap) {

String userid = (String) session.getAttribute("userid");

UserInfo userInfo = userInfoService.LookUserinfo(userid);

modelMap.put("perfectInfo",userInfo);

return "/user/perfectinfo";

/**

* 修改个人信息

* 1.前端传入用户昵称(username)、用户邮箱(email)、性别(sex)、游戏(server


System.out.println("测试是否进入!!!");

String account=login.getUsername();

String password=login.getPassword();

String vercode=login.getVercode();

UsernamePasswordToken token;

if(!ValidateCode.code.equalsIgnoreCase(vercode)){

return new ResultVo(false,StatusCode.ERROR,"请输入正确的验证码");

//判断输入的账号是否手机号

if (!JustPhone.justPhone(account)) {

//输入的是用户名

String username = account;

//盐加密


//盐加密

token=new UsernamePasswordToken(mobilephone, new Md5Hash(password,"Game-shops").toString());

System.out.println("2password :"+ token);

Subject subject= SecurityUtils.getSubject();

try {

subject.login(token);

//盐加密

String passwords = new Md5Hash(password, "Game-shops").toString();

System.out.println("3password :"+ passwords);

login.setPassword(passwords);


token=new UsernamePasswordToken(mobilephone, new Md5Hash(password,"Game-shops").toString());

Subject subject= SecurityUtils.getSubject();

try {

subject.login(token);

//盐加密

String passwords = new Md5Hash(password, "Game-shops").toString();

login.setPassword(passwords);

Login login1 = loginService.userLogin(login);

//查询登录者的权限

Integer roleId = userRoleService.LookUserRoleId(login1.getUserid());

if (roleId == 2 || roleId == 3){

session.setAttribute("admin",login1.getUsername());

String vercode = userInfo.getVercode();

Login login = new Login().setMobilephone(mobilephone);

//查询账号是否已经注册

Login userIsExist = loginService.userLogin(login);

if (!StringUtils.isEmpty(userIsExist)){//用户账号已经存在

return new ResultVo(false, StatusCode.ERROR,"该用户已经注册过了");

login.setUsername(username).setMobilephone(null);

Login userNameIsExist = loginService.userLogin(login);

if (!StringUtils.isEmpty(userNameIsExist)){//用户名已经存在

return new ResultVo(false, StatusCode.ERROR,"用户名已存在,请换一个吧");

String rel = phonecodemap1.get(mobilephone);

if (StringUtils.isEmpty(rel)) {//验证码到期 或者 没发送短信验证码

return new ResultVo(false,StatusCode.ERROR,"请重新获取验证码");

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值