Quality Management System Design and Implementation for Small and Medium Manufacturing Enterprises using Java, Spring Boot, and MySQL

In today's rapidly evolving digital landscape, traditional information management systems face significant challenges in terms of timeliness, security, and operational efficiency. The advent of internet technologies has revolutionized how data is managed, offering solutions to longstanding issues in traditional systems. As manufacturing enterpirses accumulate more data over time, manual data processing becomes increasingly inefficient, with slow data aggregation and query capabilities. Moreover, data security in traditional systems is often inadequate.

This quality management system for small and medium manufacturing enterprises addresses these challenges by implementing modern web technologies. The system provides comprehensive quality control functionalities including finished product inspection management, sampling standard management, shipment inspection management, dictionary management, announcement management, staff management, control chart initialization, incoming material inspection management, and various reporting capabilities. The system leverages MySQL as the database backend, ensuring secure data storage, reliable backups, and enhanced data integrity. By adopting this digital solution, manufacturing enterprises can significantly improve their information processing efficiency and operational effectiveness.

Technology Stack

The system is built using the following technology stack:

  • Spring Boot
  • Java
  • MySQL
  • JavaScript
  • jQuery
  • Ajax

System Functionality

Administrator Features

Finished Product Inspection Management

This module enables administrators to manage finished product inspection data. Key operations include adding, modifying, deleting, and viewing inspection records.

Announcement Information Management

Provides functionality for creating, editing, and deleting announcements. Administrators can communicate important information to relevant personnel through this module.

Announcement Type Management

Allows administrators to manage announcement categories, including adding new types, editing existing ones, and removing obsolete categories.

Incoming Material Inspection Management

Facilitates the management of incoming material inspection processes, supporting operations such as creating, updating, and removing inspection records.

Incoming Material Inspection Type Management

Enables administrators to define and manage different types of incoming material inspections, with capabilities to add, modify, and delete inspection categories.

Core Code Implementation

Authentication Module

package com.security.controller;

import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.annotation.PublicAccess;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.AccessToken;
import com.entity.Employee;
import com.service.AccessTokenService;
import com.service.EmployeeService;
import com.utils.CommonUtil;
import com.utils.SecurityUtil;
import com.utils.PageUtils;
import com.utils.Response;
import com.utils.Validator;

/**
 * Authentication Controller
 */
@RestController
@RequestMapping("/auth")
public class AuthController {
    
    @Autowired
    private EmployeeService employeeService;
    
    @Autowired
    private AccessTokenService tokenService;
    
    /**
     * User Login
     */
    @PublicAccess
    @PostMapping("/login")
    public Response login(String username, String password, HttpServletRequest request) {
        Employee employee = employeeService.selectOne(new EntityWrapper<employee>().eq("username", username));
        if(employee == null || !employee.getPassword().equals(password)) {
            return Response.error("Invalid username or password");
        }
        String token = tokenService.generateToken(employee.getId(), username, "auth", employee.getRole());
        return Response.success().add("token", token);
    }
    
    /**
     * User Registration
     */
    @PublicAccess
    @PostMapping("/register")
    public Response register(@RequestBody Employee employee) {
        if(employeeService.selectOne(new EntityWrapper<employee>().eq("username", employee.getUsername())) != null) {
            return Response.error("Username already exists");
        }
        employeeService.insert(employee);
        return Response.success();
    }
    
