APP application development | Design and implementation of enterprise attendance and salary management system

Author Home Page: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, CSDN content partner, Nuggets guest author, Alibaba Cloud blog expert, 51CTO guest author, many years of architect design experience, Tencent classroom resident lecturer

Main contents: Java projects, Python projects, front-end projects, artificial intelligence and big data, resume templates, study materials, interview question bank, technical mutual assistance

Collect, like and don’t get lost. It’s good to follow the author.

Get the source code at the end of the article 

Project number: BS-APP-001

1. Introduction to the environment

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or Hbuilder

Development technology: SSM framework development background + Andriod Studio development and implementation of APP application end

2. Project Introduction

 This topic mainly studies how to use modern information technology to help enterprises carry out attendance and salary management. For a modern enterprise, the level of informatization construction is directly related to the overall operational efficiency of the enterprise. The main content of this course is the management of employee attendance and employee wages. These two businesses are universal and common in enterprises. Applicability, the enterprise's employee attendance is a constraint on the employee's concept of time and work, and it is also effectively combined with the employee's salary income. In the past, the employee attendance constraint was achieved through attendance machines punching in, but it is required at the end of every month It is relatively troublesome to export data and then perform manual statistical management. Employee salary management mainly relies on manual accounting management. The overall operation complexity is high and the management efficiency is low.

This topic mainly implements online management of employee attendance and online management of employee wages through APP applications. The system completed the development of an enterprise attendance and salary management system with front-end and back-end separation by developing Android application APP and corresponding back-end management program. Backend development uses the Spring framework to integrate the mybatis-plus framework to complete the development of the backend management system. The database uses MYSQL5.7, and the development tools are first implemented using IDEA and Andriod Studio development tools.

This project developed and designed an application APP for salary attendance and employee salary management based on the Andriod platform based on the requirements. The users used are mainly divided into three types of roles, one is the system administrator, the other is the company employee, and the third is the department manager. These three types of users have different operating permissions after logging into the system. The two roles of company employees and department managers mainly log in through the APP. The system administrator mainly manages the business data of the entire application system through the background. operate.

  Main functions implemented by the administrator:

  1. Publish corporate announcements (add, delete, modify and check)

  2. Manage all departments of the company (add or delete department managers)

  3. All employee management (display employee personal information plus positions)

  4. Salary management (registration and payment status)

  5. Display and modification of attendance statistics (including daily attendance and leave requests)

  6. Modify attendance exceptions

  Department managers need to implement functions:

  1. View company announcements

  2. Department management and viewing

  3. Sign in and out

  4.Salary view

  5. Check the attendance status of this department

  6. Leave approval

  7. Application for abnormal attendance

  Employee implementation function:

  1. View company announcements

  2. Modification of personal information

  3. Check salary

  4. Sign in and out

  5. Leave application

  6. Application for abnormal attendance

The functional structure diagram is as follows:

3. System display

5.1 Basic functions for front-end users

5.1.1 Display of APP application login management

Enterprise employees and department manager users open the APP application, enter their account and password, and submit a request to the backend service interface for verification. Once the verification is passed, the login is successful. As shown in Figure 5.1 below.

Figure 5.1 Login interface

5.1.2 Display of news information browsing

After logging in to the APP, corporate employees and their department managers can view news and announcement information online, and perform operations such as likes, comments, and favorites on the news, as shown in Figures 5.2 and 5.3 below:

Figure 5.2 News browsing display

Figure 5.3 News interactive display diagram

5. 1.3 Employee online attendance display

   After logging in to the APP, employees can find employee attendance in My Personal Center and perform online clock-in operations. The relevant records of clock-in will be reviewed by the department manager after logging in. The details of employee clock-in are shown in Figure 5.4 below.

Figure 5.4 Employee punch-in information interface diagram

5.1.5 Employee leave management display

    After employees log in to the APP, they can find employee requests for leave in my personal center and perform online leave operations. After filling in the relevant matters and time of the leave, the relevant records of the leave will be reviewed by the department manager after logging in. The details of the employee's request for leave are as follows: As shown in 5.5.

Figure 5.5 Online leave management interface diagram

5.1.5 Department manager’s absence deduction display

After department managers log in to the APP, they can view the attendance information of employees in their department. If an employee's attendance is abnormal, the system will automatically record it. The department manager can manually deduct performance based on the absence, as shown in Figure 5.6 below.

Figure 5.6 Attendance deduction interface diagram

5.1.6 View employee salaries

After department managers log in to the APP, they can view the salary details of their department members, as shown in Figure 5.7 below.

Figure 5.7 Salary viewing interface diagram

5.1.7 Sign-in review implementation

After department managers log in to the APP, they can review the attendance information of their department employees. Those who fail the review will be treated as absences, as shown in Figure 5.8 below.

Figure 5.8 Check-in and review interface diagram

5.1.8 Implementation of leave review

After department managers log in to the APP, they can review the leave information of employees in their department, as shown in Figure 5.9 below.

Figure 5.9 Leave review interface diagram

5.2 Background management function display

5.2.1 Administrator login

    The background administrator of the enterprise employee attendance and salary management platform can perform related information management operations after logging in. The specific login interface is shown in Figure 5.10 below.

Figure 5.10 Employee login management interface diagram

5.2.2 Display of employee management functions

     The administrator enters the background management and selects employee management under system user management to perform corresponding management operations on the company's employee information, which mainly includes information query, employee addition, detailed view, modification and deletion operations, as shown in Figure 5.11 below.

Figure 5.11 Employee management information interface

Other functions are briefly displayed

4. Core code display

package com.project.demo.controller.base;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.project.demo.service.base.BaseService;
import com.project.demo.utils.IdWorker;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 */
@Slf4j
public class BaseController<E, S extends BaseService<E>> {

    @Setter
    protected S service;

    @PostMapping("/add")
    @Transactional
    public Map<String, Object> add(HttpServletRequest request) throws IOException {
        service.insert(service.readBody(request.getReader()));
        return success(1);
    }

    @Transactional
    public Map<String, Object> addMap(Map<String,Object> map){
        service.insert(map);
        return success(1);
    }

    @PostMapping("/set")
	@Transactional
    public Map<String, Object> set(HttpServletRequest request) throws IOException {
        service.update(service.readQuery(request), service.readConfig(request), service.readBody(request.getReader()));
        return success(1);
    }


    @RequestMapping(value = "/del")
    @Transactional
    public Map<String, Object> del(HttpServletRequest request) {
        service.delete(service.readQuery(request), service.readConfig(request));
        return success(1);
    }

    @RequestMapping("/get_obj")
    public Map<String, Object> obj(HttpServletRequest request) {
        List resultList = service.selectBaseList(service.select(service.readQuery(request), service.readConfig(request)));
        if (resultList.size() > 0) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("obj",resultList.get(0));
            return success(jsonObject);
        } else {
            return success(null);
        }
    }


    @RequestMapping("/get_list")
    public Map<String, Object> getList(HttpServletRequest request) {
        Map<String, Object> map = service.selectToPage(service.readQuery(request), service.readConfig(request));
        return success(map);
    }

    @RequestMapping("/list_group")
    public Map<String, Object> listGroup(HttpServletRequest request) {
        Map<String, Object> map = service.selectToList(service.readQuery(request), service.readConfig(request));
        return success(map);
    }

    @RequestMapping("/bar_group")
    public Map<String, Object> barGroup(HttpServletRequest request) {
        Map<String, Object> map = service.selectBarGroup(service.readQuery(request), service.readConfig(request));
        return success(map);
    }

    @RequestMapping(value = {"/count_group", "/count"})
    public Map<String, Object> count(HttpServletRequest request) {
        Integer value= service.selectSqlToInteger(service.groupCount(service.readQuery(request), service.readConfig(request)));
        return success(value);
    }

    @RequestMapping(value = {"/sum_group", "/sum"})
    public Map<String, Object> sum(HttpServletRequest request) {
        Integer value = service.selectSqlToInteger(service.sum(service.readQuery(request), service.readConfig(request)));
        return success(value);
    }

    @RequestMapping(value = {"/avg_group", "/avg"})
    public Map<String, Object> avg(HttpServletRequest request) {
        Integer value = service.selectSqlToInteger(service.avg(service.readQuery(request), service.readConfig(request)));
        return success(value);
    }

