|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.manage.controller;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.docus.soap.api.SoapAPISettings;
|
|
|
|
|
import com.docus.soap.api.request.zsyy.GetLoginInfoRequest;
|
|
|
|
@ -30,8 +31,11 @@ import org.apache.http.HttpEntity;
|
|
|
|
|
import org.apache.http.HttpResponse;
|
|
|
|
|
import org.apache.http.client.ClientProtocolException;
|
|
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
|
|
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.impl.client.HttpClients;
|
|
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
|
|
import org.dom4j.Document;
|
|
|
|
@ -101,6 +105,8 @@ public class FontController {
|
|
|
|
|
private PageServiceImpl pageService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Power_Sys_DictMapper sysDictMapper;
|
|
|
|
|
@Value("${POWER_PORT}")
|
|
|
|
|
private String POWER_PORT;
|
|
|
|
|
@Autowired
|
|
|
|
|
private LogService logService;
|
|
|
|
|
@Value("${TOKEN_EXPIRE_TIME}")
|
|
|
|
@ -114,7 +120,8 @@ public class FontController {
|
|
|
|
|
|
|
|
|
|
@Value("${WEBSOCKET_URLHEAD}")
|
|
|
|
|
private String WEBSOCKET_URLHEAD;
|
|
|
|
|
|
|
|
|
|
@Value("${EMRMEDICALRECORD_IP}")
|
|
|
|
|
private String ip;
|
|
|
|
|
@Value("${wsdlUrl}")
|
|
|
|
|
private String wsdlUrl;
|
|
|
|
|
@Value("${operationName}")
|
|
|
|
@ -131,6 +138,10 @@ public class FontController {
|
|
|
|
|
private String getLoginUserInfoUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${gzSingleUrl}")
|
|
|
|
|
private String gzSingleUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Class getUserClass(Object root) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -1245,6 +1256,7 @@ public class FontController {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 厦门中山医院获取二维码
|
|
|
|
|
* @author linjj
|
|
|
|
@ -1270,6 +1282,7 @@ public class FontController {
|
|
|
|
|
soapAPISettings.setUri(wsdlUrl);
|
|
|
|
|
return soapAPISettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 厦门中山医院监听用户扫码状态
|
|
|
|
|
* @author linjj
|
|
|
|
@ -1277,12 +1290,13 @@ public class FontController {
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("getQueryQRCode")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public GetQueryQRCodeResponse getQueryQRCode(String qrCode){
|
|
|
|
|
public GetQueryQRCodeResponse getQueryQRCode(String qrCode) {
|
|
|
|
|
GetQueryQRCodeRequest request = new GetQueryQRCodeRequest();
|
|
|
|
|
request.setQrCode(qrCode);
|
|
|
|
|
GetQueryQRCodeResponse queryQRCode = xmzsyyqrCodeAPIService.getQueryQRCode(request, queryQRCodeUrlAndName());
|
|
|
|
|
return queryQRCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 厦门中山医院获取用户扫码状态接口连接
|
|
|
|
|
* @author linjj
|
|
|
|
@ -1298,24 +1312,24 @@ public class FontController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 厦门中山医院扫码登录认证接口
|
|
|
|
|
* @params: idCard
|
|
|
|
|
* @params: idCard
|
|
|
|
|
* @author linjj
|
|
|
|
|
* @date: 2023/5/24 15:45
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "XMZSYYlogin",method = RequestMethod.POST)
|
|
|
|
|
public String XMZSYYlogin(Power_User powerUser, HttpServletResponse response, HttpServletRequest request, Model model){
|
|
|
|
|
@RequestMapping(value = "XMZSYYlogin", method = RequestMethod.POST)
|
|
|
|
|
public String XMZSYYlogin(Power_User powerUser, HttpServletResponse response, HttpServletRequest request, Model model) {
|
|
|
|
|
try {
|
|
|
|
|
Power_UserVo user = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
if (user != null) {
|
|
|
|
|
loginByPowerUser(user);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
//在账号不存在时同步用户信息
|
|
|
|
|
powerUserService.insertUserName(powerUser);
|
|
|
|
|
//新增用户重新登录
|
|
|
|
|
Power_UserVo userNew = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
loginByPowerUser(userNew);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
CacheManager.addExcCount("exc");
|
|
|
|
@ -1324,8 +1338,7 @@ public class FontController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "zsxmHospitalLogin",method = RequestMethod.POST)
|
|
|
|
|
@RequestMapping(value = "zsxmHospitalLogin", method = RequestMethod.POST)
|
|
|
|
|
public String zsxmHospitalLogin(Power_User powerUser) {
|
|
|
|
|
GetLoginInfoRequest getLoginInfoRequest = new GetLoginInfoRequest();
|
|
|
|
|
getLoginInfoRequest.setSys("JSScan");
|
|
|
|
@ -1334,27 +1347,27 @@ public class FontController {
|
|
|
|
|
getLoginInfoRequest.setPassword(powerUser.getUserPwd());
|
|
|
|
|
GetLoginInfoResponse loginInfo = xmzsyyqrCodeAPIService.getLoginInfo(getLoginInfoRequest, getLoginUserInfo());
|
|
|
|
|
if (StringUtils.isNotBlank(loginInfo.getData()) && loginInfo.getData().equals("0")) {
|
|
|
|
|
try {
|
|
|
|
|
Power_UserVo user = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
if (user != null) {
|
|
|
|
|
loginByPowerUser(user);
|
|
|
|
|
}else {
|
|
|
|
|
//在账号不存在时同步用户信息
|
|
|
|
|
powerUserService.insertUserName(powerUser);
|
|
|
|
|
//新增用户重新登录
|
|
|
|
|
Power_UserVo userNew = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
loginByPowerUser(userNew);
|
|
|
|
|
try {
|
|
|
|
|
Power_UserVo user = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
if (user != null) {
|
|
|
|
|
loginByPowerUser(user);
|
|
|
|
|
} else {
|
|
|
|
|
//在账号不存在时同步用户信息
|
|
|
|
|
powerUserService.insertUserName(powerUser);
|
|
|
|
|
//新增用户重新登录
|
|
|
|
|
Power_UserVo userNew = powerUserService.findPowerUserByIdCard(powerUser);
|
|
|
|
|
loginByPowerUser(userNew);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
CacheManager.addExcCount("exc");
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
CacheManager.addExcCount("exc");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "loginDir/login";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String loginByPowerUser(Power_UserVo user){
|
|
|
|
|
private String loginByPowerUser(Power_UserVo user) {
|
|
|
|
|
//设置token缓存
|
|
|
|
|
String date = String.valueOf(DateUtils.getDate());
|
|
|
|
|
String token = Base64.encode(MD5.KL(date));
|
|
|
|
@ -1424,4 +1437,81 @@ public class FontController {
|
|
|
|
|
soapAPISettings.setUri(getLoginUserInfoUrl);
|
|
|
|
|
return soapAPISettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 赣州人民医院单点登录接口
|
|
|
|
|
* @params: ticket单点登录传入票据
|
|
|
|
|
* @author linjj
|
|
|
|
|
* @date: 2024/2/28 10:00
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "gzrmSingleLogin/", method = RequestMethod.POST)
|
|
|
|
|
public String RequestMapping(String ticket) {
|
|
|
|
|
if (StringUtils.isBlank(ticket)) {
|
|
|
|
|
return "单点登录访问时传入的票据不能为空";
|
|
|
|
|
}
|
|
|
|
|
String date = String.valueOf(DateUtils.getDate());
|
|
|
|
|
String token = Base64.encode(MD5.KL(date));
|
|
|
|
|
Power_UserVo powerUserVo=new Power_UserVo();
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// 创建Post请求
|
|
|
|
|
HttpPost httpPost = new HttpPost(gzSingleUrl);
|
|
|
|
|
GzrmSingleLogin gzrmSingleLogin = new GzrmSingleLogin();
|
|
|
|
|
gzrmSingleLogin.setTicket(ticket);
|
|
|
|
|
gzrmSingleLogin.setTicket("http://" + ip + ":" + POWER_PORT + "/power/gatewayPage");
|
|
|
|
|
//json格式转换
|
|
|
|
|
String jsonString = JSON.toJSONString(gzrmSingleLogin);
|
|
|
|
|
StringEntity entity = new StringEntity(jsonString, "UTF-8");
|
|
|
|
|
// post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
|
|
|
|
|
httpPost.setEntity(entity);
|
|
|
|
|
httpPost.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// 响应模型
|
|
|
|
|
CloseableHttpResponse response = null;
|
|
|
|
|
HttpEntity responseEntity = null;
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Post请求
|
|
|
|
|
response = httpClient.execute(httpPost);
|
|
|
|
|
// 从响应模型中获取响应实体
|
|
|
|
|
responseEntity = response.getEntity();
|
|
|
|
|
System.out.println("responseEntity::::" + responseEntity);
|
|
|
|
|
if (responseEntity != null) {
|
|
|
|
|
Document document = DocumentHelper.parseText(EntityUtils.toString(responseEntity));
|
|
|
|
|
//获取根节点,在例子中就是responsedata节点
|
|
|
|
|
Element rootElement = document.getRootElement();
|
|
|
|
|
//获取根节点下的某个元素
|
|
|
|
|
Element authenticationSuccess = rootElement.element("cas:authenticationSuccess");
|
|
|
|
|
//getData返回元素的数据
|
|
|
|
|
if (StringUtils.isBlank((String) authenticationSuccess.getData())){
|
|
|
|
|
return "授权失败";
|
|
|
|
|
}
|
|
|
|
|
//获取根节点下的某个元素
|
|
|
|
|
Element user = rootElement.element("cas:user");
|
|
|
|
|
String userName = (String) user.getData();
|
|
|
|
|
//判断用户是否存在
|
|
|
|
|
powerUserVo = userMapper.casLoginUserName(userName);
|
|
|
|
|
if(Objects.isNull(powerUserVo)){
|
|
|
|
|
return "当前用户不存在";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置进缓存
|
|
|
|
|
ActionScopeUtils.setSessionAttribute("token", token, Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)) / 1000);
|
|
|
|
|
CacheManager.putCache(date, new Cache(date, powerUserVo, TOKEN_EXPIRE_TIME));
|
|
|
|
|
ActionScopeUtils.setSessionAttribute("CURRENT_USER", powerUserVo, Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)) / 1000);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
try {
|
|
|
|
|
// 释放资源
|
|
|
|
|
if (httpClient != null) {
|
|
|
|
|
httpClient.close();
|
|
|
|
|
}
|
|
|
|
|
if (response != null) {
|
|
|
|
|
response.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "redirect:gatewayPage";
|
|
|
|
|
}
|
|
|
|
|
}
|