xiatian 5 年之前
父节点
当前提交
6d5932f2f4

+ 0 - 147
src/main/java/cn/com/qmth/importpaper/ImportPaper.java

@@ -1,147 +0,0 @@
-package cn.com.qmth.importpaper;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import okhttp3.Response;
-
-public class ImportPaper {
-
-    private static Logger logger = LogManager.getLogger(ImportPaper.class);
-
-    private static String sourceDir = "C:\\Users\\chenken\\Desktop\\temp\\excelDir";
-
-    private static String sourceQuesDir = sourceDir + "\\quesDir\\";
-
-    private final static String url = "http://localhost:8008/api/ecs_ques/importDdCollegePaper";
-
-    private final static String rootOrgId = "7";
-
-    private final static String key = "U_C_7_56368";
-
-    private final static String token = "cafce76e5fae4cbba1fba6bb2e3838fc";
-
-    public static void main(String[] args) {
-        logger.debug("**********************导入开始");
-        Date start = new Date();
-        int errnum = 0;
-        int num = 0;
-        StringBuilder sb = new StringBuilder();
-        // String fname = null;
-        // File dir = new File(sourceDir);
-        // for (File f : dir.listFiles()) {
-        // fname = f.getName();
-        // if (!f.isDirectory() && fname.endsWith(".xlsx")) {
-        // num++;
-        // Date n = new Date();
-        // try {
-        // importCoursePaper(f);
-        // Date et = new Date();
-        // logger.debug("导入成功(" + num + "):" + fname + " 耗时:" + (et.getTime() -
-        // n.getTime()));
-        // } catch (Exception e) {
-        // errnum++;
-        // sb.append(fname).append(",");
-        // Date et = new Date();
-        // logger.error(
-        // "导入失败(" + num + "):" + fname + " 耗时:" + (et.getTime() - n.getTime())
-        // + " " + e.getMessage(),
-        // e);
-        // }
-        // }
-        // }
-
-        try {
-            importCoursePaper(new File("C:\\Users\\chenken\\Desktop\\temp\\excelDir\\F13020020.xlsx"));
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        Date end = new Date();
-        logger.debug("**********************导入结束  耗时:" + (end.getTime() - start.getTime()));
-
-        logger.debug("**********************导入出错数:" + errnum);
-        logger.debug("**********************导入出错课程:" + sb.toString());
-    }
-
-    private static void importCoursePaper(File file) throws Exception {
-        File zfile = new File(sourceDir + "\\" + file.getName().split("\\.")[0] + ".zip");
-        try {
-            if (zfile.exists()) {
-                zfile.delete();
-            }
-            createZip(file, zfile);
-            submitZip(zfile);
-        } finally {
-            if (zfile.exists()) {
-                zfile.delete();
-            }
-        }
-    }
-
-    private static void createZip(File file, File zfile) throws Exception {
-
-        XSSFWorkbook wb = null;
-        try {
-            wb = new XSSFWorkbook(file);
-            int num = wb.getNumberOfSheets();
-            if (num == 1) {
-                throw new Exception("没有试卷信息:" + file.getName());
-            }
-            Set<String> ques = new HashSet<String>();
-            for (int i = 1; i < num; i++) {
-                XSSFSheet sheet = wb.getSheetAt(i);
-                int rows = sheet.getLastRowNum();
-                for (int j = 1; j <= rows; j++) {
-                    XSSFRow row = sheet.getRow(j);
-                    ques.add(row.getCell(0).getStringCellValue());
-                }
-            }
-            List<File> files = new ArrayList<File>();
-            for (String s : ques) {
-                File f = new File(sourceQuesDir + s + ".txt");
-                files.add(f);
-            }
-            files.add(file);
-            FileUtil.doZip(files, zfile);
-        } finally {
-            if (wb != null) {
-                wb.close();
-            }
-        }
-    }
-
-    private static void submitZip(File zfile) throws Exception {
-        Map<String, String> params = Maps.newHashMap();
-        params.put("rootOrgId", rootOrgId);
-        Map<String, String> headers = Maps.newHashMap();
-        headers.put("key", key);
-        headers.put("token", token);
-        List<FormFilePart> fileList = Lists.newArrayList();
-        fileList.add(new FormFilePart("dataFile", zfile.getName(), zfile));
-        Response resp = null;
-        try {
-            resp = OKHttpUtil.call(HttpMethod.POST, url, headers, params, fileList);
-            if (resp.code() != 200) {
-                throw new Exception(zfile.getName() + ":body:" + resp.body().string());
-            }
-        } finally {
-            IOUtils.closeQuietly(resp);
-        }
-    }
-}

+ 148 - 0
src/main/java/cn/com/qmth/importpaper/ImportPaperByAllQues.java

@@ -0,0 +1,148 @@
+package cn.com.qmth.importpaper;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import okhttp3.Response;
+
+public class ImportPaperByAllQues {
+
+	private static Logger logger = LogManager.getLogger(ImportPaperByAllQues.class);
+
+	private static String sourceDir = "d:\\2020ddimport\\excelDir";
+
+	private static String sourceQuesDir = sourceDir + "\\quesDir\\";
+
+	private final static String url = "http://ecs-test.qmth.com.cn:8008/api/ecs_ques/importDdCollegePaper";
+
+	private final static String rootOrgId = "0";
+	
+	private final static String courseCode="CCC";
+
+	private final static String key = "U_C_0_8";
+
+	private final static String token = "5c595b0d450a4ab0b81e9f6aa0ec0d44";
+
+	public static void main(String[] args) {
+		logger.debug("**********************导入开始");
+		Date start = new Date();
+		int errnum = 0;
+		StringBuilder sb = new StringBuilder();
+//		int num = 0;
+//		String fname = null;
+//		File dir = new File(sourceDir);
+//		for (File f : dir.listFiles()) {
+//			fname = f.getName();
+//			if (!f.isDirectory() && fname.endsWith(".xlsx")) {
+//				num++;
+//				Date n = new Date();
+//				try {
+//					importCoursePaper(f);
+//					Date et = new Date();
+//					logger.debug("导入成功(" + num + "):" + fname + " 耗时:" + (et.getTime() - n.getTime()));
+//				} catch (Exception e) {
+//					errnum++;
+//					sb.append(fname).append(",");
+//					Date et = new Date();
+//					logger.error(
+//							"导入失败(" + num + "):" + fname + " 耗时:" + (et.getTime() - n.getTime()) + " " + e.getMessage(),
+//							e);
+//				}
+//			}
+//		}
+
+        try {
+            importCoursePaper(new File("d:\\2020ddimport\\excelDir\\AAAAA.11.15.xlsx"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+		Date end = new Date();
+		logger.debug("**********************导入结束  耗时:" + (end.getTime() - start.getTime()));
+
+		logger.debug("**********************导入出错数:" + errnum);
+		logger.debug("**********************导入出错课程:" + sb.toString());
+	}
+
+	private static void importCoursePaper(File file) throws Exception {
+		File zfile = new File(sourceDir + "\\" + (file.getName().substring(0, file.getName().lastIndexOf(".")))+ ".zip");
+		try {
+			if (zfile.exists()) {
+				zfile.delete();
+			}
+			createZip(file, zfile);
+			submitZip(zfile);
+		} finally {
+			if (zfile.exists()) {
+				zfile.delete();
+			}
+		}
+	}
+
+	private static void createZip(File file, File zfile) throws Exception {
+
+		XSSFWorkbook wb = null;
+		try {
+			wb = new XSSFWorkbook(file);
+			int num = wb.getNumberOfSheets();
+			if (num == 1) {
+				throw new Exception("没有试卷信息:" + file.getName());
+			}
+			Set<String> ques = new HashSet<String>();
+			for (int i = 1; i < num; i++) {
+				XSSFSheet sheet = wb.getSheetAt(i);
+				int rows = sheet.getLastRowNum();
+				for (int j = 1; j <= rows; j++) {
+					XSSFRow row = sheet.getRow(j);
+					ques.add(row.getCell(0).getStringCellValue());
+				}
+			}
+			List<File> files = new ArrayList<File>();
+			for (String s : ques) {
+				File f = new File(sourceQuesDir + s + ".txt");
+				files.add(f);
+			}
+			files.add(file);
+			FileUtil.doZip(files, zfile);
+		} finally {
+			if (wb != null) {
+				wb.close();
+			}
+		}
+	}
+
+	private static void submitZip(File zfile) throws Exception {
+		Map<String, String> params = Maps.newHashMap();
+		params.put("rootOrgId", rootOrgId);
+		params.put("courseCode", courseCode);
+		Map<String, String> headers = Maps.newHashMap();
+		headers.put("key", key);
+		headers.put("token", token);
+		List<FormFilePart> fileList = Lists.newArrayList();
+		fileList.add(new FormFilePart("dataFile", zfile.getName(), zfile));
+		Response resp = null;
+		try {
+			resp = OKHttpUtil.call(HttpMethod.POST, url, headers, params, fileList);
+			if (resp.code() != 200) {
+				throw new Exception(zfile.getName() + ":body:" + resp.body().string());
+			}
+		} finally {
+			IOUtils.closeQuietly(resp);
+		}
+	}
+}

+ 146 - 0
src/main/java/cn/com/qmth/importpaper/ImportPaperByCourse.java

@@ -0,0 +1,146 @@
+package cn.com.qmth.importpaper;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import okhttp3.Response;
+
+public class ImportPaperByCourse {
+
+	private static Logger logger = LogManager.getLogger(ImportPaperByCourse.class);
+
+	private static String sourceDir = "d:\\2020ddimport\\excelDir";
+
+	private static String sourceQuesDir = sourceDir + "\\quesDir\\";
+
+	private final static String url = "http://ecs-test.qmth.com.cn:8008/api/ecs_ques/importDdCollegePaper";
+
+	private final static String rootOrgId = "0";
+	
+	private final static String key = "U_C_0_8";
+
+	private final static String token = "5c595b0d450a4ab0b81e9f6aa0ec0d44";
+
+	public static void main(String[] args) {
+		logger.debug("**********************导入开始");
+		Date start = new Date();
+		int errnum = 0;
+		StringBuilder sb = new StringBuilder();
+		int num = 0;
+		String fname = null;
+		File dir = new File(sourceDir);
+		for (File f : dir.listFiles()) {
+			fname = f.getName();
+			if (!f.isDirectory() && fname.endsWith(".xlsx")) {
+				num++;
+				Date n = new Date();
+				try {
+					importCoursePaper(f);
+					Date et = new Date();
+					logger.debug("导入成功(" + num + "):" + fname + " 耗时:" + (et.getTime() - n.getTime()));
+				} catch (Exception e) {
+					errnum++;
+					sb.append(fname).append(",");
+					Date et = new Date();
+					logger.error(
+							"导入失败(" + num + "):" + fname + " 耗时:" + (et.getTime() - n.getTime()) + " " + e.getMessage(),
+							e);
+				}
+			}
+		}
+
+//        try {
+//            importCoursePaper(new File("d:\\2020ddimport\\excelDir\\AAAAA.xlsx"));
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+
+		Date end = new Date();
+		logger.debug("**********************导入结束  耗时:" + (end.getTime() - start.getTime()));
+
+		logger.debug("**********************导入出错数:" + errnum);
+		logger.debug("**********************导入出错课程:" + sb.toString());
+	}
+
+	private static void importCoursePaper(File file) throws Exception {
+		File zfile = new File(sourceDir + "\\" + (file.getName().substring(0, file.getName().lastIndexOf(".")))+ ".zip");
+		try {
+			if (zfile.exists()) {
+				zfile.delete();
+			}
+			createZip(file, zfile);
+			submitZip(zfile);
+		} finally {
+			if (zfile.exists()) {
+				zfile.delete();
+			}
+		}
+	}
+
+	private static void createZip(File file, File zfile) throws Exception {
+
+		XSSFWorkbook wb = null;
+		try {
+			wb = new XSSFWorkbook(file);
+			int num = wb.getNumberOfSheets();
+			if (num == 1) {
+				throw new Exception("没有试卷信息:" + file.getName());
+			}
+			Set<String> ques = new HashSet<String>();
+			for (int i = 1; i < num; i++) {
+				XSSFSheet sheet = wb.getSheetAt(i);
+				int rows = sheet.getLastRowNum();
+				for (int j = 1; j <= rows; j++) {
+					XSSFRow row = sheet.getRow(j);
+					ques.add(row.getCell(0).getStringCellValue());
+				}
+			}
+			List<File> files = new ArrayList<File>();
+			for (String s : ques) {
+				File f = new File(sourceQuesDir + s + ".txt");
+				files.add(f);
+			}
+			files.add(file);
+			FileUtil.doZip(files, zfile);
+		} finally {
+			if (wb != null) {
+				wb.close();
+			}
+		}
+	}
+
+	private static void submitZip(File zfile) throws Exception {
+		Map<String, String> params = Maps.newHashMap();
+		params.put("rootOrgId", rootOrgId);
+		params.put("courseCode", zfile.getName().split("\\.")[0]);
+		Map<String, String> headers = Maps.newHashMap();
+		headers.put("key", key);
+		headers.put("token", token);
+		List<FormFilePart> fileList = Lists.newArrayList();
+		fileList.add(new FormFilePart("dataFile", zfile.getName(), zfile));
+		Response resp = null;
+		try {
+			resp = OKHttpUtil.call(HttpMethod.POST, url, headers, params, fileList);
+			if (resp.code() != 200) {
+				throw new Exception(zfile.getName() + ":body:" + resp.body().string());
+			}
+		} finally {
+			IOUtils.closeQuietly(resp);
+		}
+	}
+}

+ 1 - 1
src/main/java/cn/com/qmth/importpaper/OKHttpUtil.java

@@ -74,7 +74,7 @@ public class OKHttpUtil {
 
 
 	static {
 	static {
 		okHttpClient = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS)
 		okHttpClient = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS)
-				.readTimeout(300, TimeUnit.SECONDS).build();
+				.readTimeout(1000, TimeUnit.SECONDS).build();
 	}
 	}
 
 
 	public static OkHttpClient getOkHttpClient() {
 	public static OkHttpClient getOkHttpClient() {

+ 0 - 285
src/main/java/cn/com/qmth/importpaper/Temp.java

@@ -1,285 +0,0 @@
-package cn.com.qmth.importpaper;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.io.FileUtils;
-
-import cn.com.qmth.S;
-import cn.com.qmth.multithread.ComputeConsumer;
-import cn.com.qmth.multithread.ComputeProducer;
-import cn.com.qmth.multithread.Consumer;
-
-public class Temp {
-
-//    public static String[] arr = { "a", "b", "c", "d", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
-//            "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
-    
-    public static String[] arr = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
-
-    public static void main(String[] args) {
-//        cre();
-    }
-    public static byte[] decodeValue(ByteBuffer bytes) {
-        int len = bytes.limit() - bytes.position();
-        byte[] bytes1 = new byte[len];
-        bytes.get(bytes1);
-        return bytes1;
-    }
-    public static boolean isUtf8(byte[] line) {
-        try {
-            byte[] tem=new String(line,"utf-8").getBytes("utf-8");
-            return Arrays.equals(tem, line);
-        } catch (UnsupportedEncodingException e) {
-            return false;
-        }
-    }
-    public static void cre() {
-        Set<String> set4 = word5();
-        File re = new File("d:\\word.txt");
-        if(re.exists()) {
-            re.delete();
-        }
-        try {
-            re.createNewFile();
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        try {
-            FileUtils.writeLines(re, set4, "\n", true);
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-    public static void dis() {
-        try {
-            File re = new File("d:\\ret.txt");
-            File unre = new File("d:\\unret.txt");
-            if (re.exists()) {
-                re.delete();
-            }
-            if (unre.exists()) {
-                unre.delete();
-            }
-            re.createNewFile();
-            unre.createNewFile();
-            ComputeProducer p = new ComputeProducer();
-            p.startDispose(ComputeConsumer.class, 20, null);
-            for (Consumer c : p.consumers) {
-                c.disposeOnEnd(re, unre);
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (InstantiationException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (IllegalAccessException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按1位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:57:31
-     */
-    public static Set<String> word1() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            set.add(l1);
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按2位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:57:31
-     */
-    public static Set<String> word2() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                String l2 = arr[j];
-                String result = l1 + l2;
-                set.add(result);
-            }
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按3位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:57:31
-     */
-    public static Set<String> word3() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                if (j != i) {
-                    String l2 = arr[j];
-                    for (int k = 0; k < arr.length; k++) {
-                        String l3 = arr[k];
-                        String result = l1 + l2 + l3;
-                        set.add(result);
-                    }
-                }
-            }
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按4位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:47:39
-     */
-    public static Set<String> word4() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                String l2 = arr[j];
-                for (int k = 0; k < arr.length; k++) {
-                    String l3 = arr[k];
-                    for (int m = 0; m < arr.length; m++) {
-                        String l4 = arr[m];
-                        String result = l1 + l2 + l3 + l4;
-                        set.add(result);
-                    }
-                }
-            }
-        }
-        return set;
-    }
-    /**
-     * @Description:26个纯字母不分大小写,按4位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:47:39
-     */
-    public static Set<String> word5() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                String l2 = arr[j];
-                for (int k = 0; k < arr.length; k++) {
-                    String l3 = arr[k];
-                    for (int m = 0; m < arr.length; m++) {
-                        String l4 = arr[m];
-                        for (int n = 0; n < arr.length; n++) {
-                            String l5 = arr[n];
-                            String result = l1 + l2 + l3 + l4+l5;
-                            set.add(result);
-                        }
-                    }
-                }
-            }
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按4位组合,不可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:57:31
-     */
-    public static Set<String> question2() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                if (j != i) {
-                    String l2 = arr[j];
-                    for (int k = 0; k < arr.length; k++) {
-                        if (k != i && k != j) {
-                            String l3 = arr[k];
-                            for (int m = 0; m < arr.length; m++) {
-                                if (m != i && m != j && m != k) {
-                                    String l4 = arr[m];
-                                    String result = l1 + l2 + l3 + l4;
-                                    set.add(result);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按5位组合,可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:47:39
-     */
-    public static Set<String> question3() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                String l2 = arr[j];
-                for (int k = 0; k < arr.length; k++) {
-                    String l3 = arr[k];
-                    for (int m = 0; m < arr.length; m++) {
-                        String l4 = arr[m];
-                        for (int n = 0; n < arr.length; n++) {
-                            String l5 = arr[n];
-                            String result = l1 + l2 + l3 + l4 + l5;
-                            set.add(result);
-                        }
-                    }
-                }
-            }
-        }
-        return set;
-    }
-
-    /**
-     * @Description:26个纯字母不分大小写,按5位组合,不可重复。求出各种组合结果
-     * @return
-     * @date: 2017年11月18日 下午1:57:31
-     */
-    public static Set<String> question4() {
-        Set<String> set = new HashSet<String>();
-        for (int i = 0; i < arr.length; i++) {
-            String l1 = arr[i];
-            for (int j = 0; j < arr.length; j++) {
-                if (j != i) {
-                    String l2 = arr[j];
-                    for (int k = 0; k < arr.length; k++) {
-                        if (k != i && k != j) {
-                            String l3 = arr[k];
-                            for (int m = 0; m < arr.length; m++) {
-                                if (m != i && m != j && m != k) {
-                                    String l4 = arr[m];
-                                    for (int n = 0; n < arr.length; n++) {
-                                        if (m != i && m != j && m != k) {
-                                            String l5 = arr[n];
-                                            String result = l1 + l2 + l3 + l4 + l5;
-                                            set.add(result);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return set;
-    }
-}

+ 0 - 172
src/main/java/cn/com/qmth/importpaper/Temp2.java

@@ -1,172 +0,0 @@
-package cn.com.qmth.importpaper;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.ParseException;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-
-public class Temp2 {
-
-    private final static String url1 = "https://checkapi.aliyun.com/check/checkdomain?";
-
-    private final static Pattern p = Pattern.compile("^[^a-z]*([a-z]*)(.*)$");
-
-    private final static String param = "&command=renew&token=Y55524d856a54264296cc7773dbb65292&ua=&currency=&site=&bid=&_csrf_token=&callback=jsonp_1589269263490_77956";
-
-    private final static int batchSize = 500000;
-
-    private final static int start = 68427;
-
-    private static int errTime = 0;
-    
-    private static int maxErrTime = 10;
-    
-    private static CloseableHttpClient client ;
-    private static RequestConfig defaultRequestConfig = RequestConfig.custom()
-            .setSocketTimeout(5000)
-            .setConnectTimeout(5000)
-            .setConnectionRequestTimeout(5000)
-            .build();
-    public static void main(String[] args) {
-        client = HttpClients.custom()
-                .setDefaultRequestConfig(defaultRequestConfig)
-                .build();
-        List<String> reList = new ArrayList<String>();
-        List<String> unreList = new ArrayList<String>();
-        int index = 0;
-        File re = new File("d:\\ret.txt");
-        File unre = new File("d:\\unret.txt");
-        try {
-            if (re.exists()) {
-                re.delete();
-            }
-            if (unre.exists()) {
-                unre.delete();
-            }
-            re.createNewFile();
-            unre.createNewFile();
-            
-            Map<String, String> map = parse();
-            for (String k : map.keySet()) {
-                String dmain = k + ".com";
-                char c = getRet(dmain);
-                if (c == '1') {
-                    reList.add(k);
-                } else {
-                    unreList.add(k);
-                }
-                index++;
-                System.out.println("**************************index:" + index);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            System.out.println("**************************count:" + reList.size());
-            System.out.println("**************************un count:" + unreList.size());
-            System.out.println("**************************end index:" + (index + start));
-            try {
-                FileUtils.writeLines(re, reList);
-                FileUtils.writeLines(unre, unreList);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static char getRet(String dmain) {
-        try {
-            
-            String ret = getData(client, url1 + "domain=" + dmain + param);
-            char c = ret.charAt(ret.indexOf("\"avail\":") + 8);
-            errTime=0;
-            return c;
-        } catch (Exception e) {
-            errTime++;
-            if (errTime <= maxErrTime) {
-                client = HttpClients.custom()
-                        .setDefaultRequestConfig(defaultRequestConfig)
-                        .build();
-                return getRet(dmain);
-            } else {
-                throw new RuntimeException("error:" + e.getMessage());
-            }
-        }
-
-    }
-
-    public static Map<String, String> parse() throws IOException {
-        Map<String, String> map = new HashMap<String, String>();
-        List<String> list = readFile();
-        for (String s : list) {
-//            Matcher m = p.matcher(s);
-//            if (m.find()) {
-//                String k = m.group(1);
-//                String v = m.group(2);
-//                if (!"".equals(k)) {
-//                    map.put(k, v);
-//                }
-//            }
-            if (!"".equals(s)) {
-              map.put(s, s);
-            }
-        }
-        return map;
-    }
-
-    public static List<String> readFile() throws IOException {
-        int index = 0;
-        List<String> list = new ArrayList<String>();
-        FileInputStream fis = new FileInputStream("d:\\word.txt");
-        InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
-        BufferedReader br = new BufferedReader(isr);
-        String line = "";
-        while ((line = br.readLine()) != null) {
-            if (start <= index && index < start + batchSize) {
-                list.add(line.toLowerCase());
-            }
-            index++;
-        }
-        br.close();
-        isr.close();
-        fis.close();
-        return list;
-    }
-
-    public static String getData(CloseableHttpClient client, String url) {
-        HttpGet get = new HttpGet(url);
-        try {
-            CloseableHttpResponse response = client.execute(get);
-            int statusCode = response.getStatusLine().getStatusCode();
-            if (statusCode == 200) {
-                HttpEntity entity = response.getEntity();
-                String data = EntityUtils.toString(entity, "UTF-8");
-                return data;
-            }
-        } catch (ClientProtocolException e) {
-            e.printStackTrace();
-        } catch (ParseException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-}