feat(oa): 添加日期参数格式化支持

- 为startTime和endTime参数添加@JsonFormat注解
- 为startTime和endTime参数添加@DateTimeFormat注解
- 设置日期格式为"yyyy-MM-dd"
- 设置时区为"GMT+8"
This commit is contained in:
2025-12-12 11:56:50 +08:00
parent e71ba481df
commit 0fd9dfab35

View File

@@ -1,11 +1,13 @@
package com.ruoyi.oa.controller.dashboard;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.oa.domain.vo.dashboard.OaWorkshopReportSummaryVo;
import com.ruoyi.oa.service.IOaWorkshopReportService;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,8 +27,8 @@ public class OaWorkshopReportController extends BaseController {
private final IOaWorkshopReportService workshopReportService;
@GetMapping("/summary")
public R<OaWorkshopReportSummaryVo> summary(@RequestParam(required = false) Date startTime,
@RequestParam(required = false) Date endTime) {
public R<OaWorkshopReportSummaryVo> summary(@RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
@RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
return R.ok(workshopReportService.summary(startTime, endTime));
}