From 3b648e56405de2509a822e1de559a6b3d58851e9 Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Fri, 16 Dec 2022 16:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=BF=9B=E5=BA=A6=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xim/myutils/account/CpicXIMStaffInfo.java | 73 ++++++++++++++++++- .../xim/myutils/account/LdapAccountCheck.java | 10 ++- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/CpicXIMStaffInfo.java b/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/CpicXIMStaffInfo.java index dfcbbb8..eca6ed6 100644 --- a/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/CpicXIMStaffInfo.java +++ b/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/CpicXIMStaffInfo.java @@ -2,7 +2,7 @@ * @Author: Kane * @Date: 2022-12-15 14:08:28 * @LastEditors: Kane - * @LastEditTime: 2022-12-16 15:20:32 + * @LastEditTime: 2022-12-16 16:15:24 * @FilePath: \AdminSys\src\main\java\com\cpic\xim\myutils\account\CpicXIMStaffInfo.java * @Description: 产险厦门分公司员工信息对象 * @@ -10,11 +10,80 @@ */ package com.cpic.xim.myutils.account; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import com.fasterxml.jackson.annotation.JsonProperty; public class CpicXIMStaffInfo { - CpicXIMStaffInfo() + public static CpicXIMStaffInfo getStaffInfo( String uidOrCode ) + throws SQLException, ClassNotFoundException + { + CpicXIMStaffInfo info = new CpicXIMStaffInfo(); + + Connection connection = null; + PreparedStatement stmt = null; + ResultSet result = null; + + String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1"; + String userName = "dataex"; + String password = "Cpic123456"; + String querySQL = "SELECT ry.staff_code, ry.staff_name, ry.p13uid " + + " FROM idst0.rydm_t ry WHERE ry.account_status = 0" + + " AND (ry.staff_code = ? OR ry.p13uid = ?)"; + + try + { + Class.forName( "oracle.jdbc.driver.OracleDriver" ); + + connection = DriverManager.getConnection( jdbcURL, userName, password ); + } + finally + { + try + { + if ( result != null) + { + result.close(); + } + } + catch ( Exception exception ) + { + exception.printStackTrace(); + } + + try + { + if ( stmt != null) + { + stmt.close(); + } + } + catch ( Exception exception ) + { + exception.printStackTrace(); + } + + try + { + if ( connection != null) + { + connection.close(); + } + } + catch ( Exception exception ) + { + exception.printStackTrace(); + } + } + + return info; + } + + private CpicXIMStaffInfo() {} public String getName() diff --git a/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/LdapAccountCheck.java b/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/LdapAccountCheck.java index 1685fd2..37da3a9 100644 --- a/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/LdapAccountCheck.java +++ b/企业级管理系统/java/AdminSys/src/main/java/com/cpic/xim/myutils/account/LdapAccountCheck.java @@ -2,9 +2,9 @@ * @Author: Kane * @Date: 2022-12-15 09:51:12 * @LastEditors: Kane - * @LastEditTime: 2022-12-16 10:57:38 + * @LastEditTime: 2022-12-16 15:29:34 * @FilePath: \AdminSys\src\main\java\com\cpic\xim\myutils\account\LdapAccountCheck.java - * @Description: + * @Description: P13验证相关方法。 * * Copyright (c) ${2022} by Kane, All Rights Reserved. */ @@ -21,6 +21,12 @@ public class LdapAccountCheck { private static String ldapServerUrl = "ldap://10.39.0.205:389"; + /***************************************************** + * 对p13账号密码提交AD域服务器进行验证 + * @param userName p13uid + * @param password p13密码 + * @return 返回验证结果,true为成功,false失败。 + *****************************************************/ public static boolean ldapLogin( String userName, String password ) { boolean result = false;