My entity time field is of date type and is also formatted. Why does the front end report an error when inputting the date format?
Control layer code!
@ApiConfig(desc = "Modify or add active products", 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));
}
Fields of entity class
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;
}
Tested page:
products (product json string):
content (activity content):
title (activity title):
shopId (the store id):
activityPrice (activity price):
onTime (activity start time):
endTime (activity end time):
img(activity picture):
spring has a message processor, you can take a look