From 44f7e1fe5136eb0666bb599387406ea6b12e659b Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: 星期二, 21 一月 2025 16:34:14 +0800
Subject: [PATCH] 特种作业非煤缴费版本

---
 exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 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 c7f231a..7a9f3c4 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.getPayType());
         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());
@@ -193,6 +201,7 @@
                 } else {
                     stu.setPayType(1L);
                     stu.setPayStatus(0L);
+                    stu.setPayType(payPersonType.longValue());
                     stu.setNonCoalPayId(nonCoalPayId);
                     save(stu);
                     successNum++;
@@ -217,7 +226,7 @@
     }
 
     private NonCoalPayStudent checkData(Long id) {
-        NonCoalPayStudent byId = getById(id);
+        NonCoalPayStudent byId = nonCoalPayStudentMapper.selectNonCoalPayStudentById(id);
         if (byId == null) {
             throw new RuntimeException("该数据不存在");
         }
@@ -229,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