| | |
| | | import com.java110.intf.community.IRoomV1InnerServiceSMO; |
| | | import com.java110.intf.user.*; |
| | | import com.java110.po.owner.OwnerAppUserPo; |
| | | import com.java110.po.owner.OwnerPo; |
| | | import com.java110.po.user.UserPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区"); |
| | | Assert.hasKeyAndValue(reqJson, "roomName", "未包含房屋"); |
| | | Assert.hasKeyAndValue(reqJson, "roomId", "未包含房屋"); |
| | | Assert.hasKeyAndValue(reqJson, "link", "未包含手机号"); |
| | | Assert.hasKeyAndValue(reqJson, "ownerName", "未包含人员名称"); |
| | | Assert.hasKeyAndValue(reqJson, "link", "手机号不能为空"); |
| | | // Assert.hasKeyAndValue(reqJson, "ownerName", "未包含人员名称"); |
| | | Assert.hasKeyAndValue(reqJson, "ownerTypeCd", "未包含人员类型"); |
| | | |
| | | //todo 根据手机号查询 是否已经认证过,如果认证过则不能再次认证 |
| | |
| | | userDto.setUserId(userId); |
| | | List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); |
| | | Assert.listOnlyOne(userDtos, "用户未登录"); |
| | | if (!userDtos.get(0).getTel().equals(reqJson.getString("link"))) { |
| | | throw new CmdException("手机号错误,不是注册时的手机号"); |
| | | if(!StringUtils.isEmpty(userDtos.get(0).getTel())){ |
| | | if (!userDtos.get(0).getTel().equals(reqJson.getString("link"))) { |
| | | throw new CmdException("手机号错误,不是注册时的手机号"); |
| | | } |
| | | } |
| | | |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setLink(reqJson.getString("link")); |
| | | //由于手机号是非必填,所有有可能查出来大量用户,所以不能使用手机号查询,要用userId查询 |
| | | // ownerAppUserDto.setLink(reqJson.getString("link")); |
| | | ownerAppUserDto.setUserId(userId); |
| | | ownerAppUserDto.setCommunityId(reqJson.getString("communityId")); |
| | | ownerAppUserDto.setStates(new String[]{ |
| | | OwnerAppUserDto.STATE_AUDITING, |
| | |
| | | List<RoomDto> roomDtos = roomV1InnerServiceSMOImpl.queryRooms(roomDto); |
| | | Assert.listOnlyOne(roomDtos, "房屋不存在"); |
| | | |
| | | if (!OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) { |
| | | return; |
| | | } |
| | | |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomDtos.get(0).getRoomId()); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | |
| | | if (ListUtil.isNull(ownerRoomRelDtos)) { |
| | | throw new CmdException("房屋未销售,请联系物业"); |
| | | } |
| | | |
| | | |
| | | if (!OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) { |
| | | return; |
| | | } |
| | | |
| | |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto); |
| | | Assert.listNotNull(communityDtos, "未包含小区信息"); |
| | | CommunityDto tmpCommunityDto = communityDtos.get(0); |
| | | |
| | | |
| | | OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo(); |
| | | //状态类型,10000 审核中,12000 审核成功,13000 审核失败 |
| | | ownerAppUserPo.setState("12000"); |
| | | ownerAppUserPo.setAppTypeCd("10010"); |
| | | ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | ownerAppUserPo.setMemberId("-1"); |
| | | ownerAppUserPo.setCommunityName(tmpCommunityDto.getName()); |
| | | ownerAppUserPo.setCommunityId(tmpCommunityDto.getCommunityId()); |
| | | ownerAppUserPo.setAppUserName(reqJson.getString("ownerName")); |
| | | ownerAppUserPo.setAppType("WECHAT"); |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | ownerAppUserPo.setUserId(userId); |
| | | ownerAppUserPo.setOpenId("-1"); |
| | | ownerAppUserPo.setRoomId(reqJson.getString("roomId")); |
| | | ownerAppUserPo.setRoomName(reqJson.getString("roomName")); |
| | | ownerAppUserPo.setOwnerTypeCd(reqJson.getString("ownerTypeCd")); |
| | | |
| | | UserAttrDto userAttrDto = new UserAttrDto(); |
| | | userAttrDto.setUserId(userId); |
| | | userAttrDto.setSpecCd(UserAttrDto.SPEC_OPEN_ID); |
| | | List<UserAttrDto> userAttrDtos = userAttrV1InnerServiceSMOImpl.queryUserAttrs(userAttrDto); |
| | | if (!ListUtil.isNull(userAttrDtos)) { |
| | | ownerAppUserPo.setOpenId(userAttrDtos.get(0).getValue()); |
| | | |
| | | //用userId查询是否有待认证记录,没有新增,有的话直接更新状态 |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setUserId(userId); |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | if(CollectionUtils.isEmpty(ownerAppUserDtos)){ |
| | | //状态类型,10000 审核中, 11000 待认证 ,12000 审核成功,13000 审核失败 |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | ownerAppUserPo.setAppTypeCd("10010"); |
| | | ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | ownerAppUserPo.setMemberId("-1"); |
| | | ownerAppUserPo.setCommunityName(tmpCommunityDto.getName()); |
| | | ownerAppUserPo.setCommunityId(tmpCommunityDto.getCommunityId()); |
| | | ownerAppUserPo.setAppUserName(reqJson.getString("ownerName")); |
| | | ownerAppUserPo.setAppType("WECHAT"); |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | ownerAppUserPo.setUserId(userId); |
| | | ownerAppUserPo.setOpenId("-1"); |
| | | ownerAppUserPo.setRoomId(reqJson.getString("roomId")); |
| | | ownerAppUserPo.setRoomName(reqJson.getString("roomName")); |
| | | ownerAppUserPo.setOwnerTypeCd(reqJson.getString("ownerTypeCd")); |
| | | UserAttrDto userAttrDto = new UserAttrDto(); |
| | | userAttrDto.setUserId(userId); |
| | | userAttrDto.setSpecCd(UserAttrDto.SPEC_OPEN_ID); |
| | | List<UserAttrDto> userAttrDtos = userAttrV1InnerServiceSMOImpl.queryUserAttrs(userAttrDto); |
| | | if (!ListUtil.isNull(userAttrDtos)) { |
| | | ownerAppUserPo.setOpenId(userAttrDtos.get(0).getValue()); |
| | | } |
| | | ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | }else{ |
| | | for(OwnerAppUserDto ownerAppUser : ownerAppUserDtos){ |
| | | ownerAppUserPo.setAppUserId(ownerAppUser.getAppUserId()); |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo); |
| | | //更新building_owner表的link字段 |
| | | OwnerPo ownerPo = new OwnerPo(); |
| | | ownerPo.setMemberId(ownerAppUser.getMemberId()); |
| | | ownerPo.setLink(reqJson.getString("link")); |
| | | ownerV1InnerServiceSMOImpl.updateOwner(ownerPo); |
| | | //更新u_user的tel字段 |
| | | UserPo userPo = new UserPo(); |
| | | userPo.setUserId(ownerAppUser.getUserId()); |
| | | userPo.setTel(reqJson.getString("link")); |
| | | userV1InnerServiceSMOImpl.updateUser(userPo); |
| | | } |
| | | } |
| | | |
| | | ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | } |
| | | } |