|
@@ -69,6 +69,9 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WelcomeSchoolService welcomeSchoolService;
|
|
private WelcomeSchoolService welcomeSchoolService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private WelcomeAccountService welcomeAccountService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public CommonResult insertBedInfo(InsertWelcomeBedRequest iwbr, BindingResult bindingResult) {
|
|
public CommonResult insertBedInfo(InsertWelcomeBedRequest iwbr, BindingResult bindingResult) {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
@@ -79,16 +82,28 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
if (ObjectUtils.isEmpty(byId)) {
|
|
if (ObjectUtils.isEmpty(byId)) {
|
|
|
return CommonResult.fail("该宿舍号不存在");
|
|
return CommonResult.fail("该宿舍号不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!byId.getSex().equals(iwbr.getSex())) {
|
|
if (!byId.getSex().equals(iwbr.getSex())) {
|
|
|
return CommonResult.fail("请勿跨性别添加床位");
|
|
return CommonResult.fail("请勿跨性别添加床位");
|
|
|
}
|
|
}
|
|
|
|
|
+ Integer bedNumber = byId.getBedNumber();
|
|
|
|
|
+// 查询该寝室下有多少床位
|
|
|
|
|
+ LambdaQueryWrapper<WelcomeBed> wrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(WelcomeBed::getDormitoryId,iwbr.getDormitoryId());
|
|
|
|
|
+ List<WelcomeBed> list = welcomeBedService.list(wrapper);
|
|
|
|
|
|
|
|
|
|
+ if (list.size()>=bedNumber) {
|
|
|
|
|
+ return CommonResult.fail("该寝室的床位号已满");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
WelcomeBed existData = welcomeBedService.queryBedData(iwbr.getSchool(), iwbr.getBuildId(), iwbr.getDormitoryId(), iwbr.getNumber());
|
|
WelcomeBed existData = welcomeBedService.queryBedData(iwbr.getSchool(), iwbr.getBuildId(), iwbr.getDormitoryId(), iwbr.getNumber());
|
|
|
if (existData != null) {
|
|
if (existData != null) {
|
|
|
return CommonResult.fail("该床位号已存在,请勿重复插入!");
|
|
return CommonResult.fail("该床位号已存在,请勿重复插入!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
WelcomeBed wb = new WelcomeBed();
|
|
WelcomeBed wb = new WelcomeBed();
|
|
|
|
|
|
|
|
if (StringUtils.hasText(iwbr.getCardNum())) {
|
|
if (StringUtils.hasText(iwbr.getCardNum())) {
|
|
@@ -196,8 +211,21 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public CommonResult queryPageBeds(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState) {
|
|
|
|
|
- PageUtils<WelcomeBed> result = welcomeBedService.queryPageWelcomeBeds(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
|
|
|
|
|
|
|
+ public CommonResult queryPageBeds(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,Integer accountId) {
|
|
|
|
|
+ // 当学院为空
|
|
|
|
|
+ PageUtils<WelcomeBed> result=null;
|
|
|
|
|
+ if (ObjectUtils.isEmpty(collegeId)) {
|
|
|
|
|
+ String collegeIds = "";
|
|
|
|
|
+ WelcomeAccount account = welcomeAccountService.getById(accountId);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(account)) {
|
|
|
|
|
+ return CommonResult.fail("当前账号不存在,请重新登入");
|
|
|
|
|
+ }
|
|
|
|
|
+ collegeIds = account.getCollegeId();
|
|
|
|
|
+ result = welcomeBedService.queryPageWelcomeBedsC(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result = welcomeBedService.queryPageWelcomeBeds(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return CommonResult.ok(result);
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -346,7 +374,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
Optional<WelcomeBed> ob = wb.stream().filter(e -> e.getSchool().equals(school) && e.getBuild().equals(build)
|
|
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();
|
|
&& e.getDormitory().equals(dormitory) && e.getNumber().intValue() == Integer.valueOf(number).intValue()).findFirst();
|
|
|
if (ob != null && ob.isPresent()) {
|
|
if (ob != null && ob.isPresent()) {
|
|
|
- return CommonResult.fail("第"+rowNum+1+"行,已存在该床位");
|
|
|
|
|
|
|
+ bedData.setId(ob.get().getId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
@@ -530,7 +558,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
Optional<WelcomeBed> ob = wb.stream().filter(e -> e.getSchool().equals(school) && e.getBuild().equals(build)
|
|
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();
|
|
&& e.getDormitory().equals(dormitory) && e.getNumber().intValue() == Integer.valueOf(number).intValue()).findFirst();
|
|
|
if (ob != null && ob.isPresent()) {
|
|
if (ob != null && ob.isPresent()) {
|
|
|
- return CommonResult.fail("第"+rowNum+1+"行,已存在该床位");
|
|
|
|
|
|
|
+ bedData.setId(ob.get().getId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
String sex = dataFormatter.formatCellValue(row.getCell(4));//床位性别
|
|
@@ -633,8 +661,22 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void welcomeBedExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState) {
|
|
|
|
|
- List<WelcomeBed> result = welcomeBedService.queryPageWelcomeBeds(schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
|
|
|
|
|
|
|
+ public void welcomeBedExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,Integer accountId) {
|
|
|
|
|
+ // 当学院为空
|
|
|
|
|
+ List<WelcomeBed> result=null;
|
|
|
|
|
+ if (ObjectUtils.isEmpty(collegeId)) {
|
|
|
|
|
+ String collegeIds = "";
|
|
|
|
|
+ WelcomeAccount account = welcomeAccountService.getById(accountId);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(account)) {
|
|
|
|
|
+ throw new RuntimeException("当前账号不存在,请重新登入");
|
|
|
|
|
+ }
|
|
|
|
|
+ collegeIds = account.getCollegeId();
|
|
|
|
|
+ result = welcomeBedService.queryPageWelcomeBedsS(schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result = welcomeBedService.queryPageWelcomeBeds(schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//导出
|
|
//导出
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
Workbook workbook = new XSSFWorkbook();
|
|
@@ -1027,14 +1069,39 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public CommonResult studentAccommodationPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name) {
|
|
|
|
|
- PageUtils<WelcomeBed> result = welcomeBedService.studentAccommodationPage(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
|
|
|
|
|
|
|
+ public CommonResult studentAccommodationPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name,Integer accountId) {
|
|
|
|
|
+ // 当学院为空
|
|
|
|
|
+ PageUtils<WelcomeBed> result=null;
|
|
|
|
|
+ if (ObjectUtils.isEmpty(collegeId)) {
|
|
|
|
|
+ String collegeIds = "";
|
|
|
|
|
+ WelcomeAccount account = welcomeAccountService.getById(accountId);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(account)) {
|
|
|
|
|
+ return CommonResult.fail("当前账号不存在,请重新登入");
|
|
|
|
|
+ }
|
|
|
|
|
+ collegeIds = account.getCollegeId();
|
|
|
|
|
+ result = welcomeBedService.studentAccommodationPageS(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeIds, majorId, classstrId,name);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result = welcomeBedService.studentAccommodationPage(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
|
|
|
|
|
+ }
|
|
|
return CommonResult.ok(result);
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void studentAccommodationListExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name) {
|
|
|
|
|
- List<WelcomeBed> result=welcomeBedService.studentAccommodationList( schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
|
|
|
|
|
|
|
+ public void studentAccommodationListExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name,Integer accountId) {
|
|
|
|
|
+ // 当学院为空
|
|
|
|
|
+ List<WelcomeBed> result=null;
|
|
|
|
|
+ if (ObjectUtils.isEmpty(collegeId)) {
|
|
|
|
|
+ String collegeIds = "";
|
|
|
|
|
+ WelcomeAccount account = welcomeAccountService.getById(accountId);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(account)) {
|
|
|
|
|
+ throw new RuntimeException("当前账号不存在,请重新登入");
|
|
|
|
|
+ }
|
|
|
|
|
+ collegeIds = account.getCollegeId();
|
|
|
|
|
+ result =welcomeBedService.studentAccommodationListS( schoolId, buildId, dormitoryId,collegeIds, majorId, classstrId,name);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ result = welcomeBedService.studentAccommodationList( schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//导出
|
|
//导出
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
Workbook workbook = new XSSFWorkbook();
|
|
@@ -1209,5 +1276,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|