|
@@ -166,9 +166,13 @@ public class StundentFaceProcessController {
|
|
|
@ApiOperation(value = "批量新增学生人脸")
|
|
@ApiOperation(value = "批量新增学生人脸")
|
|
|
@SaCheckPermission("stundentfaceprocess:batch-upload")
|
|
@SaCheckPermission("stundentfaceprocess:batch-upload")
|
|
|
public RT<Boolean> batchUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
|
public RT<Boolean> batchUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
List<BaseStudentUser> list = studentManagerService.list(
|
|
List<BaseStudentUser> list = studentManagerService.list(
|
|
|
new MPJLambdaWrapper<BaseStudentUser>().distinct()
|
|
new MPJLambdaWrapper<BaseStudentUser>().distinct()
|
|
|
.select(BaseStudentUser::getId)
|
|
.select(BaseStudentUser::getId)
|
|
|
|
|
+ .select(BaseStudentUser.class, user -> !user.getColumn().equals("avatar"))
|
|
|
.select(BaseStudentUser.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentUser.class).contains(x.getProperty()))
|
|
.select(BaseStudentUser.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentUser.class).contains(x.getProperty()))
|
|
|
.leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentUser::getId)
|
|
.leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentUser::getId)
|
|
|
.eq(BaseStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
.eq(BaseStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
@@ -196,6 +200,8 @@ public class StundentFaceProcessController {
|
|
|
|
|
|
|
|
List<FaceManagement> faceManagementList = faceManagementService.list(
|
|
List<FaceManagement> faceManagementList = faceManagementService.list(
|
|
|
new QueryWrapper<FaceManagement>().lambda()
|
|
new QueryWrapper<FaceManagement>().lambda()
|
|
|
|
|
+ .select(FaceManagement.class, face -> !face.getColumn().equals("registerBase64"))
|
|
|
|
|
+ .select(FaceManagement.class, face -> !face.getColumn().equals("register_base64"))
|
|
|
.eq(FaceManagement::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
.eq(FaceManagement::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
.eq(FaceManagement::getUserType, 2)
|
|
.eq(FaceManagement::getUserType, 2)
|
|
|
);
|
|
);
|
|
@@ -311,26 +317,31 @@ public class StundentFaceProcessController {
|
|
|
process.setFacePhoto(folderId);
|
|
process.setFacePhoto(folderId);
|
|
|
|
|
|
|
|
String faceId = null;
|
|
String faceId = null;
|
|
|
- if(process.getHikvisionResult() != null){
|
|
|
|
|
|
|
+ if(process.getHikvisionResult() != null && process.getHikvisionResult().startsWith("{") && process.getHikvisionResult().endsWith("}")){
|
|
|
JsonObject object = parser.parse(process.getHikvisionResult()).getAsJsonObject();
|
|
JsonObject object = parser.parse(process.getHikvisionResult()).getAsJsonObject();
|
|
|
if("0".equals(object.get("code").getAsString()) && "success".equals(object.get("msg").getAsString())){
|
|
if("0".equals(object.get("code").getAsString()) && "success".equals(object.get("msg").getAsString())){
|
|
|
faceId = object.get("data").getAsJsonObject().get("faceId").getAsString();
|
|
faceId = object.get("data").getAsJsonObject().get("faceId").getAsString();
|
|
|
- }else{//查询
|
|
|
|
|
- String apiUrl = "/api/resource/v1/person/condition/personInfo";
|
|
|
|
|
- JsonObject paramsJson = new JsonObject();
|
|
|
|
|
- paramsJson.addProperty("paramName", "personId");
|
|
|
|
|
- JsonArray array = new JsonArray();
|
|
|
|
|
- array.add(studentUser.getId());
|
|
|
|
|
- paramsJson.add("paramValue", array);
|
|
|
|
|
- String personInfoRes = apiUtil.doPost(apiUrl, paramsJson.toString(), null);
|
|
|
|
|
-
|
|
|
|
|
- JsonObject personInfoData = parser.parse(process.getHikvisionResult()).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){
|
|
|
|
|
- faceId = dataJson.get("list").getAsJsonArray().get(0)
|
|
|
|
|
- .getAsJsonObject().get("personPhoto").getAsJsonObject().get("personPhotoIndexCode").getAsString();
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(faceId == null){
|
|
|
|
|
+ String apiUrl = "/api/resource/v1/person/condition/personInfo";
|
|
|
|
|
+ JsonObject paramsJson = new JsonObject();
|
|
|
|
|
+ paramsJson.addProperty("paramName", "personId");
|
|
|
|
|
+ JsonArray array = new JsonArray();
|
|
|
|
|
+ array.add(studentUser.getId());
|
|
|
|
|
+ paramsJson.add("paramValue", array);
|
|
|
|
|
+ String personInfoRes = apiUtil.doPost(apiUrl, paramsJson.toString(), 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();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -339,19 +350,23 @@ public class StundentFaceProcessController {
|
|
|
JsonObject paramJson = new JsonObject();
|
|
JsonObject paramJson = new JsonObject();
|
|
|
String apiPath;
|
|
String apiPath;
|
|
|
if(faceId != null){
|
|
if(faceId != null){
|
|
|
- apiPath = "api/resource/v1/face/single/update";
|
|
|
|
|
|
|
+ apiPath = "/api/resource/v1/face/single/update";
|
|
|
paramJson.addProperty("faceId", faceId);
|
|
paramJson.addProperty("faceId", faceId);
|
|
|
paramJson.addProperty("faceData", base64String);
|
|
paramJson.addProperty("faceData", base64String);
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
- apiPath = "api/resource/v1/face/single/add";
|
|
|
|
|
|
|
+ apiPath = "/api/resource/v1/face/single/add";
|
|
|
paramJson.addProperty("personId", studentUser.getId());
|
|
paramJson.addProperty("personId", studentUser.getId());
|
|
|
paramJson.addProperty("faceData", base64String);
|
|
paramJson.addProperty("faceData", base64String);
|
|
|
}
|
|
}
|
|
|
String result = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
String result = apiUtil.doPost(apiPath, paramJson.toString(), null);
|
|
|
|
|
+ if(result.startsWith("{") && result.endsWith("}")){
|
|
|
|
|
+ JsonObject object = parser.parse(result).getAsJsonObject();
|
|
|
|
|
+ if("0".equals(object.get("code").getAsString()) && "success".equals(object.get("msg").getAsString())){
|
|
|
|
|
+ process.setHikvisionResult(result);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- process.setHikvisionResult(result);
|
|
|
|
|
stundentFaceProcessService.updateById(process);
|
|
stundentFaceProcessService.updateById(process);
|
|
|
|
|
|
|
|
FaceManagement faceManagement = faceManagementMap.get(studentUser.getId());
|
|
FaceManagement faceManagement = faceManagementMap.get(studentUser.getId());
|