- 在IWmsLeaveRequestService接口中新增按请假类型、部门、月份统计的方法 - 在IWmsMealReportService接口中新增按餐别、部门、日期统计的方法 - 在WmsLeaveRequestController中添加请假统计报表相关API端点 - 在WmsMealReportController中添加报餐统计报表相关API端点 - 在WmsLeaveRequestServiceImpl中实现请假统计报表的数据查询逻辑 - 在WmsMealReportServiceImpl中实现报餐统计报表的数据查询逻辑 - 使用QueryWrapper构建统计查询条件,支持多维度筛选和分组统计 - 统一返回Map格式的统计数据,便于前端展示报表图表
126 lines
3.9 KiB
Java
126 lines
3.9 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.WmsMealReportVo;
|
|
import com.klp.domain.bo.WmsMealReportBo;
|
|
import com.klp.service.IWmsMealReportService;
|
|
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/mealReport")
|
|
public class WmsMealReportController extends BaseController {
|
|
|
|
private final IWmsMealReportService iWmsMealReportService;
|
|
|
|
/**
|
|
* 查询部门报餐主列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsMealReportVo> list(WmsMealReportBo bo, PageQuery pageQuery) {
|
|
return iWmsMealReportService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出部门报餐主列表
|
|
*/
|
|
@Log(title = "部门报餐主", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsMealReportBo bo, HttpServletResponse response) {
|
|
List<WmsMealReportVo> list = iWmsMealReportService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "部门报餐主", WmsMealReportVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取部门报餐主详细信息
|
|
*
|
|
* @param reportId 主键
|
|
*/
|
|
@GetMapping("/{reportId}")
|
|
public R<WmsMealReportVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long reportId) {
|
|
return R.ok(iWmsMealReportService.queryById(reportId));
|
|
}
|
|
|
|
/**
|
|
* 新增部门报餐主
|
|
*/
|
|
@Log(title = "部门报餐主", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsMealReportBo bo) {
|
|
return toAjax(iWmsMealReportService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改部门报餐主
|
|
*/
|
|
@Log(title = "部门报餐主", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsMealReportBo bo) {
|
|
return toAjax(iWmsMealReportService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除部门报餐主
|
|
*
|
|
* @param reportIds 主键串
|
|
*/
|
|
@Log(title = "部门报餐主", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{reportIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] reportIds) {
|
|
return toAjax(iWmsMealReportService.deleteWithValidByIds(Arrays.asList(reportIds), true));
|
|
}
|
|
|
|
/**
|
|
* 报餐统计报表 - 按餐别统计
|
|
*/
|
|
@GetMapping("/report/mealType")
|
|
public R<List<Map<String, Object>>> getMealTypeReport(WmsMealReportBo bo) {
|
|
return R.ok(iWmsMealReportService.getMealTypeReport(bo));
|
|
}
|
|
|
|
/**
|
|
* 报餐统计报表 - 按部门统计
|
|
*/
|
|
@GetMapping("/report/dept")
|
|
public R<List<Map<String, Object>>> getMealDeptReport(WmsMealReportBo bo) {
|
|
return R.ok(iWmsMealReportService.getMealDeptReport(bo));
|
|
}
|
|
|
|
/**
|
|
* 报餐统计报表 - 按日期统计
|
|
*/
|
|
@GetMapping("/report/date")
|
|
public R<List<Map<String, Object>>> getMealDateReport(WmsMealReportBo bo) {
|
|
return R.ok(iWmsMealReportService.getMealDateReport(bo));
|
|
}
|
|
}
|