|
|
@@ -66,6 +66,9 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
@Autowired
|
|
|
private WelcomeDormitoryService welcomeDormitoryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WelcomeSchoolService welcomeSchoolService;
|
|
|
+
|
|
|
@Override
|
|
|
public CommonResult insertBedInfo(InsertWelcomeBedRequest iwbr, BindingResult bindingResult) {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
@@ -270,6 +273,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
List<WelcomeOrg> wos = welcomeOrgService.list(null);
|
|
|
List<WelcomeBuild> wbils = welcomeBuildService.list(null);
|
|
|
List<WelcomeDormitory> wds = welcomeDormitoryService.list(null);
|
|
|
+ List<WelcomeSchool> ws = welcomeSchoolService.list(null);
|
|
|
|
|
|
//读取第一张sheet
|
|
|
HSSFSheet sheetAt = sheets.getSheetAt(0);
|
|
|
@@ -287,99 +291,82 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
//所以先使用setCellType()方法先将该单元格的类型设置为STRING
|
|
|
//然后poi会根据字符串读取它
|
|
|
if (rowNum == 0) {
|
|
|
- String num = dataFormatter.formatCellValue(row.getCell(0));//序号
|
|
|
- if (!num.equals("序号")) {
|
|
|
- return CommonResult.fail("导入数据第一列为序号");
|
|
|
- }
|
|
|
- String school = dataFormatter.formatCellValue(row.getCell(1));//序号
|
|
|
+ String school = dataFormatter.formatCellValue(row.getCell(0));//校区名称
|
|
|
if (!school.equals("校区名称")) {
|
|
|
return CommonResult.fail("导入数据第一列为校区名称");
|
|
|
}
|
|
|
- String build = dataFormatter.formatCellValue(row.getCell(2));//校区名称
|
|
|
+ String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋名称
|
|
|
if (!build.equals("楼栋名称")) {
|
|
|
return CommonResult.fail("导入数据第二列为楼栋名称");
|
|
|
}
|
|
|
- String dormitory = dataFormatter.formatCellValue(row.getCell(3));//楼栋名称
|
|
|
+ String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
|
|
|
if (!dormitory.equals("寝室号")) {
|
|
|
return CommonResult.fail("导入数据第三列为寝室号");
|
|
|
}
|
|
|
- String number = dataFormatter.formatCellValue(row.getCell(4));//楼栋性别
|
|
|
+ String number = dataFormatter.formatCellValue(row.getCell(3));//床位号
|
|
|
if (!number.equals("床位号")) {
|
|
|
return CommonResult.fail("导入数据第四列为床位号");
|
|
|
}
|
|
|
- String sex = dataFormatter.formatCellValue(row.getCell(5));//床位性别
|
|
|
+ String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
|
if (!sex.equals("床位性别")) {
|
|
|
return CommonResult.fail("导入数据第五列为床位性别");
|
|
|
}
|
|
|
|
|
|
- String grade = dataFormatter.formatCellValue(row.getCell(6));//所属年级
|
|
|
+ String grade = dataFormatter.formatCellValue(row.getCell(5));//所属年级
|
|
|
if (!grade.equals("所属年级")) {
|
|
|
- return CommonResult.fail("导入数据第五列为所属年级");
|
|
|
+ return CommonResult.fail("导入数据第六列为所属年级");
|
|
|
}
|
|
|
- String college = dataFormatter.formatCellValue(row.getCell(7));//所属学院
|
|
|
+ String college = dataFormatter.formatCellValue(row.getCell(6));//所属学院
|
|
|
if (!college.equals("所属学院")) {
|
|
|
- return CommonResult.fail("导入数据第六列为所属学院");
|
|
|
+ return CommonResult.fail("导入数据第七列为所属学院");
|
|
|
}
|
|
|
- String major = dataFormatter.formatCellValue(row.getCell(8));//所属专业
|
|
|
+ String major = dataFormatter.formatCellValue(row.getCell(7));//所属专业
|
|
|
if (!major.equals("所属专业")) {
|
|
|
- return CommonResult.fail("导入数据第七列为所属专业");
|
|
|
+ return CommonResult.fail("导入数据第八列为所属专业");
|
|
|
}
|
|
|
- String classstr = dataFormatter.formatCellValue(row.getCell(9));//备注
|
|
|
+ String classstr = dataFormatter.formatCellValue(row.getCell(8));//所属班级
|
|
|
if (!classstr.equals("所属班级")) {
|
|
|
- return CommonResult.fail("导入数据第八列为所属班级");
|
|
|
+ return CommonResult.fail("导入数据第九列为所属班级");
|
|
|
}
|
|
|
- String instructor = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
+ String instructor = dataFormatter.formatCellValue(row.getCell(9));//辅导员
|
|
|
if (!instructor.equals("辅导员")) {
|
|
|
- return CommonResult.fail("导入数据第九列为辅导员");
|
|
|
+ return CommonResult.fail("导入数据第十列为辅导员");
|
|
|
}
|
|
|
- String isCheck = dataFormatter.formatCellValue(row.getCell(11));//备注
|
|
|
- if (!isCheck.equals("是否入住")) {
|
|
|
- return CommonResult.fail("导入数据第十列为是否入住");
|
|
|
- }
|
|
|
- String admissNum = dataFormatter.formatCellValue(row.getCell(12));//备注
|
|
|
- if (!admissNum.equals("录取号")) {
|
|
|
- return CommonResult.fail("导入数据第十一列为录取号");
|
|
|
- }
|
|
|
- String name = dataFormatter.formatCellValue(row.getCell(13));//备注
|
|
|
- if (!name.equals("姓名")) {
|
|
|
- return CommonResult.fail("导入数据第十二列为姓名");
|
|
|
- }
|
|
|
- String remark = dataFormatter.formatCellValue(row.getCell(14));//备注
|
|
|
+ String remark = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
if (!remark.equals("备注")) {
|
|
|
- return CommonResult.fail("导入数据第十三列为备注");
|
|
|
- }
|
|
|
- String retentionState = dataFormatter.formatCellValue(row.getCell(15));//是否保留
|
|
|
- if (!retentionState.equals("是否保留")) {
|
|
|
- return CommonResult.fail("导入数据第十四列为是否保留");
|
|
|
+ return CommonResult.fail("导入数据第十一列为备注");
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
WelcomeBed bedData = new WelcomeBed();
|
|
|
-
|
|
|
- String school = dataFormatter.formatCellValue(row.getCell(1));//校区
|
|
|
- String build = dataFormatter.formatCellValue(row.getCell(2));//楼栋
|
|
|
- String dormitory = dataFormatter.formatCellValue(row.getCell(3));//寝室号
|
|
|
- String number = dataFormatter.formatCellValue(row.getCell(4));//床位号
|
|
|
+ String school = dataFormatter.formatCellValue(row.getCell(0));//校区
|
|
|
+ String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋
|
|
|
+ String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
|
|
|
+ String number = dataFormatter.formatCellValue(row.getCell(3));//床位号
|
|
|
Optional<WelcomeBed> ob = wb.stream().filter(e -> e.getSchool().equals(school) && e.getBuild().equals(build)
|
|
|
&& e.getDormitory().equals(dormitory) && e.getNumber().intValue() == Integer.valueOf(number).intValue()).findFirst();
|
|
|
if (ob != null && ob.isPresent()) {
|
|
|
- bedData.setId(ob.get().getId());
|
|
|
+ return CommonResult.fail("第"+rowNum+1+"行,已存在该床位");
|
|
|
}
|
|
|
|
|
|
- String sex = dataFormatter.formatCellValue(row.getCell(5));//楼栋层数
|
|
|
- String grade = dataFormatter.formatCellValue(row.getCell(6));//起始层数
|
|
|
- String college = dataFormatter.formatCellValue(row.getCell(7));//起始层数
|
|
|
- String major = dataFormatter.formatCellValue(row.getCell(8));//备注
|
|
|
- String classstr = dataFormatter.formatCellValue(row.getCell(9));//备注
|
|
|
- String instructor = dataFormatter.formatCellValue(row.getCell(10));//辅导员
|
|
|
- String isCheck = dataFormatter.formatCellValue(row.getCell(11));//备注
|
|
|
- String admissNum = dataFormatter.formatCellValue(row.getCell(12));//备注
|
|
|
- String name = dataFormatter.formatCellValue(row.getCell(13));//备注
|
|
|
- String remark = dataFormatter.formatCellValue(row.getCell(14));//备注
|
|
|
- String retentionState = dataFormatter.formatCellValue(row.getCell(15));//是否保留
|
|
|
-
|
|
|
-
|
|
|
- bedData.setSchool(school);
|
|
|
+ String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
|
+ String grade = dataFormatter.formatCellValue(row.getCell(5));//所属年级
|
|
|
+ String college = dataFormatter.formatCellValue(row.getCell(6));//所属学院
|
|
|
+ String major = dataFormatter.formatCellValue(row.getCell(7));//所属专业
|
|
|
+ String classstr = dataFormatter.formatCellValue(row.getCell(8));//所属班级
|
|
|
+ String instructor = dataFormatter.formatCellValue(row.getCell(9));//辅导员
|
|
|
+ String remark = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
+
|
|
|
+ //校区
|
|
|
+ if (ws != null && ws.size() > 0) {
|
|
|
+ Optional<WelcomeSchool> wsl = ws.stream().filter(e -> e.getSchool().equals(school)).findFirst();
|
|
|
+ if (wsl != null && wsl.isPresent()) {
|
|
|
+ bedData.setSchoolId(wsl.get().getId());
|
|
|
+ bedData.setSchool(school);
|
|
|
+ } else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该校区");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//楼栋
|
|
|
if (wbils != null && wbils.size() > 0) {
|
|
|
@@ -387,6 +374,8 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (oBuild != null && oBuild.isPresent()) {
|
|
|
bedData.setBuild(build);
|
|
|
bedData.setBuildId(oBuild.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该楼栋");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -394,8 +383,17 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (wds != null && wds.size() > 0) {
|
|
|
Optional<WelcomeDormitory> oDormitory = wds.stream().filter(e -> e.getDormitory().equals(dormitory)).findFirst();
|
|
|
if (oDormitory != null && oDormitory.isPresent()) {
|
|
|
+ if (!oDormitory.get().getSex().equals(sex)) {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,床位性别和寝室性别不一致");
|
|
|
+ }
|
|
|
+ if (!oDormitory.get().getCollege().equals(college)) {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,床位院系和寝室院系不一致");
|
|
|
+ }
|
|
|
+
|
|
|
bedData.setDormitory(dormitory);
|
|
|
bedData.setDormitoryId(oDormitory.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该寝室号");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -407,26 +405,30 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (owo != null && owo.isPresent()) {
|
|
|
bedData.setCollege(college);
|
|
|
bedData.setCollegeId(owo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该院系");
|
|
|
}
|
|
|
|
|
|
Optional<WelcomeOrg> omwo = wos.stream().filter(e -> e.getName().equals(major)).findFirst();
|
|
|
if (omwo != null && omwo.isPresent()) {
|
|
|
bedData.setMajor(major);
|
|
|
bedData.setMajorId(omwo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该专业");
|
|
|
}
|
|
|
|
|
|
Optional<WelcomeOrg> ocwo = wos.stream().filter(e -> e.getName().equals(classstr)).findFirst();
|
|
|
if (ocwo != null && ocwo.isPresent()) {
|
|
|
bedData.setClassstr(classstr);
|
|
|
bedData.setClassstrId(ocwo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该班级");
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- bedData.setIsCheck(Integer.valueOf(isCheck));
|
|
|
- bedData.setCardNum(admissNum);
|
|
|
- bedData.setName(name);
|
|
|
+ bedData.setIsCheck(0);
|
|
|
bedData.setRemark(remark);
|
|
|
- bedData.setRetentionState(Integer.valueOf(retentionState));
|
|
|
+ bedData.setRetentionState(1);
|
|
|
bedData.setInstructor(instructor);
|
|
|
bedData.setGrade(Integer.valueOf(grade));
|
|
|
result.add(bedData);
|
|
|
@@ -456,7 +458,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
List<WelcomeOrg> wos = welcomeOrgService.list(null);
|
|
|
List<WelcomeBuild> wbils = welcomeBuildService.list(null);
|
|
|
List<WelcomeDormitory> wds = welcomeDormitoryService.list(null);
|
|
|
-
|
|
|
+ List<WelcomeSchool> ws = welcomeSchoolService.list(null);
|
|
|
//读取第一张sheet
|
|
|
XSSFSheet sheetAt = sheets.getSheetAt(0);
|
|
|
DataFormatter dataFormatter = new DataFormatter();
|
|
|
@@ -473,97 +475,82 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
//所以先使用setCellType()方法先将该单元格的类型设置为STRING
|
|
|
//然后poi会根据字符串读取它
|
|
|
if (rowNum == 0) {
|
|
|
- String num = dataFormatter.formatCellValue(row.getCell(0));//序号
|
|
|
- if (!num.equals("序号")) {
|
|
|
- return CommonResult.fail("导入数据第一列为序号");
|
|
|
- }
|
|
|
- String school = dataFormatter.formatCellValue(row.getCell(1));//序号
|
|
|
+ String school = dataFormatter.formatCellValue(row.getCell(0));//校区名称
|
|
|
if (!school.equals("校区名称")) {
|
|
|
return CommonResult.fail("导入数据第一列为校区名称");
|
|
|
}
|
|
|
- String build = dataFormatter.formatCellValue(row.getCell(2));//校区名称
|
|
|
+ String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋名称
|
|
|
if (!build.equals("楼栋名称")) {
|
|
|
return CommonResult.fail("导入数据第二列为楼栋名称");
|
|
|
}
|
|
|
- String dormitory = dataFormatter.formatCellValue(row.getCell(3));//楼栋名称
|
|
|
+ String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
|
|
|
if (!dormitory.equals("寝室号")) {
|
|
|
return CommonResult.fail("导入数据第三列为寝室号");
|
|
|
}
|
|
|
- String number = dataFormatter.formatCellValue(row.getCell(4));//楼栋性别
|
|
|
+ String number = dataFormatter.formatCellValue(row.getCell(3));//床位号
|
|
|
if (!number.equals("床位号")) {
|
|
|
return CommonResult.fail("导入数据第四列为床位号");
|
|
|
}
|
|
|
- String sex = dataFormatter.formatCellValue(row.getCell(5));//楼栋层数
|
|
|
+ String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
|
if (!sex.equals("床位性别")) {
|
|
|
return CommonResult.fail("导入数据第五列为床位性别");
|
|
|
}
|
|
|
- String grade = dataFormatter.formatCellValue(row.getCell(6));//起始层数
|
|
|
+
|
|
|
+ String grade = dataFormatter.formatCellValue(row.getCell(5));//所属年级
|
|
|
if (!grade.equals("所属年级")) {
|
|
|
return CommonResult.fail("导入数据第六列为所属年级");
|
|
|
}
|
|
|
-
|
|
|
- String college = dataFormatter.formatCellValue(row.getCell(7));//起始层数
|
|
|
+ String college = dataFormatter.formatCellValue(row.getCell(6));//所属学院
|
|
|
if (!college.equals("所属学院")) {
|
|
|
- return CommonResult.fail("导入数据第六列为所属学院");
|
|
|
+ return CommonResult.fail("导入数据第七列为所属学院");
|
|
|
}
|
|
|
- String major = dataFormatter.formatCellValue(row.getCell(8));//备注
|
|
|
+ String major = dataFormatter.formatCellValue(row.getCell(7));//所属专业
|
|
|
if (!major.equals("所属专业")) {
|
|
|
- return CommonResult.fail("导入数据第七列为所属专业");
|
|
|
+ return CommonResult.fail("导入数据第八列为所属专业");
|
|
|
}
|
|
|
- String classstr = dataFormatter.formatCellValue(row.getCell(9));//备注
|
|
|
+ String classstr = dataFormatter.formatCellValue(row.getCell(8));//所属班级
|
|
|
if (!classstr.equals("所属班级")) {
|
|
|
- return CommonResult.fail("导入数据第八列为所属班级");
|
|
|
+ return CommonResult.fail("导入数据第九列为所属班级");
|
|
|
}
|
|
|
- String instructor = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
+ String instructor = dataFormatter.formatCellValue(row.getCell(9));//辅导员
|
|
|
if (!instructor.equals("辅导员")) {
|
|
|
- return CommonResult.fail("导入数据第九列为辅导员");
|
|
|
- }
|
|
|
- String isCheck = dataFormatter.formatCellValue(row.getCell(11));//备注
|
|
|
- if (!isCheck.equals("是否入住")) {
|
|
|
- return CommonResult.fail("导入数据第十列为是否入住");
|
|
|
+ return CommonResult.fail("导入数据第十列为辅导员");
|
|
|
}
|
|
|
- String admissNum = dataFormatter.formatCellValue(row.getCell(12));//备注
|
|
|
- if (!admissNum.equals("录取号")) {
|
|
|
- return CommonResult.fail("导入数据第十一列为录取号");
|
|
|
- }
|
|
|
- String name = dataFormatter.formatCellValue(row.getCell(13));//备注
|
|
|
- if (!name.equals("姓名")) {
|
|
|
- return CommonResult.fail("导入数据第十二列为姓名");
|
|
|
- }
|
|
|
- String remark = dataFormatter.formatCellValue(row.getCell(14));//备注
|
|
|
+ String remark = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
if (!remark.equals("备注")) {
|
|
|
- return CommonResult.fail("导入数据第十三列为备注");
|
|
|
- }
|
|
|
- String retentionState = dataFormatter.formatCellValue(row.getCell(15));//是否保留
|
|
|
- if (!retentionState.equals("是否保留")) {
|
|
|
- return CommonResult.fail("导入数据第十四列为是否保留");
|
|
|
+ return CommonResult.fail("导入数据第十一列为备注");
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
WelcomeBed bedData = new WelcomeBed();
|
|
|
-
|
|
|
- String school = dataFormatter.formatCellValue(row.getCell(1));//校区
|
|
|
- String build = dataFormatter.formatCellValue(row.getCell(2));//楼栋
|
|
|
- String dormitory = dataFormatter.formatCellValue(row.getCell(3));//寝室号
|
|
|
- String number = dataFormatter.formatCellValue(row.getCell(4));//床位号
|
|
|
+ String school = dataFormatter.formatCellValue(row.getCell(0));//校区
|
|
|
+ String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋
|
|
|
+ String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
|
|
|
+ String number = dataFormatter.formatCellValue(row.getCell(3));//床位号
|
|
|
Optional<WelcomeBed> ob = wb.stream().filter(e -> e.getSchool().equals(school) && e.getBuild().equals(build)
|
|
|
&& e.getDormitory().equals(dormitory) && e.getNumber().intValue() == Integer.valueOf(number).intValue()).findFirst();
|
|
|
if (ob != null && ob.isPresent()) {
|
|
|
- bedData.setId(ob.get().getId());
|
|
|
+ return CommonResult.fail("第"+rowNum+1+"行,已存在该床位");
|
|
|
}
|
|
|
|
|
|
- String sex = dataFormatter.formatCellValue(row.getCell(5));//楼栋层数
|
|
|
- String grade = dataFormatter.formatCellValue(row.getCell(6));//起始层数
|
|
|
- String college = dataFormatter.formatCellValue(row.getCell(7));//起始层数
|
|
|
- String major = dataFormatter.formatCellValue(row.getCell(8));//备注
|
|
|
- String classstr = dataFormatter.formatCellValue(row.getCell(9));//备注
|
|
|
- String instructor = dataFormatter.formatCellValue(row.getCell(10));//辅导员
|
|
|
- String isCheck = dataFormatter.formatCellValue(row.getCell(11));//备注
|
|
|
- String admissNum = dataFormatter.formatCellValue(row.getCell(12));//备注
|
|
|
- String name = dataFormatter.formatCellValue(row.getCell(13));//备注
|
|
|
- String remark = dataFormatter.formatCellValue(row.getCell(14));//备注
|
|
|
- String retentionState = dataFormatter.formatCellValue(row.getCell(15));//是否保留
|
|
|
-
|
|
|
- bedData.setSchool(school);
|
|
|
+ String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
|
+ String grade = dataFormatter.formatCellValue(row.getCell(5));//所属年级
|
|
|
+ String college = dataFormatter.formatCellValue(row.getCell(6));//所属学院
|
|
|
+ String major = dataFormatter.formatCellValue(row.getCell(7));//所属专业
|
|
|
+ String classstr = dataFormatter.formatCellValue(row.getCell(8));//所属班级
|
|
|
+ String instructor = dataFormatter.formatCellValue(row.getCell(9));//辅导员
|
|
|
+ String remark = dataFormatter.formatCellValue(row.getCell(10));//备注
|
|
|
+
|
|
|
+ //校区
|
|
|
+ if (ws != null && ws.size() > 0) {
|
|
|
+ Optional<WelcomeSchool> wsl = ws.stream().filter(e -> e.getSchool().equals(school)).findFirst();
|
|
|
+ if (wsl != null && wsl.isPresent()) {
|
|
|
+ bedData.setSchoolId(wsl.get().getId());
|
|
|
+ bedData.setSchool(school);
|
|
|
+ } else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该校区");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//楼栋
|
|
|
if (wbils != null && wbils.size() > 0) {
|
|
|
@@ -571,6 +558,8 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (oBuild != null && oBuild.isPresent()) {
|
|
|
bedData.setBuild(build);
|
|
|
bedData.setBuildId(oBuild.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该楼栋");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -578,8 +567,17 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (wds != null && wds.size() > 0) {
|
|
|
Optional<WelcomeDormitory> oDormitory = wds.stream().filter(e -> e.getDormitory().equals(dormitory)).findFirst();
|
|
|
if (oDormitory != null && oDormitory.isPresent()) {
|
|
|
+ if (!oDormitory.get().getSex().equals(sex)) {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,床位性别和寝室性别不一致");
|
|
|
+ }
|
|
|
+ if (!oDormitory.get().getCollege().equals(college)) {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,床位院系和寝室院系不一致");
|
|
|
+ }
|
|
|
+
|
|
|
bedData.setDormitory(dormitory);
|
|
|
bedData.setDormitoryId(oDormitory.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该寝室号");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -591,26 +589,30 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (owo != null && owo.isPresent()) {
|
|
|
bedData.setCollege(college);
|
|
|
bedData.setCollegeId(owo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该院系");
|
|
|
}
|
|
|
|
|
|
Optional<WelcomeOrg> omwo = wos.stream().filter(e -> e.getName().equals(major)).findFirst();
|
|
|
if (omwo != null && omwo.isPresent()) {
|
|
|
bedData.setMajor(major);
|
|
|
bedData.setMajorId(omwo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该专业");
|
|
|
}
|
|
|
|
|
|
Optional<WelcomeOrg> ocwo = wos.stream().filter(e -> e.getName().equals(classstr)).findFirst();
|
|
|
if (ocwo != null && ocwo.isPresent()) {
|
|
|
bedData.setClassstr(classstr);
|
|
|
bedData.setClassstrId(ocwo.get().getId());
|
|
|
+ }else {
|
|
|
+ return CommonResult.fail("第" + rowNum + 1 + "行,不存在该班级");
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- bedData.setIsCheck(Integer.valueOf(isCheck));
|
|
|
- bedData.setCardNum(admissNum);
|
|
|
- bedData.setName(name);
|
|
|
+ bedData.setIsCheck(0);
|
|
|
bedData.setRemark(remark);
|
|
|
- bedData.setRetentionState(Integer.valueOf(retentionState));
|
|
|
+ bedData.setRetentionState(1);
|
|
|
bedData.setInstructor(instructor);
|
|
|
bedData.setGrade(Integer.valueOf(grade));
|
|
|
result.add(bedData);
|
|
|
@@ -669,10 +671,24 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
dataRow.createCell(8).setCellValue(bed.getMajor());
|
|
|
dataRow.createCell(9).setCellValue(bed.getClassstr());
|
|
|
dataRow.createCell(10).setCellValue(bed.getInstructor());
|
|
|
- dataRow.createCell(11).setCellValue(bed.getIsCheck());
|
|
|
+ Integer isCheck1 = bed.getIsCheck();
|
|
|
+ String rz="";
|
|
|
+ if (isCheck1==1) {
|
|
|
+ rz="是";
|
|
|
+ }else {
|
|
|
+ rz="否";
|
|
|
+ }
|
|
|
+ dataRow.createCell(11).setCellValue(rz);
|
|
|
dataRow.createCell(12).setCellValue(bed.getCardNum());
|
|
|
dataRow.createCell(13).setCellValue(bed.getName());
|
|
|
dataRow.createCell(14).setCellValue(bed.getRemark());
|
|
|
+ Integer retentionState1 = bed.getRetentionState();
|
|
|
+ String bl="";
|
|
|
+ if (1==retentionState1) {
|
|
|
+ bl="否";
|
|
|
+ }else {
|
|
|
+ bl="是";
|
|
|
+ }
|
|
|
dataRow.createCell(15).setCellValue(bed.getRetentionState());
|
|
|
|
|
|
}
|