| | |
| | | import com.java110.intf.common.ISystemInfoV1InnerServiceSMO; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.job.IIotInnerServiceSMO; |
| | | import com.java110.intf.job.IMallInnerServiceSMO; |
| | | import com.java110.intf.user.*; |
| | | import com.java110.po.owner.OwnerAppUserPo; |
| | | import com.java110.po.user.UserAttrPo; |
| | |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IMallInnerServiceSMO mallInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IIotInnerServiceSMO iotInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | |
| | | throw new CmdException("密码错误或者用户不存在"); |
| | | } |
| | | |
| | | //todo 1.2 同步物业用户资料给商城 |
| | | mallInnerServiceSMOImpl.sendUserInfo(userDtos.get(0)); |
| | | |
| | | //todo 1.3 同步物业用户资料给物联网 |
| | | iotInnerServiceSMOImpl.sendUserInfo(userDtos.get(0)); |
| | | |
| | | // todo 2.0 校验 业主用户绑定表是否存在记录 |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setUserId(userDtos.get(0).getUserId()); |
| | | ownerAppUserDto.setLink(userDtos.get(0).getTel()); |
| | | ownerAppUserDto.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | |
| | | LoginOwnerResDto loginOwnerResDto = new LoginOwnerResDto(); |
| | | loginOwnerResDto.setAuditState(userDtos.get(0).getAuditState()); |
| | | String communityId = ""; |
| | | if (!ListUtil.isNull(ownerAppUserDtos)) { |
| | | // todo 4.0 查询小区是否存在 |
| | | communityId = ownerAppUserDtos.get(0).getCommunityId(); |
| | | loginOwnerResDto.setAuditState(ownerAppUserDtos.get(0).getState()); |
| | | } else { |
| | | SystemInfoDto systemInfoDto = new SystemInfoDto(); |
| | | List<SystemInfoDto> systemInfoDtos = systemInfoV1InnerServiceSMOImpl.querySystemInfos(systemInfoDto); |
| | |
| | | |
| | | //todo 生成登录token |
| | | String token = generatorLoginToken(tmpUserDto); |
| | | LoginOwnerResDto loginOwnerResDto = new LoginOwnerResDto(); |
| | | |
| | | |
| | | loginOwnerResDto.setCommunityId(communityDtos.get(0).getCommunityId()); |
| | | loginOwnerResDto.setCommunityName(communityDtos.get(0).getName()); |
| | | loginOwnerResDto.setCommunityTel(communityDtos.get(0).getTel()); |
| | | loginOwnerResDto.setCommunityQrCode(communityDtos.get(0).getQrCode()); |
| | | loginOwnerResDto.setUserId(tmpUserDto.getUserId()); |
| | | loginOwnerResDto.setUserName(tmpUserDto.getName()); |
| | | loginOwnerResDto.setOwnerTel(tmpUserDto.getTel()); |
| | |
| | | if (flag < 1) { |
| | | throw new CmdException("注册失败"); |
| | | } |
| | | |
| | | OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo(); |
| | | //状态类型,10000 审核中,12000 审核成功,13000 审核失败 |
| | | ownerAppUserPo.setState("12000"); |
| | | ownerAppUserPo.setAppTypeCd("10010"); |
| | | ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | ownerAppUserPo.setMemberId(ownerDtos.get(0).getMemberId()); |
| | | ownerAppUserPo.setCommunityName(tmpCommunityDto.getName()); |
| | | ownerAppUserPo.setCommunityId(ownerDtos.get(0).getCommunityId()); |
| | | ownerAppUserPo.setAppUserName(ownerDtos.get(0).getName()); |
| | | ownerAppUserPo.setIdCard(ownerDtos.get(0).getIdCard()); |
| | | ownerAppUserPo.setAppType("WECHAT"); |
| | | ownerAppUserPo.setLink(ownerDtos.get(0).getLink()); |
| | | ownerAppUserPo.setUserId(userPo.getUserId()); |
| | | ownerAppUserPo.setOpenId("-1"); |
| | | ownerAppUserPo.setOwnerTypeCd(ownerDtos.get(0).getOwnerTypeCd()); |
| | | |
| | | queryOwnerRoom(ownerDtos.get(0), ownerAppUserPo); |
| | | |
| | | |
| | | flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("添加用户业主关系失败"); |
| | | } |
| | | |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setUserId(userPo.getUserId()); |
| | | List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto); |
| | | //用userId和手机号查询绑定关系,没有则新增 |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setLink(userPo.getTel()); |
| | | ownerAppUserDto.setUserId(userPo.getUserId()); |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | if(CollectionUtils.isEmpty(ownerAppUserDtos)){ |
| | | OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo(); |
| | | //状态类型,10000 审核中, 11000 待认证 ,12000 审核成功,13000 审核失败 |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_NOT_AUDIT); |
| | | ownerAppUserPo.setAppTypeCd("10010"); |
| | | ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | ownerAppUserPo.setMemberId(ownerDtos.get(0).getMemberId()); |
| | | ownerAppUserPo.setCommunityName(tmpCommunityDto.getName()); |
| | | ownerAppUserPo.setCommunityId(ownerDtos.get(0).getCommunityId()); |
| | | ownerAppUserPo.setAppUserName(ownerDtos.get(0).getName()); |
| | | ownerAppUserPo.setIdCard(ownerDtos.get(0).getIdCard()); |
| | | ownerAppUserPo.setAppType("WECHAT"); |
| | | ownerAppUserPo.setLink(ownerDtos.get(0).getLink()); |
| | | ownerAppUserPo.setUserId(userPo.getUserId()); |
| | | ownerAppUserPo.setOpenId("-1"); |
| | | ownerAppUserPo.setOwnerTypeCd(ownerDtos.get(0).getOwnerTypeCd()); |
| | | queryOwnerRoom(ownerDtos.get(0), ownerAppUserPo); |
| | | flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("添加用户业主关系失败"); |
| | | } |
| | | userDtos.get(0).setAuditState(ownerAppUserPo.getState()); |
| | | } |
| | | return userDtos; |
| | | } |
| | | |