Design and implementation of barber shop membership management system based on SSM+Vue

Get the source code at the end
Development language: Java
Java development tool: JDK1.8
Back-end framework: SSM
Front-end: developed using JSP technology
Database: MySQL5.7 combined with Navicat management tools
Server: Tomcat8.5
Development software: IDEA/Eclipse
Whether it is a Maven project: yes


Table of contents

1. Project Introduction

2. System design

system goals

functional structural design

3. System project screenshots

Hairdressing information management

User reservation management

User sharing management

Promotion management

Store information

Hairdressing information

User sharing

Promotions

4. Core code

4.1 Login related

4.2 File upload

4.3 Packaging

5. Table of Contents and Screenshots of Papers


1. Project Introduction

Since the development of network technology and computer technology, it has a profound theoretical foundation and has been fully used in reality. In particular, software based on computer operation has attracted attention from all walks of life. In addition, people have now entered the information age, so the promotion and management of information is very critical. Therefore, it is necessary to computerize and systematize the management of barber shop member information. Designing and developing a barber shop member management system will not only save manpower and management costs, but also safely store a huge amount of data. It does not take a lot of time to maintain and retrieve barber shop member information, which is very convenient.

The barber shop membership management system establishes a data table in MySQL to save information, and is written using the SSM framework and Java language. And design and implement according to the software design and development process. The system is user-friendly and fully functional. The functions implemented by the system include store management, hairdressing management, user appointment management, user sharing management, message management and other functions.

While the barber shop membership management system standardizes barber shop member information, it can also promptly detect erroneous data through the validity rules of data input, so that data entry can achieve accuracy, thereby improving the data provided by the barber shop membership management system. The reliability minimizes the error rate of system data.


2. System design

Currently, there are many types of systems. Judging from the content presented by the system, the types of systems include social, business, government, news, etc. Then, among the many system types, the first task of system design is to first clarify the type of system to be designed, and then on this basis, clarify the user group, functions, etc. of the system, and design a system with unique experience and vision based on this information. . Only in this way can the system be more distinctive and leave a deep impression on users among many similar systems.

system goals

The function formulation of this system strictly refers to the user's requirements, but when designing this system, it must also meet the design requirements of easy operation and convenient use. Therefore, to design a system that is standardized and meets user needs, the following system goals must be achieved.

The first system goal: The operation mode between the user and the system is based on human-computer dialogue. The design of the visual interface is not only beautiful but also friendly. The various types of information provided by the visual interface meet the requirements of accuracy and reliability, and can be easily viewed by users flexibly.

The second system goal: the data generated by the interaction between users and the system must be stored in the database in a strict and standardized manner. Whether it is searched and managed by later managers, data security must be ensured.

The third system goal: realize the functions required by users. Based on the functional requirements derived from the user survey, the design and implementation of the barber shop membership management system was completed.

The fourth system goal: In necessary links, check the data registered by users, including checking the data length, data input type, etc., provide timely feedback when errors are found, and guide users to standardize registration data. Common data verification includes password modification, registration and login, filling in user information and other aspects.

The fifth system goal: The design and development of this system requires the greatest efforts. In addition to the easy operation of the system, it is also required that the system be easy to maintain during later use, so that the system can be easy to maintain.

The sixth system goal: When this system is delivered to users, it can achieve the goal of stable operation. In addition, the system is safe and meets the conditions of reliability, so users can use it with confidence.

functional structural design

The functional analysis done above is only a general function of this system. This part requires detailed design of each module on this basis.

The detailed functions of the designed administrator are shown in the figure below. After the administrator logs in and enters the backend, he can manage hair salons, shops, promotions, user sharing information, and review user appointments for hair salon information.

The detailed functions of the designed user are shown in the figure below. Users can make appointments for hairdressing, view and comment on shops, promotions and user sharing information.

 



3. System project screenshots

Hairdressing information management

The operating effect of hairdressing information management in administrator rights is shown in the figure below. Administrators can view comments related to hairdressing, modify hairdressing information, and query hairdressing information.

User reservation management

The operation effect of user reservation management in administrator rights is shown in the figure below. The administrator needs to review the hairdressing appointment made by the user and check whether the user has completed the payment.

 

User sharing management

The operation effect of user sharing management in administrator rights is shown in the figure below. Administrators can view, query, and modify users' shared information.

 

Promotion management

The operation effect of preferential activity management in administrator rights is shown in the figure below. The administrator modifies the promotion information, checks the information of users' comments on promotions, and deletes the specified promotion information.

 

Store information

The operation effect of the store information in user permissions is shown in the figure below. Users view store introductions and comment on stores.

 

Hairdressing information

The operating effect of the hairdressing information in user permissions is shown in the figure below. Users collect hairdressing information, comment on hairdressing information, and make appointments for hairdressing.

 

User sharing

The operation effect of user sharing in user permissions is shown in the figure below. Users can view shared information posted by others, collect shared information, and comment on shared information.

 

Promotions

The operating effects of the preferential activities in user permissions are shown in the figure below. Users view promotion details and comment on promotions.

 


4. Core code

4.1 Login related


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

4.2 File upload

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

4.3 Packaging

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

5. Table of Contents and Screenshots of Papers

1 Introduction........................................ 1

1.1 Background of the topic...................................... ................................................................. ......... 1

1.2 Significance of topic selection...................................... ................................................................. ......... 1

1.3 Research content................................................ ................................................................. ........ 2

2 System Development Technology........................ 3

2.1 Java language................................................ ................................................................. ........ 3

2.2 SSM framework................................................ ................................................................. ........ 3

2.3 MYSQL database................................................ ................................................. 4

3 System Analysis........................................ 5

3.1 Feasibility study................................................ ................................................................. ...... 5

3.1.1 Economic feasibility................................................ ................................................. 5

3.1.2 Time feasibility................................................ ................................................. 5

3.1.3 Operational feasibility................................................ ................................................. 5

3.2 System performance analysis................................................ ................................................................. .. 6

3.2.1 System ease of use........................................ ................................................. 6

3.2.2 System Robustness........................................ ................................................. 6

3.2.3 System security........................................ ................................................. 6

3.3 System process analysis................................................ ................................................................. .6

3.4 System function analysis................................................ ................................................................. .. 9

4 System design................................................ 12

4.1 System goals................................................ ................................................................. ....... 12

4.2 Functional structure design................................................ ................................................................. 13

4.3 Database design................................................ ................................................................. ... 14

4.3.1 Database ER diagram................................................ ........................................ 14

4.3.2 Database table structure...................................... ........................................ 17

5 System Implementation........................ 23

5.1 Implementation of administrator functions........................................ .............................................. twenty three

5.1.1 Hairdressing information management...................................... ........................................ twenty three

5.1.2 User reservation management...................................... ........................................ twenty three

5.1.3 User sharing management...................................... ........................................ twenty four

5.1.4 Promotion management................................................ ........................................ twenty four

5.2 User function implementation...................................... ................................................. 25

5.2.1 Store information................................................ ................................................. 25

5.2.2 Hairdressing information................................................ ................................................. 25

5.2.3 User sharing................................................ ................................................. 26

5.2.4 Promotions........................................ ................................................. 26

6 System Test........................................ 28

6.1 Types of system testing................................................ ................................................. 28

6.2 Functional testing................................................ ................................................................. ...... 29

6.3 Usability testing................................................ ................................................................. .. 29

6.4 Test result analysis................................................ ................................................. 29

Conclusion........................................ 30

References........................................ 32

Acknowledgments........................................ 33

 

Guess you like

Origin blog.csdn.net/weixin_52721608/article/details/132915801