A, vhr macro-project analysis
Objective: To achieve the organs and institutions of Personnel Management Information System .
Object Software used: internal organs and institutions for personnel information management and job developer.
[Architecture] Selection
Vhr oriented groups range is not large, not part of Internet applications, so the market advocating high concurrency, high performance for this project does not apply.
The blind micro-services only heighten the cost.
Business Process Design
1. The administrator operations on employee information
First of all, log in personnel management, employee information CRUD, then the information reward and punishment, salary, evaluation, etc. CRUD, and then implement changes to the statistical part of the information department staff
2. The operator of the operation of their information
Can operate on their own information
System Functional Design
Employee data
Employee information, including basic information and advanced materials.
basic information
Employee number, employee name, sex, date of birth, ID number, marital status, ethnic, institutions, political affiliation, email address, telephone number, address, department, position, title, base salary, Employment, highest level of education, their profession, graduated from college, hire date, job status, job number, duration of the contract.
Advanced data
(1) reward information: Date of rewards and punishments, rewards points, rewards and punishments reasons.
(2) Training materials: Training dates and training.
(3) evaluation of information: the date of evaluation, evaluation content, evaluation results.
(4) salary data: date salary, salary adjustment before, after adjusting salaries, salary reasons.
. (5) to mobilize Information: mobilize date, adjust the front door, adjusting the front post, mobilize reasons, after the transfer department, after the transfer position, notes.
(6) salary information: C set name, month wages, wages should be, notes.
(7) Other information: Additional information Administrators can any notes.
HR management
Mainly used for employee incentives, training, evaluation, salary increases, transfers, salary information management.
1. Employee Information
That basic information of employees, employee information display and the staff can be fuzzy query that employees realize additions and deletions to change search information.
2. Employee rewards and punishments
Additions and deletions to change search employee reward module implementation.
3. Employee Training
Additions and deletions to change search staff training modules to achieve.
4. Employee praise
Additions and deletions to change search employees praise module implementation.
5. Employee salary
Additions and deletions of staff salary change search module implementation.
6. employee mobility
Additions and deletions to change search module mobilize employees to achieve.
Payroll
C sets wages for employees achieve management, employee Zhang Tao set up, manage payroll, month-end processing, payroll queries a series of employee payroll functions.
1 Wage Set Management
Additions and deletions to the employee bonuses, base salary, commission, etc. change search.
2 employees settings Zhang Tao
According to the company Zhang Tao (ie departments), view the salary information of employees, and additions and deletions to achieve its function.
3 payroll management
Focus on CRUD functionality for the same sector wages.
In late April handle
Additions and deletions to check the function of the monthly wage of employees in the sector.
5 payroll queries
History is a query, you can query an employee's wages in a month.
Statistics management
Unified management of query employee information, including comprehensive statistical information, employee integration statistics, personnel information system, personnel records.
1 General Information Statistics
Month of birth, and other information based on positive employee unified management.
2 Employees Statistics Points
Find points of employee according to the dates.
3 personnel information statistics
The same query management staff can information on sex, salary, job title and other employees based on the query.
4 personnel records
Unified management of staff integration, that integration can query information by department, month and so on.
System Management
Some of the operating system, and other administrators, including basic information settings, system management, operator management, backup and recovery data, initialize the database.
1 Basic settings
Additions and deletions to set up management department, position, title, reward and punishment rules and rights groups, and projects change search.
2 System Management
Some settings on the system itself.
3 Operation Log Management
Records manager operation information on the data.
4 Operator Management
Basic information of an administrator to manage, and additions and deletions to function.
5 data backup and recovery
Employee data can be backed up data, and restore at the appropriate time.
6 initialize the database
The operation of the entire information database initialization.
Second, the database table design
vhr users of the system can be broadly divided into two categories, one is the system administrator, the other one is to have all kinds of rights hr staff.
vhr a total of 21 tables, where the core of the five tables:
hr Table
role role table
User roles associated table [hr_role]
Three front table defines the objects used vhr and authority have,
In a first example hr id 3 for the system administrator user role association table rid of 6, 6 and the corresponding role in the table is the system administrator privileges.
The following two tables menus and menu table defines the roles associated with specific roles have permission.
menu table
menu_role Table
This role requires a combination of the two tables to analyze the table, or in the hr Table 3 user id for example, rid the menu_role for 3 corresponding to 7,7 mid to access content in the menu table only basic information, then the user It may be a general staff. And so on, the author in the document drew a picture very vivid interpretation of the relationship between these five tables:
The remaining functions of the table when looking down and then get to know it.
Third, the dismantling project
Login Module
I do not know how to deal with the start of the project, but fortunately in the library to borrow a book SpringBoot + Vue, practical introduction to database to log on to the module.
In the absence of ideas, let's start here to start it.
Prior studies login module, of course, is to extend the program up and running first.
clone, then opened with IDEA.
The first step is to modify the database configuration
First, building a database, create it in the vhr.sql in MySQL. [MySQL Version: 8.0]
For personal habits,
The properties changed yaml,
SpringBoot change to the version 2.1.8,
Druid change to the version 1.1.20, incidentally configuration Druid monitoring.
- About application.yaml
spring:
datasource:
# 数据源基本配置
username: noneplus
password: Noneplus564925080!
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://xx.xxx.xxx.xx:3306/vhr?serverTimezone=UTC
type: com.alibaba.druid.pool.DruidDataSource
# Druid数据源配置
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
mail:
host: smtp.qq.com
port: 465
username: [email protected]
password: fhmvfkwxjwmzhhjd
default-encoding: UTF-8
properties:
mail:
debug: true
stmp:
socketFactory:
class: javax.net.ssl.SSLSocketFactory
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
pageSizeZero: false
server:
port: 8082
######################################################################################
# 原application.properties
##MySQL配置
# spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# spring.datasource.url=jdbc:mysql://47.103.6.247:3306/vhr?useUnicode=true&characterEncoding=UTF-8
# spring.datasource.username=noneplus
# spring.datasource.password=Noneplus564925080!
# #MyBatis日志配置
# mybatis.config-location=classpath:/mybatis-config.xml
# #Redis配置
# spring.redis.database=0
# spring.redis.host=192.168.66.130
# spring.redis.port=6379
# spring.redis.password=123@456
# spring.redis.jedis.pool.max-active=8
# spring.redis.jedis.pool.max-idle=8
# spring.redis.jedis.pool.max-wait=-1ms
# spring.redis.jedis.pool.min-idle=0
# #缓存配置
# spring.cache.cache-names=menus_cache
# spring.cache.redis.time-to-live=1800s
# #端口配置
# server.port=8082
#
# spring.mail.host=smtp.qq.com
# spring.mail.port=465
# [email protected]
# spring.mail.password=fhmvfkwxjwmzhhjd
# spring.mail.default-encoding=UTF-8
# spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
# spring.mail.properties.mail.debug=true
- pom modified part
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.20</version>
</dependency>
Monitor configuration DruidConfig
In a new config package DruidConfig
package org.sang.config; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support.http.WebStatFilter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.sql.DataSource; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @Configuration public class DruidConfig { //加载application.yaml中的Druid配置 @ConfigurationProperties(prefix = "spring.datasource") @Bean public DataSource druid(){ return new DruidDataSource(); } //配置Druid的监控 //1、配置一个管理后台的Servlet @Bean public ServletRegistrationBean statViewServlet(){ ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*"); Map<String,String> initParams = new HashMap<>(); initParams.put("loginUsername","hq"); initParams.put("loginPassword","564925080"); initParams.put("allow","");//默认就是允许所有访问 initParams.put("deny","192.168.15.21"); bean.setInitParameters(initParams); return bean; } //2、配置一个web监控的filter @Bean public FilterRegistrationBean webStatFilter(){ FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter(new WebStatFilter()); Map<String,String> initParams = new HashMap<>(); initParams.put("exclusions","*.js,*.css,/druid/*"); bean.setInitParameters(initParams); bean.setUrlPatterns(Arrays.asList("/*")); return bean; } }
Configuration Druid monitor, configure log4j rely
<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>
log4j.properties [Configuration] In the resource path
# Configure logging for testing: optionally with log file log4j.rootLogger=WARN, stdout # log4j.rootLogger=WARN, stdout, logfile log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.logfile=org.apache.log4j.FileAppender log4j.appender.logfile.File=target/spring.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
Start test project
Visit: http: // localhost: 8082 / index.html # /
Druid test monitoring, visit: http: // localhost: 8082 / druid /
[Note: you need to log in before accessing the Druid Monitoring get permission, and later re-visit Druid]
Code reference
[Tips: Follow-up will update the code, in order to facilitate testing, will lay a different node]
https://github.com/Noneplus/vhr/releases/tag/v1.0