Technology Testing and Tracking Human Resource Management

Article catalog

      • Foreword
      • A project introduction
        • Introduction
        • Functional structure diagram
        • Technical selection
          • rear end
          • front end
      • Second technology points
        • Spring Security + JWT Realization Authorization
        • AOP implementation record interface access log
        • WebSocket protocol implements online chat
        • Redis Cache Login Verification Code
        • send email

Foreword

This project is based on open source projectLittle rain / VHR in JiangnanFurther improvement.

A project introduction

Introduction

A corporate human resources management system, the main functions include employee personal information, salary management, department management, position management, and employee training, assessment, department transfer, reward punishment, system role is divided into administrator, personnel, personnel manager, different The role has different permissions, the administrator has all permissions, the personnel "has personnel management, employee information, salary administration, and the personnel manager is more than the department and position management authority than the personnel.

Functional structure diagram

Technical selection

rear end
technology illustrate Version
SpringBoot Container + MVC framework 2.5.4
Spring Security Authentication and authorization framework 5.5.2
JWT JSON WEB TOKEN 0.9.0
Mybatis ORM framework 3.4.6
Mybatis-Generator Data layer code generation 1.3.3
Mysql database 5.7
Druid Database connection pool 1.2.0
Redis Distributed cache 5.0.14
FastJson JSON tool 1.2.3
Jackson JSON tool 2.10.1
Lombok Simplified object package 1.18.10
Swagger-UI Document generation tool 3.0.0
PageHelper Page insert 5.1.8
Spring-Websocket Real-time communication 5.3.9
Hibernator-Validator Verification framework 6.2.0
JDk Java development environment 1.8
Maven Project management tool 3.6.1
Tomcat Operating environment 9.0
Git Version control tool 2.32.0
IDEA development tools 2021.1.3
Postman Interface test tool 9.0
front end
technology illustrate Version
Vue Frontal frame 2.6
Vue-router Routing framework 3.0.7
Vuex Global Status Management Framework 3.4.0
ElementUI Front end UI framework 2.15
Axios Front end http framework 0.21.3
Echarts Chart frame 5.2.1
JwChat Chat component 1.0.1
Node.js Operating environment 12.18
Vue/cli Scaffolding tool 4.5
VS Code development tools 1.58

Second technology points

Spring Security + JWT Realization Authorization

Reference http://www.macrozheng.com/#/architect/mall_arch_04, http://www.macrozhen.com/#/architect/mall_arch_05

Problem: The backend needs to ensure the security of the interface access, you need to verify the identity of the requester and the judgment of whether it has this permission.

solve:

  • When logging in, generate the token, return to the front, token contains the username, Token generating time and expiration time
  • Each time the call interface needs the HTTP request head to add an Authorization field, save token
  • The backend first judges whether or not the request header is present, and then determines if the expiration is expired, and then determine if the current user has corresponding privileges, and if there is, it is allowed to access, otherwise refuses access.
                      <! - Springsecurity Dependency Configuration ->                                          <dependency              >                                                      <groupId              >            org.springframework.boot                              </groupId              >                                                      <artifactId              >            spring-boot-starter-security                              </artifactId              >                                                      </dependency              >                        <! - JWT (JSON Web token) Login Support ->                                          <dependency              >                                                      <groupId              >            io.jsonwebtoken                              </groupId              >                                                      <artifactId              >            jjwt                              </artifactId              >                                                      <version              >            0.9.0                              </version              >                                                      </dependency              >                              
                      # Custom JWT Key            jwt            :            tokenHeader            :            Authorization            #JWT Storage request head            secret            :            xxx            #Jwt add key to use            expiration            :            604800            #JWT super-dead time (60 * 60 * 24)            tokenHead            :            Bearer            #JWT load getting started                  

AOP implementation record interface access log

Reference http://www.macrozhenG.com/#/technology/AOP_LOG

Problem: If the code is added to each controller, then the code is redundant, and the service code cannot be decoupled.

Solve: Use the AOP to make a front and rear notification, the login interface is used for rear notification, increase, delete, and modify the front notification, implement the recording request client, request method, request parameters

                                                    <dependency              >                                                      <groupId              >            org.aspectj                              </groupId              >                                                      <artifactId              >            aspectjweaver                              </artifactId              >                                                      <version              >            1.8.13                              </version              >                                                      </dependency              >                              

WebSocket protocol implements online chat

Reference https://blog.csdn.net/qq_41603102/article/details/82492040, https://zhengkai.blog.csdn.net/Article/details/80275084

Question: Online chat requires a persistent connection, full duplex communication, if you use polling, network resources

Solve: Use the WebSocket protocol, once the connection is successful, you can keep communication until the connection is disconnected, it is very suitable for online chat.

                                                    <dependency              >                                                      <groupId              >            org.springframework.boot                              </groupId              >                                                      <artifactId              >            spring-boot-starter-websocket                              </artifactId              >                                                      </dependency              >                              

Redis Cache Login Verification Code

Reference http://www.macrozhenG.com/#/architect/mall_arch_03

Question: After the verification code is sent to the front end, it is necessary to save so that the expiration time is set, and the time will be deleted. If you use mysql, read / write speed is slow.

Solve: Use Redis to make a cache, improve access speed

                                                    <dependency              >                                                      <groupId              >            org.springframework.boot                              </groupId              >                                                      <artifactId              >            spring-boot-starter-data-redis                              </artifactId              >                                                      </dependency              >                              
                      spring            :            # redis configuration            redis            :            host            :            localhost            # Redis server address            database            :            0            # Redis database index (default is 0)            port            :            6379            # Redis server connection port            password            :            #           (Default is empty)            jedis            :            pool            :            max-active            :            8            #       Maximum number of connections (no limit is limited)            max-wait            :            -1ms            # Connect the pool maximum blocking waiting time (no limit is used)            max-idle            :            8            # Connect the maximum idle connection in the pool            min-idle            :            0            # Connect the minimum idle connection in the pool            timeout            :            3000ms            # Connection timeout (ms)            # Custom Redis Key            redis            :            key            :            prefix            :            authCode            :            "verifyCode:"            expire            :            authCode            :            120            #                              

send email

Reference http://www.javaboy.org/2020/0101/springboot-mail.html

Question: When HR adds employees, send mail to newly entitled employees, and the email is in a certain format.

solve:

  • Apply for an email client (I use QQ mailbox) authorization code
  • Use thymeleaf as a mail template
  • Use JavaMailsender to send mail
                                                    <dependency              >                                                      <groupId              >            org.springframework.boot                              </groupId              >                                                      <artifactId              >            spring-boot-starter-thymeleaf                              </artifactId              >                                                      </dependency              >                                                      <dependency              >                                                      <groupId              >            org.springframework.boot                              </groupId              >                                                      <artifactId              >            spring-boot-starter-mail                              </artifactId              >                                                      </dependency              >                              
                      spring            :            mail            :            host            :            smtp.qq.com            # Configure the SMTP server address            port            :            587            #SMTP server port            username            :            xxx            # Configure the mailbox user name            password            :            xxx            # Configure password, pay attention, not a real password, but the authorization code just applied            default-encoding            :            utf-            8            # Default mail code            properties            :            mail            :            smtp            :            socketFactoryClass            :            javax.net.ssl.SSLSocketFactory            # Configure SSL encryption factory            debug            :            false            # Close Debug mode                  

Technology Testing and Tracking Human Resource Management

Source: https://www.programmersought.com/article/44729899889/

0 Response to "Technology Testing and Tracking Human Resource Management"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel