diff --git a/src/main/java/com/kri/contact/server/controller/ListCallHistController.java b/src/main/java/com/kri/contact/server/controller/ListCallHistController.java index ab2e270..75cd3cc 100644 --- a/src/main/java/com/kri/contact/server/controller/ListCallHistController.java +++ b/src/main/java/com/kri/contact/server/controller/ListCallHistController.java @@ -11,8 +11,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import java.time.LocalDateTime; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -66,27 +64,4 @@ public class ListCallHistController { now ); } - - @Operation(summary = "Find list call history by agent session") - @GetMapping("/session/{agentSessionId}") - public ListCallHistDto findByAgentSessionId( - @PathVariable String agentSessionId, - RequestUserContext ctx - ) { - return listCallHistService.findByAgentSessionId( - agentSessionId, - ctx.getUserId(), - ctx.getUserCmpn(), - ctx.getUserRole() - ); - } - - @Operation(summary = "Update Call History at Client Hangup") - @PatchMapping("hangup/{agentSessionId}") - public boolean hangupClient( - @PathVariable String agentSessionId, - RequestUserContext ctx - ) { - return listCallHistService.hangupClient(agentSessionId); - } } diff --git a/src/main/java/com/kri/contact/server/persistence/entity/TListCallHistEntity.java b/src/main/java/com/kri/contact/server/persistence/entity/TListCallHistEntity.java index 79c4023..67d5b11 100644 --- a/src/main/java/com/kri/contact/server/persistence/entity/TListCallHistEntity.java +++ b/src/main/java/com/kri/contact/server/persistence/entity/TListCallHistEntity.java @@ -13,7 +13,6 @@ import jakarta.persistence.Table; import jakarta.persistence.UniqueConstraint; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -import java.time.Duration; import java.time.LocalDateTime; import lombok.AllArgsConstructor; import lombok.Builder; @@ -155,19 +154,6 @@ public class TListCallHistEntity { } - public boolean markUserHangup(LocalDateTime endDt) { - if (this.callStatus == CallStatus.CALL_CLOSE) { - return false; - } - LocalDateTime resolvedEndDt = this.endDt == null ? endDt : this.endDt; - int durationSeconds = durationSeconds(this.startDt, resolvedEndDt); - this.endDt = resolvedEndDt; - this.totalTime = durationSeconds; - this.talkTime = durationSeconds; - this.callStatus = CallStatus.USER_HANGUP; - return true; - } - private static LocalDateTime resolveEndDt(ListCallCloseRequestDto request, LocalDateTime now) { return isCompletedRequest(request) ? now : null; } @@ -181,14 +167,6 @@ public class TListCallHistEntity { || isPositive(request.getTalkTime()); } - private static int durationSeconds(LocalDateTime startDt, LocalDateTime endDt) { - if (startDt == null || endDt == null || endDt.isBefore(startDt)) { - return 0; - } - long seconds = Duration.between(startDt, endDt).getSeconds(); - return seconds > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) seconds; - } - private static boolean isPositive(Integer value) { return value != null && value > 0; } diff --git a/src/main/java/com/kri/contact/server/service/ListCallHistService.java b/src/main/java/com/kri/contact/server/service/ListCallHistService.java index dbb1445..09c9ccf 100644 --- a/src/main/java/com/kri/contact/server/service/ListCallHistService.java +++ b/src/main/java/com/kri/contact/server/service/ListCallHistService.java @@ -102,24 +102,6 @@ public class ListCallHistService { return ListCallHistDto.from(entity); } - @Transactional(readOnly = true) - public ListCallHistDto findByAgentSessionId( - String agentSessionId, - String userId, - String userCmpn, - Integer userRole - ) { - validateAgentSessionId(agentSessionId); - TListCallHistEntity entity = listCallHistRepository.findByAgentSessionId(agentSessionId) - .orElseThrow(() -> BusinessException.notFound( - "CALL_HISTORY_NOT_FOUND", - "통화 이력을 찾을 수 없습니다." - ).with("agentSessionId", agentSessionId)); - - validateUsableCallHistory(entity, userId, userCmpn, userRole, "CALL_HISTORY_NOT_FOUND"); - return ListCallHistDto.from(entity); - } - @Transactional(readOnly = true) public void validateListCallHistoryForEvent( Long listCallHistIdx, @@ -153,16 +135,6 @@ public class ListCallHistService { validateUsableCallHistory(entity, userId, userCmpn, userRole, "CALL_HISTORY_FORBIDDEN"); } - @Transactional - public boolean hangupClient( - String agentSessionId - ) { - validateAgentSessionId(agentSessionId); - return listCallHistRepository.findByAgentSessionId(agentSessionId) - .map(entity -> entity.markUserHangup(LocalDateTime.now())) - .orElse(false); - } - private void validateAgentSessionId(String agentSessionId) { if (!hasText(agentSessionId) || agentSessionId.length() > 64) { throw BusinessException.badRequest(