宿舍管理学生打卡模块,对学务和辅导员角色查看学生打卡记录做了数据筛选
This commit is contained in:
@@ -116,7 +116,13 @@ public class DmsStuDaily{
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String teacherName;
|
private String teacherName;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String teacherNo;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String idCard;
|
private String idCard;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -93,9 +93,16 @@
|
|||||||
<if test="majorId != null "> and b.major_id = #{majorId}</if>
|
<if test="majorId != null "> and b.major_id = #{majorId}</if>
|
||||||
<if test="classId != null "> and b.class_id = #{classId}</if>
|
<if test="classId != null "> and b.class_id = #{classId}</if>
|
||||||
<if test="gradeId != null "> and b.grade_id = #{gradeId}</if>
|
<if test="gradeId != null "> and b.grade_id = #{gradeId}</if>
|
||||||
<if test="stuName != null and stuName != ''"> and b.stu_name like concat('%',#{stuName},'%')</if>
|
<if test="stuName != null and stuName != ''">
|
||||||
<if test="teacherName != null and teacherName != ''"> and b.teacher_name like concat('%',#{teacherName},'%')</if>
|
and b.stu_name like concat('%',#{stuName},'%')</if>
|
||||||
<if test="idCard != null and idCard != ''"> and AES_DECRYPT(UNHEX(b.id_card),'zhxg') = #{idCard}</if>
|
<if test="teacherName != null and teacherName != ''">
|
||||||
|
and b.teacher_name like concat('%',#{teacherName},'%')</if>
|
||||||
|
<if test="teacherNo != null and teacherNo != ''">
|
||||||
|
and b.t_no = #{teacherNo}</if>
|
||||||
|
<if test="deptName != null and deptName != ''">
|
||||||
|
and b.dept_name = #{deptName}</if>
|
||||||
|
<if test="idCard != null and idCard != ''">
|
||||||
|
and AES_DECRYPT(UNHEX(b.id_card),'zhxg') = #{idCard}</if>
|
||||||
</where>
|
</where>
|
||||||
order by a.id desc
|
order by a.id desc
|
||||||
</select>
|
</select>
|
||||||
@@ -212,7 +219,7 @@
|
|||||||
END
|
END
|
||||||
ELSE ''
|
ELSE ''
|
||||||
END
|
END
|
||||||
) AS `log`
|
) AS `log`
|
||||||
FROM rt_stu_leave_operation_records AS a
|
FROM rt_stu_leave_operation_records AS a
|
||||||
LEFT JOIN rt_stu_leave_application AS b ON a.leave_application_id = b.leave_application_id
|
LEFT JOIN rt_stu_leave_application AS b ON a.leave_application_id = b.leave_application_id
|
||||||
LEFT JOIN view_stu_info AS c ON b.stu_no = c.stu_no
|
LEFT JOIN view_stu_info AS c ON b.stu_no = c.stu_no
|
||||||
|
@@ -2,6 +2,7 @@ package com.srs.web.controller.dormitory;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -21,6 +22,9 @@ import com.srs.common.utils.poi.ExcelUtil;
|
|||||||
import com.srs.common.enums.BusinessType;
|
import com.srs.common.enums.BusinessType;
|
||||||
import com.srs.common.annotation.Log;
|
import com.srs.common.annotation.Log;
|
||||||
import com.srs.common.core.page.TableDataInfo;
|
import com.srs.common.core.page.TableDataInfo;
|
||||||
|
import com.srs.common.utils.SecurityUtils;
|
||||||
|
import com.srs.common.core.domain.entity.SysUser;
|
||||||
|
import com.srs.system.service.ISysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生宿舍打卡Controller
|
* 学生宿舍打卡Controller
|
||||||
@@ -35,6 +39,9 @@ public class DmsStuDailyController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDmsStuDailyService dmsStuDailyService;
|
private IDmsStuDailyService dmsStuDailyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
@GetMapping("/countDeptCard")
|
@GetMapping("/countDeptCard")
|
||||||
public AjaxResult countDeptCard(){
|
public AjaxResult countDeptCard(){
|
||||||
List<Map<String, Object>> list = dmsStuDailyService.countDeptCard();
|
List<Map<String, Object>> list = dmsStuDailyService.countDeptCard();
|
||||||
@@ -75,11 +82,78 @@ public class DmsStuDailyController extends BaseController {
|
|||||||
@ApiOperation("查询学生宿舍打卡列表")
|
@ApiOperation("查询学生宿舍打卡列表")
|
||||||
public TableDataInfo listView(DmsStuDaily param)
|
public TableDataInfo listView(DmsStuDaily param)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// 获取当前用户信息
|
||||||
|
String username = getUsername();
|
||||||
|
SysUser currentUser = userService.selectUserByUserName(username);
|
||||||
|
|
||||||
|
// 根据用户角色设置数据过滤条件
|
||||||
|
if (currentUser != null) {
|
||||||
|
// 获取用户角色组
|
||||||
|
String roleGroup = userService.selectUserRoleGroup(username);
|
||||||
|
|
||||||
|
// 检查是否同时拥有学务干事和辅导员角色
|
||||||
|
boolean isDeptRole = roleGroup.contains("学务干事") || roleGroup.contains("学务办初审");
|
||||||
|
boolean isTeacherRole = roleGroup.contains("辅导员");
|
||||||
|
|
||||||
|
// 根据前端传递的roleType参数进行过滤
|
||||||
|
if (isDeptRole && isTeacherRole) {
|
||||||
|
// 同时拥有两个角色,根据roleType参数决定查看哪种数据
|
||||||
|
if ("teacher".equals(param.getRoleType())) {
|
||||||
|
// 查看个人班级数据
|
||||||
|
param.setTeacherNo(username);
|
||||||
|
} else {
|
||||||
|
// 默认查看学院数据
|
||||||
|
if (currentUser.getDept() != null) {
|
||||||
|
param.setDeptName(currentUser.getDept().getDeptName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isDeptRole) {
|
||||||
|
// 只有学务干事角色,查看学院数据
|
||||||
|
if (currentUser.getDept() != null) {
|
||||||
|
param.setDeptName(currentUser.getDept().getDeptName());
|
||||||
|
}
|
||||||
|
} else if (isTeacherRole) {
|
||||||
|
// 只有辅导员角色,查看个人班级数据
|
||||||
|
param.setTeacherNo(username);
|
||||||
|
}
|
||||||
|
// 超级管理员可以查看所有数据,不设置过滤条件
|
||||||
|
}
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
List<DmsStuDaily> list = dmsStuDailyService.listView(param);
|
List<DmsStuDaily> list = dmsStuDailyService.listView(param);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主要用于前端不同角色的切换返回不同的数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/checkRoles")
|
||||||
|
@ApiOperation("检查用户角色信息")
|
||||||
|
public AjaxResult checkUserRoles() {
|
||||||
|
String username = getUsername();
|
||||||
|
String roleGroup = userService.selectUserRoleGroup(username);
|
||||||
|
SysUser currentUser = userService.selectUserByUserName(username);
|
||||||
|
|
||||||
|
boolean isDeptRole = roleGroup.contains("学务干事");
|
||||||
|
boolean isTeacherRole = roleGroup.contains("辅导员");
|
||||||
|
boolean hasMultipleRoles = isDeptRole && isTeacherRole;
|
||||||
|
|
||||||
|
Map<String, Object> roleInfo = new HashMap<>();
|
||||||
|
roleInfo.put("hasMultipleRoles", hasMultipleRoles);
|
||||||
|
roleInfo.put("defaultRole", "dept"); // 默认显示学院数据
|
||||||
|
roleInfo.put("isAdmin", SecurityUtils.isAdmin(SecurityUtils.getUserId()));
|
||||||
|
roleInfo.put("isXuewu", roleGroup.contains("学务干事"));
|
||||||
|
roleInfo.put("isFudaoyuan", roleGroup.contains("辅导员"));
|
||||||
|
|
||||||
|
// 添加用户部门信息
|
||||||
|
if (currentUser != null && currentUser.getDept() != null) {
|
||||||
|
roleInfo.put("userDeptName", currentUser.getDept().getDeptName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.success(roleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("学生打卡")
|
@ApiOperation("学生打卡")
|
||||||
@PostMapping("/doCard")
|
@PostMapping("/doCard")
|
||||||
|
Reference in New Issue
Block a user