浏览代码

修复运营端 添加小区后没有, 没有小区标识问题

weiximei 6 年前
父节点
当前提交
5d8fe6d016

+ 15
- 7
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java 查看文件

77
 			//维护此用户的角色
77
 			//维护此用户的角色
78
 			tpUserMapper.insertUserRole(tpUser.getId(),1);
78
 			tpUserMapper.insertUserRole(tpUser.getId(),1);
79
 			//维护住户端用户与社区关系表
79
 			//维护住户端用户与社区关系表
80
-			TpUserCommunity tpUserCommunity = new TpUserCommunity();
81
-			tpUserCommunity.setTpUserId(tpUser.getId());
82
-			tpUserCommunityMapper.insertSelective(tpUserCommunity);
80
+			addUserAndCommunity(tpUser.getId(), toCommunities.getId());
83
 		}else {
81
 		}else {
84
 			//维护此用户的角色
82
 			//维护此用户的角色
85
 			tpUserMapper.insertUserRole(tpUserAlread.getId(),1);
83
 			tpUserMapper.insertUserRole(tpUserAlread.getId(),1);
86
 			//维护住户端用户与社区关系表
84
 			//维护住户端用户与社区关系表
87
-			TpUserCommunity tpUserCommunity = new TpUserCommunity();
88
-			tpUserCommunity.setTpUserId(tpUserAlread.getId());
89
-			tpUserCommunity.setCommunityId(toCommunities.getId());
90
-			tpUserCommunityMapper.insertSelective(tpUserCommunity);
85
+			addUserAndCommunity(tpUserAlread.getId(), toCommunities.getId());
91
 		}
86
 		}
92
 		
87
 		
93
 		return size;
88
 		return size;
94
 	}
89
 	}
90
+
91
+	/**
92
+	 * 维护住户端用户与社区关系表
93
+	 * @param tpUserId
94
+	 * @param communitiesId
95
+	 */
96
+	private void addUserAndCommunity(Integer tpUserId, Integer communitiesId) {
97
+		//维护住户端用户与社区关系表
98
+		TpUserCommunity tpUserCommunity = new TpUserCommunity();
99
+		tpUserCommunity.setTpUserId(tpUserId);
100
+		tpUserCommunity.setCommunityId(communitiesId);
101
+		tpUserCommunityMapper.insertSelective(tpUserCommunity);
102
+	}
95
 	
103
 	
96
 	/**
104
 	/**
97
 	 * 根据详情获取小区数据
105
 	 * 根据详情获取小区数据