Java-springboot生鲜电商项目(二)用户模块

基于Java+SpringBoot+Vue前后端分离电商项目【小米商城】 基于Java+SpringBoot+Vue前后端分离电商项目 阅读详情

Java-springboot生鲜电商项目(二)用户模块

用户模块开发

涉及到的接口

  1. 用户注册登录
  2. 更新个性签名
  3. 退出登录
  4. 管理员登录

开发涉及到内容:

  1. 登录、注册
  2. 重名校验
  3. 密码加密存储
  4. session的使用
  5. 越权校验
  6. 统一响应
  7. 异常枚举
  8. Java异常体系
  9. postman实操
  10. 统一异常处理
  11. 更新个人信息

(一)用户注册

用户注册的开发思路:
  1. 在dao层创建用户注册需要对数据库操作的相关接口
  2. 在对应的mapper.xml下书写SQL语句
  3. 在service层创建业务相关的接口,并在Impl中对接口进行实现,书写主要的业务逻辑
  4. 在controller中定义好用户注册请求响应,相关参数,对前端的参数进行过滤,之后调用service接口实现前端的数据传输到数据库
  5. 在1到4步骤中,对于异常,工具等,进行重构统一处理,提高程序的健壮性
根据文档,创建common包下ApiResponse类来处理响应对象
#响应文档1
{
    "status": 10000,
    "msg": "SUCCESS",
    "data": null
}
#响应文档2
{
    "status": 10000,
    "msg": "SUCCESS",
    "data": {
        "id": 9,
        "username": "xiaomu2",
        "password": null,
        "personalizedSignature": "祝你今天好心情",
        "role": 2,
        "createTime": "2020-02-09T12:39:47.000+0000",
        "updateTime": "2020-02-10T16:56:02.000+0000"
    }
}
package com.hyb.mall.common;

import com.hyb.mall.exception.MallExceptionEnum;

public class ApiRestResponse<T> {
    private Integer status;
    private String msg;
    private T data;

    private static final int OK_CODE = 10000;
    private static final String OK_MSG = "SUCCESS";

