|
|
@@ -37,6 +37,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
@Service
|
|
|
public class UserServiceImpl implements UserService {
|
|
|
@@ -458,4 +459,27 @@ public class UserServiceImpl implements UserService {
|
|
|
}
|
|
|
}, info);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public User updateUserTel(String oldTel, String newTel,Long uu) {
|
|
|
+ //旧手机号是否正确
|
|
|
+ User user = userDao.findOne(uu);
|
|
|
+ if(!user.getUserTel().equals(oldTel)){
|
|
|
+ throw new IllegalOperatorException("旧手机号错误");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(!StringUtils.isEmpty(oldTel) && !StringUtils.isEmpty(newTel)) {
|
|
|
+ //保存数据库
|
|
|
+ List<com.uas.account.entity.User> users = AccountUtils.updateTel(oldTel, newTel);
|
|
|
+ if (users != null && users.size() > 0) {
|
|
|
+ user.setUserTel(users.get(0).getUid());
|
|
|
+ user = userDao.save(user);
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|