From af17aa4a168d23de764f04f259e5e07c978559ad Mon Sep 17 00:00:00 2001 From: redhi Date: Fri, 25 Mar 2022 16:07:58 +0900 Subject: [PATCH] =?UTF-8?q?[#58]Feat:=20DB=20=ED=85=8C=EC=9D=B4=EB=B8=94?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20user=5Fstatus=20=ED=86=B5?= =?UTF-8?q?=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../movie/domain/dto/comments/Comments.java | 5 ++-- .../dto/directMessage/DirectMessage.java | 4 --- .../DirectMessageListResponseDto.java | 4 ++- .../InformationShareResponseDetail.java | 3 ++- .../InformationShareResponseSearch.java | 3 ++- .../domain/dto/signin/SignInRequestDto.java | 2 -- .../domain/dto/signin/SignInResponseDto.java | 3 ++- .../TransactionsSearchResponseDto.java | 3 ++- .../domain/entity/ChatRoom/Chat_Room.java | 10 ++++++-- .../movie/domain/entity/Comment/Comment.java | 2 -- .../entity/Content_Detail/Content_Detail.java | 14 +++++------ .../movie/domain/entity/Message/Message.java | 5 ++-- .../movie/domain/entity/User/User.java | 4 +-- .../domain/entity/User/UserRepository.java | 2 +- .../movie/domain/entity/User/UserStatus.java | 5 ++++ .../movie/service/ChatRoomService.java | 11 ++++---- .../moviegoods/movie/service/ChatService.java | 5 ---- .../movie/service/GeneralBoardService.java | 13 +++++----- .../service/InformationShareService.java | 24 +++++++----------- .../movie/service/ManagerService.java | 18 +++++++------ .../movie/service/MyPageService.java | 9 ++++--- .../movie/service/SignInService.java | 25 ++++++++----------- .../movie/service/SignUpService.java | 18 ++++++------- .../movie/service/TransactionsService.java | 4 +-- .../src/main/resources/application.properties | 1 - 25 files changed, 98 insertions(+), 99 deletions(-) create mode 100644 backend/src/main/java/moviegoods/movie/domain/entity/User/UserStatus.java diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/comments/Comments.java b/backend/src/main/java/moviegoods/movie/domain/dto/comments/Comments.java index 50a19bb..8810b60 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/comments/Comments.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/comments/Comments.java @@ -2,6 +2,7 @@ import lombok.AllArgsConstructor; import lombok.Data; +import moviegoods.movie.domain.entity.User.UserStatus; import java.time.LocalDateTime; @@ -15,9 +16,9 @@ public class Comments { private String comment_content; private Boolean is_mine; private LocalDateTime comment_written_date; - private Byte user_status; + private UserStatus user_status; - public Comments(Long user_id, String comment_nickname, String comment_content, LocalDateTime comment_written_date, Long comment_id,Byte status){ + public Comments(Long user_id, String comment_nickname, String comment_content, LocalDateTime comment_written_date, Long comment_id, UserStatus status){ this.comment_id=comment_id; this.user_id=user_id; this.comment_nickname=comment_nickname; diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessage.java b/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessage.java index 1291d8b..a668425 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessage.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessage.java @@ -2,7 +2,6 @@ import lombok.Getter; import lombok.Setter; -import org.springframework.web.multipart.MultipartFile; import java.time.LocalDateTime; @@ -11,7 +10,6 @@ @Setter public class DirectMessage { - private String image_url; private String content; private Long chat_room_id; @@ -20,6 +18,4 @@ public class DirectMessage { private LocalDateTime written_date; - - } \ No newline at end of file diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessageListResponseDto.java b/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessageListResponseDto.java index 2c3825b..fd4abff 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessageListResponseDto.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/directMessage/DirectMessageListResponseDto.java @@ -3,6 +3,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import moviegoods.movie.domain.entity.User.UserStatus; import java.time.LocalDateTime; @@ -17,10 +18,11 @@ public class DirectMessageListResponseDto { private String not_mine_nickname; private String not_mine_profile_url; private Long not_mine_reliability; + private UserStatus not_mine_user_status; private Long transaction_id; private Boolean is_complete; private String recent_message; private LocalDateTime recent_message_date; -} +} \ No newline at end of file diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseDetail.java b/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseDetail.java index f0ebd75..fa5ba77 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseDetail.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseDetail.java @@ -3,6 +3,7 @@ import lombok.Data; import moviegoods.movie.domain.dto.comments.Comments; +import moviegoods.movie.domain.entity.User.UserStatus; import java.time.LocalDateTime; import java.util.ArrayList; @@ -22,7 +23,7 @@ public class InformationShareResponseDetail { private String cinema_area; private String cinema_branch; private Boolean is_mine; - private Byte status; + private UserStatus user_status; List comment=new ArrayList<>(); //댓글리스트 /* diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseSearch.java b/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseSearch.java index ceae27e..3691477 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseSearch.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/informationShare/InformationShareResponseSearch.java @@ -1,6 +1,7 @@ package moviegoods.movie.domain.dto.informationShare; import lombok.Data; +import moviegoods.movie.domain.entity.User.UserStatus; import java.time.LocalDateTime; @@ -13,5 +14,5 @@ public class InformationShareResponseSearch { private String nickname; //user private LocalDateTime written_date; //content-detail private Long view; //post - private Byte status; + private UserStatus user_status; } diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInRequestDto.java b/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInRequestDto.java index 7745ed3..c397ac0 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInRequestDto.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInRequestDto.java @@ -1,10 +1,8 @@ package moviegoods.movie.domain.dto.signin; import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Data diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInResponseDto.java b/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInResponseDto.java index bccb6a1..0818dc2 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInResponseDto.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/signin/SignInResponseDto.java @@ -3,6 +3,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import moviegoods.movie.domain.entity.User.UserStatus; @Data @NoArgsConstructor @@ -10,7 +11,7 @@ public class SignInResponseDto { private String nickname; private String image_url; - private Boolean status; + private UserStatus user_status; private Boolean result; private String authority; } diff --git a/backend/src/main/java/moviegoods/movie/domain/dto/transactions/TransactionsSearchResponseDto.java b/backend/src/main/java/moviegoods/movie/domain/dto/transactions/TransactionsSearchResponseDto.java index 205ebde..a07f8de 100644 --- a/backend/src/main/java/moviegoods/movie/domain/dto/transactions/TransactionsSearchResponseDto.java +++ b/backend/src/main/java/moviegoods/movie/domain/dto/transactions/TransactionsSearchResponseDto.java @@ -3,6 +3,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import moviegoods.movie.domain.entity.User.UserStatus; import java.time.LocalDateTime; @@ -13,7 +14,7 @@ public class TransactionsSearchResponseDto { private Long user_id; private String content; private String status; - private Byte user_status; + private UserStatus user_status; private Long transaction_id; private Long reliability; private LocalDateTime written_date; diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/ChatRoom/Chat_Room.java b/backend/src/main/java/moviegoods/movie/domain/entity/ChatRoom/Chat_Room.java index 27da8b6..40b0136 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/ChatRoom/Chat_Room.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/ChatRoom/Chat_Room.java @@ -1,14 +1,16 @@ package moviegoods.movie.domain.entity.ChatRoom; -import javax.persistence.*; - import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import moviegoods.movie.domain.entity.ChatRoomJoin.Chat_Room_Join; import moviegoods.movie.domain.entity.Message.Message; import moviegoods.movie.domain.entity.Transaction.Transaction; +import org.springframework.format.annotation.DateTimeFormat; +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -21,6 +23,10 @@ public class Chat_Room { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long chat_room_id; + @NotNull + @DateTimeFormat + private LocalDateTime create_date; + @OneToMany(mappedBy = "chat_room", cascade = CascadeType.ALL) private List chat_room_joins = new ArrayList<>(); diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/Comment/Comment.java b/backend/src/main/java/moviegoods/movie/domain/entity/Comment/Comment.java index 00d131c..ce71615 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/Comment/Comment.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/Comment/Comment.java @@ -35,6 +35,4 @@ public class Comment { private Content_Detail content_detail; - - } diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/Content_Detail/Content_Detail.java b/backend/src/main/java/moviegoods/movie/domain/entity/Content_Detail/Content_Detail.java index 9741db1..9b361c9 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/Content_Detail/Content_Detail.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/Content_Detail/Content_Detail.java @@ -1,11 +1,9 @@ package moviegoods.movie.domain.entity.Content_Detail; -import java.time.LocalDateTime; - -import javax.persistence.*; -import javax.validation.constraints.NotNull; - +import lombok.AllArgsConstructor; import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; import moviegoods.movie.domain.entity.Comment.Comment; import moviegoods.movie.domain.entity.Message.Message; import moviegoods.movie.domain.entity.Post.Post; @@ -13,9 +11,9 @@ import moviegoods.movie.domain.entity.Transaction.Transaction; import org.springframework.format.annotation.DateTimeFormat; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; @Entity(name = "content_detail") @Data diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/Message/Message.java b/backend/src/main/java/moviegoods/movie/domain/entity/Message/Message.java index a85919c..1671b33 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/Message/Message.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/Message/Message.java @@ -1,8 +1,5 @@ package moviegoods.movie.domain.entity.Message; -import javax.persistence.*; -import javax.validation.constraints.NotBlank; - import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -11,6 +8,8 @@ import moviegoods.movie.domain.entity.Content_Detail.Content_Detail; import moviegoods.movie.domain.entity.User.User; +import javax.persistence.*; + @Entity(name = "message") @Data @NoArgsConstructor diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/User/User.java b/backend/src/main/java/moviegoods/movie/domain/entity/User/User.java index ac9964e..ed20593 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/User/User.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/User/User.java @@ -54,8 +54,8 @@ public class User { private Long reliability; @NotNull - @Column(columnDefinition = "tinyint default 1") - private Byte status; + @Enumerated(EnumType.STRING) + private UserStatus user_status; @NotNull @Enumerated(EnumType.STRING) diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/User/UserRepository.java b/backend/src/main/java/moviegoods/movie/domain/entity/User/UserRepository.java index 943605e..b5979a3 100644 --- a/backend/src/main/java/moviegoods/movie/domain/entity/User/UserRepository.java +++ b/backend/src/main/java/moviegoods/movie/domain/entity/User/UserRepository.java @@ -10,5 +10,5 @@ public interface UserRepository extends JpaRepository { Optional findByEmail(String email); Optional findByNickname(String nickname); - Optional findByEmailAndMethod(String email, String method); + Optional findByEmailAndMethod(String email, Method method); } diff --git a/backend/src/main/java/moviegoods/movie/domain/entity/User/UserStatus.java b/backend/src/main/java/moviegoods/movie/domain/entity/User/UserStatus.java new file mode 100644 index 0000000..9047276 --- /dev/null +++ b/backend/src/main/java/moviegoods/movie/domain/entity/User/UserStatus.java @@ -0,0 +1,5 @@ +package moviegoods.movie.domain.entity.User; + +public enum UserStatus { + 정상, 정지, 탈퇴 +} diff --git a/backend/src/main/java/moviegoods/movie/service/ChatRoomService.java b/backend/src/main/java/moviegoods/movie/service/ChatRoomService.java index 1de9fd5..0c2c75a 100644 --- a/backend/src/main/java/moviegoods/movie/service/ChatRoomService.java +++ b/backend/src/main/java/moviegoods/movie/service/ChatRoomService.java @@ -5,23 +5,21 @@ import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomRequestDto; import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomResponseDto; import moviegoods.movie.domain.dto.directMessage.DirectMessageListResponseDto; -import moviegoods.movie.domain.dto.manager.ManagerResponseDto; -import moviegoods.movie.domain.entity.ChatRoom.Chat_Room; import moviegoods.movie.domain.entity.ChatRoom.ChatRoomRepository; +import moviegoods.movie.domain.entity.ChatRoom.Chat_Room; import moviegoods.movie.domain.entity.ChatRoomJoin.ChatRoomJoinRepository; import moviegoods.movie.domain.entity.ChatRoomJoin.Chat_Room_Join; -import moviegoods.movie.domain.entity.Event.Event; import moviegoods.movie.domain.entity.Message.Message; import moviegoods.movie.domain.entity.Transaction.Status; import moviegoods.movie.domain.entity.Transaction.Transaction; import moviegoods.movie.domain.entity.Transaction.TransactionRepository; import moviegoods.movie.domain.entity.User.User; import moviegoods.movie.domain.entity.User.UserRepository; +import moviegoods.movie.domain.entity.User.UserStatus; import org.springframework.stereotype.Service; import javax.persistence.EntityManager; -import javax.persistence.TypedQuery; -import java.time.LocalDate; +import javax.validation.constraints.NotNull; import java.time.LocalDateTime; import java.util.*; @@ -144,6 +142,7 @@ public List findMessageRooms(User loginUser, Long String not_mine_nickname = null; String not_mine_profile_url = null; Long not_mine_reliability = null; + @NotNull UserStatus not_mine_status = null; Long transaction_id = null; Boolean is_complete = false; String recent_message = null; @@ -158,6 +157,7 @@ public List findMessageRooms(User loginUser, Long not_mine_nickname = user1.getNickname(); not_mine_profile_url = user1.getProfile_url(); not_mine_reliability = user1.getReliability(); + not_mine_status = user1.getUser_status(); } } @@ -182,6 +182,7 @@ public List findMessageRooms(User loginUser, Long not_mine_nickname, not_mine_profile_url, not_mine_reliability, + not_mine_status, transaction_id, is_complete, recent_message, diff --git a/backend/src/main/java/moviegoods/movie/service/ChatService.java b/backend/src/main/java/moviegoods/movie/service/ChatService.java index 75b9b72..9b9bdc6 100644 --- a/backend/src/main/java/moviegoods/movie/service/ChatService.java +++ b/backend/src/main/java/moviegoods/movie/service/ChatService.java @@ -3,7 +3,6 @@ import com.google.firebase.auth.FirebaseAuthException; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; - import moviegoods.movie.domain.dto.directMessage.*; import moviegoods.movie.domain.entity.ChatRoom.ChatRoomRepository; import moviegoods.movie.domain.entity.ChatRoom.Chat_Room; @@ -19,15 +18,11 @@ import moviegoods.movie.domain.entity.User.UserRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; import java.io.IOException; -import java.net.URLDecoder; import java.time.LocalDateTime; import java.util.*; -import static moviegoods.movie.domain.entity.Transaction.Status.진행중; - @Slf4j @Service diff --git a/backend/src/main/java/moviegoods/movie/service/GeneralBoardService.java b/backend/src/main/java/moviegoods/movie/service/GeneralBoardService.java index 745fb86..0b995cf 100644 --- a/backend/src/main/java/moviegoods/movie/service/GeneralBoardService.java +++ b/backend/src/main/java/moviegoods/movie/service/GeneralBoardService.java @@ -8,10 +8,10 @@ import moviegoods.movie.domain.dto.generalBoard.*; import moviegoods.movie.domain.entity.Comment.Comment; import moviegoods.movie.domain.entity.Comment.CommentRepository; -import moviegoods.movie.domain.entity.Content_Detail.ContentDetailRepository; import moviegoods.movie.domain.entity.Content_Detail.Content_Detail; import moviegoods.movie.domain.entity.Post.Post; import moviegoods.movie.domain.entity.Post.PostRepository; +import moviegoods.movie.domain.entity.User.UserStatus; import moviegoods.movie.domain.entity.User.User; import moviegoods.movie.domain.entity.User.UserRepository; import org.springframework.stereotype.Service; @@ -80,12 +80,12 @@ public List search(GeneralBoardSearchRequestDto r search_word = ""; } - String searchJpql = "select p from post p join p.user u join p.content_detail c where p.category = '자유' and "; + String searchJpql = "select p from post p join p.user u join p.content_detail c where p.category = '자유' "; String criteriaJpql = ""; String criteriaJpql2 = ""; log.info("search_criteria={}", search_criteria); - if (search_criteria != null) { + if (search_criteria != "") { if (Objects.equals(search_criteria, "작성자")) { criteriaJpql = "u.nickname"; } @@ -100,14 +100,15 @@ public List search(GeneralBoardSearchRequestDto r criteriaJpql2 = "p.title"; } if (criteriaJpql2 != "") { - searchJpql += "("+criteriaJpql + " like '%" + search_word + "%' "+"OR "+criteriaJpql2 + " like '%" + search_word + "%') "; + searchJpql += "and ("+criteriaJpql + " like '%" + search_word + "%' "+"OR "+criteriaJpql2 + " like '%" + search_word + "%') "; } else { - searchJpql += criteriaJpql + " like '%" + search_word + "%' "; + searchJpql += "and "+criteriaJpql + " like '%" + search_word + "%' "; } } + searchJpql += "order by c.written_date desc"; log.info("searchJpql={}", searchJpql); @@ -157,7 +158,7 @@ public GeneralBoardDetailResponseDto detailInfo(User loginUser, GeneralBoardDeta String comment_nickname = comment.getUser().getNickname(); String comment_content = comment.getContent_detail().getContent(); LocalDateTime comment_written_date = comment.getContent_detail().getWritten_date(); - Byte user_status = comment.getUser().getStatus(); + UserStatus user_status = comment.getUser().getUser_status(); Boolean comment_is_mine = Boolean.FALSE; if (search_user_id == user_id) { diff --git a/backend/src/main/java/moviegoods/movie/service/InformationShareService.java b/backend/src/main/java/moviegoods/movie/service/InformationShareService.java index 52eee26..fde92f1 100644 --- a/backend/src/main/java/moviegoods/movie/service/InformationShareService.java +++ b/backend/src/main/java/moviegoods/movie/service/InformationShareService.java @@ -4,7 +4,6 @@ import com.google.firebase.auth.FirebaseAuthException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; - import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto; import moviegoods.movie.domain.dto.comments.Comments; import moviegoods.movie.domain.dto.informationShare.*; @@ -16,13 +15,10 @@ import moviegoods.movie.domain.entity.Content_Detail.Content_Detail; import moviegoods.movie.domain.entity.Post.Post; import moviegoods.movie.domain.entity.Post.PostRepository; -import moviegoods.movie.domain.entity.Transaction.Status; -import moviegoods.movie.domain.entity.Transaction.Transaction; +import moviegoods.movie.domain.entity.User.UserStatus; import moviegoods.movie.domain.entity.User.User; import moviegoods.movie.domain.entity.User.UserRepository; - import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.persistence.EntityManager; @@ -30,8 +26,6 @@ import java.time.LocalDateTime; import java.util.*; -import static moviegoods.movie.domain.entity.Transaction.Status.진행중; - @Slf4j @Service @RequiredArgsConstructor @@ -119,14 +113,14 @@ public void saveUser(User user){ - public InformationShareResponseSearch makeInformationShareResponseSearch(String nickname, String title, Long views, Long post_id, LocalDateTime written_date,Byte status){ + public InformationShareResponseSearch makeInformationShareResponseSearch(String nickname, String title, Long views, Long post_id, LocalDateTime written_date, UserStatus status){ InformationShareResponseSearch informationShareResponseSearch=new InformationShareResponseSearch(); informationShareResponseSearch.setNickname(nickname); informationShareResponseSearch.setPost_id(post_id); informationShareResponseSearch.setTitle(title); informationShareResponseSearch.setView(views); informationShareResponseSearch.setWritten_date(written_date); - informationShareResponseSearch.setStatus(status); + informationShareResponseSearch.setUser_status(status); return informationShareResponseSearch; } @@ -165,7 +159,7 @@ public List Search(InformationShareRequestSearch Content_Detail content_detail=contentDetailRepository.findById(content_detail_id).get(); String nickname=post.getUser().getNickname(); - Byte status=userRepository.findByNickname(nickname).get().getStatus(); + UserStatus status=userRepository.findByNickname(nickname).get().getUser_status(); String title=post.getTitle(); Long views=post.getViews(); Long post_id=post.getPost_id(); @@ -188,7 +182,7 @@ public List Search(InformationShareRequestSearch Long user_id=post.getUser().getUser_id(); User user=userRepository.findById(user_id).get(); String nickname=user.getNickname(); - Byte status=userRepository.findByNickname(nickname).get().getStatus(); + UserStatus status=userRepository.findByNickname(nickname).get().getUser_status(); String title=post.getTitle(); Long views=post.getViews(); Long post_id=post.getPost_id(); @@ -234,7 +228,7 @@ public List Search(InformationShareRequestSearch List postList=em.createQuery(filterJpql,Post.class).getResultList(); for (Post post : postList) { String nickname=userRepository.findById(post.getUser().getUser_id()).get().getNickname(); - Byte status=userRepository.findByNickname(nickname).get().getStatus(); + UserStatus status=userRepository.findByNickname(nickname).get().getUser_status(); String title=post.getTitle(); Long views=post.getViews(); Long post_id=post.getPost_id(); @@ -292,7 +286,7 @@ public List Search(InformationShareRequestSearch Content_Detail content_detail=contentDetailRepository.findById(content_detail_id).get(); String nickname=post.getUser().getNickname(); - Byte status=userRepository.findByNickname(nickname).get().getStatus(); + UserStatus status=userRepository.findByNickname(nickname).get().getUser_status(); String title=post.getTitle(); Long views=post.getViews(); Long post_id=post.getPost_id(); @@ -325,14 +319,14 @@ public InformationShareResponseDetail detailInfo(User loginUser, InformationShar InformationShareResponseDetail informationShareResponseDetail=new InformationShareResponseDetail(); String nickname=(String)result[1]; - informationShareResponseDetail.setStatus(userRepository.findByNickname(nickname).get().getStatus()); + informationShareResponseDetail.setUser_status(userRepository.findByNickname(nickname).get().getUser_status()); List row2=em.createQuery("select u.user_id, u.nickname, d.content, d.written_date ,c.comment_id from comment c join c.post p left join c.user u left join c.content_detail d where p.post_id=:post_id").setParameter("post_id",post_id).getResultList(); List result2=new ArrayList<>(); for (Object[] objects : row2) { Boolean check=false; String nickname2=(String)objects[1]; - Byte status2=userRepository.findByNickname(nickname2).get().getStatus(); + UserStatus status2=userRepository.findByNickname(nickname2).get().getUser_status(); Comments comment=new Comments((Long)objects[0],(String)objects[1],(String)objects[2],(LocalDateTime)objects[3],(Long)objects[4],status2); if(user_id==(Long)objects[0]){ check=true; diff --git a/backend/src/main/java/moviegoods/movie/service/ManagerService.java b/backend/src/main/java/moviegoods/movie/service/ManagerService.java index 3081c1f..73531c8 100644 --- a/backend/src/main/java/moviegoods/movie/service/ManagerService.java +++ b/backend/src/main/java/moviegoods/movie/service/ManagerService.java @@ -10,11 +10,15 @@ import moviegoods.movie.domain.entity.Transaction.Transaction; import moviegoods.movie.domain.entity.User.User; import moviegoods.movie.domain.entity.User.UserRepository; +import moviegoods.movie.domain.entity.User.UserStatus; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.*; +import static moviegoods.movie.domain.entity.User.UserStatus.정상; +import static moviegoods.movie.domain.entity.User.UserStatus.정지; + @Slf4j @Service @RequiredArgsConstructor @@ -41,7 +45,7 @@ public List show() { String reported_content = transaction.getContent_detail().getContent(); //신고당한 내용 Boolean is_complete = false; - if(reportedUser.getStatus() == 0) { + if(reportedUser.getUser_status() == 정지) { is_complete = true; } @@ -57,16 +61,16 @@ public List show() { public ResultResponseDto approve(Long user_id) { Optional user = userRepository.findById(user_id); ResultResponseDto result = new ResultResponseDto(); - Byte statusActive = 1; - Byte statusDeActive = 0; + UserStatus statusActive = 정상; + UserStatus statusDeActive = 정지; if(user.isPresent()) { User findedUser = user.get(); - if(findedUser.getStatus() == 1) { - findedUser.setStatus(statusDeActive); + if(findedUser.getUser_status() == 정상) { + findedUser.setUser_status(statusDeActive); userRepository.save(findedUser); } - else if (findedUser.getStatus() == 0) { - findedUser.setStatus(statusActive); + else if (findedUser.getUser_status() == 정지) { + findedUser.setUser_status(statusActive); userRepository.save(findedUser); } result.setResult(true); diff --git a/backend/src/main/java/moviegoods/movie/service/MyPageService.java b/backend/src/main/java/moviegoods/movie/service/MyPageService.java index 95d8d78..902f1a3 100644 --- a/backend/src/main/java/moviegoods/movie/service/MyPageService.java +++ b/backend/src/main/java/moviegoods/movie/service/MyPageService.java @@ -8,6 +8,7 @@ import moviegoods.movie.domain.entity.Transaction.Status; import moviegoods.movie.domain.entity.User.User; import moviegoods.movie.domain.entity.User.UserRepository; +import moviegoods.movie.domain.entity.User.UserStatus; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -18,6 +19,8 @@ import java.util.List; import java.util.UUID; +import static moviegoods.movie.domain.entity.User.UserStatus.탈퇴; + @Slf4j @Service @RequiredArgsConstructor @@ -186,12 +189,12 @@ public Boolean withdrawal(User loginUser,MyPageRequestWithdrawal mrwd){ user_id = loginUser.getUser_id(); } - Byte newStatus=0; + UserStatus newStatus=탈퇴; User user=userRepository.findById(user_id).get(); - user.setStatus(newStatus); + user.setUser_status(newStatus); userRepository.save(user); - if(userRepository.findById(user_id).get().getStatus()==newStatus){ + if(userRepository.findById(user_id).get().getUser_status()==newStatus){ check=true; } return check; diff --git a/backend/src/main/java/moviegoods/movie/service/SignInService.java b/backend/src/main/java/moviegoods/movie/service/SignInService.java index 14c69dd..b4a6fb4 100644 --- a/backend/src/main/java/moviegoods/movie/service/SignInService.java +++ b/backend/src/main/java/moviegoods/movie/service/SignInService.java @@ -1,26 +1,25 @@ package moviegoods.movie.service; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import moviegoods.movie.configure.SessionConfig.SessionConst; import moviegoods.movie.domain.dto.signin.SignInRequestDto; import moviegoods.movie.domain.dto.signin.SignInResponseDto; import moviegoods.movie.domain.dto.signup.SignUpRequestDto; import moviegoods.movie.domain.entity.User.Method; import moviegoods.movie.domain.entity.User.User; +import moviegoods.movie.domain.entity.User.UserStatus; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; -import moviegoods.movie.configure.SessionConfig.*; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.validation.constraints.NotNull; - -import com.google.gson.JsonParser; -import com.google.gson.JsonElement; - import java.io.*; import java.net.HttpURLConnection; import java.net.URL; @@ -30,6 +29,8 @@ import java.util.Random; import java.util.stream.Collectors; +import static moviegoods.movie.domain.entity.User.UserStatus.*; + @Slf4j @Service @@ -53,7 +54,7 @@ public SignInResponseDto login(SignInRequestDto requestDto, HttpServletRequest r user = em.createQuery(searchJpql, User.class).getSingleResult(); }catch (NoResultException e){ - signInResponseDto = new SignInResponseDto(null,null,true, false, null); + signInResponseDto = new SignInResponseDto(null,null,정상, false, null); return signInResponseDto; } @@ -61,20 +62,16 @@ public SignInResponseDto login(SignInRequestDto requestDto, HttpServletRequest r if(passwordEncoder.matches(password, existPassword)) { HttpSession session = request.getSession(); + session.setMaxInactiveInterval(30*60); session.setAttribute(SessionConst.LOGIN_MEMBER, user); - @NotNull Byte status = user.getStatus(); + @NotNull UserStatus status = user.getUser_status(); Enum authority = user.getAuthority(); - Boolean user_status = true; - if (status == 0) { - user_status = false; - } - - signInResponseDto = new SignInResponseDto(user.getNickname(), user.getProfile_url(), user_status, true, authority.toString()); + signInResponseDto = new SignInResponseDto(user.getNickname(), user.getProfile_url(),status, true, authority.toString()); } else { - signInResponseDto = new SignInResponseDto(null,null,true,false, null); + signInResponseDto = new SignInResponseDto(null,null,정상,false, null); } return signInResponseDto; diff --git a/backend/src/main/java/moviegoods/movie/service/SignUpService.java b/backend/src/main/java/moviegoods/movie/service/SignUpService.java index fd2766b..33c111a 100644 --- a/backend/src/main/java/moviegoods/movie/service/SignUpService.java +++ b/backend/src/main/java/moviegoods/movie/service/SignUpService.java @@ -1,18 +1,15 @@ package moviegoods.movie.service; import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto; import moviegoods.movie.domain.dto.signup.SignUpDuplicateCheckRequestDto; import moviegoods.movie.domain.dto.signup.SignUpRequestDto; -import moviegoods.movie.domain.entity.User.Authority; -import moviegoods.movie.domain.entity.User.Method; -import moviegoods.movie.domain.entity.User.User; -import moviegoods.movie.domain.entity.User.UserRepository; +import moviegoods.movie.domain.entity.User.*; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import static moviegoods.movie.domain.entity.User.Method.*; +import static moviegoods.movie.domain.entity.User.UserStatus.정상; @Service @@ -23,7 +20,7 @@ public class SignUpService { private final PasswordEncoder passwordEncoder; private static String basicUrl = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlx2rvqRVwn6S5uXPkHl856CcYvV2z8bUMyw&usqp=CAU"; private static Long basicReliability = 0L; - private static Byte basicStatus = 1; + private static UserStatus basicStatus = 정상; public ResultResponseDto saveUser(SignUpRequestDto requestDto, Method method) { String email = requestDto.getEmail(); @@ -34,15 +31,15 @@ public ResultResponseDto saveUser(SignUpRequestDto requestDto, Method method) { User saveEntity = new User(); if (method==일반) { - saveEntity = User.builder().authority(Authority.일반).email(email).status(basicStatus).reliability(basicReliability). + saveEntity = User.builder().authority(Authority.일반).email(email).user_status(basicStatus).reliability(basicReliability). nickname(nickname).password(encodedPassword).profile_url(basicUrl).method(일반).build(); } if (method==카카오) { - saveEntity = User.builder().authority(Authority.일반).email(email).status(basicStatus).reliability(basicReliability). + saveEntity = User.builder().authority(Authority.일반).email(email).user_status(basicStatus).reliability(basicReliability). nickname(nickname).password(encodedPassword).profile_url(basicUrl).method(카카오).build(); } if (method==구글) { - saveEntity = User.builder().authority(Authority.일반).email(email).status(basicStatus).reliability(basicReliability). + saveEntity = User.builder().authority(Authority.일반).email(email).user_status(basicStatus).reliability(basicReliability). nickname(nickname).password(encodedPassword).profile_url(basicUrl).method(구글).build(); } @@ -52,6 +49,7 @@ public ResultResponseDto saveUser(SignUpRequestDto requestDto, Method method) { return resultResponseDto; } + public ResultResponseDto duplicateCheck(SignUpDuplicateCheckRequestDto requestDto,Method method) { ResultResponseDto resultResponseDto = new ResultResponseDto(); String email = requestDto.getEmail(); @@ -59,7 +57,7 @@ public ResultResponseDto duplicateCheck(SignUpDuplicateCheckRequestDto requestDt User user = new User(); if (email != null) { - user = (User) userRepository.findByEmailAndMethod(email,method.toString()).orElse(null); + user = (User) userRepository.findByEmailAndMethod(email,method).orElse(null); } if (nickname != null) { user = userRepository.findByNickname(nickname).orElse(null); diff --git a/backend/src/main/java/moviegoods/movie/service/TransactionsService.java b/backend/src/main/java/moviegoods/movie/service/TransactionsService.java index 22b5f76..d6241e0 100644 --- a/backend/src/main/java/moviegoods/movie/service/TransactionsService.java +++ b/backend/src/main/java/moviegoods/movie/service/TransactionsService.java @@ -13,6 +13,7 @@ import moviegoods.movie.domain.entity.Transaction.Transaction; import moviegoods.movie.domain.entity.Transaction.TransactionRepository; import moviegoods.movie.domain.entity.User.User; +import moviegoods.movie.domain.entity.User.UserStatus; import moviegoods.movie.domain.entity.User.UserRepository; import moviegoods.movie.domain.dto.transactions.*; import org.springframework.stereotype.Service; @@ -73,7 +74,6 @@ public List search(User loginUser, TransactionsSe Boolean is_proceed = requestDto.getIs_proceed(); // 모집중(1) , 전체(0) String search_word = requestDto.getSearch_word(); // 검색어 - String sort_criteria = requestDto.getSort_criteria(); // 최신순 String search_criteria = requestDto.getSearch_criteria(); // 작성자/글내용 Long start = requestDto.getStart(); Long end = requestDto.getEnd(); @@ -118,7 +118,7 @@ public List search(User loginUser, TransactionsSe Long reliability = transaction.getUser().getReliability(); String content = transaction.getContent_detail().getContent(); String status2 = String.valueOf(transaction.getStatus()); - Byte user_status = transaction.getUser().getStatus(); + UserStatus user_status = transaction.getUser().getUser_status(); Long transaction_id = transaction.getTransaction_id(); LocalDateTime written_date = transaction.getContent_detail().getWritten_date(); String nickname = transaction.getUser().getNickname(); diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 3ac4c15..2c0462d 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -8,6 +8,5 @@ spring.jpa.properties.hibernate.format_sql=true spring.jpa.properties.hibernate.show-sql=true #show parameter binding logging.level.org.hibernate.type.descriptor.sql=DEBUG -session.setMaxInactiveInterval(1800); logging.level.org.hibernate.SQL=DEBUG server.servlet.session.tracking-modes=cookie \ No newline at end of file