Browse Source

缴费问题

java110 5 years ago
parent
commit
8abbedffe7

+ 12 - 0
java110-utils/src/main/java/com/java110/utils/util/StringUtil.java

@@ -272,6 +272,18 @@ public class StringUtil {
         }
     }
 
+    public static boolean isInteger(String str) {
+        try {
+            double value = Double.parseDouble(str);
+            if (value == Math.ceil(value)) {
+                return true;
+            }
+        } catch (Exception e) {
+            return false;
+        }
+
+        return false;
+    }
 
     /**
      * Description: 获得字符(byte)的实际长度<br>

+ 1 - 1
service-fee/src/main/java/com/java110/fee/listener/fee/UpdateFeeInfoListener.java

@@ -162,7 +162,7 @@ public class UpdateFeeInfoListener extends AbstractFeeBusinessServiceDataFlowLis
                     if (cycles > 0) {
                         Calendar endCalender = Calendar.getInstance();
                         endCalender.setTime(endTime);
-                        if (StringUtil.isNumber(cyclesStr)) {
+                        if (StringUtil.isInteger(cyclesStr)) {
                             endCalender.add(Calendar.MONTH, new Double(cycles).intValue());
                         } else {
                             int hours = new Double(cycles * DateUtil.getCurrentMonthDay() * 24).intValue();