|
|
|
@ -598,28 +598,19 @@ public class FontController {
|
|
|
|
|
@RequestMapping(value="getQRcode")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public QrBean getQRcode(QRcode qRcode, HttpServletRequest request){
|
|
|
|
|
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// 创建Post请求
|
|
|
|
|
HttpPost httpPost = new HttpPost("http://192.168.1.212:8080/cloudkeyserver/api/login/qrcode/nostatus/2CKV1");
|
|
|
|
|
// qRcode.setLoginTypeBitValue(16);
|
|
|
|
|
// qRcode.setType(3);
|
|
|
|
|
// qRcode.setProjectUid("cloudkey-fstth");
|
|
|
|
|
// qRcode.setApplicationId("fstth-wzh");
|
|
|
|
|
System.out.println("qRcode:::::"+qRcode.getApplicationId());
|
|
|
|
|
//json格式转换
|
|
|
|
|
String jsonString = JSON.toJSONString(qRcode);
|
|
|
|
|
System.out.println("jsonString1::::"+jsonString);
|
|
|
|
|
StringEntity entity = new StringEntity(jsonString, "UTF-8");
|
|
|
|
|
System.out.println("jsonString::::"+jsonString);
|
|
|
|
|
// post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
|
|
|
|
|
httpPost.setEntity(entity);
|
|
|
|
|
httpPost.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// 响应模型
|
|
|
|
|
CloseableHttpResponse response = null;
|
|
|
|
|
HttpEntity responseEntity=null;
|
|
|
|
|
String s ="";
|
|
|
|
|
QrBean qrBean=new QrBean();
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Post请求
|
|
|
|
@ -635,11 +626,8 @@ public class FontController {
|
|
|
|
|
String qrCodeIdentity = contentsObject.getString("qrCodeIdentity");
|
|
|
|
|
JSONArray qrCodes = contentsObject.getJSONArray("qrCodes");
|
|
|
|
|
String qrCodeBase64 = qrCodes.getJSONObject(0).get("qrCodeBase64").toString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qrBean.setQrCodeBase64(qrCodeBase64);
|
|
|
|
|
qrBean.setQrCodeIdentity(qrCodeIdentity);
|
|
|
|
|
System.out.println("qrBean::::"+qrBean.getQrCodeIdentity());
|
|
|
|
|
}
|
|
|
|
|
} catch (ClientProtocolException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -671,7 +659,6 @@ public class FontController {
|
|
|
|
|
@RequestMapping(value="getScanCode")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ScanCodeRes getQRcode(ScanCode scanCode, HttpServletRequest request){
|
|
|
|
|
System.out.println("scanCode123::::"+scanCode.getQrCodeIdentity());
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// 创建Post请求
|
|
|
|
@ -739,18 +726,18 @@ public class FontController {
|
|
|
|
|
//json格式转换
|
|
|
|
|
String jsonString = JSON.toJSONString(userCode);
|
|
|
|
|
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;
|
|
|
|
|
UserCodeRes userCodeRes =new UserCodeRes();
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Post请求
|
|
|
|
|
response = httpClient.execute(httpPost);
|
|
|
|
|
// 从响应模型中获取响应实体
|
|
|
|
|
responseEntity = response.getEntity();
|
|
|
|
|
// post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
|
|
|
|
|
httpPost.setEntity(entity);
|
|
|
|
|
httpPost.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// 响应模型
|
|
|
|
|
CloseableHttpResponse response = null;
|
|
|
|
|
HttpEntity responseEntity=null;
|
|
|
|
|
UserCodeRes userCodeRes =new UserCodeRes();
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Post请求
|
|
|
|
|
response = httpClient.execute(httpPost);
|
|
|
|
|
// 从响应模型中获取响应实体
|
|
|
|
|
responseEntity = response.getEntity();
|
|
|
|
|
System.out.println("responseEntity::::"+responseEntity);
|
|
|
|
|
System.out.println("响应状态为:" + response.getStatusLine());
|
|
|
|
|
if (responseEntity != null) {
|
|
|
|
@ -797,23 +784,11 @@ public class FontController {
|
|
|
|
|
public Msg qRCodeLogin(Power_User powerUser, HttpServletResponse response, HttpServletRequest request, Model model){
|
|
|
|
|
try {
|
|
|
|
|
Power_UserVo user = power_userService.findUserName(powerUser);
|
|
|
|
|
System.out.println("user:::::"+user);
|
|
|
|
|
//添加进操作日志
|
|
|
|
|
Power_Log log = new Power_Log();
|
|
|
|
|
if(user != null){
|
|
|
|
|
// //存session密码置空
|
|
|
|
|
//// //是否记住密码功能
|
|
|
|
|
//// MyCookieUtil.remember(request, response);
|
|
|
|
|
//设置token缓存
|
|
|
|
|
String token = UUID.randomUUID().toString();
|
|
|
|
|
//查询归属医院
|
|
|
|
|
/*long start5 = System.currentTimeMillis();
|
|
|
|
|
Power_User_Dict powerUserDict = powerUserDictMapper.selectDictIdByUserId(user.getUserId());
|
|
|
|
|
long end5 = System.currentTimeMillis();
|
|
|
|
|
System.out.println("查询医院时间="+(end5-start5)/1000.0+"s");
|
|
|
|
|
user.setDictId(powerUserDict.getDictId());*/
|
|
|
|
|
//设置用户登录次数缓存
|
|
|
|
|
//CacheManager.addloginUserCount(fmt.format(new Date()),user.getUserName());
|
|
|
|
|
CacheManager.addExcCount("noExc");
|
|
|
|
|
List<Power_Menu> list = null;
|
|
|
|
|
List<User_Dept_Menu> menuList = new ArrayList<>();
|
|
|
|
@ -867,10 +842,6 @@ public class FontController {
|
|
|
|
|
url = "http://"+ip+":"+POWER_PORT+"/power/gatewayPage";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//request.getRequestDispatcher(url).forward(request, response);
|
|
|
|
|
|
|
|
|
|
//response.sendRedirect(url);
|
|
|
|
|
//return "redirect:gatewayPage";
|
|
|
|
|
return Msg.success().add("url",url);
|
|
|
|
|
}else{
|
|
|
|
|
//登录失败
|
|
|
|
|