dzx před 4 měsíci
rodič
revize
2e0e8f3ad0

+ 14 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -19,7 +19,9 @@ import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
 import com.xjrsoft.module.base.entity.BaseClassroom;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
 import com.xjrsoft.module.base.service.IBaseClassroomService;
+import com.xjrsoft.module.base.service.IBaseMajorSetService;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.teacher.entity.BaseTeacher;
@@ -48,6 +50,7 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
     private final BandingTaskClassStudentMapper classStudentMapper;
     private final IBaseClassroomService classroomService;
     private final IUserService userService;
+    private final IBaseMajorSetService majorSetService;
     @Override
     public Boolean add(BandingTaskClass bandingTaskClass) {
         bandingTaskClass.setCreateDate(new Date());
@@ -132,6 +135,16 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
             userMap.put(user.getName(), user.getId());
         }
 
+        List<BaseMajorSet> majorSetList = majorSetService.list(
+                new QueryWrapper<BaseMajorSet>().lambda()
+        );
+
+        Map<String, Long> majorSetMap = new HashMap<>();
+        for (BaseMajorSet majorSet : majorSetList) {
+            majorSetMap.put(majorSet.getName(), majorSet.getId());
+        }
+
+
         List<BandingTaskClass> classList = new ArrayList<>();
         Date createDate = new Date();
         for (Map<Integer, Object> taskClass : excelDataList) {
@@ -139,6 +152,7 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
                 setBandingTaskId(bandingTaskId);
                 setCreateDate(createDate);
                 setName(taskClass.get(1).toString());
+                setMajorSetId(majorSetMap.get(taskClass.get(0).toString().trim()));
                 setNumber(Integer.parseInt(taskClass.get(2).toString()));
                 setClassroomId(classroomMap.get(taskClass.get(4).toString()));
                 if(taskClass.get(5) != null){