一个考勤系统的开发笔记

DutySystem

开发周期7月20号到8月1号,8月20号到8月25号左右

A duty system for xxxxxxx.


Runtime Enviornment

运行环境

Enviornment Version
Laravel 5.4
PHP 7.0.10
MySQL 5.7.17
Nginx 1.11.9

1. Initialize

系统初始化

2. MySQL authentication

account: **

password: **

remote database:

  • IP: **.**.**.**:**
  • Account: **
  • Password: **

Service Logic

业务逻辑

3. Model

模型

  • User
  • Employee
  • Record (For employees)
  • ActionRecord (For admins)
  • CarRecord
  • CardRecord
  • TimeNode
  • DailyCheckStatus
  • HolidayDate
  • AbsenceValidRecord

3.1. Model Relationship

模型间关系

4. Controller

控制器

  • Controller
  • IndexController
  • HomeController
  • RouteController
  • EmployeeController
  • RecordController
  • TimeNodeController
  • ActionRecordController
  • AbsenceValidRecordController

  • Auth

    • RegisterController
    • LoginController
    • ForgetPasswordController
    • ResetPasswordController

5. Middleware

中间件

  • EncryptCookies
  • RedirectIfAuthenticated
  • TrimStrings
  • VerifyCsrfToken

Listener

监听器

6. API

应用程序接口

  • GET / : 返回所有记录界面
  • POST / : 返回指定日期内记录界面

    请求变量:

  • GET /home : 返回普通管理员登录界面

  • GET /superhome : 返回超级管理员登录界面
    <!– – GET /graph : 返回图表界面
  • GET /correct : 返回数据修正界面
  • GET /export : 返回导出excel界面 –>
  • GET /valid : 返回当日出勤情况界面
  • POST /valid : 返回指定某个日期的出勤情况界面

    请求变量:

  • GET /report : 返回月报表界面

  • POST /report : 返回某个指定月份的月报表界面

    请求变量:

  • GET /holidays : 返回假期日历界面

  • GET /holidays/dates : 请求当前的假期信息

    返回 JSON 数据:

  • POST /holidays : 请求指定的假期信息

    请求内容:

    返回 JSON 数据:

  • PUT /holidays : 添加指定的假期日期

    请求变量:

  • DELETE /holidays : 删除指定的假期日期

    请求 JSON 数据:

  • GET /leave : 返回请假界面

  • POST /leave : 请求指定日期的请假信息

    请求变量:

  • PUT /leave : 添加请假信息

    请求变量:

  • DELETE /leave : 删除指定请假信息

    请求变量:

  • GET /timeedit : 返回有效时间编辑界面

  • PUT /timeedit/update : 更改出勤时间设置

    请求变量:

  • GET /employees/{work_number} : 返回某个指定雇员信息

  • PUT /employees/{work_number}/records/{id} : 更改某个指定雇员的某条指定出勤记录

    请求变量:

  • GET /admin/actions : 返回当前管理员操作信息

    返回 JSON 数据:

  • GET /admin/actions/{id} (SuperAdmin ONLY): 返回某个指定管理员的操作信息

  • GET /admin/users (SuperAdmin ONLY): 返回所有管理员信息

    返回 JSON 数据:

  • POST /admin/resetpassword : 重置管理员密码

    请求变量:

7. Database tables

数据表

symbol means
* primary key
^ foreign key

7.1. table name: employees

columns:

ID* name gender eamil phone_number work_title department car_number
1 TripleZ man [email protected] 15240241051 CEO Develop Department null

7.2. table names: records

columns:

ID* employee_id^ check_direction(Y/N) check_method check_time
1 3 1 card 2017-07-21 13:22:13
2 3 0 card 2017-07-21 17:22:13
3 1 1 car 2017-07-22 07:22:13
4 1 0 car 2017-07-22 12:22:13

7.3. table name: users

columns:

ID* name email password admin(Y/N) phone_number created_at updated_at
1 TripleZ [email protected] ****** 1 66666666
2 test [email protected] ****** 0 88888888

7.4. table name: user_action_records

columns:

ID* user_id^ action timestamp
1 1 login 2017-07-23 15:47:35
2 1 logout 2017-07-23 15:47:39

8. Migrations

  • 2014_10_12_000000_create_xx_table

9. Seeds

填充假数据

  • UsersTableSeeder
  • EmployeeSeeder
  • RecordSeeder
  • ActionRecordSeeder
  • CarRecordSeeder
  • CardRecordSeeder
  • TimeNodeSeeder
  • DailyCheckStatusSeeder
  • HolidayDateSeeder
  • AbsenceValidRecordSeeder

记得将需要 seed 的数据在 database/seeds/DatabaseSeeder.php 中注册。

10. Employee Status

雇员状态

  • 正常
  • 迟到
  • 早退
  • 迟到早退
  • 缺勤
  • 事假
  • 病假
  • 暂无

11. Important Timestamp

重要时间戳

  • Global

  • AM

  • PM

11.1. Default Timezone

默认时区

UTC+8 Asia/Shanghai

12. Scheduling task

计划任务

13. note

13.1. Error message:

13.2. Solution

in file: config\database.php

13.3. Change Server Timezone

Add timezone when written data into database!

Caron::now('Asia/Shanghai') OR Carbon::now('CST')

14. Source Code rewrite

14.1. modal position

demand:

make the modal box be at a right position

14.2. positionmethod

find the function ‘Modal.prototype.adjustDialog’ bootstrap.js(in this project is included in public/js/app.js),then replace them as the follow code:

15. Web-view Layouts Design

15.1. general page

function:display all the records ordered by time stamp

demand:

  1. day/week/month
  2. export as excel
  3. correct records
  4. search by employee name

view structure:

15.2. graph page

function: build a calendar, and display each employee duty status.

demand:

  1. a calendar can show as day/week/month.
  2. mark up the time/date that has record

view structure:

15.3. valid records

function: display all records by day.

demand:

  1. display single record(included in and out) of each employee devided by day
  2. should include arrive&leave time,also,a status indicate valid(invalid) should be shown

view structure:

15.4. holiday page(option)

function: mark up holiday.

demand:

  1. decide which day has no duty
  2. mark up the time/date in the calendar view

view structure:

15.5. timeedit page

function:define legal time

demand:

  1. define valid time of records

view structure:

Copyright

版权信息

Copyright (c) 2017 TripleZ Foxwest

Leave a Comment

电子邮件地址不会被公开。 必填项已用*标注