|
|
@@ -15,6 +15,8 @@ import com.usoftchina.smartschool.school.dto.DocBaseDTO;
|
|
|
import com.usoftchina.smartschool.school.dto.ListReqDTO;
|
|
|
import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
|
import com.usoftchina.smartschool.school.mapper.DataImportMapper;
|
|
|
+import com.usoftchina.smartschool.school.mapper.SysClazzMapper;
|
|
|
+import com.usoftchina.smartschool.school.mapper.SysGradeMapper;
|
|
|
import com.usoftchina.smartschool.school.mapper.SysStudentMapper;
|
|
|
import com.usoftchina.smartschool.school.po.*;
|
|
|
import com.usoftchina.smartschool.utils.CollectionUtils;
|
|
|
@@ -41,6 +43,10 @@ public class StudentServiceImpl implements StudentService{
|
|
|
private DataImportMapper dataImportMapper;
|
|
|
@Autowired
|
|
|
private AccountApi accountApi;
|
|
|
+ @Autowired
|
|
|
+ private SysGradeMapper sysGradeMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysClazzMapper sysClazzMapper;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<SysStudent> getListData(PageRequest page, ListReqDTO listReqDTO) {
|
|
|
@@ -216,6 +222,15 @@ public class StudentServiceImpl implements StudentService{
|
|
|
|
|
|
SysStudent stu = JSONObject.parseObject(json.toJSONString(), SysStudent.class);
|
|
|
|
|
|
+ //校验年级班级是否存在
|
|
|
+ SysGrade sysGrade = sysGradeMapper.selectByName(stu.getStu_grade(), schoolId);
|
|
|
+ if (ObjectUtils.isEmpty(sysGrade)) {
|
|
|
+ throw new BizException(BizExceptionCode.NONGRADE);
|
|
|
+ }
|
|
|
+ SysClazz sysClazz = sysClazzMapper.selectByName(stu.getStu_class(), sysGrade.getGrade_id(), schoolId);
|
|
|
+ if (ObjectUtils.isEmpty(sysClazz)) {
|
|
|
+ throw new BizException(BizExceptionCode.NONCLAZZ);
|
|
|
+ }
|
|
|
//学生不存在
|
|
|
if (null == student) {
|
|
|
stu.setSchool_id(schoolId);
|