|
@@ -5630,6 +5630,119 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//endregion
|
|
//endregion
|
|
|
return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
|
|
return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult updateSmartUserImageById(updateSmartUserImageRequest usur, BindingResult bindingResult) throws Exception {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ String st = paramUtils.getParamError(bindingResult);
|
|
|
|
|
+ return CommonResult.fail(st);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //region 参数判断
|
|
|
|
|
+ if (usur.getHeadImage() == null) {
|
|
|
|
|
+ return CommonResult.fail("学生人脸照片不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
|
|
+ int useXw = 1;
|
|
|
|
|
+ int useBs = 1;
|
|
|
|
|
+
|
|
|
|
|
+ //更新的同时将百胜用户信息同步过去或者同步过来?
|
|
|
|
|
+ SmartUser su = smartUserService.getSmartById(usur.getId());
|
|
|
|
|
+ if (su == null) {
|
|
|
|
|
+ return CommonResult.fail("用户数据已失效,修改失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Integer oldSchoolClass = su.getOldSchoolClass();
|
|
|
|
|
+ if (ObjectUtils.isEmpty(oldSchoolClass)) {
|
|
|
|
|
+ oldSchoolClass = su.getSchoolClass();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartClass classData = smartClassService.getSmartClassById(oldSchoolClass);
|
|
|
|
|
+ if(classData == null){
|
|
|
|
|
+ return CommonResult.fail("班级数据无效,更新失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ SmartGrade gradeData = smartGradeService.querySmartGradeById(su.getGrade() == null || su.getGrade() == "" ? null : Integer.valueOf(su.getGrade()));
|
|
|
|
|
+ if (gradeData == null) {
|
|
|
|
|
+ return CommonResult.fail("年级数据无效,更新失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
|
|
+
|
|
|
|
|
+ su.setHeadImage(usur.getHeadImage());
|
|
|
|
|
+
|
|
|
|
|
+ //region 更新希沃学生信息
|
|
|
|
|
+ if (useXw == 1) {
|
|
|
|
|
+ CommonResult updateStudent = SeewoUpdateStudent(seewoClient, su);
|
|
|
|
|
+ if (!updateStudent.isSuccess()) {
|
|
|
|
|
+ if (updateStudent.getMessage().contains("学生不存在")) {
|
|
|
|
|
+ CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, su.getName(), su.getCardNo(), su.getSexId(), su.getPhone(), classData.getClassUid());
|
|
|
|
|
+ if (!insertStudent.isSuccess()) {
|
|
|
|
|
+ return CommonResult.fail("希沃平台:" + insertStudent.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!su.getSchoolClass().equals(oldSchoolClass)) {
|
|
|
|
|
+ //获取班级Uid
|
|
|
|
|
+ SmartClass oldClassData = smartClassService.getSmartClassById(oldSchoolClass);
|
|
|
|
|
+ if (oldClassData == null) {
|
|
|
|
|
+ return CommonResult.fail("班级数据无效,更新失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ CommonResult changeClass = SeewoChangeClass(seewoClient, seewoConfig.getSchoolId(), su.getXwStudentUid(), oldClassData.getClassUid(), classData.getClassUid());
|
|
|
|
|
+ if (!changeClass.isSuccess()) {
|
|
|
|
|
+ return CommonResult.fail("希沃平台:" + changeClass.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //上传图片
|
|
|
|
|
+ List<PhotoServiceSavePhotosParam.ThirdSavePhotoQuery> photoList = new ArrayList<>();
|
|
|
|
|
+ PhotoServiceSavePhotosParam.ThirdSavePhotoQuery photo = new PhotoServiceSavePhotosParam.ThirdSavePhotoQuery();
|
|
|
|
|
+ photo.setPhotoUrl(su.getHeadImage());
|
|
|
|
|
+ photo.setUserCode(su.getCardNo());
|
|
|
|
|
+ photoList.add(photo);
|
|
|
|
|
+ CommonResult result = SeewoInsertBatchPhoto(seewoClient, photoList, eSeewoUserType.Student.getValue());
|
|
|
|
|
+ if (!result.isSuccess()) {
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
|
|
+ //region 更新百胜学生信息
|
|
|
|
|
+ if (useBs == 1) {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 学生数据的有效期是到毕业年份的8月31日
|
|
|
|
|
+ */
|
|
|
|
|
+ String startTime = TimeExchange.DateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ String endTime = queryGraduationYear(gradeData.getGradeNo());
|
|
|
|
|
+ CommonResult updateBsStudent = bsUpdateStudent(su, classData.getBsClassNo(), startTime, endTime);
|
|
|
|
|
+ if (!updateBsStudent.isSuccess()) {
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.fail("百胜平台:" + updateBsStudent.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
|
|
+ int result = smartUserService.updateSmartUser(su);
|
|
|
|
|
+// 修改需同步到海康平台
|
|
|
|
|
+ if (result > 0) {
|
|
|
|
|
+ Integer identityId = su.getIdentityId();
|
|
|
|
|
+ if (2 == identityId || identityId == 3) {
|
|
|
|
|
+ Integer id = su.getId();
|
|
|
|
|
+ SmartOperationUser smartOperationUser = new SmartOperationUser();
|
|
|
|
|
+ smartOperationUser.setOperationId(id);
|
|
|
|
|
+ smartOperationUser.setOperationMode("2");
|
|
|
|
|
+ smartOperationUser.setStatus(1);
|
|
|
|
|
+ smartOperationUser.setType(identityId);
|
|
|
|
|
+ smartOperationUserService.save(smartOperationUser);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
|
|
|
|
|
+ }
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 希沃增删改查方法
|
|
//region 希沃增删改查方法
|