1、數據類型轉換
//實體轉vo
BeanUtils.copyProperties(testDemoFrom,testDemoDTO);
//JSONObject轉map
List<Map<String,String>> mapList = JSONObject.parseObject(jsonObject.toJSONString(), new TypeReference<List<Map<String, String>>>(){});
2、時間獲取以及格式化
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss”);//時間格式
format.format(new Date()); //獲取當前時間
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) +7);//獲取7天后的時間
format.format(calendar.getTime());//格式化時間