Browse Source

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

weiximei 6 years ago
parent
commit
5d8fe6d016

+ 15
- 7
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java View File

@@ -77,21 +77,29 @@ public class CommunityServiceImpl implements CommunityServiceI {
77 77
 			//维护此用户的角色
78 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 81
 		}else {
84 82
 			//维护此用户的角色
85 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 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
 	 * 根据详情获取小区数据