Merge pull request '아마란스 결재문서 금액/수량 표시 오류 수정 (과학적 표기법 대응)' (#194) from V20260210 into main

Reviewed-on: #194
This commit was merged in pull request #194.
This commit is contained in:
2026-04-01 01:05:03 +00:00

View File

@@ -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("<tr>");
@@ -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();