|
@@ -62,29 +62,19 @@ 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
|
|
- addUserAndRole(tpUser.getId(), 1);
|
79
|
|
- //维护住户端用户与社区关系表
|
80
|
|
- addUserAndCommunity(tpUser.getId(), toCommunities.getId());
|
81
|
|
- }else {
|
82
|
|
- //维护此用户的角色
|
83
|
|
- addUserAndRole(tpUserAlread.getId(), 1);
|
84
|
|
- //维护住户端用户与社区关系表
|
85
|
|
- addUserAndCommunity(tpUserAlread.getId(), toCommunities.getId());
|
86
|
|
- }
|
87
|
|
-
|
|
65
|
+
|
|
66
|
+ //构建用户信息
|
|
67
|
+ TpUser tpUser = new TpUser();
|
|
68
|
+ tpUser.setUserName(toCommunities.getUserName());
|
|
69
|
+ tpUser.setLoginName(toCommunities.getLoginName());
|
|
70
|
+ tpUser.setCreateDate(new Date());
|
|
71
|
+ tpUser.setCreateUser(1);
|
|
72
|
+ tpUser.setCommunityId(toCommunities.getId());
|
|
73
|
+ tpUser.setStatus(Constant.EFFECTIVE);
|
|
74
|
+ //插入用户信息
|
|
75
|
+ tpUserMapper.insertSelective(tpUser);
|
|
76
|
+ //维护此用户的角色
|
|
77
|
+ addUserAndRole(tpUser.getId(), 1);
|
88
|
78
|
return size;
|
89
|
79
|
}
|
90
|
80
|
|
|
@@ -135,11 +125,7 @@ public class CommunityServiceImpl implements CommunityServiceI {
|
135
|
125
|
ToCommunities oldCommunities = toCommunitiesMapper.selectByPrimaryKey(toCommunities.getId());
|
136
|
126
|
//未修改前的电话号码
|
137
|
127
|
String oldTel = oldCommunities.getLoginName();
|
138
|
|
- //判断电话号码是否重复
|
139
|
|
- TpUser tpUser = tpUserMapper.selectByTel(toCommunities.getId(),toCommunities.getLoginName());
|
140
|
|
- if (null != tpUser && !tpUser.getLoginName().equals(oldTel)){
|
141
|
|
- return Constant.ADMIN_IS_EXIST;
|
142
|
|
- }
|
|
128
|
+ //修改手机号码
|
143
|
129
|
tpUserMapper.updateByTel(toCommunities.getId(),toCommunities.getLoginName(),toCommunities.getUserName(),oldTel);
|
144
|
130
|
toCommunitiesMapper.updateByPrimaryKeySelective(toCommunities);
|
145
|
131
|
return Constant.SUCCESS;
|