@@ -20,11 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/** Compatibility endpoints used by BestSchool.IBaseClass.BLL.DbClass consumers. */
|
/** Compatibility endpoints used by BestSchool.IBaseClass.BLL.DbClass consumers. */
|
||||||
@@ -43,7 +39,7 @@ public class DbClassController {
|
|||||||
public ResponseEntity<List<Map<String, Object>>> getSchteaList(
|
public ResponseEntity<List<Map<String, Object>>> getSchteaList(
|
||||||
@Parameter(description = "School ID", required = true, example = "3")
|
@Parameter(description = "School ID", required = true, example = "3")
|
||||||
@RequestParam("Group") Integer group) {
|
@RequestParam("Group") Integer group) {
|
||||||
if (group == null || group <= 0) return ResponseEntity.badRequest().build();
|
if (group == null || group <= 0) return ResponseEntity.ok(new ArrayList<>());
|
||||||
|
|
||||||
SchInfoVO school = schInfoService.GetSchFirst(group);
|
SchInfoVO school = schInfoService.GetSchFirst(group);
|
||||||
String schSerId = school == null
|
String schSerId = school == null
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class TeainfoController {
|
|||||||
public ResponseEntity<TeaInfoVO> getTeainfo(@RequestParam Integer uid) {
|
public ResponseEntity<TeaInfoVO> getTeainfo(@RequestParam Integer uid) {
|
||||||
// 1. 鍙傛暟鏍¢獙
|
// 1. 鍙傛暟鏍¢獙
|
||||||
if (uid == null) {
|
if (uid == null) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new TeaInfoVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 鐩存帴浣跨敤 uid 鏌ヨ
|
// 2. 鐩存帴浣跨敤 uid 鏌ヨ
|
||||||
@@ -63,7 +63,7 @@ public class TeainfoController {
|
|||||||
})
|
})
|
||||||
.map(this::convertToTeaInfoVO)
|
.map(this::convertToTeaInfoVO)
|
||||||
.map(ResponseEntity::ok)
|
.map(ResponseEntity::ok)
|
||||||
.orElse(ResponseEntity.notFound().build());
|
.orElse(ResponseEntity.ok(new TeaInfoVO()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private TeaInfoVO convertToTeaInfoVO(SchTeacher teacher) {
|
private TeaInfoVO convertToTeaInfoVO(SchTeacher teacher) {
|
||||||
@@ -134,7 +134,7 @@ public class TeainfoController {
|
|||||||
public ResponseEntity<List<TeaInfoVO>> getArrTeainfo(@RequestBody String userIds) {
|
public ResponseEntity<List<TeaInfoVO>> getArrTeainfo(@RequestBody String userIds) {
|
||||||
// 1. 鍙傛暟鏍¢獙
|
// 1. 鍙傛暟鏍¢獙
|
||||||
if (userIds == null) {
|
if (userIds == null) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Integer> uids= Arrays.asList(OtherUtil.convertToArray(userIds));
|
List<Integer> uids= Arrays.asList(OtherUtil.convertToArray(userIds));
|
||||||
@@ -146,7 +146,7 @@ public class TeainfoController {
|
|||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return voList.isEmpty() ? ResponseEntity.noContent().build() : ResponseEntity.ok(voList);
|
return ResponseEntity.ok(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -174,7 +174,7 @@ public class TeainfoController {
|
|||||||
// 1. 参数校验:SchSerID 与 schId 至少传一个
|
// 1. 参数校验:SchSerID 与 schId 至少传一个
|
||||||
Integer resolvedSchId = resolveSchId(schId, SchSerID);
|
Integer resolvedSchId = resolveSchId(schId, SchSerID);
|
||||||
if (resolvedSchId == null) {
|
if (resolvedSchId == null) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SchTeacher> teachers = schTeacherService.getSchTeacherList(resolvedSchId);
|
List<SchTeacher> teachers = schTeacherService.getSchTeacherList(resolvedSchId);
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public class UserInfoController {
|
|||||||
public ResponseEntity<List<UserInfoVO>> getUserList(@RequestParam String SchSerID) {
|
public ResponseEntity<List<UserInfoVO>> getUserList(@RequestParam String SchSerID) {
|
||||||
// 1. 鍙傛暟鏍¢獙
|
// 1. 鍙傛暟鏍¢獙
|
||||||
if (SchSerID == null || SchSerID.trim().isEmpty()) {
|
if (SchSerID == null || SchSerID.trim().isEmpty()) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
SchInfoVO schInfoVO = schInfoService.GetSchFirst(SchSerID);
|
SchInfoVO schInfoVO = schInfoService.GetSchFirst(SchSerID);
|
||||||
if (schInfoVO == null) {
|
if (schInfoVO == null) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
Integer schId = schInfoVO.getUserSchSerId();
|
Integer schId = schInfoVO.getUserSchSerId();
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public class UserInfoController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. 杩斿洖缁撴灉
|
// 4. 杩斿洖缁撴灉
|
||||||
return voList.isEmpty() ? ResponseEntity.noContent().build() : ResponseEntity.ok(voList);
|
return ResponseEntity.ok(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== 杞崲鏁欏笀 =====
|
// ===== 杞崲鏁欏笀 =====
|
||||||
@@ -157,7 +157,7 @@ public class UserInfoController {
|
|||||||
@Operation(summary = "getUserIdList")
|
@Operation(summary = "getUserIdList")
|
||||||
public ResponseEntity<List<UserInfoVO>> getUserIdList(@RequestParam Integer userid) {
|
public ResponseEntity<List<UserInfoVO>> getUserIdList(@RequestParam Integer userid) {
|
||||||
if (userid == null) {
|
if (userid == null) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<SchTeacher> teacherOpt = schTeacherRepository.findByTeaId(userid);
|
Optional<SchTeacher> teacherOpt = schTeacherRepository.findByTeaId(userid);
|
||||||
@@ -175,8 +175,7 @@ public class UserInfoController {
|
|||||||
return ResponseEntity.ok(Collections.singletonList(vo));
|
return ResponseEntity.ok(Collections.singletonList(vo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ResponseEntity.ok(new ArrayList<>());
|
||||||
return ResponseEntity.notFound().build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user