From b230852e9f5d6fa6cc46c2a68111a27011f81e0b Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: Wed, 22 Jan 2025 08:29:40 +0800
Subject: [PATCH] 特种作业非煤缴费版本
---
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 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 5ca08df..9c34576 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
@@ -4,7 +4,9 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.pay.dto.req.NonCoalPayStudentReqDto;
+import com.gkhy.exam.pay.entity.NonCoalPay;
import com.gkhy.exam.pay.entity.NonCoalPayStudent;
+import com.gkhy.exam.pay.mapper.NonCoalPayMapper;
import com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper;
import com.gkhy.exam.pay.service.NonCoalPayStudentService;
import com.ruoyi.common.exception.ServiceException;
@@ -30,6 +32,8 @@
public class NonCoalPayStudentServiceImpl extends ServiceImpl<NonCoalPayStudentMapper, NonCoalPayStudent> implements NonCoalPayStudentService {
@Resource
private NonCoalPayStudentMapper nonCoalPayStudentMapper;
+ @Resource
+ private NonCoalPayMapper nonCoalPayMapper;
/**
* 查询【请填写功能名称】
@@ -63,6 +67,8 @@
@Override
public int insertNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent) {
checkSameData(nonCoalPayStudent);
+ NonCoalPay nonCoalPay = checkNonCoalPay(nonCoalPayStudent.getNonCoalPayId());
+ nonCoalPayStudent.setPayType(nonCoalPay.getPayPersonType().longValue());
nonCoalPayStudent.setCreateBy(SecurityUtils.getUsername());
return nonCoalPayStudentMapper.insertNonCoalPayStudent(nonCoalPayStudent);
}
@@ -77,6 +83,7 @@
public int updateNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent) {
checkData(nonCoalPayStudent.getId());
checkSameData(nonCoalPayStudent);
+ nonCoalPayStudent.setPayType(null);
nonCoalPayStudent.setUpdateBy(SecurityUtils.getUsername());
return nonCoalPayStudentMapper.updateNonCoalPayStudent(nonCoalPayStudent);
}
@@ -111,7 +118,7 @@
.eq(NonCoalPayStudent::getNonCoalPayId, nonCoalPay.getNonCoalPayId())
.eq(NonCoalPayStudent::getIdCard, nonCoalPay.getIdCard())
.eq(NonCoalPayStudent::getDelFlag, 0);
- if (nonCoalPay.getId() == null) {
+ if (nonCoalPay.getId() != null) {
lambdaQueryWrapper.ne(NonCoalPayStudent::getId, nonCoalPay.getId());
}
Long l = baseMapper.selectCount(lambdaQueryWrapper);
@@ -161,7 +168,8 @@
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)
.collect(Collectors.toSet());
@@ -186,11 +194,14 @@
StringBuilder failureMsg = new StringBuilder();
for (NonCoalPayStudent stu : nonCoalPayStudents) {
try {
- if (idCardToNameMap.get(stu.getIdCard().trim()) != null) {
+ 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);
successNum++;
@@ -215,7 +226,7 @@
}
private NonCoalPayStudent checkData(Long id) {
- NonCoalPayStudent byId = getById(id);
+ NonCoalPayStudent byId = nonCoalPayStudentMapper.selectNonCoalPayStudentById(id);
if (byId == null) {
throw new RuntimeException("该数据不存在");
}
@@ -227,4 +238,13 @@
}
return byId;
}
+
+
+ private NonCoalPay checkNonCoalPay(Long nonCoalPayId) {
+ NonCoalPay nonCoalPay = nonCoalPayMapper.selectNonCoalPayById(nonCoalPayId);
+ if (nonCoalPay == null) {
+ throw new ServiceException("该主数据不存在");
+ }
+ return nonCoalPay;
+ }
}
\ No newline at end of file
--
Gitblit v1.9.2