Commit 95b3da34f722df0b5293b14ca62687d1baa990bf
1 parent
1be3410a7e
Exists in
master
and in
1 other branch
修改权限表和获取方式
Showing 6 changed files with 68 additions and 10 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPermission.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsUserService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsUserServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java
View file @
95b3da3
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 7 | 7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 8 | 8 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| 9 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 9 | 10 | import com.lyms.talkonlineweb.domain.LymsUser; |
| 10 | 11 | import com.lyms.talkonlineweb.mapper.LymsUserMapper; |
| 11 | 12 | import com.lyms.talkonlineweb.result.BaseResponse; |
| ... | ... | @@ -71,6 +72,7 @@ |
| 71 | 72 | user.setHxid(rArr.getJSONObject(0).getString("uuid")); |
| 72 | 73 | } |
| 73 | 74 | } |
| 75 | + JSONObject json=hxService.getChatMessages("2021090617"); | |
| 74 | 76 | lymsUserService.saveOrUpdate(user); |
| 75 | 77 | user.setPasswd(null); |
| 76 | 78 | tMap.put("user",user); |
| ... | ... | @@ -95,7 +97,7 @@ |
| 95 | 97 | Claims claims =JwtUtils.parseJWT(authorization); |
| 96 | 98 | String username=claims.getSubject(); |
| 97 | 99 | |
| 98 | - List<Map<String,Object>> permiss=lymsUserService.getPermissionByUsername(username); | |
| 100 | + List<LymsPermission> permiss=lymsUserService.getPermissionByUsername(username); | |
| 99 | 101 | baseResponse.setObject(permiss); |
| 100 | 102 | } catch (Exception e) { |
| 101 | 103 | log.error(e.getMessage()); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPermission.java
View file @
95b3da3
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsUserService.java
View file @
95b3da3
| 1 | 1 | package com.lyms.talkonlineweb.service; |
| 2 | 2 | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 3 | 4 | import com.lyms.talkonlineweb.domain.LymsUser; |
| 4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
| 5 | 6 | |
| ... | ... | @@ -11,7 +12,7 @@ |
| 11 | 12 | */ |
| 12 | 13 | public interface LymsUserService extends IService<LymsUser> { |
| 13 | 14 | |
| 14 | - List<Map<String, Object>> getPermissionByUsername(String username) throws Exception; | |
| 15 | + List<LymsPermission> getPermissionByUsername(String username) throws Exception; | |
| 15 | 16 | |
| 16 | 17 | LymsUser getUserByToken(String token); |
| 17 | 18 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsUserServiceImpl.java
View file @
95b3da3
| ... | ... | @@ -43,8 +43,8 @@ |
| 43 | 43 | * @return |
| 44 | 44 | */ |
| 45 | 45 | @Override |
| 46 | - public List<Map<String, Object>> getPermissionByUsername(String username) throws Exception { | |
| 47 | - List<Map<String, Object>> rs=new ArrayList<>(); | |
| 46 | + public List<LymsPermission> getPermissionByUsername(String username) throws Exception { | |
| 47 | + List<LymsPermission> rs=new ArrayList<>(); | |
| 48 | 48 | |
| 49 | 49 | Map<String,Object> param=new HashMap<>(); |
| 50 | 50 | param.put("login",username); |
| 51 | 51 | |
| ... | ... | @@ -58,14 +58,15 @@ |
| 58 | 58 | int rid=rLst.get(0).getRid(); |
| 59 | 59 | // 首次取一次菜单 |
| 60 | 60 | List<LymsPermission> pLst=lymsPermissionMapper.sltPermissByRole(rid, Constant.ROOT_MENU); |
| 61 | - | |
| 61 | + rs.addAll(pLst); | |
| 62 | 62 | for (LymsPermission p:pLst) { |
| 63 | 63 | //获取二级菜单 |
| 64 | 64 | List<LymsPermission> sLst=lymsPermissionMapper.sltPermissByRole(rid, p.getId()); |
| 65 | - Map<String, Object> oneMap=new HashMap<>(); | |
| 66 | - oneMap.put("menu",p); | |
| 67 | - oneMap.put("children",sLst); | |
| 68 | - rs.add(oneMap); | |
| 65 | +// Map<String, Object> oneMap=new HashMap<>(); | |
| 66 | +// oneMap.put("menu",p); | |
| 67 | +// oneMap.put("children",sLst); | |
| 68 | +// rs.add(oneMap); | |
| 69 | + rs.addAll(sLst); | |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | return rs; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
View file @
95b3da3
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | public static final String JWT_SECERT = "bHltc3dlbnpoZW5waW5ndGFpMjEwODMw"; |
| 5 | 5 | public static final int JWT_ERRCODE_EXPIRE = 500; |
| 6 | 6 | public static final int JWT_ERRCODE_FAIL = 501; |
| 7 | - public static final long JWT_TTL=24*60*60*1000;//1天 | |
| 7 | + public static final long JWT_TTL=24*60*60*1000*30;//1天 | |
| 8 | 8 | public static final int ROOT_MENU = 0;//一级菜单 |
| 9 | 9 | public static final String CUR_USER = "cur_user";//当前用户 |
| 10 | 10 | public static final String COMMON_PASSWD = "123456";//通用密码 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java
View file @
95b3da3
| ... | ... | @@ -151,6 +151,55 @@ |
| 151 | 151 | return rs; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | + /** | |
| 155 | + * 获取聊天记录 | |
| 156 | + * @param time 查询的时间格式为10位数字形式(YYYYMMDDHH) | |
| 157 | + * @return | |
| 158 | + */ | |
| 159 | + public JSONObject getChatMessages(String time){ | |
| 160 | + JSONObject msg=new JSONObject(); | |
| 161 | + String token=getToken(); | |
| 162 | + HttpHeaders headers=new HttpHeaders(); | |
| 163 | + headers.add("Authorization","Bearer "+token); | |
| 164 | + HttpEntity param=new HttpEntity(headers); | |
| 165 | + resp=restTemplate.exchange(getUrl()+"chatmessages/"+time, HttpMethod.GET,param,String.class); | |
| 166 | + if (resp.getStatusCodeValue()==200){ | |
| 167 | + msg= JSON.parseObject(resp.getBody()); | |
| 168 | + } | |
| 169 | + return msg; | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * 创建聊天室 | |
| 174 | + * @param name | |
| 175 | + * @param description | |
| 176 | + * @param owner | |
| 177 | + * @param members | |
| 178 | + * @return | |
| 179 | + */ | |
| 180 | + public JSONObject addChatRooms(String name,String description,String owner,String[] members){ | |
| 181 | + JSONObject rs=new JSONObject(); | |
| 182 | + Map<String,Object> param=new HashMap<>(); | |
| 183 | + HttpHeaders headers=new HttpHeaders(); | |
| 184 | + | |
| 185 | + headers.add("Authorization","Bearer "+getToken()); | |
| 186 | + List lParam=new ArrayList(); | |
| 187 | + param.put("name",name); | |
| 188 | + param.put("description",description); | |
| 189 | + param.put("owner",owner); | |
| 190 | + param.put("members",members); | |
| 191 | + | |
| 192 | + lParam.add(param); | |
| 193 | + HttpEntity entity=new HttpEntity(param,headers); | |
| 194 | + resp=restTemplate.postForEntity(getUrl()+"chatrooms",entity,String.class); | |
| 195 | + if (resp.getStatusCodeValue()==200){ | |
| 196 | + rs= JSON.parseObject(resp.getBody()); | |
| 197 | + } | |
| 198 | + log.info(rs); | |
| 199 | + return rs; | |
| 200 | + } | |
| 201 | + | |
| 202 | + | |
| 154 | 203 | |
| 155 | 204 | } |