入住信息权限解决
This commit is contained in:
@@ -174,12 +174,10 @@ public class SrsDormitoryStudentController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('dms:dormStu:add')")
|
|
||||||
@ApiOperation(value = "学生自主选择床位", notes = "id不用填写,只能选择是当前学生班级并且为空的宿舍床位", response = StudentDormitoryDto.class)
|
@ApiOperation(value = "学生自主选择床位", notes = "id不用填写,只能选择是当前学生班级并且为空的宿舍床位", response = StudentDormitoryDto.class)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public AjaxResult add(@RequestBody StudentDormitoryDto dto) {
|
public AjaxResult add(@RequestBody StudentDormitoryDto dto) {
|
||||||
boolean hasRole = RoleBool.isHigh(getUserId(), _postService);
|
boolean hasRole = RoleBool.isHigh(getUserId(), _postService);
|
||||||
System.out.println(hasRole);
|
|
||||||
if (hasRole) {
|
if (hasRole) {
|
||||||
DomInfo dorm = _dormService.getDormHas(dto.getDormitoryId());
|
DomInfo dorm = _dormService.getDormHas(dto.getDormitoryId());
|
||||||
SrsStudent stu = _stuService.getStuInfo(dto.getStuNo());
|
SrsStudent stu = _stuService.getStuInfo(dto.getStuNo());
|
||||||
@@ -224,6 +222,50 @@ public class SrsDormitoryStudentController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('dms:dormStu:add')")
|
||||||
|
@ApiOperation(value = "学生自主选择床位", notes = "id不用填写,只能选择是当前学生班级并且为空的宿舍床位", response = StudentDormitoryDto.class)
|
||||||
|
@PostMapping("/addCheckInInformation")
|
||||||
|
public AjaxResult addCheckInInformation(@RequestBody StudentDormitoryDto dto) {
|
||||||
|
DomInfo dorm = _dormService.getDormHas(dto.getDormitoryId());
|
||||||
|
SrsStudent stu = _stuService.getStuInfo(dto.getStuNo());
|
||||||
|
QueryWrapper<SrsDormitoryStudent> query = new QueryWrapper<>();
|
||||||
|
query.eq("stu_no", dto.getStuNo());
|
||||||
|
SrsDormitoryStudent find = srsDormitoryStudentService.getOne(query);
|
||||||
|
if (find != null) {
|
||||||
|
return AjaxResult.error("该生已分配宿舍");
|
||||||
|
}
|
||||||
|
if(dorm!=null) {
|
||||||
|
if (!Objects.equals(stu.getGender(), dorm.gender)) {
|
||||||
|
return AjaxResult.error("学生性别与宿舍性别不符");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SrsDormitoryStudent param = new SrsDormitoryStudent();
|
||||||
|
if(dto.getIsInStudentsleep().equals("否")||dto.getIsInStudentsleep().equals("外宿")||dto.getIsInStudentsleep().equals("外出实习")){
|
||||||
|
param.setDormitoryId(null);
|
||||||
|
param.setBedId(null);
|
||||||
|
param.setStuNo(dto.getStuNo());
|
||||||
|
param.setIsDormitoryHead(0);
|
||||||
|
param.setStatus(0);
|
||||||
|
param.setCheckinTime(null);
|
||||||
|
param.setIsInStudentsleep(dto.getIsInStudentsleep());
|
||||||
|
}
|
||||||
|
if(dorm!=null) {
|
||||||
|
if (dorm.bedNum > dorm.occupancy) {
|
||||||
|
// param.setStuNo(dto.getStuNo());
|
||||||
|
// param.setDormitoryId(dto.getDormitoryId());
|
||||||
|
// param.setCheckinTime(dto.checkinTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
|
if (dto.getIsInStudentsleep().equals("是")) {
|
||||||
|
param.setCheckinTime(dto.getCheckinTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
|
BeanUtils.copyProperties(dto, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("宿舍床位不够");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toAjax(srsDormitoryStudentService.save(param));
|
||||||
|
}
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(DmsSearch param) {
|
public TableDataInfo list(DmsSearch param) {
|
||||||
boolean hasRole = RoleBool.isHigh(getUserId(), _postService);
|
boolean hasRole = RoleBool.isHigh(getUserId(), _postService);
|
||||||
@@ -237,6 +279,14 @@ public class SrsDormitoryStudentController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('dms:dormStu:add')")
|
||||||
|
@GetMapping("/checkInInformation")
|
||||||
|
public TableDataInfo checkInInformation(DmsSearch param) {
|
||||||
|
startPage();
|
||||||
|
List<SrsDormitoryStudentVo> list = srsDormitoryStudentService.list(param);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("查询学生宿舍关联列表")
|
@ApiOperation("查询学生宿舍关联列表")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
|||||||
Reference in New Issue
Block a user