Skip to content

Commit

Permalink
[FEAT] 모든 질답 완료 시 응답값 구분 #100
Browse files Browse the repository at this point in the history
  • Loading branch information
jun02160 committed Aug 24, 2023
1 parent ee39c8c commit 1ddd5cc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ public GetMainViewResponseDto getMainInfo(Long userId) {
QnA lastQna = qnaList.get(parentchild.getCount()-1);
log.info("getCount(): {}", parentchild.getCount());

QnA currentQnA = parentchild.getQnaList().get(parentchild.getCount() - 1);
if (parentchild.getCount() == 7 && (currentQnA.isParentAnswer() && currentQnA.isChildAnswer())) {
return GetMainViewResponseDto.of(lastQna, parentchild.getCount()+1); // 유효하지 않은 8로 반환 시 엔딩이벤트
}


return GetMainViewResponseDto.of(lastQna, parentchild.getCount());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@

@Slf4j
@Repository
public class ParentchildDao {
public class ParentchildDao implements AutoCloseable {

@PersistenceContext
private EntityManager em;


@Override
public void close() throws Exception {

}

public Optional<Parentchild> findByUserId(Long userId) {

String jpql = "SELECT pc FROM Parentchild pc " +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
package sopt.org.umbba.notification.config;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import java.sql.Connection;
@Aspect
@Component
public class ConnectionClosingAspect {
@AfterThrowing(pointcut = "execution(* sopt.org.umbba.notification.service.*.*(..))", throwing = "ex")
public void closeConnectionOnException(Exception ex) {
Connection conn =
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ public void schedulePushAlarm(String cronExpression, Long parentchildId) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
Thread.currentThread().interrupt();
// throw new RuntimeException(e);
}

TransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

Expand All @@ -15,6 +17,7 @@
import java.util.List;

@Slf4j
@Aspect
@Component
@RequiredArgsConstructor
public class FCMScheduler {
Expand Down Expand Up @@ -42,8 +45,8 @@ public String pushTodayQna() {
})
.forEach(pc -> {
log.info(pc.getId() + "번째 Parentchild");
String cronExpression = String.format("0 %s %s * * ?", pc.getPushTime().getMinute(), pc.getPushTime().getHour());
// String cronExpression = String.format("*/20 * * * * *");
// String cronExpression = String.format("0 %s %s * * ?", pc.getPushTime().getMinute(), pc.getPushTime().getHour());
String cronExpression = String.format("*/20 * * * * *");
log.info("cron: {}", cronExpression);
fcmService.schedulePushAlarm(cronExpression, pc.getId());
});
Expand Down
2 changes: 1 addition & 1 deletion umbba-notification/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spring:
connection-timeout: 30000 # 30초(default: 30초)
maximum-pool-size: 10 # default: 10개
max-lifetime: 600000 # 10분(default: 30분)
leak-detection-threshold: 2000 # default: 0(이용X)
leak-detection-threshold: 60000 # default: 0(이용X)
jpa:
show-sql: false
hibernate:
Expand Down

0 comments on commit 1ddd5cc

Please sign in to comment.