Просмотр исходного кода

1、新生手动分班增加未交费验证
2、新生数据同步增加重复验证逻辑

dzx 6 месяцев назад
Родитель
Сommit
ca65896750

+ 6 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -11,6 +11,7 @@ import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.enums.RoleEnum;
+import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.utils.LocalDateUtil;
 import com.xjrsoft.common.utils.RedisUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
@@ -116,6 +117,11 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
                         .in(BaseNewStudent::getId, dto.getNewStudentIds())
         );
 
+        List<BaseNewStudent> notPaymnyList = list.stream().filter(x -> "未交费".equals(x.getPaymnystate())).collect(Collectors.toList());
+        if(!notPaymnyList.isEmpty() && dto.getIsHandle() == 1){
+            throw new MyException("选择的学生中存在未交费情况,无法手动分班");
+        }
+
         List<BandingTaskClassStudent> dataList = new ArrayList<>();
         long createUserId = StpUtil.getLoginIdAsLong();
 

+ 6 - 1
src/main/java/com/xjrsoft/module/job/BaseNewStudentTask.java

@@ -117,6 +117,8 @@ public class BaseNewStudentTask {
         );
         Map<String, Long> majorSetNameMap = majorSetList.stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
 
+        Set<String> insCredentialNumber = new HashSet<>();
+
         //循环攀宝的数据,准备更新到新生表中
         List<BaseNewStudent> updateList = new ArrayList<>();
         List<BaseNewStudent> insertList = new ArrayList<>();
@@ -160,7 +162,9 @@ public class BaseNewStudentTask {
                 updateList.add(existsNewStudent);
                 continue;
             }
-
+            if(insCredentialNumber.contains(feeobjupdate.getPersonalid())){
+                continue;
+            }
             insertList.add(
                     new BaseNewStudent() {{
                         setCredentialNumber(feeobjupdate.getPersonalid());
@@ -198,6 +202,7 @@ public class BaseNewStudentTask {
                         setIsCanBanding(1);
                     }}
             );
+            insCredentialNumber.add(feeobjupdate.getPersonalid());
         }
 
         if (!updateList.isEmpty()) {

+ 4 - 0
src/test/java/com/xjrsoft/module/job/BaseNewStudentTaskTest.java

@@ -35,8 +35,10 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 import static org.junit.jupiter.api.Assertions.*;
@@ -141,6 +143,8 @@ class BaseNewStudentTaskTest {
         );
         Map<String, Long> majorSetNameMap = majorSetList.stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
 
+        Set<String> insCredentialNumber = new HashSet<>();
+
         //循环攀宝的数据,准备更新到新生表中
         List<BaseNewStudent> updateList = new ArrayList<>();
         List<BaseNewStudent> insertList = new ArrayList<>();