|
|
@@ -31,6 +31,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
@@ -196,4 +197,15 @@ public class UserService {
|
|
|
}
|
|
|
return setPassword(userId, password);
|
|
|
}
|
|
|
+
|
|
|
+ public void updateUserInfo(Map<String, Object> data) {
|
|
|
+ User user = userRepo.findById(SecurityUtils.getAuthenticatedUser().getId())
|
|
|
+ .orElseThrow(new BusinessException("用户不存在"));
|
|
|
+ try {
|
|
|
+ org.apache.commons.beanutils.BeanUtils.populate(user, data);
|
|
|
+ } catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
+ log.error("updateUserInfo", e);
|
|
|
+ }
|
|
|
+ userRepo.save(user);
|
|
|
+ }
|
|
|
}
|