|
@@ -62,22 +62,34 @@ public class CommunityServiceImpl implements CommunityServiceI {
|
62
|
62
|
if (size < 1){
|
63
|
63
|
return 0;
|
64
|
64
|
}
|
|
65
|
+ //查询这个用户是否包含多个小区
|
|
66
|
+ TpUser tpUserAlread = tpUserMapper.selectByLoginName(toCommunities.getLoginName());
|
|
67
|
+ if (null == tpUserAlread){
|
|
68
|
+ //构建用户信息
|
|
69
|
+ TpUser tpUser = new TpUser();
|
|
70
|
+ tpUser.setUserName(toCommunities.getUserName());
|
|
71
|
+ tpUser.setLoginName(toCommunities.getLoginName());
|
|
72
|
+ tpUser.setCreateDate(new Date());
|
|
73
|
+ tpUser.setCreateUser(1);
|
|
74
|
+ tpUser.setStatus(Constant.EFFECTIVE);
|
|
75
|
+ //插入用户信息
|
|
76
|
+ tpUserMapper.insertSelective(tpUser);
|
|
77
|
+ //维护此用户的角色
|
|
78
|
+ tpUserMapper.insertUserRole(tpUser.getId(),1);
|
|
79
|
+ //维护住户端用户与社区关系表
|
|
80
|
+ TpUserCommunity tpUserCommunity = new TpUserCommunity();
|
|
81
|
+ tpUserCommunity.setTpUserId(tpUser.getId());
|
|
82
|
+ tpUserCommunityMapper.insertSelective(tpUserCommunity);
|
|
83
|
+ }else {
|
|
84
|
+ //维护此用户的角色
|
|
85
|
+ tpUserMapper.insertUserRole(tpUserAlread.getId(),1);
|
|
86
|
+ //维护住户端用户与社区关系表
|
|
87
|
+ TpUserCommunity tpUserCommunity = new TpUserCommunity();
|
|
88
|
+ tpUserCommunity.setTpUserId(tpUserAlread.getId());
|
|
89
|
+ tpUserCommunity.setCommunityId(toCommunities.getId());
|
|
90
|
+ tpUserCommunityMapper.insertSelective(tpUserCommunity);
|
|
91
|
+ }
|
65
|
92
|
|
66
|
|
- //构建用户信息
|
67
|
|
- TpUser tpUser = new TpUser();
|
68
|
|
- tpUser.setCommunityId(toCommunities.getId());
|
69
|
|
- tpUser.setUserName(toCommunities.getUserName());
|
70
|
|
- tpUser.setLoginName(toCommunities.getLoginName());
|
71
|
|
- tpUser.setCreateDate(new Date());
|
72
|
|
- tpUser.setCreateUser(1);
|
73
|
|
- tpUser.setStatus(Constant.EFFECTIVE);
|
74
|
|
- //插入用户信息
|
75
|
|
- tpUserMapper.insertSelective(tpUser);
|
76
|
|
- //维护住户端用户与社区关系表
|
77
|
|
- TpUserCommunity tpUserCommunity = new TpUserCommunity();
|
78
|
|
- tpUserCommunity.setTpUserId(tpUser.getId());
|
79
|
|
- tpUserCommunity.setCommunityId(tpUser.getCommunityId());
|
80
|
|
- tpUserCommunityMapper.insertSelective(tpUserCommunity);
|
81
|
93
|
return size;
|
82
|
94
|
}
|
83
|
95
|
|