not a valid representation

2019-09-27 10:14:54.266 [60] [ERROR] c.b.c.GlobalExceptionHandler:27 - 系统级异常处理,异常内容:
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize value of type java.util.Date from String "2019-09-26 17:25:57": not a valid representation (error: Failed to parse Date value '2019-09-26 17:25:57': Can not parse date "2019-09-26 17:25:57": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSS', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type java.util.Date from String "2019-09-26 17:25:57": not a valid representation (error: Failed to parse Date value '2019-09-26 17:25:57': Can not parse date "2019-09-26 17:25:57": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSS', parsing fails (leniency? null))
 at [Source: java.io.PushbackInputStream@b26105c; line: 3, column: 19] (through reference chain: com.bmadmin.project.businessproject.domain.SalesSystem.SalesOrderHeadDO["outStorageTime"])

 

 

解决方法:

    在userDto中的日期格式上增加下面注解就可以解决:

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

 

 

如:创建时间字段:

    @ApiModelProperty(value = "创建时间 ;不需要传")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;
 

=============================================================

===》

实体类加注解:

@Temporal(TemporalType.TIMESTAMP)

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值