首页 > 数据库 >免费分享一套Java协同过滤推荐算法的SpringBoot+Vue(图书)商城系统【论文+源码+SQL脚本】,帅呆了~~

免费分享一套Java协同过滤推荐算法的SpringBoot+Vue(图书)商城系统【论文+源码+SQL脚本】,帅呆了~~

时间:2024-08-26 11:51:56浏览次数:11  
标签:username Java SpringBoot com ruoyi 源码 import login loginForm

大家好,我是java1234_小锋老师,看到一个不错的Java协同过滤推荐算法的SpringBoot+Vue(图书)商城系统,分享下哈。

项目视频演示

【免费】Java协同过滤推荐算法的SpringBoot+Vue(图书)商城系统 Java毕业设计_哔哩哔哩_bilibili

项目介绍

伴随着Internet的蓬勃发展,电子商务也取得了突飞猛进的发展。电子商务是在互联网开放环境下,基于浏览器/服务器应用方式,实现消费者的网上购物、商户之间的网上交易和在线电子支付的一种新型的商业运作模式。不同领域的电子商务网站的建立,给人们的生活带来了巨大的影响。本论文就此网上书城系统进行了详细全面的论述。     

网上书城系统是一个B/S结构的信息管理系统,共分两个部分:前台用户部分和后台管理部份。在前台用户部分中,包括用户在线注册、用户在线登录、浏览商品、查询商品信息、购物车管理、订单查看、订购商品等操作;后台管理部分包括:客户的管理、商品种类的管理、商品信息的管理、商品的出入库管理、用户订单的管理。作为一个购物系统,系统的安全性和实现购物的方便性是很重要的,在安全性方面,系统主要考虑了数据存储的安全性,以及用了用户注册和密码等措施,如用户注册时,对用户密码试用BCrypt 算法来对密码实现加密和验证处理。由于 BCrypt本身是一种 单向Hash算法,因此它和我们日常用的 MD5一样,通常情况下是无法逆向解密的。另外,系统用到的主要技术有Vue、Mybatis、Mybatis-plus和Spring-boot,系统采用MySQL来设计数据库,使用Idea开发平台。  

本文主要介绍了Vue+Mybatis+Spring-boot+MySQL系统的一般原理;阐述了整个页面生成的结构及工作原理;分析了系统实现中的难点和重点;设计实现了用户注册/登录、查询、购买;实现了管理员对后台的系统管理;分析并解决了实现中的若干技术问题。

系统展示

部分代码

package com.ruoyi.web.controller.system;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * 登录验证
 *
 * @author ruoyi
 */
@RestController
public class SysLoginController {
    @Autowired
    private SysLoginService loginService;

    @Autowired
    private ISysMenuService menuService;

    @Autowired
    private SysPermissionService permissionService;

    /**
     * 登录方法
     *
     * @param loginBody 登录信息
     * @return 结果
     */
    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginBody loginBody) {
        AjaxResult ajax = AjaxResult.success();
        // 生成令牌
        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
                loginBody.getUuid());
        ajax.put(Constants.TOKEN, token);
        return ajax;
    }

    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @GetMapping("getInfo")
    public AjaxResult getInfo() {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        // 角色集合
        Set<String> roles = permissionService.getRolePermission(user);
        // 权限集合
        Set<String> permissions = permissionService.getMenuPermission(user);
        AjaxResult ajax = AjaxResult.success();
        ajax.put("user", user);
        ajax.put("roles", roles);
        ajax.put("permissions", permissions);
        return ajax;
    }

    /**
     * 获取路由信息
     *
     * @return 路由信息
     */
    @GetMapping("getRouters")
    public AjaxResult getRouters() {
        Long userId = SecurityUtils.getUserId();
        List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
        return AjaxResult.success(menuService.buildMenus(menus));
    }
}
<!-- 登录界面 -->
<template>
  <div class="login">
    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
      <h3 class="title">
        <img src="../assets/logo/head.png" style="width: 300px;" />
      </h3>
      <el-form-item prop="username">
        <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
          <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
        </el-input>
      </el-form-item>
      <el-form-item prop="password">
        <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
          @keyup.enter.native="handleLogin">
          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
        </el-input>
      </el-form-item>
      <el-form-item prop="code" v-if="captchaEnabled">
        <el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
          @keyup.enter.native="handleLogin">
          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
        </el-input>
        <div class="login-code">
          <img :src="codeUrl" @click="getCode" class="login-code-img" />
        </div>
      </el-form-item>
      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
      <el-form-item style="width:100%;">
        <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
          @click.native.prevent="handleLogin">
          <span v-if="!loading">登 录</span>
          <span v-else>登 录 中...</span>
        </el-button>
        <div style="float: right;" v-if="register">
          <router-link class="link-type" :to="'/register'">立即注册</router-link>
        </div>
     

      </el-form-item>
    </el-form>
    <!--  底部  -->
    <div class="el-login-footer">
      <span>Copyright © XXXX</span>
    </div>
  </div>