    public ApiRestResponse(Integer status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public ApiRestResponse(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public ApiRestResponse() {
        this(OK_CODE, OK_MSG);
    }

    //成功的时候调用的方法
    public static <T> ApiRestResponse<T> success() {
        return new ApiRestResponse<>();
    }

    //返回具有data的方法
    public static <T> ApiRestResponse<T> success(T result) {
        ApiRestResponse<T> response = new ApiRestResponse<>();
        response.setData(result);
        return response;
    }

    //失败时的方法
    public static <T> ApiRestResponse<T> error(Integer code, String msg) {
        return new ApiRestResponse<>(code, msg);
    }

    //失败时的方法
    public static <T> ApiRestResponse<T> error(MallExceptionEnum ex) {
        return new ApiRestResponse<>(ex.getCode(),ex.getMsg());
    }

    @Override
    public String toString() {
        return "ApiRestResponse{" +
                "status=" + status +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static int getOkCode() {
        return OK_CODE;
    }

    public static String getOkMsg() {
        return OK_MSG;
    }
}


定义controller返回的异常枚举
package com.hyb.mall.exception;

/**
 * 定义异常枚举
 */
public enum MallExceptionEnum {
    //业务异常 10000
    NEED_USER_NAME(10001,"用户名不能为空"),
    NEED_PASSWORD(10002,"密码不能为空"),
    PASSWORD_TO_SHORT(10003,"密码长度不小于8位"),
    NAME_EXISTED(10004,"不予许重名"),
    INSERT_FAILED(10005,"插入失败,请重试"),
    WRONG_PASSWORD(10006,"密码错误"),
    NEED_LOGIN(10007,"用户未登录"),
    UPDATE_FAILED(10008,"更新失败"),
    NEED_ADMIN(10009,"无管理员权限"),

    //系统异常 20000
    SYSTEM_ERROR(20000,"系统异常");
    /**
     * 异常码 code
     * 异常信息 msg
     */
    Integer code;
    String msg;

    MallExceptionEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}

在exception包中定义统一异常处理
package com.hyb.mall.exception;

/**
 * 描述:统一异常
 */
public class MallException extends RuntimeException{
    /**
     * 异常码 code
     * 异常信息 msg
     */
    private final Integer code;
    private final String message;

    public MallException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    public MallException(MallExceptionEnum exceptionEnum){
        this(exceptionEnum.getCode(),exceptionEnum.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
1.在dao层先定义查询用户的接口,并且返回User查询对象
User selectByName(String userName);
2.在UserMapper映射中添加SQL查询语句
  <select id="selectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from imooc_mall_user
    where username = #{userName,jdbcType=VARCHAR}
  </select>
3.在UserService定义用户注册接口,并在Service实现接口
//用户注册
    void register(String userName,String password);
    public void register(String userName, String password) throws MallException {
        //1.查询用户名是否存在,不允许重名
        User result = userMapper.selectByName(userName);
        if (result != null) {
            throw new MallException(MallExceptionEnum.NAME_EXISTED);
        }
        //2.将用户名和密码写入数据库
        User user = new User();
        user.setUsername(userName);
        user.setPassword(password);
        int count = userMapper.insertSelective(user);
        if (count == 0) {
            throw new MallException(MallExceptionEnum.INSERT_FAILED);
        }
    }
4.在controller实现调用
      @PostMapping("/register")
    @ResponseBody
    public ApiRestResponse register(@RequestParam("userName") String userName, @RequestParam("password") String password) throws MallException {
        //1.校验:判断用户名是否为空
        if (StringUtils.isEmpty(userName)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_USER_NAME);
        }
        //2.校验:判断密码是否为空
        if (StringUtils.isEmpty(password)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_PASSWORD);
        }
        //3.密码长度不少于8位
        if (password.length() < 8) {
            return ApiRestResponse.error(MallExceptionEnum.PASSWORD_TO_SHORT);
        }
        //4.调用useService的注册方法,将用户名和密码写入数据库
        userService.register(userName, password);

        //5.写入成功后返回成功
        return ApiRestResponse.success();
    }
5.使用postman进行测试,效果如下:

在这里插入图片描述

在插入成功后,我将用户名,密码为空,密码小于8位在进行测试,结果成功返回预期效果。但是在测试完后,有一些错误的信息暴露出来,所以错误的处理还需要进行重构!!!

package com.hyb.mall.exception;

import com.hyb.mall.common.ApiRestResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 1. 描述:处理统一异常的handler
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    private final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Object handleException(Exception e) {
        log.error("Default Exception: ", e);
        return ApiRestResponse.error(MallExceptionEnum.SYSTEM_ERROR);
    }

    @ExceptionHandler(MallException.class)
    @ResponseBody
    public Object handleImoocMallException(MallException e) {
        log.error("MallException: ", e);
        return ApiRestResponse.error(e.getCode(), e.getMessage());
    }
}

实现密码加密

  1. 在common下创建一个加盐常量的工具包,避免MD5加密被反破解
  2. 在util下创建MD5加密的工具类,对password进行加密处理
  3. 在注册接口的实现类中,用MD5加密的方法代替原来直接输入密码在数据库的操作
在common下Constant,用于加盐
package com.hyb.mall.common;
/**
 * 描述:常量
 */
public class Constant {
    //自定义常量,越复杂越好,和MD5混合使用,避免MD5反破解
    public static final String SALT = "82ps[d]][sffs.a";
    public static final String HYB_MALL_USER = "hyb_mall_user";
}

创建工具包Util,创建MD5Utils
package com.hyb.mall.util;

import com.hyb.mall.common.Constant;
import org.apache.tomcat.util.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * 描述:MD5加密工具
 */
public class MD5Utils {
    public static String getMD5Str(String strValue) throws NoSuchAlgorithmException {
        //传入算法MD5
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        //传入的参数还需要进行base64的转码,方便存储
        return Base64.encodeBase64String(md5.digest((strValue + Constant.SALT).getBytes()));
    }

    public static void main(String[] args) throws NoSuchAlgorithmException {
    	//加密后的密码:q+z/brWEdxFpbgLJ2MTXng==
        String md5 = getMD5Str("1234");
        System.out.println(md5);
    }
}

在UserServiceImpl中替换原来password的存储密码方法,使用MD5进行密码存储
    @Override
    public void register(String userName, String password) throws MallException {
        //1.查询用户名是否存在,不允许重名
        User result = userMapper.selectByName(userName);
        if (result != null) {
            throw new MallException(MallExceptionEnum.NAME_EXISTED);
        }
        //2.将用户名和密码写入数据库
        User user = new User();
        user.setUsername(userName);
        //使用MD5加密对密码进行加密处理
        try {
            user.setPassword(MD5Utils.getMD5Str(password));
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        //直接输入密码不进行处理,存在安全隐患
//        user.setPassword(password);
        int count = userMapper.insertSelective(user);
        if (count == 0) {
            throw new MallException(MallExceptionEnum.INSERT_FAILED);
        }
    }

(二)用户登录

1. 在dao中UserMapper中添加查询数据库用户接口
//传入多个参数,需要用@Param
User selectLogin(@Param("userName") String userName,@Param("password") String password);
2. 在resources/mappers中UserMapper.xml中查询语句
  <select id="selectLogin" parameterType="map" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from imooc_mall_user
    where username = #{userName,jdbcType=VARCHAR}
    and password = #{password}
  </select>
3. 在service中添加用户登录的业务接口
    //用户登录
    User login(String userName, String password) throws MallException;
4. 在service/Impl中实现用户登录的业务接口类,获取用户名,加密后的密码进行登录校验
    @Override
    public User login(String userName,String password) throws MallException {
        String md5Password = null;
        try {
            md5Password = MD5Utils.getMD5Str(password);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        User user = userMapper.selectLogin(userName,md5Password);
        if(user == null){
            throw new MallException(MallExceptionEnum.WRONG_PASSWORD);
        }
        return user;
    }
5. 在controller中主要是实现用户的登录,并将用户信息保存在session中。
    @PostMapping("/login")
    @ResponseBody
    public ApiRestResponse login(@RequestParam("userName") String userName,
                                 @RequestParam("password") String password,
                                 HttpSession session) throws MallException {
        //1.校验:判断用户名是否为空
        if (StringUtils.isEmpty(userName)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_USER_NAME);
        }
        //2.校验:判断密码是否为空
        if (StringUtils.isEmpty(password)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_PASSWORD);
        }
        User user = userService.login(userName, password);
        //为了安全,保存用户信息时,不将密码进行保存,返回null
        user.setPassword(null);
        //将用户信息存在session中
        session.setAttribute(Constant.HYB_MALL_USER,user);
        return ApiRestResponse.success(user);
    }

(三)更新用户个性签名

1.先在userService中创建相关接口
    //更新签名
    void updateInformation(User user) throws MallException;
2.实现个性签名中的接口
@Override
    public void updateInformation(User user) throws MallException {
        //更新个性签名
        int updateCount = userMapper.updateByPrimaryKeySelective(user);
        if (updateCount>1){
            throw new MallException(MallExceptionEnum.UPDATE_FAILED);
        }
    }
3.在controller中获取到了登录后的session信息,利用session去更新用户的个性签名。
//验证session是否进行存储
    @PostMapping("/user/update")
    @ResponseBody
    public ApiRestResponse updateUserInfo(HttpSession session,@RequestParam String signature) throws MallException {
        User currentUser = (User) session.getAttribute(Constant.HYB_MALL_USER);
        if(currentUser == null){
            return ApiRestResponse.error(MallExceptionEnum.NEED_LOGIN);
        }
        User user = new User();
        user.setId(currentUser.getId());
        user.setPersonalizedSignature(signature);
        userService.updateInformation(user);
        return ApiRestResponse.success();
    }

(四)退出用户登录

直接将用户信息从session中清除掉,以此来完成登出功能
    @PostMapping("/user/logout")
    @ResponseBody
    public ApiRestResponse logout(HttpSession session){
        session.removeAttribute(Constant.HYB_MALL_USER);
        return ApiRestResponse.success();
    }

(五)管理员登录

1.在service中定义管理员校验接口
    //校验是否管理员
    boolean checkAdminRole(User user);
2.在service/Impl实现类中判断用户是普通用户(1)还是管理员(2)
    @Override
    public boolean checkAdminRole(User user){
        //1是普通用户 2是管理员
        return user.getRole().equals(2);
    }
3.在controller中进行管理员的登录校验,与之前普通用户的登录差不多,只是需要判断登录的用户的身份是否是管理员
    @PostMapping("/adminlogin")
    @ResponseBody
    public ApiRestResponse adminlogin(@RequestParam("userName") String userName,
                                 @RequestParam("password") String password,
                                 HttpSession session) throws MallException {
        //1.校验:判断用户名是否为空
        if (StringUtils.isEmpty(userName)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_USER_NAME);
        }
        //2.校验:判断密码是否为空
        if (StringUtils.isEmpty(password)) {
            return ApiRestResponse.error(MallExceptionEnum.NEED_PASSWORD);
        }
        User user = userService.login(userName, password);
        //判断登录的用户的身份是否是管理员
        if (userService.checkAdminRole(user)) {
            //为了安全,保存用户信息时,不将密码进行保存,返回null
            user.setPassword(null);
            //将用户信息存在session中
            session.setAttribute(Constant.HYB_MALL_USER, user);
            return ApiRestResponse.success(user);
        }else {
            return ApiRestResponse.error(MallExceptionEnum.NEED_ADMIN);
        }

(六)使用postman进行接口校验

校验步骤:
  1. 先进行更新个性签名的更新,判断是否session能正常工作(更新结果失败,无登录结果)
  2. 进行用户注册,再次进行个性签名更新(更新结果还是失败,同样是无登录)
  3. 用户登录后,检查数据库是否存在和密码是否加密(校验成功)
  4. 再次进行个性签名更新(更新成功)
  5. 登出用户,清除session(登出成功)
  6. 修改数据库用户身份,将普通用户修改成管理员用户,再次进行管理员登录校验(管理员登录成功)
流程如下图所示:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

DailyFresh:DailyFresh (天天生鲜) - Java SSM 框架实现 DailyFresh(天天生鲜) 天天生鲜是Python中Django框架的一个经典案例,现将其用java的SSM框架实现 版本信息 v1.1 完成注册功能 实现功能: 用户注册:前台校验,成功后发送ajax请求,控制器响应并向数据库表中添加数据 用户激活:通过产生唯一激活码查询用户并修改用户激活状态 暂时发现的问题: 密码明文存储 邮件功能未完成 异常信息输出在页面上,给人不好的体验 用户名和密码存储出现错误(Controller中的json解析出现问题),存储到数据库的格式为'"DATA"',导致查询出现问题 v1.2 完成登录功能 实现功能: 用户登录:通过用户名和密码查询用户并判断用户是否激活,登录成功后将用户存储在session中 退出登录:将存储在session中的用户信息清除 记住用户名:判断用户是否勾选记住用户名,将信息存在cookie中 主页顶部显示用户欢迎信息:通过判断 立即下载

相关推荐

天天生鲜_java项目.zip

java实训中写的天天生鲜系统,实现了商品的购买和查询,订单的自动生成和查询等功能。需要的可以私信我哟!

springboot 学习小记 3:设计用户登录模块,注册新用户

springboot 学习小记 3:设计用户登录模块,注册新用户

weixin_57169969的博客 806

天天生鲜项目.zip

天天生鲜项目,内附源码

基于SpringBoot+SSM电商后台实战开发(附源码)

课程简介:本项目实战课程,从基础的项目需求,到项目模块编码,均采用实战教学。目标是让学员学习项目开发的基础流程,学习市面上主流框架SpringBoot、SpringMvc、Spring、MyBatis等实战开发核心技术点。熟悉企业级项目管理与构建,提升学员代码编码能力和实战项目编码经验。养成规范化、标准化的代码编写习惯和良好的技术文档习惯。相信通过整个项目的学习和编码,学习Java项目开发中的难点技术,深刻理解Java编程中的技术原理,以帮助学员走向高手之路。 项目技术栈: - 采用SpringBoot简化商城系统的初始搭建以及开发过程- 开发环境采用Maven实施多模块项目构建,采用Git进行项目版本管理;- 采用SpringMVC+Spring+IBatis完成项目的整合- 采用Mysql作为数据库存储,druid配置数据库连接池- 采用FastDFS文件储存系统文件存储,完成广告图片、商品图片的上传和存储- 使用ECharts根据后台查询数据生成图表- 使用POI实现了商城盈利状况的Excel表格导出。- 商品的详情页使用Thymeleaf完成页面静态化,减少页面数据展示延迟- 项目中使用SpringBoot下的Aop + 自定义注解完成用户行为记录,日志采集- 后台管理系统使用Shiro实现登录验证和权限管理(超级管理员、管理员、产品编辑员) 项目部分截图:            

生鲜超市管理系统(JAVA+GUI+MYSQL).zip

生鲜超市管理系统(JAVA+GUI+MYSQL);包含管理员,客户,生鲜商品(增删改查),优惠券,客户评价,订单等等

java大牛手把手开发SSM企业级电商项目教程

完整的13章企业级电商教程,涉及ssm技术,包含购物车模块,支付宝支付模块,订单管理模块的开发

Java-springboot生鲜电商项目(四)商品模块

Java-springboot生鲜电商项目(四)商品模块商品模块这个模块的难点常见错误(一)后台的新增商品在request创建AddProduct类,目的是为了修改product不会污染pojo下的product类在productMapper创建查询商品名的接口,用于之后的重名判断在productMapper.xml编写SQL语句在productServiceImpl实现商品插入的业务逻辑写到这里,会出现一个问题,就是图片上传问题,处理步骤如下:UUID在Constant常量类中编写图片文件保存的地址并在类

bingbign0607的博客 2277

在 Dify 平台部署一个 知识库问答(KBQA) 工作流

加强检索约束,Prompt 加限制(“仅基于知识库回答”):启用缓存,使用轻量级 LLM(如 Mistral-7B)(OpenAI Embedding、M3E、BGE等)(支持 PDF/TXT/Markdown/Word)(GPU/CPU 资源,用于向量数据库和模型推理)企业内部文档(PDF/Word/Excel)网页爬取数据(Markdown/HTML)分块大小(太小→信息碎片化,太大→噪声多)相似度阈值(太高→漏检,太低→噪声多)(是否返回正确文档)结构化数据(数据库/API)

井底小蛙的博客 1520

慕课网--网上商城mmall项目---部署手记

1.先在服务器部署好java,maven,nodejs环境。 2.然后安装nginx,tomcat,vsftp,git(一般默认会有)等软件, 其中vsftp安装过程参照我上一篇文章。 3.

qq_23947467的博客 869

思科路由器重分发(静态路由+OSPF动态路由+RIP动态路由)

思科路由器重分发(静态路由+OSPF动态路由+RIP动态路由)

2301_81256766的博客 1257

【3D目标检测】激光雷达和相机联合标定(一)——ROS同步解包

激光雷达和相机联合标定(一)——ROS同步解包

qq_44703886的博客 4233

Java-springboot生鲜电商项目(五)购物车模块

Java-springboot生鲜电商项目(五)购物车模块购物车功能业务流程(一)购物车列表daomapperservice(二)添加商品到购物车对用户的过滤器开发:因为购物车的功能是用户的行为操作,所以在添加商品到购物车的时候,先判断是否是用户,可以借鉴管理员过滤器的开发filter包中创建UserFilter对过滤器进行config配置coding到这里,我发现有个小小的笔误,我在controller中@PostMapping("")注解中,映射的地址开头有些有“/”有些没有,然后我进行统一处理,全加上

bingbign0607的博客 3588

【RViz2】导入urdf模型时报错:Could not load resource xxx,Unable to open file xxx,Error retrieving file xxx

初学ROS2,想要在RViz2中显示urdf模型。其中.urdf文件引用了外部的meshes文件夹。

qq_43557907的博客 9487

Java-springboot生鲜电商项目(六)订单模块

Java-springboot生鲜电商项目(六)订单模块(爆炸难)订单开发思路重难点(一)创建订单新建一个创建订单的请求类添加异常在Constant添加在service添加创建订单方法controller实现在postman进行测试(二)订单详情定义异常先在dao创建接口orderMpperMapper先在dao创建接口orderMpperMapperservice,主要还是在拼接信息上controller(三)订单列表daomapperservicecontrollerpostman测试(四)取消订单添加

bingbign0607的博客 2895

Matlab2024a安装教程

点击【下一步】。8.选择解压后的【MATLAB R2024a(64bit)】文件夹中【Crack】文件夹下的【licese.lic】,点击【打开】。

qq_64359046的博客 4803

车规级非易失存储选型指南:从AEC-Q100到ISO 26262的可靠性设计

非易失存储器是电子系统中负责长期保存关键数据与代码的核心组件,其可靠性直接决定了系统的长期稳定运行能力。在汽车电子领域,这一要求被提升到了极致,必须满足严苛的车规级标准。从原理上看,存储器的数据保持能力、擦写寿命等关键参数在高温、振动等恶劣环境下会急剧衰减,因此需要专门的设计与验证。其技术价值在于保障车辆全生命周期的功能安全与数据完整性,避免因存储失效导致的安全隐患或频繁维护。应用场景涵盖从发动机控制单元、自动驾驶域控制器到智能座舱的各类电子控制单元。本文聚焦于车规级非易失存储的选型,深入解析AEC-Q10

weixin_30938149的博客 457

Java-springboot生鲜电商项目(零)开发前言

springboot生鲜电商项目项目亮点1.最新的业界互联网企业级的优质技术。2.代码规范简介,充分优化。3.流程完整,电商功能丰富。4.前后端彻底分离,符合未来趋势。项目功能模块介绍前台模块:后台模块:工具准备:技术选型: 前言:开发的是一款基于springboot为主的销售生鲜网站,该网站主要是涉及到前端展示和后端管理的开发,开发的目的是为了将Java的所学做一次系统的汇总,并将技术落地到实际的项目开发中,从零到一的打造一个属于自己的优质网站。 该博客将会分模块的进行知识梳理,开发流程进行梳理,尽量将思

bingbign0607的博客 1857

[yolov5/yolov8修改]替换yolov5/yolov8中的主干网络为EfficientNetv2

针对yolov5和yolov8的主干网络进行替换。

PLH19990227的博客 4146

Java-springboot生鲜电商项目(三)商品分类模块

Java-springboot生鲜电商项目(二)商品分类模块主要功能主要会使用的新技术有:(一)开发添加商品分类目录的接口1.在MallExceptionEnum加入处理异常的相关代码2.在dao层CategoryMapper中添加通过商品类目名查询的接口3.在categoryMapper.xml中添加SQL语句4.另外添加目录请求类,不用pojo中Category,是因为保持每个类都有自己的职责,也是保证程序的安全性5.在Service下创建目录分类的Service接口,并创建CategoryImpl实现

bingbign0607的博客 4443

微信小程序:errno: 600001, errMsg: “uploadFile:fail errcode:-101 cronet_error_code:-10001 error_msg:net::E

微信小程序报错uploadFile:fail errcode:-101 cronet_error_code:-10001 error_msg:net::ERR_CONNECTION_RESET, custum ip is invalid, didn't find user's ip,wx.uploadFile errno: 600001 errcode:-101 ?微信小程序wx.uploadFile错误,wx.uploadFile 在真机上报下面的错误,调试工具里没有问题,其它接口在真机/调试工具都正常,

✅ 精选推荐文章 4257

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

java-springboot基于Java的网上生鲜超市 基于SpringBoot的Java生鲜电商购物平台 B/S架构下Java农产品在线订购配送系统计算机毕业设计

本文介绍了一个基于Java SpringBoot框架开发的网上生鲜超市系统。该系统采用B/S架构,整合了用户管理、商品展示、购物车、订单处理、支付结算、物流跟踪等核心功能模块,实现了从商品上架到配送评价的完整生鲜电商流程。系统使用MySQL数据库存储数据,通过SpringBoot+MyBatis技术栈实现前后端分离开发,具有用户注册登录、商品分类管理、库存预警、销售统计等特色功能。论文详细分析了系统的可行性、需求规格、技术架构和数据库设计,并展示了主要功能界面截图。该系统旨在解决传统生鲜购买中的时效性、新鲜

毕设源码_谢师姐 1775

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

计算机毕业设计springboot的小岛生鲜网站 鲜果生鲜电商平台开发 生鲜食品在线销售系统

小岛生鲜网站通过Spring Boot框架构建了一个高效、便捷的生鲜电商平台。它不仅涵盖了用户从浏览商品到下单支付的全流程,还通过后台管理功能为运营者提供了强大的支持。系统的设计充分考虑了用户体验和运营效率,无论是前端的交互设计还是后端的管理功能,都旨在提升生鲜电商的运营质量,满足消费者对新鲜、健康、便捷的生鲜产品的需求。注:完成的毕业设计程序以下面的的环境软件、功能图和界面为准。系统所需要的环境软件:idea、eclipse+mysql5.7、8.0+Navicat+JDK1.8+tomcat7.0。

Django计算机程序 1008

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

2025毕设springboot 基于协同算法的社区生鲜电商平台论文+源码

随着居民生活水平的提高和消费观念的转变,社区生鲜电商作为一种新兴的零售模式,以其便捷性、新鲜度和个性化服务等特点,受到了广大消费者的青睐。因此,本选题将以社区生鲜电商平台为研究情景,重点分析和研究其运营模式、供应链管理、用户体验优化等问题,以期探寻社区生鲜电商平台发展的关键要素和成功路径,为后续更加深入的研究提供基础。现实实践意义在于,研究社区生鲜电商平台的发展规律和成功经验,可以为电商平台运营商提供有益的参考和借鉴,帮助其优化运营策略、提升服务质量,从而更好地满足消费者的需求,促进电商行业的健康发展。

Python程序源码老哥 872

计算机毕业设计springboot基于Java的网上生鲜超市 基于SpringBoot的社区生鲜电商订购平台设计与实现 融合SpringBoot的产地直供冷链商城系统开发

本文介绍了一个基于SpringBoot的网上生鲜超市系统设计,采用Java+Vue+MySQL技术栈实现B/S架构。系统包含用户端、卖家端和管理员端三大模块:用户可浏览商品、下单购买;卖家可管理商品和订单;管理员负责用户权限和系统维护。通过数字化管理生鲜供应链,实现从采摘到配送的全流程追踪,解决传统生鲜销售信息不对称问题。系统具有完整的电商功能,包括商品管理、订单处理、支付系统等,并支持多平台访问。开发环境为IDEA/Eclipse+MySQL+JDK1.8+Tomcat7.0,系统界面简洁,操作便捷,旨在

毕设源码_谢师姐 1276

Java项目:156SpringBoot Vue的生鲜商城系统

基于SpringBoot Vue的生鲜交易系统 角色:管理员、用户、商家 用户:用户系统,在系统首页可以查看首页,生鲜信息,公告信息,个人中心,后台管理,购物车等内容 商家:商家登录系统后,可以对首页,个人中心,生鲜信息管理,广告信息管理,生鲜仓库管理,生鲜出库管理,订单管理等 管理员:管理员登录进入系统可以对首页,个人中心,用户管理,商家管理,生鲜信息管理,生鲜分类管理,广告信息管理,生鲜仓库管理,生鲜出库管理,系统管理等进行相应操作 使用人群: 正在做毕设的学生,或者需要项目实战练习的Java

1287
上一篇: Java-springboot生鲜电商项目(一)数据设计与项目初始化
下一篇: Java-springboot生鲜电商项目(三)商品分类模块
bingbing0607
博客等级 码龄9年 74粉丝 26原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值