|
|
@@ -65,21 +65,23 @@ class HikvisionBaseDataTaskTest {
|
|
|
dataMap.put(table, tableData);
|
|
|
}
|
|
|
DataUtil dataUtil = new DataUtil();
|
|
|
+
|
|
|
+// deletePerson();
|
|
|
String tableName = "xjr_department";
|
|
|
-// Map<String, String> department = dataUtil.insertDepartment(use, tableName, dataMap.get(tableName));
|
|
|
-// if(department.isEmpty() && dataMap.get(tableName) != null){
|
|
|
-// department = dataMap.get(tableName);
|
|
|
-// }
|
|
|
+ Map<String, String> department = dataUtil.insertDepartment(use, tableName, dataMap.get(tableName));
|
|
|
+ if(department.isEmpty() && dataMap.get(tableName) != null){
|
|
|
+ department = dataMap.get(tableName);
|
|
|
+ }
|
|
|
//
|
|
|
-// //推送教职工
|
|
|
-// tableName = "base_teacher";
|
|
|
-// dataUtil.insertTeacher(use, tableName, dataMap.get(tableName), department);
|
|
|
+ //推送教职工
|
|
|
+ tableName = "base_teacher";
|
|
|
+ dataUtil.insertTeacher(use, tableName, dataMap.get(tableName), department);
|
|
|
//
|
|
|
//推送车辆
|
|
|
|
|
|
- String carTableName = "car_message_apply";
|
|
|
- Map<String, String> baseClass = dataMap.get(carTableName);
|
|
|
- dataUtil.insertCar(use, carTableName,baseClass, faceImportMapper);
|
|
|
+// String carTableName = "car_message_apply";
|
|
|
+// Map<String, String> baseClass = dataMap.get(carTableName);
|
|
|
+// dataUtil.insertCar(use, carTableName,baseClass, faceImportMapper);
|
|
|
|
|
|
// tableName = "base_class";
|
|
|
// Map<String, String> baseClass = dataMap.get(tableName);
|
|
|
@@ -98,7 +100,7 @@ class HikvisionBaseDataTaskTest {
|
|
|
|
|
|
|
|
|
// selecAllPersonById(use);
|
|
|
- selectResource(use);
|
|
|
+ selecAllPersonById(use);
|
|
|
}
|
|
|
|
|
|
public static void selectCar(Db db, String tableName) throws SQLException {
|
|
|
@@ -246,14 +248,30 @@ class HikvisionBaseDataTaskTest {
|
|
|
|
|
|
void selecAllPersonById(Db db) throws SQLException {
|
|
|
String apiPath = "/api/resource/v2/person/advance/personList";
|
|
|
- JsonObject jsonObject = new JsonObject();
|
|
|
- jsonObject.addProperty("pageNo", 1);
|
|
|
- jsonObject.addProperty("pageSize", 500);
|
|
|
- jsonObject.addProperty("personIds", "654321987655613");
|
|
|
|
|
|
|
|
|
+ Map<Long, String> map = new HashMap<>();
|
|
|
+ map.put(14954817043910L, "肖会春");map.put(14954817552454L, "苏平");map.put(14954818123205L, "刘瑞田");
|
|
|
+ map.put(14954818337094L, "王开兰");map.put(14954818837189L, "龚仁容");map.put(14954819407814L, "张洪梅");
|
|
|
+ map.put(14954819516102L, "袁夕芳");map.put(14954819746757L, "冯加林");map.put(14954820166213L, "张凤琴");
|
|
|
+ map.put(14954820362949L, "周家慧");map.put(14954820552390L, "龙运刚");map.put(14954820751429L, "张怀会");
|
|
|
+ map.put(14954825048006L, "李孝秋");map.put(14954802607430L, "王强");
|
|
|
ApiUtil apiUtil = new ApiUtil();
|
|
|
- String result = apiUtil.doPost(apiPath, jsonObject.toString(), null, null);
|
|
|
+ JsonParser parser = new JsonParser();
|
|
|
+ Map<Long, String> idMap = new HashMap<>();
|
|
|
+ for (Long id : map.keySet()) {
|
|
|
+ JsonObject jsonObject = new JsonObject();
|
|
|
+ jsonObject.addProperty("pageNo", 1);
|
|
|
+ jsonObject.addProperty("pageSize", 500);
|
|
|
+ jsonObject.addProperty("personName", map.get(id));
|
|
|
+ String result = apiUtil.doPost(apiPath, jsonObject.toString(), null, null);
|
|
|
+ JsonObject resultJson = parser.parse(result).getAsJsonObject();
|
|
|
+ JsonObject info = resultJson.get("data").getAsJsonObject().get("list").getAsJsonArray().get(0).getAsJsonObject();
|
|
|
+ String personId = info.get("personId").getAsString();
|
|
|
+ idMap.put(id, personId);
|
|
|
+ }
|
|
|
+ insertRecord(db, "base_teacher",idMap);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void selecAllPerson(Db db) throws SQLException {
|
|
|
@@ -329,4 +347,24 @@ class HikvisionBaseDataTaskTest {
|
|
|
System.out.println(result);
|
|
|
}
|
|
|
|
|
|
+ void deletePerson(){
|
|
|
+ String apiPath = "/api/resource/v1/person/batch/delete";
|
|
|
+ Map<Long, String> idMap = new HashMap<>();
|
|
|
+ JsonParser jsonParser = new JsonParser();
|
|
|
+ ApiUtil apiUtil = new ApiUtil();
|
|
|
+ JsonArray dataArray = new JsonArray();
|
|
|
+ dataArray.add("14954805813957");dataArray.add("14954812339909");dataArray.add("14954808977606");
|
|
|
+ dataArray.add("14954812285254");dataArray.add("14954812392774");dataArray.add("14954812448325");
|
|
|
+ dataArray.add("14954804711366");dataArray.add("15331003650245");dataArray.add("14954802607430");
|
|
|
+ dataArray.add("14954807016389");dataArray.add("14954803353286");dataArray.add("14954806910277");
|
|
|
+ dataArray.add("14954807016389");
|
|
|
+
|
|
|
+ JsonObject paramJson = new JsonObject();
|
|
|
+ paramJson.add("personIds", dataArray);
|
|
|
+ Map<String, String> headerMap = new HashMap<>();
|
|
|
+ headerMap.put("tagId", "deleteperson");
|
|
|
+ String result = apiUtil.doPost(apiPath, paramJson.toString(), null, headerMap);
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|