if(zhongdJsonArr!=null&&zhongdJsonArr.size()>0){ for (int i = 0; i < zhongdJsonArr.size(); i++) { entry = zhongdJsonArr.getJSONObject(i); //控制java.util.date String[] dateFormats = new String[]{"yyyy-MM-dd HH:mm:ss"}; JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats)); KmGmZhongduaninfo info = (KmGmZhongduaninfo)JSONObject.toBean(entry,KmGmZhongduaninfo.class); zhongduanService.addOrModifyOrDelZhongduan(info,Integer.parseInt(syncType)); } jsonObject.put("resCode",200); jsonObject.put("resDesc","处理成功!"); }
关键代码:
//控制java.util.date
String[] dateFormats = new String[]{"yyyy-MM-dd HH:mm:ss"};
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));