|
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -274,12 +275,16 @@ public class PrintController {
|
|
|
@RequestMapping(value = "/school/list", method = RequestMethod.POST)
|
|
|
@Aac(strict = false, auth = false)
|
|
|
public Result list(@ApiParam(value = "学校Code") @RequestParam(required = false) String code) {
|
|
|
- List<BasicSchool> list = clientService.listSchool(code);
|
|
|
+ List<BasicSchool> list = clientService.listSchool();
|
|
|
+ List<BasicSchool> finalList = new ArrayList<>();
|
|
|
// 指定code后,只返回code对应学校,否则查默认学校,没有默认,返回所有
|
|
|
- if (CollectionUtils.isNotEmpty(list) && StringUtils.isBlank(code)) {
|
|
|
- List<BasicSchool> defaultSchools = list.stream().filter(m -> m.getDefaultSchool() != null && m.getDefaultSchool()).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(defaultSchools)) {
|
|
|
- return ResultUtil.ok(defaultSchools);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ finalList = list.stream().filter(m -> m.getDefaultSchool() != null && m.getDefaultSchool()).collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isEmpty(finalList) && StringUtils.isNotBlank(code)){
|
|
|
+ finalList = list.stream().filter(m -> m.getCode().equals(code)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(finalList)) {
|
|
|
+ return ResultUtil.ok(finalList);
|
|
|
}
|
|
|
}
|
|
|
return ResultUtil.ok(list);
|