0.5 · ฟีเจอร์หลัก 20 ตัว
บทนี้ list ฟีเจอร์หลักของระบบ เพื่อให้รู้ว่า "ถ้า HR พูดถึง X มันอยู่ในโค้ดตรงไหน"
ไม่ใช่ list ทั้งหมด — เป็นแค่ 20 อันที่ user ใช้บ่อยที่สสุด รายการทั้งหมดอยู่ใน typeDefs 43 ไฟล์ของ vtrc-api (ดู Volume 3 และ Volume 11)
รายการ 20 ฟีเจอร์
| # | ฟีเจอร์ | พนักงาน | HR | Code หลัก |
|---|---|---|---|---|
| 1 | Authentication / Login | ✓ | ✓ | vtrc-api/api/src/typeDefs/authentication.js |
| 2 | JWT refresh + session | ✓ | ✓ | vtrc-api/api/src/lib/repositories/session/session.js |
| 3 | Payslip (ดูสลิปเงินเดือน) | ✓ | vtrc-api/api/src/typeDefs/slip.js + centralize/controllers/slip.js → cu-central | |
| 4 | Tax (ภาษี ปี/6 เดือน/หลายปี) | ✓ | vtrc-api/api/src/typeDefs/slip.js (fetchUrlTax*) | |
| 5 | Leave (การลา 12 ประเภท) | ✓ | ✓ | vtrc-api/api/src/typeDefs/hrmi.js + lib/controllers/hrmi/ |
| 6 | Multi-level approval chain | ✓ | ✓ | vtrc-api/api/src/lib/controllers/hrmi/hrmi.js:60-180 |
| 7 | Hospital Welfare Withdrawal | ✓ | ✓ | vtrc-api/api/src/typeDefs/wdHospital.js |
| 8 | Study Leave / ทุนการศึกษา | ✓ | ✓ | vtrc-api/api/src/typeDefs/studyLeave*.js |
| 9 | Child Tuition (ค่าเล่าเรียนบุตร) | ✓ | ✓ | vtrc-api/api/src/typeDefs/childTuition.js |
| 10 | Time Attendance | ✓ | ✓ | vtrc-api/api/src/typeDefs/timeAttendance.js → cu-central |
| 11 | Provident Fund | ✓ | ✓ | vtrc-api/api/src/typeDefs/providentFund.js |
| 12 | Delegate (ผู้รับมอบฉันทะ) | ✓ | ✓ | vtrc-api/api/src/typeDefs/delegate.js |
| 13 | Policy (นโยบายคุณภาพ) | ✓ | ✓ | vtrc-api/api/src/typeDefs/policy.js |
| 14 | News / Post | ✓ | ✓ | vtrc-api/api/src/typeDefs/post.js + notification.js |
| 15 | Document (คลังเอกสาร) | ✓ | ✓ | vtrc-api/api/src/typeDefs/document.js |
| 16 | Contact Us | ✓ | ✓ | vtrc-api/api/src/typeDefs/contactUs.js |
| 17 | Profile | ✓ | ✓ | vtrc-api/api/src/typeDefs/profile.js + user.js |
| 18 | Bank Export (KBANK) | ✓ | vtrc-api/api/src/config.js:488-518 (statusKcash) | |
| 19 | Excel Import / Export | ✓ | vtrc-api/api/src/routes.js (GET /download/excel/:table) + lib/controllers/excel/ | |
| 20 | RBAC + Menu Access | ✓ | vtrc-api/api/src/directives/auth.js + config.js |
ฟีเจอร์ 5 · Leave (การลา) — 12 ประเภท
ประเภทการลาทั้งหมดไม่ได้ hardcode ใน code แต่อยู่ในตาราง MasterData ที่ HR แก้ไขได้ ประเภทที่พบบ่อย
- ลาป่วย
- ลากิจ
- ลาพักผ่อน
- ลาคลอด
- ลาทหาร (เกณฑ์)
- ลาไปศึกษา
- ลาไปอบรม (conicle)
- ลาเพื่ออุปสมบท
- ลาเพื่อช่วยภริยาคลอด
- ลาเพื่อดูแลบุตร
- ลาประจำปี (พิเศษ)
- ลาอื่นๆ
กฎเกณฑ์ (max/min days, advance/retroactive windows) อยู่ใน lib/controllers/hrmi/hrmi.js:1295-1319 — เป็น logic ที่ตรวจก่อนบันทึกคำขอใหม่
ฟีเจอร์ 7 · Hospital Welfare Withdrawal — ความสัมพันธ์ที่เบิกได้
พนักงานเบิกค่ารักษาให้คนในความสัมพันธ์ต่อไปนี้ได้
| Code | ความสัมพันธ์ | หมายเหตุ |
|---|---|---|
00 | ตัวเอง | self-claim |
10 | บิดา | |
20 | มารดา | |
70 | คู่สมรส | |
81–85 | บุตรคนที่ 1–5 | สูงสุด 5 คน — hardcode policy |
policy "สูงสุด 5 บุตร" อยู่ใน vtrc-api/api/src/config.js:392-429 (relationHrmi)
ฟีเจอร์ 10 · Time Attendance — flow ผ่าน cu-central
vtrc-web
│
│ GraphQL timeAttendanceByDate(date)
▼
vtrc-api
│ lib/repositories/timeAttendance → centralize/controllers/timeAttendance.js
│ GraphqlCDWithToken → END_POINT_CENTRALIZE
▼
cu-central-api (GraphQL)
│
│ คิวรี่ MSSQL (HR time)
▼
response → vtrc-weblive path ไม่ผ่าน NestJS centralize-api และไม่พึ่ง Redis write-through บน path นี้ใน vtrc-api
ฟีเจอร์ที่ "มีแต่ไม่เด่น"
Conicle (คอนิเคิล)
ระบบ training/learning ภายนอก APP_TYPE: INTEGRATE_APP — หน้าที่อนุญาตมีจำกัด
// vtrc-api/api/src/config.js
CONICLE_PAGE: ['MyLibrary', 'LearningRequest', 'Home']Twoway Sync
APP_TYPE: TWOWAY — sync ข้อมูลสองทิศทางกับ HRMI (รายละเอียดใน cu-central-api/main-api/src/lib/twoWay/)
Meeting
APP_TYPE: MEETING — ระบบจัดการประชุม
Plasma & CU re-structure
มี KEY_PLASMA ('47837e2d-7788-4a1a-8e24-a90abf6742f4') และ KEY_CU_H ('CU-RE-STRUCTURE-ID-02') ใน config.js:152-154 เป็น hardcoded identifiers สำหรับกลุ่มพนักงานพิเศษ — ความหมายเชิง business ถาม HR เท่านั้น
Subsystems ฝั่ง backoffice
backoffice ไม่ใช่แค่ HR หลัก แต่รวม subsystems หลายตัวเข้าด้วยกัน (เห็นได้จาก axios instances 15 ตัวใน src/config/ — ไฟล์ axios*.js)
| Subsystem | หน้าใน backoffice | axios config |
|---|---|---|
| PMS | pages/PMS/, pages/PmsAssessment/, pages/PmsIndicators/ | axios-pms.js |
| Recruitment | pages/Recruitment/ | axios-recruitment.js, axios-recruitment-upload.js |
| WorkForce | pages/WorkForce/ | axios-workforce.js, apollo-workforce.js |
| Meeting | pages/Meeting/ | axios-meeting.js |
| Benefit | pages/Benefit/, pages/OtherWelfare/ | axios-benefit.js, axios-benefit-i3.js |
ฟีเจอร์ระบบภายในที่ user มองไม่เห็น
PDF Generation Pipeline
พนักงานขอ PDF
│
▼
vtrc-api (routes.js)
│
├── ejs render (HTML template)
│
├── html-pdf (PhantomJS → PDF)
│
├── qpdf encrypt (password = identityCard)
│
└── ส่ง URL valid 1 ชั่วโมงให้ browsersecurity caveat — execSync(qpdf --encrypt ${password}...) เป็น command injection risk (ดู Volume 15 SEC-1)
Cron Jobs
vtrc-api/api/src/crons.js ใช้ node-schedule รันใน process — ไม่มี HA ถ้า replica ที่รัน cron restart กลางคัน งานนั้นหาย
งานที่รันในไฟล์นี้ (ณ โค้ดปัจจุบัน)
- อัปเดต fund change rate สำเร็จ (
updateSuccessFundChangeRateByJob) — เฉพาะเมื่อAPP_NO === 1 - หมดอายุ delegate (
updateDelegatesExpire) ทุกวัน 03:30 - เก็บ stat log (
statLog) ทุกวัน 00:30
ไม่มี job ดึงผล K-Cash จากธนาคาร — การอัปเดตสถานะหลังโอนทำด้วยการนำเข้าไฟล์ด้วยมือ (importUpdateStatus)
Notification (FCM Push)
ใช้ firebase-admin@^9.2.0 ส่ง push notification ผ่าน Firebase Cloud Messaging ส่วนใหญ่ไปที่ mobile app