Răsfoiți Sursa

支付方式去除多余逗号

Qchen 2 ani în urmă
părinte
comite
e4a4aca3c7

+ 5 - 2
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java

@@ -88,8 +88,11 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
         for (InvAccountExcel record : records) {
             StringBuilder a = new StringBuilder();
             String[] split = record.getPayMethod().split(",");
-            for (String i : split) {
-                a.append(InvPayMethodEnum.getNameByCode(i)).append(",");
+            for (int i = 0; i < split.length; i++) {
+                a.append(InvPayMethodEnum.getNameByCode(split[i]));
+                if (i < split.length - 1) {
+                    a.append(",");
+                }
             }
             record.setPayMethod(a.toString());
         }

+ 5 - 2
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -83,8 +83,11 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
             StringBuilder a = new StringBuilder();
             if (record.getPayMethod() != null) {
                 String[] split = record.getPayMethod().split(",");
-                for (String i : split) {
-                    a.append(InvPayMethodEnum.getNameByCode(i)).append(",");
+                for (int i = 0; i < split.length; i++) {
+                    a.append(InvPayMethodEnum.getNameByCode(split[i]));
+                    if (i < split.length - 1) {
+                        a.append(",");
+                    }
                 }
                 record.setPayMethod(a.toString());
             }

+ 5 - 2
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -262,8 +262,11 @@ public class EasyExcelUtils {
             String payMethod = excel.getPayMethod();
             String[] split = payMethod.split(",");
             StringBuilder a = new StringBuilder();
-            for (String i : split) {
-                a.append(InvPayMethodEnum.getNameByCode(i)).append(",");
+            for (int i = 0; i < split.length; i++) {
+                a.append(InvPayMethodEnum.getNameByCode(split[i]));
+                if (i < split.length - 1) {
+                    a.append(",");
+                }
             }
 
             StringBuilder stringBuffer = new StringBuilder();