| | |
| | | package org.dromara.eims.utils; |
| | | |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.eims.domain.bo.EimsRepairReqBo; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 自定义数据隔离 |
| | |
| | | //报修单 |
| | | public void filterRepairReq(EimsRepairReqBo bo){ |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | if (loginUser == null) return; |
| | | Set<String> rolePermission = loginUser.getRolePermission(); |
| | | if (rolePermission == null) return; |
| | | if (rolePermission.contains(Role.operator.name())) { |
| | | //维修工只能查询自己的数据 |
| | | bo.setCreateBy(loginUser.getUserId()); |
| | | Map<String, Object> params = bo.getParams(); |
| | | List<Long> userList = new ArrayList<>(); |
| | | if (rolePermission == null) { |
| | | //没有权限不允许查询数据 |
| | | userList.add(-1L); |
| | | |
| | | }else if (rolePermission.contains(Role.operator.name())) { |
| | | //操作工只能查询自己的数据 |
| | | userList.add(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工只能查询未接单状态的报修单(具体状态参考字典repair_req_status) |
| | | bo.setStatus("0"); |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | } |
| | | System.err.println(loginUser); |
| | | params.put("createBy", userList); |
| | | } |
| | | |
| | | //维修工单 |
| | | public void filterRepairRes(EimsRepairResBo bo){ |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | Set<String> rolePermission = loginUser.getRolePermission(); |
| | | Map<String, Object> params = bo.getParams(); |
| | | List<Long> userList = new ArrayList<>(); |
| | | if (rolePermission == null) { |
| | | //没有权限不允许查询数据 |
| | | userList.add(-1L); |
| | | |
| | | }else if (rolePermission.contains(Role.operator.name())) { |
| | | //操作工只能查询自己的数据 |
| | | userList.add(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工只能查询未接单状态的报修单(具体状态参考字典repair_req_status) |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | } |
| | | params.put("createBy", userList); |
| | | } |
| | | |
| | | } |