|
|
@@ -146,6 +146,9 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
public CommonResult importExcelUsers(MultipartFile excelFile, String headImage) throws Exception {
|
|
|
List<SmartUser> result = new ArrayList<>();
|
|
|
|
|
|
+ int useXw = 1;
|
|
|
+ int useBs = 0;
|
|
|
+
|
|
|
//先解析excel如果excel不满足格式就提示错误信息 避免提前占用带宽上传头像
|
|
|
if (excelFile.isEmpty() || excelFile.getSize() == 0) {
|
|
|
return CommonResult.fail("压缩包中的excel文件不能为空");
|
|
|
@@ -213,82 +216,86 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃新增学生信息
|
|
|
- //初始化客户端
|
|
|
- SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
- StudentServiceBatchSaveClassStudentsParam param = new StudentServiceBatchSaveClassStudentsParam();
|
|
|
- //请求体,MimeType为 application/json
|
|
|
- StudentServiceBatchSaveClassStudentsParam.JSONRequestBody requestBody = StudentServiceBatchSaveClassStudentsParam.JSONRequestBody.builder()
|
|
|
- .build();
|
|
|
- param.setRequestBody(requestBody);
|
|
|
- //查询条件
|
|
|
- StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery query = StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery.builder()
|
|
|
- .appId(seewoConfig.getAppId())
|
|
|
- .schoolUid(seewoConfig.getSchoolId())
|
|
|
- .classUid(classData.getClassUid())
|
|
|
- .build();
|
|
|
- requestBody.setQuery(query);
|
|
|
- // 学生列表
|
|
|
- StudentServiceBatchSaveClassStudentsParam.StudentInfo students = StudentServiceBatchSaveClassStudentsParam.StudentInfo.builder()
|
|
|
- .studentName(student.getName())
|
|
|
- .studentCode(student.getCardNo())
|
|
|
- .gender(student.getSexId())
|
|
|
- .phone(student.getPhone() == null ? "" : student.getPhone())
|
|
|
- .build();
|
|
|
- query.setStudents(java.util.Collections.singletonList(students));
|
|
|
- query.setInPlaceOld(false);// 是否删除旧学生再保存
|
|
|
- param.setRequestBody(requestBody);
|
|
|
- StudentServiceBatchSaveClassStudentsRequest request = new StudentServiceBatchSaveClassStudentsRequest(param);
|
|
|
- String jsonString = JSON.toJSONString(request);
|
|
|
- System.out.println("入参:" + request);
|
|
|
- //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
|
|
|
- //request.setServerUrl("https://openapi.test.seewo.com")
|
|
|
- //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
|
|
|
- StudentServiceBatchSaveClassStudentsResult studentResult = seewoClient.invoke(request);
|
|
|
- System.out.println("出参:" + studentResult);
|
|
|
-
|
|
|
- if (studentResult == null) {
|
|
|
- return CommonResult.fail("希沃学生数据新增失败!");
|
|
|
- }
|
|
|
+ if(useXw == 1){
|
|
|
+ //初始化客户端
|
|
|
+ SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
+ StudentServiceBatchSaveClassStudentsParam param = new StudentServiceBatchSaveClassStudentsParam();
|
|
|
+ //请求体,MimeType为 application/json
|
|
|
+ StudentServiceBatchSaveClassStudentsParam.JSONRequestBody requestBody = StudentServiceBatchSaveClassStudentsParam.JSONRequestBody.builder()
|
|
|
+ .build();
|
|
|
+ param.setRequestBody(requestBody);
|
|
|
+ //查询条件
|
|
|
+ StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery query = StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery.builder()
|
|
|
+ .appId(seewoConfig.getAppId())
|
|
|
+ .schoolUid(seewoConfig.getSchoolId())
|
|
|
+ .classUid(classData.getClassUid())
|
|
|
+ .build();
|
|
|
+ requestBody.setQuery(query);
|
|
|
+ // 学生列表
|
|
|
+ StudentServiceBatchSaveClassStudentsParam.StudentInfo students = StudentServiceBatchSaveClassStudentsParam.StudentInfo.builder()
|
|
|
+ .studentName(student.getName())
|
|
|
+ .studentCode(student.getCardNo())
|
|
|
+ .gender(student.getSexId())
|
|
|
+ .phone(student.getPhone() == null ? "" : student.getPhone())
|
|
|
+ .build();
|
|
|
+ query.setStudents(java.util.Collections.singletonList(students));
|
|
|
+ query.setInPlaceOld(false);// 是否删除旧学生再保存
|
|
|
+ param.setRequestBody(requestBody);
|
|
|
+ StudentServiceBatchSaveClassStudentsRequest request = new StudentServiceBatchSaveClassStudentsRequest(param);
|
|
|
+ String jsonString = JSON.toJSONString(request);
|
|
|
+ System.out.println("入参:" + request);
|
|
|
+ //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
|
|
|
+ //request.setServerUrl("https://openapi.test.seewo.com")
|
|
|
+ //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
|
|
|
+ StudentServiceBatchSaveClassStudentsResult studentResult = seewoClient.invoke(request);
|
|
|
+ System.out.println("出参:" + studentResult);
|
|
|
+
|
|
|
+ if (studentResult == null) {
|
|
|
+ return CommonResult.fail("希沃学生数据新增失败!");
|
|
|
+ }
|
|
|
|
|
|
- if (!studentResult.getResponseBody().getCode().equals("000000")) {
|
|
|
- return CommonResult.fail(studentResult.getResponseBody().getMessage());
|
|
|
- }
|
|
|
+ if (!studentResult.getResponseBody().getCode().equals("000000")) {
|
|
|
+ return CommonResult.fail(studentResult.getResponseBody().getMessage());
|
|
|
+ }
|
|
|
|
|
|
- student.setXwStudentUid(studentResult.getResponseBody().getData().get(0).getUserUid());
|
|
|
+ student.setXwStudentUid(studentResult.getResponseBody().getData().get(0).getUserUid());
|
|
|
+ }
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜新增学生信息
|
|
|
- String appId = controlConfig.getAppId();
|
|
|
- String schoolno = controlConfig.getSchoolCode();
|
|
|
- String timestamp = TimeExchange.DateNowTimeStamo();
|
|
|
- String appSecret = controlConfig.getAppSecret();
|
|
|
- String url = controlConfig.getUrl() + "student/create";
|
|
|
-
|
|
|
- JSONObject jsonobject = new JSONObject();
|
|
|
- jsonobject.put("appid", appId);
|
|
|
- String str = "{\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}";
|
|
|
- String aesStr = URLEncoder.encode(AesTestOne.encrypt(str, controlConfig.getAppSecret()), "UTF-8");
|
|
|
- jsonobject.put("data", aesStr);
|
|
|
- jsonobject.put("schoolno", schoolno);
|
|
|
- jsonobject.put("timestamp", timestamp);
|
|
|
-
|
|
|
- String md5Str = "appid=" + appId + "&data={\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}" + "&schoolno=" + schoolno + "×tamp=" + timestamp + "&key=" + appSecret;
|
|
|
- String sign = CommonUtil.MD5(md5Str);
|
|
|
- //sign签名
|
|
|
- jsonobject.put("sign", sign);
|
|
|
-
|
|
|
- //返回的结果中 code为1表示成功
|
|
|
- String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
|
|
|
-
|
|
|
- if (bsResult.contains("添加成功")) {
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- BsStudentVo grade = objectMapper.readValue(bsResult, BsStudentVo.class);
|
|
|
-
|
|
|
- // URL解码
|
|
|
- String decodedUrl = URLDecoder.decode(grade.getData(), "UTF-8");
|
|
|
-
|
|
|
- BsStudentNoVo studentNo = objectMapper.readValue(decrypt(decodedUrl, controlConfig.getAppSecret()), BsStudentNoVo.class);
|
|
|
- student.setBsStudentNo(studentNo.getStudent_no());
|
|
|
+ if(useBs == 1){
|
|
|
+ String appId = controlConfig.getAppId();
|
|
|
+ String schoolno = controlConfig.getSchoolCode();
|
|
|
+ String timestamp = TimeExchange.DateNowTimeStamo();
|
|
|
+ String appSecret = controlConfig.getAppSecret();
|
|
|
+ String url = controlConfig.getUrl() + "student/create";
|
|
|
+
|
|
|
+ JSONObject jsonobject = new JSONObject();
|
|
|
+ jsonobject.put("appid", appId);
|
|
|
+ String str = "{\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}";
|
|
|
+ String aesStr = URLEncoder.encode(AesTestOne.encrypt(str, controlConfig.getAppSecret()), "UTF-8");
|
|
|
+ jsonobject.put("data", aesStr);
|
|
|
+ jsonobject.put("schoolno", schoolno);
|
|
|
+ jsonobject.put("timestamp", timestamp);
|
|
|
+
|
|
|
+ String md5Str = "appid=" + appId + "&data={\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}" + "&schoolno=" + schoolno + "×tamp=" + timestamp + "&key=" + appSecret;
|
|
|
+ String sign = CommonUtil.MD5(md5Str);
|
|
|
+ //sign签名
|
|
|
+ jsonobject.put("sign", sign);
|
|
|
+
|
|
|
+ //返回的结果中 code为1表示成功
|
|
|
+ String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
|
|
|
+
|
|
|
+ if (bsResult.contains("添加成功")) {
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ BsStudentVo grade = objectMapper.readValue(bsResult, BsStudentVo.class);
|
|
|
+
|
|
|
+ // URL解码
|
|
|
+ String decodedUrl = URLDecoder.decode(grade.getData(), "UTF-8");
|
|
|
+
|
|
|
+ BsStudentNoVo studentNo = objectMapper.readValue(decrypt(decodedUrl, controlConfig.getAppSecret()), BsStudentNoVo.class);
|
|
|
+ student.setBsStudentNo(studentNo.getStudent_no());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -302,62 +309,65 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
- //学生与家长列表,最大100条
|
|
|
- List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
|
|
|
- for (SmartUser student : studentDatas) {
|
|
|
- ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
|
|
|
- .studentCode(student.getCardNo())
|
|
|
- .build();
|
|
|
- studentParents.add(students);
|
|
|
-
|
|
|
- List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(student.getCardNo())).collect(Collectors.toList());
|
|
|
- List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
|
|
|
- int i = 0;
|
|
|
- for (SmartUser parent : parentDatas) {
|
|
|
- ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
|
|
|
- .name(parent.getName())
|
|
|
- .phone(parent.getPhone())
|
|
|
- .index(i)
|
|
|
+ if(useXw == 1){
|
|
|
+ //学生与家长列表,最大100条
|
|
|
+ List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
|
|
|
+ for (SmartUser student : studentDatas) {
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
|
|
|
+ .studentCode(student.getCardNo())
|
|
|
.build();
|
|
|
- parents.add(data);
|
|
|
- ++i;
|
|
|
+ studentParents.add(students);
|
|
|
+
|
|
|
+ List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(student.getCardNo())).collect(Collectors.toList());
|
|
|
+ List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
|
|
|
+ int i = 0;
|
|
|
+ for (SmartUser parent : parentDatas) {
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
|
|
|
+ .name(parent.getName())
|
|
|
+ .phone(parent.getPhone())
|
|
|
+ .index(i)
|
|
|
+ .build();
|
|
|
+ parents.add(data);
|
|
|
+ ++i;
|
|
|
+ }
|
|
|
+ //家长列表,最多4个
|
|
|
+ students.setParents(parents);
|
|
|
}
|
|
|
- //家长列表,最多4个
|
|
|
- students.setParents(parents);
|
|
|
- }
|
|
|
-
|
|
|
- //初始化客户端
|
|
|
- SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
- ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
|
|
|
- //响应体,MimeType为 application/json
|
|
|
- ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
|
|
|
- .build();
|
|
|
- param.setRequestBody(requestBody);
|
|
|
- //query
|
|
|
- ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
|
|
|
- .appId(seewoConfig.getAppId())
|
|
|
- .schoolUid(seewoConfig.getSchoolId())
|
|
|
- .build();
|
|
|
- requestBody.setQuery(query);
|
|
|
- query.setStudentParents(studentParents);
|
|
|
- param.setRequestBody(requestBody);
|
|
|
- ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
|
|
|
- String jsonString = JSON.toJSONString(request);
|
|
|
- System.out.println("入参:" + request);
|
|
|
- //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
|
|
|
- //request.setServerUrl("https://openapi.test.seewo.com")
|
|
|
- //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
|
|
|
- ParentServiceBatchSaveOrUpdateParentsResult parentResult = seewoClient.invoke(request);
|
|
|
- System.out.println("出参:" + parentResult);
|
|
|
- //endregion
|
|
|
|
|
|
- if (parentResult == null) {
|
|
|
- return CommonResult.fail("希沃学生家长数据添加失败!");
|
|
|
- }
|
|
|
+ //初始化客户端
|
|
|
+ SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
|
|
|
+ //响应体,MimeType为 application/json
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
|
|
|
+ .build();
|
|
|
+ param.setRequestBody(requestBody);
|
|
|
+ //query
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
|
|
|
+ .appId(seewoConfig.getAppId())
|
|
|
+ .schoolUid(seewoConfig.getSchoolId())
|
|
|
+ .build();
|
|
|
+ requestBody.setQuery(query);
|
|
|
+ query.setStudentParents(studentParents);
|
|
|
+ param.setRequestBody(requestBody);
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
|
|
|
+ String jsonString = JSON.toJSONString(request);
|
|
|
+ System.out.println("入参:" + request);
|
|
|
+ //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
|
|
|
+ //request.setServerUrl("https://openapi.test.seewo.com")
|
|
|
+ //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
|
|
|
+ ParentServiceBatchSaveOrUpdateParentsResult parentResult = seewoClient.invoke(request);
|
|
|
+ System.out.println("出参:" + parentResult);
|
|
|
+
|
|
|
+
|
|
|
+ if (parentResult == null) {
|
|
|
+ return CommonResult.fail("希沃学生家长数据添加失败!");
|
|
|
+ }
|
|
|
|
|
|
- if (!parentResult.getResponseBody().getCode().equals("000000")) {
|
|
|
- return CommonResult.fail(parentResult.getResponseBody().getMessage());
|
|
|
+ if (!parentResult.getResponseBody().getCode().equals("000000")) {
|
|
|
+ return CommonResult.fail(parentResult.getResponseBody().getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
+ //endregion
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -1006,6 +1016,9 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail(st);
|
|
|
}
|
|
|
|
|
|
+ int useBs = 0;
|
|
|
+ int useXw = 1;
|
|
|
+
|
|
|
//重复性判断
|
|
|
int existCount = smartUserService.querySmartUserByCardNo(isur.getCardNo());
|
|
|
if (existCount > 0) {
|
|
|
@@ -1064,9 +1077,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
List<SmartUser> studentDatas = smartUserService.getSmartUserIds(isur.getAffiliate());
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
- CommonResult insertOrUpdateStudent = insertOrUpdateStudentParent(seewoClient, studentDatas, isur.getName(), isur.getPhone());
|
|
|
- if (!insertOrUpdateStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertOrUpdateStudent.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult insertOrUpdateStudent = insertOrUpdateStudentParent(seewoClient, studentDatas, isur.getName(), isur.getPhone());
|
|
|
+ if (!insertOrUpdateStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertOrUpdateStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -1089,20 +1104,24 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃新增学生信息
|
|
|
- CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, isur.getName(), isur.getCardNo(), isur.getSexId(), isur.getPhone(), classData.getClassUid());
|
|
|
- if (!insertStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertStudent.getMessage());
|
|
|
- }
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, isur.getName(), isur.getCardNo(), isur.getSexId(), isur.getPhone(), classData.getClassUid());
|
|
|
+ if (!insertStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertStudent.getMessage());
|
|
|
+ }
|
|
|
|
|
|
- su.setXwStudentUid(insertStudent.getData());
|
|
|
+ su.setXwStudentUid(insertStudent.getData());
|
|
|
+ }
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜新增学生信息
|
|
|
- CommonResult<String> insertBsStudent = bsInsertStudent(isur.getName(), isur.getCardNo(), isur.getSexId(), isur.getHeadImage(), isur.getTimeGroupId(), classData.getBsClassNo());
|
|
|
- if (!insertBsStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertBsStudent.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult<String> insertBsStudent = bsInsertStudent(isur.getName(), isur.getCardNo(), isur.getSexId(), isur.getHeadImage(), isur.getTimeGroupId(), classData.getBsClassNo());
|
|
|
+ if (!insertBsStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertBsStudent.getMessage());
|
|
|
+ }
|
|
|
+ su.setBsStudentNo(insertBsStudent.getData());
|
|
|
}
|
|
|
- su.setBsStudentNo(insertBsStudent.getData());
|
|
|
//endregion
|
|
|
|
|
|
} else if (isur.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {//老师
|
|
|
@@ -1118,11 +1137,13 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//endregion
|
|
|
|
|
|
//region 希沃添加教师数据
|
|
|
- CommonResult<String> insertTeacher = SeewoInsertTeacher(seewoClient, isur.getPhone(), isur.getName(), isur.getHeadImage());
|
|
|
- if (!insertTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(insertTeacher.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult<String> insertTeacher = SeewoInsertTeacher(seewoClient, isur.getPhone(), isur.getName(), isur.getHeadImage());
|
|
|
+ if (!insertTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertTeacher.getMessage());
|
|
|
+ }
|
|
|
+ su.setXwTeacherCode(insertTeacher.getData());
|
|
|
}
|
|
|
- su.setXwTeacherCode(insertTeacher.getData());
|
|
|
//endregion
|
|
|
|
|
|
if (isur.getDuties().intValue() == eDuties.ClassTeacher.getValue()) {
|
|
|
@@ -1133,9 +1154,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 将班主任推送到希沃
|
|
|
- CommonResult pushMaster = SeewoPushMaster(seewoClient, isur.getPhone(), classData.getClassUid());
|
|
|
- if (!pushMaster.isSuccess()) {
|
|
|
- return CommonResult.fail(pushMaster.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult pushMaster = SeewoPushMaster(seewoClient, isur.getPhone(), classData.getClassUid());
|
|
|
+ if (!pushMaster.isSuccess()) {
|
|
|
+ return CommonResult.fail(pushMaster.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
@@ -1150,11 +1173,13 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 百胜添加教师数据
|
|
|
- CommonResult<String> insertBsTeacher = bsInsertTeacher(su, departmentNo);
|
|
|
- if (!insertBsTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(insertBsTeacher.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult<String> insertBsTeacher = bsInsertTeacher(su, departmentNo);
|
|
|
+ if (!insertBsTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertBsTeacher.getMessage());
|
|
|
+ }
|
|
|
+ su.setBsStaffCode(insertBsTeacher.getData());
|
|
|
}
|
|
|
- su.setBsStaffCode(insertBsTeacher.getData());
|
|
|
//endregion
|
|
|
|
|
|
}
|
|
|
@@ -1183,6 +1208,9 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail(st);
|
|
|
}
|
|
|
|
|
|
+ int useXw = 1;
|
|
|
+ int useBs = 0;
|
|
|
+
|
|
|
//更新的同时将百胜用户信息同步过去或者同步过来?
|
|
|
SmartUser su = smartUserService.getSmartById(usur.getId());
|
|
|
if (su == null) {
|
|
|
@@ -1241,10 +1269,12 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
if (!changeIdentity) {
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
- //学生与家长列表,最大100条
|
|
|
- CommonResult insertOrUpdateResult = insertOrUpdateStudentParent(seewoClient, studentDatas, usur.getName(), usur.getPhone());
|
|
|
- if (!insertOrUpdateResult.isSuccess()) {
|
|
|
- return CommonResult.fail(insertOrUpdateResult.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ //学生与家长列表,最大100条
|
|
|
+ CommonResult insertOrUpdateResult = insertOrUpdateStudentParent(seewoClient, studentDatas, usur.getName(), usur.getPhone());
|
|
|
+ if (!insertOrUpdateResult.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertOrUpdateResult.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
} else {
|
|
|
@@ -1256,16 +1286,20 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("班级数据无效,更新失败");
|
|
|
}
|
|
|
|
|
|
- CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
- if (!deleteStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteStudent.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
+ if (!deleteStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜删除学生
|
|
|
- CommonResult deleteBsStudent = bsDeleteStudent(su);
|
|
|
- if (!deleteBsStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteBsStudent.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult deleteBsStudent = bsDeleteStudent(su);
|
|
|
+ if (!deleteBsStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteBsStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -1277,31 +1311,39 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃删除教师
|
|
|
- CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, su.getPhone());
|
|
|
- if (!deleteTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, su.getPhone());
|
|
|
+ if (!deleteTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 希沃删除班主任
|
|
|
- CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), su.getPhone());
|
|
|
- if (deleteTeacherMaster.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), su.getPhone());
|
|
|
+ if (deleteTeacherMaster.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜删除教师
|
|
|
- CommonResult bsDeleteTeacher = bsDeleteTeacher(oldStaffNo);
|
|
|
- if (!bsDeleteTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(bsDeleteTeacher.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult bsDeleteTeacher = bsDeleteTeacher(oldStaffNo);
|
|
|
+ if (!bsDeleteTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(bsDeleteTeacher.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
|
|
|
//region 希沃新增编辑学生家长信息
|
|
|
- CommonResult insertOrUpdate = insertOrUpdateStudentParent(seewoClient, studentDatas, su.getName(), su.getPhone());
|
|
|
- if (!insertOrUpdate.isSuccess()) {
|
|
|
- return CommonResult.fail(insertOrUpdate.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult insertOrUpdate = insertOrUpdateStudentParent(seewoClient, studentDatas, su.getName(), su.getPhone());
|
|
|
+ if (!insertOrUpdate.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertOrUpdate.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
@@ -1319,42 +1361,46 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
if (!changeIdentity) {
|
|
|
//region 更新希沃学生信息
|
|
|
- CommonResult updateStudent = SeewoUpdateStudent(seewoClient, su);
|
|
|
- if (!updateStudent.isSuccess()) {
|
|
|
- if (updateStudent.getMessage().equals("学生不存在")) {
|
|
|
- //获取班级Uid
|
|
|
- SmartClass classData = smartClassService.getSmartClassById(su.getSchoolClass());
|
|
|
- if (classData == null) {
|
|
|
- return CommonResult.fail("班级数据无效,更新失败");
|
|
|
- }
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult updateStudent = SeewoUpdateStudent(seewoClient, su);
|
|
|
+ if (!updateStudent.isSuccess()) {
|
|
|
+ if (updateStudent.getMessage().equals("学生不存在")) {
|
|
|
+ //获取班级Uid
|
|
|
+ SmartClass classData = smartClassService.getSmartClassById(su.getSchoolClass());
|
|
|
+ if (classData == null) {
|
|
|
+ return CommonResult.fail("班级数据无效,更新失败");
|
|
|
+ }
|
|
|
|
|
|
- CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, su.getName(), su.getCardNo(), su.getSexId(), su.getPhone(), classData.getClassUid());
|
|
|
- if (!insertStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertStudent.getMessage());
|
|
|
+ CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, su.getName(), su.getCardNo(), su.getSexId(), su.getPhone(), classData.getClassUid());
|
|
|
+ if (!insertStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
+ return CommonResult.fail(updateStudent.getMessage());
|
|
|
}
|
|
|
- return CommonResult.fail(updateStudent.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 更新百胜学生信息
|
|
|
- CommonResult updateBsStudent = bsUpdateStudent(su);
|
|
|
- if (!updateBsStudent.isSuccess()) {
|
|
|
- if (updateBsStudent.getMessage().equals("人员不存在或已删除")) {
|
|
|
- //获取班级Uid
|
|
|
- SmartClass classData = smartClassService.getSmartClassById(usur.getSchoolClass());
|
|
|
- if (classData == null) {
|
|
|
- return CommonResult.fail("班级数据无效,更新失败");
|
|
|
- }
|
|
|
- //region 百胜新增学生信息
|
|
|
- CommonResult<String> insertBsStudent = bsInsertStudent(usur.getName(), usur.getCardNo(), usur.getSexId(), usur.getHeadImage(), usur.getTimeGroupId(), classData.getBsClassNo());
|
|
|
- if (!insertBsStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertBsStudent.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult updateBsStudent = bsUpdateStudent(su);
|
|
|
+ if (!updateBsStudent.isSuccess()) {
|
|
|
+ if (updateBsStudent.getMessage().equals("人员不存在或已删除")) {
|
|
|
+ //获取班级Uid
|
|
|
+ SmartClass classData = smartClassService.getSmartClassById(usur.getSchoolClass());
|
|
|
+ if (classData == null) {
|
|
|
+ return CommonResult.fail("班级数据无效,更新失败");
|
|
|
+ }
|
|
|
+ //region 百胜新增学生信息
|
|
|
+ CommonResult<String> insertBsStudent = bsInsertStudent(usur.getName(), usur.getCardNo(), usur.getSexId(), usur.getHeadImage(), usur.getTimeGroupId(), classData.getBsClassNo());
|
|
|
+ if (!insertBsStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertBsStudent.getMessage());
|
|
|
+ }
|
|
|
+ su.setBsStudentNo(insertBsStudent.getData());
|
|
|
+ //endregion
|
|
|
+ } else {
|
|
|
+ return CommonResult.fail(updateBsStudent.getMessage());
|
|
|
}
|
|
|
- su.setBsStudentNo(insertBsStudent.getData());
|
|
|
- //endregion
|
|
|
- } else {
|
|
|
- return CommonResult.fail(updateBsStudent.getMessage());
|
|
|
}
|
|
|
}
|
|
|
//endregion
|
|
|
@@ -1367,29 +1413,33 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃新增学生信息
|
|
|
- CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, su.getName(), su.getCardNo(), su.getSexId(), su.getPhone(), classData.getClassUid());
|
|
|
- if (!insertStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(insertStudent.getMessage());
|
|
|
- } else {
|
|
|
- su.setXwStudentUid(insertStudent.getData());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult<String> insertStudent = SeewoInsertStudent(seewoClient, su.getName(), su.getCardNo(), su.getSexId(), su.getPhone(), classData.getClassUid());
|
|
|
+ if (!insertStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertStudent.getMessage());
|
|
|
+ } else {
|
|
|
+ su.setXwStudentUid(insertStudent.getData());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜新增学生信息
|
|
|
- CommonResult<String> insertBsStudent = bsInsertStudent(su.getName(), su.getCardNo(), su.getSexId(), su.getHeadImage(), su.getTimeGroupId(), classData.getBsClassNo());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult<String> insertBsStudent = bsInsertStudent(su.getName(), su.getCardNo(), su.getSexId(), su.getHeadImage(), su.getTimeGroupId(), classData.getBsClassNo());
|
|
|
|
|
|
- if (insertBsStudent.isSuccess()) {
|
|
|
- su.setBsStudentNo(insertBsStudent.getData());
|
|
|
- } else {
|
|
|
- //region 希沃删除学生
|
|
|
- //百胜数据插入失败后需要把已插入到希沃的数据删除
|
|
|
- CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
- if (!deleteStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteStudent.getMessage());
|
|
|
- }
|
|
|
- //endregion
|
|
|
+ if (insertBsStudent.isSuccess()) {
|
|
|
+ su.setBsStudentNo(insertBsStudent.getData());
|
|
|
+ } else {
|
|
|
+ //region 希沃删除学生
|
|
|
+ //百胜数据插入失败后需要把已插入到希沃的数据删除
|
|
|
+ CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
+ if (!deleteStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteStudent.getMessage());
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
|
|
|
- return CommonResult.fail("切换身份后," + insertBsStudent.getMessage() + ",百胜无法插入学生数据");
|
|
|
+ return CommonResult.fail("切换身份后," + insertBsStudent.getMessage() + ",百胜无法插入学生数据");
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -1397,10 +1447,12 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
List<SmartUser> studentDatas = smartUserService.getSmartUserIds(Arrays.asList(oldAffiliate.split(",")));
|
|
|
|
|
|
- //region 删除原有的家长关系
|
|
|
- CommonResult deleteResult = deleteOldParentShip(seewoClient, studentDatas, su.getPhone());
|
|
|
- if (!deleteResult.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteResult.getMessage());
|
|
|
+ //region 希沃删除原有的家长关系
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteResult = deleteOldParentShip(seewoClient, studentDatas, su.getPhone());
|
|
|
+ if (!deleteResult.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteResult.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
} else if (oldIdentity.intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
@@ -1411,23 +1463,29 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃删除教师
|
|
|
- CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, su.getPhone());
|
|
|
- if (!deleteTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, su.getPhone());
|
|
|
+ if (!deleteTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 希沃删除班主任
|
|
|
- CommonResult deleteMaster = SeewoDeleteTeacherMaster(seewoClient, oldClassData.getClassUid(), su.getPhone());
|
|
|
- if (!deleteMaster.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteMaster.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteMaster = SeewoDeleteTeacherMaster(seewoClient, oldClassData.getClassUid(), su.getPhone());
|
|
|
+ if (!deleteMaster.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteMaster.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜删除教师
|
|
|
- CommonResult deleteBsTeacher = bsDeleteTeacher(oldStaffNo);
|
|
|
- if (!deleteBsTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteBsTeacher.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult deleteBsTeacher = bsDeleteTeacher(oldStaffNo);
|
|
|
+ if (!deleteBsTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteBsTeacher.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
@@ -1436,11 +1494,13 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
} else if (usur.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {//教师
|
|
|
if (!changeIdentity) {
|
|
|
//region 希沃更新教师数据
|
|
|
- CommonResult<String> updateTeacher = SeewoUpdateTeacher(seewoClient, su.getPhone(), su.getName(), su.getHeadImage());
|
|
|
- if (!updateTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(updateTeacher.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult<String> updateTeacher = SeewoUpdateTeacher(seewoClient, su.getPhone(), su.getName(), su.getHeadImage());
|
|
|
+ if (!updateTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(updateTeacher.getMessage());
|
|
|
+ }
|
|
|
+ su.setXwTeacherCode(updateTeacher.getData());
|
|
|
}
|
|
|
- su.setXwTeacherCode(updateTeacher.getData());
|
|
|
//endregion
|
|
|
|
|
|
SmartDepartment departmentData = smartDepartmentService.getSmartById(su.getDepartmentId());
|
|
|
@@ -1454,22 +1514,26 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 百胜更新教师数据
|
|
|
- CommonResult<String> bsUpdateTeacher = updateBsTeacher(su, departmentNo);
|
|
|
- if (!bsUpdateTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(bsUpdateTeacher.getMessage());
|
|
|
- }
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult<String> bsUpdateTeacher = updateBsTeacher(su, departmentNo);
|
|
|
+ if (!bsUpdateTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(bsUpdateTeacher.getMessage());
|
|
|
+ }
|
|
|
|
|
|
- su.setBsStaffCode(bsUpdateTeacher.getData());
|
|
|
+ su.setBsStaffCode(bsUpdateTeacher.getData());
|
|
|
+ }
|
|
|
//endregion
|
|
|
} else {
|
|
|
if (oldIdentity.intValue() == eIdentityStatu.Parent.getValue()) {
|
|
|
|
|
|
List<SmartUser> studentDatas = smartUserService.getSmartUserIds(Arrays.asList(oldAffiliate.split(",")));
|
|
|
|
|
|
- //region 删除原有的家长关系
|
|
|
- CommonResult deleteOldShip = deleteOldParentShip(seewoClient, studentDatas, su.getPhone());
|
|
|
- if (!deleteOldShip.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteOldShip.getMessage());
|
|
|
+ //region 希沃删除原有的家长关系
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteOldShip = deleteOldParentShip(seewoClient, studentDatas, su.getPhone());
|
|
|
+ if (!deleteOldShip.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteOldShip.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
} else if (oldIdentity.intValue() == eIdentityStatu.Student.getValue()) {
|
|
|
@@ -1480,26 +1544,32 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 希沃删除学生
|
|
|
- CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
- if (!deleteStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteStudent.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), oldCardNo);
|
|
|
+ if (!deleteStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 百胜删除学生
|
|
|
- CommonResult deleteBsStudent = bsDeleteStudent(su);
|
|
|
- if (!deleteBsStudent.isSuccess()) {
|
|
|
- return CommonResult.fail(deleteBsStudent.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult deleteBsStudent = bsDeleteStudent(su);
|
|
|
+ if (!deleteBsStudent.isSuccess()) {
|
|
|
+ return CommonResult.fail(deleteBsStudent.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
|
|
|
//region 希沃添加教师数据
|
|
|
- CommonResult<String> insertTeacher = SeewoInsertTeacher(seewoClient, su.getPhone(), su.getName(), su.getHeadImage());
|
|
|
- if (!insertTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(insertTeacher.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult<String> insertTeacher = SeewoInsertTeacher(seewoClient, su.getPhone(), su.getName(), su.getHeadImage());
|
|
|
+ if (!insertTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertTeacher.getMessage());
|
|
|
+ }
|
|
|
+ su.setXwTeacherCode(insertTeacher.getData());
|
|
|
}
|
|
|
- su.setXwTeacherCode(insertTeacher.getData());
|
|
|
//endregion
|
|
|
|
|
|
if (su.getDuties().intValue() == eDuties.ClassTeacher.getValue()) {
|
|
|
@@ -1510,9 +1580,11 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
|
|
|
//region 将班主任推送到希沃
|
|
|
- CommonResult pushMaster = SeewoPushMaster(seewoClient, su.getPhone(), classData.getClassUid());
|
|
|
- if (!pushMaster.isSuccess()) {
|
|
|
- return CommonResult.fail(pushMaster.getMessage());
|
|
|
+ if (useXw == 1) {
|
|
|
+ CommonResult pushMaster = SeewoPushMaster(seewoClient, su.getPhone(), classData.getClassUid());
|
|
|
+ if (!pushMaster.isSuccess()) {
|
|
|
+ return CommonResult.fail(pushMaster.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
@@ -1527,11 +1599,13 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("百胜部门编号为空,新增教师失败");
|
|
|
}
|
|
|
//region 百胜添加教师数据
|
|
|
- CommonResult<String> insertBsTeacher = bsInsertTeacher(su, departmentNo);
|
|
|
- if (!insertBsTeacher.isSuccess()) {
|
|
|
- return CommonResult.fail(insertBsTeacher.getMessage());
|
|
|
+ if (useBs == 1) {
|
|
|
+ CommonResult<String> insertBsTeacher = bsInsertTeacher(su, departmentNo);
|
|
|
+ if (!insertBsTeacher.isSuccess()) {
|
|
|
+ return CommonResult.fail(insertBsTeacher.getMessage());
|
|
|
+ }
|
|
|
+ su.setBsStaffCode(insertBsTeacher.getData());
|
|
|
}
|
|
|
- su.setBsStaffCode(insertBsTeacher.getData());
|
|
|
//endregion
|
|
|
}
|
|
|
}
|
|
|
@@ -1983,14 +2057,14 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("希沃家长数据删除失败!");
|
|
|
}
|
|
|
|
|
|
- if(deleteOldFamilyResult.getResponseBody().getResult() == null){
|
|
|
+ if (deleteOldFamilyResult.getResponseBody().getResult() == null) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
XwBodyVo result = objectMapper.readValue(deleteOldFamilyResult.getBody(), XwBodyVo.class);
|
|
|
- if(!result.getCode().equals("000000")){
|
|
|
+ if (!result.getCode().equals("000000")) {
|
|
|
return CommonResult.fail(result.getMessage());
|
|
|
}
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (!deleteOldFamilyResult.getResponseBody().getResult().getCode().equals("000000")) {
|
|
|
return CommonResult.fail(deleteOldFamilyResult.getResponseBody().getResult().getMessage());
|
|
|
}
|
|
|
@@ -2032,14 +2106,14 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
return CommonResult.fail("希沃家长数据删除失败!");
|
|
|
}
|
|
|
|
|
|
- if(deleteOldFamilyResult.getResponseBody().getResult() == null){
|
|
|
+ if (deleteOldFamilyResult.getResponseBody().getResult() == null) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
XwBodyVo result = objectMapper.readValue(deleteOldFamilyResult.getBody(), XwBodyVo.class);
|
|
|
- if(!result.getCode().equals("000000")){
|
|
|
+ if (!result.getCode().equals("000000")) {
|
|
|
return CommonResult.fail(result.getMessage());
|
|
|
}
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (!deleteOldFamilyResult.getResponseBody().getResult().getCode().equals("000000")) {
|
|
|
return CommonResult.fail(deleteOldFamilyResult.getResponseBody().getResult().getMessage());
|
|
|
}
|
|
|
@@ -2587,7 +2661,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- if(parents != null){
|
|
|
+ if (parents != null) {
|
|
|
//region 删除原有的家长关系
|
|
|
CommonResult deleteResult = deleteOldStudentParentShip(seewoClient, user.getCardNo(), parents.stream().map(SmartUser::getPhone).collect(Collectors.toList()));
|
|
|
if (!deleteResult.isSuccess()) {
|
|
|
@@ -2596,7 +2670,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//endregion
|
|
|
}
|
|
|
|
|
|
- } else if(user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()){
|
|
|
+ } else if (user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
//获取班级Uid
|
|
|
SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
if (classData == null) {
|
|
|
@@ -2646,7 +2720,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
|
|
|
//先删除咱自己数据库里的用户数据
|
|
|
int result = smartUserService.deleteSmartUserByIds(ur.getUserIds());
|
|
|
- if(result <= 0){
|
|
|
+ if (result <= 0) {
|
|
|
return CommonResult.fail("删除失败");
|
|
|
}
|
|
|
|
|
|
@@ -2662,7 +2736,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 删除原有的家长关系
|
|
|
CommonResult deleteResult = deleteOldParentShip(seewoClient, studentDatas, user.getPhone());
|
|
|
if (!deleteResult.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除家长关系失败:"+deleteResult.getMessage()+";";
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除家长关系失败:" + deleteResult.getMessage() + ";";
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
@@ -2681,7 +2755,8 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 百胜删除学生
|
|
|
CommonResult deleteBsStudent = bsDeleteStudent(user);
|
|
|
if (!deleteBsStudent.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除学生失败;"+deleteBsStudent.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除学生失败;" + deleteBsStudent.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteBsStudent.getMessage());
|
|
|
}
|
|
|
@@ -2690,24 +2765,26 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 希沃删除学生
|
|
|
CommonResult deleteStudent = SeewoDeleteStudent(seewoClient, classData.getClassUid(), user.getCardNo());
|
|
|
if (!deleteStudent.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除学生失败;"+deleteStudent.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除学生失败;" + deleteStudent.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteStudent.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- if(parents != null){
|
|
|
+ if (parents != null) {
|
|
|
//region 删除原有的家长关系
|
|
|
CommonResult deleteResult = deleteOldStudentParentShip(seewoClient, user.getCardNo(), parents.stream().map(SmartUser::getPhone).collect(Collectors.toList()));
|
|
|
if (!deleteResult.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除家长关系失败;"+deleteResult.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除家长关系失败;" + deleteResult.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteResult.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
|
|
|
- } else if(user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()){
|
|
|
+ } else if (user.getIdentityId().intValue() == eIdentityStatu.Teacher.getValue()) {
|
|
|
//获取班级Uid
|
|
|
SmartClass classData = smartClassService.getSmartClassById(user.getSchoolClass());
|
|
|
if (classData == null) {
|
|
|
@@ -2719,7 +2796,8 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 希沃删除教师
|
|
|
CommonResult deleteTeacher = SeewoDeleteTeacher(seewoClient, user.getPhone());
|
|
|
if (!deleteTeacher.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;"+deleteTeacher.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;" + deleteTeacher.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteTeacher.getMessage());
|
|
|
}
|
|
|
@@ -2728,7 +2806,8 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 希沃删除班主任
|
|
|
CommonResult deleteTeacherMaster = SeewoDeleteTeacherMaster(seewoClient, classData.getClassUid(), user.getPhone());
|
|
|
if (deleteTeacherMaster.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除班主任失败;"+deleteTeacherMaster.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "希沃删除班主任失败;" + deleteTeacherMaster.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(deleteTeacherMaster.getMessage());
|
|
|
}
|
|
|
@@ -2737,19 +2816,20 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
//region 百胜删除教师
|
|
|
CommonResult bsDeleteTeacher = bsDeleteTeacher(user.getBsStaffCode());
|
|
|
if (!bsDeleteTeacher.isSuccess()) {
|
|
|
- String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;"+bsDeleteTeacher.getMessage()+";";;
|
|
|
+ String reason = (deleteUser.getReason() == null ? "" : deleteUser.getReason()) + "百胜删除老师失败;" + bsDeleteTeacher.getMessage() + ";";
|
|
|
+ ;
|
|
|
deleteUser.setReason(reason);
|
|
|
//return CommonResult.fail(bsDeleteTeacher.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
- if(deleteUser.getReason() != null){
|
|
|
+ if (deleteUser.getReason() != null) {
|
|
|
deleteUsers.add(deleteUser);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(deleteUsers != null && deleteUsers.size() > 0){
|
|
|
+ if (deleteUsers != null && deleteUsers.size() > 0) {
|
|
|
int deleteUser = smartUserService.deleteUserBatch(deleteUsers);
|
|
|
return deleteUser > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
|
|
|
}
|
|
|
@@ -2991,7 +3071,7 @@ public class SmartUserController implements SmartUserControllerAPI {
|
|
|
PageUtils<UserDeleteVo> result = smartUserService.queryUserDeletePage(currentPage, pageCount);
|
|
|
|
|
|
List<SmartDepartment> departments = smartDepartmentService.list(null);
|
|
|
- for (UserDeleteVo data :result.getList()) {
|
|
|
+ for (UserDeleteVo data : result.getList()) {
|
|
|
data.setIdentityStr(eIdentityStatu.stringOf(data.getIdentityId()));//身份
|
|
|
//获取父级部门ID
|
|
|
Optional<SmartDepartment> department = departments.stream().filter(e -> e.getId().equals(data.getDepartmentId())).findFirst();
|