Design and implementation of food safety traceability system based on Java (source code + lw + deployment documents + explanation, etc.)

Blogger Introduction: ?300,000+ fans across the entire network, csdn guest author, blog expert, CSDN Rising Star Program mentor, high-quality creator in the Java field, Blog Star, Nuggets / Huawei Cloud / Alibaba Cloud / InfoQ and other platforms are high-quality authors, focusing on the field of Java technology and practical graduation projects?

Contact for source code at the end of the article

Recommended subscription for wonderful columns Otherwise, you won’t find it next time

The most comprehensive collection of computer software graduation project topics for 2022-2024: 1,000 popular topic recommendations?

Java project quality practical cases “100 sets”

Java WeChat Mini Program Project Practical “100 Sets”

If you are interested, you can save it first. If you have questions about graduation topics, projects, thesis writing and other related questions, you can leave me a message for consultation. I hope to help more people

?

System introduction:

The fast-paced development of the modern economy and the constantly improving and upgrading of information technology have upgraded traditional data information management to software storage, summary, and centralized processing of data information management methods. This food safety traceability system was born in such an environment. It can help managers process huge data information in a short time. Using this software tool can help managers improve transaction processing efficiency and achieve twice the result with half the effort. This food safety traceability system uses the current mature and complete JSP technology, the cross-platform Java language that can develop large-scale commercial websites, and the Mysql database, one of the most popular RDBMS application software, for program development. The development of the food safety traceability system is designed according to the needs of operators. The interface is simple and beautiful, and the layout of functional modules is consistent with similar websites. When the program realizes the basic required functions, it also provides some practical solutions to the security issues faced by data information. plan. It can be said that this program not only helps managers handle work affairs efficiently, but also realizes the integration, standardization and automation of data information.

When the user’s functional requirements for the program are analyzed and obtained, program design can be carried out. Figure 4.2 shows the administrator function structure diagram. The administrator functions include personal center, user management, company information management, food material management, material type management, processing technology management, message board management, and system management. Users can register and log in to view records such as processing techniques displayed in various food safety traceability processes.

Figure 4.2 Administrator function structure diagram

When the program is handed over to the user for use, the operation flow chart of the program needs to be provided, so that the user can easily understand the specific working steps of the program. Nowadays, the operation process of the program has a general standard, that is, first submit the login data through the login page, After the program is verified correctly, the user can operate the corresponding function on the program function operation area page.

?

Program operation flow chart

Function screenshot:

5.1 ManagementBackendFunction Introduction

5.1.1 User information management

Figure 5.1 shows the user information management page. The functions provided to administrators on this page include: adding, modifying, querying, and deleting user information.

Figure 5.1 User information management page

5.1.2 Company Information Management

Figure 5.2 shows the company information management page. The functions provided to administrators on this page include: adding, modifying, querying, and deleting company information.

Figure 5.2 Company information management page

5.1.3 Material type management

Figure 5.3 shows the material type management page. The functions provided to administrators on this page include: adding, modifying, querying, and deleting material type information.

Figure 5.3 Material type management page

5.1.4 Processing Technology Management

Figure 5.4 shows the processing technology management page. The functions provided to administrators on this page include: adding, modifying, querying, and deleting processing technology information.

Figure 5.4 Processing technology management page

5.1.5 Food Material Management

Figure 5.5 shows the food material management page. The functions provided to administrators on this page include: adding, modifying, querying, and deleting food material information.

Figure 5.5 Food material information page

5.2 Introduction to front-end functions

5.2.1 Home

Figure 5.6 shows the home page. This page is mainly provided for users to access. It has the software name and navigation bar. Click on the navigation to jump to the corresponding interface.

Figure 5.6 Home page

5.2.2 Processing technology

Figure 5.7 shows the processing technology page. This page mainly displays the process name, process flow, and process details. Users can not only view, but also collect and comment, and can like and dislike to express their opinions.

Figure 5.7 Processing technology page

5.2.3 Personal Center

Figure 5.8 shows the personal center page. The functions provided to users on this page are: only after registering and logging in, users can click on the personal center to enter the following interface. In the personal center, they can modify personal information and view their own information. Collection, click My Collection to jump to all your collection information.

Figure 5.8 Personal center page

Code implementation:

/**
 * Login related
 */
@RequestMapping("users")
@RestController
public class UserController{
    
    @Autowired
    private UserService userService;
    
    @Autowired
    private TokenService tokenService;

    /**
     * Log in
     */
    @IgnoreAuth
    @PostMapping(value = "/login")
    public R login(String username, String password, String role, HttpServletRequest request) {
        UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
        if(user != null){
            if(!user.getRole().equals(role)){
                return R.error("Permissions are abnormal");
            }
            if(user==null || !user.getPassword().equals(password)) {
                return R.error("Account or password is incorrect");
            }
            String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
            return R.ok().put("token", token);
        }else{
            return R.error("Account or password or permissions are incorrect");
        }

    }
    
    /**
     * register
     */
    @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("User already exists");
        }
        userService.insert(user);
        return R.ok();
    }

    /**
     * quit
     */
    @GetMapping(value = "logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("Exit successfully");
    }
    
    /**
     * reset Password
     */
    @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("Account does not exist");
        }
        user.setPassword("123456");
        userService.update(user,null);
        return R.ok("Password has been reset to: 123456");
    }
    
    /**
     * list
     */
    @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);
    }

    /**
     * information
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * Get the user's session user information
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
        Integer id = (Integer)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * save
     */
    @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("User already exists");
        }
        userService.insert(user);
        return R.ok();
    }

    /**
     * Revise
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
        userService.updateById(user);//Update all
        return R.ok();
    }

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

Paper reference:

Source code acquisition:

Everyone like, collect, follow, comment, viewget contact information

Recommended subscription for wonderful columns: In the column below

The most comprehensive collection of computer software graduation project topics for 2022-2024: 1,000 popular topic recommendations?

Java project quality practical cases “100 sets”

Java WeChat Mini Program Project Practice “100 Sets”

The knowledge points of the article match the official knowledge files, and you can further learn related knowledge. Java Skill TreeHomepageOverview 137029 people are learning the system