Quellcode durchsuchen

projectVO返回userId,用户中心同步用户信息,只同步邮箱、手机、密码

xuexiaobo vor 6 Jahren
Ursprung
Commit
1719942408

+ 5 - 5
site/src/main/java/com/mooctest/crowd/site/anticorruption/impl/UserAntiCorruptionImpl.java

@@ -74,12 +74,12 @@ public class UserAntiCorruptionImpl implements UserAntiCorruption {
             throw new UserNotExistException();
         log.info("userInfo: " + userInfo.toString());
         try{
-            //将用户中心的用户中心的用户数据对本系统内同步
-            User newUser = userInfo.toUser();
+            //将用户中心的用户中心的用户数据对本系统内同步,直同步用户邮箱、手机号、密码
             User oldUser = userRepo.getByID(userId);
-            newUser.setRoleList(oldUser.getRoleList());
-            newUser.setGender(oldUser.getGender());
-            userRepo.saveUser(newUser);
+            oldUser.setEmail(userInfo.getEmail());
+            oldUser.setMobile(userInfo.getMobile());
+            oldUser.setPassword(userInfo.getPassword());
+            userRepo.saveUser(oldUser);
         }catch (UserNotExistException e){   //本站不存在该用户,是未同步信息的新用户,初始化角色
             User user = userInfo.toUser();
             List<Role> roles = new ArrayList<>();

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdProjectVO.java

@@ -32,6 +32,7 @@ public class CrowdProjectVO {
     private String doc;
     private String file;
     private Long resource;
+    private Long userId;
     private Map<String, String> location;
     private String institution;
     private Timestamp datetime;
@@ -51,6 +52,7 @@ public class CrowdProjectVO {
         this.file = project.getProjectFile();
         this.resource = project.getProjectDistributionTypeId();
         this.location = new HashMap<>();
+        this.userId = project.getUserId();
         this.location.put("provinceCode", project.getDistributionProvince());
         this.location.put("cityCode", project.getDistributionCity());
         this.datetime = project.getDeadTime();