Sfoglia il codice sorgente

【深爱-4A】【AD域】【初始密码修改,企微通知模板】

DINGYL 2 mesi fa
parent
commit
1fe2af6094
1 ha cambiato i file con 23 aggiunte e 1 eliminazioni
  1. 23 1
      src/main/java/com/uas/eis/serviceImpl/ADSyncService.java

+ 23 - 1
src/main/java/com/uas/eis/serviceImpl/ADSyncService.java

@@ -74,9 +74,19 @@ public class ADSyncService {
                 if(orgOptional.isPresent()){
                     String ouPath = getOUPath(orgOptional.get().getOr_path());
                     String adaccountname = getADID(employee);
-                    String adid = addUser(adaccountname,employee.getEm_name(),ouPath,employee.getEm_password(), employee.getEmjob());
+                    String initPWD = employee.getEm_password();
+                    if(! StringUtil.hasText(initPWD) || initPWD.length() <8 || ! hasThreeCharacterTypes(initPWD)){
+                        //初始密码拼音+系统账号+SI
+                        initPWD = adaccountname+employee.getEm_code()+"SI";
+                    }
+                    String adid = addUser(adaccountname,employee.getEm_name(),ouPath,initPWD, employee.getEmjob());
                     System.out.println(adaccountname+":"+adid);
                     if(adid!=null){
+                        baseDao.execute("insert into UAPPROVALMSG(ID_,TYPE_,TITLE_,MSG_,EMS_) " +
+                                "select UAPPROVALMSG_SEQ.NEXTVAL,'TEXT','AD域开通提醒','"+employee.getEm_name()+" 您的AD(电脑账号)已创建\n" +
+                                "账号:si\\"+adaccountname+"\n" +
+                                "初始密码:"+initPWD+"',em_qywx" +
+                                " from  employee where em_code='"+employee.getEm_code()+"' and  em_qywx is not null");
                         baseDao.updateByCondition("employee","em_adid='"+adid+"',em_adaccountname='"+adaccountname+"'","em_code='"+employee.getEm_code()+"'");
                     }
                 }
@@ -582,4 +592,16 @@ public class ADSyncService {
         Object accountid= baseDao.getFieldDataByCondition("dual","get_4a_id('"+employee.getEm_code()+"','"+PinyinUtils.getCustomPinyin(employee.getEm_name())+"','AD')","1=1");
         return String.valueOf(accountid);
     }
+    public boolean hasThreeCharacterTypes(String password) {
+        int typeCount = 0;
+        // 检查是否包含大写字母
+        if (password.matches(".*[A-Z].*")) typeCount++;
+        // 检查是否包含小写字母
+        if (password.matches(".*[a-z].*")) typeCount++;
+        // 检查是否包含数字
+        if (password.matches(".*[0-9].*")) typeCount++;
+        // 检查是否包含特殊符号(非字母数字)
+        if (password.matches(".*[^A-Za-z0-9].*")) typeCount++;
+        return typeCount >= 3;
+    }
 }