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;