From 8f2abbbda6c87c59d0c2c5da9979e78ea38e74db Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 21 一月 2025 18:15:00 +0800 Subject: [PATCH] 合并代码 --- cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 44 insertions(+), 11 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java index c626ef0..4b712b6 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import springfox.documentation.swagger2.mappers.ModelMapper; @@ -1085,14 +1086,20 @@ @PostMapping("/student/queryUserAge1") public HashMap<String, Object> queryUserAge1() { HashMap<String, Object> map = new HashMap<>(); - List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1)); + List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1) + .isNotNull(TAppUser::getPhone) + .isNotNull(TAppUser::getCity)); + Set<String> strings2 = new HashSet<>(list.stream().filter(e -> e.getCity().equals("[]")).collect(Collectors.groupingBy(TAppUser::getProvince)).keySet()); List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList()); if (collect.size() == 0) { collect.add(-1); } - - Set<String> strings = list.stream().collect(Collectors.groupingBy(TAppUser::getCity)).keySet(); + Set<String> strings = new HashSet<>(list.stream() + .filter(e -> !e.getCity().equals("[]") && StringUtils.hasLength(e.getCity())) + .collect(Collectors.groupingBy(TAppUser::getCity)) + .keySet()); + strings.addAll(strings2); ArrayList<String> strings1 = new ArrayList<>(); ArrayList<Integer> integers = new ArrayList<>(); @@ -1100,13 +1107,14 @@ int a = 0; strings1.add(string); for (TAppUser tAppUser : list) { - if (tAppUser.getCity().equals(string)) { + if (tAppUser.getCity()!=null&&tAppUser.getCity().equals(string)) { + a++; + }else if (tAppUser.getProvince()!=null&&tAppUser.getProvince().equals(string)){ a++; } } integers.add(a); } - map.put("cityData", strings1); map.put("cityNum", integers); int age1 = 0; @@ -1159,14 +1167,21 @@ @PostMapping("/student/queryUserAgeYys") public HashMap<String, Object> queryUserAgeYys(@RequestBody List<Integer> ids) { HashMap<String, Object> map = new HashMap<>(); - List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids)); + List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids) + .isNotNull(TAppUser::getPhone) + .isNotNull(TAppUser::getCity)); + Set<String> strings2 = new HashSet<>(list.stream().filter(e -> e.getCity().equals("[]")).collect(Collectors.groupingBy(TAppUser::getProvince)).keySet()); List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList()); if (collect.size() == 0) { collect.add(-1); } - Set<String> strings = list.stream().collect(Collectors.groupingBy(TAppUser::getCity)).keySet(); + Set<String> strings = new HashSet<>(list.stream() + .filter(e -> !e.getCity().equals("[]") && StringUtils.hasLength(e.getCity())) + .collect(Collectors.groupingBy(TAppUser::getCity)) + .keySet()); + strings.addAll(strings2); ArrayList<String> strings1 = new ArrayList<>(); ArrayList<Integer> integers = new ArrayList<>(); @@ -1174,7 +1189,9 @@ int a = 0; strings1.add(string); for (TAppUser tAppUser : list) { - if (tAppUser.getCity().equals(string)) { + if (tAppUser.getCity()!=null&&tAppUser.getCity().equals(string)) { + a++; + }else if (tAppUser.getProvince()!=null&&tAppUser.getProvince().equals(string)){ a++; } } @@ -1232,14 +1249,21 @@ @PostMapping("/student/queryUserAgeStore") public HashMap<String, Object> queryUserAgeStore(@RequestBody List<Integer> ids) { HashMap<String, Object> map = new HashMap<>(); - List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids)); + List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids) + .isNotNull(TAppUser::getPhone) + .isNotNull(TAppUser::getCity)); List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList()); if (collect.size() == 0) { collect.add(-1); } + Set<String> strings2 = new HashSet<>(list.stream().filter(e -> e.getCity().equals("[]")).collect(Collectors.groupingBy(TAppUser::getProvince)).keySet()); - Set<String> strings = list.stream().collect(Collectors.groupingBy(TAppUser::getCity)).keySet(); + Set<String> strings = new HashSet<>(list.stream() + .filter(e -> !e.getCity().equals("[]") && StringUtils.hasLength(e.getCity())) + .collect(Collectors.groupingBy(TAppUser::getCity)) + .keySet()); + strings.addAll(strings2); ArrayList<String> strings1 = new ArrayList<>(); ArrayList<Integer> integers = new ArrayList<>(); @@ -1247,7 +1271,9 @@ int a = 0; strings1.add(string); for (TAppUser tAppUser : list) { - if (tAppUser.getCity().equals(string)) { + if (tAppUser.getCity()!=null&&tAppUser.getCity().equals(string)) { + a++; + }else if (tAppUser.getProvince()!=null&&tAppUser.getProvince().equals(string)){ a++; } } @@ -1381,7 +1407,14 @@ map.put("boy", boy); map.put("girl", girl); return map; + } + + @ResponseBody + @PostMapping("/student/queryExpiredList") + public List<TStudent> queryExpiredList(){ + List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().eq("state", 1).last(" and DATE_FORMAT(now(), '%Y-%m-%d') > validity")); + return list; } } -- Gitblit v1.7.1