| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | 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 io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | |
| | | @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 = "通过权限获取部门员工列表") |
| | |
| | | sysStaffService.mgtDeleteStaff(mgtBaseGetDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "导入员工数据") |
| | | @PostMapping("/importSysStaff") |
| | | public AjaxResult importSysStaff(@RequestPart("file") MultipartFile file) throws Exception |
| | | { |
| | | ExcelUtil<MgtSysStaffImportDto> util = new ExcelUtil<MgtSysStaffImportDto>(MgtSysStaffImportDto.class); |
| | | List<MgtSysStaffImportDto> sysStaffImportDtoList = util.importExcel(file.getInputStream()); |
| | | String message = sysStaffService.importSysStaff(sysStaffImportDtoList); |
| | | return success(message); |
| | | } |
| | | } |