From e0af51081428d90be79c455160aa64fded53212e Mon Sep 17 00:00:00 2001 From: GUARDiA Date: Fri, 19 Jun 2026 00:50:19 +0900 Subject: [PATCH] =?UTF-8?q?fix(mes):=20productionKpi=20ROUND(double,int)?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95(=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=EC=8B=9D=20::numeric=20=EC=BA=90=EC=8A=A4=ED=8C=85)=20+=20?= =?UTF-8?q?=EC=8A=A4=ED=83=9D=ED=8A=B8=EB=A0=88=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EB=88=84=EC=B6=9C=20=EC=B0=A8=EB=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zioinfo/mes/common/GlobalExceptionHandler.java | 9 +++++++++ backend/src/main/resources/mapper/AnalyticsMapper.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java b/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java index 1586a58..8aabecb 100644 --- a/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java @@ -1,6 +1,7 @@ package com.zioinfo.mes.common; import lombok.extern.slf4j.Slf4j; +import org.springframework.dao.DataAccessException; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -39,6 +40,14 @@ public class GlobalExceptionHandler { return ApiResponse.fail(e.getMessage()); } + @ExceptionHandler(DataAccessException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + public ApiResponse handleDataAccess(DataAccessException e) { + // 보안 불변 규칙: SQL/테이블/쿼리/스택 상세 절대 미노출 — 내부 로그만 남기고 일반 메시지 반환 + log.error("DB 오류", e); + return ApiResponse.fail("ERR-MES-DB: 데이터 처리 중 오류가 발생했습니다"); + } + @ExceptionHandler(RuntimeException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ApiResponse handleRuntime(RuntimeException e) { diff --git a/backend/src/main/resources/mapper/AnalyticsMapper.xml b/backend/src/main/resources/mapper/AnalyticsMapper.xml index a244b25..af79ba9 100644 --- a/backend/src/main/resources/mapper/AnalyticsMapper.xml +++ b/backend/src/main/resources/mapper/AnalyticsMapper.xml @@ -8,7 +8,7 @@ COALESCE(SUM(good_qty),0) AS total_good, COALESCE(SUM(defect_qty),0) AS total_defect, ROUND( (COALESCE(SUM(defect_qty),0)::numeric - / NULLIF(SUM(good_qty)+SUM(defect_qty),0) * 100), 2) AS defect_rate, + / NULLIF(SUM(good_qty)+SUM(defect_qty),0) * 100)::numeric, 2) AS defect_rate, (SELECT COUNT(*) FROM mes_workorder WHERE status IN ('DONE','CLOSED') AND updated_at >= CURRENT_DATE - (#{days} || ' days')::interval) AS completed_workorders