Explorar el Código

Merge branch 'develop' of http://git.ycjcjy.com/fuxingfan/smartCommunity into develop

傅行帆 hace 6 años
padre
commit
710e45b059

+ 9
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Ver fichero

@@ -152,9 +152,10 @@ public class TaUserServiceImpl implements ITaUserService {
152 152
         }else {
153 153
             TaUser user = new TaUser();
154 154
             user.setLoginName(loginName);
155
+            user.setCommunityId(Integer.valueOf(communityId));
155 156
             ResponseBean result = register(user);
156 157
 
157
-            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(currentUser.getCommunityId());
158
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(user.getCommunityId());
158 159
             TaUserVO taUserVO = (TaUserVO) result.getData();
159 160
             taUserVO.setCommunityName(communities.getCommunityName());
160 161
 
@@ -186,7 +187,6 @@ public class TaUserServiceImpl implements ITaUserService {
186 187
         user.setAcceptAgreementStatus("1");
187 188
         user.setUserName(user.getLoginName());
188 189
         user.setRemark("这是系统自动注册!");
189
-        user.setCommunityId(3);
190 190
         user.setVerifyStatus("1");
191 191
         user.setFaceStatus("0");
192 192
         //user.setLoginPassword(MD5Utils.encode(user.getLoginPassword()));
@@ -198,8 +198,8 @@ public class TaUserServiceImpl implements ITaUserService {
198 198
         // 更新
199 199
         taUserMapper.updateByPrimaryKeySelective(user);
200 200
 
201
-        // TODO 这里先默认 type=0 (租客), 后期需要和 资料库对接
202
-        addUserRole(0,response,user);
201
+        // TODO 这里先默认 type=2 (租客), 后期需要和 资料库对接
202
+        addUserRole(2,response,user);
203 203
 
204 204
 
205 205
 
@@ -507,14 +507,14 @@ public class TaUserServiceImpl implements ITaUserService {
507 507
     /**
508 508
      * 公共方法,添加角色.
509 509
      *      用于注册 和 业主添加家属和租客
510
-     * @param type 0 是租客  1 是家属
510
+     * @param type 1是业主 2 是租客  3 是家属
511 511
      * @param response
512 512
      * @param user
513 513
      */
514 514
     private void addUserRole(Integer type,ResponseBean response,TaUser user){
515 515
         // 先查询角色 在角色关联记录
516 516
         // 这里的 2 或者 3 是对应角色编号
517
-        int roleType = type.equals("0") ? 2 : 3;
517
+        int roleType = type.equals("1") ? 1 : type.equals("2") ? 2 : 3;
518 518
         TaSysRole taSysRole = taSysRoleMapper.selectByPrimaryKey(roleType);
519 519
         if (null == taSysRole) {
520 520
             response.addError("该权限不存在!");
@@ -531,12 +531,12 @@ public class TaUserServiceImpl implements ITaUserService {
531 531
             if (resultRole > 0) {
532 532
                 response.addSuccess("添加成功!");
533 533
             } else {
534
-                throw new RuntimeException("租客或者家属角色权限添加失败");
534
+                throw new RuntimeException("业主或者租客或者家属角色权限添加失败");
535 535
             }
536 536
         } catch (Exception e) {
537 537
             response.addSuccess("添加失败!");
538
-            log.error("租客或者家属角色权限添加失败!",e);
539
-            throw new RuntimeException("租客或者家属角色权限添加失败");
538
+            log.error("业主或者租客或者家属角色权限添加失败!",e);
539
+            throw new RuntimeException("业主或者租客或者家属角色权限添加失败");
540 540
         }
541 541
     }
542 542
 

+ 2
- 2
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml Ver fichero

@@ -39,7 +39,7 @@
39 39
     delete from ta_user
40 40
     where id = #{id,jdbcType=INTEGER}
41 41
   </delete>
42
-  <insert id="insert" parameterType="com.community.huiju.model.TaUser" >
42
+  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
43 43
     insert into ta_user (id, community_id, building_owner_info_id,
44 44
       head_portrait, user_name, login_name,
45 45
       login_password, email, gender,
@@ -57,7 +57,7 @@
57 57
       #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
58 58
       )
59 59
   </insert>
60
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" >
60
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
61 61
     insert into ta_user
62 62
     <trim prefix="(" suffix=")" suffixOverrides="," >
63 63
       <if test="id != null" >