[FO] 일계부 소수점 포함된 숫자 데이터에 getStringComma 추가

This commit is contained in:
김현주
2025-06-26 15:06:11 +09:00
parent eda81b0bfa
commit f1eb2cd3f9
8 changed files with 46 additions and 21 deletions

View File

@@ -1,8 +1,11 @@
package app.module.core.config.application.util;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
@@ -10,6 +13,7 @@ import java.util.Locale;
@Slf4j
@Component
@RequiredArgsConstructor
public class DailyUtil {
/**
@@ -103,4 +107,25 @@ public class DailyUtil {
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate));
}
/**
* 문자형 타입의 숫자에 콤마 적용
*
* @param value 입력 데이터
* @return 숫자(콤마, 도트)
*/
public String getStringComma(String value) {
if (StringUtils.isBlank(value)) {
return value;
}
String[] values = value.split("\\.");
if (values.length > 1) {
Double input = Double.parseDouble(values[0]);
return new DecimalFormat("###,###").format(input) + "." + values[1];
}
return value;
}
}