[Jinzan] [Login]
297

學習帳號不在籍處理

雲端校務系統中學生異動可能是因轉學造成短期空檔不在籍 所以在判斷停用後, 時間註記在 syncAccount.getDa

Full Link //n.sfs.tw/16260

Copy Link 學習帳號不在籍處理@igogo
(Welcome to reprint and indicate the source when reproducing.)
2024-09-24 14:25:11 Last edition
2023-10-04 15:00:54 By igogo
 

 

 

雲端校務系統中學生異動可能是因轉學造成短期空檔不在籍

所以在判斷停用後, 時間註記在 syncAccount.getDataTimestamp()

超過30天未更新且又是停用者, 先寄mail通知

超過90天後,

找出 account 為停用 且 syncAccount.getDataTimestamp() 超過90天者及syncAccount.getOutOfStudyTimestamp() == 0

執行停權並將syncAccount.setOutOfStudyTimestamp() 設為執行時間

 

學生回復學籍時, syncAccount.getOutOfStudyTimestamp() 再標記為0

 

部份程式


  List<SyncAccount> syncAccounts = syncAccountService.findByOutofStudyConditionBefore(100);

        syncAccounts.forEach(syncAccount -> {
            Instant instant = Instant.ofEpochSecond(syncAccount.getDataTimestamp());
            ZonedDateTime present = instant.atZone(ZoneId.of("Asia/Taipei"));  //taipei時區
            Account account = accountDAO.findAccountByPID(syncAccount.getPid());
            UserName userName = accountUtilsService.getUserName(account);

            User user = null;
            try {
                user = userService.getUser(syncAccount.getGoogle_account());


                logger.info(account.getGoogle_account() + ",is suspended? " + user.getSuspended());

                if (user.getSuspended() == false) {
                    logger.info("set user suspensed: " + account.getGoogle_account());
                    user.setOrgUnitPath("/停用");
                    user.setSuspended(true);
                }

                userName.setFamilyName("停用");
                user.setName(userName);
                user = userService.update(user);



                //學習帳號列表
                StUser stUser = syncStUserService.findStUserByEmail(syncAccount.getGoogle_account());
                stUser.setFullname(userName.getFamilyName() + userName.getFullName());
                stUser.setUpdateTimestamp(Instant.now().getEpochSecond());
                stUser.setOrgUnitPath("/停用");
                stUser.setSuspended(true);
                syncStUserService.save(stUser);


                //資料庫帳號更新參照
                syncAccount.setName(userName.getFamilyName() + userName.getFullName());
                syncAccount.setOutOfStudyTimestamp(Instant.now().getEpochSecond());
                syncAccountService.save(syncAccount);


            } catch (Exception e) {
                throw new RuntimeException(e);
            }


        });

 

 

 

END

You may be interested

學習帳號不在籍處理 雲端校務系統中學生異動可能是因轉學造成短期空檔不在籍 所以在判斷停用後, 時間註記在 syncAccount.getDa

Say something

>>

Limit: Max 1000 characters, over will be truncated. Limit: Not logined guest, the interval should last no less than 10 minutes between each post, 5 posts in each day

Message

[no message]

random articles

tmux 將終端機切割成多個視 窗 tmux, multiple terminal

2018 hoc 頒獎 校慶到了,啦啦隊比賽如火如荼展開,學務主任將頒發獎狀給表現優異的班級。請完成以下程式碼,讓程式將啦啦隊表演成績由高至低依序輸出。

讀取特定資料夾下的xls檔 讀取特定資料夾下的xls檔

將google試算表當作簡易資料庫,利用Google apps cript 在網頁上操作查詢 將google試算表當作簡易資料庫,利用apps cript 在網頁上操作查詢 若我有一試算表資料 縣市 status

Google sheet 建立成績單的總分及排名並提供名字下拉查詢 Google sheet, sum, rank, pull down list