# Software Design Description ## issue 教師資料需商討出一個可行方案,盡量將人數精確計算出來 審查歷程使用json格式儲存,sql server是提供binary還是字串 區分出變更案件,新聘/續聘案件可變動範圍 ## System Architecture 使用者人數:1,954(資料庫已啟用狀態) 教師數(預估metadata容量,1人最多5kb):23,576(人次) 案件數(預估metadata容量):如下圖 每位教師平均上傳檔案數量: 每位教師平均上傳檔案容量(預估files容量與每年成長): 尖峰使用期間: 回應時間限制(在場與會人員皆抱怨舊系統執行速度): ![總案件數](https://hackmd.io/_uploads/B13jnnYa2.png) ![2022年每月案件數](https://hackmd.io/_uploads/SyLe2hFT3.png) ![2023年每月案件數](https://hackmd.io/_uploads/SkLxhnYTn.png) - 資科司伺服器資源對系統架構的影響 ? - 最多幾台VM - file storage硬碟容量 - metadata database硬碟容量 - AP 記憶體,cpu --- - [x] 一般情況,約2-3台 - window server:1 - linux server:1 - db server:1 - storage server:1 ```mermaid flowchart LR browser --> web web["ASP.Net Web Form"] --> API API --> db subgraph API ["linux container"] Identity["Authenticate API"] Resource["Resource API"] Identity --> Resource Resource --> Identity end subgraph db metadata["metadata database"] end API --> storage subgraph storage files["file storage"] end ``` - 負載叢集(限Container,docker Swarm節點最少3個) - window server:1 - linux server:3 - db server:1 - storage server:1 ```mermaid flowchart LR browser --> nginx subgraph nginx["linux container"] direction LR LB["load balance"] proxy["proxy server"] end nginx --> web["ASP.Net Web Form"] nginx --> swarm subgraph swarm["linux container"] direction LR subgraph identity direction LR Authenticate1 Authenticate2 Authenticate3 end identity -->resource resource -->identity subgraph resource direction LR API1 API2 API3 end end swarm --> db subgraph db["sql server"] direction LR metadata["meatadata database"] end swarm --> storage subgraph storage direction TB File["files storage"] end ``` - 負載叢集(含IIS) - window server:3 - linux server:3 - db server:1 - storage server:1 ```mermaid flowchart LR browser --> nginx subgraph nginx["linux container"] direction LR LB["load balance"] proxy["proxy server"] end nginx --> web subgraph web["IIS"] web1["ASP.Net Web Form1"] web2["ASP.Net Web Form2"] web3["ASP.Net Web Form3"] end nginx --> swarm subgraph swarm["linux container"] direction LR subgraph identity direction LR Authenticate1 Authenticate2 Authenticate3 end identity -->resource resource -->identity subgraph resource direction LR API1 API2 API3 end end swarm --> db subgraph db["sql server"] direction LR metadata["meatadata database"] end swarm --> storage subgraph storage direction TB File["files storage"] end ``` ## use case 主要使用者分為:仲介,聘僱單位,審查單位 - 仲介 需符合就福法34條,符合勞動部規定合法人力仲介機構 仲介帳號開通需透過實質審查後,再交由作業小組建立帳號 與學校契約期限有變時,學校需到部備查 依實際情況申請,契約證明文件上傳,依據起訖期間使用系統 所有契約起訖過期無法再使用帳號,任一契約起訖過期無法對該聘僱單位進行送審操作 使用權限類同聘僱單位子帳號 - 聘僱單位 建立子帳號 建立教師資料 提交聘僱許可資料(新聘/續聘),校內檢核流程(子帳號提交->主帳號檢核->主帳號送出) 聘僱許可資料進行補件 補件逾期退件 補件學校可選擇取消 提交聘僱許可(廢止/變更) 所有教師皆需經過變更申請,才可變更資料;部份欄位可在(新聘/續聘)時變更 仲介與學校是學校設定?還是由作業小組進行設定 實驗學校(聘僱單位),許可有固定期限,一旦逾期停權使用 教師姓名為全英文大寫輸入 - 審查單位 實驗學校有特例,不經過地方政府審查,直接送往中正大學(分為本部管轄、非本部管轄) **補件後希望重新審查流程,而不是回到原審查單位** 聘僱許可需呈現目前在那一個節點處理中 補件期限可由最終審查單位設定,逾期自動退件 下載檔案檔名制式化 - 報表 精確呈現外籍聘僱教師數、案件數 - 願望清單 - [ ] 表單提供Excel下載、匯出 - [x] 上傳介面增加提醒資料上傳容量限制 - [x] 系統提醒登出時間 - [ ] 案件提供批次下載,檔案名稱制式化 - [ ] 系統具備可擴充性,未來可能有海歸子女專班 - [x] 新系統開發時程 - [x] 基本統計報表,月報 --- ## Software Architecture ```mermaid flowchart TB Frontend["ASP.NET WebForm"] -- http reqeust and response --> API["API Specification"] Controllers -- implement --> API subgraph Backend Controllers subgraph Controllers direction TB Authenticate EmploymentLicense Employment Instructor Notice Account end Controllers -- express--> Contracts Controllers -- create --> Command Queries -- read --> Controllers subgraph Applications direction LR subgraph Contracts Response Request end Command -- delivery parameter-->CommandHandler subgraph Commands Command CommandHandler end Queries end CommandHandler -- use --> DomainModel CommandHandler -- use --> Repository CommandHandler -- use --> Queries CommandHandler -- return result--> Controllers CommandHandler -- use --> DomainService subgraph DomainService AuthenticateService FlowGraphService EmploymentService NotifyService FileTransportService end subgraph DomainModel EmploymentLicenseManagement InstructorManagement UserManagement RoleManagement end subgraph Infrastructure direction TB Context Repository -- access --> Mapper Mapper -- mapping --> Context Repository end Context -- Entity changed -->DataBase end DataBase -- no side effect query --> Queries ``` --- ## 功能 - [Account Management Specification](/ihUv92Q3R0aXCVw1cqYIVg) - 帳號管理 - 2FA驗證 - 符合帳號管理原則pecification - 逾期/離職皆停用,重新申請 - 忘記密碼 - 權限管理 - 主帳號擁有建立帳號權限 - 子帳號權限皆小於父階層帳號權限 - 特定使用者限制審查流程中的節點 - 單位管理 - 聘僱單位資料 - 仲介資料 - 審查單位資料 - [Employment License Management Specification](/2bo1GBI2SByJtOL9y75OyQ) - 審查流程 - 設定補件期限 - 依循聘僱單位學制、特例,途經不同審查單位進行操作 - 審查歷程 - FileService - 檔案上傳、下載 - 教師個人資料佐證文件 - 聘僱單位聘僱佐證文件 - 仲介佐證文件 - 表單提供excel下載 - [Instructor management Specification](/W0NtkLPcQly3pPUwcfmVkg) - 教師資料管理 - 個人資料 - 與聘僱單位的合約情形 - NotifyService - 寄信 - 聘僱許可流程寄信 - 帳號通知作業 - ScheduleService - 排程 - 帳號清查 - 補件逾期 - 契約逾期 - 一般系統設定 - 基本設定 - 公告 - stats Report - 報表 - 統計報表,月報 ## 甘特圖 ```mermaid gantt title A Gantt Diagram dateFormat YYYY-MM-DD section 帳號管理 2fa驗證 :a1, 2023-08-29, 5d 帳號管理原則 :a2, after a1, 2d 忘記密碼 :a3, after a2 ,1d section 權限管理 主帳號擁有建立子帳號權限 :b1,2023-09-06, 2d 子帳號權限皆小於父階層帳號權限 :b2,after b1 ,2d 特定使用限制審查流程中的節點 : b3,after b2, 2d 聘僱單位建立,刪除,修改: b4 ,after b3 ,2d 私立就業服務機構建立,刪除,修改: b5 , after b4 , 2d 審查單位資料建立,刪除,修改: b6, after b5, 2d 子單位建立,刪除,修改: b7, after b6 ,2d section 教師資料管理 教師個人資料: c1 ,after b7 ,3d 維護聘僱合約情形: c2,after c1 ,2d section 審查流程 設定補件期限: d1, after c2,2d 聘僱流程: d2, after d1 , 10d 審查歷程: d3 , after d2 ,3d section 檔案上傳下載 設定各節點上傳檔案 :e1 , after d3 ,3d 教師個人資料佐證文件: e2, after e1,2d 聘僱單位聘僱佐證文件:e3, after e2 ,2d 私立就業服務機構佐證文件:e4, after e3 ,2d 表單提供excel下載: e5, after e4,2d section 寄信通知 聘僱許可流程寄信: f1, after e5,2d 帳號通知作業: f2, after f1 ,2d section 一般系統設定 公告設定: g1, after f2 ,2d section 基本報表 統計報表、月報: h1 , after g1 ,4d ``` ## Project Structure - NIRLS.Web - Applications - Contracts - Services - ViewModels - Configurations - Registry - Route - Controllers - Views - NIRLS.API - Applications - Commands - Contracts - Queries - Mappers - Configurations - Registry - Environment - Controllers - LicenseController - InstructorController - AccountController - EmploymentController - AuthenticateController - Notice - NIRLS.Domain - AggregateModels - LicenseAggregate - InstructorAggregate - AccountAggregate - Shared - Enumerations - Primitive - DomainEvent - DomainService - Exception - Shared - Kernel - Data - Query - Repository - UnitOfWork - Domain - Event - Validator - Services - NIRLS.Infrastructure - Repository - DbContext - UnitOfWork