|
@@ -336,31 +336,34 @@ public class AcsService {
|
|
|
//教师添加或更新照片
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String teacherUpdateUserImage(String employeeNo, String photoUrl) throws Exception {
|
|
|
- try {
|
|
|
+ AdminUserDO user = userService.findUserByUserNumber(employeeNo);
|
|
|
+ if (photoUrl == null || photoUrl.trim().isEmpty()){//提交的为空,删除人脸
|
|
|
+ deleteFace(employeeNo);//考勤机里的
|
|
|
+ user.setPhotoUrl("");//同步更新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);
|
|
|
-
|
|
|
- AdminUserDO user = userService.findUserByUserNumber(employeeNo);
|
|
|
JsonArray userInfoArray = jsonObject
|
|
|
.getAsJsonObject("UserInfoSearch")
|
|
|
.getAsJsonArray("UserInfo");
|
|
|
+
|
|
|
if (userInfoArray != null) {
|
|
|
String msg = addFaceByUrl(employeeNo, photoUrl);
|
|
|
if (msg.contains("下发人脸成功") && msg.contains("但是有异常情况")) {
|
|
|
- return "更新照片失败,请检查照片大小";
|
|
|
+ return "更新照片失败,请检查照片大小";
|
|
|
} else {
|
|
|
- if (user!=null) {
|
|
|
+ if (user != null) {
|
|
|
user.setPhotoUrl(photoUrl);
|
|
|
userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
|
|
|
}
|
|
|
return "更新照片成功";
|
|
|
}
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ return "未找到该考勤用户信息";
|
|
|
}
|
|
|
- return "更新照片失败";
|
|
|
}
|
|
|
|
|
|
//批量导入用户信息
|