From c9e12200e153957e4d00d97f0121c23c124bd0fb Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 29 Mar 2024 20:46:08 +0800 Subject: [PATCH] fix --- .../main/java/com/iformall/utils/PriceUtilV2.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java b/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java index 0675e6167..dafa34afb 100644 --- a/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java +++ b/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java @@ -112,11 +112,11 @@ public class PriceUtilV2 { // 每次获取到最后一个数 numUnit = (int) (number % 10); if (numUnit > 0) { - if ((numIndex == 9) && (zeroSize >= 3)) { - sb.insert(0, CN_UPPER_MONETRAY_UNIT[6]); + if ((numIndex == 8) && (zeroSize >= 3)) { + sb.insert(0, CN_UPPER_MONETRAY_UNIT[7]); } - if ((numIndex == 13) && (zeroSize >= 3)) { - sb.insert(0, CN_UPPER_MONETRAY_UNIT[10]); + if ((numIndex == 12) && (zeroSize >= 3)) { + sb.insert(0, CN_UPPER_MONETRAY_UNIT[11]); } sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); sb.insert(0, CN_UPPER_NUMBER[numUnit]); @@ -127,11 +127,11 @@ public class PriceUtilV2 { if (!(getZero)) { sb.insert(0, CN_UPPER_NUMBER[numUnit]); } - if (numIndex == 2) { + if (numIndex == 3) { if (number > 0) { sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); } - } else if (((numIndex - 2) % 4 == 0) && (number % 1000 > 0)) { + } else if (((numIndex - 3) % 5 == 0) && (number % 1000 > 0)) { sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); } getZero = true; @@ -154,7 +154,7 @@ public class PriceUtilV2 { public static void main(String[] args) { //BigDecimal numberOfMoney = new BigDecimal(432342341231.906); //BigDecimal numberOfMoney = new BigDecimal(1500.100); - BigDecimal numberOfMoney = new BigDecimal(20000.000); + BigDecimal numberOfMoney = new BigDecimal(22200000020.109); System.out.println(numberOfMoney.toString()); System.out.println(number2CNMontrayUnit(numberOfMoney)); }