| | |
| | | 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.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | |
| | | 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()); |
| | | if(StringUtil.isEmpty(reqJson.getString("link"))){ |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDITING); |
| | | }else{ |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | } |
| | | ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo); |
| | | } |
| | | } |
| | | |
| | | ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | } |
| | | } |