- 新增根据请假人分组获取请假信息的接口方法 - 在WmsLeaveRequestBo中添加beginTime、endTimeParam和leaveIds字段 - 重构buildQueryWrapper方法支持按ID列表查询和时间范围交叉查询 - 添加按请假人分组统计的数据库查询实现 - 移除WmsLeaveRequestVo中leaveId和attachmentUrls的Excel导出注解 - 在WmsMealReportService中添加用户昵称映射功能 - 为WmsMealReportVo添加创建人和更新人姓名字段
137 lines
4.3 KiB
Java
137 lines
4.3 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
import com.klp.common.annotation.Log;
|
|
import com.klp.common.core.controller.BaseController;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.domain.R;
|
|
import com.klp.common.core.validate.AddGroup;
|
|
import com.klp.common.core.validate.EditGroup;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
import com.klp.domain.vo.WmsLeaveRequestVo;
|
|
import com.klp.domain.bo.WmsLeaveRequestBo;
|
|
import com.klp.service.IWmsLeaveRequestService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 员工请假申请
|
|
*
|
|
* @author klp
|
|
* @date 2026-01-17
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/leaveRequest")
|
|
public class WmsLeaveRequestController extends BaseController {
|
|
|
|
private final IWmsLeaveRequestService iWmsLeaveRequestService;
|
|
|
|
/**
|
|
* 查询员工请假申请列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsLeaveRequestVo> list(WmsLeaveRequestBo bo, PageQuery pageQuery) {
|
|
return iWmsLeaveRequestService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出员工请假申请列表
|
|
*/
|
|
@Log(title = "员工请假申请", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsLeaveRequestBo bo, HttpServletResponse response) {
|
|
List<WmsLeaveRequestVo> list = iWmsLeaveRequestService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "员工请假申请", WmsLeaveRequestVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取员工请假申请详细信息
|
|
*
|
|
* @param leaveId 主键
|
|
*/
|
|
@GetMapping("/{leaveId}")
|
|
public R<WmsLeaveRequestVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long leaveId) {
|
|
return R.ok(iWmsLeaveRequestService.queryById(leaveId));
|
|
}
|
|
|
|
/**
|
|
* 新增员工请假申请
|
|
*/
|
|
@Log(title = "员工请假申请", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsLeaveRequestBo bo) {
|
|
return toAjax(iWmsLeaveRequestService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改员工请假申请
|
|
*/
|
|
@Log(title = "员工请假申请", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsLeaveRequestBo bo) {
|
|
return toAjax(iWmsLeaveRequestService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除员工请假申请
|
|
*
|
|
* @param leaveIds 主键串
|
|
*/
|
|
@Log(title = "员工请假申请", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{leaveIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] leaveIds) {
|
|
return toAjax(iWmsLeaveRequestService.deleteWithValidByIds(Arrays.asList(leaveIds), true));
|
|
}
|
|
|
|
/**
|
|
* 请假统计报表 - 按请假类型统计
|
|
*/
|
|
@GetMapping("/report/leaveType")
|
|
public R<List<Map<String, Object>>> getLeaveTypeReport(WmsLeaveRequestBo bo) {
|
|
return R.ok(iWmsLeaveRequestService.getLeaveTypeReport(bo));
|
|
}
|
|
|
|
/**
|
|
* 请假统计报表 - 按部门统计
|
|
*/
|
|
@GetMapping("/report/dept")
|
|
public R<List<Map<String, Object>>> getLeaveDeptReport(WmsLeaveRequestBo bo) {
|
|
return R.ok(iWmsLeaveRequestService.getLeaveDeptReport(bo));
|
|
}
|
|
|
|
/**
|
|
* 请假统计报表 - 按月份统计
|
|
*/
|
|
@GetMapping("/report/monthly")
|
|
public R<List<Map<String, Object>>> getLeaveMonthlyReport(WmsLeaveRequestBo bo) {
|
|
return R.ok(iWmsLeaveRequestService.getLeaveMonthlyReport(bo));
|
|
}
|
|
|
|
/**
|
|
* 根据请假人分组获取请假信息
|
|
*/
|
|
@GetMapping("/grouped")
|
|
public R<List<Map<String, Object>>> getLeaveListGroupedByApplicant(WmsLeaveRequestBo bo) {
|
|
return R.ok(iWmsLeaveRequestService.getLeaveListGroupedByApplicant(bo));
|
|
}
|
|
|
|
|
|
|
|
}
|