+## μ£Όμ κΈ°λ₯ μκ° π
-(1) μ₯μ κ²μ
+| μ₯μ κ²μ | μμ½(μ¨μ΄ν
) μμ€ν
|
+|:------:|:------:|
+|  |  |
+|- μ₯μ κ²μ
- μΉ΄ν
κ³ λ¦¬ νν° κ²μ
- λνΉ μ‘°ν
|- μ€ν μ΄ μ¨μ΄ν
μ μ²
- μ€ν μ΄ νν© μ‘°ν
- μ¬μ©μ μ ν¨μ±(λ©μΌ) μΈμ¦ λ° λ©μΌ νΈμΆ|
-- μ₯μ κ²μ κΈ°λ₯
-- μΉ΄ν
κ³ λ¦¬ νν° κ²μ κΈ°λ₯
-- κ²μμ΄ μ§μ κ²μ (κ°κ² μ΄λ¦ / λλ‘λͺ
μ£Όμ / μ
μ’
)
-- λνΉ μ‘°ν(νμ 4μ μ΄μ / νμ λμ μ / 리뷰 1000κ° μ΄μ / 리뷰 λμ μ)
-- Elastic Search + Nori ννμ λΆμκΈ°λ₯Ό μ΄μ©ν λΉ λ₯΄κ³ μ νν κ²μ κΈ°λ₯ μ 곡
+
+| μ₯μ 리뷰 κΈ°λ₯ | κ΄λ¦¬μνμ΄μ§ |
+|:------:|:------:|
+|  ||
+|- μ₯μ 리뷰 μμ± λ° μ‘°ν κΈ°λ₯
- 리뷰 λ±λ‘ μ μ€ν μ΄ μ 보 κ°±μ (λ³μ , 리뷰 κ°―μ)
|- μ¨μ΄ν
νν© νμΈ
- μ¨μ΄ν
νΈμΆ(μ΄λ©μΌ)
|
+
+#
+## μμ°μμ π₯
+[μμ°μμ λ°λ‘κ°κΈ°](https://www.youtube.com/watch?v=HmiIVvJn6I8&t=21s)
+
+#
+## μλΉμ€ μν€ν
μ² π¨
+
+
+#
+## ERD π¨π»βπ»
+
+ νΌμ³λ³΄κΈ°
+
+
+
+
+
+
-(2) μμ½(μ¨μ΄ν
) μμ€ν
+#
+## API π¬
+[Swagger API λ°λ‘κ°κΈ°](https://pintable.co.kr/swagger-ui/index.html?urls.primaryName=store#/store-controller/createStoreUsingPOST)
-- μ€ν μ΄ μ¨μ΄ν
μ μ² κΈ°λ₯
-- μ€ν μ΄ νν© μ‘°ν κΈ°λ₯
-- μ¬μ©μ μ ν¨μ±(λ©μΌ) μΈμ¦ λ° λ©μΌ νΈμΆ κΈ°λ₯
+#
+## νΈλ¬λΈμν
π
-(3) μ₯μ 리뷰 κΈ°λ₯
+
+ λ°μ΄ν° μμ§
+
+
+ (1) 곡곡 APIλ₯Ό μ΄μ©ν λμ©λ μ₯μ λ°μ΄ν° μμ§
+ - 곡곡 λ°μ΄ν° ν¬νΈμμ μ 곡νλ μ κ΅ μμμ /μΉ΄νμ νμΌ λ°μ΄ν° μμ§ (μ½ 650λ§κ±΄)
-- μ₯μ 리뷰 μμ± λ° μ‘°ν κΈ°λ₯
-- 리뷰 λ±λ‘ μ μ€ν μ΄ μ 보 κ°±μ (λ³μ , 리뷰 κ°―μ) κΈ°λ₯
+
+(2) μ₯μ λ°μ΄ν° 1μ°¨ κ°κ³΅
+ - 곡곡 λ°μ΄ν° ν¬νΈμμ μμ§ν λ°μ΄ν° μ€ λΆνμ μ»¬λΌ λ° νμ
μ₯μ λ°μ΄ν° μ κ±° (μ½ 200λ§κ±΄)
+
+(3) λ€μ΄λ² νλ μ΄μ€ μΉ ν¬λ‘€λ§μ ν΅ν μΆκ° λ°μ΄ν° μμ§
+ - μΉν¬λ‘€λ§(Python + μ
λ λμ)μ μ΄μ©νμ¬ λ¦¬λ·° κ°―μ/ λΈλ‘κ·Έ 리뷰 / λ³μ μ 보 λ± μΆκ° λ°μ΄ν° μμ§
+ - λ€μ΄λ² νλ μ΄μ€ ν¬λ‘€λ§ μ νΉμ νμ μ΄μ λ°λ³΅ μλμ μ°¨λ¨λλ κ²½μ°κ° λ°μνμκ³ , μλ κ³Όμ μ ν΅ν΄ ν΄κ²°
+ π https://www.notion.so/404-Not-Found-9ec37cc4600545e7972663f4d9d06364
+
+(4) Faker λΌμ΄λΈλ¬λ¦¬λ₯Ό μ΄μ©ν 리뷰/μ¬μ©μ λ°μ΄ν° μμ±
+ - Faker λΌμ΄λΈλ¬λ¦¬λ₯Ό μ΄μ©νμ¬ μ½ 600λ§κ±΄μ 리뷰/μ¬μ©μ λ°μ΄ν° μμ±
+
-## 4. μμ°μμ π₯
-[μμ°μμ λ°λ‘κ°κΈ°](https://www.youtube.com/watch?v=iY3YxFOawYs)
+
+ κ²μ μ±λ₯ ν₯μ
+
+ π κ²μ μ±λ₯ κ°μ μμΈν 보기 : https://www.notion.so/PIN-TABLE-98c3a7dbb1324630a3a300575b2f7782
+ γ΄( π₯Ή μ΄μ¬ννλλ° λ΄μ£Όμ€κΊΌμ£ ? π₯Ή)
-## 5. μλΉμ€ μν€ν
μ² π¨
-
+
+
-## 6. ERD π¨π»βπ»
-
## 7. API π¬
[APIλͺ
μΈμ λ°λ‘κ°κΈ° Swagger](https://pintable.co.kr/swagger-ui/index.html?urls.primaryName=store#/store-controller/createStoreUsingPOST)
-## 8. νΈλ¬λΈμν
π
+
+ λμμ± μ μ΄
+
+ π§² λμμ± μ μ΄ μμΈν 보기 : https://www.notion.so/PIN-TABLE-721fb45b91454dda8255e0de4ac757ca
+)
+
+
diff --git a/src/main/java/com/example/pirate99_final/global/MsgResponseDto.java b/src/main/java/com/example/pirate99_final/global/MsgResponseDto.java
index 37e9842..b9205ea 100644
--- a/src/main/java/com/example/pirate99_final/global/MsgResponseDto.java
+++ b/src/main/java/com/example/pirate99_final/global/MsgResponseDto.java
@@ -11,8 +11,8 @@
@Getter
@NoArgsConstructor
public class MsgResponseDto {
- private int statusCode;
- private String msg;
+ protected int statusCode;
+ protected String msg;
public MsgResponseDto(SuccessCode successCode) {
this.msg = successCode.getMessage();
@@ -23,15 +23,6 @@ public MsgResponseDto(int statusCode, String msg) {
this.msg = msg;
this.statusCode = statusCode;
}
-
- public MsgResponseDto(CustomException customException) {
- this.msg = customException.getMsg();
- this.statusCode = customException.getStatusCode();
- }
- public MsgResponseDto(MethodArgumentNotValidException ex) {
- this.msg = ex.getBindingResult().getAllErrors().get(0).getDefaultMessage();
- this.statusCode = HttpStatus.BAD_REQUEST.value();
- }
public MsgResponseDto(ErrorCode errorCode) {
this.msg = errorCode.getMessage();
this.statusCode = errorCode.getHttpStatus().value();
diff --git a/src/main/java/com/example/pirate99_final/global/exception/CustomException.java b/src/main/java/com/example/pirate99_final/global/exception/CustomException.java
index aa75ae4..0ecafd4 100644
--- a/src/main/java/com/example/pirate99_final/global/exception/CustomException.java
+++ b/src/main/java/com/example/pirate99_final/global/exception/CustomException.java
@@ -1,6 +1,8 @@
package com.example.pirate99_final.global.exception;
import lombok.Getter;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.MethodArgumentNotValidException;
@Getter
public class CustomException extends RuntimeException{
@@ -19,5 +21,13 @@ public CustomException(int statusCode, String msg) {
this.msg = msg; // μλ΄ λ¬Έκ΅¬
this.statusCode = statusCode; // μν μ½λ
}
+ public CustomException(int statusCode, ErrorCode errorCode) {
+ this.msg = msg; // μλ΄ λ¬Έκ΅¬
+ this.statusCode = statusCode; // μν μ½λ
+ }
+ public CustomException(MethodArgumentNotValidException ex) {
+ this.msg = ex.getBindingResult().getAllErrors().get(0).getDefaultMessage();
+ this.statusCode = HttpStatus.BAD_REQUEST.value();
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/example/pirate99_final/global/exception/ErrorCode.java b/src/main/java/com/example/pirate99_final/global/exception/ErrorCode.java
index 9bcf8e0..8081236 100644
--- a/src/main/java/com/example/pirate99_final/global/exception/ErrorCode.java
+++ b/src/main/java/com/example/pirate99_final/global/exception/ErrorCode.java
@@ -8,31 +8,21 @@
@RequiredArgsConstructor
public enum ErrorCode {
- LOGIN_ERROR(HttpStatus.BAD_REQUEST, "λ‘κ·ΈμΈμ μ€ν¨νμ΅λλ€."),
- SIGN_UP_ERROR(HttpStatus.BAD_REQUEST, "νμκ°μ
μ μ€ν¨νμ΅λλ€."),
NOT_FOUND_ID_ERROR(HttpStatus.OK, "ν΄λΉνλ IDκ° μμ΅λλ€."),
NOT_FOUND_USER_ERROR(HttpStatus.OK, "ν΄λΉνλ μ¬μ©μλ₯Ό μ°Ύμ μ μμ΅λλ€."),
DUPLICATE_USER_ERROR(HttpStatus.OK, "μ΄λ―Έ μ‘΄μ¬νλ νμμ
λλ€."),
- WAITING_POST_ERROR(HttpStatus.BAD_REQUEST, "λκΈ°μ λͺ
λ¨ λ±λ‘μ μ€ν¨νμ΅λλ€."),
WRONG_PASSWORD_ERROR(HttpStatus.OK, "μλͺ»λ λΉλ°λ²νΈμ
λλ€."),
- WAITING_DELETE_ERROR(HttpStatus.BAD_REQUEST, "λκΈ°μ λͺ
λ¨ μμ μ μ€ν¨νμ΅λλ€."), // error code λμ status code 200κ³Ό error message λ₯Ό ν¨κ» 보λΈλ€.
-
-
- NOT_ENOUGH_TABLE(HttpStatus.OK, "λΉ μλ¦¬κ° μμ΅λλ€. μμ½ λ±λ‘ λΆνλ립λλ€."),
- WRONG_LIMIT_WAITING_ERROR(HttpStatus.OK, "μΈμ μ ν μ€μ κ°μ νμ¬ λκΈ°μ μΈμλ³΄λ€ μ μ μ μμ΅λλ€."),
-
- STORE_POST_ERROR(HttpStatus.BAD_REQUEST, "μ ν¬ λ±λ‘μ μ€ν¨νμ΅λλ€."),
- STORE_DELETE_ERROR(HttpStatus.BAD_REQUEST, "μ ν¬ μμ μ μ€ν¨νμ΅λλ€."),
- NOT_FOUND_STORE_STATUS_ERROR(HttpStatus.BAD_REQUEST, "ν΄λΉνλ μνΈ μνκ° μμ΅λλ€."),
NOT_FOUND_STORE_ERROR(HttpStatus.OK, "ν΄λΉνλ μνΈλͺ
μ΄ μμ΅λλ€."),
- REVIEW_POST_ERROR(HttpStatus.BAD_REQUEST, "리뷰 λ±λ‘μ μ€ν¨νμ΅λλ€."),
- REVIEW_DELETE_ERROR(HttpStatus.OK, "리뷰 μμ μ μ€ν¨νμ΅λλ€."),
NOT_FOUND_REVIEW_ERROR(HttpStatus.OK, "ν΄λΉνλ λ¦¬λ·°κ° μμ΅λλ€."),
ALREADY_IN_QUEUE(HttpStatus.OK, "μ΄λ―Έ λκΈ°μ΄μ μ‘΄μ¬ν©λλ€."),
+
+ ALREADY_LEAVING(HttpStatus.OK, "μ΄λ―Έ ν΄μ₯ν μλμ
λλ€."),
+
+ ALREADY_EATING(HttpStatus.OK, "μ΄λ―Έ μμ¬ μ€μΈ μλμ
λλ€."),
LIMIT_QUEUE_EXCEEDED(HttpStatus.OK, "μ ν λκΈ°μ΄ μ΄κ³Ό");
diff --git a/src/main/java/com/example/pirate99_final/review/controller/ReviewController.java b/src/main/java/com/example/pirate99_final/review/controller/ReviewController.java
index 0f871b8..65c7368 100644
--- a/src/main/java/com/example/pirate99_final/review/controller/ReviewController.java
+++ b/src/main/java/com/example/pirate99_final/review/controller/ReviewController.java
@@ -28,7 +28,7 @@ public MsgResponseDto createReview(@PathVariable Long storeId, @RequestBody Revi
// DB select one
@GetMapping("/review/{storeId}/{reviewId}")
- public ReviewResponseDto getReview(@PathVariable Long storeId, @PathVariable Long reviewId){return reviewService.getReview(storeId, reviewId);}
+ public MsgResponseDto getReview(@PathVariable Long storeId, @PathVariable Long reviewId){return reviewService.getReview(storeId, reviewId);}
// DB delete
@DeleteMapping("/review/{storeId}/{reviewId}")
diff --git a/src/main/java/com/example/pirate99_final/review/dto/ReviewResponseDto.java b/src/main/java/com/example/pirate99_final/review/dto/ReviewResponseDto.java
index 50002f0..5c98f9a 100644
--- a/src/main/java/com/example/pirate99_final/review/dto/ReviewResponseDto.java
+++ b/src/main/java/com/example/pirate99_final/review/dto/ReviewResponseDto.java
@@ -1,10 +1,11 @@
package com.example.pirate99_final.review.dto;
+import com.example.pirate99_final.global.MsgResponseDto;
import com.example.pirate99_final.review.entity.Review;
import lombok.Getter;
@Getter
-public class ReviewResponseDto {
+public class ReviewResponseDto extends MsgResponseDto {
private Long reviewId;
private String username;
private String content;
diff --git a/src/main/java/com/example/pirate99_final/review/service/ReviewService.java b/src/main/java/com/example/pirate99_final/review/service/ReviewService.java
index e69a9e5..35b8656 100644
--- a/src/main/java/com/example/pirate99_final/review/service/ReviewService.java
+++ b/src/main/java/com/example/pirate99_final/review/service/ReviewService.java
@@ -34,78 +34,77 @@ public class ReviewService {
// Review Insert (Insert to Redis)
public MsgResponseDto createReview(long id, ReviewRequestDto requestDto) {
- SetOperations
setOperations = redisTemplate.opsForSet();
- Store store = storeRepository.findById(id).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
+ try {
+ SetOperations setOperations = redisTemplate.opsForSet();
- User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
- );
+ Store store = storeRepository.findById(id).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
- Review review = new Review(requestDto, store, user);
- reviewRepository.save(review);
+ User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
+ );
- RedisRequestDto saveId = new RedisRequestDto(store.getStoreId());
- setOperations.add("reviewIdx", saveId);
+ Review review = new Review(requestDto, store, user);
+ reviewRepository.save(review);
- return new MsgResponseDto(CREATE_REVIEW);
+ RedisRequestDto saveId = new RedisRequestDto(store.getStoreId());
+ setOperations.add("reviewIdx", saveId);
+
+ return new MsgResponseDto(CREATE_REVIEW);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
// Get memos from DB (all)
public List getReviews(long id) {
- Store store = storeRepository.findById(id).orElseThrow(()
- -> new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- // 1. Select All Memo
- List ListReview = reviewRepository.findTop10ByStoreOrderByIdDesc(store);
- List ListResponseDto = new ArrayList<>();
+ Store store = storeRepository.findById(id).orElseThrow(()
+ -> new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
- for (Review review : ListReview) {
- ListResponseDto.add(new ReviewResponseDto(review));
- }
- return ListResponseDto;
- }
+ // 1. Select All Memo
+ List ListReview = reviewRepository.findTop10ByStoreOrderByIdDesc(store);
- // Get store from DB (one)
- public ReviewResponseDto getReview(long storeId, long reviewId) {
- Review review = reviewRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_REVIEW_ERROR)
- );
+ List ListResponseDto = new ArrayList<>();
- ReviewResponseDto responseDto = new ReviewResponseDto(review);
- return responseDto;
+ for (Review review : ListReview) {
+ ListResponseDto.add(new ReviewResponseDto(review));
+ }
+ return ListResponseDto;
}
- // DB update function
- @Transactional
- public ReviewResponseDto update(Long storeId, Long reviewid, ReviewRequestDto requestDto) {
-
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
+ // Get store from DB (one)
+ public MsgResponseDto getReview(long storeId, long reviewId) {
- Review review = reviewRepository.findByStoreAndId(store, reviewid).orElseThrow( // find memo
- () -> new CustomException(ErrorCode.NOT_FOUND_REVIEW_ERROR)
- );
+ try {
+ Review review = reviewRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_REVIEW_ERROR)
+ );
- review.update(requestDto);
- return new ReviewResponseDto(review);
+ ReviewResponseDto responseDto = new ReviewResponseDto(review);
+ return responseDto;
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
// DB delete function (data delete)
public MsgResponseDto deleteReview(Long storeId, Long reviewid) {
- Review review = reviewRepository.findById(storeId).orElseThrow( // find memo
- () -> new CustomException(ErrorCode.NOT_FOUND_ID_ERROR)
- );
- reviewRepository.deleteById(storeId); // ν΄λΉ κ²μλ¬Ό μμ
+ try {
+ Review review = reviewRepository.findById(storeId).orElseThrow( // find memo
+ () -> new CustomException(ErrorCode.NOT_FOUND_ID_ERROR)
+ );
+ reviewRepository.deleteById(storeId); // ν΄λΉ κ²μλ¬Ό μμ
- return new MsgResponseDto(DELETE_REVIEW);
+ return new MsgResponseDto(DELETE_REVIEW);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
}
diff --git a/src/main/java/com/example/pirate99_final/store/controller/StoreController.java b/src/main/java/com/example/pirate99_final/store/controller/StoreController.java
index f81762b..6c5baf3 100644
--- a/src/main/java/com/example/pirate99_final/store/controller/StoreController.java
+++ b/src/main/java/com/example/pirate99_final/store/controller/StoreController.java
@@ -27,7 +27,7 @@ public MsgResponseDto createStore(@RequestBody StoreRequestDto requestDto){
// DB select one
@GetMapping("/storeStatus/{storeId}")
- public StoreStatusResponseDto getStore(@PathVariable long storeId){return storeService.getStore(storeId);}
+ public MsgResponseDto getStore(@PathVariable long storeId){return storeService.getStore(storeId);}
// DB delete
@DeleteMapping("/storeStatus/{storeId}")
@@ -42,8 +42,8 @@ public MsgResponseDto enterStore(@PathVariable Long storeId){
@PutMapping("/storeStatus/leave/{storeId}")
- public MsgResponseDto leaveStore(@PathVariable Long storeId){
- return storeService.leaveStore(storeId);
+ public MsgResponseDto leaveStore(@PathVariable Long storeId, @RequestBody LeaveRequestDto requestDto){
+ return storeService.leaveStore(storeId, requestDto);
}
@PutMapping("/storeStatus/call/{storeId}")
@@ -62,7 +62,7 @@ public MsgResponseDto limitWaitingCnt(@PathVariable Long storeId, @RequestBody L
}
@GetMapping("/storeAdmin/{storeId}")
- public StoreResponseDto getStoreAdminInfo(@PathVariable Long storeId) {
+ public MsgResponseDto getStoreAdminInfo(@PathVariable Long storeId) {
return storeService.getStoreAdminInfo(storeId);
}
}
diff --git a/src/main/java/com/example/pirate99_final/store/dto/LeaveRequestDto.java b/src/main/java/com/example/pirate99_final/store/dto/LeaveRequestDto.java
new file mode 100644
index 0000000..8229d68
--- /dev/null
+++ b/src/main/java/com/example/pirate99_final/store/dto/LeaveRequestDto.java
@@ -0,0 +1,11 @@
+package com.example.pirate99_final.store.dto;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@Getter
+@NoArgsConstructor
+public class LeaveRequestDto {
+
+ private String username;
+}
diff --git a/src/main/java/com/example/pirate99_final/store/dto/StoreResponseDto.java b/src/main/java/com/example/pirate99_final/store/dto/StoreResponseDto.java
index a9d51d3..78d6625 100644
--- a/src/main/java/com/example/pirate99_final/store/dto/StoreResponseDto.java
+++ b/src/main/java/com/example/pirate99_final/store/dto/StoreResponseDto.java
@@ -1,10 +1,11 @@
package com.example.pirate99_final.store.dto;
+import com.example.pirate99_final.global.MsgResponseDto;
import com.example.pirate99_final.store.entity.Store;
import lombok.Getter;
@Getter
-public class StoreResponseDto {
+public class StoreResponseDto extends MsgResponseDto {
private String storeName;
diff --git a/src/main/java/com/example/pirate99_final/store/dto/StoreStatusResponseDto.java b/src/main/java/com/example/pirate99_final/store/dto/StoreStatusResponseDto.java
index 75f41e1..4236c87 100644
--- a/src/main/java/com/example/pirate99_final/store/dto/StoreStatusResponseDto.java
+++ b/src/main/java/com/example/pirate99_final/store/dto/StoreStatusResponseDto.java
@@ -1,10 +1,11 @@
package com.example.pirate99_final.store.dto;
+import com.example.pirate99_final.global.MsgResponseDto;
import com.example.pirate99_final.store.entity.StoreStatus;
import lombok.Getter;
@Getter
-public class StoreStatusResponseDto {
+public class StoreStatusResponseDto extends MsgResponseDto {
private Long storeStatusId; // storeStatusId
private int totalTableCnt; // μ΄ ν
μ΄λΈ μ
private int availableTableCnt; // νμ¬ μ¬μ© μ€μΈ ν
μ΄λΈ μ
diff --git a/src/main/java/com/example/pirate99_final/store/entity/StoreStatus.java b/src/main/java/com/example/pirate99_final/store/entity/StoreStatus.java
index 9c3c9c8..4b664ab 100644
--- a/src/main/java/com/example/pirate99_final/store/entity/StoreStatus.java
+++ b/src/main/java/com/example/pirate99_final/store/entity/StoreStatus.java
@@ -54,4 +54,5 @@ public void update_waitingCnt(int waitingCnt, int availableTableCnt){
public void update_limitWaitingCnt(int limitWaitingCnt) {
this.limitWaitingCnt = limitWaitingCnt;
}
-}
\ No newline at end of file
+
+ }
\ No newline at end of file
diff --git a/src/main/java/com/example/pirate99_final/store/service/StoreService.java b/src/main/java/com/example/pirate99_final/store/service/StoreService.java
index cadb07a..2d79e14 100644
--- a/src/main/java/com/example/pirate99_final/store/service/StoreService.java
+++ b/src/main/java/com/example/pirate99_final/store/service/StoreService.java
@@ -78,177 +78,178 @@ public List getStores() {
}
// Get store from DB (one)
- public StoreStatusResponseDto getStore(long storeId) {
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
+ public MsgResponseDto getStore(long storeId) {
+ try {
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
- StoreStatusResponseDto responseDto = new StoreStatusResponseDto(storeStatus);
+ StoreStatusResponseDto responseDto = new StoreStatusResponseDto(storeStatus);
+
+ return responseDto;
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
- return responseDto;
}
// DB delete function (data delete)
public MsgResponseDto deleteStore(Long storeId) {
+ try {
+ Store store = storeRepository.findById(storeId).orElseThrow( // find store
+ () -> new CustomException(ErrorCode.NOT_FOUND_ID_ERROR)
+ );
- Store store = storeRepository.findById(storeId).orElseThrow( // find store
- () -> new CustomException(ErrorCode.NOT_FOUND_ID_ERROR)
- );
+ storeStatusRepository.deleteByStore(store); // μμ μν ν
μ΄λΈ μμ
+ storeRepository.deleteById(storeId); // ν΄λΉ μμ μμ
- storeStatusRepository.deleteByStore(store); // μμ μν ν
μ΄λΈ μμ
- storeRepository.deleteById(storeId); // ν΄λΉ μμ μμ
+ return new MsgResponseDto(DELETE_STORE);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
- return new MsgResponseDto(DELETE_STORE);
}
public MsgResponseDto enterStore(Long storeId) { // need to update
int availableCnt = 0; // μ΄μ© κ°λ₯ μ’μ
+ try {
+ // 1. find store
+ Store store = storeRepository.findById(storeId).orElseThrow(()->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
- // 1. find store
- Store store = storeRepository.findById(storeId).orElseThrow(()->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- // 2. storeStatus check
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+ // 2. storeStatus check
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
- // 3. counting availableCnt
- if((storeStatus.getAvailableTableCnt() - 1) > 0){
- availableCnt = storeStatus.getAvailableTableCnt() - 1;
- }
- else if(storeStatus.getAvailableTableCnt() == 0){
- return new MsgResponseDto(SuccessCode.NOT_ENOUGH_TABLE); // ν΄λΉ λΆλΆ μμ νμ
- }
+ // 3. counting availableCnt
+ if((storeStatus.getAvailableTableCnt() - 1) > 0){
+ availableCnt = storeStatus.getAvailableTableCnt() - 1;
+ }
+ else if(storeStatus.getAvailableTableCnt() == 0){
+ return new MsgResponseDto(SuccessCode.NOT_ENOUGH_TABLE); // ν΄λΉ λΆλΆ μμ νμ
+ }
- // 4. update storeStatus
- storeStatus.update(availableCnt);
- storeStatusRepository.save(storeStatus);
+ // 4. update storeStatus
+ storeStatus.update(availableCnt);
+ storeStatusRepository.save(storeStatus);
- return new MsgResponseDto(SuccessCode.CONFIRM_ENTER);
+ return new MsgResponseDto(SuccessCode.CONFIRM_ENTER);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
// Leave people from store
@Transactional
- public MsgResponseDto leaveStore(Long storeId) {
+ public MsgResponseDto leaveStore(Long storeId, LeaveRequestDto requestDto) {
int availableCnt = 0; // μ΄μ© κ°λ₯ μ’μ
-
- // 1. find store
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- // 2. storeStatus check
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
-
- availableCnt = storeStatus.getAvailableTableCnt() + 1;
-
- // Leaving people check
- storeStatus.update(availableCnt);
-
- Waiting waiting = waitingRepository.findFirstByStoreStatusAndWaitingStatusOrderByWaitingIdAsc(storeStatus, 0);
-
- if(waiting != null){
+ try {
// 1. find store
- store = storeRepository.findById(storeId).orElseThrow(() ->
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
);
// 2. storeStatus check
- storeStatus = storeStatusRepository.findByStore(store);
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
// 3. User find
- User user = userRepository.findByUsername(waiting.getUser().getUsername()).orElseThrow(() ->
+ User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
);
+ Waiting waiting = waitingRepository.findByStoreStatusAndUser(storeStatus, user);
- Waiting waiting2 = waitingRepository.findByStoreStatusAndUser(storeStatus, user);
- waiting.update(2);
-
- int waitingCnt = 0;
+ if (waiting.getWaitingStatus() == 2) {
+ waiting.update(4);
- if(storeStatus.getWaitingCnt() > 0){
- waitingCnt = storeStatus.getWaitingCnt() - 1;
+ availableCnt = storeStatus.getAvailableTableCnt() + 1;
+ storeStatus.update(availableCnt);
+ } else {
+ return new MsgResponseDto(ErrorCode.ALREADY_LEAVING);
}
- availableCnt = storeStatus.getAvailableTableCnt();
-
- if (availableCnt > 0) {
- availableCnt = availableCnt - 1;
- }
-
- storeStatus.update_waitingCnt(waitingCnt, availableCnt);
+ return new MsgResponseDto(SuccessCode.CONFIRM_LEAVE);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
- return new MsgResponseDto(SuccessCode.CONFIRM_LEAVE);
}
@Transactional
public MsgResponseDto confirmStore(Long storeId, ConfirmRequestDto requestDto) {
- // 1. find store
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
+ try {
+ // 1. find store
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
+
+ // 2. storeStatus check
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+
+ // 3. User find
+ User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
+ );
- // 2. storeStatus check
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+ Waiting waiting = waitingRepository.findByStoreStatusAndUser(storeStatus, user);
- // 3. User find
- User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
- );
+ if (requestDto.getWaitingStatus() == 1) {
+ waiting.update(2);
+ int waitingCnt = storeStatus.getWaitingCnt() - 1;
+ int availableCnt = storeStatus.getAvailableTableCnt();
- Waiting waiting = waitingRepository.findByStoreStatusAndUser(storeStatus, user);
+ if (availableCnt > 0) {
+ availableCnt = availableCnt - 1;
+ }
- if (requestDto.getWaitingStatus() == 1) {
- waiting.update(2);
- int waitingCnt = storeStatus.getWaitingCnt() - 1;
- int availableCnt = storeStatus.getAvailableTableCnt();
+ storeStatus.update_waitingCnt(waitingCnt, availableCnt);
+ } else if (requestDto.getWaitingStatus() == 3) {
+ waiting.update(3);
+ int waitingCnt = storeStatus.getWaitingCnt() - 1;
+ int availableCnt = storeStatus.getAvailableTableCnt();
- if (availableCnt > 0) {
- availableCnt = availableCnt - 1;
+ storeStatus.update_waitingCnt(waitingCnt, availableCnt);
}
- storeStatus.update_waitingCnt(waitingCnt, availableCnt);
- } else if (requestDto.getWaitingStatus() == 3) {
- waiting.update(3);
- int waitingCnt = storeStatus.getWaitingCnt() - 1;
- int availableCnt = storeStatus.getAvailableTableCnt();
-
- storeStatus.update_waitingCnt(waitingCnt, availableCnt);
+ return new MsgResponseDto(SuccessCode.CONFIRM_ENTER);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
- return new MsgResponseDto(SuccessCode.CONFIRM_ENTER);
}
// call people
@Transactional
public MsgResponseDto callpeople(Long storeId, ConfirmRequestDto requestDto) throws MessagingException {
- // 1. find store
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- // 2. storeStatus check
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
-
- // 3. User find
- User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
- );
-
- Waiting waiting = waitingRepository.findByStoreStatusAndUser(storeStatus, user);
- waiting.update(1);
-
- String toEmail = user.getAddress();
- String storeName = store.getStoreName();
- String title = "Pin Table μ
μ₯μλ΄ [" + storeName + "] λκΈ° νΈμΆ";
- String mailForm = "mailForm_call";
-
- MimeMessage emailForm = createEmailForm(toEmail, title, mailForm);
- emailSender.send(emailForm);
- return new MsgResponseDto(SuccessCode.CALL_PEOPLE);
+ try {
+ // 1. find store
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
+
+ // 2. storeStatus check
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+
+ // 3. User find
+ User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
+ );
+
+ Waiting waiting = waitingRepository.queueing(storeStatus.getStoreStatusId(), user.getUserId());
+ waiting.update(1);
+
+ String toEmail = user.getAddress();
+ String storeName = store.getStoreName();
+ String title = "Pin Table μ
μ₯μλ΄ [" + storeName + "] λκΈ° νΈμΆ";
+ String mailForm = "mailForm_call";
+
+ MimeMessage emailForm = createEmailForm(toEmail, title, mailForm);
+ emailSender.send(emailForm);
+ return new MsgResponseDto(SuccessCode.CALL_PEOPLE);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
private MimeMessage createEmailForm(String sendmail, String mailTitle, String mailForm) throws MessagingException {
@@ -275,62 +276,61 @@ private String setContext(String mailform) {
@Transactional
public MsgResponseDto limitWaitingCnt(Long storeId, LimitWaitingCntRequestDto requestDto) throws MessagingException {
- int totalWaitingCnt, limitWaitingCnt = 0;
-
-
- // 1. find store
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- // 2. storeStatus check
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
-
- // λκΈ°μ΄ μ€ μνκ°μ΄ 'λκΈ°μ€', 'μ
μ₯κ°λ₯'μΈ μ¬λλ€λ§ μΉ΄μ΄ν
νκΈ°μν΄ κ΅¬λ³ν΄μ 리μ€νΈμ λ΄μ
- List waitingList = waitingRepository.
- findAllByStoreStatusAndWaitingStatusOrWaitingStatusOrderByWaitingIdAsc(storeStatus, 0, 1);
-
- // μ ν¬μμ μ€μ ν λκΈ° μΈμ μ νν κ°μ μ ν¬ μνμ μ
λ°μ΄νΈ ν¨
- storeStatus.update_limitWaitingCnt(requestDto.getLimitWaitingCnt());
+ int limitWaitingCnt = 0;
+ try {
+ // 1. find store
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
+ );
- limitWaitingCnt = storeStatus.getLimitWaitingCnt();
+ // 2. storeStatus check
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+ // λκΈ°μ΄ μ€ μνκ°μ΄ 'λκΈ°μ€', 'μ
μ₯κ°λ₯'μΈ μ¬λλ€λ§ μΉ΄μ΄ν
νκΈ°μν΄ κ΅¬λ³ν΄μ 리μ€νΈμ λ΄μ
+ List waitingList = waitingRepository.
+ waitingList(0, 1, storeStatus.getStoreStatusId());
- // λκΈ°μΈμ μ νμ΄ '0'μΈ κ²½μ° 'default' κ°μΈ 무νμΌλ‘ μ€μ
- if (limitWaitingCnt == 1000) {
+ // μ ν¬μμ μ€μ ν λκΈ° μΈμ μ νν κ°μ μ ν¬ μνμ μ
λ°μ΄νΈ ν¨
+ storeStatus.update_limitWaitingCnt(requestDto.getLimitWaitingCnt());
- return new MsgResponseDto(LIMIT_DEFAULT);
- // λκΈ°μΈμ μ νμ΄ μ΄ λκΈ°μΈμ μ λ³΄λ€ ν° κ²½μ°, μ€μ μ΄ μλ£λμλ€λ λ©μΈμ§ λ°ν
- } else if (limitWaitingCnt >= storeStatus.getWaitingCnt()) {
+ limitWaitingCnt = storeStatus.getLimitWaitingCnt();
- return new MsgResponseDto(SuccessCode.LIMIT_SETTING);
- // λκΈ°μΈμ μ νμ΄ μ΄ λκΈ°μΈμ μ λ³΄λ€ μ μ κ²½μ°, μ νμ μ΄κ³Όν νμ¬ λκΈ°μΈμλ€μκ² μ΄λ©μΌμ 보λ΄κ³ λκΈ°μ·¨μ μ²λ¦¬νλ€.
- } else if (limitWaitingCnt < storeStatus.getWaitingCnt()) {
+ int waitingCnt = storeStatus.getWaitingCnt();
+ // λκΈ°μΈμ μ νμ΄ '0'μΈ κ²½μ° 'default' κ°μΈ 무νμΌλ‘ μ€μ
+ if (limitWaitingCnt == 1000) {
- for (int i = limitWaitingCnt; i < storeStatus.getWaitingCnt(); i++) {
+ return new MsgResponseDto(LIMIT_DEFAULT);
+ // λκΈ°μΈμ μ νμ΄ μ΄ λκΈ°μΈμ μ λ³΄λ€ ν° κ²½μ°, μ€μ μ΄ μλ£λμλ€λ λ©μΈμ§ λ°ν
+ } else if (limitWaitingCnt >= storeStatus.getWaitingCnt()) {
- Waiting waiting_person = waitingList.get(i);
+ return new MsgResponseDto(SuccessCode.LIMIT_SETTING);
+ // λκΈ°μΈμ μ νμ΄ μ΄ λκΈ°μΈμ μ λ³΄λ€ μ μ κ²½μ°, μ νμ μ΄κ³Όν νμ¬ λκΈ°μΈμλ€μκ² μ΄λ©μΌμ 보λ΄κ³ λκΈ°μ·¨μ μ²λ¦¬νλ€.
+ } else if (limitWaitingCnt < storeStatus.getWaitingCnt()) {
- String toEmail = waiting_person.getUser().getAddress();
- String storeName = store.getStoreName();
- String title = "Pin Table [" + storeName + "] μ¨μ΄ν
μ·¨μ μλ΄";
- String mailForm = "mailForm_cancle";
+ for (int i = limitWaitingCnt; i < storeStatus.getWaitingCnt(); i++) {
- // λκΈ°μ·¨μ μνλ‘ λ³κ²½
- waiting_person.update(3);
+ Waiting waiting_person = waitingList.get(i);
+ String toEmail = waiting_person.getUser().getAddress();
+ String storeName = store.getStoreName();
+ String title = "Pin Table [" + storeName + "] μ¨μ΄ν
μ·¨μ μλ΄";
+ String mailForm = "mailForm_cancle";
- MimeMessage emailForm = createEmailForm(toEmail, title, mailForm);
- emailSender.send(emailForm);
+ // λκΈ°μ·¨μ μνλ‘ λ³κ²½
+ waiting_person.update(3);
+ waitingCnt = waitingCnt - 1;
- return new MsgResponseDto(CONFIRM_ENTER);
+ MimeMessage emailForm = createEmailForm(toEmail, title, mailForm);
+ emailSender.send(emailForm);
+ }
+ storeStatus.update_waitingCnt(waitingCnt, storeStatus.getAvailableTableCnt());
}
-
- return new MsgResponseDto(ErrorCode.WRONG_LIMIT_WAITING_ERROR);
+ return null;
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
- return null;
}
public void searchCurrentMap(Model model, String latitude, String longitude, String storeName) {
@@ -565,19 +565,23 @@ public void elasticSearchReviewDESC(Model model, SearchCondition condition) {
}
- public StoreResponseDto getStoreAdminInfo(Long storeId) {
+ public MsgResponseDto getStoreAdminInfo(Long storeId) {
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR));
+ try {
+ Store store = storeRepository.findById(storeId).orElseThrow(() ->
+ new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR));
- StoreStatus storeStatus = storeStatusRepository.findByStore(store);
+ StoreStatus storeStatus = storeStatusRepository.findByStore(store);
- List waitingTeams = waitingRepository.findAllByStoreStatusAndWaitingStatusOrWaitingStatusOrderByWaitingIdAsc(storeStatus, 0, 1);
+ List waitingTeams = waitingRepository.waitingList(0, 1, storeStatus.getStoreStatusId());
- int numberOfTeamsWaiting = waitingTeams.size();
+ int numberOfTeamsWaiting = waitingTeams.size();
- int numberOfCustomersInUse = storeStatus.getTotalTableCnt() - storeStatus.getAvailableTableCnt();
+ int numberOfCustomersInUse = storeStatus.getTotalTableCnt() - storeStatus.getAvailableTableCnt();
- return new StoreResponseDto(store, numberOfTeamsWaiting, numberOfCustomersInUse);
+ return new StoreResponseDto(store, numberOfTeamsWaiting, numberOfCustomersInUse);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
+ }
}
}
diff --git a/src/main/java/com/example/pirate99_final/user/controller/UserController.java b/src/main/java/com/example/pirate99_final/user/controller/UserController.java
index dbdbaa6..ce37e10 100644
--- a/src/main/java/com/example/pirate99_final/user/controller/UserController.java
+++ b/src/main/java/com/example/pirate99_final/user/controller/UserController.java
@@ -22,7 +22,7 @@ public class UserController {
public MsgResponseDto signup(@RequestBody SignupRequestDto signupRequestDto) {
userService.signup(signupRequestDto);
- return new MsgResponseDto(SuccessCode.SIGN_UP);
+ return userService.signup(signupRequestDto);
}
@PostMapping("/login")
@@ -30,7 +30,7 @@ public MsgResponseDto login(@RequestBody LoginRequestDto loginRequestDto) {
//ν΄λΌμ΄μΈνΈμ λ°ννκΈ° μν΄ response κ°μ²΄
userService.login(loginRequestDto);
- return new MsgResponseDto(SuccessCode.LOG_IN);
+ return userService.login(loginRequestDto);
}
// μ¬μ©μ λ©μΌ μ ν¨μ± μ²΄ν¬ κΈ°λ₯
diff --git a/src/main/java/com/example/pirate99_final/user/service/UserService.java b/src/main/java/com/example/pirate99_final/user/service/UserService.java
index 1cb7c39..d38d050 100644
--- a/src/main/java/com/example/pirate99_final/user/service/UserService.java
+++ b/src/main/java/com/example/pirate99_final/user/service/UserService.java
@@ -32,42 +32,49 @@ public class UserService {
// νμκ°μ
@Transactional
public MsgResponseDto signup(SignupRequestDto signupRequestDto) {
+ try {
+ // 1. USERNAME, PASSWORD SETTING
+ String username = signupRequestDto.getUsername(); // username setting (DTO -> val)
+ String password = signupRequestDto.getPassword(); // password setting (DTO -> val)
+ String address = signupRequestDto.getEmail();
+
+ // 2. find user (duplicate user)
+ Optional found = userRepository.findByUsername(username); // νμ μ€λ³΅ νμΈ
+ if (found.isPresent()) { // isPresent - > foundκ° nullμ΄ μλλΌλ©΄ true λ°ν
+ throw new CustomException(ErrorCode.DUPLICATE_USER_ERROR);
+ }
- // 1. USERNAME, PASSWORD SETTING
- String username = signupRequestDto.getUsername(); // username setting (DTO -> val)
- String password = signupRequestDto.getPassword(); // password setting (DTO -> val)
- String address = signupRequestDto.getEmail();
-
- // 2. find user (duplicate user)
- Optional found = userRepository.findByUsername(username); // νμ μ€λ³΅ νμΈ
- if (found.isPresent()) { // isPresent - > foundκ° nullμ΄ μλλΌλ©΄ true λ°ν
- throw new CustomException(ErrorCode.DUPLICATE_USER_ERROR);
+ // 5. DB insert
+ User user = new User(username, password, address); // DTO -> Entity
+ userRepository.save(user);
+ return new MsgResponseDto(SIGN_UP);
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
- // 5. DB insert
- User user = new User(username, password, address); // DTO -> Entity
- userRepository.save(user);
- return new MsgResponseDto(SIGN_UP);
}
// λ‘κ·ΈμΈ
@Transactional(readOnly = true)
public MsgResponseDto login(LoginRequestDto loginRequestDto) {
+ try {
+ // 1. USERNAME, PASSWORD SETTING
+ String username = loginRequestDto.getUsername();
+ String password = loginRequestDto.getPassword();
+
+ // 2. Check USERNAME, PASSWORD
+ User user = userRepository.findByUsername(username).orElseThrow( // μ¬μ©μ νμΈ
+ () -> new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
+ );
+
+ if (!password.equals(user.getPassword())) { // λΉλ°λ²νΈ λΉκ΅
+ throw new CustomException(ErrorCode.WRONG_PASSWORD_ERROR);
+ }
- // 1. USERNAME, PASSWORD SETTING
- String username = loginRequestDto.getUsername();
- String password = loginRequestDto.getPassword();
-
- // 2. Check USERNAME, PASSWORD
- User user = userRepository.findByUsername(username).orElseThrow( // μ¬μ©μ νμΈ
- () -> new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
- );
-
- if (!password.equals(user.getPassword())) { // λΉλ°λ²νΈ λΉκ΅
- throw new CustomException(ErrorCode.WRONG_PASSWORD_ERROR);
+ return new MsgResponseDto(LOG_IN);
+ } catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
-
- return new MsgResponseDto(LOG_IN);
}
diff --git a/src/main/java/com/example/pirate99_final/waiting/controller/WaitingController.java b/src/main/java/com/example/pirate99_final/waiting/controller/WaitingController.java
index 4d79361..a3f8767 100644
--- a/src/main/java/com/example/pirate99_final/waiting/controller/WaitingController.java
+++ b/src/main/java/com/example/pirate99_final/waiting/controller/WaitingController.java
@@ -23,20 +23,20 @@ public MsgResponseDto createWaiter(@PathVariable Long storeId, @RequestBody Wait
}
@PostMapping("/waitingList/myTurn/{storeId}")
- public MyTurnResponseDto getMyTurn(@PathVariable Long storeId, @RequestBody WaitingRequestDto requestDto) {
+ public MsgResponseDto getMyTurn(@PathVariable Long storeId, @RequestBody WaitingRequestDto requestDto) {
return waitingService.getMyTurn(storeId, requestDto);
}
- @GetMapping("/waitingList/{storeId}/{waitingId}")
- public WaitingResponseDto getWaiter(@PathVariable Long storeId, @PathVariable Long waitingId) {
+ @GetMapping("/waitingList/{waitingId}")
+ public WaitingResponseDto getWaiter(@PathVariable Long waitingId) {
- return waitingService.getWaiter(storeId, waitingId);
+ return waitingService.getWaiter(waitingId);
}
- @PutMapping("/waitingList/{storeId}/{waitingId}")
- public MsgResponseDto deleteWaiter(@PathVariable Long storeId, @PathVariable Long waitingId) {
- return waitingService.deleteWaiter(storeId, waitingId);
+ @PutMapping("/waitingList/{waitingId}")
+ public MsgResponseDto deleteWaiter(@PathVariable Long waitingId) {
+ return waitingService.deleteWaiter(waitingId);
}
// DB select all (User Info)
diff --git a/src/main/java/com/example/pirate99_final/waiting/dto/MyTurnResponseDto.java b/src/main/java/com/example/pirate99_final/waiting/dto/MyTurnResponseDto.java
index e5a9404..df500a9 100644
--- a/src/main/java/com/example/pirate99_final/waiting/dto/MyTurnResponseDto.java
+++ b/src/main/java/com/example/pirate99_final/waiting/dto/MyTurnResponseDto.java
@@ -1,14 +1,16 @@
package com.example.pirate99_final.waiting.dto;
+import com.example.pirate99_final.global.MsgResponseDto;
import lombok.Getter;
@Getter
-public class MyTurnResponseDto {
+public class MyTurnResponseDto extends MsgResponseDto {
private int totalWaitingCnt;
private int myTurn;
+
public MyTurnResponseDto(int totalWaitingCnt, int myTurn) {
this.totalWaitingCnt = totalWaitingCnt;
this.myTurn = myTurn;
diff --git a/src/main/java/com/example/pirate99_final/waiting/entity/WaitingStatus.java b/src/main/java/com/example/pirate99_final/waiting/entity/WaitingStatus.java
index be7183e..1293797 100644
--- a/src/main/java/com/example/pirate99_final/waiting/entity/WaitingStatus.java
+++ b/src/main/java/com/example/pirate99_final/waiting/entity/WaitingStatus.java
@@ -10,7 +10,8 @@ public enum WaitingStatus {
WAITING(0), // λκΈ° μ€
ADMISSION_ALLOWED(1), // μ
μ₯ κ°λ₯
ADMISSION_COMPLETE(2), // μ
μ₯ μλ£
- CANCELLATIONS(3); // λκΈ° μ·¨μ
+ CANCELLATIONS(3), // λκΈ° μ·¨μ
+ LEAVING(4); // μλ ν΄μ₯
private final int waitingStatus;
}
diff --git a/src/main/java/com/example/pirate99_final/waiting/repository/WaitingRepository.java b/src/main/java/com/example/pirate99_final/waiting/repository/WaitingRepository.java
index cd87795..3a02f1c 100644
--- a/src/main/java/com/example/pirate99_final/waiting/repository/WaitingRepository.java
+++ b/src/main/java/com/example/pirate99_final/waiting/repository/WaitingRepository.java
@@ -11,17 +11,21 @@
public interface WaitingRepository extends JpaRepository {
Waiting findByWaitingId(Long waitingId);
- List findAllByStoreStatusAndWaitingStatusOrWaitingStatusOrderByWaitingIdAsc(StoreStatus storeStatus, int waitingStatus, int waitingStatus2 );
- @Query(value = "select * from waiting as a where (waiting_status = :waitingStatus1 or waiting_status = :waitingStatus2) and store_status_id = :storeStatusId", nativeQuery = true)
+ @Query(value = "select * from waiting where (waiting_status = :waitingStatus1 or waiting_status = :waitingStatus2) and store_status_id = :storeStatusId", nativeQuery = true)
List waitingList(int waitingStatus1, int waitingStatus2, Long storeStatusId);
+ @Query(value = "select * from waiting where store_status_id = :storeStatusId and user_id = :userId", nativeQuery = true)
+ Waiting queueing(Long storeStatusId, Long userId);
+
Waiting findByStoreStatusAndUser(StoreStatus storestatus, User user);
@Query(value = "select *from waiting where (waiting_status = :waitingStatus1 or waiting_status = :waitingStatus2) and store_status_id = :storeStatusId and user_id = :userId", nativeQuery = true)
Optional alreadyQueue(int waitingStatus1, int waitingStatus2, Long userId, Long storeStatusId);
+ @Query(value = "select *from waiting where waiting_status = :waitingStatus1 and store_status_id = :storeStatusId and user_id = :userId", nativeQuery = true)
+ Optional alreadyEating(int waitingStatus1, Long userId, Long storeStatusId);
+
List findAllByStoreStatusOrderByWaitingIdAsc(StoreStatus storeStatus);
- Waiting findFirstByStoreStatusAndWaitingStatusOrderByWaitingIdAsc(StoreStatus storeStatus, int waitingStatus);
}
diff --git a/src/main/java/com/example/pirate99_final/waiting/service/WaitingService.java b/src/main/java/com/example/pirate99_final/waiting/service/WaitingService.java
index 7befc84..c7c1de1 100644
--- a/src/main/java/com/example/pirate99_final/waiting/service/WaitingService.java
+++ b/src/main/java/com/example/pirate99_final/waiting/service/WaitingService.java
@@ -20,6 +20,7 @@
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
+import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@@ -42,58 +43,63 @@ public class WaitingService {
public MsgResponseDto createWaiter(Long storeId, WaitingRequestDto requestDto) { // λκΈ°μ λ±λ‘ μμ€ν
- RLock lock = redissonClient.getLock("key μ΄λ¦");
+ RLock lock = redissonClient.getLock("Waiting");
try {
- boolean isLocked = lock.tryLock(60000, 60000, TimeUnit.MILLISECONDS);
+ boolean isLocked = lock.tryLock(60000, 45000, TimeUnit.MILLISECONDS);
if (isLocked) {
try {
- // μ€ν μ΄ μ°ΎκΈ° (storeId)
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
// μ€ν μ΄ μ€ν
μ΄ν°μ€ μ°ΎκΈ°
StoreStatus storeStatus = storeStatusRepository.findByStoreId(storeId);
// μ μ μ°ΎκΈ°
User user = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(
- () -> new IllegalArgumentException("μ μ λ₯Ό μ°Ύμ μ μμ΅λλ€.")
+ () -> new CustomException(ErrorCode.NOT_FOUND_USER_ERROR)
);
-
- // μμ¬ μ’μμ΄ μμ λλ, waitingRepositoryμ μκΈ°
- if(storeStatus.getAvailableTableCnt() > 0 ){
- waitingRepository.save(new Waiting(user, storeStatus, 1));
- storeStatus.update_waitingCnt(storeStatus.getWaitingCnt() + 1, storeStatus.getAvailableTableCnt() - 1);
- }
- else{
- // λκΈ°μ΄ μ€ μνκ°μ΄ 'λκΈ°μ€', 'μ
μ₯κ°λ₯'μΈ μ¬λλ€λ§ μΉ΄μ΄ν
νκΈ°μν΄ κ΅¬λ³ν΄μ 리μ€νΈμ λ΄μ
- Optional alreadyQueue = waitingRepository.alreadyQueue(0, 1, user.getUserId(), storeStatus.getStoreStatusId());
-
- // μ’
μ
μμ΄ μ€μ ν λκΈ°μΈμ μ νμ€μ κ° λ³΄λ€ νμ¬ λκΈ°μΈμμ΄ μ μ κ²½μ°λ§ λκΈ°μ λ±λ‘μ΄ κ°λ₯νκ²λ μ€μ
- if (storeStatus.getWaitingCnt() < storeStatus.getLimitWaitingCnt()) {
- if (alreadyQueue.isEmpty()) {
- // μ¨μ΄ν
(λκΈ°μ) λ±λ‘
- Waiting waiting = waitingRepository.save(new Waiting(user, storeStatus, 0));
- } else {
+ // λκΈ°μ΄ μ€ μνκ°μ΄ 'λκΈ°μ€', 'μ
μ₯κ°λ₯'μΈ μ¬λλ€λ§ μΉ΄μ΄ν
νκΈ°μν΄ κ΅¬λ³ν΄μ 리μ€νΈμ λ΄μ
+ Optional alreadyQueue = waitingRepository.alreadyQueue(0, 1, user.getUserId(), storeStatus.getStoreStatusId());
+ Optional alreadyEating = waitingRepository.alreadyEating(2, user.getUserId(), storeStatus.getStoreStatusId());
+ // λκΈ°μ΄ λ±λ‘ μμ²ν κ³ κ°μ΄ μ΄λ―Έ μμ¬ μ€μ΄ μλλΌλ©΄ μ
μ₯μλ£ μ²λ¦¬
+ if (alreadyEating.isEmpty()){
+ // μμ¬ μ’μμ΄ μμ λλ, waitingRepositoryμ μκΈ°
+ if (storeStatus.getAvailableTableCnt() > 0 && storeStatus.getWaitingCnt() == 0){
+ // λκΈ°μ λͺ
λ¨μ μμ μ μ΄λ¦μ΄ μλ€λ©΄
+ if (alreadyQueue.isEmpty()){
+ // μ
μ₯μλ£ λ±λ‘
+ waitingRepository.save(new Waiting(user, storeStatus, 2));
+ storeStatus.update(storeStatus.getAvailableTableCnt() - 1);
+ }else{
return new MsgResponseDto(ErrorCode.ALREADY_IN_QUEUE);
}
- } else {
- return new MsgResponseDto(ErrorCode.LIMIT_QUEUE_EXCEEDED);
- }
+ }else{
+ // μ’
μ
μμ΄ μ€μ ν λκΈ°μΈμ μ νμ€μ κ° λ³΄λ€ νμ¬ λκΈ°μΈμμ΄ μ μ κ²½μ°λ§ λκΈ°μ λ±λ‘μ΄ κ°λ₯νκ²λ μ€μ
+ if (storeStatus.getWaitingCnt() < storeStatus.getLimitWaitingCnt()) {
+ if (alreadyQueue.isEmpty()) {
+ // μ¨μ΄ν
(λκΈ°μ) λ±λ‘
+ waitingRepository.save(new Waiting(user, storeStatus, 0));
+ } else {
+ return new MsgResponseDto(ErrorCode.ALREADY_IN_QUEUE);
+ }
+ } else {
+ return new MsgResponseDto(ErrorCode.LIMIT_QUEUE_EXCEEDED);
+ }
- storeStatus.update_waitingCnt(storeStatus.getWaitingCnt() + 1, storeStatus.getAvailableTableCnt());
+ storeStatus.update_waitingCnt(storeStatus.getWaitingCnt() + 1, storeStatus.getAvailableTableCnt());
+ }
+ }else {
+ return new MsgResponseDto(ErrorCode.ALREADY_EATING);
}
+
// ν΄λΉ μ ν¬ μ¨μ΄ν
νν© μμ μ
λ°μ΄νΈ
storeStatusRepository.save(storeStatus);
-
+ lock.unlock();
return new MsgResponseDto(SuccessCode.CREATE_WAITING);
- } catch (Exception e) {
-
- } finally {
+ } catch (CustomException e) {
lock.unlock();
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
}
} catch (Exception e) {
@@ -102,62 +108,52 @@ public MsgResponseDto createWaiter(Long storeId, WaitingRequestDto requestDto) {
return null;
}
- @Transactional
- public MyTurnResponseDto getMyTurn(Long storeId, WaitingRequestDto requestDto) { // λκΈ° μΈμ μ€ μμ μ μ°¨λ‘ μ‘°ν
+ public MsgResponseDto getMyTurn(Long storeId, WaitingRequestDto requestDto) { // λκΈ° μΈμ μ€ μμ μ μ°¨λ‘ μ‘°ν
+
// μ΄μ©μκ° μμ μ μ°¨λ‘λ₯Ό μ‘°νν λ μ°λ 'myTurn'κ³Ό ν΄λΉ μ ν¬ μ΄ λκΈ°μΈμ μ 'totalWaitingCnt' λ₯Ό μ μΈνλ€.
int myTurn = 0;
int totalWaitingCnt = 0;
- // μ€ν μ΄ μ°ΎκΈ° (storeId)
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
+
// μ€ν μ΄ μ€ν
μ΄ν°μ€ μ°ΎκΈ°
StoreStatus storeStatus = storeStatusRepository.findByStoreId(storeId);
// λκΈ°μ΄ μ€ μνκ°μ΄ 'λκΈ°μ€', 'μ
μ₯κ°λ₯'μΈ μ¬λλ€λ§ μΉ΄μ΄ν
νκΈ°μν΄ κ΅¬λ³ν΄μ 리μ€νΈμ λ΄μ
-// List waitingList = waitingRepository.findAllByStoreStatusAndWaitingStatusOrWaitingStatusOrderByWaitingIdAsc(storeStatus, 0, 1);
List waitingList = waitingRepository.waitingList(0, 1, storeStatus.getStoreStatusId());
- // μ μ μ°ΎκΈ°
- User getUser = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(
- () -> new IllegalArgumentException("μ μ λ₯Ό μ°Ύμ μ μμ΅λλ€."));
- // μ΄λκΈ° μΈμμ = μμμ λ΄μ μ¨μ΄ν
리μ€νΈμ μ¬μ΄μ¦
- totalWaitingCnt = waitingList.size();
+ try {
+ // μ μ μ°ΎκΈ°
+ User getUser = userRepository.findByUsername(requestDto.getUsername()).orElseThrow(
+ () -> new CustomException(HttpStatus.OK.value(), ErrorCode.NOT_FOUND_USER_ERROR));
+
+ // μ΄λκΈ° μΈμμ = μμμ λ΄μ μ¨μ΄ν
리μ€νΈμ μ¬μ΄μ¦
+ totalWaitingCnt = waitingList.size();
- for (int i = 0; i < waitingList.size(); i++) {
- // μ΄ λκΈ°μΈμ μ μ€μ μμ μ μ°¨λ‘λ₯Ό μ°Ύλ λ‘μ§ 'waitingList' μ€ Iλ²μ§Έ μμκ° μμ μ μ°¨λ‘μμ λνλ
- if (waitingList.get(i).getUser().equals(getUser)) {
- myTurn = i + 1;
+ for (int i = 0; i < waitingList.size(); i++) {
+ // μ΄ λκΈ°μΈμ μ μ€μ μμ μ μ°¨λ‘λ₯Ό μ°Ύλ λ‘μ§ 'waitingList' μ€ Iλ²μ§Έ μμκ° μμ μ μ°¨λ‘μμ λνλ
+ if (waitingList.get(i).getUser().equals(getUser)) {
+ myTurn = i + 1;
+ }
}
+ }catch (CustomException e) {
+ return new MsgResponseDto(e.getStatusCode(), e.getMsg());
}
return new MyTurnResponseDto(totalWaitingCnt, myTurn);
}
@Transactional
- public WaitingResponseDto getWaiter(Long storeId, Long waitingId) { // λκΈ°μΈμ μ€ νΉμ μ¬μ©μμ μ 보 λΆλ¬μ€κΈ°
-
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- StoreStatus storeStatus = storeStatusRepository.findByStoreId(storeId);
+ public WaitingResponseDto getWaiter(Long waitingId) { // λκΈ°μΈμ μ€ νΉμ μ¬μ©μμ μ 보 λΆλ¬μ€κΈ°
Waiting waiting = waitingRepository.findByWaitingId(waitingId);
return new WaitingResponseDto(waiting);
}
@Transactional
- public MsgResponseDto deleteWaiter(Long storeId, Long waitingId) { // λκΈ°μΈμ μ€ λκΈ°μ·¨μ λ±μ μ¬μ λ‘ μνκ°μ λ³κ²½νλ μμ
- Store store = storeRepository.findById(storeId).orElseThrow(() ->
- new CustomException(ErrorCode.NOT_FOUND_STORE_ERROR)
- );
-
- StoreStatus storeStatus = storeStatusRepository.findByStoreId(storeId);
+ public MsgResponseDto deleteWaiter(Long waitingId) { // λκΈ°μΈμ μ€ λκΈ°μ·¨μ λ±μ μ¬μ λ‘ μνκ°μ λ³κ²½νλ μμ
Waiting waiting = waitingRepository.findByWaitingId(waitingId);
-
// λκΈ°μ λͺ
λ¨μμ μνκ°μ '3' (λκΈ° μ·¨μ)μΌλ‘ λ³κ²½ν¨
waiting.update(3);
+
return new MsgResponseDto(SuccessCode.DELETE_WAITING);
}
@@ -186,8 +182,10 @@ else if(waiting.getWaitingStatus() == 1){
else if(waiting.getWaitingStatus() == 2){
waitingStatus = "μ
μ₯ μλ£";
}
- else{
+ else if(waiting.getWaitingStatus() == 3){
waitingStatus = "λκΈ° μ·¨μ";
+ }else {
+ waitingStatus = "ν΄μ₯";
}
waitingResponseDto.add(new EnterStatusResponseDto(waiting,waitingStatus));
}
diff --git a/src/main/resources/static/js/admin.js b/src/main/resources/static/js/admin.js
index 4f96005..d70c338 100644
--- a/src/main/resources/static/js/admin.js
+++ b/src/main/resources/static/js/admin.js
@@ -7,10 +7,9 @@ window.onload = function () {
}
// λκΈ°μ νΈμΆ κΈ°λ₯
-function callpeople() {
+function callpeople(username) {
var getId = localStorage.getItem("storeId"); //λ°μ΄ν°λ₯Ό keyλ‘ κΊΌλ
const id = JSON.parse(getId); //λ¬Έμμ΄μ κ°μ²΄(json)μΌλ‘ λ³ν
- let username = document.querySelector('#username').innerHTML;
const api = '/api/storeStatus/call/';
axios({
@@ -24,15 +23,12 @@ function callpeople() {
},
})
.then(function (response) {
- // console.log("RESPONSE : " + JSON.stringify(response.data));
alert("κ³ κ° νΈμΆ !")
location.reload();
})
.catch(function (error) {
- // console.log("ERROR : " + JSON.stringify(error));
});
}
-
// μ
μ₯ μλ£ μ¬λΆ μ‘°ν API μ°λ (μμμ λκΈ°μ 리μ€νΈ μ 체)
function EnterStatus() {
var getId = localStorage.getItem("storeId"); //λ°μ΄ν°λ₯Ό keyλ‘ κΊΌλ
@@ -52,7 +48,7 @@ function EnterStatus() {
const statusData = JSON.stringify(response.data);
var status = JSON.parse(statusData);
- if(Object.keys(status).length != 0){
+ if (Object.keys(status).length != 0) {
let rows = status;
@@ -66,15 +62,17 @@ function EnterStatus() {
${waitingNum} |
${waitingUserName} |
${waitingStatus} |
-
-
- |
-
-
- |
-
-
- |
+
+
+ |
+
+
+ |
+
+
+
+
+ |
`
$('#waitingList').append(temp_html)
}
@@ -97,7 +95,7 @@ function LimitSetup() {
method: "put",
url: baseUrl + api + id,
data: JSON.stringify(
- {limitWaitingCnt : limit_number }
+ {limitWaitingCnt: limit_number}
),
headers: {
"Content-Type": "application/json; charset=utf-8"
@@ -112,18 +110,16 @@ function LimitSetup() {
}
// μ
μ₯ νμΈ
-function EnterConfirm() {
+function EnterConfirm(waitingUserName) {
var getId = localStorage.getItem("storeId"); //λ°μ΄ν°λ₯Ό keyλ‘ κΊΌλ
const id = JSON.parse(getId); //λ¬Έμμ΄μ κ°μ²΄(json)μΌλ‘ λ³ν
- let username = document.querySelector('#username').innerHTML;
-
const api = '/api/storeStatus/confirmEnter/' + id;
axios({
method: "put",
url: baseUrl + api,
data: JSON.stringify(
- {username : username, waitingStatus : 1}
+ {username: waitingUserName, waitingStatus: 1}
),
headers: {
"Content-Type": "application/json; charset=utf-8"
@@ -138,7 +134,9 @@ function EnterConfirm() {
}
// ν΄μ₯νμΈ API μ°λ
-function ExitConfirm(){
+
+function ExitConfirm(username) {
+
var getId = localStorage.getItem("storeId"); //λ°μ΄ν°λ₯Ό keyλ‘ κΊΌλ
const id = JSON.parse(getId); //λ¬Έμμ΄μ κ°μ²΄(json)μΌλ‘ λ³ν
const api = '/api/storeStatus/leave/' + id;
@@ -147,6 +145,7 @@ function ExitConfirm(){
method: "put",
url: baseUrl + api,
data: JSON.stringify(
+ {username: username}
),
headers: {
"Content-Type": "application/json; charset=utf-8"
@@ -179,7 +178,7 @@ function getStoreAdminInfo() {
const storeAdmin = JSON.parse(transferStoreAdmin);
document.getElementById("storeName").innerHTML = storeAdmin.storeName;
document.getElementById("totalWaiting").innerHTML = "μ΄ λκΈ°ν μ : " + storeAdmin.numberOfTeamsWaiting + "ν";
- document.getElementById("useCustomer").innerHTML = "μ΄μ©μ€μΈ κ³ κ°μ : " + storeAdmin.numberOfCustomersInUse +"ν";
+ document.getElementById("useCustomer").innerHTML = "μ΄μ©μ€μΈ κ³ κ°μ : " + storeAdmin.numberOfCustomersInUse + "ν";
})
.catch(function (error) {
diff --git a/src/main/resources/static/js/index.js b/src/main/resources/static/js/index.js
index b469fbd..aa492e3 100644
--- a/src/main/resources/static/js/index.js
+++ b/src/main/resources/static/js/index.js
@@ -109,8 +109,6 @@ function signIn() {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
alert("λ‘κ·ΈμΈ μ±κ³΅, μμ² λ²νΌμ λλ¬μ μ΄λ©μΌ μΈμ¦μ ν΄μ£ΌμΈμ!")
})
.catch(function (error) {
@@ -136,8 +134,6 @@ function callWaiting() {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
const requestWaiting = document.getElementById('signin'); // μ
λ ₯λ°μ νμμ λ³΄λ‘ νμκ°μ
μ νκ³ ,
requestWaiting.style.display = 'none'; // ν΄λΉ Formμ μ¨κΉμ²λ¦¬νλ€.
alert("μ¨μ΄ν
λ±λ‘ μ±κ³΅!")
@@ -145,9 +141,6 @@ function callWaiting() {
location.reload();
})
.catch(function (error) {
- console.log("");
- console.log("ERROR : " + JSON.stringify(error));
- console.log("");
});
} else {
alert("μ¬μ©μ μ΄λ©μΌ μΈμ¦μ΄ λμ§ μμμ΅λλ€. μΈμ¦νμΈμ λλ¬μ£ΌμΈμ!")
@@ -182,9 +175,7 @@ function mystatus() {
document.querySelector('.userId1').value = '';
})
.catch(function (error) {
- console.log("");
- console.log("ERROR : " + JSON.stringify(error));
- console.log("");
+ alert("μν μ‘°ν μ€λ₯!")
});
}
@@ -207,8 +198,6 @@ function postReview() {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
alert("리뷰 λ±λ‘ μ±κ³΅!")
document.querySelector('.postReviewUserId').value = '';
document.querySelector('.reviewComment').value = '';
@@ -218,9 +207,7 @@ function postReview() {
postReview.style.display = 'none';
})
.catch(function (error) {
- console.log("");
- console.log("ERROR : " + JSON.stringify(error));
- console.log("");
+ alert("리뷰 λ±λ‘ μ€ν¨!")
});
}
@@ -239,8 +226,6 @@ function storeStatus() {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
const transferStatus = JSON.stringify(response.data);
var status = JSON.parse(transferStatus);
alert("λ΄ μν μ‘°ν μλ£!")
@@ -248,9 +233,7 @@ function storeStatus() {
})
.catch(function (error) {
- console.log("");
- console.log("ERROR : " + JSON.stringify(error));
- console.log("");
+ alert("λ΄ μν μ‘°ν μ€λ₯!")
});
}
@@ -284,7 +267,7 @@ function sendMail() {
code = JSON.stringify(response.data); // μ΄λ©μΌλ‘ μ μ‘ν μ½λ μ μ₯
})
.catch(function (error) {
- console.log("ERROR : " + JSON.stringify(error));
+ alert("μΈμ¦ μ μ‘ μ€λ₯!")
});
}
}
@@ -323,8 +306,6 @@ function storeReview(storeId) {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
const transeBlog = JSON.stringify(response.data);
var blogList = JSON.parse(transeBlog);
const blogNum = blogList.length;
@@ -353,7 +334,6 @@ function storeReview(storeId) {
}
})
.catch(function (error) {
- console.log("");
console.log("ERROR : " + JSON.stringify(error));
});
}
@@ -378,16 +358,12 @@ function getStoreName() {
},
})
.then(function (response) {
- console.log("");
- console.log("RESPONSE : " + JSON.stringify(response.data));
const transferStoreName = JSON.stringify(response.data);
var storeName = JSON.parse(transferStoreName);
document.getElementById("myStoreName").innerHTML = storeName.storeName;
})
.catch(function (error) {
- console.log("");
console.log("ERROR : " + JSON.stringify(error));
- console.log("");
});
}
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index a6815ee..c14de0a 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -86,14 +86,6 @@
-
-
@@ -296,7 +288,6 @@