</template>

<script>
  import {
    getCodeImg
  } from "@/api/login";
  import Cookies from "js-cookie";
  import {
    encrypt,
    decrypt
  } from '@/utils/jsencrypt'

  export default {
    name: "Login",
    data() {
      return {
        codeUrl: "",
        loginForm: {
          username: "admin",
          password: "admin123",
          rememberMe: false,
          code: "",
          uuid: ""
        },
        loginRules: {
          username: [{
            required: true,
            trigger: "blur",
            message: "请输入您的账号"
          }],
          password: [{
            required: true,
            trigger: "blur",
            message: "请输入您的密码"
          }],
          code: [{
            required: true,
            trigger: "change",
            message: "请输入验证码"
          }]
        },
        loading: false,
        // 验证码开关
        captchaEnabled: true,
        // 注册开关
        register: true,
        redirect: undefined
      };
    },
    watch: {
      $route: {
        handler: function(route) {
          this.redirect = route.query && route.query.redirect;
        },
        immediate: true
      }
    },
    created() {
      this.getCode();
      this.getCookie();
    },
    methods: {
      getCode() {
        getCodeImg().then(res => {
          this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
          if (this.captchaEnabled) {
            this.codeUrl = "data:image/gif;base64," + res.img;
            this.loginForm.uuid = res.uuid;
          }
        });
      },
      getCookie() {
        const username = Cookies.get("username");
        const password = Cookies.get("password");
        const rememberMe = Cookies.get('rememberMe')
        this.loginForm = {
          username: username === undefined ? this.loginForm.username : username,
          password: password === undefined ? this.loginForm.password : decrypt(password),
          rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
        };
      },
      handleLogin() {

        this.$refs.loginForm.validate(valid => {
          if (valid) {
            this.loading = true;

            // //加载效果
            // const loading = this.$loading({
            //   lock: false,
            //   text: '登陆中...',
            //   spinner: 'el-icon-loading',
            //   background: 'rgba(0, 0, 0, 0.7)'
            // });
            // setTimeout(() => {
            //   loading.close();
            // }, 1500);

            if (this.loginForm.rememberMe) {
              Cookies.set("username", this.loginForm.username, {
                expires: 30
              });
              Cookies.set("password", encrypt(this.loginForm.password), {
                expires: 30
              });
              Cookies.set('rememberMe', this.loginForm.rememberMe, {
                expires: 30
              });
            } else {
              Cookies.remove("username");
              Cookies.remove("password");
              Cookies.remove('rememberMe');
            }
            this.$store.dispatch("Login", this.loginForm).then(() => {
              this.$router.push({
                path: this.redirect || "/"
              }).catch(() => {});
              setTimeout(() => {
                this.$message({
                  message: '恭喜你,登录成功',
                  type: 'success'
                });
                L
              }, 800);

            }).catch(() => {
              this.loading = false;
              if (this.captchaEnabled) {
                this.getCode();
              }
            });
          }
        });
      }
    }
  };
</script>

<style rel="stylesheet/scss" lang="scss">
  .login {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background-image: url("../assets/images/login-background.jpg");
    background-size: cover;
  }

  .title {
    margin: 0px auto 30px auto;
    text-align: center;
    color: #707070;
  }

  .login-form {
    border-radius: 6px;
    background: #ffffff;
    width: 400px;
    padding: 25px 25px 5px 25px;

    .el-input {
      height: 38px;

      input {
        height: 38px;
      }
    }

    .input-icon {
      height: 39px;
      width: 14px;
      margin-left: 2px;
    }
  }

  .login-tip {
    font-size: 13px;
    text-align: center;
    color: #bfbfbf;
  }

  .login-code {
    width: 33%;
    height: 38px;
    float: right;

    img {
      cursor: pointer;
      vertical-align: middle;
    }
  }

  .el-login-footer {
    height: 40px;
    line-height: 40px;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-family: Arial;
    font-size: 12px;
    letter-spacing: 1px;
  }

  .login-code-img {
    height: 38px;
  }
</style>

源码代码

链接:https://pan.baidu.com/s/1F23AlJIB0lVWa615x70brA 
提取码:1234

