Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/DatasyncConstant.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/DatasyncConstant.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/DatasyncConstant.java (revision 31880)
@@ -0,0 +1,47 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.fsszyy;
+
+/**
+ * 佛山市中医院接口相关常量
+ * @author ZhouPeiMian
+ * @since 2021-08-10
+ *
+ */
+public class DatasyncConstant {
+
+ /**
+ * 与卫宁之间基于webservice协议的单点登录接口地址:http://10.46.12.209:8082/ws/sso.wsdl
+ * 登录方式如下:http://追溯系统地址 flag=PTSSO&appid=XDGY&userid=00&captcha=3a0ff203-7ba1-4eec-ba66-4578a0e84c94
+ */
+ public final static String WebserviceAddress = "http://10.46.12.209:8082/ws/sso.wsdl";
+
+ /**
+ * 登录标志:首次登录时为1
+ */
+ public final static String LOGINFLAG_1 = "1";
+
+ /**
+ * 登录标志:非首次登录为2
+ */
+ public final static String LOGINFLAG_2 = "2";
+
+ /**
+ * 1、登录安全验证 的方法名称: 业务系统被启动之后需调用认证服务的验证服务,以确保此次启动是合法的。
+ */
+ public final static String FUNCTION_NAME_LOGINVERIFY = "LoginVerify";
+
+ /**
+ * 2、注册用户信息 的方法名称: 首次登录时,业务系统验证本地系统的用户名和密码成功后,将登录的用户ID和用户名称通过服务注册到平台。
+ */
+ public final static String FUNCTION_NAME_LOGININFOREGISTER = "LoginInfoRegister";
+
+ /**
+ * 状态码,AA:成功 AE:失败
+ */
+ public final static String RETCODE_SUCC = "AA";
+
+ /**
+ * 状态码,AA:成功 AE:失败
+ */
+ public final static String RETCODE_FAIL = "AE";
+
+}
Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/WebServiceClientHelper.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/WebServiceClientHelper.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/WebServiceClientHelper.java (revision 31880)
@@ -0,0 +1,119 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.fsszyy;
+
+import java.nio.charset.Charset;
+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;
+import org.dom4j.Document;
+import org.dom4j.Node;
+import org.dom4j.XPath;
+
+import com.forgon.exception.SystemException;
+
+/**
+ * 佛山市中医院webservice帮助类
+ * @author ZhouPeiMian
+ * @since 2021-08-10
+ *
+ */
+public class WebServiceClientHelper {
+
+ public static Logger logger = Logger.getLogger(WebServiceClientHelper.class);
+
+ /**
+ * 根据document和Xpath表达式解析数据
+ * @param document
+ * @param nameSpaceURIMap
+ * @param xpathExp
+ * @return
+ */
+ public static String processDataByXpath(Document document, String xpathExp) {
+ if ((StringUtils.isNotBlank(xpathExp)) && (document != null)) {
+ XPath xpath = document.createXPath(xpathExp);
+ Node node = xpath.selectSingleNode(document);
+ if (node != null) {
+ return node.getStringValue();
+ }
+ }
+ return null;
+ }
+
+ public static String buildInputStr(String function, String appid, String loginid, String captcha){
+ StringBuffer inputSb = new StringBuffer();
+ if(StringUtils.equals(function, DatasyncConstant.FUNCTION_NAME_LOGINVERIFY)){
+
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("" + appid + "");
+ inputSb.append("" + loginid + "");
+ inputSb.append("");
+ inputSb.append("" + captcha + "");
+ inputSb.append("");
+
+ inputSb.append("]]>");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+ inputSb.append("");
+
+ return inputSb.toString();
+ }else{
+ throw new SystemException("FunctionName错误:" + function);
+ }
+ }
+
+ /**
+ * 使用SOAP1.2发送消息
+ * @param postUrl
+ * @param soapXml
+ * @param soapAction
+ * @return
+ */
+ public static String doPostSoap1_2(String postUrl, String soapXml, String soapAction) {
+ String retStr = "";
+ // 创建HttpClientBuilder
+ HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
+ // HttpClient
+ CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
+ HttpPost httpPost = new HttpPost(postUrl);
+ // 设置请求和传输超时时间
+ RequestConfig requestConfig = RequestConfig.custom()
+ .setSocketTimeout(3000000)
+ .setConnectTimeout(3000000).build();
+ httpPost.setConfig(requestConfig);
+ try {
+ httpPost.setHeader("Content-Type", "application/soap+xml;charset=UTF-8;");
+ httpPost.setHeader("SOAPAction", soapAction);
+ StringEntity data = new StringEntity(soapXml,Charset.forName("UTF-8"));
+ httpPost.setEntity(data);
+ CloseableHttpResponse response = closeableHttpClient.execute(httpPost);
+ HttpEntity httpEntity = response.getEntity();
+ if (httpEntity != null) {
+ // 打印响应内容
+ retStr = EntityUtils.toString(httpEntity, "UTF-8");
+ retStr = retStr.replaceAll("<", "<");
+ retStr = retStr.replaceAll(">", ">");
+ }
+ // 释放资源
+ closeableHttpClient.close();
+ } catch (Exception e) {
+ logger.info("exception in doPostSoap1_2:" + e);
+ }
+ return retStr;
+ }
+
+}
Index: ssts-web/src/main/webapp/logonSSOForFsszyy.jsp
===================================================================
diff -u
--- ssts-web/src/main/webapp/logonSSOForFsszyy.jsp (revision 0)
+++ ssts-web/src/main/webapp/logonSSOForFsszyy.jsp (revision 31880)
@@ -0,0 +1,196 @@
+<%@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.fsszyy.SSOAuthenticationDao"%>
+
+<%
+ArrayList message = new ArrayList();
+String appid = request.getParameter("appid");
+String userid = request.getParameter("userid");
+// 登录验证需要的参数
+String captcha = request.getParameter("captcha");
+if(StringUtils.isNotBlank(appid) && StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(captcha)){
+ try{
+ SSOAuthenticationDao ssoAuthenticationDao = (SSOAuthenticationDao)SpringBeanManger.getBean("ssoAuthenticationDao");
+ boolean result = ssoAuthenticationDao.authentication(appid, userid, captcha);
+ if(result){
+ UserManager userManager=(UserManager)SpringBeanManger.getBean("userManager");
+ User user = userManager.getFirst("name", userid);
+ 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 -r31653 -r31880
--- ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 31653)
+++ ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 31880)
@@ -46,6 +46,7 @@
+
Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDaoImpl.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDaoImpl.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDaoImpl.java (revision 31880)
@@ -0,0 +1,73 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.fsszyy;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+
+/**
+ * 佛山市中医院单点登录接口
+ * @author ZhouPeiMian
+ * @since 2021-08-10
+ */
+public class SSOAuthenticationDaoImpl implements SSOAuthenticationDao {
+
+ private static final Logger logger = Logger.getLogger(SSOAuthenticationDaoImpl.class);
+
+ @Override
+ public boolean authentication(String appid, String userid, String captcha) throws Exception {
+ String retCode = loginVerify(appid, userid, captcha);
+ return StringUtils.equals(retCode, DatasyncConstant.RETCODE_SUCC);
+ }
+
+ private String loginVerify(String appid, String userid, String captcha) throws Exception{
+ String postUrl = DatasyncConstant.WebserviceAddress;
+ logger.info("登录安全验证接口地址:" + postUrl);
+ String soapXml = WebServiceClientHelper.buildInputStr(DatasyncConstant.FUNCTION_NAME_LOGINVERIFY, appid, userid, captcha);
+ logger.info("登录安全验证接口的请求信息:" + soapXml);
+ String soapAction = "http://tempuri.org/LoginVerify";
+ String result = WebServiceClientHelper.doPostSoap1_2(postUrl, soapXml, soapAction);
+ logger.info("登录安全验证接口的返回信息:" + result);
+ // 解析接口返回发结果
+ String retCode = getRetCode(result);
+ return retCode;
+ }
+
+ /**
+ * 解析接口返回的结果
+ * @param result
+ * @return
+ * @throws Exception
+ */
+ private String getRetCode(String result) throws Exception {
+ int startIndex = result.indexOf("标签");
+ }
+ String xmlString = result.substring(startIndex + "".length(), endIndex);
+ if(StringUtils.isBlank(xmlString)){
+ logger.info("接口返回信息为空!" + xmlString);
+ throw new RuntimeException("接口返回信息为空!" + xmlString);
+ }
+ xmlString = StringEscapeUtils.unescapeXml(xmlString);
+ xmlString = "" + xmlString + "";
+ Document document = DocumentHelper.parseText(xmlString);
+ String retcodeXpathExp = "/output/retcode";
+ String msgXpathExp = "/output/msg";
+ String retcode = WebServiceClientHelper.processDataByXpath(document, retcodeXpathExp);
+ String msg = WebServiceClientHelper.processDataByXpath(document, msgXpathExp);
+ if(StringUtils.equals(retcode, DatasyncConstant.RETCODE_FAIL)){
+ // 状态码为AE(验证失败)时,需要把“失败原因”显示出来
+ throw new RuntimeException(msg);
+ }
+ return retcode;
+ }
+
+}
Index: ssts-web/src/main/webapp/disinfectsystem/config/fsszyy/spring/sso.xml
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/config/fsszyy/spring/sso.xml (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/config/fsszyy/spring/sso.xml (revision 31880)
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDao.java
===================================================================
diff -u
--- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDao.java (revision 0)
+++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/fsszyy/SSOAuthenticationDao.java (revision 31880)
@@ -0,0 +1,20 @@
+package com.forgon.disinfectsystem.datasynchronization.dao.fsszyy;
+
+/**
+ * 佛山市中医院单点登录接口
+ * @author ZhouPeiMian
+ * @since 2021-08-10
+ */
+public interface SSOAuthenticationDao {
+
+ /**
+ * 身份验证,验证通过返回true,否则返回false
+ * @param appid 业务系统的id(XDGY)
+ * @param userid 平台中统一用户的ID
+ * @param captcha 登录时平台传入的验证码
+ * @return
+ * @throws Exception
+ */
+ public boolean authentication(String appid, String userid, String captcha) throws Exception;
+
+}