...
|
...
|
@@ -127,7 +127,7 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
|
.virtualHostId(userInfo.getVirtualHostId())
|
|
|
.durability(true)
|
|
|
.autoDelete(false)
|
|
|
.description(userInfo.getUsername() + ":专属队列")
|
|
|
.description(userInfo.getUsername() + "用户:专属队列")
|
|
|
.build();
|
|
|
busQueueService.insertSelective(busQueue);
|
|
|
}
|
...
|
...
|
@@ -180,7 +180,10 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
|
if (StringUtil.isNullOrEmpty(userInfo.getId())) {
|
|
|
return new ResultJson<>("400", "该用户不存在");
|
|
|
}
|
|
|
return userInfoMapper.updateByPrimaryKeySelective(userInfo) > 0
|
|
|
ResultJson validateResult = validateUser(userInfo);
|
|
|
int num = userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
|
|
|
|
|
return num > 0
|
|
|
? new ResultJson<>("200", "修改用户信息,成功")
|
|
|
: new ResultJson<>("500", "修改用户信息,失败");
|
|
|
}
|
...
|
...
|
@@ -229,6 +232,34 @@ public class UserInfoServiceImpl implements UserInfoService { |
|
|
return userInfoMapper.selectUserExist(username);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResultJson updatePassword(UserInfo userInfo) throws MalformedURLException, URISyntaxException
|
|
|
{
|
|
|
if (StringUtil.isNullOrEmpty(userInfo.getUsername()) || StringUtil.isNullOrEmpty(userInfo.getPassword())) {
|
|
|
return new ResultJson<>("400", "用户名和密码,不能为空");
|
|
|
}
|
|
|
if (userInfoMapper.selectUserExist(userInfo.getUsername()).size() == 0) {
|
|
|
return new ResultJson<>("400", "该用户不存在");
|
|
|
}
|
|
|
UserInfo oldUserInfo = userInfoMapper.selectByUsername(userInfo.getUsername());
|
|
|
oldUserInfo.setPassword(DigestUtils.md5DigestAsHex(userInfo.getPassword().getBytes()));
|
|
|
int num = userInfoMapper.updateByPrimaryKeySelective(oldUserInfo);
|
|
|
// 在这里修改MQ用户密码
|
|
|
Client client = connectClient();
|
|
|
ArrayList<String> tags = new ArrayList<>();
|
|
|
client.updateUser(userInfo.getUsername(), userInfo.getPassword().toCharArray(), tags);
|
|
|
return num > 0
|
|
|
? new ResultJson<>("200", userInfo.getUsername() + "用户:修改密码成功!")
|
|
|
: new ResultJson<>("500", userInfo.getUsername() + "用户:修改密码失败!");
|
|
|
}
|
|
|
|
|
|
public Client connectClient() throws MalformedURLException, URISyntaxException
|
|
|
{
|
|
|
String url = "http://" + host + ":15672/api";
|
|
|
Client client = new Client(url, rabbitUsername, rabbitPassword);
|
|
|
return client;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|