From f9cb0f3f384279b2cbe87c35dde3ba573a0197f3 Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期四, 24 四月 2025 16:17:25 +0800 Subject: [PATCH] 煤矿缴费修改 --- exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 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 f85e3a9..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 @@ -10,10 +10,8 @@ import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.SecurityUtils; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; +import com.ruoyi.common.utils.StringUtils; +import org.apache.poi.ss.usermodel.*; import org.aspectj.weaver.loadtime.Aj; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -94,14 +92,20 @@ coalPayStudent.setCoalPayId(coalPayId); if (row!=null){ coalPayStudent.setName(row.getCell(0).getStringCellValue()); - coalPayStudent.setIdCard(row.getCell(1).getStringCellValue()); + String idCard = row.getCell(1).getStringCellValue(); + coalPayStudent.setIdCard(idCard); coalPayStudent.setPhone(row.getCell(2).getStringCellValue()); - String stringCellValue = row.getCell(3).getStringCellValue(); - if (stringCellValue.equals("男")){ - coalPayStudent.setSex(0L); - }else if (stringCellValue.equals("女")){ - coalPayStudent.setSex(1L); + Cell cell = row.getCell(3); + if (cell!=null){ + if (StringUtils.isEmpty(cell.getStringCellValue())){ + coalPayStudent.setTrain("-"); + }else{ + coalPayStudent.setTrain(cell.getStringCellValue()); + } } + + 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()); @@ -110,6 +114,7 @@ } // 根据身份证号去重 List<CoalPayStudent> distinctStudents = coalPayStudents.stream() + .filter(student -> student.getIdCard()!=null) .collect(Collectors.toMap( CoalPayStudent::getIdCard, // 使用身份证号作为键 student -> student, // 使用学生对象作为值 @@ -158,4 +163,9 @@ public void updateByCoalPayIdAndStatus(CoalPayStudent payStudent) { coalPayStudentMapper.updateByCoalPayIdAndStatus(payStudent); } + + @Override + public void updateByIdAndPayType(CoalPayStudent payStudent) { + coalPayStudentMapper.updateByIdAndPayType(payStudent); + } } -- Gitblit v1.9.2