|
@@ -138,6 +138,14 @@ class HikvisionBaseDataTaskTest {
|
|
|
// selectResource(use);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void selectPerson(){
|
|
|
+ String sql = "SELECT * FROM xjr_user WHERE id IN (\n" +
|
|
|
+ "SELECT source_id FROM hikvision_data WHERE hikvision_id LIKE '%-%' AND table_name = 'base_teacher'\n" +
|
|
|
+ ")";
|
|
|
+ List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql, String[].class);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void testCarInsert() throws Exception {
|
|
|
outInRecordUtil.GetVehicleRecord(faceImportMapper);
|
|
@@ -290,26 +298,38 @@ class HikvisionBaseDataTaskTest {
|
|
|
void selecAllPersonById() throws SQLException {
|
|
|
String apiPath = "/api/resource/v2/person/advance/personList";
|
|
|
|
|
|
- String sql = "SELECT * FROM xjr_user WHERE id IN (" +
|
|
|
- " SELECT source_id FROM hikvision_data WHERE table_name IN( 'base_teacher','base_student')" +
|
|
|
- " AND hikvision_id LIKE '%-%'" +
|
|
|
- " )";
|
|
|
+ String sql = "SELECT t1.id, t1.name,t1.user_name,t2.dept_id FROM xjr_user t1\n" +
|
|
|
+ "INNER JOIN xjr_user_dept_relation t2 ON t1.id = t2.user_id\n" +
|
|
|
+ " WHERE t1.id IN (\n" +
|
|
|
+ "SELECT source_id FROM hikvision_data WHERE hikvision_id LIKE '%-%' AND table_name = 'base_teacher'\n" +
|
|
|
+ ")";
|
|
|
List<Map<String, Object>> maps = SqlRunnerAdapter.db().selectList(sql);
|
|
|
ApiUtil apiUtil = new ApiUtil();
|
|
|
- JsonObject jsonObject = new JsonObject();
|
|
|
- jsonObject.addProperty("pageNo", 1);
|
|
|
- jsonObject.addProperty("pageSize", 500);
|
|
|
- jsonObject.addProperty("personName", "彭兴玲");
|
|
|
- String result = apiUtil.doPost(apiPath, jsonObject.toString(), null, null);
|
|
|
- System.out.println(result);
|
|
|
|
|
|
+ Map<String, String> userInfoMap = new HashMap<>();
|
|
|
|
|
|
+ JsonParser parser = new JsonParser();
|
|
|
for (Map<String, Object> map : maps) {
|
|
|
String name = map.get("name").toString();
|
|
|
-
|
|
|
-
|
|
|
+ JsonObject jsonObject = new JsonObject();
|
|
|
+ jsonObject.addProperty("pageNo", 1);
|
|
|
+ jsonObject.addProperty("pageSize", 500);
|
|
|
+ jsonObject.addProperty("personName", name);
|
|
|
+ jsonObject.addProperty("orgIndexCodes", map.get("dept_id").toString());
|
|
|
+ String result = apiUtil.doPost(apiPath, jsonObject.toString(), null, null);
|
|
|
+ JsonObject asJsonObject = parser.parse(result).getAsJsonObject();
|
|
|
+ if("0".equals(asJsonObject.get("code").getAsString())){
|
|
|
+ JsonArray jsonArray = asJsonObject.get("data").getAsJsonObject().get("list").getAsJsonArray();
|
|
|
+ if(jsonArray.size() == 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JsonObject object = jsonArray.get(0).getAsJsonObject();
|
|
|
+ if(name.equals(object.get("personName").getAsString()) && map.get("user_name").toString().equals(object.get("jobNo").getAsString())){
|
|
|
+ userInfoMap.put(map.get("id").toString(), object.get("personId").getAsString());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ System.out.println(userInfoMap);
|
|
|
}
|
|
|
|
|
|
void selecAllPerson(Db db) throws SQLException {
|