| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.service.RemoteUserService; |
| | | import com.ruoyi.system.domain.dto.*; |
| | | import com.ruoyi.system.domain.vo.MgtDeptStaffListVo; |
| | | import com.ruoyi.system.domain.vo.MgtStaffPageVo; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import static com.ruoyi.common.core.web.domain.AjaxResult.success; |
| | |
| | | @RequestMapping("/mgt/staff") |
| | | public class MgtStaffController { |
| | | |
| | | |
| | | @Resource |
| | | private RemoteUserService sysUserService; |
| | | |
| | | @Resource |
| | | private StaffSuggestService staffSuggestService; |
| | |
| | | @RequestMapping(value = "/listMgtDeptStaff", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取部门员工列表") |
| | | public R<List<MgtDeptStaffListVo>> listMgtDeptStaff() { |
| | | List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(); |
| | | // 获取当前登陆人的可视权限 |
| | | SysUser sysUser = SecurityUtils.getSysUser(); |
| | | // 如果当前登陆人权限是查看部门数据 |
| | | Long deptId = null; |
| | | // 如果当前登陆人是查看个人数据 |
| | | Long userId = null; |
| | | if (sysUser!=null){ |
| | | String dataScope = sysUser.getDataScope(); |
| | | if (!sysUser.getUserName().equals("admin")){ |
| | | if (org.springframework.util.StringUtils.hasLength(dataScope)){ |
| | | switch (dataScope){ |
| | | case "3": |
| | | // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 |
| | | deptId = sysUser.getDeptId(); |
| | | break; |
| | | case "5": |
| | | // 仅个人数据 查询当前登陆人关联店铺下的用户 |
| | | userId = sysUser.getUserId(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(deptId,userId); |
| | | return R.ok(mgtDeptStaffListVoList); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/listDeptStaff", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取所有部门员工列表") |
| | | public R<List<MgtDeptStaffListVo>> listDeptStaff() { |
| | | List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(null,null); |
| | | return R.ok(mgtDeptStaffListVoList); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/listMgtDeptStaffByPermission", method = RequestMethod.POST) |
| | | @ApiOperation(value = "通过权限获取部门员工列表") |
| | | public R<List<MgtDeptStaffListVo>> listMgtDeptStaffByPermission() { |