|
@@ -25,6 +25,7 @@ import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import springfox.documentation.annotations.Cacheable;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.Base64;
|
|
|
import java.util.List;
|
|
@@ -50,6 +51,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
|
|
|
|
|
|
@Autowired
|
|
|
private ImaConfig imaConfig;
|
|
|
+ @Resource
|
|
|
+ private IUserService userService;
|
|
|
|
|
|
@Override
|
|
|
public List<Myuser> listAll(String id, String orgId, String unitId) {
|
|
@@ -93,7 +96,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
|
|
|
@Override
|
|
|
public MyuserResDTO getSysUser(String code) {
|
|
|
try {
|
|
|
+ System.out.println("请求-3-获取用户信息");
|
|
|
Object json = remoteServiceBuilder.getGatewayUrl().getSysUser(code);
|
|
|
+
|
|
|
MyuserResDTO user = JSON.parseObject(json.toString(), MyuserResDTO.class);
|
|
|
return user;
|
|
|
} catch (Exception e) {
|
|
@@ -108,10 +113,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
|
|
|
if (null == request.getHeader("code")) {
|
|
|
throw new CustomException("请求鉴权信息为空");
|
|
|
}
|
|
|
+ System.out.println("请求-2-获取用户信息");
|
|
|
+ MyuserResDTO user = null;
|
|
|
+ MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
|
|
|
+ headers.add("Blade-Auth", "bearer " + request.getHeader("Blade-Auth"));
|
|
|
String code = request.getHeader("code");
|
|
|
- JSONObject json = remoteServiceBuilder.getGatewayUrl().getSysUser(code);
|
|
|
- MyuserResDTO user = JSONObject.parseObject(json.getJSONObject("data").toJSONString(), MyuserResDTO.class);
|
|
|
- return user;
|
|
|
+ HttpEntity<LinkedMultiValueMap<String, Object>> param = new HttpEntity<>(null, headers);
|
|
|
+
|
|
|
+ ResponseEntity<String> responseEntity2 = restTemplate.postForEntity(imaConfig.getGatewayUrl() + "/ims-idms/sysuser/getSysUser?code={code}",
|
|
|
+ param, String.class, code);
|
|
|
+ log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
|
|
|
+ if (200 == responseEntity2.getStatusCodeValue()) {
|
|
|
+
|
|
|
+ user = JSONObject.parseObject(JSON.parseObject(responseEntity2.getBody()).getJSONObject("data").toJSONString(), MyuserResDTO.class);
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return null;
|
|
@@ -220,4 +238,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JSONObject getSysUser(String code,String auth) {
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println("请求--获取用户信息");
|
|
|
+ MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
|
|
|
+ headers.add("Blade-Auth", "bearer " + auth);
|
|
|
+ HttpEntity<LinkedMultiValueMap<String, Object>> param = new HttpEntity<>(null, headers);
|
|
|
+
|
|
|
+ ResponseEntity<String> responseEntity2 = restTemplate.postForEntity(imaConfig.getGatewayUrl() + "/ims-idms/sysuser/getSysUser?code={code}",
|
|
|
+ param, String.class, code);
|
|
|
+ log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
|
|
|
+ if (200 == responseEntity2.getStatusCodeValue()) {
|
|
|
+ return JSON.parseObject(responseEntity2.getBody());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|