赞
踩
今天在接受微信返回时间格式时候,发现了微信返回的时间格式不是时间戳 而是"20240514163531"这个样子的。然后导致我接参数接不到,转换错误。
报错data: "JSON parse error: Cannot deserialize value of type `java.util.Date` from String "20240514163531": expected format "yyyy-MM-dd"; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String "20240514163531": expected format "yyyy-MM-dd"↵ at [Source: (PushbackInputStream); line: 1, column: 452] (through reference chain: com.ybkj.entity.SelfBuildStoreOrder["time"])"
msg: "JSON parse error: Cannot deserialize value of type `java.util.Date` from String "20240514163531": expected format "yyyy-MM-dd"; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String "20240514163531": expected format "yyyy-MM-dd"↵ at [Source: (PushbackInputStream); line: 1, column: 452] (through reference chain: com.ybkj.entity.SelfBuildStoreOrder["time"])" 。。。后来改为
具体原因是因为
这里接参数的时间类型不一致 所以应该是接参数自动识别成字符串了 所以导致转换类型失败,所以我换一个参数类型使用hutool的datetime直接懒省劲 没有在前端传参数时候转换一下类型或者转换成时间戳传参。
解决!!!记录一下,希望大佬批评指正多指点。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。