|
@@ -127,7 +127,7 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
@@ -127,7 +127,7 @@ public class UserInfoServiceImpl implements UserInfoService { |
127
|
.virtualHostId(userInfo.getVirtualHostId())
|
127
|
.virtualHostId(userInfo.getVirtualHostId())
|
128
|
.durability(true)
|
128
|
.durability(true)
|
129
|
.autoDelete(false)
|
129
|
.autoDelete(false)
|
130
|
- .description(userInfo.getUsername() + ":专属队列")
|
130
|
+ .description(userInfo.getUsername() + "用户:专属队列")
|
131
|
.build();
|
131
|
.build();
|
132
|
busQueueService.insertSelective(busQueue);
|
132
|
busQueueService.insertSelective(busQueue);
|
133
|
}
|
133
|
}
|
|
@@ -180,7 +180,10 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
@@ -180,7 +180,10 @@ public class UserInfoServiceImpl implements UserInfoService { |
180
|
if (StringUtil.isNullOrEmpty(userInfo.getId())) {
|
180
|
if (StringUtil.isNullOrEmpty(userInfo.getId())) {
|
181
|
return new ResultJson<>("400", "该用户不存在");
|
181
|
return new ResultJson<>("400", "该用户不存在");
|
182
|
}
|
182
|
}
|
183
|
- return userInfoMapper.updateByPrimaryKeySelective(userInfo) > 0
|
183
|
+ ResultJson validateResult = validateUser(userInfo);
|
|
|
184
|
+ int num = userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
|
|
185
|
+
|
|
|
186
|
+ return num > 0
|
184
|
? new ResultJson<>("200", "修改用户信息,成功")
|
187
|
? new ResultJson<>("200", "修改用户信息,成功")
|
185
|
: new ResultJson<>("500", "修改用户信息,失败");
|
188
|
: new ResultJson<>("500", "修改用户信息,失败");
|
186
|
}
|
189
|
}
|
|
@@ -229,6 +232,34 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
@@ -229,6 +232,34 @@ public class UserInfoServiceImpl implements UserInfoService { |
229
|
return userInfoMapper.selectUserExist(username);
|
232
|
return userInfoMapper.selectUserExist(username);
|
230
|
}
|
233
|
}
|
231
|
|
234
|
|
|
|
235
|
+ @Override
|
|
|
236
|
+ public ResultJson updatePassword(UserInfo userInfo) throws MalformedURLException, URISyntaxException
|
|
|
237
|
+ {
|
|
|
238
|
+ if (StringUtil.isNullOrEmpty(userInfo.getUsername()) || StringUtil.isNullOrEmpty(userInfo.getPassword())) {
|
|
|
239
|
+ return new ResultJson<>("400", "用户名和密码,不能为空");
|
|
|
240
|
+ }
|
|
|
241
|
+ if (userInfoMapper.selectUserExist(userInfo.getUsername()).size() == 0) {
|
|
|
242
|
+ return new ResultJson<>("400", "该用户不存在");
|
|
|
243
|
+ }
|
|
|
244
|
+ UserInfo oldUserInfo = userInfoMapper.selectByUsername(userInfo.getUsername());
|
|
|
245
|
+ oldUserInfo.setPassword(DigestUtils.md5DigestAsHex(userInfo.getPassword().getBytes()));
|
|
|
246
|
+ int num = userInfoMapper.updateByPrimaryKeySelective(oldUserInfo);
|
|
|
247
|
+ // 在这里修改MQ用户密码
|
|
|
248
|
+ Client client = connectClient();
|
|
|
249
|
+ ArrayList<String> tags = new ArrayList<>();
|
|
|
250
|
+ client.updateUser(userInfo.getUsername(), userInfo.getPassword().toCharArray(), tags);
|
|
|
251
|
+ return num > 0
|
|
|
252
|
+ ? new ResultJson<>("200", userInfo.getUsername() + "用户:修改密码成功!")
|
|
|
253
|
+ : new ResultJson<>("500", userInfo.getUsername() + "用户:修改密码失败!");
|
|
|
254
|
+ }
|
|
|
255
|
+
|
|
|
256
|
+ public Client connectClient() throws MalformedURLException, URISyntaxException
|
|
|
257
|
+ {
|
|
|
258
|
+ String url = "http://" + host + ":15672/api";
|
|
|
259
|
+ Client client = new Client(url, rabbitUsername, rabbitPassword);
|
|
|
260
|
+ return client;
|
|
|
261
|
+ }
|
|
|
262
|
+
|
232
|
}
|
263
|
}
|
233
|
|
264
|
|
234
|
|
265
|
|