From 02fa12e93281fea472323201e5eb6ab55466a63d Mon Sep 17 00:00:00 2001 From: heheng <heheng@123456> Date: 星期四, 23 一月 2025 08:35:48 +0800 Subject: [PATCH] 特种作业非煤缴费版本导入优化 --- exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java index 4e46e3b..3b78a96 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.institutionalaccess.enums.StudentSex; +import com.gkhy.exam.pay.dto.req.NonCoalPayStuImport; import com.gkhy.exam.pay.dto.req.NonCoalPayStudentReqDto; import com.gkhy.exam.pay.entity.NonCoalPay; import com.gkhy.exam.pay.entity.NonCoalPayStudent; @@ -69,6 +71,8 @@ checkSameData(nonCoalPayStudent); NonCoalPay nonCoalPay = checkNonCoalPay(nonCoalPayStudent.getNonCoalPayId()); nonCoalPayStudent.setPayType(nonCoalPay.getPayPersonType().longValue()); +// nonCoalPayStudent.setOrderNo(RandomUtil.generateOrderNumber()); + nonCoalPayStudent.setCreateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.insertNonCoalPayStudent(nonCoalPayStudent); } @@ -84,6 +88,7 @@ checkData(nonCoalPayStudent.getId()); checkSameData(nonCoalPayStudent); nonCoalPayStudent.setPayType(null); + nonCoalPayStudent.setOrderNo(null); nonCoalPayStudent.setUpdateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.updateNonCoalPayStudent(nonCoalPayStudent); } @@ -164,14 +169,14 @@ } @Override - public String importData(List<NonCoalPayStudent> nonCoalPayStudents, String operName, Long nonCoalPayId) { + public String importData(List<NonCoalPayStuImport> nonCoalPayStudents, String operName, Long nonCoalPayId) { if (StringUtils.isNull(nonCoalPayStudents) || nonCoalPayStudents.isEmpty()) { throw new ServiceException("导入数据不能为空!"); } NonCoalPay nonCoalPay = checkNonCoalPay(nonCoalPayId); Integer payPersonType = nonCoalPay.getPayPersonType(); Set<String> collect = nonCoalPayStudents.stream() - .map(NonCoalPayStudent::getIdCard) + .map(NonCoalPayStuImport::getIdCard) .collect(Collectors.toSet()); if (collect.size() != nonCoalPayStudents.size()) { throw new ServiceException("导入数据不能有重复身份证号!"); @@ -192,18 +197,25 @@ int failureNum = 0; StringBuilder successMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder(); - for (NonCoalPayStudent stu : nonCoalPayStudents) { + for (NonCoalPayStuImport stu : nonCoalPayStudents) { try { if (StringUtils.isEmpty(stu.getIdCard()) || StringUtils.isEmpty(stu.getName()) || StringUtils.isEmpty(stu.getPhone()) || stu.getSex() == null) { failureMsg.append("<br/>" + failureNum + "、导入数据为空: " + stu.getIdCard() + " 数据错误"); } else if (idCardToNameMap.get(stu.getIdCard().trim()) != null) { failureMsg.append("<br/>" + failureNum + "、身份证号: " + stu.getIdCard() + " 数据已存在"); } else { - stu.setPayType(1L); - stu.setPayStatus(0L); - stu.setPayType(payPersonType.longValue()); - stu.setNonCoalPayId(nonCoalPayId); - save(stu); + NonCoalPayStudent stu1 = new NonCoalPayStudent(); + stu1.setPayStatus(0L); + stu1.setPayType(payPersonType.longValue()); + stu1.setNonCoalPayId(nonCoalPayId); + stu1.setCreateBy(operName); + stu1.setName(stu.getName()); + stu1.setIdCard(stu.getIdCard()); + stu1.setPhone(stu.getPhone()); + +// stu1.setOrderNo(RandomUtil.generateOrderNumber()); + stu1.setSex(StudentSex.BOY.getStatus().equals(stu.getSex().trim()) ? 0L : 1L); + nonCoalPayStudentMapper.insertNonCoalPayStudent(stu1); successNum++; successMsg.append("<br/>" + successNum + "、身份证号 " + stu.getIdCard() + " 导入成功"); idCardToNameMap.put(stu.getIdCard(), stu.getIdCard()); -- Gitblit v1.9.2