diff --git a/src/com/pms/service/ApprovalService.java b/src/com/pms/service/ApprovalService.java index 892f45b..a1837f3 100644 --- a/src/com/pms/service/ApprovalService.java +++ b/src/com/pms/service/ApprovalService.java @@ -2272,7 +2272,14 @@ public class ApprovalService { for(int i = 0; i < itemList.size(); i++){ Map item = CommonUtils.toUpperCaseMapKey(itemList.get(i)); int qty = 0; - try { qty = Integer.parseInt(CommonUtils.checkNull(item.get("ORDER_QUANTITY"), "0")); } catch(Exception e){} + try { + Object qtyVal = item.get("ORDER_QUANTITY"); + if(qtyVal instanceof Number) { + qty = ((Number) qtyVal).intValue(); + } else { + qty = (int) Math.round(Double.parseDouble(CommonUtils.checkNull(qtyVal, "0"))); + } + } catch(Exception e){} totalQty += qty; String unitPrice = CommonUtils.checkNull(item.get("ORDER_UNIT_PRICE")); String itemSupply = CommonUtils.checkNull(item.get("ORDER_SUPPLY_PRICE")); @@ -2401,7 +2408,14 @@ public class ApprovalService { for(int i = 0; i < itemList.size(); i++){ Map item = CommonUtils.toUpperCaseMapKey(itemList.get(i)); int qty = 0; - try { qty = Integer.parseInt(CommonUtils.checkNull(item.get("ORDER_QUANTITY"), "0")); } catch(Exception e){} + try { + Object qtyVal = item.get("ORDER_QUANTITY"); + if(qtyVal instanceof Number) { + qty = ((Number) qtyVal).intValue(); + } else { + qty = (int) Math.round(Double.parseDouble(CommonUtils.checkNull(qtyVal, "0"))); + } + } catch(Exception e){} totalQty += qty; html.append(""); @@ -3594,10 +3608,15 @@ public class ApprovalService { /** * 숫자 천단위 콤마 포맷 + * Number 타입(Double/BigDecimal 등)은 직접 변환하여 과학적 표기법(3.745E7) 문제 방지 */ private String formatNumber(Object value){ if(value == null) return "0"; try { + if(value instanceof Number) { + long num = Math.round(((Number) value).doubleValue()); + return String.format("%,d", num); + } String strVal = value.toString().replaceAll("[^0-9.\\-]", ""); if(strVal.isEmpty()) return "0"; if(strVal.contains(".")) { @@ -3610,16 +3629,22 @@ public class ApprovalService { return value.toString(); } } - + /** * 숫자 천단위 콤마 + 소수점 2자리 포맷 (단가, 합계용) + * Number 타입(Double/BigDecimal 등)은 직접 변환하여 과학적 표기법(3.745E7) 문제 방지 */ private String formatDecimalNumber(Object value){ if(value == null) return "0.00"; try { - String strVal = value.toString().replaceAll("[^0-9.\\-]", ""); - if(strVal.isEmpty()) return "0.00"; - double num = Double.parseDouble(strVal); + double num; + if(value instanceof Number) { + num = ((Number) value).doubleValue(); + } else { + String strVal = value.toString().replaceAll("[^0-9.\\-]", ""); + if(strVal.isEmpty()) return "0.00"; + num = Double.parseDouble(strVal); + } return String.format("%,.2f", num); } catch(Exception e){ return value.toString();