|
|
@@ -95,4 +95,62 @@ public class TeacherFaceProcessServiceImpl extends MPJBaseServiceImpl<TeacherFac
|
|
|
public Boolean clearHistory(TeacherFaceProcess process) {
|
|
|
return this.baseMapper.clearHistory(process);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean removeByUserId(Long userId) {
|
|
|
+ List<TeacherFaceProcess> list = this.list(
|
|
|
+ new QueryWrapper<TeacherFaceProcess>().lambda()
|
|
|
+ .eq(TeacherFaceProcess::getUserId, userId)
|
|
|
+ );
|
|
|
+ ApiUtil apiUtil = new ApiUtil();
|
|
|
+ String apiPath = "/api/resource/v1/face/single/delete";
|
|
|
+ JsonParser parser = new JsonParser();
|
|
|
+ for (TeacherFaceProcess process : list) {
|
|
|
+ String studentHikvisionId = hikvisionDataMapper.getTeacherHikvisionId(process.getUserId());
|
|
|
+
|
|
|
+ String apiUrl = "/api/resource/v1/person/condition/personInfo";
|
|
|
+ JsonObject paramsJson = new JsonObject();
|
|
|
+ paramsJson.addProperty("paramName", "personId");
|
|
|
+ JsonArray array = new JsonArray();
|
|
|
+ array.add(studentHikvisionId);
|
|
|
+ paramsJson.add("paramValue", array);
|
|
|
+ String personInfoRes = apiUtil.doPost(apiUrl, paramsJson.toString(), null);
|
|
|
+ String faceId = null;
|
|
|
+ JsonObject personInfoData = parser.parse(personInfoRes).getAsJsonObject();
|
|
|
+ if ("0".equals(personInfoData.get("code").getAsString()) && "success".equals(personInfoData.get("msg").getAsString())) {
|
|
|
+ JsonObject dataJson = personInfoData.get("data").getAsJsonObject();
|
|
|
+ if (dataJson.get("total").getAsInt() > 0) {
|
|
|
+ JsonArray personPhoto = dataJson.get("list").getAsJsonArray().get(0)
|
|
|
+ .getAsJsonObject().get("personPhoto").getAsJsonArray();
|
|
|
+ if (personPhoto.size() > 0) {
|
|
|
+ faceId = personPhoto.get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ JsonObject paramJson = new JsonObject();
|
|
|
+ paramJson.addProperty("faceId", faceId);
|
|
|
+
|
|
|
+ String result = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
|
+ process.setExamStatus(2);
|
|
|
+ process.setHikvisionResult(result);
|
|
|
+ process.setDeleteMark(DeleteMark.DELETED.getCode());
|
|
|
+ process.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ process.setModifyDate(new Date());
|
|
|
+ this.baseMapper.updateById(process);
|
|
|
+
|
|
|
+ FaceManagement faceManagement = faceManagementService.getOne(
|
|
|
+ new QueryWrapper<FaceManagement>().lambda()
|
|
|
+ .eq(FaceManagement::getUserId, process.getUserId())
|
|
|
+ .eq(FaceManagement::getFileId, process.getFacePhoto())
|
|
|
+ );
|
|
|
+ if (faceManagement != null) {
|
|
|
+ faceManagement.setRegisterBase64(null);
|
|
|
+ faceManagementService.update(faceManagement);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|