fix(mes): productionKpi ROUND(double,int) 오류 수정(전체식 ::numeric 캐스팅) + 스택트레이스 누출 차단
This commit is contained in:
parent
050a5ba6a9
commit
e0af510814
@ -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<Void> handleDataAccess(DataAccessException e) {
|
||||
// 보안 불변 규칙: SQL/테이블/쿼리/스택 상세 절대 미노출 — 내부 로그만 남기고 일반 메시지 반환
|
||||
log.error("DB 오류", e);
|
||||
return ApiResponse.fail("ERR-MES-DB: 데이터 처리 중 오류가 발생했습니다");
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public ApiResponse<Void> handleRuntime(RuntimeException e) {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user