Spring的@DateTimeFormat(iso=DateTimeFormat.ISO.DATE) Date day问题

本文介绍了一个关于@DateTimeFormat注解无法正确解析日期的问题,并推荐使用Joda-Time库来解决这一问题。文中提供了引入Joda-Time到项目的Maven配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

@DateTimeFormat(iso=DateTimeFormat.ISO.DATE) Date day

不能运行,可以导入joda-time试试,maven配置是

<dependency>
	<groupId>joda-time</groupId>
	<artifactId>joda-time</artifactId>
	<version>2.0</version>
</dependency>
            


package cn.iocoder.yudao.module.erp.controller.admin.saleorder.vo; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; import java.math.BigDecimal; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @Schema(description = "管理后台 - ERP 销售订单分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class SaleOrderPageReqVO extends PageParam { @Schema(description = "销售单编号") private String no; @Schema(description = "销售状态", example = "1") private Integer status; @Schema(description = "客户编号", example = "1978") private Long customerId; @Schema(description = "结算账户编号", example = "28162") private Long accountId; @Schema(description = "销售用户编号", example = "31423") private Long saleUserId; @Schema(description = "下单时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] orderTime; @Schema(description = "合计数量", example = "13095") private BigDecimal totalCount; @Schema(description = "合计价格,单位:元", example = "28787") private BigDecimal totalPrice; @Schema(description = "合计产品价格,单位:元", example = "24897") private BigDecimal totalProductPrice; @Schema(description = "合计税额,单位:元", example = "15194") private BigDecimal totalTaxPrice; @Schema(description = "优惠率,百分比") private BigDecimal discountPercent; @Schema(description = "优惠金额,单位:元", example = "3572") private BigDecimal discountPrice; @Schema(description = "定金金额,单位:元", example = "10578") private BigDecimal depositPrice; @Schema(description = "附件地址", example = "https://www.iocoder.cn") private String fileUrl; @Schema(description = "备注", example = "你猜") private String remark; @Schema(description = "销售出库数量", example = "9412") private BigDecimal outCount; @Schema(description = "销售退货数量", example = "16397") private BigDecimal returnCount; @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; }帮我分析一下这个代码每一个地方的用处,细节,不懂
最新发布
07-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值