|
@@ -1,11 +1,14 @@
|
|
|
package com.xjrsoft.module.job;
|
|
package com.xjrsoft.module.job;
|
|
|
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
+import com.google.gson.JsonArray;
|
|
|
|
|
+import com.google.gson.JsonElement;
|
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonObject;
|
|
|
import com.google.gson.JsonParser;
|
|
import com.google.gson.JsonParser;
|
|
|
import com.xjrsoft.XjrSoftApplication;
|
|
import com.xjrsoft.XjrSoftApplication;
|
|
|
import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
|
|
+import com.xjrsoft.module.hikvision.service.IHikvisionDataService;
|
|
|
import com.xjrsoft.module.hikvision.util.ApiUtil;
|
|
import com.xjrsoft.module.hikvision.util.ApiUtil;
|
|
|
import com.xjrsoft.module.personnel.entity.StundentFaceProcess;
|
|
import com.xjrsoft.module.personnel.entity.StundentFaceProcess;
|
|
|
import com.xjrsoft.module.personnel.service.IStundentFaceProcessService;
|
|
import com.xjrsoft.module.personnel.service.IStundentFaceProcessService;
|
|
@@ -29,36 +32,56 @@ class StudentDropOutTaskTest {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IStundentFaceProcessService stundentFaceProcessService;
|
|
private IStundentFaceProcessService stundentFaceProcessService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IHikvisionDataService hikvisionDataService;
|
|
|
|
|
+
|
|
|
@Test
|
|
@Test
|
|
|
void test(){
|
|
void test(){
|
|
|
- Long id = 1783747887750492160L;
|
|
|
|
|
|
|
+ Long id = 1783747887754686465L;
|
|
|
List<StundentFaceProcess> list = stundentFaceProcessService.list(
|
|
List<StundentFaceProcess> list = stundentFaceProcessService.list(
|
|
|
new MPJLambdaWrapper<StundentFaceProcess>()
|
|
new MPJLambdaWrapper<StundentFaceProcess>()
|
|
|
.select(StundentFaceProcess::getId)
|
|
.select(StundentFaceProcess::getId)
|
|
|
.select(StundentFaceProcess.class, x -> VoToColumnUtil.fieldsToColumns(StundentFaceProcess.class).contains(x.getProperty()))
|
|
.select(StundentFaceProcess.class, x -> VoToColumnUtil.fieldsToColumns(StundentFaceProcess.class).contains(x.getProperty()))
|
|
|
.innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, StundentFaceProcess::getUserId)
|
|
.innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, StundentFaceProcess::getUserId)
|
|
|
.ne(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901)
|
|
.ne(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901)
|
|
|
- .isNotNull(StundentFaceProcess::getHikvisionResult)
|
|
|
|
|
|
|
+ //.isNotNull(StundentFaceProcess::getHikvisionResult)
|
|
|
.eq(StundentFaceProcess::getUserId, id)
|
|
.eq(StundentFaceProcess::getUserId, id)
|
|
|
);
|
|
);
|
|
|
JsonParser parser = new JsonParser();
|
|
JsonParser parser = new JsonParser();
|
|
|
for (StundentFaceProcess user : list) {
|
|
for (StundentFaceProcess user : list) {
|
|
|
//删除海康人脸
|
|
//删除海康人脸
|
|
|
-
|
|
|
|
|
- JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
|
|
|
|
|
- if(!hikvisionResult.get("msg").isJsonNull() && !"success".equals(hikvisionResult.get("msg").getAsString())){
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- String faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
|
|
|
|
|
ApiUtil apiUtil = new ApiUtil();
|
|
ApiUtil apiUtil = new ApiUtil();
|
|
|
- String apiPath = "/api/resource/v1/face/single/delete";
|
|
|
|
|
- JsonObject paramJson = new JsonObject();
|
|
|
|
|
- paramJson.addProperty("faceId", faceId);
|
|
|
|
|
- String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
|
|
|
|
|
+ String apiPath;
|
|
|
|
|
+ String faceId = null;
|
|
|
|
|
+ JsonObject paramJson;
|
|
|
|
|
+ if(user.getHikvisionResult() == null || !user.getHikvisionResult().startsWith("{\"code\":\"0\",\"msg\":\"success\"")){
|
|
|
|
|
+ apiPath = "/api/resource/v1/person/condition/personInfo";
|
|
|
|
|
+ paramJson = new JsonObject();
|
|
|
|
|
+ paramJson.addProperty("paramName", "personId");
|
|
|
|
|
+ JsonArray paramValue = new JsonArray();
|
|
|
|
|
+ paramValue.add(hikvisionDataService.getHikvisionIdBySourceId(user.getUserId().toString()));
|
|
|
|
|
+ paramJson.add("paramValue", paramValue);
|
|
|
|
|
+ String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
|
|
|
+ JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
|
|
|
|
|
+ if(resultJson.get("code").getAsInt() == 0 && "success".equals(resultJson.get("msg").getAsString())){
|
|
|
|
|
+ JsonElement data = resultJson.get("data").getAsJsonObject().get("list").getAsJsonArray().get(0);
|
|
|
|
|
+ faceId = data.getAsJsonObject().get("personPhoto").getAsJsonArray().get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
|
|
|
|
|
+ faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(faceId != null){
|
|
|
|
|
+ apiPath = "/api/resource/v1/face/single/delete";
|
|
|
|
|
+ paramJson = new JsonObject();
|
|
|
|
|
+ paramJson.addProperty("faceId", faceId);
|
|
|
|
|
+ String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
|
|
|
|
|
|
- JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
|
|
|
|
|
- if(resultJson.get("code").getAsInt() == 0){
|
|
|
|
|
- stundentFaceProcessService.removeById(user);
|
|
|
|
|
|
|
+ JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
|
|
|
|
|
+ if(resultJson.get("code").getAsInt() == 0){
|
|
|
|
|
+ stundentFaceProcessService.removeById(user);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|