diff --git a/src/main/java/com/agent/controller/agent/ManifestController.java b/src/main/java/com/agent/controller/agent/ManifestController.java index 8f01348..37e8414 100755 --- a/src/main/java/com/agent/controller/agent/ManifestController.java +++ b/src/main/java/com/agent/controller/agent/ManifestController.java @@ -1229,6 +1229,10 @@ public class ManifestController extends BasicController { } manifestService.save(manifest); + //修改分单航班号航班日期 分单需要根据主单走 + if (manifest.getId() != null){ + preparesecondaryServer.update(manifest.getFlightno(), manifest.getFlightdate(), manifest.getId()); + } receiptService.saveFromManifest(manifest, type); // 生成报文并且发送 String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR); diff --git a/src/main/java/com/agent/controller/system/LoginController.java b/src/main/java/com/agent/controller/system/LoginController.java index ab17334..28c37cd 100755 --- a/src/main/java/com/agent/controller/system/LoginController.java +++ b/src/main/java/com/agent/controller/system/LoginController.java @@ -239,10 +239,16 @@ public class LoginController { rm.setMsg("1"); } } else { - // 登录用户 + Subject subject = SecurityUtils.getSubject(); subject.getSession().setAttribute("user", user); - UsernamePasswordToken token = new UsernamePasswordToken(loginAccount, MD5Tools.MD5(password)); + UsernamePasswordToken token = null; + if ("".equals(userEntity.getUamId())){ + // 登录用户 + token = new UsernamePasswordToken(loginAccount, MD5Tools.MD5(password)); + }else { + token = new UsernamePasswordToken(loginAccount, userEntity.getPassword()); + } // System.out.println(loginAccount+" " + password); try { subject.login(token); diff --git a/src/main/java/com/agent/controller/system/UserController.java b/src/main/java/com/agent/controller/system/UserController.java index 86091ac..f767b46 100755 --- a/src/main/java/com/agent/controller/system/UserController.java +++ b/src/main/java/com/agent/controller/system/UserController.java @@ -6,12 +6,22 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import com.agent.entity.system.*; +import com.agent.service.system.FunctionService; +import com.agent.util.HttpClientUtil; +import com.google.gson.Gson; +import jdk.nashorn.internal.runtime.regexp.RegExp; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -32,6 +42,21 @@ import com.plugin.easyui.EasyPage; @RequestMapping({"/system/user" }) public class UserController extends BasicController { + /** + * 验证服务票据响应属性名 + */ + private static final String SERVICE_RESPONESE = "serviceResponse"; + private static final String AUTHENTICATION_SUCCESS = "authenticationSuccess"; + private static final String LOGIN_NAME = "LOGIN_NAME"; + private static final String ATTRIBUTES = "attributes"; + private static final String USER_ID = "USER_ID"; + + @Value("${ger.req-url}") + private String requestUrl; + + @Value("${ger.res-url}") + private String responseUrl; + private static final Logger logger = LoggerFactory.getLogger(UserController.class); @Resource @@ -43,6 +68,9 @@ public class UserController extends BasicController { @Resource private BasicAgentService agentService; + @Resource + private FunctionService functionService; + /** * 用户账号管理 * @return @@ -246,62 +274,137 @@ public class UserController extends BasicController { return model; } -// /** -// * 资源同步 -// */ -// @RequestMapping(value = "/userSynchronization") -// @ResponseBody -// public ResultMessage userSynchronization(@RequestBody UAM uam) throws Exception { -// if ("user".equals(uam.getResType())){ -// List<UserData> data = uam.getData(); -// // 判断该用户是否存在 -// int i = 0; -// for (UserData userData: data){ -// if (userService.countLonginName(userData.getLOGIN_NAME()) > 0){ + /** + * 资源同步 + */ + @RequestMapping(value = "/userSynchronization", method = RequestMethod.POST) + @ResponseBody + public ResultMessage userSynchronization(@RequestBody UAM uam) throws Exception { + if ("user".equals(uam.getResType())){ + List<UserData> data = uam.getData(); + // 判断该用户是否存在 + int i = 0; + for (UserData userData: data){ + if (userService.findLoginaccount(userData.getLOGIN_NAME()) != null){ // log.info("通过账号为条件更新"); -// i = userService.updateSyncUserLoginName(userData); -// }else { -// if (kakoUserMapperl.findLonginName("", userDate.getUSER_ID()) != null){ -// KakoUser kakoUser = new KakoUser(); -// kakoUser.setLoginName(userDate.getLOGIN_NAME()); -// kakoUser.setPassword(userDate.getPWD()); -// kakoUser.setUserSyncId(userDate.getUSER_ID()); -// kakoUser.setMobile(userDate.getMOBILE()); -// kakoUser.setEmail(userDate.getEMAIL()); -// kakoUser.setDelFlag("0"); -// kakoUser.setName(userDate.getUSER_NAME()); -// kakoUser.setCompanyId("1"); -// kakoUser.setOfficeId("5e95a0f081c64fce9f85d59e18cfdc5f"); -// kakoUser.setUpdateBy("tyrz"); -// kakoUser.setLoginFlag("1"); -// kakoUser.setUpdateDate(new Date()); + i = userService.updateSyncUserLoginName(userData); + }else { + if (userService.findUamId(userData.getUSER_ID()) != null){ // log.info("账号不存在用过统一认证id更新"); -// i = kakoUserMapperl.updateSyncUserId(kakoUser); -// }else { -// KakoUser kakoUser = new KakoUser(); -// kakoUser.setId(UUID.randomUUID().toString()); -// kakoUser.setLoginName(userDate.getLOGIN_NAME()); -// kakoUser.setPassword(userDate.getPWD()); -// kakoUser.setUserSyncId(userDate.getUSER_ID()); -// kakoUser.setMobile(userDate.getMOBILE()); -// kakoUser.setEmail(userDate.getEMAIL()); -// kakoUser.setName(userDate.getUSER_NAME()); -// kakoUser.setCompanyId("1"); -// kakoUser.setOfficeId("5e95a0f081c64fce9f85d59e18cfdc5f"); -// kakoUser.setLoginFlag("1"); -// kakoUser.setCreateBy("tyrz"); -// kakoUser.setUpdateBy("tyrz"); -// kakoUser.setCreateDate(new Date()); -// kakoUser.setUpdateDate(new Date()); + i = userService.updateSyncUserId(userData); + }else { // log.info("账号统一认证id都不在 新增"); -// i = kakoUserMapperl.insertSelective(kakoUser); -// } -// } -// } -// -// return i > 0 ? new ResultMessage("200","资源同步成功"):new ResultMessage("202", "资源同步失败"); -// } -// return new ResultMessage("201","不是用户信息"); -// } + UserEntity userEntity = new UserEntity(); + userEntity.setPassword(userData.getPWD()); + userEntity.setLoginaccount(userData.getLOGIN_NAME()); + userEntity.setRealName(userData.getUSER_NAME()); + userEntity.setMobile(userData.getMOBILE()); + userEntity.setUamId(userData.getUSER_ID()); + userEntity.setStatus(0); + userEntity.setLoginerror(0); + if (userService.save(userEntity)!=null){ + i = 1; + }else { + i = 0; + } + } + } + } + + return i > 0 ? new ResultMessage("200","资源同步成功"):new ResultMessage("202", "资源同步失败"); + } + return new ResultMessage("201","不是用户信息"); + } + + /** + * 转发致ssoLoginjsp页面 + * @return + */ + @RequestMapping(value = "/uamJump") + public String ssoLoginJsp(){ + return "ssoLogin"; + } + + /** + * 验证票据 + * @param ticket + * @return + * @throws Exception + */ + @RequestMapping (value = "/ssoLogin") + @ResponseBody + public ResponseModel ssoLogin(String ticket) throws Exception { + ResponseModel responseModel = new ResponseModel(); + try { +// log.info("票据接受:{}", ticket); + if (!org.springframework.util.StringUtils.isEmpty(ticket)){ +// log.info("开始验证票据"); + String result = HttpClientUtil.httpGet("http://10.5.14.103:27080/sso/p3/serviceValidate?format=json&service="+"http://10.50.3.73:8003/sso/ssoLogin.html"+"&ticket="+ticket, "UTF-8"); +// log.info("验证票据返回值:{}", result); + Map<String, Object> userInfo = resolveUserInfo(result); + if (userInfo != null){ + UserEntity user = userService.findLoginaccount(userInfo.get("loginName").toString()); +// log.info("查询用户信息:{}", user); + if (user != null){ + // 登录用户 + Subject subject = SecurityUtils.getSubject(); + subject.getSession().setAttribute("user", user); + UsernamePasswordToken token = new UsernamePasswordToken(user.getLoginaccount(), user.getPassword()); + try { + subject.login(token); + subject.getSession().setAttribute("permission", roleService + .findAllFunctionByRole(((UserEntity) subject.getSession().getAttribute("user")).getRole())); + subject.getSession().setAttribute("all_function", functionService.findAll()); + //登录成功 请空失败次数 + userService.emptyLoginerror(user.getLoginaccount()); + responseModel.setStatus(200); + return responseModel; + } catch (UnknownAccountException e) { + responseModel.setStatus(500); + responseModel.setMsg("1"); + } + }else { + responseModel.setStatus(204); + responseModel.setMsg("该用户不存在本系统,请先去同步信息"); + return responseModel; + } + }else { + responseModel.setStatus(203); + responseModel.setMsg("远程获取用户信息失败"+result); + return responseModel; + } + }else { + responseModel.setStatus(202); + responseModel.setMsg("票据为空,获取失败"); + return responseModel; + } + }catch (Exception e){ + e.printStackTrace(); + responseModel.setStatus(201); + responseModel.setMsg(e.toString()); + return responseModel; + } + return null; + } + + public Map<String, Object> resolveUserInfo(String result){ +// result="{\"serviceResponse\":{\"authenticationSuccess\":{\"user\":\"shenhl\",\"attributes\":{\"isFromNewLogin\":[false],\"authenticationDate\":[1630484829.010000000],\"successfulAuthenticationHandlers\":[\"pwd\"],\"USER_ID\":\"1338722569884504064\",\"USER_NAME\":\"申海龙\",\"extend\":[],\"credentialType\":\"UsernamePasswordCredential\",\"samlAuthenticationStatementAuthMethod\":\"urn:oasis:names:tc:SAML:1.0:am:password\",\"ipTerritory\":\"\",\"authenticationMethod\":\"pwd\",\"equipType\":\"pc\",\"clientIp\":\"172.19.0.1\",\"isDefaultPwd\":\"false\",\"longTermAuthenticationRequestTokenUsed\":[false],\"LOGIN_NAME\":\"shenhl\",\"MOBILE\":\"17600319854\"}}}}"; + //认证成功,解析用户信息 + Gson gson = new Gson(); + Map resultMap = gson.fromJson(result, Map.class); + Object serviceResponse = resultMap.get(SERVICE_RESPONESE); + if(serviceResponse != null && serviceResponse instanceof Map){ + Object authenticationSuccess = ((Map) serviceResponse).get(AUTHENTICATION_SUCCESS); + if(authenticationSuccess != null && authenticationSuccess instanceof Map){ + Map<String, Object> userInfo = new HashMap<>(); + userInfo.put("attributes", ((Map) authenticationSuccess).get(ATTRIBUTES)); + Object attributes = ((Map) authenticationSuccess).get("attributes"); + userInfo.put("loginName", ((Map) attributes).get(LOGIN_NAME)); + userInfo.put("userId", ((Map) attributes).get(USER_ID)); + return userInfo; + } + } + return null; + } } diff --git a/src/main/java/com/agent/filter/MyShiroController.java b/src/main/java/com/agent/filter/MyShiroController.java index 284639a..72c4cfd 100755 --- a/src/main/java/com/agent/filter/MyShiroController.java +++ b/src/main/java/com/agent/filter/MyShiroController.java @@ -12,6 +12,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.shiro.SecurityUtils; @@ -29,7 +30,9 @@ public class MyShiroController implements Filter { } private String publicAction[] = { "/login", "/doLogin", "/manifest/app/send", - "/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114", "/manifest/f5f5669bbdecefd3dacfaba194647c35", "/getVerifyCode" }; + "/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114", "/manifest/f5f5669bbdecefd3dacfaba194647c35", "/getVerifyCode", + "/system/user/userSynchronization", "/system/user/uamJump", "/system/user/ssoLogin", + }; private String crossDomain[] = { "/cross/", "tracking/detail" }; // manifest/cross/grid.json diff --git a/src/main/java/com/agent/repository/agent/PreparesecondaryRepository.java b/src/main/java/com/agent/repository/agent/PreparesecondaryRepository.java index 08f1b75..9f67196 100755 --- a/src/main/java/com/agent/repository/agent/PreparesecondaryRepository.java +++ b/src/main/java/com/agent/repository/agent/PreparesecondaryRepository.java @@ -1,5 +1,6 @@ package com.agent.repository.agent; +import java.util.Date; import java.util.List; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; @@ -52,4 +53,10 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{ @Query(value = "select count(id) from PREPARESECONDARY where WAYBILLNOMASTER = ?1 and WAYBILLNOSECONDARY=?2", nativeQuery = true) int findAwbAwbH(String awb, String awbh); + + @Transactional + @Modifying + @Query(value = "UPDATE PREPARESECONDARY SET FLIGHTNO=?1, FLIGHTDATE=?2 WHERE PREPAREMASTERID=?3", nativeQuery = true) + int update(String flightno, Date flightDate, Long awbaId); + } diff --git a/src/main/java/com/agent/repository/system/UserRepository.java b/src/main/java/com/agent/repository/system/UserRepository.java index 14edb35..a0324c7 100755 --- a/src/main/java/com/agent/repository/system/UserRepository.java +++ b/src/main/java/com/agent/repository/system/UserRepository.java @@ -41,6 +41,9 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L @Query(value = "select * from sys_user where LOGINACCOUNT = ?1", nativeQuery = true) UserEntity findLoginaccount(String loginaccount); + @Query(value = "select * from sys_user where UAM_ID = ?1", nativeQuery = true) + UserEntity findUamId(String uamId); + // 锁定账户 @Transactional @Modifying(clearAutomatically=true) @@ -60,5 +63,15 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L @Query(value = "UPDATE SYS_USER SET loginerror = 0 where loginaccount=?1", nativeQuery = true) public void emptyLoginerror(String loginaccount); + @Transactional + @Modifying(clearAutomatically = true) + @Query(value = "update SYS_USER SET loginaccount=?1 , password=?2,realName=?3,UAM_ID=?4 where loginaccount = ?1", nativeQuery = true) + public int updateSyncUserLoginName(String loginName, String pwd, String userName, String uamId); + + @Transactional + @Modifying(clearAutomatically = true) + @Query(value = "update SYS_USER SET loginaccount=?1 , password=?2,realName=?3,UAM_ID=?4 where UAM_ID = ?4", nativeQuery = true) + public int updateSyncUserId(String loginName, String pwd, String userName, String uamId); + } diff --git a/src/main/java/com/agent/service/agent/PreparesecondaryService.java b/src/main/java/com/agent/service/agent/PreparesecondaryService.java index 7b53b7f..cda5e91 100755 --- a/src/main/java/com/agent/service/agent/PreparesecondaryService.java +++ b/src/main/java/com/agent/service/agent/PreparesecondaryService.java @@ -1,5 +1,6 @@ package com.agent.service.agent; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,6 +36,11 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity return preparesecondaryRepository.save(manifest); } + @Transactional + public int update(String flightNo, Date flightdate, Long awbaId) { + return preparesecondaryRepository.update(flightNo, flightdate, awbaId); + } + public List<PreparesecondaryEntity> findAll(Long id) { return preparesecondaryRepository.findAll(id); } diff --git a/src/main/java/com/agent/service/system/UserService.java b/src/main/java/com/agent/service/system/UserService.java index f32c642..fcd3e2b 100755 --- a/src/main/java/com/agent/service/system/UserService.java +++ b/src/main/java/com/agent/service/system/UserService.java @@ -4,6 +4,7 @@ import java.util.List; import javax.annotation.Resource; +import com.agent.entity.system.UserData; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.jpa.domain.Specification; @@ -151,6 +152,10 @@ public class UserService extends BasicService<UserEntity> { public UserEntity findLoginaccount(String loginaccount){ return userDao.findLoginaccount(loginaccount); } + //查询统一认证id 是否存在 + public UserEntity findUamId(String uamId){ + return userDao.findUamId(uamId); + } // 锁定账户 public void updateStatus(String loginacount){ @@ -168,4 +173,21 @@ public class UserService extends BasicService<UserEntity> { userDao.emptyLoginerror(loginaccount); } + // 通过账户更新 + public int updateSyncUserLoginName(UserData userData){ + + return userDao.updateSyncUserLoginName(userData.getLOGIN_NAME(), + userData.getPWD(), + userData.getUSER_NAME(), + userData.getUSER_ID()); + } + // 通过uamId更新 + public int updateSyncUserId(UserData userData){ + + return userDao.updateSyncUserId(userData.getLOGIN_NAME(), + userData.getPWD(), + userData.getUSER_NAME(), + userData.getUSER_ID()); + } + } diff --git a/src/main/java/com/agent/util/HttpClientUtil.java b/src/main/java/com/agent/util/HttpClientUtil.java new file mode 100644 index 0000000..07056c8 --- /dev/null +++ b/src/main/java/com/agent/util/HttpClientUtil.java @@ -0,0 +1,140 @@ +package com.agent.util; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; + +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; + +/** + * @author shenhailong + * <p> + * 2021/6/17/18:05 + */ +public class HttpClientUtil { + + public static String httpReader(String url, String code) { + System.out.println("GetPage:" + url); + + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(url); + String result = null; + try { + client.executeMethod(method); + int status = method.getStatusCode(); + if (status == HttpStatus.SC_OK) { + result = method.getResponseBodyAsString(); + } else { + System.out.println("Method failed: " + method.getStatusLine()); + } + } catch (HttpException e) { + // �����������쳣��������Э�鲻�Ի��߷��ص����������� + System.out.println("Please check your provided http address!"); + e.printStackTrace(); + } catch (IOException e) { + // ���������쳣 + System.out.println("���������쳣��"); + e.printStackTrace(); + } finally { + // �ͷ����� + if (method != null) { + method.releaseConnection(); + } + method = null; + client = null; + } + return result; + } + + public static String httpGet(String url, String code) { +// log.info("GetPage:{}"+ url); + String content = null; + HttpClient httpClient = new HttpClient(); + //����header + httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT, "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2"); + GetMethod method = new GetMethod(url); + try { + int statusCode = httpClient.executeMethod(method); + System.out.println("httpClientUtils::statusCode=" + statusCode); + System.out.println(method.getStatusLine()); + content = new String(method.getResponseBody(), code); + + } catch (Exception e) { + System.out.println("time out"); + e.printStackTrace(); + } finally { + if (method != null) method.releaseConnection(); + method = null; + httpClient = null; + } + return content; + } + + public static String httpPost(String url, Map paramMap, String code) { + System.out.println("GetPage:" + url); + String content = null; + if (url == null || url.trim().length() == 0 || paramMap == null + || paramMap.isEmpty()) { + return null; + } + HttpClient httpClient = new HttpClient(); + //����header + httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT, "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2");// + + //�������� + //httpClient.getHostConfiguration().setProxy("128.128.176.74", 808); + + PostMethod method = new PostMethod(url); + Iterator it = paramMap.keySet().iterator(); + + + while (it.hasNext()) { + String key = it.next() + ""; + Object o = paramMap.get(key); + if (o != null && o instanceof String) { + method.addParameter(new NameValuePair(key, o.toString())); + } + if (o != null && o instanceof String[]) { + String[] s = (String[]) o; + if (s != null) { + for (int i = 0; i < s.length; i++) { + method.addParameter(new NameValuePair(key, s[i])); + } + } + } + } + try { + + int statusCode = httpClient.executeMethod(method); + + System.out.println("httpClientUtils::statusCode=" + statusCode); + + System.out.println(method.getStatusLine()); + content = new String(method.getResponseBody(), code); + + } catch (Exception e) { + System.out.println("time out"); + e.printStackTrace(); + } finally { + if (method != null) { + method.releaseConnection(); + } + method = null; + httpClient = null; + } + return content; + + } + + public static String httpPost(String url, Map paramMap) { + //���룺UTF-8 + return HttpClientUtil.httpPost(url, paramMap, "UTF-8"); + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5db23a9..d7df534 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -39,3 +39,6 @@ custom.message.password=vmvnv1v2VV custom.message.server=10.50.3.61 custom.message.remotedir=nms_customs_xml2 +ger.req-url= "http://10.5.14.103:27080/sso/p3/serviceValidate?format=json&service=" +ger.res-url= "http://10.50.3.73:8003/agent_test/sso/ssoLogin.html" + diff --git a/src/main/resources/i18n_zh_CN.properties b/src/main/resources/i18n_zh_CN.properties index 19a76e2..1004792 100755 --- a/src/main/resources/i18n_zh_CN.properties +++ b/src/main/resources/i18n_zh_CN.properties @@ -612,7 +612,7 @@ manifest.delivery=\u4fdd\u5b58\u5e76\u53d1\u9001\u5230\u4ea4\u8fd0 manifest.response_text=\u8FD0\u5355\u72B6\u6001 manifest.loginaccount=\u7528\u6237\u8d26\u53f7 manifest.agentCode=\u8d27\u4ee3\u4fe1\u606f -manifest.excel=\u5bfc\u5165\u0045\u0078\u0063\u0065\u006c\u6587\u4ef6 +manifest.excel=\u5bfc\u5165\u0045\u0078\u0063\u0065\u006c\u6587\u4ef6\u8fd0\u5355\u72b6\u6001 manifest.customs_status_001 = \u666E\u901A\u8D27\u7269 manifest.customs_status_002 = \u56FD\u9645\u8F6C\u8FD0\u8D27\u7269 diff --git a/src/main/webapp/WEB-INF/views/ssoLogin.jsp b/src/main/webapp/WEB-INF/views/ssoLogin.jsp new file mode 100755 index 0000000..08c32ec --- /dev/null +++ b/src/main/webapp/WEB-INF/views/ssoLogin.jsp @@ -0,0 +1,62 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> +<!doctype html> +<html lang="zh"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>郑州机场航空物流信息平台</title> + <link href="<%=basePath %>resource/css/login.css" rel="stylesheet"> + <script src="<%=basePath %>resource/easyui/jquery.min.js"></script> + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script> +</head> +<body> +<div id="login"> + <div style="height: 83px;margin-top: 32px;"> + <div style="font-size:28px;color:white;margin-left:400px;">河南省机场集团有限公司</div> + <div style="font-size:16px;color:white;margin-left:510px;"> 郑州机场航空物流信息平台</div> + </div> +</div> +<div id="copyright"></div> +</body> +<script type="text/javascript"> + // 获取地址栏参数 + function getUrlKey(name) { + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null + } + + // 获取票据 + function ticket() { + var ticket = this.getUrlKey("ticket"); + if (ticket!=undefined){ + var loginParams = { + ticket : ticket + } + $.post('<%=basePath %>system/user/ssoLogin',loginParams,function(res){ + //NProgress.done(); + var status = res.status; + console.log("------->"+status); + console.log("------->"+res); + if (status !== 200) { + var msg = "该账户不存在本系统"; + $.growl({ title: "消息提示", message: msg }); + } else { + window.location.href='<%=basePath %>manifest/list'; + } + }).catch(error => { + $.growl({ title: "消息提示", message: error }); + //this.logining = false; + }); + }else { + console.log("票据为空 请求路由") + window.location.href = 'http://10.5.14.103:27080/sso/login?service=http://10.50.3.73:8003/sso/ssoLogin.html' + } + } + $(document).ready(function(){ + ticket(); + }); +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index ec4e65e..5ba33f1 100755 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -3,7 +3,6 @@ xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> - <!-- shiro --> <filter> <filter-name>shiroFilter</filter-name> @@ -138,5 +137,4 @@ <session-config> <session-timeout>120</session-timeout> </session-config> - </web-app> \ No newline at end of file