From 3a762add44449332d6d379e361698850f6066e16 Mon Sep 17 00:00:00 2001 From: heheng <475597332@qq.com> Date: 星期一, 19 五月 2025 15:20:12 +0800 Subject: [PATCH] 修改 --- exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 12 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 982e645..90039df 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,13 +92,26 @@ 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()); + } + } + + 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); + } } coalPayStudent.setPayStatus(0L); coalPayStudent.setCreateBy(loginUser.getUsername()); @@ -143,7 +154,24 @@ } @Override - public CoalPayStudent selectbyId(Long studentId) { - return coalPayStudentMapper.selectById(studentId); + public List<CoalPayStudent> selectbyId(Long studentId) { + List<Long> longs = new ArrayList<>(); + longs.add(studentId); + return coalPayStudentMapper.selectBatchIds(longs); + } + + @Override + public void updateByCoalPayId(CoalPayStudent coalPayStudent) { + coalPayStudentMapper.updateByCoalPayId(coalPayStudent); + } + + @Override + public void updateByCoalPayIdAndStatus(CoalPayStudent payStudent) { + coalPayStudentMapper.updateByCoalPayIdAndStatus(payStudent); + } + + @Override + public void updateByIdAndPayType(CoalPayStudent payStudent) { + coalPayStudentMapper.updateByIdAndPayType(payStudent); } } -- Gitblit v1.9.2