[精讚] [會員登入]
498

學習帳號不在籍處理

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

分享此文連結 //n.sfs.tw/16260

分享連結 學習帳號不在籍處理@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2024-09-24 14:25:11 最後編修
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

你可能感興趣的文章

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

隨機好文

apache 反向代理 80轉443轉8080 apache, proxy pass

臺中市雲端校務系統與Windows AD帳號整合(3) LDAP的基本概念

台中市網路應用競賽試場安排(一) 排試場就跟排班或是排課表一樣, 找不到一個都能讓所有人滿意的結果

台中市校園空氣品質預警 aqi

使用poi 解析 docx 原先是想解析出在docx 中的文字跟圖片, 但是, 有些我們認為是圖片, 其實是用方程式表示, 實在是太麻煩了 就記錄一