Commit 0fd06170ad250ecfb8d2ed1c2e8ab402e91d20bf

Authored by changpengfei
1 parent c80f32d65c
Exists in master

系统用户登录返回环信用户信息

Showing 1 changed file with 18 additions and 7 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java View file @ 0fd0617
... ... @@ -58,7 +58,12 @@
58 58 private String clientId;
59 59 @Value("${hx.ClientSecret}")
60 60 private String clientSecret;
  61 + @Value("${hx.hxuser}")
  62 + private String hxuser;
61 63  
  64 + @Value("${hx.hxpasswd}")
  65 + private String hxpasswd;
  66 +
62 67 @RequestMapping(value = "login",method = {RequestMethod.GET,RequestMethod.POST,RequestMethod.OPTIONS})
63 68 public BaseResponse login(String username, String passwd){
64 69 // QueryWrapper queryWrapper= Wrappers.query(LymsUser.class);
65 70  
... ... @@ -74,15 +79,21 @@
74 79 String JWT = JwtUtils.createJWT("1", user.getLogin(), Constant.JWT_TTL);
75 80 tMap.put("token",JWT);
76 81  
77   - if(user.getHxid()==null && user.getHid()==null){
78   - JSONObject json=hxService.addUser(user.getLogin(),Constant.COMMON_PASSWD,"sys_"+user.getUname());
79   - JSONArray rArr=json.getJSONArray("entities");
80   - if(rArr.size()>0){
81   - user.setHxid(rArr.getJSONObject(0).getString("uuid"));
82   - }
83   - }
  82 +// if(user.getHxid()==null && user.getHid()==null){
  83 +// JSONObject json=hxService.addUser(user.getLogin(),Constant.COMMON_PASSWD,"sys_"+user.getUname());
  84 +// JSONArray rArr=json.getJSONArray("entities");
  85 +// if(rArr.size()>0){
  86 +// user.setHxid(rArr.getJSONObject(0).getString("uuid"));
  87 +// }
  88 +// }
84 89 lymsUserService.saveOrUpdate(user);
85 90 user.setPasswd(null);
  91 +
  92 + Map<String,Object> hxMap=new HashMap<>();
  93 + hxMap.put("hxuser",hxuser);
  94 + hxMap.put("hxpasswd",hxpasswd);
  95 +
  96 + tMap.put("hx",hxMap);
86 97 tMap.put("user",user);
87 98 }
88 99 baseResponse.setObject(tMap);