Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Design and Implementation of a Product Marketing System with Membership Management Based on SpringBoot+Vue+uniapp

Tech Jul 8 2

Introduction

🌞Author Profile: ✌With over 150,000 followers across platforms, I am a CSDN invited author, a graduate from a 211 university, and an experienced full-stack developer with years of industry experience. I specialize in Java and mini-program technologies, offering project implementation guidance, customized development, and career mentoring. ✌🌞

👇🏻 Recommended Specialized Columns👇🏻
2023-2024 Top Mini-Program Graduation Project Topics: 100 Popular Choices ✅

2023-2024 Top Java Graduation Project Topics: 500 Popular Choices ✅

Java Practical Case Collection《500 Sets》

Mini-Program Project Case Collection《500 Sets》

💯Source Code + Database at the End of This Article 💯
Feel free to bookmark this page. For any queries related to graduation projects, development, or thesis writing, feel free to leave a message for assistance.

Detailed Video Demonstration

Contact me for comprehensive video walkthroughs.

Screenshots

Technology Stack

Backend Framework: SpringBoot

Spring Boot comes with built-in servers like Tomcat, Jetty, and Undertow, eliminating the need for additional setup. Its auto-configuration capability automatically adjusts based on dependencies, simplifying application configuration. It also provides out-of-the-box features such as Spring Data, Spring Security, and Spring Cloud, accelerating application development and integration. This makes it a widely adopted framework for building robust applications quickly.

Frontend Framework: Vue

Vue.js utilizes virtual DOM technology, enabling efficient DOM manipulation through memory-based data structures. It supports reactive data binding, virtual DOM rendering, and component-based architecture, delivering a flexible and maintainable development approach. When data changes, the UI updates automatically, allowing developers to focus on data handling rather than manual UI updates—highlighting Vue’s simplicity, flexibility, and efficiency.

Persistence Layer: MyBatisPlus

MyBatis-Plus enhances the MyBatis framework to streamline development. It supports multiple databases including MySQL, Oracle, SQL Server, and PostgreSQL. With rich APIs and annotations, it reduces manual SQL writing and includes a code generator that produces entity classes, Mapper interfaces, and XML mapping files. Additional features like pagination, dynamic queries, optimistic locking, and performance analysis further improve data operations. It helps developers build high-quality data access layers efficiently.

System Testing

Thorough testing is crucial for identifying system defects and ensuring quality. It validates whether the system meets customer expectations and corrects any issues found during testing. The ultimate goal is to ensure that the system functions correctly according to design specifications.

Purpose of System Testing

In the development cycle of a management system, testing is essential for quality assurance. It ensures the system's reliability and usability before deployement. The process involves simulating various usage scenarios to uncover defects and enhance user experience. A well-executed test process improves overall system quality and functionality.

Functional Testing

Functional tests are performed on system modules using methods like input validation, boundary value testing, and black-box testing techniques. Test cases are created and executed to validate each function. Below are sample test results for key modules:

Login Functionality Testing

User Management Testing

Testing Conclusion

This system uses black-box testing methodologies, simulating user interactions to verify functionality. Testing ensures that all processes operate as intended. It confirms the system meets functional and performance criteria, enhancing usability and reliability. All test scenarios align with user needs, ensuring that the final product is both effective and user-friendly.

Why Choose Me

Code Reference

@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
   UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
   if(user == null || !user.getPassword().equals(password)) {
      return R.error("Invalid credentials");
   }
   String token = tokenService.generateToken(user.getId(), username, "users", user.getRole());
   return R.ok().put("token", token);
}

@Override
public String generateToken(Long userid, String username, String tableName, String role) {
    TokenEntity tokenEntity = this.selectOne(new EntityWrapper<TokenEntity>().eq("userid", userid).eq("role", role));
    String token = CommonUtil.getRandomString(32);
    Calendar cal = Calendar.getInstance();   
    cal.setTime(new Date());   
    cal.add(Calendar.HOUR_OF_DAY, 1);
    if(tokenEntity != null) {
        tokenEntity.setToken(token);
        tokenEntity.setExpiratedtime(cal.getTime());
        this.updateById(tokenEntity);
    } else {
        this.insert(new TokenEntity(userid, username, tableName, role, token, cal.getTime()));
    }
    return token;
}

