我的实体时间字段是date类型的,也格式化了,为什么前台输入日期格式报错?
控制层的代码!
@ApiConfig(desc = "修改或者新增活动产品", author = "cxf", status = Status.developing)
@ResponseBody
@RequestMapping(value = {"updateOrAdd"}, method = {RequestMethod.GET, RequestMethod.POST})
public String updateOrAdd(@ApiParam(name="产品json字符串")String products,@ApiParam(name="id!=null修改,id=null增加",
excludes = {"id","actiDetailsList","pic","name"})ProActivityVO proActivity){
String strs = StringEscapeUtils.unescapeJava(products);
List<ProductInfo> list = JSON.parseArray(strs, ProductInfo.class);
return WebUtils.toJson(request, productInfoService.updateOrAdd(list, proActivity));
}
实体类的字段
public class ProActivityVO{
@FieldDesc(name="活动开始时间")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date onTime;
@FieldDesc(name="活动结束时间")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date endTime;
}
测试的页面:
products(产品json字符串):
content(活动内容):
title(活动标题):
shopId(所属店铺id):
actityPrice(活动价格):
onTime(活动开始时间):
endTime(活动结束时间):
img(活动图片):
spring有个消息处理器,可以去看一下