Пример #1
0
	@Override
	public int registClub(int communityNo, String email, Club club, String category) {
		//
		List<Category> categories = categoryDao.readCategoriesByCommunityNo(communityNo);

		int categoryNo = 0;
		for (Category cate : categories) {
			if(cate.getCategory().equals(category)){
				categoryNo = cate.getCategoryNo();
			}
		}
		
		List<Club> clubList = findAllClubs(communityNo);
		for (Club clubOne : clubList) {
			if (clubOne.getCategory().equals(category)) {
				throw NamooExceptionFactory.createRuntime("해당 카테고리의 클럽이 이미 존재합니다. 다른 카테고리를 선택해주세요");
			}
		}
		
		int id = clubDao.createClub(communityNo, club, categoryNo);
		Member member = new Member(email, id, 2, 3);
		memberDao.createMember(member);
		
		return id;
	}
Пример #2
0
	@Override
	public void joinAsMember(int clubNo, String email) {
		//
		int communityId = clubDao.readClub(clubNo).getCommunityId();
		List<Member> mem = memberDao.readMembersByPerson(email);
		for (Member member : mem){
			if(member.getGroupType()==1 && member.getGroupNo()==communityId){
				member = new Member(email, clubNo, 2, 1);
				memberDao.createMember(member);
				return;
			}
		}
		throw NamooExceptionFactory.createRuntime("커뮤니티에 가입 후 소속 클럽에 가입하실 수 있습니다.");
	}