package com.zc.business.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.domain.DcEmployees; import com.zc.business.enums.UniversalEnum; import com.zc.business.service.IDcEmployeesService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; /** * 值班人员信息Controller * * @author ruoyi * @date 2024-01-04 */ @Api(tags = "人员管理") @RestController @RequestMapping("/business/employees") public class DcEmployeesController extends BaseController { @Autowired private IDcEmployeesService dcEmployeesService; /** * 查询值班人员信息列表 */ @ApiOperation("获取人员信息列表") // @PreAuthorize("@ss.hasPermi('business:employees:list')") @GetMapping("/list") public TableDataInfo list(DcEmployees dcEmployees) { startPage(); String name = dcEmployees.getName(); if (name != null && !name.isEmpty()) { name = name.replace(UniversalEnum.BLANK_SPACE.getValue(), UniversalEnum.EMPTY_STRING.getValue()); // 去掉空格 dcEmployees.setName(name); } List list = dcEmployeesService.selectDcEmployeesList(dcEmployees); return getDataTable(list); } /** * 查询值班人员信息列表不分页 */ @ApiOperation("获取人员信息列表") // @PreAuthorize("@ss.hasPermi('business:employees:list')") @GetMapping("/listAll") public AjaxResult listAll(DcEmployees dcEmployees) { String name = dcEmployees.getName(); if (name != null && !name.isEmpty()) { name = name.replace(UniversalEnum.BLANK_SPACE.getValue(), UniversalEnum.EMPTY_STRING.getValue()); // 去掉空格 dcEmployees.setName(name); } return AjaxResult.success(dcEmployeesService.selectDcEmployeesList(dcEmployees)); } /** * 导出值班人员信息列表 */ @ApiOperation("导出值班人员信息列表") // @PreAuthorize("@ss.hasPermi('business:employees:export')") @Log(title = "值班人员信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response,@RequestBody DcEmployees dcEmployees) { List list = dcEmployeesService.selectDcEmployeesList(dcEmployees); ExcelUtil util = new ExcelUtil<>(DcEmployees.class); util.exportExcel(response, list, UniversalEnum.DUTY_PERSONNEL_INFORMATION_DATA.getValue()); } /** * 获取值班人员信息详细信息 */ @ApiOperation("获取人员信息详细信息") // @PreAuthorize("@ss.hasPermi('business:employees:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(dcEmployeesService.selectDcEmployeesById(id)); } /** * 新增值班人员信息 */ @ApiOperation("新增人员信息") // @PreAuthorize("@ss.hasPermi('business:employees:add')") @Log(title = "值班人员信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcEmployees dcEmployees) { return toAjax(dcEmployeesService.insertDcEmployees(dcEmployees)); } /** * 修改值班人员信息 */ @ApiOperation("修改人员信息") //@PreAuthorize("@ss.hasPermi('business:employees:edit')") @Log(title = "值班人员信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcEmployees dcEmployees) { return toAjax(dcEmployeesService.updateDcEmployees(dcEmployees)); } /** * 删除值班人员信息 */ @ApiOperation("删除人员信息") // @PreAuthorize("@ss.hasPermi('business:employees:remove')") @Log(title = "值班人员信息", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(dcEmployeesService.deleteDcEmployeesByIds(ids)); } //查询全部机构id与名称信息 @ApiOperation(value = "查询全部机构id与名称信息") @PostMapping("/organization") public AjaxResult selectOrganizationAll(@RequestBody DcEmployees dcEmployees ){ return AjaxResult.success(dcEmployeesService.selectOrganizationAll(dcEmployees)); } //查询全部岗位id与名称信息 @ApiOperation(value = "查询全部岗位id与名称信息") @PostMapping("/sysPost") public AjaxResult selectSysPostAll(){ return AjaxResult.success(dcEmployeesService.selectSysPostAll()); } //获取用户信息,按照岗位分组 @ApiOperation(value = "获取用户信息,按照岗位分组") @PostMapping("/employeesPostGroup") public AjaxResult employeesPostGroup(){ return AjaxResult.success(dcEmployeesService.selectEmployeesPost()); } //获取全部用户信息,以及所在岗位信息 @PostMapping("/employeesPostAll") public AjaxResult selectEmployeesPostAll(){ return AjaxResult.success(dcEmployeesService.selectEmployeesPostAll()); } //定时任务,获取值班信息定义人员归属岗位 @PostMapping("/personnelPositions") public AjaxResult personnelPositions(){ return toAjax(dcEmployeesService.personnelPositions()); } @ApiOperation("获取应急机构下的所有人员") @GetMapping("/getAllEmployees") public List> getAllEmployees(@ApiParam(value = "桩号", name = "stakeMark", required = true) String stakeMark) { return dcEmployeesService.getAllEmployees(stakeMark); } }