|
@@ -2,7 +2,6 @@ package cn.com.qmth.importpaper;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -27,17 +26,17 @@ public class ImportPropByCourse {
|
|
|
private static Logger logger = LogManager.getLogger(ImportPropByCourse.class);
|
|
|
private final static String sourceDir = "d:/yunkai/";
|
|
|
|
|
|
-// private static String batch = "230517";
|
|
|
-// private static String host = "http://localhost:8008";
|
|
|
-// private static String rootOrgId = "149";
|
|
|
-// private static String key = "U_C_149_170";
|
|
|
-// private static String token = "cac2f518a68346fe860fcb8a616bb458";
|
|
|
+ private static String batch = "230821";
|
|
|
|
|
|
- private static String batch = "230517";
|
|
|
- private static String host = "http://192.168.1.249:8008";
|
|
|
- private static String rootOrgId = "17351";
|
|
|
- private static String key = "U_C_17351_646523";
|
|
|
- private static String token = "6537edc191d546349fd5a4cb9e74b94b";
|
|
|
+ private static String host = "http://localhost:8008";
|
|
|
+ private static String rootOrgId = "0";
|
|
|
+ private static String key = "$SS:C_0_8";
|
|
|
+ private static String token = "abf51dd054eb4192937d01904a1e966e";
|
|
|
+
|
|
|
+// private static String host = "http://192.168.1.249:8008";
|
|
|
+// private static String rootOrgId = "17351";
|
|
|
+// private static String key = "U_C_17351_646523";
|
|
|
+// private static String token = "6537edc191d546349fd5a4cb9e74b94b";
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
@@ -47,16 +46,15 @@ public class ImportPropByCourse {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
int num = 0;
|
|
|
- List<Course> cs = readSubject();
|
|
|
+// List<Course> cs = readSubject();
|
|
|
Map<String,ImportCourse> ics=readSubjectCodes();
|
|
|
- for (Course c : cs) {
|
|
|
- ImportCourse ic=ics.get(c.getCode());
|
|
|
- if(ic==null) {
|
|
|
+ for (ImportCourse ic : ics.values()) {
|
|
|
+ File file = new File(sourceDir + "/prop/" + ic.getSubjectCode() + ".json");
|
|
|
+ if(!file.exists()) {
|
|
|
continue;
|
|
|
}
|
|
|
Date n = new Date();
|
|
|
num++;
|
|
|
- File file = new File(sourceDir + "/prop/" + c.getId() + ".json");
|
|
|
try {
|
|
|
if (file.exists()) {
|
|
|
submit(ic, file);
|
|
@@ -84,7 +82,7 @@ public class ImportPropByCourse {
|
|
|
Map<String,ImportCourse> map=new HashMap<>();
|
|
|
XSSFWorkbook wb = null;
|
|
|
try {
|
|
|
- wb = new XSSFWorkbook(sourceDir + "subject_codes.xlsx");
|
|
|
+ wb = new XSSFWorkbook(sourceDir + "subject_info.xlsx");
|
|
|
XSSFSheet sheet = wb.getSheetAt(0);
|
|
|
int rows = sheet.getLastRowNum();
|
|
|
for (int i = 1; i <= rows; i++) {
|
|
@@ -117,36 +115,36 @@ public class ImportPropByCourse {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- private static List<Course> readSubject() {
|
|
|
- List<Course> list = new ArrayList<>();
|
|
|
- XSSFWorkbook wb = null;
|
|
|
- try {
|
|
|
- wb = new XSSFWorkbook(sourceDir + "subject.xlsx");
|
|
|
- XSSFSheet sheet = wb.getSheetAt(0);
|
|
|
- int rows = sheet.getLastRowNum();
|
|
|
- for (int i = 1; i <= rows; i++) {
|
|
|
- Course c = new Course();
|
|
|
- XSSFRow row = sheet.getRow(i);
|
|
|
- String id = row.getCell(0).getStringCellValue().trim();
|
|
|
- String name = row.getCell(1).getStringCellValue().trim();
|
|
|
- String code = row.getCell(2).getStringCellValue().trim();
|
|
|
- c.setId(Long.valueOf(id));
|
|
|
- c.setCode(code);
|
|
|
- c.setName(name);
|
|
|
- list.add(c);
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } finally {
|
|
|
- if (wb != null) {
|
|
|
- try {
|
|
|
- wb.close();
|
|
|
- } catch (IOException e) {
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return list;
|
|
|
- }
|
|
|
+// private static List<Course> readSubject() {
|
|
|
+// List<Course> list = new ArrayList<>();
|
|
|
+// XSSFWorkbook wb = null;
|
|
|
+// try {
|
|
|
+// wb = new XSSFWorkbook(sourceDir + "subject.xlsx");
|
|
|
+// XSSFSheet sheet = wb.getSheetAt(0);
|
|
|
+// int rows = sheet.getLastRowNum();
|
|
|
+// for (int i = 1; i <= rows; i++) {
|
|
|
+// Course c = new Course();
|
|
|
+// XSSFRow row = sheet.getRow(i);
|
|
|
+// String id = row.getCell(0).getStringCellValue().trim();
|
|
|
+// String name = row.getCell(1).getStringCellValue().trim();
|
|
|
+// String code = row.getCell(2).getStringCellValue().trim();
|
|
|
+// c.setId(Long.valueOf(id));
|
|
|
+// c.setCode(code);
|
|
|
+// c.setName(name);
|
|
|
+// list.add(c);
|
|
|
+// }
|
|
|
+// } catch (IOException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// } finally {
|
|
|
+// if (wb != null) {
|
|
|
+// try {
|
|
|
+// wb.close();
|
|
|
+// } catch (IOException e) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return list;
|
|
|
+// }
|
|
|
|
|
|
private static void submit(ImportCourse ic, File zfile) throws Exception {
|
|
|
List<String> cs=ic.getCourses().stream().map(e->e.getCode()).collect(Collectors.toList());
|