//    @RequestMapping(value = {"/count_group", "/count"})
//    public Map<String, Object> count(HttpServletRequest request) {
//        Query count = service.count(service.readQuery(request), service.readConfig(request));
//        return success(count.getResultList());
//    }
//
//    @RequestMapping(value = {"/sum_group", "/sum"})
//    public Map<String, Object> sum(HttpServletRequest request) {
//        Query count = service.sum(service.readQuery(request), service.readConfig(request));
//        return success(count.getResultList());
//    }
//
//    @RequestMapping(value = {"/avg_group", "/avg"})
//	public Map<String, Object> avg(HttpServletRequest request) {
//        Query count = service.avg(service.readQuery(request), service.readConfig(request));
//        return success(count.getResultList());
//    }


    @PostMapping("/upload")
    public Map<String, Object> upload(@RequestParam(value = "file",required=false) MultipartFile file,HttpServletRequest request) {
        log.info("进入方法");
        if (file.isEmpty()) {
            return error(30000, "没有选择文件");
        }
        try {
            //判断有没路径,没有则创建
            String filePath = request.getSession().getServletContext().getRealPath("\\") +"upload\\";
//            String filePath = System.getProperty("user.dir") + "\\target\\classes\\static\\upload\\";
            File targetDir = new File(filePath);
            if (!targetDir.exists() && !targetDir.isDirectory()) {
                if (targetDir.mkdirs()) {
                    log.info("创建目录成功");
                } else {
                    log.error("创建目录失败");
                }
            }
//            String path = ResourceUtils.getURL("classpath:").getPath() + "static/upload/";
//            String filePath = path.replace('/', '\\').substring(1, path.length());
            String fileName = file.getOriginalFilename();
            int lastIndexOf = fileName.lastIndexOf(".");
            //获取文件的后缀名 .jpg
            String suffix = fileName.substring(lastIndexOf);
            fileName = IdWorker.getId()+suffix;
            File dest = new File(filePath + fileName);
            log.info("文件路径:{}", dest.getPath());
            log.info("文件名:{}", dest.getName());
            file.transferTo(dest);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("url", "/api/upload/" + fileName);
            return success(jsonObject);
        } catch (IOException e) {
            log.info("上传失败:{}", e.getMessage());
        }
        return error(30000, "上传失败");
    }

//    @PostMapping("/import_db")
//    public Map<String, Object> importDb(@RequestParam("file") MultipartFile file) throws IOException {
//        service.importDb(file);
//        return success(1);
//    }
//
//    @RequestMapping("/export_db")
//    public void exportDb(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        HSSFWorkbook sheets = service.exportDb(service.readQuery(request), service.readConfig(request));
//        response.setContentType("application/octet-stream");
//        response.setHeader("Content-disposition", "attachment;filename=employee.xls");
//        response.flushBuffer();
//        sheets.write(response.getOutputStream());
//        sheets.close();
//    }

    public Map<String, Object> success(Object o) {
        Map<String, Object> map = new HashMap<>();
        if (o == null) {
            map.put("result", null);
            return map;
        }
        if (o instanceof List) {
            if (((List) o).size() == 1) {
               o =  ((List) o).get(0);
                map.put("result", o);
            }else {
                String jsonString = JSONObject.toJSONString(o);
                JSONArray objects = service.covertArray(JSONObject.parseArray(jsonString));
                map.put("result", objects);
            }
        } else if (o instanceof Integer || o instanceof String) {
            map.put("result", o);
        } else {
            String jsonString = JSONObject.toJSONString(o);
            JSONObject jsonObject = JSONObject.parseObject(jsonString);
            JSONObject j = service.covertObject(jsonObject);
            map.put("result", j);
        }
        return map;
    }

    public Map<String, Object> error(Integer code, String message) {
        Map<String, Object> map = new HashMap<>();
        map.put("error", new HashMap<String, Object>(4) {
   
   {
            put("code", code);
            put("message", message);
        }});
        return map;
    }
}

5. Display of related works

Practical projects based on Java development, Python development, PHP development, C# development and other related languages

Front-end practical projects developed based on Nodejs, Vue and other front-end technologies

Related works based on WeChat applet and Android APP application development

Development and application of embedded Internet of Things based on 51 microcontroller and other embedded devices

AI intelligent applications based on various algorithms

Various data management and recommendation systems based on big data

 

 

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/133063546