Browse Source

增加采购清单接口

周箭河 5 years ago
parent
commit
3605e59bd5

+ 6 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -118,12 +118,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public ClassGroup addClassGroup(ClassGroup classGroup) throws Exception {
     public ClassGroup addClassGroup(ClassGroup classGroup) throws Exception {
+        String userIds = classGroup.getUserIds();
+        if(userIds == null || userIds.isEmpty()) throw new Exception("班级学生不能为空");
+
+        HashSet<String> userIdStrSet = new HashSet<>(Arrays.asList(userIds.split(",")));
+
         Date date = new Date();
         Date date = new Date();
         classGroup.setCreateTime(date);
         classGroup.setCreateTime(date);
         classGroup.setUpdateTime(date);
         classGroup.setUpdateTime(date);
         classGroup.setType(ClassGroupTypeEnum.NORMAL);
         classGroup.setType(ClassGroupTypeEnum.NORMAL);
-        String userIds = classGroup.getUserIds();
-        HashSet<String> userIdStrSet = new HashSet<>(Arrays.asList(userIds.split(",")));
 
 
         classGroup.setExpectStudentNum(userIdStrSet.size());
         classGroup.setExpectStudentNum(userIdStrSet.size());
         classGroup.setStudentNum(userIdStrSet.size());
         classGroup.setStudentNum(userIdStrSet.size());
@@ -139,6 +142,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentList.add(classGroupStudentMapper);
             classGroupStudentList.add(classGroupStudentMapper);
+
             StudentRegistration studentRegistration = new StudentRegistration();
             StudentRegistration studentRegistration = new StudentRegistration();
             studentRegistration.setClassGroupId(classGroup.getId());
             studentRegistration.setClassGroupId(classGroup.getId());
             studentRegistration.setUserId(Integer.getInteger(userId));
             studentRegistration.setUserId(Integer.getInteger(userId));