[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;
}
}

View File

@@ -91,7 +91,7 @@
<p>[[${child.itemName}]]</p>
<span>
<span>[[${child.workName}]]</span>
<span>총 [[${child.totalHour}]]시간</span>
<span>총 [[${@dailyUtil.getStringComma(child.totalHour)}]]시간</span>
</span>
</li>
</th:block>
@@ -109,9 +109,9 @@
<li>
<p>[[${child.equipmentName}]]</p>
<span th:if="${not #strings.isEmpty(child.ownedHours)}"
th:text="|총 ${#numbers.formatInteger(child.ownedHours, 1, 'COMMA')}시간|">총8시간</span>
th:text="|총 ${@dailyUtil.getStringComma(child.ownedHours)}시간|">총8시간</span>
<span th:if="${not #strings.isEmpty(child.leasedHours)}"
th:text="|총 ${#numbers.formatInteger(child.leasedHours, 1, 'COMMA')}시간|">총8시간</span>
th:text="|총 ${@dailyUtil.getStringComma(child.leasedHours)}시간|">총8시간</span>
</li>
</th:block>
</ul>

View File

@@ -76,7 +76,7 @@
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
<span th:text="|${@dailyUtil.getStringComma(item.quantity)}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.price)}">
<p>현금 </p>

View File

@@ -86,7 +86,7 @@
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
<span th:text="|${@dailyUtil.getStringComma(item.quantity)}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
<p>현물평가액</p>

View File

@@ -78,7 +78,7 @@
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
<span th:text="|${@dailyUtil.getStringComma(item.quantity)}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
<p>현물평가액</p>

View File

@@ -96,7 +96,7 @@
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
<span th:text="|${@dailyUtil.getStringComma(item.quantity)}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.price)}">
<p>현금 </p>

View File

@@ -68,11 +68,11 @@
<ul class="detail-list">
<li th:if="${not #strings.isEmpty(item.ownedHours)}">
<p>자가 사용시간</p>
<span th:text="|${item.ownedHours}시간|">0시간</span>
<span th:text="|${@dailyUtil.getStringComma(item.ownedHours)}시간|">0시간</span>
</li>
<li th:if="${not #strings.isEmpty(item.leasedHours)}">
<p>임차 사용시간</p>
<span th:text="|${item.leasedHours}시간|">0시간</span>
<span th:text="|${@dailyUtil.getStringComma(item.leasedHours)}시간|">0시간</span>
</li>
</ul>
</div>

View File

@@ -80,51 +80,51 @@
</li>
<li th:if="${not #strings.isEmpty(item.workLandArea)}">
<p>작업 면적</p>
<span th:text="|${item.workLandArea}${#strings.defaultString(item.areaUnitLabel,'')}|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.workLandArea)}${#strings.defaultString(item.areaUnitLabel,'')}|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.harvestQuantity)}">
<p>수확량</p>
<span th:text="|${item.harvestQuantity}${#strings.defaultString(item.harvestUnitLabel,'')}|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.harvestQuantity)}${#strings.defaultString(item.harvestUnitLabel,'')}|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.ownerTime)}">
<p>경영주 노동투입시간</p>
<span th:text="|${item.ownerTime}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.ownerTime)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.spouseTime)}">
<p>배우자 노동투입시간</p>
<span th:text="|${item.spouseTime}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.spouseTime)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.familyMHours)}">
<p>가족노동(남)</p>
<span th:text="|${item.familyMHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.familyMHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.familyFHours)}">
<p>가족노동(여)</p>
<span th:text="|${item.familyFHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.familyFHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.hiredMHours)}">
<p>고용노동(남)</p>
<span th:text="|${item.hiredMHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.hiredMHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.hiredFHours)}">
<p>고용노동(여)</p>
<span th:text="|${item.hiredFHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.hiredFHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.sharedMHours)}">
<p>품앗이(남)</p>
<span th:text="|${item.sharedMHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.sharedMHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.sharedFHours)}">
<p>품앗이(여)</p>
<span th:text="|${item.sharedFHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.sharedFHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.volunteerMHours)}">
<p>일손돕기(남)</p>
<span th:text="|${item.volunteerMHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.volunteerMHours)}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.volunteerFHours)}">
<p>일손돕기(여)</p>
<span th:text="|${item.volunteerFHours}시간|"></span>
<span th:text="|${@dailyUtil.getStringComma(item.volunteerFHours)}시간|"></span>
</li>
</ul>
</div>