From 3d989e3839b6716f009da70e4a1a5017a42f880a Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 11 Jan 2024 23:39:46 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[feat]=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=88=98=20=EB=8A=98?= =?UTF-8?q?=EB=A6=BC=20#13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ALGo/ALGo_server/message/service/MessageService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java index a67e277..f965864 100644 --- a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java +++ b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java @@ -37,7 +37,7 @@ public MessageResponse message(User user) throws IOException, ParseException { urlBuilder.append("?serviceKey=" + secretKey); urlBuilder.append("&returnType=json"); urlBuilder.append("&pageNum=1"); - urlBuilder.append("&numRowsPerPage=10"); + urlBuilder.append("&numRowsPerPage=20"); URL url = new URL(urlBuilder.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); From ecfe4ffecde7f4ea01bff2a5b3e75d5847da7571 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 11 Jan 2024 23:53:54 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[feat]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C=20=EC=96=B8=EC=96=B4=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ALGo/ALGo_server/authentication/Dto/TokenResponseDto.java | 1 + .../com/ALGo/ALGo_server/authentication/Service/UserService.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/ALGo/ALGo_server/authentication/Dto/TokenResponseDto.java b/src/main/java/com/ALGo/ALGo_server/authentication/Dto/TokenResponseDto.java index 3d0c2ca..c0802cf 100644 --- a/src/main/java/com/ALGo/ALGo_server/authentication/Dto/TokenResponseDto.java +++ b/src/main/java/com/ALGo/ALGo_server/authentication/Dto/TokenResponseDto.java @@ -13,4 +13,5 @@ public class TokenResponseDto { private String grantType; private String jwtAccessToken; private String jwtRefreshToken; + private String language; } diff --git a/src/main/java/com/ALGo/ALGo_server/authentication/Service/UserService.java b/src/main/java/com/ALGo/ALGo_server/authentication/Service/UserService.java index e6378c2..ab49b9d 100644 --- a/src/main/java/com/ALGo/ALGo_server/authentication/Service/UserService.java +++ b/src/main/java/com/ALGo/ALGo_server/authentication/Service/UserService.java @@ -52,6 +52,7 @@ public TokenResponseDto login(LoginRequestDto requestDto){ return TokenResponseDto.builder() .grantType("Bearer") + .language(user.getLanguage()) .jwtAccessToken(accessToken) .jwtRefreshToken(refreshToken) .build(); From c7a45640c1c94626d19c03fb2fca99bc72fb134a Mon Sep 17 00:00:00 2001 From: yunji118 Date: Fri, 12 Jan 2024 02:29:11 +0900 Subject: [PATCH 03/10] =?UTF-8?q?[fix]=20=ED=86=A0=ED=81=B0=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EC=97=B0=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ALGo/ALGo_server/authentication/Jwt/JwtTokenProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ALGo/ALGo_server/authentication/Jwt/JwtTokenProvider.java b/src/main/java/com/ALGo/ALGo_server/authentication/Jwt/JwtTokenProvider.java index 666b1f6..866acff 100644 --- a/src/main/java/com/ALGo/ALGo_server/authentication/Jwt/JwtTokenProvider.java +++ b/src/main/java/com/ALGo/ALGo_server/authentication/Jwt/JwtTokenProvider.java @@ -20,8 +20,8 @@ public class JwtTokenProvider { private static final String AUTHORITIES_KEY = "auth"; private static final String BEARER_TYPE = "BEARER"; - private final Long ACCESS_TOKEN_EXPIRE_TIME = 10000L * 60 * 60; - private final Long REFRESH_TOKEN_EXPIRE_TIME = 10000L * 60 * 60 * 24 * 7; + private final Long ACCESS_TOKEN_EXPIRE_TIME = 1000L * 60 * 60 * 24 * 3; + private final Long REFRESH_TOKEN_EXPIRE_TIME = 1000L * 60 * 60 * 24 * 7; private final CustomUserDetailsService customUserDetailsService; From 539deed7dedda743557a6806a5593b4051229af7 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Fri, 12 Jan 2024 18:24:35 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[feat]=20data=20100=EA=B0=9C=EB=A1=9C=20?= =?UTF-8?q?=EB=8A=98=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ALGo/ALGo_server/message/service/MessageService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java index ac409fa..a84d77c 100644 --- a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java +++ b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java @@ -37,7 +37,7 @@ public MessageResponse message(User user) throws IOException, ParseException { urlBuilder.append("?serviceKey=" + secretKey); urlBuilder.append("&returnType=json"); urlBuilder.append("&pageNum=1"); - urlBuilder.append("&numRowsPerPage=20"); + urlBuilder.append("&numRowsPerPage=100"); URL url = new URL(urlBuilder.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); From aa90f71b4084730a5eac11572414230426f2980f Mon Sep 17 00:00:00 2001 From: ri-naa Date: Fri, 12 Jan 2024 18:43:14 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[feat]=20=EC=9E=AC=EB=82=9C=20=ED=80=B4?= =?UTF-8?q?=EC=A6=88=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?#32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ALGo/ALGo_server/entity/Quiz.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/com/ALGo/ALGo_server/entity/Quiz.java diff --git a/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java b/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java new file mode 100644 index 0000000..a202381 --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java @@ -0,0 +1,22 @@ +package com.ALGo.ALGo_server.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor +public class Quiz { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long quiz_id; + + @Column(nullable = false) + private String question; + + @Column(nullable = false) + private boolean answer; + +} From 81101db38cff3afaf65c8d01eef8610fdc242b48 Mon Sep 17 00:00:00 2001 From: ri-naa Date: Fri, 12 Jan 2024 18:51:46 +0900 Subject: [PATCH 06/10] =?UTF-8?q?[fix]=20=EC=9E=AC=EB=82=9C=20=ED=80=B4?= =?UTF-8?q?=EC=A6=88=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?#32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ALGo/ALGo_server/entity/Quiz.java | 3 +++ .../ALGo/ALGo_server/repository/QuizRepository.java | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java diff --git a/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java b/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java index a202381..569e8d9 100644 --- a/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java +++ b/src/main/java/com/ALGo/ALGo_server/entity/Quiz.java @@ -19,4 +19,7 @@ public class Quiz { @Column(nullable = false) private boolean answer; + @Column(nullable = false) + private String description; + } diff --git a/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java b/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java new file mode 100644 index 0000000..75d6f7b --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java @@ -0,0 +1,10 @@ +package com.ALGo.ALGo_server.repository; + +import com.ALGo.ALGo_server.entity.Quiz; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface QuizRepository extends JpaRepository { + + Quiz findByQuiz_id(Long quiz_id); + +} From 26b30fab1367c37180a0d1ff6cba687e6b175a6f Mon Sep 17 00:00:00 2001 From: yunji118 Date: Fri, 12 Jan 2024 19:33:43 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[feat]=20quiz=20=EA=B5=AC=ED=98=84=20#32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quiz/Controller/QuizController.java | 21 +++++++++++ .../ALGo/ALGo_server/quiz/Dto/QuizDto.java | 15 ++++++++ .../ALGo_server/quiz/Dto/QuizResponseDto.java | 14 ++++++++ .../ALGo_server/quiz/Service/QuizService.java | 36 +++++++++++++++++++ .../repository/QuizRepository.java | 4 +-- 5 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/ALGo/ALGo_server/quiz/Controller/QuizController.java create mode 100644 src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizDto.java create mode 100644 src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizResponseDto.java create mode 100644 src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java diff --git a/src/main/java/com/ALGo/ALGo_server/quiz/Controller/QuizController.java b/src/main/java/com/ALGo/ALGo_server/quiz/Controller/QuizController.java new file mode 100644 index 0000000..729abb5 --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/quiz/Controller/QuizController.java @@ -0,0 +1,21 @@ +package com.ALGo.ALGo_server.quiz.Controller; + +import com.ALGo.ALGo_server.quiz.Dto.QuizResponseDto; +import com.ALGo.ALGo_server.quiz.Service.QuizService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/quiz") +@RequiredArgsConstructor +public class QuizController { + private final QuizService quizService; + + @GetMapping() + public QuizResponseDto getQuiz(){ + return quizService.getQuiz(); + } +} diff --git a/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizDto.java b/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizDto.java new file mode 100644 index 0000000..b60158b --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizDto.java @@ -0,0 +1,15 @@ +package com.ALGo.ALGo_server.quiz.Dto; + +import com.ALGo.ALGo_server.entity.Quiz; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +public class QuizDto { + private Long id; + + public QuizDto(Quiz quiz){ + this.id = quiz.getQuiz_id(); + } +} diff --git a/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizResponseDto.java b/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizResponseDto.java new file mode 100644 index 0000000..1fffd67 --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/quiz/Dto/QuizResponseDto.java @@ -0,0 +1,14 @@ +package com.ALGo.ALGo_server.quiz.Dto; + +import lombok.Getter; + +import java.util.List; + +@Getter +public class QuizResponseDto { + List quizList; + + public QuizResponseDto(List quizList){ + this.quizList = quizList; + } +} diff --git a/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java b/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java new file mode 100644 index 0000000..460e4a6 --- /dev/null +++ b/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java @@ -0,0 +1,36 @@ +package com.ALGo.ALGo_server.quiz.Service; + + +import com.ALGo.ALGo_server.entity.Quiz; +import com.ALGo.ALGo_server.quiz.Dto.QuizDto; +import com.ALGo.ALGo_server.quiz.Dto.QuizResponseDto; +import com.ALGo.ALGo_server.repository.QuizRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +@Service +@RequiredArgsConstructor +public class QuizService { + private final QuizRepository quizRepository; + + @Transactional(readOnly = true) + public QuizResponseDto getQuiz(){ + Random random = new Random(); + + List quizDtoList = new ArrayList<>(); + for(int i=0;i<4;i++){ + Long randomNum = Long.valueOf(random.nextInt(16) + 1); + Quiz q = quizRepository.findById(randomNum).get(); + QuizDto quizDto = new QuizDto(q); + quizDtoList.add(quizDto); + } + QuizResponseDto responseDto = new QuizResponseDto(quizDtoList); + + return responseDto; + } +} diff --git a/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java b/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java index 75d6f7b..2fdc03b 100644 --- a/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java +++ b/src/main/java/com/ALGo/ALGo_server/repository/QuizRepository.java @@ -2,9 +2,7 @@ import com.ALGo.ALGo_server.entity.Quiz; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; public interface QuizRepository extends JpaRepository { - - Quiz findByQuiz_id(Long quiz_id); - } From b5a90b6519820e0239bfa9ce40f723a6a062fac6 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Fri, 12 Jan 2024 19:37:40 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[feat]=20quiz=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20#32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ALGo/ALGo_server/quiz/Service/QuizService.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java b/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java index 460e4a6..9595cfd 100644 --- a/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java +++ b/src/main/java/com/ALGo/ALGo_server/quiz/Service/QuizService.java @@ -9,9 +9,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; +import java.util.*; @Service @RequiredArgsConstructor @@ -22,14 +20,14 @@ public class QuizService { public QuizResponseDto getQuiz(){ Random random = new Random(); - List quizDtoList = new ArrayList<>(); - for(int i=0;i<4;i++){ + Set quizDtoList = new HashSet<>(); + while (quizDtoList.size() < 4){ Long randomNum = Long.valueOf(random.nextInt(16) + 1); Quiz q = quizRepository.findById(randomNum).get(); QuizDto quizDto = new QuizDto(q); quizDtoList.add(quizDto); } - QuizResponseDto responseDto = new QuizResponseDto(quizDtoList); + QuizResponseDto responseDto = new QuizResponseDto(quizDtoList.stream().toList()); return responseDto; } From 404ab669b17db8f3790bf2aa2fcafb94e52baed9 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Fri, 12 Jan 2024 19:39:48 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[feat]=20FE=20vercel=20=EC=A3=BC=EC=86=8C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ALGo/ALGo_server/config/SecurityConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/ALGo/ALGo_server/config/SecurityConfig.java b/src/main/java/com/ALGo/ALGo_server/config/SecurityConfig.java index 57d37f1..cd4af11 100644 --- a/src/main/java/com/ALGo/ALGo_server/config/SecurityConfig.java +++ b/src/main/java/com/ALGo/ALGo_server/config/SecurityConfig.java @@ -65,6 +65,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.addAllowedOrigin("http://localhost:5173"); + configuration.addAllowedOrigin("https://alertglobal.vercel.app/"); configuration.addAllowedMethod("*"); configuration.addAllowedHeader("*"); configuration.setAllowCredentials(true); From 6f9f065a50fdf438eede8d95bbd95ee1cb490544 Mon Sep 17 00:00:00 2001 From: ri-naa Date: Sat, 13 Jan 2024 01:18:55 +0900 Subject: [PATCH 10/10] =?UTF-8?q?[fix]=20=EC=A7=80=EC=97=AD=EB=AA=85,=20?= =?UTF-8?q?=EC=9E=AC=ED=95=B4=EA=B5=AC=EB=B6=84=EB=AA=85=20=EB=B2=88?= =?UTF-8?q?=EC=97=AD=20=EC=B6=94=EA=B0=80=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/dto/MessageResponse.java | 7 ++++++- .../message/service/MessageService.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ALGo/ALGo_server/message/dto/MessageResponse.java b/src/main/java/com/ALGo/ALGo_server/message/dto/MessageResponse.java index 01cdd54..9636762 100644 --- a/src/main/java/com/ALGo/ALGo_server/message/dto/MessageResponse.java +++ b/src/main/java/com/ALGo/ALGo_server/message/dto/MessageResponse.java @@ -7,7 +7,6 @@ @Data public class MessageResponse { private String MSG_CN; //메세지 내용 - private String trans_MSG_CN; //번역된 내용 private String CREAT_DT; //생성일 private List RCV_AREA_ID; //수신지역 id private List RCV_AREA_NM; //수신지역명 @@ -15,6 +14,12 @@ public class MessageResponse { private String DSSTR_SE_ID; //재해구분 id private String DSSTR_SE_NM; //재해구분 명 + private String trans_MSG_CN; //문자 번역 + private String trans_AREA; //지역명 번역 + private String trnas_DSSTR; //재해구분명 번역 + + + public MessageResponse(String MSG_CN, String CREAT_DT, List RCV_AREA_ID, List RCV_AREA_NM, String EMRGNCY_STEP_ID, String DSSTR_SE_ID, String DSSTR_SE_NM){ this.MSG_CN = MSG_CN; //this.trans_MSG_CN = trans_MSG_CN; diff --git a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java index a84d77c..800cf61 100644 --- a/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java +++ b/src/main/java/com/ALGo/ALGo_server/message/service/MessageService.java @@ -132,8 +132,26 @@ public MessageResponse message(User user) throws IOException, ParseException { if(result != null){ String MSG_CN = result.getMSG_CN(); + String DSSTR = result.getDSSTR_SE_NM(); + + List areaArr = result.getRCV_AREA_NM(); + //문자 발송 지역 리스트 중 사용자 + String AREA = ""; + for (int i = 0; i < areaArr.size(); i++) { + if (combinedCity.equals(areaArr.get(i)) || city.equals(areaArr.get(i))) { + AREA = areaArr.get(i); + break; + } + } + String translatedMSG = naverTransService.getTransSentence(MSG_CN, user); + String translateDSSTR = naverTransService.getTransSentence(DSSTR, user); + String translateAREA = naverTransService.getTransSentence(AREA, user); + result.setTrans_MSG_CN(translatedMSG); + result.setTrnas_DSSTR(translateDSSTR); + result.setTrans_AREA(translateAREA); + } return result;