From 548dca52c3f2d79d3d06a455f16a461926255209 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 12 Nov 2026 14:01:21 +0900 Subject: [PATCH] =?UTF-8?q?261112=5F01=5FCLN:=20=EB=AF=B8=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20=ED=86=B5=ED=99=94=20=EC=9D=B4=EB=A0=A5=20=EC=84=B8?= =?UTF-8?q?=EC=85=98=20=EC=A1=B0=ED=9A=8C=C2=B7=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=20=EC=A2=85=EB=A3=8C=20API=20=EB=B0=8F=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ListCallHistController.java | 25 ----------------- .../entity/TListCallHistEntity.java | 22 --------------- .../server/service/ListCallHistService.java | 28 ------------------- 3 files changed, 75 deletions(-) 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(