tao.mo

Merge remote-tracking branch 'origin/master'

Showing 25 changed files with 772 additions and 79 deletions
...@@ -51,6 +51,12 @@ ...@@ -51,6 +51,12 @@
51 <version>12.2.0.1</version> 51 <version>12.2.0.1</version>
52 <scope>${install.scope}</scope> 52 <scope>${install.scope}</scope>
53 </dependency> 53 </dependency>
54 + <dependency>
55 + <groupId>com.fedex.connect</groupId>
56 + <artifactId>common-dependencies</artifactId>
57 + <version>1.0.0</version>
58 + <scope>compile</scope>
59 + </dependency>
54 </dependencies> 60 </dependencies>
55 61
56 <profiles> 62 <profiles>
......
1 +package com.fedex.connect.customer.controller;
2 +
3 +
4 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 +import org.springframework.http.HttpHeaders;
7 +import org.springframework.http.HttpStatus;
8 +import org.springframework.http.ResponseEntity;
9 +import org.springframework.util.MultiValueMap;
10 +
11 +import javax.annotation.Resource;
12 +import java.net.URI;
13 +import java.util.Objects;
14 +
15 +/**
16 + * @author EDY
17 + */
18 +public class AbstractEtController {
19 +
20 + @Resource
21 + protected LocaleMessageUtil localeMessageUtil;
22 +
23 +
24 + public <T> ResponseEntity<T> seeOther(String url) {
25 + HttpHeaders httpHeaders = new HttpHeaders();
26 + httpHeaders.setLocation(URI.create(url));
27 + return result(HttpStatus.SEE_OTHER, httpHeaders);
28 + }
29 +
30 + public <T> ResponseEntity<T> temporaryRedirect(String url) {
31 + HttpHeaders httpHeaders = new HttpHeaders();
32 + httpHeaders.setLocation(URI.create(url));
33 + return result(HttpStatus.TEMPORARY_REDIRECT, httpHeaders);
34 + }
35 +
36 + public <T> ResponseEntity<T> permanentRedirect(String url) {
37 + HttpHeaders httpHeaders = new HttpHeaders();
38 + httpHeaders.setLocation(URI.create(url));
39 + return result(HttpStatus.PERMANENT_REDIRECT, httpHeaders);
40 + }
41 +
42 + public <T> ResponseEntity<T> result(HttpStatus status, T data) {
43 + return new ResponseEntity<>(data, status);
44 + }
45 +
46 + public <T> ResponseEntity<T> result(HttpStatus status, HttpHeaders headers) {
47 + return new ResponseEntity<>(headers, status);
48 + }
49 +
50 + public <T> ResponseEntity<T> ok(T data) {
51 + return new ResponseEntity<>(data, HttpStatus.OK);
52 + }
53 +
54 + public <T> ResponseEntity<T> ok(MultiValueMap<String, String> headers, T data) {
55 + return new ResponseEntity<>(data, headers, HttpStatus.OK);
56 + }
57 +
58 + public <T> ResponseEntity<T> error(HttpStatus code) {
59 + return new ResponseEntity<>(code);
60 + }
61 +
62 +
63 + public <T> ResponseEntity<T> error(HttpStatus code, MultiValueMap<String, String> headers) {
64 + return new ResponseEntity<>(headers, code);
65 + }
66 +
67 +
68 + /**
69 + * 通过自定义的错误码,转换为对应的HttpStatus
70 + * @param response
71 + * @return
72 + */
73 + public HttpStatus errorMappingStatus(ResponseResultVo response) {
74 + if (Objects.isNull(response)) {
75 + return HttpStatus.BAD_REQUEST; //400
76 + }
77 + return HttpStatus.BAD_REQUEST; //400
78 + }
79 +
80 +
81 + /**
82 + * 判定是否返回成功
83 + * @param responseEntity
84 + * @param <T>
85 + * @return
86 + */
87 + public <T> boolean isSuccess(ResponseEntity<ResponseResultVo<T>> responseEntity) {
88 + return responseEntity != null && responseEntity.getBody() != null && responseEntity.getBody().isSuccess();
89 + }
90 +
91 + /**
92 + * 判定是否返回成功
93 + * @param response
94 + * @param <T>
95 + * @return
96 + */
97 + public <T> boolean isSuccess(ResponseResultVo<T> response) {
98 + return response != null && response.isSuccess();
99 + }
100 +
101 +}
1 +package com.fedex.connect.customer.controller.biz;
2 +
3 +public interface IConsignmentController {
4 +}
1 +package com.fedex.connect.customer.data;
2 +
3 +import com.fasterxml.jackson.annotation.JsonIgnore;
4 +
5 +import java.util.Objects;
6 +
7 +public class PageBase {
8 +
9 + private Integer page;
10 +
11 + private Integer size;
12 +
13 + @JsonIgnore
14 + private Integer start;
15 +
16 + public Integer getPage() {
17 + return page;
18 + }
19 +
20 + public void setPage(Integer page) {
21 + this.page = page;
22 + }
23 +
24 + public Integer getSize() {
25 + return size;
26 + }
27 +
28 + public void setSize(Integer size) {
29 + this.size = size;
30 + }
31 +
32 + public Integer getStart() {
33 + Integer start = 0;
34 + if (Objects.nonNull(page) && Objects.nonNull(size)) {
35 + start = (page - 1) * size;
36 + }
37 + return start;
38 + }
39 +
40 + public void setStart(Integer start) {
41 + this.start = start;
42 + }
43 +
44 + public PageBase() {
45 + }
46 +
47 + public PageBase(Integer page, Integer size, Integer start) {
48 + this.page = page;
49 + this.size = size;
50 + this.start = start;
51 + }
52 +}
1 +package com.fedex.connect.customer.data.query;
2 +
3 +import com.fasterxml.jackson.annotation.JsonIgnore;
4 +import com.fedex.connect.common.dependencies.util.Utils;
5 +import com.fedex.connect.customer.data.PageBase;
6 +import org.springframework.util.CollectionUtils;
7 +
8 +import java.util.List;
9 +
10 +
11 +public class ConsignmentQuery extends PageBase {
12 +
13 + public static ConsignmentQuery dataProcessing(ConsignmentQuery query){
14 + //多提单号查询
15 + if (Utils.isNotEmpty(query.getDeliveryNo())) {
16 + query.setDeliveryNoList(Utils.split(query.getDeliveryNo(), "[;\\n]"));
17 + }
18 + if(!CollectionUtils.isEmpty(query.getDeliveryNoList())) {
19 + query.setCreateTimeFrom(null);
20 + query.setCreateTimeTo(null);
21 + }
22 + query.setStart(query.getStart());
23 + return query;
24 + }
25 +
26 + private String createTimeFrom;
27 +
28 + private String createTimeTo;
29 +
30 + private String deliveryNo;
31 +
32 + private Long sort;
33 +
34 + @JsonIgnore
35 + private List<String> deliveryNoList;
36 +
37 + @JsonIgnore
38 + private Long userId;
39 +
40 + public String getCreateTimeFrom() {
41 + return createTimeFrom;
42 + }
43 +
44 + public void setCreateTimeFrom(String createTimeFrom) {
45 + this.createTimeFrom = createTimeFrom;
46 + }
47 +
48 + public String getCreateTimeTo() {
49 + return createTimeTo;
50 + }
51 +
52 + public void setCreateTimeTo(String createTimeTo) {
53 + this.createTimeTo = createTimeTo;
54 + }
55 +
56 + public String getDeliveryNo() {
57 + return deliveryNo;
58 + }
59 +
60 + public void setDeliveryNo(String deliveryNo) {
61 + this.deliveryNo = deliveryNo;
62 + }
63 +
64 + public Long getUserId() {
65 + return userId;
66 + }
67 +
68 + public void setUserId(Long userId) {
69 + this.userId = userId;
70 + }
71 +
72 + public List<String> getDeliveryNoList() {
73 + return deliveryNoList;
74 + }
75 +
76 + public void setDeliveryNoList(List<String> deliveryNoList) {
77 + this.deliveryNoList = deliveryNoList;
78 + }
79 +
80 + public Long getSort() {
81 + return sort;
82 + }
83 +
84 + public void setSort(Long sort) {
85 + this.sort = sort;
86 + }
87 +}
1 +package com.fedex.connect.customer.service;
2 +
3 +
4 +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 +
6 +import javax.annotation.Resource;
7 +
8 +public class AbstractEtService {
9 +
10 + @Resource
11 + protected LocaleMessageUtil localeMessageUtil;
12 +
13 + /**
14 + * repository
15 + */
16 +
17 +
18 + /**
19 + * Mapper---------------------------------------------
20 + */
21 +
22 +
23 + /**
24 + * MapperExt---------------------------------------------
25 + */
26 +
27 +}
1 +package com.fedex.connect.customer.service.biz;
2 +
3 +public interface IConsignmentService {
4 +
5 +}
1 +package com.fedex.connect.customer.service.biz.impl;
2 +
3 +import com.fedex.connect.customer.service.AbstractEtService;
4 +import com.fedex.connect.customer.service.biz.IConsignmentService;
5 +import org.springframework.stereotype.Service;
6 +
7 +@Service
8 +public class ConsignmentServiceImpl extends AbstractEtService implements IConsignmentService {
9 +
10 +}
1 package com.fedex.connect.common.dependencies.authentication.exception; 1 package com.fedex.connect.common.dependencies.authentication.exception;
2 2
3 -import com.fedex.export.common.i18n.LocaleMessageUtil; 3 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
4 -import com.fedex.export.common.util.SpringBeanUtil; 4 +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 -import com.fedex.export.data.vo.JsonResult; 5 +import com.fedex.connect.common.dependencies.util.SpringBeanUtil;
6 import com.google.gson.Gson; 6 import com.google.gson.Gson;
7 import org.springframework.security.access.AccessDeniedException; 7 import org.springframework.security.access.AccessDeniedException;
8 import org.springframework.security.web.access.AccessDeniedHandler; 8 import org.springframework.security.web.access.AccessDeniedHandler;
...@@ -24,7 +24,7 @@ public class JwtAccessDeniedHandler implements AccessDeniedHandler { ...@@ -24,7 +24,7 @@ public class JwtAccessDeniedHandler implements AccessDeniedHandler {
24 public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException { 24 public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException {
25 response.setCharacterEncoding("UTF-8"); 25 response.setCharacterEncoding("UTF-8");
26 response.setContentType("application/json"); 26 response.setContentType("application/json");
27 - JsonResult result = new JsonResult(); 27 + ResponseResultVo result = new ResponseResultVo();
28 result.setCode(HttpServletResponse.SC_FORBIDDEN); 28 result.setCode(HttpServletResponse.SC_FORBIDDEN);
29 //使用context手动注入 29 //使用context手动注入
30 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); 30 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class);
......
1 package com.fedex.connect.common.dependencies.authentication.exception; 1 package com.fedex.connect.common.dependencies.authentication.exception;
2 2
3 -import com.fedex.export.common.i18n.LocaleMessageUtil; 3 +
4 -import com.fedex.export.common.util.SpringBeanUtil; 4 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 -import com.fedex.export.data.vo.JsonResult; 5 +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 +import com.fedex.connect.common.dependencies.util.SpringBeanUtil;
6 import com.google.gson.Gson; 7 import com.google.gson.Gson;
7 import org.springframework.security.core.AuthenticationException; 8 import org.springframework.security.core.AuthenticationException;
8 import org.springframework.security.web.AuthenticationEntryPoint; 9 import org.springframework.security.web.AuthenticationEntryPoint;
...@@ -25,7 +26,7 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { ...@@ -25,7 +26,7 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
25 26
26 response.setCharacterEncoding("UTF-8"); 27 response.setCharacterEncoding("UTF-8");
27 response.setContentType("application/json"); 28 response.setContentType("application/json");
28 - JsonResult result = new JsonResult(); 29 + ResponseResultVo result = new ResponseResultVo();
29 result.setCode(HttpServletResponse.SC_UNAUTHORIZED); 30 result.setCode(HttpServletResponse.SC_UNAUTHORIZED);
30 //使用context手动注入 31 //使用context手动注入
31 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); 32 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class);
......
...@@ -3,7 +3,7 @@ package com.fedex.connect.common.dependencies.config; ...@@ -3,7 +3,7 @@ package com.fedex.connect.common.dependencies.config;
3 3
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 import com.fedex.connect.common.dependencies.util.Utils; 5 import com.fedex.connect.common.dependencies.util.Utils;
6 -import com.fedex.connect.common.model.base.DictionaryEntries; 6 +import com.fedex.connect.common.model.bi.DictionaryEntries;
7 import org.slf4j.Logger; 7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
9 import org.springframework.boot.CommandLineRunner; 9 import org.springframework.boot.CommandLineRunner;
......
1 package com.fedex.connect.common.dependencies.config; 1 package com.fedex.connect.common.dependencies.config;
2 2
3 -import com.fedex.connect.common.model.base.DictionaryEntries; 3 +import com.fedex.connect.common.model.bi.DictionaryEntries;
4 4
5 import java.util.List; 5 import java.util.List;
6 6
......
1 +package com.fedex.connect.common.dependencies.date.dto;
2 +
3 +import com.fedex.connect.common.model.sys.User;
4 +import org.springframework.security.core.GrantedAuthority;
5 +import org.springframework.security.core.userdetails.UserDetails;
6 +
7 +import java.util.Collection;
8 +import java.util.HashSet;
9 +import java.util.Set;
10 +
11 +/**
12 + * 继承核心用户信息。实现UserDetails。SpringSecurity进行用户信息认证
13 + * @author Administrator
14 + */
15 +public class SecurityUserDetails implements UserDetails {
16 +
17 + private static final long serialVersionUID = 1L;
18 +
19 + private Long id;
20 +
21 + private String username;
22 +
23 + private String password;
24 +
25 + private boolean isAccountNonExpired = true;
26 +
27 + private boolean isAccountNonLocked = true;
28 +
29 + private boolean isCredentialsNonExpired = true;
30 +
31 + private boolean isEnabled = true;
32 +
33 + private User user;
34 +
35 + private Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
36 +
37 + public void setId(Long id) {
38 + this.id = id;
39 + }
40 +
41 + public void setUsername(String username) {
42 + this.username = username;
43 + }
44 +
45 + public void setPassword(String password) {
46 + this.password = password;
47 + }
48 +
49 + public void setAccountNonExpired(boolean isAccountNonExpired) {
50 + this.isAccountNonExpired = isAccountNonExpired;
51 + }
52 +
53 + public void setAccountNonLocked(boolean isAccountNonLocked) {
54 + this.isAccountNonLocked = isAccountNonLocked;
55 + }
56 +
57 + public void setCredentialsNonExpired(boolean isCredentialsNonExpired) {
58 + this.isCredentialsNonExpired = isCredentialsNonExpired;
59 + }
60 +
61 + public void setEnabled(boolean isEnabled) {
62 + this.isEnabled = isEnabled;
63 + }
64 +
65 + public void setAuthorities(Set<GrantedAuthority> authorities) {
66 + this.authorities = authorities;
67 + }
68 +
69 + public Long getId() {
70 + return id;
71 + }
72 +
73 + @Override
74 + public String getUsername() {
75 + return username;
76 + }
77 +
78 + @Override
79 + public String getPassword() {
80 + return password;
81 + }
82 +
83 + @Override
84 + public boolean isAccountNonExpired() {
85 + return isAccountNonExpired;
86 + }
87 +
88 + @Override
89 + public boolean isAccountNonLocked() {
90 + return isAccountNonLocked;
91 + }
92 +
93 + @Override
94 + public boolean isCredentialsNonExpired() {
95 + return isCredentialsNonExpired;
96 + }
97 +
98 + @Override
99 + public boolean isEnabled() {
100 + return isEnabled;
101 + }
102 +
103 +
104 + @Override
105 + public Collection<GrantedAuthority> getAuthorities() {
106 + return authorities;
107 + }
108 +
109 + public User getUser() {
110 + return user;
111 + }
112 +
113 + public void setUser(User user) {
114 + this.user = user;
115 + }
116 +}
1 +package com.fedex.connect.common.dependencies.date.model;
2 +
3 +import com.google.gson.Gson;
4 +
5 +/**
6 + * 用于打印日志的Model。
7 + * 为了将来打印的日志,转换语言
8 + * @author EDY
9 + */
10 +public class LogShowModel {
11 +
12 + /**
13 + * 方法
14 + */
15 + private String method;
16 +
17 + /**
18 + * 参数
19 + */
20 + private Object param;
21 +
22 + /**
23 + * 返回
24 + */
25 + private Object result;
26 +
27 + /**
28 + * 异常
29 + */
30 + private Exception e;
31 +
32 + /**
33 + * 错误
34 + */
35 + private String msg;
36 +
37 +
38 + public static String showRequest(String methodName, Object param){
39 + LogShowModel lsm = new LogShowModel();
40 + lsm.setMethod(methodName);
41 + lsm.setParam(param);
42 + return lsm.toString();
43 + }
44 +
45 + public static String showResponse(String methodName, Object result){
46 + LogShowModel lsm = new LogShowModel();
47 + lsm.setMethod(methodName);
48 + lsm.setResult(result);
49 + return lsm.toString();
50 + }
51 +
52 + public static String showException(String methodName, Exception e){
53 + LogShowModel lsm = new LogShowModel();
54 + lsm.setMethod(methodName);
55 + lsm.setE(e);
56 + return lsm.toString();
57 + }
58 +
59 + public static String showMsg(String methodName, String msg){
60 + LogShowModel lsm = new LogShowModel();
61 + lsm.setMethod(methodName);
62 + lsm.setMsg(msg);
63 + return lsm.toString();
64 + }
65 +
66 + @Override
67 + public String toString() {
68 + Gson gson = new Gson();
69 + StringBuilder show = new StringBuilder("方法:" + method);
70 + if (param != null){
71 + show.append(",请求参数:"+gson.toJson(param));
72 + }
73 + if (result != null){
74 + show.append(",响应:"+gson.toJson(result));
75 + }
76 + if (e != null){
77 + show.append(",异常:"+ e.toString());
78 + }
79 + if (msg != null){
80 + show.append(","+ msg);
81 + }
82 + return show.toString();
83 + }
84 +
85 + public LogShowModel(String method, Object param, Object result, Exception e, String msg) {
86 + this.method = method;
87 + this.param = param;
88 + this.result = result;
89 + this.e = e;
90 + this.msg = msg;
91 + }
92 +
93 + public LogShowModel() {
94 + }
95 +
96 + public String getMethod() {
97 + return method;
98 + }
99 +
100 + public void setMethod(String method) {
101 + this.method = method;
102 + }
103 +
104 + public Object getParam() {
105 + return param;
106 + }
107 +
108 + public void setParam(Object param) {
109 + this.param = param;
110 + }
111 +
112 + public Object getResult() {
113 + return result;
114 + }
115 +
116 + public void setResult(Object result) {
117 + this.result = result;
118 + }
119 +
120 + public Exception getE() {
121 + return e;
122 + }
123 +
124 + public void setE(Exception e) {
125 + this.e = e;
126 + }
127 +
128 + public String getMsg() {
129 + return msg;
130 + }
131 +
132 + public void setMsg(String msg) {
133 + this.msg = msg;
134 + }
135 +}
1 -package com.fedex.connect.manager.data.vo; 1 +package com.fedex.connect.common.dependencies.date.vo;
2 2
3 import com.fedex.connect.common.dependencies.enums.ResponseCode; 3 import com.fedex.connect.common.dependencies.enums.ResponseCode;
4 4
5 import javax.servlet.http.HttpServletResponse; 5 import javax.servlet.http.HttpServletResponse;
6 6
7 -public class JsonResult<T> { 7 +/**
8 + * @Author Szl
9 + * @Description 类说明 响应结果vo
10 + * @Date 2024/10/30
11 + */
12 +public class ResponseResultVo<T> {
8 13
9 private int code = HttpServletResponse.SC_BAD_REQUEST;; 14 private int code = HttpServletResponse.SC_BAD_REQUEST;;
10 private String msg; 15 private String msg;
...@@ -43,16 +48,16 @@ public class JsonResult<T> { ...@@ -43,16 +48,16 @@ public class JsonResult<T> {
43 this.data = data; 48 this.data = data;
44 } 49 }
45 50
46 - public static JsonResult succ(Object data,String message) { 51 + public static ResponseResultVo succ(Object data, String message) {
47 return succ(ResponseCode.SUCCESS_CODE.getCode(), message, data); 52 return succ(ResponseCode.SUCCESS_CODE.getCode(), message, data);
48 } 53 }
49 54
50 - public static JsonResult succ(Object data) { 55 + public static ResponseResultVo succ(Object data) {
51 return succ(ResponseCode.SUCCESS_CODE.getCode(), "SUCCESS", data); 56 return succ(ResponseCode.SUCCESS_CODE.getCode(), "SUCCESS", data);
52 } 57 }
53 58
54 - public static JsonResult succ(int code, String msg, Object data) { 59 + public static ResponseResultVo succ(int code, String msg, Object data) {
55 - JsonResult r = new JsonResult(); 60 + ResponseResultVo r = new ResponseResultVo();
56 r.setCode(code); 61 r.setCode(code);
57 r.setMsg(msg); 62 r.setMsg(msg);
58 r.setSuccess(true); 63 r.setSuccess(true);
...@@ -60,12 +65,12 @@ public class JsonResult<T> { ...@@ -60,12 +65,12 @@ public class JsonResult<T> {
60 return r; 65 return r;
61 } 66 }
62 67
63 - public static JsonResult fail(String msg) { 68 + public static ResponseResultVo fail(String msg) {
64 return fail(ResponseCode.FAIL_CODE.getCode(), msg,null); 69 return fail(ResponseCode.FAIL_CODE.getCode(), msg,null);
65 } 70 }
66 71
67 - public static JsonResult fail(int code, String msg,Object data) { 72 + public static ResponseResultVo fail(int code, String msg, Object data) {
68 - JsonResult r = new JsonResult(); 73 + ResponseResultVo r = new ResponseResultVo();
69 r.setCode(code); 74 r.setCode(code);
70 r.setMsg(msg); 75 r.setMsg(msg);
71 r.setSuccess(false); 76 r.setSuccess(false);
...@@ -73,11 +78,11 @@ public class JsonResult<T> { ...@@ -73,11 +78,11 @@ public class JsonResult<T> {
73 return r; 78 return r;
74 } 79 }
75 80
76 - public static JsonResult fail(ResponseCode resultCode) { 81 + public static ResponseResultVo fail(ResponseCode resultCode) {
77 return fail(resultCode.getCode(), resultCode.getMsg(), null); 82 return fail(resultCode.getCode(), resultCode.getMsg(), null);
78 } 83 }
79 84
80 - public static JsonResult fail(ResponseCode resultCode, Object data) { 85 + public static ResponseResultVo fail(ResponseCode resultCode, Object data) {
81 return fail(resultCode.getCode(), resultCode.getMsg(), data); 86 return fail(resultCode.getCode(), resultCode.getMsg(), data);
82 } 87 }
83 } 88 }
......
1 +package com.fedex.connect.common.dependencies.util;
2 +
3 +import com.fedex.connect.common.dependencies.date.dto.SecurityUserDetails;
4 +import com.fedex.connect.common.model.sys.User;
5 +import org.springframework.security.core.GrantedAuthority;
6 +import org.springframework.security.core.context.SecurityContextHolder;
7 +import org.springframework.security.core.userdetails.UserDetails;
8 +
9 +import java.util.ArrayList;
10 +import java.util.Collection;
11 +import java.util.List;
12 +
13 +
14 +/**
15 + * @author Administrator
16 + */
17 +public class CurrentUserInfo {
18 +
19 + public static UserDetails getUserDetails() throws RuntimeException {
20 + Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
21 + UserDetails userDetails = null;
22 + try {
23 + userDetails = (UserDetails) principal;
24 + } catch (Exception e) {
25 + e.printStackTrace();
26 + throw e;
27 + }
28 + return userDetails;
29 + }
30 +
31 + public static User getCurUser() throws Exception {
32 + SecurityUserDetails userDetails = null;
33 + try {
34 + userDetails = (SecurityUserDetails) getUserDetails();
35 + } catch (Exception e) {
36 + throw e;
37 + }
38 + return userDetails.getUser();
39 + }
40 +
41 + public static User getUser() throws Exception {
42 + User sysUser = null;
43 + try {
44 + sysUser = getCurUser();
45 + } catch (Exception e) {
46 + throw e;
47 + }
48 + return sysUser;
49 + }
50 +
51 + /**
52 + * 用户ID
53 + *
54 + * @return
55 + */
56 + public static Long getUserId() throws Exception {
57 + return getUser().getId();
58 + }
59 +
60 + /**
61 + * 用户登录名 + 用户姓名
62 + *
63 + * @return
64 + */
65 + public static String getUserName() throws Exception {
66 + return getUser().getAccNo() + " - " + getUser().getUserName();
67 + }
68 +
69 + /**
70 + * 用户登录名
71 + *
72 + * @return
73 + */
74 + public static String getLoginName() throws Exception {
75 + return getUser().getAccNo();
76 + }
77 +
78 + public static Long findUserId() {
79 + SecurityUserDetails s = ((SecurityUserDetails) getUserDetails());
80 + return s.getId();
81 + }
82 +
83 + public static List<String> getAuthorities() {
84 + Collection<GrantedAuthority> gaList = (Collection<GrantedAuthority>) getUserDetails().getAuthorities();
85 + List<String> list = new ArrayList<String>();
86 + for (GrantedAuthority ga : gaList) {
87 + list.add(ga.getAuthority());
88 + }
89 + return list;
90 + }
91 +}
1 +package com.fedex.connect.common.dependencies.util;
2 +
3 +import org.springframework.beans.BeansException;
4 +import org.springframework.context.ApplicationContext;
5 +import org.springframework.context.ApplicationContextAware;
6 +import org.springframework.stereotype.Component;
7 +
8 +/**
9 + *spring加载过程中将ApplicationContext注入到工具类当中,在使用时,直接从工具类中获取对应的bean
10 + * @author EDY
11 + */
12 +@Component
13 +public class SpringBeanUtil implements ApplicationContextAware {
14 +
15 + private static ApplicationContext applicationContext;
16 +
17 + @Override
18 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
19 + /** 将框架初始化加载的ioc容器赋值给 静态ApplicationContext*/
20 + if (SpringBeanUtil.applicationContext == null) {
21 + SpringBeanUtil.applicationContext = applicationContext;
22 + }
23 + }
24 +
25 + /**
26 + * 获取Ioc容器
27 + */
28 + public static ApplicationContext getApplicationContext() {
29 + return applicationContext;
30 + }
31 +
32 +
33 + /**
34 + * 通过名称获取Bean
35 + */
36 + public static Object getBean(String name) {
37 + return getApplicationContext().getBean(name);
38 + }
39 +
40 + /**
41 + * 通过class获取Bean
42 + */
43 + public static <T> T getBean(Class<T> clazz) {
44 + return getApplicationContext().getBean(clazz);
45 + }
46 +
47 + /**
48 + * 通过名称、class获取Bean
49 + */
50 + public static <T> T getBean(String name, Class<T> clazz) {
51 + return getApplicationContext().getBean(name, clazz);
52 + }
53 +}
...\ No newline at end of file ...\ No newline at end of file
1 package com.fedex.connect.manager.controller; 1 package com.fedex.connect.manager.controller;
2 2
3 3
4 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
4 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 import com.fedex.connect.manager.config.PropertiesConfig; 6 import com.fedex.connect.manager.config.PropertiesConfig;
6 import com.fedex.connect.manager.controller.log.ILogLoginService; 7 import com.fedex.connect.manager.controller.log.ILogLoginService;
7 -import com.fedex.connect.manager.data.vo.JsonResult;
8 import com.fedex.connect.manager.service.system.ISysAuthService; 8 import com.fedex.connect.manager.service.system.ISysAuthService;
9 import com.fedex.connect.manager.service.system.ISysUserService; 9 import com.fedex.connect.manager.service.system.ISysUserService;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
...@@ -86,7 +86,7 @@ public class AbstractEtController { ...@@ -86,7 +86,7 @@ public class AbstractEtController {
86 * @param response 86 * @param response
87 * @return 87 * @return
88 */ 88 */
89 - public HttpStatus errorMappingStatus(JsonResult response) { 89 + public HttpStatus errorMappingStatus(ResponseResultVo response) {
90 if (Objects.isNull(response)) { 90 if (Objects.isNull(response)) {
91 return HttpStatus.BAD_REQUEST; //400 91 return HttpStatus.BAD_REQUEST; //400
92 } 92 }
...@@ -100,7 +100,7 @@ public class AbstractEtController { ...@@ -100,7 +100,7 @@ public class AbstractEtController {
100 * @param <T> 100 * @param <T>
101 * @return 101 * @return
102 */ 102 */
103 - public <T> boolean isSuccess(ResponseEntity<JsonResult<T>> responseEntity) { 103 + public <T> boolean isSuccess(ResponseEntity<ResponseResultVo<T>> responseEntity) {
104 return responseEntity != null && responseEntity.getBody() != null && responseEntity.getBody().isSuccess(); 104 return responseEntity != null && responseEntity.getBody() != null && responseEntity.getBody().isSuccess();
105 } 105 }
106 106
...@@ -110,7 +110,7 @@ public class AbstractEtController { ...@@ -110,7 +110,7 @@ public class AbstractEtController {
110 * @param <T> 110 * @param <T>
111 * @return 111 * @return
112 */ 112 */
113 - public <T> boolean isSuccess(JsonResult<T> response) { 113 + public <T> boolean isSuccess(ResponseResultVo<T> response) {
114 return response != null && response.isSuccess(); 114 return response != null && response.isSuccess();
115 } 115 }
116 116
......
...@@ -2,6 +2,7 @@ package com.fedex.connect.manager.controller.system.impl; ...@@ -2,6 +2,7 @@ package com.fedex.connect.manager.controller.system.impl;
2 2
3 3
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 import com.fedex.connect.common.dependencies.util.GsonUtils; 6 import com.fedex.connect.common.dependencies.util.GsonUtils;
6 import com.fedex.connect.common.dependencies.util.StringExtUtil; 7 import com.fedex.connect.common.dependencies.util.StringExtUtil;
7 import com.fedex.connect.common.dependencies.util.Utils; 8 import com.fedex.connect.common.dependencies.util.Utils;
...@@ -12,7 +13,6 @@ import com.fedex.connect.manager.controller.system.ISysAuthController; ...@@ -12,7 +13,6 @@ import com.fedex.connect.manager.controller.system.ISysAuthController;
12 import com.fedex.connect.manager.data.dto.LogLoginDto; 13 import com.fedex.connect.manager.data.dto.LogLoginDto;
13 import com.fedex.connect.manager.data.dto.LoginRequest; 14 import com.fedex.connect.manager.data.dto.LoginRequest;
14 import com.fedex.connect.manager.data.dto.SysUserDto; 15 import com.fedex.connect.manager.data.dto.SysUserDto;
15 -import com.fedex.connect.manager.data.vo.JsonResult;
16 import com.google.gson.JsonObject; 16 import com.google.gson.JsonObject;
17 import io.swagger.annotations.Api; 17 import io.swagger.annotations.Api;
18 import io.swagger.annotations.ApiOperation; 18 import io.swagger.annotations.ApiOperation;
...@@ -44,8 +44,8 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA ...@@ -44,8 +44,8 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA
44 44
45 @PostMapping("/init") 45 @PostMapping("/init")
46 @ApiOperation(value = "初始化进入首页获取FCL登录地址") 46 @ApiOperation(value = "初始化进入首页获取FCL登录地址")
47 - public JsonResult init(){ 47 + public ResponseResultVo init(){
48 - return JsonResult.succ(fclIndexLoginUrl); 48 + return ResponseResultVo.succ(fclIndexLoginUrl);
49 } 49 }
50 50
51 51
...@@ -79,7 +79,7 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA ...@@ -79,7 +79,7 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA
79 if (cookiesList.size() > 0 && cookiesList.size() == saveKeyList.size()){ 79 if (cookiesList.size() > 0 && cookiesList.size() == saveKeyList.size()){
80 JsonObject jsonObject = GsonUtils.stringToBean("{"+String.join(",",cookiesList)+"}",JsonObject.class); 80 JsonObject jsonObject = GsonUtils.stringToBean("{"+String.join(",",cookiesList)+"}",JsonObject.class);
81 //set cookie by fcl_key 81 //set cookie by fcl_key
82 - JsonResult tokenResult = sysAuthService.createFclToken(jsonObject); 82 + ResponseResultVo tokenResult = sysAuthService.createFclToken(jsonObject);
83 if (tokenResult.isSuccess()){ 83 if (tokenResult.isSuccess()){
84 String fcl_token_key = String.valueOf(tokenResult.getData()); 84 String fcl_token_key = String.valueOf(tokenResult.getData());
85 String redirectUrl = String.format("%s?token=%s", propertiesConfig.getFclLoginUrl(), fcl_token_key); 85 String redirectUrl = String.format("%s?token=%s", propertiesConfig.getFclLoginUrl(), fcl_token_key);
...@@ -137,7 +137,7 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA ...@@ -137,7 +137,7 @@ public class SysAuthControllerImpl extends AbstractEtController implements ISysA
137 //创建token 137 //创建token
138 LoginRequest loginRequest = new LoginRequest(); 138 LoginRequest loginRequest = new LoginRequest();
139 loginRequest.setRememberMe(true); 139 loginRequest.setRememberMe(true);
140 - JsonResult tokenResult = sysAuthService.createAccessToken(loginRequest, loginUser); 140 + ResponseResultVo tokenResult = sysAuthService.createAccessToken(loginRequest, loginUser);
141 141
142 //记录日志 142 //记录日志
143 LogLoginDto dto = new LogLoginDto(loginUser.getId(), DatabaseConstants.USER_OPER_FCL_REGISTER, 143 LogLoginDto dto = new LogLoginDto(loginUser.getId(), DatabaseConstants.USER_OPER_FCL_REGISTER,
......
1 package com.fedex.connect.manager.data.dto; 1 package com.fedex.connect.manager.data.dto;
2 2
3 3
4 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
4 import com.fedex.connect.common.dependencies.enums.ResponseCode; 5 import com.fedex.connect.common.dependencies.enums.ResponseCode;
5 import com.fedex.connect.common.dependencies.util.Utils; 6 import com.fedex.connect.common.dependencies.util.Utils;
6 -import com.fedex.connect.manager.data.vo.JsonResult;
7 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
8 8
9 import java.io.Serializable; 9 import java.io.Serializable;
...@@ -26,17 +26,17 @@ public class LoginRequest implements Serializable { ...@@ -26,17 +26,17 @@ public class LoginRequest implements Serializable {
26 * @param dto 26 * @param dto
27 * @return 27 * @return
28 */ 28 */
29 - public static JsonResult validate(LoginRequest dto){ 29 + public static ResponseResultVo validate(LoginRequest dto){
30 if (dto == null){ 30 if (dto == null){
31 - JsonResult.fail(ResponseCode.REQUEST_PARAM_NULL.getMsg()); 31 + ResponseResultVo.fail(ResponseCode.REQUEST_PARAM_NULL.getMsg());
32 } 32 }
33 if (StringUtils.isBlank(dto.getAccNo())){ 33 if (StringUtils.isBlank(dto.getAccNo())){
34 - JsonResult.fail("auth_login_accno_null"); 34 + ResponseResultVo.fail("auth_login_accno_null");
35 } 35 }
36 if (StringUtils.isBlank(dto.getPassword())){ 36 if (StringUtils.isBlank(dto.getPassword())){
37 - JsonResult.fail("auth_login_pwd_null"); 37 + ResponseResultVo.fail("auth_login_pwd_null");
38 } 38 }
39 - return JsonResult.succ(null); 39 + return ResponseResultVo.succ(null);
40 } 40 }
41 41
42 /** 42 /**
......
...@@ -2,12 +2,12 @@ package com.fedex.connect.manager.data.dto; ...@@ -2,12 +2,12 @@ package com.fedex.connect.manager.data.dto;
2 2
3 import com.fasterxml.jackson.annotation.JsonIgnore; 3 import com.fasterxml.jackson.annotation.JsonIgnore;
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
5 import com.fedex.connect.common.dependencies.enums.ResponseCode; 6 import com.fedex.connect.common.dependencies.enums.ResponseCode;
6 import com.fedex.connect.common.dependencies.util.BytesUtils; 7 import com.fedex.connect.common.dependencies.util.BytesUtils;
7 import com.fedex.connect.common.dependencies.util.StringExtUtil; 8 import com.fedex.connect.common.dependencies.util.StringExtUtil;
8 import com.fedex.connect.common.dependencies.util.Utils; 9 import com.fedex.connect.common.dependencies.util.Utils;
9 import com.fedex.connect.common.model.sys.User; 10 import com.fedex.connect.common.model.sys.User;
10 -import com.fedex.connect.manager.data.vo.JsonResult;
11 import io.swagger.annotations.ApiModel; 11 import io.swagger.annotations.ApiModel;
12 import org.apache.commons.lang3.StringUtils; 12 import org.apache.commons.lang3.StringUtils;
13 import org.apache.commons.lang3.math.NumberUtils; 13 import org.apache.commons.lang3.math.NumberUtils;
...@@ -43,94 +43,94 @@ public class SysUserDto { ...@@ -43,94 +43,94 @@ public class SysUserDto {
43 * @param dto 43 * @param dto
44 * @return 44 * @return
45 */ 45 */
46 - public static JsonResult validatedDto(SysUserDto dto){ 46 + public static ResponseResultVo validatedDto(SysUserDto dto){
47 if (dto == null){ 47 if (dto == null){
48 - JsonResult.fail(ResponseCode.REQUEST_PARAM_NULL.getMsg()); 48 + ResponseResultVo.fail(ResponseCode.REQUEST_PARAM_NULL.getMsg());
49 } 49 }
50 //必填校验 50 //必填校验
51 if (StringUtils.isBlank(dto.getAccNo())){ 51 if (StringUtils.isBlank(dto.getAccNo())){
52 - JsonResult.fail("dto_vali_user_accno_null"); 52 + ResponseResultVo.fail("dto_vali_user_accno_null");
53 } 53 }
54 if (BytesUtils.getStrUTF8ByteLength(dto.getAccNo()) > 200){ 54 if (BytesUtils.getStrUTF8ByteLength(dto.getAccNo()) > 200){
55 - JsonResult.fail("dto_vali_user_accno_max"); 55 + ResponseResultVo.fail("dto_vali_user_accno_max");
56 } 56 }
57 if (StringUtils.isBlank(dto.getUserName())){ 57 if (StringUtils.isBlank(dto.getUserName())){
58 - JsonResult.fail("dto_vali_user_name_null"); 58 + ResponseResultVo.fail("dto_vali_user_name_null");
59 } 59 }
60 if (BytesUtils.getStrUTF8ByteLength(dto.getUserName()) > 200){ 60 if (BytesUtils.getStrUTF8ByteLength(dto.getUserName()) > 200){
61 - JsonResult.fail("dto_vali_user_name_max"); 61 + ResponseResultVo.fail("dto_vali_user_name_max");
62 } 62 }
63 if (StringUtils.isBlank(dto.getPassword())){ 63 if (StringUtils.isBlank(dto.getPassword())){
64 - JsonResult.fail("dto_vali_user_pwd_null"); 64 + ResponseResultVo.fail("dto_vali_user_pwd_null");
65 } 65 }
66 if (BytesUtils.getStrUTF8ByteLength(dto.getPassword()) > 255){ 66 if (BytesUtils.getStrUTF8ByteLength(dto.getPassword()) > 255){
67 - JsonResult.fail("dto_vali_user_pwd_max"); 67 + ResponseResultVo.fail("dto_vali_user_pwd_max");
68 } 68 }
69 if (StringUtils.isBlank(dto.getPassword2())){ 69 if (StringUtils.isBlank(dto.getPassword2())){
70 - JsonResult.fail("dto_vali_user_pwd2_null"); 70 + ResponseResultVo.fail("dto_vali_user_pwd2_null");
71 } 71 }
72 if (StringUtils.equals(dto.getPassword(),dto.getPassword2())){ 72 if (StringUtils.equals(dto.getPassword(),dto.getPassword2())){
73 - JsonResult.fail("dto_vali_user_pwd3_null"); 73 + ResponseResultVo.fail("dto_vali_user_pwd3_null");
74 } 74 }
75 if (StringUtils.isBlank(dto.getFedexAccNo())){ 75 if (StringUtils.isBlank(dto.getFedexAccNo())){
76 - JsonResult.fail("dto_vali_user_fed_no_null"); 76 + ResponseResultVo.fail("dto_vali_user_fed_no_null");
77 } 77 }
78 if (BytesUtils.getStrUTF8ByteLength(dto.getFedexAccNo()) > 200){ 78 if (BytesUtils.getStrUTF8ByteLength(dto.getFedexAccNo()) > 200){
79 - JsonResult.fail("dto_vali_user_fed_no_max"); 79 + ResponseResultVo.fail("dto_vali_user_fed_no_max");
80 } 80 }
81 if (!NumberUtils.isDigits(dto.getFedexAccNo()) || dto.getFedexAccNo().length() != 9){ 81 if (!NumberUtils.isDigits(dto.getFedexAccNo()) || dto.getFedexAccNo().length() != 9){
82 - JsonResult.fail("dto_vali_user_fed_no_num"); 82 + ResponseResultVo.fail("dto_vali_user_fed_no_num");
83 } 83 }
84 if (StringUtils.isBlank(dto.getFedexAccNo2())){ 84 if (StringUtils.isBlank(dto.getFedexAccNo2())){
85 - JsonResult.fail("dto_vali_user_fed_no_null"); 85 + ResponseResultVo.fail("dto_vali_user_fed_no_null");
86 } 86 }
87 if (!NumberUtils.isDigits(dto.getFedexAccNo2()) || dto.getFedexAccNo2().length() != 9){ 87 if (!NumberUtils.isDigits(dto.getFedexAccNo2()) || dto.getFedexAccNo2().length() != 9){
88 - JsonResult.fail("dto_vali_user_fed_no_num"); 88 + ResponseResultVo.fail("dto_vali_user_fed_no_num");
89 } 89 }
90 if (StringUtils.equals(dto.getFedexAccNo(),dto.getFedexAccNo2())){ 90 if (StringUtils.equals(dto.getFedexAccNo(),dto.getFedexAccNo2())){
91 - JsonResult.fail("dto_vali_user_fed_no3_null"); 91 + ResponseResultVo.fail("dto_vali_user_fed_no3_null");
92 } 92 }
93 if (StringUtils.isBlank(dto.getEmail())){ 93 if (StringUtils.isBlank(dto.getEmail())){
94 - JsonResult.fail("dto_vali_user_email_null"); 94 + ResponseResultVo.fail("dto_vali_user_email_null");
95 } 95 }
96 if (BytesUtils.getStrUTF8ByteLength(dto.getEmail()) > 100){ 96 if (BytesUtils.getStrUTF8ByteLength(dto.getEmail()) > 100){
97 - JsonResult.fail("dto_vali_user_email_max"); 97 + ResponseResultVo.fail("dto_vali_user_email_max");
98 } 98 }
99 if (!StringExtUtil.isEmail(dto.getEmail())){ 99 if (!StringExtUtil.isEmail(dto.getEmail())){
100 - JsonResult.fail("dto_vali_user_email_final"); 100 + ResponseResultVo.fail("dto_vali_user_email_final");
101 } 101 }
102 if (StringUtils.isBlank(dto.getPhone())){ 102 if (StringUtils.isBlank(dto.getPhone())){
103 - JsonResult.fail("dto_vali_user_phone_null"); 103 + ResponseResultVo.fail("dto_vali_user_phone_null");
104 } 104 }
105 if (BytesUtils.getStrUTF8ByteLength(dto.getPhone()) > 20){ 105 if (BytesUtils.getStrUTF8ByteLength(dto.getPhone()) > 20){
106 - JsonResult.fail("dto_vali_user_phone_max"); 106 + ResponseResultVo.fail("dto_vali_user_phone_max");
107 } 107 }
108 if (StringUtils.isBlank(dto.getCompanyName())){ 108 if (StringUtils.isBlank(dto.getCompanyName())){
109 - JsonResult.fail("dto_vali_user_com_name_null"); 109 + ResponseResultVo.fail("dto_vali_user_com_name_null");
110 } 110 }
111 if (BytesUtils.getStrUTF8ByteLength(dto.getCompanyName()) > 255){ 111 if (BytesUtils.getStrUTF8ByteLength(dto.getCompanyName()) > 255){
112 - JsonResult.fail("dto_vali_user_com_name_max"); 112 + ResponseResultVo.fail("dto_vali_user_com_name_max");
113 } 113 }
114 if (StringUtils.isBlank(dto.getUnifiedBusinessNum())){ 114 if (StringUtils.isBlank(dto.getUnifiedBusinessNum())){
115 - JsonResult.fail("dto_vali_user_no_null"); 115 + ResponseResultVo.fail("dto_vali_user_no_null");
116 } 116 }
117 if (BytesUtils.getStrUTF8ByteLength(dto.getUnifiedBusinessNum()) > 30){ 117 if (BytesUtils.getStrUTF8ByteLength(dto.getUnifiedBusinessNum()) > 30){
118 - JsonResult.fail("dto_vali_user_no_max"); 118 + ResponseResultVo.fail("dto_vali_user_no_max");
119 } 119 }
120 if (!StringUtils.isBlank(dto.getCustomsSerialNum()) && 120 if (!StringUtils.isBlank(dto.getCustomsSerialNum()) &&
121 BytesUtils.getStrUTF8ByteLength(dto.getUnifiedBusinessNum()) > 30){ 121 BytesUtils.getStrUTF8ByteLength(dto.getUnifiedBusinessNum()) > 30){
122 - JsonResult.fail("dto_vali_serlai_max"); 122 + ResponseResultVo.fail("dto_vali_serlai_max");
123 } 123 }
124 if (!NumberUtils.isDigits(dto.getUnifiedBusinessNum())){ 124 if (!NumberUtils.isDigits(dto.getUnifiedBusinessNum())){
125 - JsonResult.fail("dto_vali_user_no_final"); 125 + ResponseResultVo.fail("dto_vali_user_no_final");
126 } 126 }
127 if (!dto.isPolicyFlag()){ 127 if (!dto.isPolicyFlag()){
128 - JsonResult.fail("dto_vali_user_no_policy"); 128 + ResponseResultVo.fail("dto_vali_user_no_policy");
129 } 129 }
130 if (!dto.isClauseFlag()){ 130 if (!dto.isClauseFlag()){
131 - JsonResult.fail("dto_vali_user_no_clause"); 131 + ResponseResultVo.fail("dto_vali_user_no_clause");
132 } 132 }
133 - return JsonResult.succ(null); 133 + return ResponseResultVo.succ(null);
134 } 134 }
135 135
136 /** 136 /**
......
1 package com.fedex.connect.manager.service.system; 1 package com.fedex.connect.manager.service.system;
2 2
3 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
3 import com.fedex.connect.common.model.sys.User; 4 import com.fedex.connect.common.model.sys.User;
4 import com.fedex.connect.manager.data.dto.LoginRequest; 5 import com.fedex.connect.manager.data.dto.LoginRequest;
5 -import com.fedex.connect.manager.data.vo.JsonResult;
6 import com.google.gson.JsonObject; 6 import com.google.gson.JsonObject;
7 7
8 public interface ISysAuthService { 8 public interface ISysAuthService {
9 - JsonResult createAccessToken(LoginRequest loginRequest, User user); 9 + ResponseResultVo createAccessToken(LoginRequest loginRequest, User user);
10 10
11 - JsonResult createFclToken(JsonObject token); 11 + ResponseResultVo createFclToken(JsonObject token);
12 12
13 JsonObject getFclToken(String tokenKey); 13 JsonObject getFclToken(String tokenKey);
14 } 14 }
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.service.system.impl; ...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.service.system.impl;
3 3
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 import com.fedex.connect.common.dependencies.contants.RedisConstants; 5 import com.fedex.connect.common.dependencies.contants.RedisConstants;
6 +import com.fedex.connect.common.dependencies.date.vo.ResponseResultVo;
6 import com.fedex.connect.common.dependencies.enums.ResponseCode; 7 import com.fedex.connect.common.dependencies.enums.ResponseCode;
7 import com.fedex.connect.common.dependencies.util.GsonUtils; 8 import com.fedex.connect.common.dependencies.util.GsonUtils;
8 import com.fedex.connect.common.dependencies.util.JwtTokenUtils; 9 import com.fedex.connect.common.dependencies.util.JwtTokenUtils;
...@@ -10,7 +11,6 @@ import com.fedex.connect.common.model.sys.RedisSlab; ...@@ -10,7 +11,6 @@ import com.fedex.connect.common.model.sys.RedisSlab;
10 import com.fedex.connect.common.model.sys.Role; 11 import com.fedex.connect.common.model.sys.Role;
11 import com.fedex.connect.common.model.sys.User; 12 import com.fedex.connect.common.model.sys.User;
12 import com.fedex.connect.manager.data.dto.LoginRequest; 13 import com.fedex.connect.manager.data.dto.LoginRequest;
13 -import com.fedex.connect.manager.data.vo.JsonResult;
14 import com.fedex.connect.manager.service.AbstractEtService; 14 import com.fedex.connect.manager.service.AbstractEtService;
15 import com.fedex.connect.manager.service.system.IRedisUtilService; 15 import com.fedex.connect.manager.service.system.IRedisUtilService;
16 import com.fedex.connect.manager.service.system.ISysAuthService; 16 import com.fedex.connect.manager.service.system.ISysAuthService;
...@@ -47,7 +47,7 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer ...@@ -47,7 +47,7 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer
47 * @param user 47 * @param user
48 * @return 48 * @return
49 */ 49 */
50 - public JsonResult createAccessToken(LoginRequest loginRequest, User user) { 50 + public ResponseResultVo createAccessToken(LoginRequest loginRequest, User user) {
51 //2、创建token 51 //2、创建token
52 List<String> roleCodeList = new ArrayList<>(); 52 List<String> roleCodeList = new ArrayList<>();
53 Role roleInfo = sysRoleInfoService.findRoleByUserId(user.getId()); 53 Role roleInfo = sysRoleInfoService.findRoleByUserId(user.getId());
...@@ -65,10 +65,10 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer ...@@ -65,10 +65,10 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer
65 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime); 65 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime);
66 } catch (NullPointerException e) { 66 } catch (NullPointerException e) {
67 logger.error("***************** redis 异常:{} *********************", e); 67 logger.error("***************** redis 异常:{} *********************", e);
68 - return JsonResult.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 68 + return ResponseResultVo.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null);
69 } 69 }
70 70
71 - return JsonResult.succ(token); 71 + return ResponseResultVo.succ(token);
72 } 72 }
73 73
74 74
...@@ -77,17 +77,17 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer ...@@ -77,17 +77,17 @@ public class SysAuthServiceImpl extends AbstractEtService implements ISysAuthSer
77 * @param token token信息 77 * @param token token信息
78 * @return token key 78 * @return token key
79 */ 79 */
80 - public JsonResult createFclToken(JsonObject token) { 80 + public ResponseResultVo createFclToken(JsonObject token) {
81 String tokenKey = DatabaseConstants.FCL_PREFIX + UUID.randomUUID(); 81 String tokenKey = DatabaseConstants.FCL_PREFIX + UUID.randomUUID();
82 try { 82 try {
83 /*redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), RedisConstants.REDIS_EXPRIE_TIME_1W);*/ 83 /*redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), RedisConstants.REDIS_EXPRIE_TIME_1W);*/
84 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1); 84 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1);
85 } catch (NullPointerException e) { 85 } catch (NullPointerException e) {
86 logger.error("***************** redis 异常:{} *********************", e); 86 logger.error("***************** redis 异常:{} *********************", e);
87 - return JsonResult.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 87 + return ResponseResultVo.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null);
88 } 88 }
89 89
90 - return JsonResult.succ(tokenKey); 90 + return ResponseResultVo.succ(tokenKey);
91 } 91 }
92 92
93 /** 93 /**
......
...@@ -3,7 +3,7 @@ package com.fedex.connect.manager.service.system.impl; ...@@ -3,7 +3,7 @@ package com.fedex.connect.manager.service.system.impl;
3 import com.fedex.connect.common.dependencies.config.CacheSystem; 3 import com.fedex.connect.common.dependencies.config.CacheSystem;
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 import com.fedex.connect.common.dependencies.util.Utils; 5 import com.fedex.connect.common.dependencies.util.Utils;
6 -import com.fedex.connect.common.model.base.DictionaryEntries; 6 +import com.fedex.connect.common.model.bi.DictionaryEntries;
7 import com.fedex.connect.common.model.sys.Role; 7 import com.fedex.connect.common.model.sys.Role;
8 import com.fedex.connect.common.model.sys.RoleExample; 8 import com.fedex.connect.common.model.sys.RoleExample;
9 import com.fedex.connect.common.model.sys.UserRole; 9 import com.fedex.connect.common.model.sys.UserRole;
......
...@@ -5,7 +5,7 @@ import com.fedex.connect.common.dependencies.authentication.EncryptProvider; ...@@ -5,7 +5,7 @@ import com.fedex.connect.common.dependencies.authentication.EncryptProvider;
5 import com.fedex.connect.common.dependencies.config.CacheSystem; 5 import com.fedex.connect.common.dependencies.config.CacheSystem;
6 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 6 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
7 import com.fedex.connect.common.dependencies.util.Utils; 7 import com.fedex.connect.common.dependencies.util.Utils;
8 -import com.fedex.connect.common.model.base.DictionaryEntries; 8 +import com.fedex.connect.common.model.bi.DictionaryEntries;
9 import com.fedex.connect.common.model.sys.Role; 9 import com.fedex.connect.common.model.sys.Role;
10 import com.fedex.connect.common.model.sys.User; 10 import com.fedex.connect.common.model.sys.User;
11 import com.fedex.connect.common.model.sys.UserExample; 11 import com.fedex.connect.common.model.sys.UserExample;
......