33import com .java110 .core .factory .AuthenticationFactory ;
44import com .java110 .core .factory .GenerateCodeFactory ;
55import com .java110 .dto .community .CommunityDto ;
6+ import com .java110 .dto .user .UserDto ;
67import com .java110 .intf .community .ICommunityInnerServiceSMO ;
78import com .java110 .intf .user .IOwnerAppUserV1InnerServiceSMO ;
89import com .java110 .intf .user .IUserV1InnerServiceSMO ;
1516import com .java110 .utils .constant .UserLevelConstant ;
1617import com .java110 .utils .exception .CmdException ;
1718import com .java110 .utils .util .Assert ;
19+ import com .java110 .utils .util .ListUtil ;
1820import org .springframework .beans .factory .annotation .Autowired ;
1921import org .springframework .stereotype .Service ;
2022
@@ -48,18 +50,29 @@ public void generator(OwnerPo ownerPo) {
4850 Assert .listNotNull (communityDtos , "未包含小区信息" );
4951 CommunityDto tmpCommunityDto = communityDtos .get (0 );
5052
51- UserPo userPo = new UserPo ();
52- userPo .setUserId (GenerateCodeFactory .getUserId ());
53- userPo .setName (ownerPo .getName ());
54- userPo .setTel (ownerPo .getLink ());
55- userPo .setPassword (AuthenticationFactory .passwdMd5 (ownerPo .getLink ()));
56- userPo .setLevelCd (UserLevelConstant .USER_LEVEL_ORDINARY );
57- userPo .setAge (ownerPo .getAge ());
58- userPo .setAddress (ownerPo .getAddress ());
59- userPo .setSex (ownerPo .getSex ());
60- flag = userV1InnerServiceSMOImpl .saveUser (userPo );
61- if (flag < 1 ) {
62- throw new CmdException ("注册失败" );
53+ UserDto userDto = new UserDto ();
54+ userDto .setTel (ownerPo .getLink ());
55+ userDto .setLevelCd (UserLevelConstant .USER_LEVEL_ORDINARY );
56+ List <UserDto > userDtos = userV1InnerServiceSMOImpl .queryUsers (userDto );
57+ String userId = "" ;
58+ if (ListUtil .isNull (userDtos )) {
59+ UserPo userPo = new UserPo ();
60+ userPo .setUserId (GenerateCodeFactory .getUserId ());
61+ userPo .setName (ownerPo .getName ());
62+ userPo .setTel (ownerPo .getLink ());
63+ userPo .setPassword (AuthenticationFactory .passwdMd5 (ownerPo .getLink ()));
64+ userPo .setLevelCd (UserLevelConstant .USER_LEVEL_ORDINARY );
65+ userPo .setAge (ownerPo .getAge ());
66+ userPo .setAddress (ownerPo .getAddress ());
67+ userPo .setSex (ownerPo .getSex ());
68+ flag = userV1InnerServiceSMOImpl .saveUser (userPo );
69+ if (flag < 1 ) {
70+ throw new CmdException ("注册失败" );
71+ }
72+ userId = userPo .getUserId ();
73+ } else {
74+ userId = userDtos .get (0 ).getUserId ();
75+
6376 }
6477
6578 OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo ();
@@ -74,7 +87,7 @@ public void generator(OwnerPo ownerPo) {
7487 ownerAppUserPo .setIdCard (ownerPo .getIdCard ());
7588 ownerAppUserPo .setAppType ("WECHAT" );
7689 ownerAppUserPo .setLink (ownerPo .getLink ());
77- ownerAppUserPo .setUserId (userPo . getUserId () );
90+ ownerAppUserPo .setUserId (userId );
7891 ownerAppUserPo .setOpenId ("-1" );
7992
8093 flag = ownerAppUserV1InnerServiceSMOImpl .saveOwnerAppUser (ownerAppUserPo );
0 commit comments