| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getStudentTotal(StudentQeryDto studentQeryDto) { |
| | | List<Map<String, Object>> studentTotal = this.baseMapper.getStudentTotal(studentQeryDto); |
| | | // String cityCode = studentQeryDto.getCityCode(); |
| | | // String start = studentQeryDto.getStart(); |
| | | // String end = studentQeryDto.getEnd(); |
| | | // //获取用户数据 |
| | | // List<Integer> appUserIds = null; |
| | | // if(ToolUtil.isNotEmpty(cityCode)){ |
| | | // List<AppUser> appUsers = appuClient.queryAppUserByCityCode(cityCode); |
| | | // if(appUsers.size() > 0){ |
| | | // appUserIds = appUsers.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | // } |
| | | // } |
| | | // QueryWrapper<CoursePackageStudent> status = new QueryWrapper<CoursePackageStudent>().eq("payStatus", 2).eq("status", 1); |
| | | // if(null != appUserIds){ |
| | | // status.in("appUserId", appUserIds); |
| | | // } |
| | | // List<Map<String, Object>> maps = this.baseMapper.getStudentTotal(appUserIds, studentQeryDto.getStart(), studentQeryDto.getEnd()); |
| | | // List<Map<String, Object>> list = new ArrayList<>(); |
| | | // for (Map<String, Object> objectMap : maps) { |
| | | // Integer studentId = Integer.valueOf(objectMap.get("studentId").toString()); |
| | | // Integer appUserId = Integer.valueOf(objectMap.get("appUserId").toString()); |
| | | // Integer coursePackageId = Integer.valueOf(objectMap.get("coursePackageId").toString()); |
| | | // Integer number = Integer.valueOf(objectMap.get("number").toString()); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // Student student = studentClient.queryStudentById(studentId); |
| | | // map.put("studentName", student.getName()); |
| | | // AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | // map.put("province", appUser.getProvince()); |
| | | // map.put("provinceCode", appUser.getProvinceCode()); |
| | | // map.put("city", appUser.getCity()); |
| | | // map.put("cityCode", appUser.getCityCode()); |
| | | // TCoursePackage coursePackage = coursePackageService.getById(coursePackageId); |
| | | // map.put("courseName", coursePackage.getName()); |
| | | // map.put("totalClassHours", number); |
| | | // map.put("cashPayment", coursePackageOrder.getCashPayment()); |
| | | // map.put("hasHours", ) |
| | | // |
| | | // |
| | | // } |
| | | |
| | | for (Map<String, Object> student : studentTotal) { |
| | | Integer appUserId = (Integer) student.get("appUserId"); |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | student.put("province", appUser.getProvince()); |
| | | student.put("provinceCode", appUser.getProvinceCode()); |
| | | |
| | | student.put("city", appUser.getCity()); |
| | | student.put("cityCode", appUser.getCityCode()); |
| | | |
| | | Student studentId = studentClient.queryStudentById((Integer) student.get("studentId")); |
| | | student.put("studentName", studentId.getName()); |
| | | BigDecimal cashPayment = (BigDecimal) student.get("cashPayment"); |
| | | BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours"); |
| | | BigDecimal hasHours = (BigDecimal) student.get("hasHours"); |
| | | if (cashPayment == null) { |
| | | continue; |
| | | } |
| | | if (totalClassHours.compareTo(BigDecimal.ZERO) == 0) { |
| | | totalClassHours = totalClassHours.add(new BigDecimal("1")); |
| | | } |
| | | BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP) |
| | | .multiply(hasHours).setScale(2, RoundingMode.HALF_UP); |
| | | student.put("hasPayment", hasPayment); |
| | | } |
| | | |
| | | if (studentQeryDto.getCityCode() != null && studentQeryDto.getCityCode() != "") { |
| | | String value = studentQeryDto.getCityCode(); |
| | | boolean allZeros = value.substring(value.length() - 4).endsWith("0000"); |
| | | System.out.println(allZeros); // Output: true |
| | | if (allZeros) { |
| | | Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> student = iterator.next(); |
| | | String cityCode = (String) student.get("provinceCode"); |
| | | if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | iterator.remove(); // Remove the element from the list |
| | | } |
| | | } |
| | | } else { |
| | | Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> student = iterator.next(); |
| | | String cityCode = (String) student.get("cityCode"); |
| | | if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | iterator.remove(); // Remove the element from the list |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (studentQeryDto.getStudentName() != null && studentQeryDto.getStudentName() != "") { |
| | | List<Map<String, Object>> totallike = new ArrayList<>(); |
| | | for (Map<String, Object> student : studentTotal) { |
| | | String studentName = (String) student.get("studentName"); |
| | | if (studentName.contains(studentQeryDto.getStudentName())) { |
| | | totallike.add(student); |
| | | } |
| | | |
| | | } |
| | | return totallike; |
| | | } |
| | | return studentTotal; |
| | | // List<Map<String, Object>> studentTotal = this.baseMapper.getStudentTotal(studentQeryDto); |
| | | // for (Map<String, Object> student : studentTotal) { |
| | | // Integer appUserId = (Integer) student.get("appUserId"); |
| | | // AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | // student.put("province", appUser.getProvince()); |
| | | // student.put("provinceCode", appUser.getProvinceCode()); |
| | | // |
| | | // student.put("city", appUser.getCity()); |
| | | // student.put("cityCode", appUser.getCityCode()); |
| | | // |
| | | // Student studentId = studentClient.queryStudentById((Integer) student.get("studentId")); |
| | | // student.put("studentName", studentId.getName()); |
| | | // BigDecimal cashPayment = (BigDecimal) student.get("cashPayment"); |
| | | // BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours"); |
| | | // BigDecimal hasHours = (BigDecimal) student.get("hasHours"); |
| | | // if (cashPayment == null) { |
| | | // continue; |
| | | // } |
| | | // if (totalClassHours.compareTo(BigDecimal.ZERO) == 0) { |
| | | // totalClassHours = totalClassHours.add(new BigDecimal("1")); |
| | | // } |
| | | // BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP) |
| | | // .multiply(hasHours).setScale(2, RoundingMode.HALF_UP); |
| | | // student.put("hasPayment", hasPayment); |
| | | // } |
| | | // |
| | | // if (studentQeryDto.getCityCode() != null && studentQeryDto.getCityCode() != "") { |
| | | // String value = studentQeryDto.getCityCode(); |
| | | // boolean allZeros = value.substring(value.length() - 4).endsWith("0000"); |
| | | // System.out.println(allZeros); // Output: true |
| | | // if (allZeros) { |
| | | // Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // Map<String, Object> student = iterator.next(); |
| | | // String cityCode = (String) student.get("provinceCode"); |
| | | // if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | // iterator.remove(); // Remove the element from the list |
| | | // } |
| | | // } |
| | | // } else { |
| | | // Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // Map<String, Object> student = iterator.next(); |
| | | // String cityCode = (String) student.get("cityCode"); |
| | | // if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | // iterator.remove(); // Remove the element from the list |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (studentQeryDto.getStudentName() != null && studentQeryDto.getStudentName() != "") { |
| | | // List<Map<String, Object>> totallike = new ArrayList<>(); |
| | | // for (Map<String, Object> student : studentTotal) { |
| | | // String studentName = (String) student.get("studentName"); |
| | | // if (studentName.contains(studentQeryDto.getStudentName())) { |
| | | // totallike.add(student); |
| | | // } |
| | | // |
| | | // } |
| | | // return totallike; |
| | | // } |
| | | // return studentTotal; |
| | | return null; |
| | | } |
| | | |
| | | @Override |