|
@@ -338,20 +338,20 @@ public class AcsService {
|
|
|
//教师添加或更新照片
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String teacherUpdateUserImage(String employeeNo, String photoUrl) throws Exception {
|
|
|
- AdminUserDO user = userService.findUserByUserNumber(employeeNo);
|
|
|
- if (photoUrl == null || photoUrl.trim().isEmpty()){//提交的为空,删除人脸
|
|
|
+ AdminUserDO user = userService.findUserByUserNumber(employeeNo);
|
|
|
+ String result = getUser(employeeNo);
|
|
|
+ Gson gson = new Gson();
|
|
|
+ JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
|
|
|
+ JsonArray userInfoArray = jsonObject
|
|
|
+ .getAsJsonObject("UserInfoSearch")
|
|
|
+ .getAsJsonArray("UserInfo");
|
|
|
+
|
|
|
+ if (photoUrl.trim().isEmpty()){//去除空格后为空,删除人脸
|
|
|
deleteFace(employeeNo);//考勤机里的
|
|
|
- user.setPhotoUrl("");//同步更新user表里的
|
|
|
- userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
|
|
|
+ user.setPhotoUrl(photoUrl.trim());//同步更新user表里的
|
|
|
+ userService.updateUser(BeanUtils.toBean(user, UserSaveReqVO.class));
|
|
|
return "删除照片成功";
|
|
|
}else {
|
|
|
- String result = getUser(employeeNo);
|
|
|
- Gson gson = new Gson();
|
|
|
- JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
|
|
|
- JsonArray userInfoArray = jsonObject
|
|
|
- .getAsJsonObject("UserInfoSearch")
|
|
|
- .getAsJsonArray("UserInfo");
|
|
|
-
|
|
|
if (userInfoArray != null) {
|
|
|
String msg = addFaceByUrl(employeeNo, photoUrl);
|
|
|
if (msg.contains("下发人脸成功") && msg.contains("但是有异常情况")) {
|
|
@@ -403,7 +403,7 @@ public class AcsService {
|
|
|
public imageImportRespVO importImages(MultipartFile file) throws Exception {
|
|
|
// 校验文件类型
|
|
|
if (!file.getOriginalFilename().endsWith(".zip")) {
|
|
|
- throw exception(UPLOADED_FOLDER_CANNOT_EMPTY);
|
|
|
+ throw exception(UPLOADED_FOLDER_NOT_ZIP);
|
|
|
}
|
|
|
// 创建临时目录存放解压后的文件
|
|
|
File tempDir = Files.createTempDirectory("user_images").toFile();
|