@Test public void testGetPastDate() throws Exception { }
private static String getPastDate(int days, String dateStr, boolean isMonth) { java.sql.Date date = java.sql.Date.valueOf(dateStr); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if(isMonth) calendar.add(Calendar.MONTH, - days); else calendar.add(Calendar.DATE, - days); Date targetDay = calendar.getTime(); return sdf.format(targetDay); }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private static String getPastDate(int days, String dateStr, boolean isMonth) { java.sql.Date date = java.sql.Date.valueOf(dateStr); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if(isMonth) calendar.add(Calendar.MONTH, - days); else calendar.add(Calendar.DATE, - days); Date targetDay = calendar.getTime(); return sdf.format(targetDay); } }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private static String getPastDate(int days, String dateStr, boolean isMonth) { java.sql.Date date = java.sql.Date.valueOf(dateStr); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if(isMonth) calendar.add(Calendar.MONTH, - days); else calendar.add(Calendar.DATE, - days); Date targetDay = calendar.getTime(); return sdf.format(targetDay); }  }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private static String getPastDate(int days, String dateStr, boolean isMonth) { java.sql.Date date = java.sql.Date.valueOf(dateStr); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if(isMonth) calendar.add(Calendar.MONTH, - days); else calendar.add(Calendar.DATE, - days); Date targetDay = calendar.getTime(); return sdf.format(targetDay); }  @Override CommonResult doctorStatistics(String beginDateStr, String endDateStr); @Override CommonResult doctorStatisticsByUserIdAndDate(String dateStr, Integer userId); }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private static String getPastDate(int days, String dateStr, boolean isMonth) { java.sql.Date date = java.sql.Date.valueOf(dateStr); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if(isMonth) calendar.add(Calendar.MONTH, - days); else calendar.add(Calendar.DATE, - days); Date targetDay = calendar.getTime(); return sdf.format(targetDay); }  @Override CommonResult doctorStatistics(String beginDateStr, String endDateStr); @Override CommonResult doctorStatisticsByUserIdAndDate(String dateStr, Integer userId);  }