    /**
     * Logout
     */
    @GetMapping("/logout")
    public Response logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return Response.success("Logout successful");
    }
    
    /**
     * Password Reset
     */
    @PublicAccess
    @PostMapping("/resetPassword")
    public Response resetPassword(String username, HttpServletRequest request) {
        Employee employee = employeeService.selectOne(new EntityWrapper<employee>().eq("username", username));
        if(employee == null) {
            return Response.error("Username not found");
        }
        employee.setPassword("123456");
        employeeService.update(employee, null);
        return Response.success("Password has been reset to: 123456");
    }
    
    /**
     * User List
     */
    @GetMapping("/list")
    public Response list(Employee employee) {
        EntityWrapper<employee> wrapper = new EntityWrapper<>();
        wrapper.allEq(Validator.filterMap(employee, "emp"));
        return Response.success().add("data", employeeService.selectListView(wrapper));
    }
    
    /**
     * User Details
     */
    @GetMapping("/details/{id}")
    public Response details(@PathVariable("id") String id) {
        Employee employee = employeeService.selectById(id);
        return Response.success().add("data", employee);
    }
    
    /**
     * Get Current User Session
     */
    @GetMapping("/current")
    public Response getCurrentUser(HttpServletRequest request) {
        Long id = (Long) request.getSession().getAttribute("userId");
        Employee employee = employeeService.selectById(id);
        return Response.success().add("data", employee);
    }
    
    /**
     * Save New User
     */
    @PostMapping("/save")
    public Response save(@RequestBody Employee employee) {
        if(employeeService.selectOne(new EntityWrapper<employee>().eq("username", employee.getUsername())) != null) {
            return Response.error("Username already exists");
        }
        employeeService.insert(employee);
        return Response.success();
    }
    
    /**
     * Update User
     */
    @PostMapping("/update")
    public Response update(@RequestBody Employee employee) {
        employeeService.updateById(employee);
        return Response.success();
    }
    
    /**
     * Delete Users
     */
    @PostMapping("/delete")
    public Response delete(@RequestBody Long[] ids) {
        employeeService.deleteBatchIds(Arrays.asList(ids));
        return Response.success();
    }
}
</employee></employee></employee></employee></employee>

File Upload Module

package com.storage.controller;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
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.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.annotation.PublicAccess;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.StorageConfig;
import com.exception.StorageException;
import com.service.StorageConfigService;
import com.utils.Response;

/**
 * File Upload Controller
 */
@RestController
@RequestMapping("/files")
public class FileUploadController {
    
    @Autowired
    private StorageConfigService configService;
    
    /**
     * Upload File
     */
    @PostMapping("/upload")
    public Response upload(@RequestParam("file") MultipartFile file, String type) throws Exception {
        if (file.isEmpty()) {
            throw new StorageException("Uploaded file cannot be empty");
        }
        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 uploadDir = new File(path.getAbsolutePath(), "/uploads/");
        if(!uploadDir.exists()) {
            uploadDir.mkdirs();
        }
        String fileName = new Date().getTime() + "." + fileExt;
        File destination = new File(uploadDir.getAbsolutePath() + "/" + fileName);
        file.transferTo(destination);
        FileUtils.copyFile(destination, new File("C:\\Users\\Desktop\\manufacturing\\springboot\\src\\main\\resources\\static\\uploads\\" + fileName));
        
        if(StringUtils.isNotBlank(type) && type.equals("1")) {
            StorageConfig config = configService.selectOne(new EntityWrapper<storageconfig>().eq("name", "profilePicture"));
            if(config == null) {
                config = new StorageConfig();
                config.setName("profilePicture");
                config.setValue(fileName);
            } else {
                config.setValue(fileName);
            }
            configService.insertOrUpdate(config);
        }
        return Response.success().add("file", fileName);
    }
    
    /**
     * Download File
     */
    @PublicAccess
    @GetMapping("/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 uploadDir = new File(path.getAbsolutePath(), "/uploads/");
            if(!uploadDir.exists()) {
                uploadDir.mkdirs();
            }
            File file = new File(uploadDir.getAbsolutePath() + "/" + fileName);
            if(file.exists()){
                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);
    }
}
</byte></byte></byte></storageconfig>

Response Utility Class

package com.utils;

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

/**
 * Response Data Structure
 */
public class Response extends HashMap<string object=""> {
    private static final long serialVersionUID = 1L;
    
    public Response() {
        put("code", 0);
    }
    
    public static Response error() {
        return error(500, "Unknown error, please contact administrator");
    }
    
    public static Response error(String message) {
        return error(500, message);
    }
    
    public static Response error(int code, String message) {
        Response response = new Response();
        response.put("code", code);
        response.put("message", message);
        return response;
    }
    
    public static Response success(String message) {
        Response response = new Response();
        response.put("message", message);
        return response;
    }
    
    public static Response success(Map<string object=""> data) {
        Response response = new Response();
        response.putAll(data);
        return response;
    }
    
    public static Response success() {
        return new Response();
    }
    
    public Response add(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
</string></string>

Tags: java Spring Boot MySQL Quality Management Manufacturing

Posted on Sat, 19 Sep 2026 16:25:17 +0000 by icarpenter