@Component
public class AuthorizationInterceptor implements HandlerInterceptor {

    public static final String LOGIN_TOKEN_KEY = "Token";

    @Autowired
    private TokenService tokenService;
    
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
        response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));

        if (request.getMethod().equals(RequestMethod.OPTIONS.name())) {
            response.setStatus(HttpStatus.OK.value());
            return false;
        }
        
        IgnoreAuth annotation;
        if (handler instanceof HandlerMethod) {
            annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
        } else {
            return true;
        }

        String token = request.getHeader(LOGIN_TOKEN_KEY);

        if(annotation != null) {
            return true;
        }
        
        TokenEntity tokenEntity = null;
        if(StringUtils.isNotBlank(token)) {
            tokenEntity = tokenService.getTokenEntity(token);
        }
        
        if(tokenEntity != null) {
            request.getSession().setAttribute("userId", tokenEntity.getUserid());
            request.getSession().setAttribute("role", tokenEntity.getRole());
            request.getSession().setAttribute("tableName", tokenEntity.getTablename());
            request.getSession().setAttribute("username", tokenEntity.getUsername());
            return true;
        }
        
        PrintWriter writer = null;
        response.setCharacterEncoding("UTF-8");
        response.setContentType("application/json; charset=utf-8");
        try {
            writer = response.getWriter();
            writer.print(JSONObject.toJSONString(R.error(401, "Please log in first")));
        } finally {
            if(writer != null){
                writer.close();
            }
        }
        return false;
    }
}

Database Schema Reference

-- ----------------------------
-- Table structure for token
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
  `userid` bigint(20) NOT NULL COMMENT 'User ID',
  `username` varchar(100) NOT NULL COMMENT 'Username',
  `tablename` varchar(100) DEFAULT NULL COMMENT 'Table Name',
  `role` varchar(100) DEFAULT NULL COMMENT 'Role',
  `token` varchar(200) NOT NULL COMMENT 'Token',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation Time',
  `expiratedtime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Expiration Time',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Token Table';

-- ----------------------------
-- Records of token
-- ----------------------------
INSERT INTO `token` VALUES ('9', '23', 'cd01', 'xuesheng', '学生', 'al6svx5qkei1wljry5o1npswhdpqcpcg', '2023-02-23 21:46:45', '2023-03-15 14:01:36');
INSERT INTO `token` VALUES ('10', '11', 'xh01', 'xuesheng', '学生', 'fahmrd9bkhqy04sq0fzrl4h9m86cu6kx', '2023-02-27 18:33:52', '2023-03-17 18:27:42');
INSERT INTO `token` VALUES ('11', '17', 'ch01', 'xuesheng', '学生', 'u5km44scxvzuv5yumdah2lhva0gp4393', '2023-02-27 18:46:19', '2023-02-27 19:48:58');
INSERT INTO `token` VALUES ('12', '1', 'admin', 'users', '管理员', 'h1pqzsb9bldh93m92j9m2sljy9bt1wdh', '2023-02-27 19:37:01', '2023-03-17 18:23:02');
INSERT INTO `token` VALUES ('13', '21', 'xiaohao', 'shezhang', '社长', 'zdm7j8h1wnfe27pkxyiuzvxxy27ykl2a', '2023-02-27 19:38:07', '2023-03-17 18:25:20');
INSERT INTO `token` VALUES ('14', '27', 'djy01', 'xuesheng', '学生', 'g3teq4335pe21nwuwj2sqkrpqoabqomm', '2023-03-15 12:56:17', '2023-03-15 14:00:16');
INSERT INTO `token` VALUES ('15', '29', 'dajiyue', 'shezhang', '社长', '0vb1x9xn7riewlp5ddma5ro7lp4u8m9j', '2023-03-15 12:58:08', '2023-03-15 14:03:48');

Source Code Access

If you have any questions, feel free to reach out.
Please like, bookmark, follow, and comment!
Recommended Specialized Columns: Below 👇🏻
Java Practical Case Collection《500 Sets》
Mini-Program Project Case Collection《500 Sets》

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.