From 960ddab080d2434277bb75c188e2f7380856997e Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期五, 07 三月 2025 14:33:53 +0800 Subject: [PATCH] 煤矿修改 --- exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java index 90039df..48ec04b 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java @@ -104,15 +104,8 @@ } } - char c = idCard.charAt(idCard.length() - 1); - if (Character.isDigit(c)){ - int genderDigit = Character.getNumericValue(c); - if (genderDigit % 2 == 1) { - coalPayStudent.setSex(0L); - } else { - coalPayStudent.setSex(1L); - } - } + idCard = idCard.trim(); + coalPayStudent.setSex((idCard.charAt(idCard.length() - 2) - '0') % 2 == 0 ? 1L : 0L); coalPayStudent.setPayStatus(0L); coalPayStudent.setCreateBy(loginUser.getUsername()); coalPayStudent.setCreateTime(new Date()); @@ -121,6 +114,7 @@ } // 根据身份证号去重 List<CoalPayStudent> distinctStudents = coalPayStudents.stream() + .filter(student -> student.getIdCard()!=null) .collect(Collectors.toMap( CoalPayStudent::getIdCard, // 使用身份证号作为键 student -> student, // 使用学生对象作为值 -- Gitblit v1.9.2