正在显示
13 个修改的文件
包含
427 行增加
和
60 行删除
@@ -1229,6 +1229,10 @@ public class ManifestController extends BasicController { | @@ -1229,6 +1229,10 @@ public class ManifestController extends BasicController { | ||
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | manifestService.save(manifest); | 1231 | manifestService.save(manifest); |
1232 | + //修改分单航班号航班日期 分单需要根据主单走 | ||
1233 | + if (manifest.getId() != null){ | ||
1234 | + preparesecondaryServer.update(manifest.getFlightno(), manifest.getFlightdate(), manifest.getId()); | ||
1235 | + } | ||
1232 | receiptService.saveFromManifest(manifest, type); | 1236 | receiptService.saveFromManifest(manifest, type); |
1233 | // 生成报文并且发送 | 1237 | // 生成报文并且发送 |
1234 | String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR); | 1238 | String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR); |
@@ -239,10 +239,16 @@ public class LoginController { | @@ -239,10 +239,16 @@ public class LoginController { | ||
239 | rm.setMsg("1"); | 239 | rm.setMsg("1"); |
240 | } | 240 | } |
241 | } else { | 241 | } else { |
242 | - // 登录用户 | 242 | + |
243 | Subject subject = SecurityUtils.getSubject(); | 243 | Subject subject = SecurityUtils.getSubject(); |
244 | subject.getSession().setAttribute("user", user); | 244 | subject.getSession().setAttribute("user", user); |
245 | - UsernamePasswordToken token = new UsernamePasswordToken(loginAccount, MD5Tools.MD5(password)); | 245 | + UsernamePasswordToken token = null; |
246 | + if ("".equals(userEntity.getUamId())){ | ||
247 | + // 登录用户 | ||
248 | + token = new UsernamePasswordToken(loginAccount, MD5Tools.MD5(password)); | ||
249 | + }else { | ||
250 | + token = new UsernamePasswordToken(loginAccount, userEntity.getPassword()); | ||
251 | + } | ||
246 | // System.out.println(loginAccount+" " + password); | 252 | // System.out.println(loginAccount+" " + password); |
247 | try { | 253 | try { |
248 | subject.login(token); | 254 | subject.login(token); |
@@ -6,12 +6,22 @@ import javax.annotation.Resource; | @@ -6,12 +6,22 @@ import javax.annotation.Resource; | ||
6 | import javax.servlet.http.HttpServletRequest; | 6 | import javax.servlet.http.HttpServletRequest; |
7 | 7 | ||
8 | import com.agent.entity.system.*; | 8 | import com.agent.entity.system.*; |
9 | +import com.agent.service.system.FunctionService; | ||
10 | +import com.agent.util.HttpClientUtil; | ||
11 | +import com.google.gson.Gson; | ||
12 | +import jdk.nashorn.internal.runtime.regexp.RegExp; | ||
9 | import org.apache.commons.collections.CollectionUtils; | 13 | import org.apache.commons.collections.CollectionUtils; |
10 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
15 | +import org.apache.shiro.SecurityUtils; | ||
16 | +import org.apache.shiro.authc.UnknownAccountException; | ||
17 | +import org.apache.shiro.authc.UsernamePasswordToken; | ||
18 | +import org.apache.shiro.subject.Subject; | ||
11 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
12 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
21 | +import org.springframework.beans.factory.annotation.Value; | ||
13 | import org.springframework.stereotype.Controller; | 22 | import org.springframework.stereotype.Controller; |
14 | import org.springframework.ui.Model; | 23 | import org.springframework.ui.Model; |
24 | +import org.springframework.web.bind.annotation.RequestBody; | ||
15 | import org.springframework.web.bind.annotation.RequestMapping; | 25 | import org.springframework.web.bind.annotation.RequestMapping; |
16 | import org.springframework.web.bind.annotation.RequestMethod; | 26 | import org.springframework.web.bind.annotation.RequestMethod; |
17 | import org.springframework.web.bind.annotation.ResponseBody; | 27 | import org.springframework.web.bind.annotation.ResponseBody; |
@@ -32,6 +42,21 @@ import com.plugin.easyui.EasyPage; | @@ -32,6 +42,21 @@ import com.plugin.easyui.EasyPage; | ||
32 | @RequestMapping({"/system/user" }) | 42 | @RequestMapping({"/system/user" }) |
33 | public class UserController extends BasicController { | 43 | public class UserController extends BasicController { |
34 | 44 | ||
45 | + /** | ||
46 | + * 验证服务票据响应属性名 | ||
47 | + */ | ||
48 | + private static final String SERVICE_RESPONESE = "serviceResponse"; | ||
49 | + private static final String AUTHENTICATION_SUCCESS = "authenticationSuccess"; | ||
50 | + private static final String LOGIN_NAME = "LOGIN_NAME"; | ||
51 | + private static final String ATTRIBUTES = "attributes"; | ||
52 | + private static final String USER_ID = "USER_ID"; | ||
53 | + | ||
54 | + @Value("${ger.req-url}") | ||
55 | + private String requestUrl; | ||
56 | + | ||
57 | + @Value("${ger.res-url}") | ||
58 | + private String responseUrl; | ||
59 | + | ||
35 | private static final Logger logger = LoggerFactory.getLogger(UserController.class); | 60 | private static final Logger logger = LoggerFactory.getLogger(UserController.class); |
36 | 61 | ||
37 | @Resource | 62 | @Resource |
@@ -43,6 +68,9 @@ public class UserController extends BasicController { | @@ -43,6 +68,9 @@ public class UserController extends BasicController { | ||
43 | @Resource | 68 | @Resource |
44 | private BasicAgentService agentService; | 69 | private BasicAgentService agentService; |
45 | 70 | ||
71 | + @Resource | ||
72 | + private FunctionService functionService; | ||
73 | + | ||
46 | /** | 74 | /** |
47 | * 用户账号管理 | 75 | * 用户账号管理 |
48 | * @return | 76 | * @return |
@@ -246,62 +274,137 @@ public class UserController extends BasicController { | @@ -246,62 +274,137 @@ public class UserController extends BasicController { | ||
246 | return model; | 274 | return model; |
247 | } | 275 | } |
248 | 276 | ||
249 | -// /** | ||
250 | -// * 资源同步 | ||
251 | -// */ | ||
252 | -// @RequestMapping(value = "/userSynchronization") | ||
253 | -// @ResponseBody | ||
254 | -// public ResultMessage userSynchronization(@RequestBody UAM uam) throws Exception { | ||
255 | -// if ("user".equals(uam.getResType())){ | ||
256 | -// List<UserData> data = uam.getData(); | ||
257 | -// // 判断该用户是否存在 | ||
258 | -// int i = 0; | ||
259 | -// for (UserData userData: data){ | ||
260 | -// if (userService.countLonginName(userData.getLOGIN_NAME()) > 0){ | 277 | + /** |
278 | + * 资源同步 | ||
279 | + */ | ||
280 | + @RequestMapping(value = "/userSynchronization", method = RequestMethod.POST) | ||
281 | + @ResponseBody | ||
282 | + public ResultMessage userSynchronization(@RequestBody UAM uam) throws Exception { | ||
283 | + if ("user".equals(uam.getResType())){ | ||
284 | + List<UserData> data = uam.getData(); | ||
285 | + // 判断该用户是否存在 | ||
286 | + int i = 0; | ||
287 | + for (UserData userData: data){ | ||
288 | + if (userService.findLoginaccount(userData.getLOGIN_NAME()) != null){ | ||
261 | // log.info("通过账号为条件更新"); | 289 | // log.info("通过账号为条件更新"); |
262 | -// i = userService.updateSyncUserLoginName(userData); | ||
263 | -// }else { | ||
264 | -// if (kakoUserMapperl.findLonginName("", userDate.getUSER_ID()) != null){ | ||
265 | -// KakoUser kakoUser = new KakoUser(); | ||
266 | -// kakoUser.setLoginName(userDate.getLOGIN_NAME()); | ||
267 | -// kakoUser.setPassword(userDate.getPWD()); | ||
268 | -// kakoUser.setUserSyncId(userDate.getUSER_ID()); | ||
269 | -// kakoUser.setMobile(userDate.getMOBILE()); | ||
270 | -// kakoUser.setEmail(userDate.getEMAIL()); | ||
271 | -// kakoUser.setDelFlag("0"); | ||
272 | -// kakoUser.setName(userDate.getUSER_NAME()); | ||
273 | -// kakoUser.setCompanyId("1"); | ||
274 | -// kakoUser.setOfficeId("5e95a0f081c64fce9f85d59e18cfdc5f"); | ||
275 | -// kakoUser.setUpdateBy("tyrz"); | ||
276 | -// kakoUser.setLoginFlag("1"); | ||
277 | -// kakoUser.setUpdateDate(new Date()); | 290 | + i = userService.updateSyncUserLoginName(userData); |
291 | + }else { | ||
292 | + if (userService.findUamId(userData.getUSER_ID()) != null){ | ||
278 | // log.info("账号不存在用过统一认证id更新"); | 293 | // log.info("账号不存在用过统一认证id更新"); |
279 | -// i = kakoUserMapperl.updateSyncUserId(kakoUser); | ||
280 | -// }else { | ||
281 | -// KakoUser kakoUser = new KakoUser(); | ||
282 | -// kakoUser.setId(UUID.randomUUID().toString()); | ||
283 | -// kakoUser.setLoginName(userDate.getLOGIN_NAME()); | ||
284 | -// kakoUser.setPassword(userDate.getPWD()); | ||
285 | -// kakoUser.setUserSyncId(userDate.getUSER_ID()); | ||
286 | -// kakoUser.setMobile(userDate.getMOBILE()); | ||
287 | -// kakoUser.setEmail(userDate.getEMAIL()); | ||
288 | -// kakoUser.setName(userDate.getUSER_NAME()); | ||
289 | -// kakoUser.setCompanyId("1"); | ||
290 | -// kakoUser.setOfficeId("5e95a0f081c64fce9f85d59e18cfdc5f"); | ||
291 | -// kakoUser.setLoginFlag("1"); | ||
292 | -// kakoUser.setCreateBy("tyrz"); | ||
293 | -// kakoUser.setUpdateBy("tyrz"); | ||
294 | -// kakoUser.setCreateDate(new Date()); | ||
295 | -// kakoUser.setUpdateDate(new Date()); | 294 | + i = userService.updateSyncUserId(userData); |
295 | + }else { | ||
296 | // log.info("账号统一认证id都不在 新增"); | 296 | // log.info("账号统一认证id都不在 新增"); |
297 | -// i = kakoUserMapperl.insertSelective(kakoUser); | ||
298 | -// } | ||
299 | -// } | ||
300 | -// } | ||
301 | -// | ||
302 | -// return i > 0 ? new ResultMessage("200","资源同步成功"):new ResultMessage("202", "资源同步失败"); | ||
303 | -// } | ||
304 | -// return new ResultMessage("201","不是用户信息"); | ||
305 | -// } | 297 | + UserEntity userEntity = new UserEntity(); |
298 | + userEntity.setPassword(userData.getPWD()); | ||
299 | + userEntity.setLoginaccount(userData.getLOGIN_NAME()); | ||
300 | + userEntity.setRealName(userData.getUSER_NAME()); | ||
301 | + userEntity.setMobile(userData.getMOBILE()); | ||
302 | + userEntity.setUamId(userData.getUSER_ID()); | ||
303 | + userEntity.setStatus(0); | ||
304 | + userEntity.setLoginerror(0); | ||
305 | + if (userService.save(userEntity)!=null){ | ||
306 | + i = 1; | ||
307 | + }else { | ||
308 | + i = 0; | ||
309 | + } | ||
310 | + } | ||
311 | + } | ||
312 | + } | ||
313 | + | ||
314 | + return i > 0 ? new ResultMessage("200","资源同步成功"):new ResultMessage("202", "资源同步失败"); | ||
315 | + } | ||
316 | + return new ResultMessage("201","不是用户信息"); | ||
317 | + } | ||
318 | + | ||
319 | + /** | ||
320 | + * 转发致ssoLoginjsp页面 | ||
321 | + * @return | ||
322 | + */ | ||
323 | + @RequestMapping(value = "/uamJump") | ||
324 | + public String ssoLoginJsp(){ | ||
325 | + return "ssoLogin"; | ||
326 | + } | ||
327 | + | ||
328 | + /** | ||
329 | + * 验证票据 | ||
330 | + * @param ticket | ||
331 | + * @return | ||
332 | + * @throws Exception | ||
333 | + */ | ||
334 | + @RequestMapping (value = "/ssoLogin") | ||
335 | + @ResponseBody | ||
336 | + public ResponseModel ssoLogin(String ticket) throws Exception { | ||
337 | + ResponseModel responseModel = new ResponseModel(); | ||
338 | + try { | ||
339 | +// log.info("票据接受:{}", ticket); | ||
340 | + if (!org.springframework.util.StringUtils.isEmpty(ticket)){ | ||
341 | +// log.info("开始验证票据"); | ||
342 | + 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"); | ||
343 | +// log.info("验证票据返回值:{}", result); | ||
344 | + Map<String, Object> userInfo = resolveUserInfo(result); | ||
345 | + if (userInfo != null){ | ||
346 | + UserEntity user = userService.findLoginaccount(userInfo.get("loginName").toString()); | ||
347 | +// log.info("查询用户信息:{}", user); | ||
348 | + if (user != null){ | ||
349 | + // 登录用户 | ||
350 | + Subject subject = SecurityUtils.getSubject(); | ||
351 | + subject.getSession().setAttribute("user", user); | ||
352 | + UsernamePasswordToken token = new UsernamePasswordToken(user.getLoginaccount(), user.getPassword()); | ||
353 | + try { | ||
354 | + subject.login(token); | ||
355 | + subject.getSession().setAttribute("permission", roleService | ||
356 | + .findAllFunctionByRole(((UserEntity) subject.getSession().getAttribute("user")).getRole())); | ||
357 | + subject.getSession().setAttribute("all_function", functionService.findAll()); | ||
358 | + //登录成功 请空失败次数 | ||
359 | + userService.emptyLoginerror(user.getLoginaccount()); | ||
360 | + responseModel.setStatus(200); | ||
361 | + return responseModel; | ||
362 | + } catch (UnknownAccountException e) { | ||
363 | + responseModel.setStatus(500); | ||
364 | + responseModel.setMsg("1"); | ||
365 | + } | ||
366 | + }else { | ||
367 | + responseModel.setStatus(204); | ||
368 | + responseModel.setMsg("该用户不存在本系统,请先去同步信息"); | ||
369 | + return responseModel; | ||
370 | + } | ||
371 | + }else { | ||
372 | + responseModel.setStatus(203); | ||
373 | + responseModel.setMsg("远程获取用户信息失败"+result); | ||
374 | + return responseModel; | ||
375 | + } | ||
376 | + }else { | ||
377 | + responseModel.setStatus(202); | ||
378 | + responseModel.setMsg("票据为空,获取失败"); | ||
379 | + return responseModel; | ||
380 | + } | ||
381 | + }catch (Exception e){ | ||
382 | + e.printStackTrace(); | ||
383 | + responseModel.setStatus(201); | ||
384 | + responseModel.setMsg(e.toString()); | ||
385 | + return responseModel; | ||
386 | + } | ||
387 | + return null; | ||
388 | + } | ||
389 | + | ||
390 | + public Map<String, Object> resolveUserInfo(String result){ | ||
391 | +// 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\"}}}}"; | ||
392 | + //认证成功,解析用户信息 | ||
393 | + Gson gson = new Gson(); | ||
394 | + Map resultMap = gson.fromJson(result, Map.class); | ||
395 | + Object serviceResponse = resultMap.get(SERVICE_RESPONESE); | ||
396 | + if(serviceResponse != null && serviceResponse instanceof Map){ | ||
397 | + Object authenticationSuccess = ((Map) serviceResponse).get(AUTHENTICATION_SUCCESS); | ||
398 | + if(authenticationSuccess != null && authenticationSuccess instanceof Map){ | ||
399 | + Map<String, Object> userInfo = new HashMap<>(); | ||
400 | + userInfo.put("attributes", ((Map) authenticationSuccess).get(ATTRIBUTES)); | ||
401 | + Object attributes = ((Map) authenticationSuccess).get("attributes"); | ||
402 | + userInfo.put("loginName", ((Map) attributes).get(LOGIN_NAME)); | ||
403 | + userInfo.put("userId", ((Map) attributes).get(USER_ID)); | ||
404 | + return userInfo; | ||
405 | + } | ||
406 | + } | ||
407 | + return null; | ||
408 | + } | ||
306 | 409 | ||
307 | } | 410 | } |
@@ -12,6 +12,7 @@ import javax.servlet.ServletRequest; | @@ -12,6 +12,7 @@ import javax.servlet.ServletRequest; | ||
12 | import javax.servlet.ServletResponse; | 12 | import javax.servlet.ServletResponse; |
13 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
14 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
15 | +import javax.servlet.http.HttpSession; | ||
15 | 16 | ||
16 | import org.apache.shiro.SecurityUtils; | 17 | import org.apache.shiro.SecurityUtils; |
17 | 18 | ||
@@ -29,7 +30,9 @@ public class MyShiroController implements Filter { | @@ -29,7 +30,9 @@ public class MyShiroController implements Filter { | ||
29 | } | 30 | } |
30 | 31 | ||
31 | private String publicAction[] = { "/login", "/doLogin", "/manifest/app/send", | 32 | private String publicAction[] = { "/login", "/doLogin", "/manifest/app/send", |
32 | - "/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114", "/manifest/f5f5669bbdecefd3dacfaba194647c35", "/getVerifyCode" }; | 33 | + "/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114", "/manifest/f5f5669bbdecefd3dacfaba194647c35", "/getVerifyCode", |
34 | + "/system/user/userSynchronization", "/system/user/uamJump", "/system/user/ssoLogin", | ||
35 | + }; | ||
33 | private String crossDomain[] = { "/cross/", "tracking/detail" }; | 36 | private String crossDomain[] = { "/cross/", "tracking/detail" }; |
34 | 37 | ||
35 | // manifest/cross/grid.json | 38 | // manifest/cross/grid.json |
1 | package com.agent.repository.agent; | 1 | package com.agent.repository.agent; |
2 | 2 | ||
3 | +import java.util.Date; | ||
3 | import java.util.List; | 4 | import java.util.List; |
4 | 5 | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
@@ -52,4 +53,10 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{ | @@ -52,4 +53,10 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{ | ||
52 | 53 | ||
53 | @Query(value = "select count(id) from PREPARESECONDARY where WAYBILLNOMASTER = ?1 and WAYBILLNOSECONDARY=?2", nativeQuery = true) | 54 | @Query(value = "select count(id) from PREPARESECONDARY where WAYBILLNOMASTER = ?1 and WAYBILLNOSECONDARY=?2", nativeQuery = true) |
54 | int findAwbAwbH(String awb, String awbh); | 55 | int findAwbAwbH(String awb, String awbh); |
56 | + | ||
57 | + @Transactional | ||
58 | + @Modifying | ||
59 | + @Query(value = "UPDATE PREPARESECONDARY SET FLIGHTNO=?1, FLIGHTDATE=?2 WHERE PREPAREMASTERID=?3", nativeQuery = true) | ||
60 | + int update(String flightno, Date flightDate, Long awbaId); | ||
61 | + | ||
55 | } | 62 | } |
@@ -41,6 +41,9 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L | @@ -41,6 +41,9 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L | ||
41 | @Query(value = "select * from sys_user where LOGINACCOUNT = ?1", nativeQuery = true) | 41 | @Query(value = "select * from sys_user where LOGINACCOUNT = ?1", nativeQuery = true) |
42 | UserEntity findLoginaccount(String loginaccount); | 42 | UserEntity findLoginaccount(String loginaccount); |
43 | 43 | ||
44 | + @Query(value = "select * from sys_user where UAM_ID = ?1", nativeQuery = true) | ||
45 | + UserEntity findUamId(String uamId); | ||
46 | + | ||
44 | // 锁定账户 | 47 | // 锁定账户 |
45 | @Transactional | 48 | @Transactional |
46 | @Modifying(clearAutomatically=true) | 49 | @Modifying(clearAutomatically=true) |
@@ -60,5 +63,15 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L | @@ -60,5 +63,15 @@ public interface UserRepository extends PagingAndSortingRepository<UserEntity, L | ||
60 | @Query(value = "UPDATE SYS_USER SET loginerror = 0 where loginaccount=?1", nativeQuery = true) | 63 | @Query(value = "UPDATE SYS_USER SET loginerror = 0 where loginaccount=?1", nativeQuery = true) |
61 | public void emptyLoginerror(String loginaccount); | 64 | public void emptyLoginerror(String loginaccount); |
62 | 65 | ||
66 | + @Transactional | ||
67 | + @Modifying(clearAutomatically = true) | ||
68 | + @Query(value = "update SYS_USER SET loginaccount=?1 , password=?2,realName=?3,UAM_ID=?4 where loginaccount = ?1", nativeQuery = true) | ||
69 | + public int updateSyncUserLoginName(String loginName, String pwd, String userName, String uamId); | ||
70 | + | ||
71 | + @Transactional | ||
72 | + @Modifying(clearAutomatically = true) | ||
73 | + @Query(value = "update SYS_USER SET loginaccount=?1 , password=?2,realName=?3,UAM_ID=?4 where UAM_ID = ?4", nativeQuery = true) | ||
74 | + public int updateSyncUserId(String loginName, String pwd, String userName, String uamId); | ||
75 | + | ||
63 | 76 | ||
64 | } | 77 | } |
1 | package com.agent.service.agent; | 1 | package com.agent.service.agent; |
2 | 2 | ||
3 | +import java.util.Date; | ||
3 | import java.util.HashMap; | 4 | import java.util.HashMap; |
4 | import java.util.List; | 5 | import java.util.List; |
5 | import java.util.Map; | 6 | import java.util.Map; |
@@ -35,6 +36,11 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity | @@ -35,6 +36,11 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity | ||
35 | return preparesecondaryRepository.save(manifest); | 36 | return preparesecondaryRepository.save(manifest); |
36 | } | 37 | } |
37 | 38 | ||
39 | + @Transactional | ||
40 | + public int update(String flightNo, Date flightdate, Long awbaId) { | ||
41 | + return preparesecondaryRepository.update(flightNo, flightdate, awbaId); | ||
42 | + } | ||
43 | + | ||
38 | public List<PreparesecondaryEntity> findAll(Long id) { | 44 | public List<PreparesecondaryEntity> findAll(Long id) { |
39 | return preparesecondaryRepository.findAll(id); | 45 | return preparesecondaryRepository.findAll(id); |
40 | } | 46 | } |
@@ -4,6 +4,7 @@ import java.util.List; | @@ -4,6 +4,7 @@ import java.util.List; | ||
4 | 4 | ||
5 | import javax.annotation.Resource; | 5 | import javax.annotation.Resource; |
6 | 6 | ||
7 | +import com.agent.entity.system.UserData; | ||
7 | import org.springframework.data.domain.Page; | 8 | import org.springframework.data.domain.Page; |
8 | import org.springframework.data.domain.PageRequest; | 9 | import org.springframework.data.domain.PageRequest; |
9 | import org.springframework.data.jpa.domain.Specification; | 10 | import org.springframework.data.jpa.domain.Specification; |
@@ -151,6 +152,10 @@ public class UserService extends BasicService<UserEntity> { | @@ -151,6 +152,10 @@ public class UserService extends BasicService<UserEntity> { | ||
151 | public UserEntity findLoginaccount(String loginaccount){ | 152 | public UserEntity findLoginaccount(String loginaccount){ |
152 | return userDao.findLoginaccount(loginaccount); | 153 | return userDao.findLoginaccount(loginaccount); |
153 | } | 154 | } |
155 | + //查询统一认证id 是否存在 | ||
156 | + public UserEntity findUamId(String uamId){ | ||
157 | + return userDao.findUamId(uamId); | ||
158 | + } | ||
154 | 159 | ||
155 | // 锁定账户 | 160 | // 锁定账户 |
156 | public void updateStatus(String loginacount){ | 161 | public void updateStatus(String loginacount){ |
@@ -168,4 +173,21 @@ public class UserService extends BasicService<UserEntity> { | @@ -168,4 +173,21 @@ public class UserService extends BasicService<UserEntity> { | ||
168 | userDao.emptyLoginerror(loginaccount); | 173 | userDao.emptyLoginerror(loginaccount); |
169 | } | 174 | } |
170 | 175 | ||
176 | + // 通过账户更新 | ||
177 | + public int updateSyncUserLoginName(UserData userData){ | ||
178 | + | ||
179 | + return userDao.updateSyncUserLoginName(userData.getLOGIN_NAME(), | ||
180 | + userData.getPWD(), | ||
181 | + userData.getUSER_NAME(), | ||
182 | + userData.getUSER_ID()); | ||
183 | + } | ||
184 | + // 通过uamId更新 | ||
185 | + public int updateSyncUserId(UserData userData){ | ||
186 | + | ||
187 | + return userDao.updateSyncUserId(userData.getLOGIN_NAME(), | ||
188 | + userData.getPWD(), | ||
189 | + userData.getUSER_NAME(), | ||
190 | + userData.getUSER_ID()); | ||
191 | + } | ||
192 | + | ||
171 | } | 193 | } |
1 | +package com.agent.util; | ||
2 | + | ||
3 | +import org.apache.commons.httpclient.HttpClient; | ||
4 | +import org.apache.commons.httpclient.HttpException; | ||
5 | +import org.apache.commons.httpclient.HttpStatus; | ||
6 | +import org.apache.commons.httpclient.NameValuePair; | ||
7 | +import org.apache.commons.httpclient.methods.GetMethod; | ||
8 | +import org.apache.commons.httpclient.methods.PostMethod; | ||
9 | +import org.apache.commons.httpclient.params.HttpMethodParams; | ||
10 | + | ||
11 | +import java.io.IOException; | ||
12 | +import java.util.Iterator; | ||
13 | +import java.util.Map; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author shenhailong | ||
17 | + * <p> | ||
18 | + * 2021/6/17/18:05 | ||
19 | + */ | ||
20 | +public class HttpClientUtil { | ||
21 | + | ||
22 | + public static String httpReader(String url, String code) { | ||
23 | + System.out.println("GetPage:" + url); | ||
24 | + | ||
25 | + HttpClient client = new HttpClient(); | ||
26 | + GetMethod method = new GetMethod(url); | ||
27 | + String result = null; | ||
28 | + try { | ||
29 | + client.executeMethod(method); | ||
30 | + int status = method.getStatusCode(); | ||
31 | + if (status == HttpStatus.SC_OK) { | ||
32 | + result = method.getResponseBodyAsString(); | ||
33 | + } else { | ||
34 | + System.out.println("Method failed: " + method.getStatusLine()); | ||
35 | + } | ||
36 | + } catch (HttpException e) { | ||
37 | + // �����������쳣��������Э�鲻�Ի��߷��ص����������� | ||
38 | + System.out.println("Please check your provided http address!"); | ||
39 | + e.printStackTrace(); | ||
40 | + } catch (IOException e) { | ||
41 | + // ���������쳣 | ||
42 | + System.out.println("���������쳣��"); | ||
43 | + e.printStackTrace(); | ||
44 | + } finally { | ||
45 | + // �ͷ����� | ||
46 | + if (method != null) { | ||
47 | + method.releaseConnection(); | ||
48 | + } | ||
49 | + method = null; | ||
50 | + client = null; | ||
51 | + } | ||
52 | + return result; | ||
53 | + } | ||
54 | + | ||
55 | + public static String httpGet(String url, String code) { | ||
56 | +// log.info("GetPage:{}"+ url); | ||
57 | + String content = null; | ||
58 | + HttpClient httpClient = new HttpClient(); | ||
59 | + //����header | ||
60 | + 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"); | ||
61 | + GetMethod method = new GetMethod(url); | ||
62 | + try { | ||
63 | + int statusCode = httpClient.executeMethod(method); | ||
64 | + System.out.println("httpClientUtils::statusCode=" + statusCode); | ||
65 | + System.out.println(method.getStatusLine()); | ||
66 | + content = new String(method.getResponseBody(), code); | ||
67 | + | ||
68 | + } catch (Exception e) { | ||
69 | + System.out.println("time out"); | ||
70 | + e.printStackTrace(); | ||
71 | + } finally { | ||
72 | + if (method != null) method.releaseConnection(); | ||
73 | + method = null; | ||
74 | + httpClient = null; | ||
75 | + } | ||
76 | + return content; | ||
77 | + } | ||
78 | + | ||
79 | + public static String httpPost(String url, Map paramMap, String code) { | ||
80 | + System.out.println("GetPage:" + url); | ||
81 | + String content = null; | ||
82 | + if (url == null || url.trim().length() == 0 || paramMap == null | ||
83 | + || paramMap.isEmpty()) { | ||
84 | + return null; | ||
85 | + } | ||
86 | + HttpClient httpClient = new HttpClient(); | ||
87 | + //����header | ||
88 | + 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");// | ||
89 | + | ||
90 | + //�������� | ||
91 | + //httpClient.getHostConfiguration().setProxy("128.128.176.74", 808); | ||
92 | + | ||
93 | + PostMethod method = new PostMethod(url); | ||
94 | + Iterator it = paramMap.keySet().iterator(); | ||
95 | + | ||
96 | + | ||
97 | + while (it.hasNext()) { | ||
98 | + String key = it.next() + ""; | ||
99 | + Object o = paramMap.get(key); | ||
100 | + if (o != null && o instanceof String) { | ||
101 | + method.addParameter(new NameValuePair(key, o.toString())); | ||
102 | + } | ||
103 | + if (o != null && o instanceof String[]) { | ||
104 | + String[] s = (String[]) o; | ||
105 | + if (s != null) { | ||
106 | + for (int i = 0; i < s.length; i++) { | ||
107 | + method.addParameter(new NameValuePair(key, s[i])); | ||
108 | + } | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
112 | + try { | ||
113 | + | ||
114 | + int statusCode = httpClient.executeMethod(method); | ||
115 | + | ||
116 | + System.out.println("httpClientUtils::statusCode=" + statusCode); | ||
117 | + | ||
118 | + System.out.println(method.getStatusLine()); | ||
119 | + content = new String(method.getResponseBody(), code); | ||
120 | + | ||
121 | + } catch (Exception e) { | ||
122 | + System.out.println("time out"); | ||
123 | + e.printStackTrace(); | ||
124 | + } finally { | ||
125 | + if (method != null) { | ||
126 | + method.releaseConnection(); | ||
127 | + } | ||
128 | + method = null; | ||
129 | + httpClient = null; | ||
130 | + } | ||
131 | + return content; | ||
132 | + | ||
133 | + } | ||
134 | + | ||
135 | + public static String httpPost(String url, Map paramMap) { | ||
136 | + //���룺UTF-8 | ||
137 | + return HttpClientUtil.httpPost(url, paramMap, "UTF-8"); | ||
138 | + } | ||
139 | + | ||
140 | +} |
@@ -39,3 +39,6 @@ custom.message.password=vmvnv1v2VV | @@ -39,3 +39,6 @@ custom.message.password=vmvnv1v2VV | ||
39 | custom.message.server=10.50.3.61 | 39 | custom.message.server=10.50.3.61 |
40 | custom.message.remotedir=nms_customs_xml2 | 40 | custom.message.remotedir=nms_customs_xml2 |
41 | 41 | ||
42 | +ger.req-url= "http://10.5.14.103:27080/sso/p3/serviceValidate?format=json&service=" | ||
43 | +ger.res-url= "http://10.50.3.73:8003/agent_test/sso/ssoLogin.html" | ||
44 | + |
@@ -612,7 +612,7 @@ manifest.delivery=\u4fdd\u5b58\u5e76\u53d1\u9001\u5230\u4ea4\u8fd0 | @@ -612,7 +612,7 @@ manifest.delivery=\u4fdd\u5b58\u5e76\u53d1\u9001\u5230\u4ea4\u8fd0 | ||
612 | manifest.response_text=\u8FD0\u5355\u72B6\u6001 | 612 | manifest.response_text=\u8FD0\u5355\u72B6\u6001 |
613 | manifest.loginaccount=\u7528\u6237\u8d26\u53f7 | 613 | manifest.loginaccount=\u7528\u6237\u8d26\u53f7 |
614 | manifest.agentCode=\u8d27\u4ee3\u4fe1\u606f | 614 | manifest.agentCode=\u8d27\u4ee3\u4fe1\u606f |
615 | -manifest.excel=\u5bfc\u5165\u0045\u0078\u0063\u0065\u006c\u6587\u4ef6 | 615 | +manifest.excel=\u5bfc\u5165\u0045\u0078\u0063\u0065\u006c\u6587\u4ef6\u8fd0\u5355\u72b6\u6001 |
616 | 616 | ||
617 | manifest.customs_status_001 = \u666E\u901A\u8D27\u7269 | 617 | manifest.customs_status_001 = \u666E\u901A\u8D27\u7269 |
618 | manifest.customs_status_002 = \u56FD\u9645\u8F6C\u8FD0\u8D27\u7269 | 618 | manifest.customs_status_002 = \u56FD\u9645\u8F6C\u8FD0\u8D27\u7269 |
src/main/webapp/WEB-INF/views/ssoLogin.jsp
0 → 100755
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
2 | +<% | ||
3 | +String path = request.getContextPath(); | ||
4 | +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; | ||
5 | +%> | ||
6 | +<!doctype html> | ||
7 | +<html lang="zh"> | ||
8 | +<head> | ||
9 | + <meta charset="utf-8"> | ||
10 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
11 | + <title>郑州机场航空物流信息平台</title> | ||
12 | + <link href="<%=basePath %>resource/css/login.css" rel="stylesheet"> | ||
13 | + <script src="<%=basePath %>resource/easyui/jquery.min.js"></script> | ||
14 | + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script> | ||
15 | +</head> | ||
16 | +<body> | ||
17 | +<div id="login"> | ||
18 | + <div style="height: 83px;margin-top: 32px;"> | ||
19 | + <div style="font-size:28px;color:white;margin-left:400px;">河南省机场集团有限公司</div> | ||
20 | + <div style="font-size:16px;color:white;margin-left:510px;"> 郑州机场航空物流信息平台</div> | ||
21 | + </div> | ||
22 | +</div> | ||
23 | +<div id="copyright"></div> | ||
24 | +</body> | ||
25 | +<script type="text/javascript"> | ||
26 | + // 获取地址栏参数 | ||
27 | + function getUrlKey(name) { | ||
28 | + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null | ||
29 | + } | ||
30 | + | ||
31 | + // 获取票据 | ||
32 | + function ticket() { | ||
33 | + var ticket = this.getUrlKey("ticket"); | ||
34 | + if (ticket!=undefined){ | ||
35 | + var loginParams = { | ||
36 | + ticket : ticket | ||
37 | + } | ||
38 | + $.post('<%=basePath %>system/user/ssoLogin',loginParams,function(res){ | ||
39 | + //NProgress.done(); | ||
40 | + var status = res.status; | ||
41 | + console.log("------->"+status); | ||
42 | + console.log("------->"+res); | ||
43 | + if (status !== 200) { | ||
44 | + var msg = "该账户不存在本系统"; | ||
45 | + $.growl({ title: "消息提示", message: msg }); | ||
46 | + } else { | ||
47 | + window.location.href='<%=basePath %>manifest/list'; | ||
48 | + } | ||
49 | + }).catch(error => { | ||
50 | + $.growl({ title: "消息提示", message: error }); | ||
51 | + //this.logining = false; | ||
52 | + }); | ||
53 | + }else { | ||
54 | + console.log("票据为空 请求路由") | ||
55 | + window.location.href = 'http://10.5.14.103:27080/sso/login?service=http://10.50.3.73:8003/sso/ssoLogin.html' | ||
56 | + } | ||
57 | + } | ||
58 | + $(document).ready(function(){ | ||
59 | + ticket(); | ||
60 | + }); | ||
61 | +</script> | ||
62 | +</html> |
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | xmlns="http://java.sun.com/xml/ns/javaee" | 3 | xmlns="http://java.sun.com/xml/ns/javaee" |
4 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | 4 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" |
5 | version="3.0"> | 5 | version="3.0"> |
6 | - | ||
7 | <!-- shiro --> | 6 | <!-- shiro --> |
8 | <filter> | 7 | <filter> |
9 | <filter-name>shiroFilter</filter-name> | 8 | <filter-name>shiroFilter</filter-name> |
@@ -138,5 +137,4 @@ | @@ -138,5 +137,4 @@ | ||
138 | <session-config> | 137 | <session-config> |
139 | <session-timeout>120</session-timeout> | 138 | <session-timeout>120</session-timeout> |
140 | </session-config> | 139 | </session-config> |
141 | - | ||
142 | </web-app> | 140 | </web-app> |
-
请 注册 或 登录 后发表评论