@Test public void saveDaily() { DailyVO dailyVO = new DailyVO(); dailyVO.setContent(RandomUtil.randomString(9)); dailyVO.setDate(new Date(System.currentTimeMillis())); dailyVO.setScore(RandomUtil.randomInt(10)); dailyVO.setWeather(RandomUtil.randomString(3)); Assert.assertNotNull(dailyService.saveDaily(getUser().getId(), dailyVO)); }
@Override @LogMethod("添加日程记录") public Daily saveDaily(String userId, DailyVO dailyVO) { AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); Daily daily = new Daily().copyFrom(dailyVO); daily.setCreateTime(System.currentTimeMillis()); daily.setId(IdUtil.simpleUUID()); daily.setUserId(userId); return dailyDAO.save(daily); }
DailyServiceImpl implements DailyService { @Override @LogMethod("添加日程记录") public Daily saveDaily(String userId, DailyVO dailyVO) { AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); Daily daily = new Daily().copyFrom(dailyVO); daily.setCreateTime(System.currentTimeMillis()); daily.setId(IdUtil.simpleUUID()); daily.setUserId(userId); return dailyDAO.save(daily); } }
DailyServiceImpl implements DailyService { @Override @LogMethod("添加日程记录") public Daily saveDaily(String userId, DailyVO dailyVO) { AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); Daily daily = new Daily().copyFrom(dailyVO); daily.setCreateTime(System.currentTimeMillis()); daily.setId(IdUtil.simpleUUID()); daily.setUserId(userId); return dailyDAO.save(daily); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); }
DailyServiceImpl implements DailyService { @Override @LogMethod("添加日程记录") public Daily saveDaily(String userId, DailyVO dailyVO) { AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); Daily daily = new Daily().copyFrom(dailyVO); daily.setCreateTime(System.currentTimeMillis()); daily.setId(IdUtil.simpleUUID()); daily.setUserId(userId); return dailyDAO.save(daily); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); @Override @LogMethod("检测日程记录是否存在") boolean exists(String dailyId); @Override @LogMethod("查找日程记录") Daily getDaily(String userId, Date date); @Override @LogMethod("列出日程记录") List<Daily> listDaily(String userId, Date startDate, Date endDate); @Override @LogMethod("删除日程记录") void remove(String dailyId); @Override @LogMethod("添加日程记录") Daily saveDaily(String userId, DailyVO dailyVO); @Override @LogMethod("检测日程记录是否存在") boolean exists(String userId, String dailyId, Date date); @Override @LogMethod("更新日程记录") Daily updateDaily(String userId, String dailyId, DailyVO dailyVO); }
DailyServiceImpl implements DailyService { @Override @LogMethod("添加日程记录") public Daily saveDaily(String userId, DailyVO dailyVO) { AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); Daily daily = new Daily().copyFrom(dailyVO); daily.setCreateTime(System.currentTimeMillis()); daily.setId(IdUtil.simpleUUID()); daily.setUserId(userId); return dailyDAO.save(daily); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); @Override @LogMethod("检测日程记录是否存在") boolean exists(String dailyId); @Override @LogMethod("查找日程记录") Daily getDaily(String userId, Date date); @Override @LogMethod("列出日程记录") List<Daily> listDaily(String userId, Date startDate, Date endDate); @Override @LogMethod("删除日程记录") void remove(String dailyId); @Override @LogMethod("添加日程记录") Daily saveDaily(String userId, DailyVO dailyVO); @Override @LogMethod("检测日程记录是否存在") boolean exists(String userId, String dailyId, Date date); @Override @LogMethod("更新日程记录") Daily updateDaily(String userId, String dailyId, DailyVO dailyVO);  }