From 8663780ea617fd30ddf74c80085d40580179a7e9 Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: Wed, 22 Jan 2025 14:26:37 +0800
Subject: [PATCH] 特种作业非煤缴费版本导入优化
---
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 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 9c34576..d42cd8a 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.setGovPayStatus(0L);
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 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