use of com.moxi.mogublog.commons.entity.User in project mogu_blog_v2 by moxi624.
the class UserServiceImpl method resetUserPassword.
@Override
public String resetUserPassword(UserVO userVO) {
String defaultPassword = sysParamsService.getSysParamsValueByKey(SysConf.SYS_DEFAULT_PASSWORD);
User user = userService.getById(userVO.getUid());
user.setPassWord(MD5Utils.string2MD5(defaultPassword));
user.setUpdateTime(new Date());
user.updateById();
return ResultUtil.successWithMessage(MessageConf.OPERATION_SUCCESS);
}
use of com.moxi.mogublog.commons.entity.User in project mogu_blog_v2 by moxi624.
the class UserServiceImpl method getPageList.
@Override
public IPage<User> getPageList(UserVO userVO) {
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
// 查询用户名
if (StringUtils.isNotEmpty(userVO.getKeyword()) && !StringUtils.isEmpty(userVO.getKeyword().trim())) {
queryWrapper.like(SQLConf.USER_NAME, userVO.getKeyword().trim()).or().like(SQLConf.NICK_NAME, userVO.getKeyword().trim());
}
if (StringUtils.isNotEmpty(userVO.getSource()) && !StringUtils.isEmpty(userVO.getSource().trim())) {
queryWrapper.eq(SQLConf.SOURCE, userVO.getSource().trim());
}
if (userVO.getCommentStatus() != null) {
queryWrapper.eq(SQLConf.COMMENT_STATUS, userVO.getCommentStatus());
}
if (StringUtils.isNotEmpty(userVO.getOrderByAscColumn())) {
// 将驼峰转换成下划线
String column = StringUtils.underLine(new StringBuffer(userVO.getOrderByAscColumn())).toString();
queryWrapper.orderByAsc(column);
} else if (StringUtils.isNotEmpty(userVO.getOrderByDescColumn())) {
// 将驼峰转换成下划线
String column = StringUtils.underLine(new StringBuffer(userVO.getOrderByDescColumn())).toString();
queryWrapper.orderByDesc(column);
} else {
queryWrapper.orderByDesc(SQLConf.CREATE_TIME);
}
queryWrapper.select(User.class, i -> !i.getProperty().equals(SQLConf.PASS_WORD));
Page<User> page = new Page<>();
page.setCurrent(userVO.getCurrentPage());
page.setSize(userVO.getPageSize());
queryWrapper.ne(SQLConf.STATUS, EStatus.DISABLED);
IPage<User> pageList = userService.page(page, queryWrapper);
List<User> list = pageList.getRecords();
final StringBuffer fileUids = new StringBuffer();
list.forEach(item -> {
if (StringUtils.isNotEmpty(item.getAvatar())) {
fileUids.append(item.getAvatar() + SysConf.FILE_SEGMENTATION);
}
});
Map<String, String> pictureMap = new HashMap<>();
String pictureResult = null;
if (fileUids != null) {
pictureResult = this.pictureFeignClient.getPicture(fileUids.toString(), SysConf.FILE_SEGMENTATION);
}
List<Map<String, Object>> picList = webUtil.getPictureMap(pictureResult);
picList.forEach(item -> {
pictureMap.put(item.get(SQLConf.UID).toString(), item.get(SQLConf.URL).toString());
});
for (User item : list) {
// 获取图片
if (StringUtils.isNotEmpty(item.getAvatar())) {
List<String> pictureUidsTemp = StringUtils.changeStringToString(item.getAvatar(), SysConf.FILE_SEGMENTATION);
List<String> pictureListTemp = new ArrayList<>();
pictureUidsTemp.forEach(picture -> {
if (pictureMap.get(picture) != null && pictureMap.get(picture) != "") {
pictureListTemp.add(pictureMap.get(picture));
}
});
if (pictureListTemp.size() > 0) {
item.setPhotoUrl(pictureListTemp.get(0));
}
}
}
pageList.setRecords(list);
return pageList;
}
use of com.moxi.mogublog.commons.entity.User in project mogu_blog_v2 by moxi624.
the class UserServiceImpl method editUser.
@Override
public String editUser(UserVO userVO) {
User user = userService.getById(userVO.getUid());
user.setUserName(userVO.getUserName());
user.setEmail(userVO.getEmail());
user.setStartEmailNotification(userVO.getStartEmailNotification());
user.setOccupation(userVO.getOccupation());
user.setGender(userVO.getGender());
user.setQqNumber(userVO.getQqNumber());
user.setSummary(userVO.getSummary());
user.setBirthday(userVO.getBirthday());
user.setAvatar(userVO.getAvatar());
user.setNickName(userVO.getNickName());
user.setUserTag(userVO.getUserTag());
user.setCommentStatus(userVO.getCommentStatus());
user.setUpdateTime(new Date());
user.updateById();
return ResultUtil.successWithMessage(MessageConf.UPDATE_SUCCESS);
}
Aggregations