|
@@ -48,12 +48,12 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
private BasicCampusService basicCampusService;
|
|
|
|
|
|
@Override
|
|
|
- public IPage<BasicStudentResult> basicStudentPage(String queryParams,Long campusId, Set<Long> clazzIdList,int pageNumber, int pageSize) {
|
|
|
+ public IPage<BasicStudentResult> basicStudentPage(String queryParams, Long campusId, Set<Long> clazzIdList, int pageNumber, int pageSize) {
|
|
|
Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
// Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
|
Set<Long> orgIds = null;
|
|
|
queryParams = SystemConstant.translateSpecificSign(queryParams);
|
|
|
- return basicStudentMapper.findBasicStudentPage(new Page<>(pageNumber, pageSize), queryParams, schoolId,campusId, clazzIdList,orgIds);
|
|
|
+ return basicStudentMapper.findBasicStudentPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, campusId, clazzIdList, orgIds);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -85,7 +85,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
if (idList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请选择要删除的目标");
|
|
|
}
|
|
|
- return this.remove(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getId,idList));
|
|
|
+ return this.remove(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getId, idList));
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -95,13 +95,13 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
Long schoolId = sysUser.getSchoolId();
|
|
|
final String link = "-";
|
|
|
// key = campusName
|
|
|
- Map<String,BasicCampus> campusMap = new HashMap<>();
|
|
|
+ Map<String, BasicCampus> campusMap = new HashMap<>();
|
|
|
// key = collegeName
|
|
|
- Map<String,SysOrg> collegeMap = new HashMap<>();
|
|
|
+ Map<String, SysOrg> collegeMap = new HashMap<>();
|
|
|
// key = collegeId + "-" + majorName
|
|
|
- Map<String,Long> majorMap = new HashMap<>();
|
|
|
+ Map<String, Long> majorMap = new HashMap<>();
|
|
|
// key = majorId + "-" + clazzName
|
|
|
- Map<String,Long> clazzMap = new HashMap<>();
|
|
|
+ Map<String, Long> clazzMap = new HashMap<>();
|
|
|
|
|
|
List<BasicStudentParams> addBasicStudentParamsList = new ArrayList<>();
|
|
|
for (int i = 0; i < finalList.size(); i++) {
|
|
@@ -109,7 +109,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
List<Object> basicStudentImportDtoList = excelMap.get(i);
|
|
|
|
|
|
assert basicStudentImportDtoList != null;
|
|
|
- if (basicStudentImportDtoList.get(0) instanceof DescribeImportDto){
|
|
|
+ if (basicStudentImportDtoList.get(0) instanceof DescribeImportDto) {
|
|
|
continue;
|
|
|
}
|
|
|
List<BasicStudentImportDto> datasource = basicStudentImportDtoList.stream().map(e -> {
|
|
@@ -141,7 +141,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
basicCampus = basicCampusService.getOne(new QueryWrapper<BasicCampus>().lambda()
|
|
|
.eq(BasicCampus::getSchoolId, schoolId)
|
|
|
.eq(BasicCampus::getCampusName, campusName));
|
|
|
- if (Objects.isNull(basicCampus)){
|
|
|
+ if (Objects.isNull(basicCampus)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("系统中不存在【校区】:" + campusName);
|
|
|
}
|
|
|
campusMap.put(campusName, basicCampus);
|
|
@@ -151,7 +151,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
|
|
|
// 学院
|
|
|
Long collegeId = null;
|
|
|
- if (SystemConstant.strNotNull(collegeName)){
|
|
|
+ if (SystemConstant.strNotNull(collegeName)) {
|
|
|
SysOrg sysOrg;
|
|
|
if (collegeMap.containsKey(collegeName)) {
|
|
|
sysOrg = collegeMap.get(collegeName);
|
|
@@ -159,7 +159,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
sysOrg = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
|
|
|
.eq(SysOrg::getSchoolId, schoolId)
|
|
|
.eq(SysOrg::getName, collegeName));
|
|
|
- if (Objects.isNull(sysOrg)){
|
|
|
+ if (Objects.isNull(sysOrg)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("系统中不存在【学院】:" + collegeName);
|
|
|
}
|
|
|
collegeMap.put(collegeName, sysOrg);
|
|
@@ -196,36 +196,36 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
|
|
|
// 班级
|
|
|
Long clazzId = null;
|
|
|
- if (SystemConstant.strNotNull(clazzName)){
|
|
|
- if (!SystemConstant.longNotNull(campusId)){
|
|
|
+ if (SystemConstant.strNotNull(clazzName)) {
|
|
|
+ if (!SystemConstant.longNotNull(campusId)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生班级信息缺失校区信息异常");
|
|
|
}
|
|
|
- if (!SystemConstant.longNotNull(collegeId)){
|
|
|
+ if (!SystemConstant.longNotNull(collegeId)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生班级信息缺失学院信息异常");
|
|
|
}
|
|
|
- if (!SystemConstant.longNotNull(majorId)){
|
|
|
+ if (!SystemConstant.longNotNull(majorId)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生班级信息缺失专业信息异常");
|
|
|
}
|
|
|
|
|
|
String clazzKey = majorId + link + clazzName;
|
|
|
- if (clazzMap.containsKey(clazzKey)){
|
|
|
+ if (clazzMap.containsKey(clazzKey)) {
|
|
|
clazzId = clazzMap.get(clazzKey);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
BasicClazz basicClazz = basicClazzService.getOne(new QueryWrapper<BasicClazz>().lambda()
|
|
|
- .eq(BasicClazz::getSchoolId,schoolId)
|
|
|
- .eq(BasicClazz::getMajorId,majorId)
|
|
|
- .eq(BasicClazz::getClazzName,clazzName));
|
|
|
- if (Objects.isNull(basicClazz)){
|
|
|
+ .eq(BasicClazz::getSchoolId, schoolId)
|
|
|
+ .eq(BasicClazz::getMajorId, majorId)
|
|
|
+ .eq(BasicClazz::getClazzName, clazzName));
|
|
|
+ if (Objects.isNull(basicClazz)) {
|
|
|
// 新增一个clazz
|
|
|
BasicClazzParams basicClazzParams = new BasicClazzParams();
|
|
|
basicClazzParams.setCampusId(campusId);
|
|
|
basicClazzParams.setMajorId(majorId);
|
|
|
basicClazzParams.setClazzName(clazzName);
|
|
|
- clazzId = basicClazzService.saveBasicClazz(basicClazzParams,sysUser);
|
|
|
- }else {
|
|
|
+ clazzId = basicClazzService.saveBasicClazz(basicClazzParams, sysUser);
|
|
|
+ } else {
|
|
|
clazzId = basicClazz.getId();
|
|
|
}
|
|
|
- clazzMap.put(clazzKey,clazzId);
|
|
|
+ clazzMap.put(clazzKey, clazzId);
|
|
|
}
|
|
|
}
|
|
|
// 学生信息组装
|
|
@@ -233,16 +233,16 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
basicStudentParams.setStudentName(studentName);
|
|
|
basicStudentParams.setStudentCode(studentCode);
|
|
|
basicStudentParams.setPhoneNumber(phoneNumber);
|
|
|
- if (SystemConstant.longNotNull(campusId)){
|
|
|
+ if (SystemConstant.longNotNull(campusId)) {
|
|
|
basicStudentParams.setCampusId(campusId);
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(collegeId)){
|
|
|
+ if (SystemConstant.longNotNull(collegeId)) {
|
|
|
basicStudentParams.setCollegeId(collegeId);
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(majorId)){
|
|
|
+ if (SystemConstant.longNotNull(majorId)) {
|
|
|
basicStudentParams.setMajorId(majorId);
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(clazzId)){
|
|
|
+ if (SystemConstant.longNotNull(clazzId)) {
|
|
|
basicStudentParams.setClazzId(clazzId);
|
|
|
}
|
|
|
|
|
@@ -283,19 +283,19 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
Long collegeId = basicStudentParams.getCollegeId();
|
|
|
|
|
|
// 班级验证
|
|
|
- if (SystemConstant.longNotNull(clazzId)){
|
|
|
+ if (SystemConstant.longNotNull(clazzId)) {
|
|
|
// 如果有班级id 再验证
|
|
|
BasicClazz basicClazz = basicClazzService.getById(clazzId);
|
|
|
if (Objects.isNull(basicClazz)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("所选班级不存在");
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(campusId)){
|
|
|
- if (!campusId.equals(basicClazz.getCampusId())){
|
|
|
+ if (SystemConstant.longNotNull(campusId)) {
|
|
|
+ if (!campusId.equals(basicClazz.getCampusId())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生所属班级信息和学生信息中【校区】不对应");
|
|
|
}
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(majorId)){
|
|
|
- if (!majorId.equals(basicClazz.getMajorId())){
|
|
|
+ if (SystemConstant.longNotNull(majorId)) {
|
|
|
+ if (!majorId.equals(basicClazz.getMajorId())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生所属班级信息和学生信息中【专业】不对应");
|
|
|
}
|
|
|
}
|
|
@@ -303,13 +303,13 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
|
|
|
|
|
|
// 专业验证
|
|
|
- if (SystemConstant.longNotNull(majorId)){
|
|
|
+ if (SystemConstant.longNotNull(majorId)) {
|
|
|
BasicMajor basicMajor = basicMajorService.getById(majorId);
|
|
|
if (Objects.isNull(basicMajor)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("所选专业不存在");
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(collegeId)){
|
|
|
- if (!collegeId.equals(basicMajor.getBelongOrgId())){
|
|
|
+ if (SystemConstant.longNotNull(collegeId)) {
|
|
|
+ if (!collegeId.equals(basicMajor.getBelongOrgId())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学生所属专业信息和学生信息中【学院】不对应");
|
|
|
}
|
|
|
}
|
|
@@ -328,7 +328,7 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
|
|
|
}
|
|
|
|
|
|
// 检验有值的电话在学校的唯一性
|
|
|
- if (SystemConstant.strNotNull(phoneNumber)){
|
|
|
+ if (SystemConstant.strNotNull(phoneNumber)) {
|
|
|
BasicStudent checkPhone = this.getOne(new QueryWrapper<BasicStudent>().lambda()
|
|
|
.eq(BasicStudent::getSchoolId, schoolId)
|
|
|
.eq(BasicStudent::getPhoneNumber, phoneNumber)
|