wangliang 1 سال پیش
والد
کامیت
b6cccce370
1فایلهای تغییر یافته به همراه35 افزوده شده و 0 حذف شده
  1. 35 0
      server/src/main/java/com/qmth/jkserver/controller/api/WpsController.java

+ 35 - 0
server/src/main/java/com/qmth/jkserver/controller/api/WpsController.java

@@ -45,6 +45,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.regex.Matcher;
@@ -657,4 +658,38 @@ public class WpsController extends BaseSystemController {
         // 判断是否包含中文字符
         return m.find();
     }
+
+//    public static void main(String[] args) throws IOException {
+//        File file = new File("/Users/king/Downloads/cet4.txt");
+//        byte[] bytes = IOUtils.toByteArray(new FileInputStream(file));
+//        String str = new String(bytes, SystemConstant.CHARSET_GBK);
+//        String[] strs = StringUtils.split(str, "\r\n");
+//        List<String> list = new ArrayList<>(Arrays.asList(strs));
+//        StringJoiner stringJoiner1 = new StringJoiner("\r\n");
+//        StringJoiner stringJoiner2 = new StringJoiner("\r\n");
+//        for (String s : list) {
+//            String[] temp1 = StringUtils.split(s, ",");
+//            String[] temp2 = StringUtils.split(s, ",");
+//            StringBuffer stringBuffer1 = new StringBuffer(temp1[0]);
+//            stringBuffer1.replace(0, 1, "4");
+//            temp1[0] = stringBuffer1.toString();
+//            stringJoiner1.add(StringUtils.join(temp1, ","));
+//
+//            StringBuffer stringBuffer2 = new StringBuffer(temp2[0]);
+//            stringBuffer2.replace(9, 10, "2");
+//            temp2[0] = stringBuffer2.toString();
+//            stringJoiner2.add(StringUtils.join(temp2, ","));
+//        }
+//        File file1 = new File("/Users/king/Downloads/cet4_1.txt");
+//        if (file1.exists()) {
+//            file1.createNewFile();
+//        }
+//        IOUtils.write(stringJoiner1.toString().getBytes(StandardCharsets.UTF_8), new FileOutputStream(file1));
+//
+//        File file2 = new File("/Users/king/Downloads/cet4_2.txt");
+//        if (file2.exists()) {
+//            file2.createNewFile();
+//        }
+//        IOUtils.write(stringJoiner2.toString().getBytes(StandardCharsets.UTF_8), new FileOutputStream(file2));
+//    }
 }