From 03682382b79d64cccdbceb395bb93628bd9f1c31 Mon Sep 17 00:00:00 2001 From: heheng <heheng@123456> Date: 星期三, 22 一月 2025 14:25:07 +0800 Subject: [PATCH] 特种作业非煤缴费版本导入优化 --- exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java | 29 +++++++++++++++++++++-------- 1 files changed, 21 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..25c5178 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; @@ -10,6 +12,7 @@ import com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper; import com.gkhy.exam.pay.service.NonCoalPayStudentService; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.RandomUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import org.springframework.stereotype.Service; @@ -69,6 +72,8 @@ checkSameData(nonCoalPayStudent); NonCoalPay nonCoalPay = checkNonCoalPay(nonCoalPayStudent.getNonCoalPayId()); nonCoalPayStudent.setPayType(nonCoalPay.getPayPersonType().longValue()); + nonCoalPayStudent.setOrderNo(RandomUtil.generateOrderNumber()); + nonCoalPayStudent.setGovPayStatus(0L); nonCoalPayStudent.setCreateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.insertNonCoalPayStudent(nonCoalPayStudent); } @@ -84,6 +89,7 @@ checkData(nonCoalPayStudent.getId()); checkSameData(nonCoalPayStudent); nonCoalPayStudent.setPayType(null); + nonCoalPayStudent.setOrderNo(null); nonCoalPayStudent.setUpdateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.updateNonCoalPayStudent(nonCoalPayStudent); } @@ -164,14 +170,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 +198,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.setGovPayStatus(0L); + 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