|
|
@ -2,6 +2,7 @@ package com.luoo.user.service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
@ -93,7 +94,6 @@ public class UserInfoService {
|
|
|
|
return userInfoDao.getById(id);
|
|
|
|
return userInfoDao.getById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 修改
|
|
|
|
* 修改
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -117,7 +117,6 @@ public class UserInfoService {
|
|
|
|
userInfoDao.deleteById(id);
|
|
|
|
userInfoDao.deleteById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void sendSms(String deviceId, String mobile) {
|
|
|
|
public void sendSms(String deviceId, String mobile) {
|
|
|
|
// 生成6位数字随机数
|
|
|
|
// 生成6位数字随机数
|
|
|
|
String checkcode = RandomStringUtils.randomNumeric(6);
|
|
|
|
String checkcode = RandomStringUtils.randomNumeric(6);
|
|
|
@ -186,7 +185,8 @@ public class UserInfoService {
|
|
|
|
userInfo.setLastUseDeviceId(deviceId);
|
|
|
|
userInfo.setLastUseDeviceId(deviceId);
|
|
|
|
userInfo.setLastUseDeviceBrand(deviceBrand);
|
|
|
|
userInfo.setLastUseDeviceBrand(deviceBrand);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
return Constants.TOKEN_PREFIX+jwtUtil.createJWT(userLoginDto.getUserId(), userInfo.getNickName(), userLoginDto.getRoles(),userLoginDto.getAvatar());
|
|
|
|
return Constants.TOKEN_PREFIX + jwtUtil.createJWT(userLoginDto.getUserId(), userInfo.getNickName(),
|
|
|
|
|
|
|
|
userLoginDto.getRoles(), userLoginDto.getAvatar());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long countByNickName(String nickName) {
|
|
|
|
public long countByNickName(String nickName) {
|
|
|
@ -211,13 +211,18 @@ public class UserInfoService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setLastLoginTime(new Date());
|
|
|
|
user.setLastLoginTime(new Date());
|
|
|
|
userInfoDao.save(user);
|
|
|
|
userInfoDao.save(user);
|
|
|
|
return Constants.TOKEN_PREFIX+jwtUtil.createJWT(user.getId(),user.getNickName(),Constants.TOKEN_ROLE_APP_USER,user.getAvatar());
|
|
|
|
return Constants.TOKEN_PREFIX
|
|
|
|
|
|
|
|
+ jwtUtil.createJWT(user.getId(), user.getNickName(), Constants.TOKEN_ROLE_APP_USER, user.getAvatar());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<UserInfo> orderByField(List<String> idList) {
|
|
|
|
public List<UserInfo> orderByField(List<String> idList) {
|
|
|
|
return userInfoDao.orderByField(idList);
|
|
|
|
return userInfoDao.orderByField(idList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<UserInfo> cmsOrderByField(List<String> idList) {
|
|
|
|
|
|
|
|
return orderByField(idList).stream().map(this::updateAvatarPath).collect(Collectors.toList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<SimpleUser> getSimpleUserOrderByField(List<String> idList) {
|
|
|
|
public List<SimpleUser> getSimpleUserOrderByField(List<String> idList) {
|
|
|
|
return userInfoDao.getSimpleUserOrderByField(idList);
|
|
|
|
return userInfoDao.getSimpleUserOrderByField(idList);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -230,16 +235,18 @@ public class UserInfoService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private UserInfo updateAvatarPath(UserInfo userInfo) {
|
|
|
|
private UserInfo updateAvatarPath(UserInfo userInfo) {
|
|
|
|
if (null != userInfo.getAvatar()) {
|
|
|
|
if (null != userInfo && null != userInfo.getAvatar()) {
|
|
|
|
userInfo.setAvatar(Constants.RESOURCE_PREFIX + userInfo.getAvatar());
|
|
|
|
userInfo.setAvatar(Constants.RESOURCE_PREFIX + userInfo.getAvatar());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return userInfo;
|
|
|
|
return userInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Page<UserInfo> findSearch(UserQueryReq queryReq, int page, int size) {
|
|
|
|
public Page<UserInfo> findSearch(UserQueryReq queryReq, int page, int size) {
|
|
|
|
Specification<UserInfo> specification = createUserInfoSpecification(queryReq);
|
|
|
|
Specification<UserInfo> specification = createUserInfoSpecification(queryReq);
|
|
|
|
PageRequest pageRequest = PageRequest.of(page - 1, size);
|
|
|
|
PageRequest pageRequest = PageRequest.of(page - 1, size);
|
|
|
|
return userInfoDao.findAll(specification, pageRequest);
|
|
|
|
return userInfoDao.findAll(specification, pageRequest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Specification<UserInfo> createUserInfoSpecification(UserQueryReq queryReq) {
|
|
|
|
private Specification<UserInfo> createUserInfoSpecification(UserQueryReq queryReq) {
|
|
|
|
return (root, criteriaQuery, criteriaBuilder) -> {
|
|
|
|
return (root, criteriaQuery, criteriaBuilder) -> {
|
|
|
|
List<Predicate> predicateList = new ArrayList<>();
|
|
|
|
List<Predicate> predicateList = new ArrayList<>();
|
|
|
@ -277,5 +284,8 @@ public class UserInfoService {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UserInfo cmsFindById(String id) {
|
|
|
|
|
|
|
|
return updateAvatarPath(userInfoDao.getById(id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|