Index: ssts-web/src/main/webapp/logonSSOForZsyy.jsp
===================================================================
diff -u
--- ssts-web/src/main/webapp/logonSSOForZsyy.jsp (revision 0)
+++ ssts-web/src/main/webapp/logonSSOForZsyy.jsp (revision 32540)
@@ -0,0 +1,195 @@
+<%@page import="com.forgon.security.model.User"%>
+<%@page import="com.forgon.disinfectsystem.common.CssdUtils"%>
+<%@page import="com.forgon.security.service.UserManager"%>
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@page import="com.forgon.tools.SpringBeanManger"%>
+<%@page import="com.forgon.tools.Constants"%>
+<%@page import="net.sf.json.JSONObject" %>
+<%@page import="java.io.File" %>
+<%@page import="java.util.ArrayList" %>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="com.forgon.directory.model.LoginInfo"%>
+<%@page import="com.forgon.disinfectsystem.datasynchronization.dao.zsyy.SSOAuthenticationDao"%>
+<%@ include file="/common/taglibs.jsp" %>
+
+<%
+ArrayList message = new ArrayList();
+String accessToken = request.getParameter("accessToken");
+if(StringUtils.isNotBlank(accessToken)){
+ try{
+ String accessTokenValidateURL = "http://168.168.250.161:19101/as/me";
+ SSOAuthenticationDao ssoAuthenticationDao = (SSOAuthenticationDao)SpringBeanManger.getBean("ssoAuthenticationDao");
+ String userName = ssoAuthenticationDao.authentication(accessTokenValidateURL, accessToken);
+ if(userName != null){
+ UserManager userManager=(UserManager)SpringBeanManger.getBean("userManager");
+ User user = userManager.getFirst("name", userName);
+ if(user==null){
+ message.add("用户不存在");
+ }else{
+ session.setAttribute("barcode", user.getBarcode());
+ }
+ }
+ } catch (Exception e) {
+ message.add(e.getMessage());
+ }
+}
+pageContext.setAttribute("message", message);
+
+String companyName = CssdUtils.getSystemSetConfigByName("companyName");
+String companyNameStr = "";
+if(companyName == null || companyName.equals("forgon")){
+ companyNameStr = "©2021 广州孚峻信息技术有限公司 版权所有";
+}else if(companyName.equals("dingxiang")){
+ companyNameStr = "©2021 广州丁香软件有限公司 版权所有";
+}
+session.setAttribute("companyName", companyNameStr);
+String project = CssdUtils.getConfigProperty("project");
+session.setAttribute("profile", project);
+
+String imgPath = "disinfectsystem/config/" + project + "/img/logo_" + project +".png";
+File file = new File(application.getRealPath("/") + imgPath);
+if(file.exists()){
+ request.setAttribute("logoPath",imgPath);
+}else{
+ if(companyName == null || companyName.equals("forgon")){
+ request.setAttribute("logoPath","themes/portalPage/img/logo_Forgon.png");
+ }else if(companyName.equals("dingxiang")){
+ request.setAttribute("logoPath","themes/portalPage/img/logo_dingxiangsoft.png");
+ }
+}
+
+%>
+
+
+
+
+
+
+
+
+消毒供应质量追溯管理系统
+<%-- --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml
===================================================================
diff -u -r32033 -r32540
--- ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 32033)
+++ ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 32540)
@@ -48,6 +48,7 @@
+
Index: ssts-web/src/main/webapp/disinfectsystem/config/zsyy/spring/his.xml
===================================================================
diff -u -r28754 -r32540
--- ssts-web/src/main/webapp/disinfectsystem/config/zsyy/spring/his.xml (.../his.xml) (revision 28754)
+++ ssts-web/src/main/webapp/disinfectsystem/config/zsyy/spring/his.xml (.../his.xml) (revision 32540)
@@ -125,5 +125,10 @@
+
+
+
+
\ No newline at end of file
Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDao.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDao.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDao.java (revision 32540)
@@ -0,0 +1,18 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.zsyy;
+
+/**
+ * 中山大学附属第一医院 单点登录接口 ZSYY-294
+ * @author ZhouPeiMian
+ * @since 2021-11-25
+ */
+public interface SSOAuthenticationDao {
+
+ /**
+ * 身份验证,验证通过用户账号
+ * @param accessToken 用户令牌
+ * @return
+ * @throws Exception
+ */
+ public String authentication(String url, String accessToken) throws Exception;
+
+}
Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDaoImpl.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDaoImpl.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/zsyy/SSOAuthenticationDaoImpl.java (revision 32540)
@@ -0,0 +1,103 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.zsyy;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * 中山大学附属第一医院 单点登录接口 ZSYY-294
+ * @author ZhouPeiMian
+ * @since 2021-11-25
+ */
+public class SSOAuthenticationDaoImpl implements SSOAuthenticationDao {
+
+ private static final Logger logger = Logger.getLogger(SSOAuthenticationDaoImpl.class);
+
+ @Override
+ public String authentication(String url, String accessToken)
+ throws Exception {
+ if(StringUtils.isBlank(url) || StringUtils.isBlank(accessToken)){
+ throw new RuntimeException("参数不能为空!");
+ }
+ logger.info("门户单点登录令牌验证及用户信息请求接口地址:" + url);
+ logger.info("门户单点登录令牌:" + accessToken);
+ // 创建HttpClientBuilder
+ HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
+ // HttpClient
+ CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
+ CloseableHttpResponse response = null;
+ String result = "";
+ try{
+ HttpPost httpPost = new HttpPost(url);
+ // 设置请求和传输超时时间
+ RequestConfig requestConfig = RequestConfig.custom()
+ .setSocketTimeout(3000000)
+ .setConnectTimeout(3000000).build();
+ httpPost.setConfig(requestConfig);
+ httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
+ httpPost.addHeader("Authorization", "bearer " + accessToken);
+ StringEntity data = new StringEntity("");
+ httpPost.setEntity(data);
+ response = closeableHttpClient.execute(httpPost);
+ if(response != null){
+ HttpEntity resEntity = response.getEntity();
+ if(resEntity != null){
+ result = EntityUtils.toString(resEntity,"UTF-8");
+ }
+ }
+ /*result = "{"
+ + "'domainId':'2.16.840.1.113883.4.487.2.1.12',"
+ + "'username':'李四',"
+ + "'sex':'男',"
+ + "'birthDay':1409673600000,"
+ + "'code':'admin',"
+ + "'loginName':'user1',"
+ + "'identityCard':'111',"
+ + "'email':'test24@djhealthunion.com',"
+ + "'phone':'asdfa',"
+ + "'systemUser':'1'"
+ + "}";*/
+
+ logger.info("门户单点登录令牌验证及用户信息请求接口返回信息:" + result);
+ if(StringUtils.isBlank(result)){
+ return null;
+ }
+
+ JSONObject jsonObject = JSONObject.fromObject(result);
+ if(jsonObject == null){
+ return null;
+ }
+
+ return jsonObject.optString("code");
+ }catch(Exception ex){
+ ex.printStackTrace();
+ }finally{
+ //关闭资源
+ if(response != null){
+ try {
+ response.close();
+ }catch (Exception ioe){
+ ioe.printStackTrace();
+ }
+ }
+ if(closeableHttpClient != null){
+ try{
+ closeableHttpClient.close();
+ }catch (Exception ioe){
+ ioe.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+}