|
|
@@ -38,6 +38,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -102,6 +103,9 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
@Autowired
|
|
|
private SmartAuthorityService smartAuthorityService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SmartFamilyIndexService smartFamilyIndexService;
|
|
|
+
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
|
public CommonResult logoffAccount(useridsRequest ur, BindingResult bindingResult) {
|
|
|
@@ -243,7 +247,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
SmartUser user = new SmartUser();
|
|
|
String name = dataFormatter.formatCellValue(row.getCell(4));
|
|
|
if (ObjectUtils.isEmpty(name)) {
|
|
|
- return CommonResult.fail("第" + (rowNum + 2) + "条数据的姓名不能为空");
|
|
|
+ return CommonResult.fail("第" + (rowNum + 1) + "条数据的姓名不能为空");
|
|
|
}
|
|
|
|
|
|
String schoolGrade = dataFormatter.formatCellValue(row.getCell(0));//年级
|
|
|
@@ -474,6 +478,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("导入失败");
|
|
|
}
|
|
|
|
|
|
+ List<SmartFamilyIndex> familyIndexs = new ArrayList<>();
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
if (useXw == 1) {
|
|
|
int num = (int) Math.ceil((double) studentDatas.size() / 100);
|
|
|
@@ -497,6 +502,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
|
|
|
int i = 0;
|
|
|
for (SmartUser parent : parentDatas) {
|
|
|
+ SmartFamilyIndex familyIndex = new SmartFamilyIndex();
|
|
|
+ familyIndex.setParentPhone(parent.getPhone());
|
|
|
+ familyIndex.setStudentNo(student.getCardNo());
|
|
|
+ familyIndex.setIndexData(i);
|
|
|
+ familyIndexs.add(familyIndex);
|
|
|
ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
|
|
|
.name(parent.getName())
|
|
|
.phone(parent.getPhone())
|
|
|
@@ -549,6 +559,12 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
}
|
|
|
//endregion
|
|
|
+ if (familyIndexs != null && familyIndexs.size() > 0) {
|
|
|
+ boolean insertBatch = smartFamilyIndexService.saveBatch(familyIndexs);
|
|
|
+ if (!insertBatch) {
|
|
|
+ return CommonResult.fail("导入失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -614,6 +630,87 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.ok("导入成功");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public CommonResult importExcelFamilys(MultipartFile excelFile) throws Exception {
|
|
|
+ //先解析excel如果excel不满足格式就提示错误信息 避免提前占用带宽上传头像
|
|
|
+ if (excelFile.isEmpty() || excelFile.getSize() == 0) {
|
|
|
+ return CommonResult.fail("压缩包中的excel文件不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String ContentType = excelFile.getContentType();
|
|
|
+ InputStream inputStream = excelFile.getInputStream();
|
|
|
+ List<SmartFamilyIndex> result = new ArrayList<>();
|
|
|
+ CommonResult<List<SmartFamilyIndex>> resultData = readFamilyXlsx(inputStream);
|
|
|
+ if (!resultData.isSuccess()) {
|
|
|
+ return resultData;
|
|
|
+ }
|
|
|
+ result = resultData.getData();
|
|
|
+
|
|
|
+ boolean insertBatch = smartFamilyIndexService.saveBatch(result);
|
|
|
+
|
|
|
+ return insertBatch ? CommonResult.ok("操作成功") : CommonResult.fail("操作失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Xlsx文件读取方法
|
|
|
+ *
|
|
|
+ * @param inputStream 文件流
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ private CommonResult<List<SmartFamilyIndex>> readFamilyXlsx(InputStream inputStream) throws IOException {
|
|
|
+ List<SmartFamilyIndex> result = new ArrayList<>();
|
|
|
+ XSSFWorkbook sheets = new XSSFWorkbook(inputStream);
|
|
|
+
|
|
|
+ //读取第一张sheet
|
|
|
+ XSSFSheet sheetAt = sheets.getSheetAt(0);
|
|
|
+
|
|
|
+ DataFormatter dataFormatter = new DataFormatter();
|
|
|
+ try {
|
|
|
+ for (int rowNum = 1; rowNum < sheetAt.getLastRowNum() + 1; rowNum++) {
|
|
|
+ XSSFRow row = sheetAt.getRow(rowNum);
|
|
|
+
|
|
|
+ if (row != null) {
|
|
|
+ //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
|
|
|
+ //所以先使用setCellType()方法先将该单元格的类型设置为STRING
|
|
|
+ //然后poi会根据字符串读取它
|
|
|
+ //标题 校验
|
|
|
+ if (rowNum < 3) {
|
|
|
+ //不做校验处理了
|
|
|
+ } else {
|
|
|
+ String cardNo = dataFormatter.formatCellValue(row.getCell(4));//学号
|
|
|
+ if (ObjectUtils.isEmpty(cardNo)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String phone1 = dataFormatter.formatCellValue(row.getCell(10));//手机号1
|
|
|
+ if (!ObjectUtils.isEmpty(phone1)) {
|
|
|
+ SmartFamilyIndex index = new SmartFamilyIndex();
|
|
|
+ index.setStudentNo(cardNo);
|
|
|
+ index.setParentPhone(phone1);
|
|
|
+ index.setIndexData(0);
|
|
|
+ result.add(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ String phone2 = dataFormatter.formatCellValue(row.getCell(12));//手机号1
|
|
|
+ if (!ObjectUtils.isEmpty(phone1)) {
|
|
|
+ SmartFamilyIndex index = new SmartFamilyIndex();
|
|
|
+ index.setStudentNo(cardNo);
|
|
|
+ index.setParentPhone(phone1);
|
|
|
+ index.setIndexData(1);
|
|
|
+ result.add(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return CommonResult.fail("请按模板格式导入数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ return CommonResult.ok(result);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
|
|
|
//region 批量更新用户
|
|
|
|
|
|
@@ -1171,8 +1268,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
} else {
|
|
|
SmartUser user = new SmartUser();
|
|
|
String name = dataFormatter.formatCellValue(row.getCell(3));
|
|
|
+// if (ObjectUtils.isEmpty(name)) {
|
|
|
+// return CommonResult.fail("第" + (rowNum + 1) + "条数据的名称不能为空");
|
|
|
+// }
|
|
|
if (ObjectUtils.isEmpty(name)) {
|
|
|
- return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
String schoolGrade = dataFormatter.formatCellValue(row.getCell(0));//年级
|
|
|
@@ -1454,8 +1554,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
} else {
|
|
|
SmartUser user = new SmartUser();
|
|
|
String name = dataFormatter.formatCellValue(row.getCell(3));
|
|
|
+// if (ObjectUtils.isEmpty(name)) {
|
|
|
+// return CommonResult.fail("第" + (rowNum + 1) + "条数据的名称不能为空");
|
|
|
+// }
|
|
|
if (ObjectUtils.isEmpty(name)) {
|
|
|
- return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
String schoolGrade = dataFormatter.formatCellValue(row.getCell(0));//年级
|
|
|
@@ -1822,7 +1925,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
if (useXw == 1) {
|
|
|
- CommonResult insertOrUpdateStudent = insertOrUpdateStudentParent(seewoClient, studentDatas, isur.getName(), isur.getPhone());
|
|
|
+ CommonResult insertOrUpdateStudent = insertOrUpdateStudentParent(seewoClient, studentDatas, isur.getName(), isur.getPhone(), true);
|
|
|
if (!insertOrUpdateStudent.isSuccess()) {
|
|
|
return CommonResult.fail(insertOrUpdateStudent.getMessage());
|
|
|
}
|
|
|
@@ -2067,7 +2170,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
if (useXw == 1) {
|
|
|
//学生与家长列表,最大100条
|
|
|
- CommonResult insertOrUpdateResult = insertOrUpdateStudentParent(seewoClient, studentDatas, usur.getName(), usur.getPhone());
|
|
|
+ CommonResult insertOrUpdateResult = insertOrUpdateStudentParent(seewoClient, studentDatas, usur.getName(), usur.getPhone(), false);
|
|
|
if (!insertOrUpdateResult.isSuccess()) {
|
|
|
return CommonResult.fail(insertOrUpdateResult.getMessage());
|
|
|
}
|
|
|
@@ -2136,7 +2239,12 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
if (useXw == 1) {
|
|
|
- CommonResult insertOrUpdate = insertOrUpdateStudentParent(seewoClient, studentDatas, su.getName(), su.getPhone());
|
|
|
+ List<SmartFamilyIndex> indexs = smartFamilyIndexService.querySmartFamilyByCardNo(su.getCardNo());
|
|
|
+ if (indexs != null && indexs.size() >= 4) {
|
|
|
+ return CommonResult.fail("绑定失败,希沃学生家长最多绑定四个家长");
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonResult insertOrUpdate = insertOrUpdateStudentParent(seewoClient, studentDatas, su.getName(), su.getPhone(), true);
|
|
|
if (!insertOrUpdate.isSuccess()) {
|
|
|
return CommonResult.fail(insertOrUpdate.getMessage());
|
|
|
}
|
|
|
@@ -2272,6 +2380,8 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
if (!deleteResult.isSuccess()) {
|
|
|
return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ smartFamilyIndexService.deleteSmartFamilyByPhone(su.getPhone());
|
|
|
}
|
|
|
//endregion
|
|
|
} else if (oldIdentity.intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
@@ -2369,6 +2479,8 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
if (!deleteOldShip.isSuccess()) {
|
|
|
return CommonResult.fail(deleteOldShip.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ smartFamilyIndexService.deleteSmartFamilyByPhone(su.getPhone());
|
|
|
}
|
|
|
//endregion
|
|
|
} else if (oldIdentity.intValue() == eIdentityStatu.Student.getValue()) {
|
|
|
@@ -2908,12 +3020,65 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//endregion
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
- public CommonResult insertOrUpdateStudentParent(SeewoClient
|
|
|
- seewoClient, List<SmartUser> studentDatas, String name, String phone) {
|
|
|
+ public CommonResult insertOrUpdateStudentParent(SeewoClient seewoClient, List<SmartUser> studentDatas, String name, String phone, boolean isInsert) {
|
|
|
+
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
//学生与家长列表,最大100条
|
|
|
List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
|
|
|
+ List<SmartFamilyIndex> insertIndexs = new ArrayList<>();
|
|
|
for (SmartUser student : studentDatas) {
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ if (isInsert) {
|
|
|
+ List<SmartFamilyIndex> indexs = smartFamilyIndexService.querySmartFamilyByCardNo(student.getCardNo());
|
|
|
+ if (indexs != null && indexs.size() >= 4) {
|
|
|
+ return CommonResult.fail("绑定失败,希沃学生家长最多绑定四个家长");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (indexs != null) {
|
|
|
+ for (SmartFamilyIndex data : indexs) {
|
|
|
+ if (data.getIndexData().intValue() == index && index < 3) {
|
|
|
+ index++;
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SmartFamilyIndex insertFamily = new SmartFamilyIndex();
|
|
|
+ insertFamily.setParentPhone(phone);
|
|
|
+ insertFamily.setStudentNo(student.getCardNo());
|
|
|
+ insertFamily.setIndexData(index);
|
|
|
+ insertIndexs.add(insertFamily);
|
|
|
+ } else {
|
|
|
+ SmartFamilyIndex familyIndex = smartFamilyIndexService.queryFamilyByPhoneCardNo(phone, student.getCardNo());
|
|
|
+ if (familyIndex == null) {
|
|
|
+ List<SmartFamilyIndex> indexs = smartFamilyIndexService.querySmartFamilyByCardNo(student.getCardNo());
|
|
|
+ if (indexs != null && indexs.size() >= 4) {
|
|
|
+ return CommonResult.fail("绑定失败,希沃学生家长最多绑定四个家长");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (indexs != null) {
|
|
|
+ for (SmartFamilyIndex data : indexs) {
|
|
|
+ if (data.getIndexData().intValue() == index && index < 3) {
|
|
|
+ index++;
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SmartFamilyIndex insertFamily = new SmartFamilyIndex();
|
|
|
+ insertFamily.setParentPhone(phone);
|
|
|
+ insertFamily.setStudentNo(student.getCardNo());
|
|
|
+ insertFamily.setIndexData(index);
|
|
|
+ insertIndexs.add(insertFamily);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
|
|
|
.studentCode(student.getCardNo())
|
|
|
.build();
|
|
|
@@ -2923,12 +3088,17 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem parents = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
|
|
|
.name(name)
|
|
|
.phone(phone)
|
|
|
- .index(0)
|
|
|
+ .index(index)
|
|
|
.build();
|
|
|
|
|
|
students.setParents(java.util.Collections.singletonList(parents));
|
|
|
}
|
|
|
|
|
|
+ if (insertIndexs != null && insertIndexs.size() > 0) {
|
|
|
+ smartFamilyIndexService.saveBatch(insertIndexs);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//初始化客户端
|
|
|
//SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
|
|
|
@@ -3190,6 +3360,17 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonResult testDeleteUserById(int userId) throws Exception {
|
|
|
+ SmartUser user = smartUserService.getSmartById(userId);
|
|
|
+
|
|
|
+ bsDeleteStudent(user);
|
|
|
+
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//region 百胜删除学生
|
|
|
public CommonResult bsDeleteStudent(SmartUser su) throws Exception {
|
|
|
//region 百胜删除学生
|
|
|
@@ -3342,9 +3523,9 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- BsControlVo result = objectMapper.readValue(bsResult, BsControlVo.class);
|
|
|
+ BsDeleteStudentVo result = objectMapper.readValue(bsResult, BsDeleteStudentVo.class);
|
|
|
|
|
|
- if (!bsResult.contains("删除成功")) {
|
|
|
+ if (!bsResult.contains("删除员工成功")) {
|
|
|
return CommonResult.fail(result.getMsg());
|
|
|
}
|
|
|
|
|
|
@@ -3716,6 +3897,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
} else if (user.getIdentityId().intValue() == eIdentityStatu.Student.getValue()) {
|
|
|
//查找家长
|
|
|
List<SmartUser> parents = smartUserService.getAffiliateList(user.getId());
|
|
|
@@ -3749,11 +3931,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
} else if (user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
- //获取班级Uid
|
|
|
- SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
- if (classData == null) {
|
|
|
- return CommonResult.fail("班级数据无效,更新失败");
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//region 希沃删除教师
|
|
|
CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, user.getPhone());
|
|
|
@@ -3762,12 +3940,25 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- //region 希沃删除班主任
|
|
|
- CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), user.getPhone());
|
|
|
- if (deleteTeacherMaster.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
+ if (user.getDuties().intValue() == eDuties.ClassTeacher.getValue()) {
|
|
|
+ if (user.getSchoolClass() == null) {
|
|
|
+ return CommonResult.fail("班级数据无效,删除失败");
|
|
|
+ }
|
|
|
+ //获取班级Uid
|
|
|
+ SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
+ if (classData == null) {
|
|
|
+ return CommonResult.fail("班级数据无效,删除失败");
|
|
|
+ }
|
|
|
+ //region 希沃删除班主任
|
|
|
+ if (user.getDuties().intValue() == eDuties.ClassTeacher.getValue()) {
|
|
|
+ CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), user.getPhone());
|
|
|
+ if (deleteTeacherMaster.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
}
|
|
|
- //endregion
|
|
|
+
|
|
|
|
|
|
//region 百胜删除教师
|
|
|
CommonResult bsDeleteTeacher = bsDeleteTeacher(user.getBsStaffCode());
|
|
|
@@ -3819,6 +4010,10 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
+ //删除家长 根据家长手机号删除下标数据
|
|
|
+ smartFamilyIndexService.deleteSmartFamilyByPhone(user.getPhone());
|
|
|
+
|
|
|
} else if (user.getIdentityId().intValue() == eIdentityStatu.Student.getValue()) {
|
|
|
//查找家长
|
|
|
List<SmartUser> parents = smartUserService.getAffiliateList(user.getId());
|
|
|
@@ -3860,42 +4055,51 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
+ //删除学生 根据学生学号删除下标数据
|
|
|
+ smartFamilyIndexService.deleteSmartFamilyByCardNo(user.getCardNo());
|
|
|
}
|
|
|
|
|
|
} else if (user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
- //获取班级Uid
|
|
|
- SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
- if (classData == null) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "班级数据无效,百胜删除学生失败;";
|
|
|
- deleteUser.setReason(reason);
|
|
|
- //return CommonResult.fail("班级数据无效,更新失败");
|
|
|
+
|
|
|
+ if (user.getDuties().intValue() == eDuties.ClassTeacher.getValue()) {
|
|
|
+ if(user.getSchoolClass() == null){
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "班级数据无效,希沃删除班主任失败;";
|
|
|
+ deleteUser.setReason(reason);
|
|
|
+ }else{
|
|
|
+ //获取班级Uid
|
|
|
+ SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
+ if (classData == null) {
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "班级数据无效,希沃删除教师失败;";
|
|
|
+ deleteUser.setReason(reason);
|
|
|
+ //return CommonResult.fail("班级数据无效,更新失败");
|
|
|
+ }
|
|
|
+ //region 希沃删除班主任
|
|
|
+ CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), user.getPhone());
|
|
|
+ if (!deleteTeacherMaster.isSuccess()) {
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除班主任失败;" + deleteTeacherMaster.getMessage() + ";";
|
|
|
+ deleteUser.setReason(reason);
|
|
|
+ //return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//region 希沃删除教师
|
|
|
CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, user.getPhone());
|
|
|
if (!deleteTeacher.isSuccess()) {
|
|
|
String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;" + deleteTeacher.getMessage() + ";";
|
|
|
- ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- //region 希沃删除班主任
|
|
|
- CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), user.getPhone());
|
|
|
- if (deleteTeacherMaster.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除班主任失败;" + deleteTeacherMaster.getMessage() + ";";
|
|
|
- ;
|
|
|
- deleteUser.setReason(reason);
|
|
|
- //return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
- }
|
|
|
- //endregion
|
|
|
|
|
|
//region 百胜删除教师
|
|
|
CommonResult bsDeleteTeacher = bsDeleteTeacher(user.getBsStaffCode());
|
|
|
if (!bsDeleteTeacher.isSuccess()) {
|
|
|
String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;" + bsDeleteTeacher.getMessage() + ";";
|
|
|
- ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(bsDeleteTeacher.getMessage());
|
|
|
}
|
|
|
@@ -4081,6 +4285,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("当前学生不存在,绑定失败!");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//判断是否已绑定过
|
|
|
if (parentUser.getAffiliate() == null) {
|
|
|
parentUser.setAffiliate(String.valueOf(studentUser.getId()));
|
|
|
@@ -4092,7 +4297,24 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("当前学生信息已绑定过,请勿重复操作!");
|
|
|
}
|
|
|
|
|
|
- parentUser.setAffiliate(parentUser.getAffiliate() + "," + String.valueOf(studentUser.getId()));
|
|
|
+ parentUser.setAffiliate(parentUser.getAffiliate() + "," + studentUser.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SmartFamilyIndex> indexs = smartFamilyIndexService.querySmartFamilyByCardNo(studentUser.getCardNo());
|
|
|
+ if (indexs != null && indexs.size() >= 4) {
|
|
|
+ return CommonResult.fail("绑定失败,希沃学生家长最多绑定四个家长");
|
|
|
+ }
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ if (indexs != null) {
|
|
|
+ for (SmartFamilyIndex data : indexs) {
|
|
|
+ if (data.getIndexData().intValue() == index && index < 3) {
|
|
|
+ index++;
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//region 新增希沃学生家长信息
|
|
|
@@ -4118,7 +4340,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem parents = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
|
|
|
.name(parentUser.getName())
|
|
|
.phone(parentUser.getPhone())
|
|
|
- .index(0)
|
|
|
+ .index(index)
|
|
|
.build();
|
|
|
studentParents.setParents(java.util.Collections.singletonList(parents));
|
|
|
param.setRequestBody(requestBody);
|
|
|
@@ -4170,13 +4392,13 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CommonResult queryClassUser(int userId) {
|
|
|
+ public CommonResult queryClassUser(int userId, String keyWord) {
|
|
|
SmartUser userData = smartUserService.getSmartById(userId);
|
|
|
if (userData == null) {
|
|
|
return CommonResult.fail("未查到用户信息,获取失败");
|
|
|
}
|
|
|
|
|
|
- if(userData.getSchoolClass() == null){
|
|
|
+ if (userData.getSchoolClass() == null) {
|
|
|
return CommonResult.fail("当前用户所在班级为空,获取失败");
|
|
|
}
|
|
|
|
|
|
@@ -4204,7 +4426,6 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
result.setClassId(userData.getSchoolClass());
|
|
|
result.setName(departmentStr);
|
|
|
List<ClassUserDetailVo> userDetails = new ArrayList<>();
|
|
|
-
|
|
|
//region 用户明细集合数据
|
|
|
List<SmartUser> users = smartUserService.queryUsersByClass(userData.getSchoolClass());
|
|
|
if (users != null && users.size() > 0) {
|
|
|
@@ -4213,15 +4434,22 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
ClassUserDetailVo userDetail = new ClassUserDetailVo();
|
|
|
userDetail.setId(user.getId());
|
|
|
userDetail.setName(user.getName());
|
|
|
+ userDetail.setCardNo(user.getCardNo());
|
|
|
Optional<SmartTimeGroup> timeGroup = timeGroups.stream().filter(e -> e.getId().equals(user.getTimeGroupId())).findFirst();
|
|
|
if (timeGroup != null && timeGroup.isPresent()) {
|
|
|
userDetail.setTimeGroup(timeGroup.get().getName());
|
|
|
}
|
|
|
userDetails.add(userDetail);
|
|
|
}
|
|
|
+
|
|
|
+ if (!ObjectUtils.isEmpty(keyWord)) {
|
|
|
+ userDetails = userDetails.stream().filter(e -> (e.getName() != null && e.getName().contains(keyWord)) || (e.getTimeGroup() != null && e.getTimeGroup().contains(keyWord))).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
+
|
|
|
result.setUserDetails(userDetails);
|
|
|
|
|
|
return CommonResult.ok(result);
|