保存数据时,前端的自动生成的日期组件的日期传不到后台里面

Blade 未结 1 1359
javahuan
javahuan 2021-01-29 18:03

一、该问题的重现步骤是什么?

 1. 使用代码自动生成出了一个vue页面,如下所示
image.png


2. 如果没有开始时间这个自动生成的组件,点击保存,后台在保存请求那里加的断点可以跟踪进来,数据是可以传入到后端,并保存入库 


3. 如果加了有这个组件,点击保存前端会直接报错,后台在保存请求那里加的断点没任何反应。前端报错如下所示

JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-01-05T16:00:00.000Z": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-05T16:00:00.000Z' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-01-05T16:00:00.000Z": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-05T16:00:00.000Z' could not be parsed at index 10 at [Source: (PushbackInputStream); line: 1, column: 173] (through reference chain: org.business.lcyj.finance.entity.XjOrderInfo["startTime"])


后端报错如下:

2021-01-29 18:00:20.996 DEBUG 10148 --- [XNIO-1 task-396] .c.c.v.BladeRequestMappingHandlerMapping : Mapped to org.business.lcyj.finance.controller.OrderInfoController#submit(OrderInfo)

2021-01-29 18:00:20.998 ERROR 10148 --- [XNIO-1 task-396] o.s.c.log.error.RestExceptionTranslator  : 消息不能读取:JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-01-05T16:00:00.000Z": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-05T16:00:00.000Z' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-01-05T16:00:00.000Z": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-05T16:00:00.000Z' could not be parsed at index 10

 at [Source: (PushbackInputStream); line: 1, column: 173] (through reference chain: org.business.lcyj.finance.entity.OrderInfo["startTime"])



二、你期待的结果是什么?

     我期待自动生成的日期组件数据可以保存入库,我需要的是 年,月,日,加 时,分,秒 这样的日期传入后台并保存入库


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

bladex cloud版  版本号是2.7.0.RELEASE  全部运行在widows上面


1条回答
  •  admin
    admin (楼主)
    2021-01-30 22:59

    前后端字段需要分别做如下配置

    image.png

    image.png

    0 讨论(0)
提交回复