标签:username,Java,SpringBoot,com,ruoyi,源码,import,login,loginForm
From: https://blog.csdn.net/caoli201314/article/details/141557754

相关文章

  • Java 入门指南:异常处理的实践规范
    在Java中处理异常并不是一个简单的事情。需要花费很多时间来思考如何处理异常,包括需要处理哪些异常,怎样处理等等。抛出或捕获异常的时候,有很多不同的情况需要考虑,而且大部分事情都是为了改善代码的可读性或者API的可用性。异常不仅仅是一个错误控制机制,也是一个通信媒......
  • 短剧分销系统搭建教程,源码分享+部署上线指南
    一、短剧分销系统是什么?简单来说就是用来分销推广短剧的系统,系统对接他人短剧小程序片源,仅推广分销用户看剧充值在第三方小程序,佣金为第三方打款。短剧分销系统变现方式简述:付费观看:单剧付费或会员订阅,直接获取用户收入。分销佣金:推广者通过销售获得分成。打赏机制:用户打赏......
  • 源码搭建说明
    云分发系统安装说明【服务器以及环境】系统CentOS7以上然后安装宝塔JAVAPHP7.2Mysql5.6SSL证书JAVA安装说明打开宝塔终端,输入yuminstalljava-1.8.0-openjdk-devel.x86_64,中间如果有yn选项的话,选择y,意思就是继续,最后等待安装完成即可。本产品禁止用于含木马、病毒......
  • JAVA毕业设计|(免费)springboot基于JAVA的社团管理系统的包含文档代码讲解
    收藏点赞不迷路 关注作者有好处编号:springboot270springboot基于JAVA的社团管理系统的开发语言:Java数据库:MySQL技术:Spring+SpringMVC+MyBatis工具:IDEA/Ecilpse、Navicat、Maven1.系统展示2.万字文档展示第5章系统详细设计5.1学生信息管理如图5.1显示的就是学生......
  • 毕业设计|springboot基于JAVA的社团管理系统的|免费|代码讲解
    收藏点赞不迷路 关注作者有好处编号:springboot270springboot基于JAVA的社团管理系统的开发语言:Java数据库:MySQL技术:Spring+SpringMVC+MyBatis工具:IDEA/Ecilpse、Navicat、Maven1.系统展示2.万字文档展示第5章系统详细设计5.1学生信息管理如图5.1显示的就是学生......
  • 【免费】springboot共享汽车管理系统|毕业设计|Javaweb项目
    收藏点赞不迷路 关注作者有好处编号:springboot118springboot共享汽车管理系统开发语言:Java数据库:MySQL技术:Spring+SpringMVC+MyBatis工具:IDEA/Ecilpse、Navicat、Maven1.系统展示2.万字文档展示第5章系统详细设计5.1管理员模块的实现5.1.1用户信息管理共享......
  • 【免费】springboot汽车资讯网站|毕业设计|Javaweb项目
    收藏点赞不迷路 关注作者有好处编号:springboot125springboot汽车资讯网站开发语言:Java数据库:MySQL技术:Spring+SpringMVC+MyBatis工具:IDEA/Ecilpse、Navicat、Maven1.系统展示2.万字文档展示第5章系统详细设计5.1管理员模块的实现5.1.1用户信息管理汽车资讯......
  • JAVA毕业设计|(免费)springboot基于JAVA的社团管理系统的包含文档代码讲解
    收藏点赞不迷路 关注作者有好处编号:springboot270springboot基于JAVA的社团管理系统的开发语言:Java数据库:MySQL技术:Spring+SpringMVC+MyBatis工具:IDEA/Ecilpse、Navicat、Maven1.系统展示2.万字文档展示第5章系统详细设计5.1学生信息管理如图5.1显示的就是学生......
  • 堆排序算法及优化(java)
    目录1.1引言1.2堆排序的历史1.3堆排序的基本原理1.3.1堆的概念1.3.2堆排序的过程1.3.3堆调整1.3.4堆排序算法流程1.4堆排序的Java实现1.4.1简单实现1.4.2代码解释1.4.3优化实现1.4.4代码解释1.5堆排序的时间复杂度1.5.1分析1.5.2证明1.6堆排序......
  • 【java计算机毕设】车联网位置信息管理系统MySQL springcloud vue maven项目设计源码
    目录1项目功能2项目介绍3项目地址 1项目功能【java计算机毕设】车联网位置信息管理系统MySQLspringcloudvuemaven项目设计源码前后端可分离也可不分离 2项目介绍系统功能:车联网位置信息管理系统包括管理员、用户两种角色。管理员功能包括个人中心模块用......