feat(wms): 添加日期时间格式化注解以优化交付报告接口

- 在 startTime 和 endTime 参数上添加 @DateTimeFormat 和 @JsonFormat 注解
- 指定日期时间格式为 "yyyy-MM-dd HH:mm:ss"
- 改进请求参数的序列化与反序列化行为
- 提高接口对日期时间参数的处理准确性
- 确保前后端日期时间数据传输的一致性
- 引入必要的 Jackson 和 Spring 格式化注解依赖
This commit is contained in:
2025-11-27 10:28:39 +08:00
parent 8517180ebb
commit c71cf95468

View File

@@ -4,11 +4,14 @@ import java.util.Date;
import java.util.List;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
import com.klp.domain.vo.WmsDeliveryReportVo;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.klp.common.annotation.RepeatSubmit;
@@ -120,8 +123,8 @@ public class WmsDeliveryPlanController extends BaseController {
*/
@GetMapping("/report")
public R<List<WmsDeliveryReportVo>> getDeliveryReport(
@RequestParam(required = false) Date startTime,
@RequestParam(required = false) Date endTime) {
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
List<WmsDeliveryReportVo> report = iWmsDeliveryPlanService.getDeliveryReport(startTime, endTime);
return R.ok(report);
}