@Test public void saveTodo() { }
@Override @LogMethod("添加待办事项") public Todo saveTodo(String userId, TodoVO todoVO) { Todo todo = new Todo(); todo.setContent(todoVO.getContent()); todo.setCreateTime(System.currentTimeMillis()); todo.setDoingDate(todoVO.getDoingDate()); todo.setId(IdUtil.simpleUUID()); todo.setStatus("0"); todo.setUserId(userId); todoDAO.save(todo); if (todoVO.getOffsetWell() > 0 && todoVO.getRepeatWell() > 0) { ThreadUtil.execute(() -> { long offset = 0; final long nowMilli = DateUtil.parseDate(todoVO.getDoingDate()).getTime(); final long offsetMillis = (long) todoVO.getOffset() * (long) IntegerConsts.ONE_DAY_MILLIS; for (int i = 0; i < todoVO.getRepeat(); i++) { offset += offsetMillis; Todo another = todo.copyInto(new Todo()); another.setCreateTime(System.currentTimeMillis()); another.setDoingDate(DateUtil.formatDate(new Date(nowMilli + offset))); another.setId(IdUtil.simpleUUID()); another.setUserId(userId); todoDAO.save(another); } }); } return todo; }
TodoServiceImpl implements TodoService { @Override @LogMethod("添加待办事项") public Todo saveTodo(String userId, TodoVO todoVO) { Todo todo = new Todo(); todo.setContent(todoVO.getContent()); todo.setCreateTime(System.currentTimeMillis()); todo.setDoingDate(todoVO.getDoingDate()); todo.setId(IdUtil.simpleUUID()); todo.setStatus("0"); todo.setUserId(userId); todoDAO.save(todo); if (todoVO.getOffsetWell() > 0 && todoVO.getRepeatWell() > 0) { ThreadUtil.execute(() -> { long offset = 0; final long nowMilli = DateUtil.parseDate(todoVO.getDoingDate()).getTime(); final long offsetMillis = (long) todoVO.getOffset() * (long) IntegerConsts.ONE_DAY_MILLIS; for (int i = 0; i < todoVO.getRepeat(); i++) { offset += offsetMillis; Todo another = todo.copyInto(new Todo()); another.setCreateTime(System.currentTimeMillis()); another.setDoingDate(DateUtil.formatDate(new Date(nowMilli + offset))); another.setId(IdUtil.simpleUUID()); another.setUserId(userId); todoDAO.save(another); } }); } return todo; } }
TodoServiceImpl implements TodoService { @Override @LogMethod("添加待办事项") public Todo saveTodo(String userId, TodoVO todoVO) { Todo todo = new Todo(); todo.setContent(todoVO.getContent()); todo.setCreateTime(System.currentTimeMillis()); todo.setDoingDate(todoVO.getDoingDate()); todo.setId(IdUtil.simpleUUID()); todo.setStatus("0"); todo.setUserId(userId); todoDAO.save(todo); if (todoVO.getOffsetWell() > 0 && todoVO.getRepeatWell() > 0) { ThreadUtil.execute(() -> { long offset = 0; final long nowMilli = DateUtil.parseDate(todoVO.getDoingDate()).getTime(); final long offsetMillis = (long) todoVO.getOffset() * (long) IntegerConsts.ONE_DAY_MILLIS; for (int i = 0; i < todoVO.getRepeat(); i++) { offset += offsetMillis; Todo another = todo.copyInto(new Todo()); another.setCreateTime(System.currentTimeMillis()); another.setDoingDate(DateUtil.formatDate(new Date(nowMilli + offset))); another.setId(IdUtil.simpleUUID()); another.setUserId(userId); todoDAO.save(another); } }); } return todo; } @Autowired  TodoServiceImpl(TodoDAO todoDAO, MongoTemplate mongoTemplate); }
TodoServiceImpl implements TodoService { @Override @LogMethod("添加待办事项") public Todo saveTodo(String userId, TodoVO todoVO) { Todo todo = new Todo(); todo.setContent(todoVO.getContent()); todo.setCreateTime(System.currentTimeMillis()); todo.setDoingDate(todoVO.getDoingDate()); todo.setId(IdUtil.simpleUUID()); todo.setStatus("0"); todo.setUserId(userId); todoDAO.save(todo); if (todoVO.getOffsetWell() > 0 && todoVO.getRepeatWell() > 0) { ThreadUtil.execute(() -> { long offset = 0; final long nowMilli = DateUtil.parseDate(todoVO.getDoingDate()).getTime(); final long offsetMillis = (long) todoVO.getOffset() * (long) IntegerConsts.ONE_DAY_MILLIS; for (int i = 0; i < todoVO.getRepeat(); i++) { offset += offsetMillis; Todo another = todo.copyInto(new Todo()); another.setCreateTime(System.currentTimeMillis()); another.setDoingDate(DateUtil.formatDate(new Date(nowMilli + offset))); another.setId(IdUtil.simpleUUID()); another.setUserId(userId); todoDAO.save(another); } }); } return todo; } @Autowired  TodoServiceImpl(TodoDAO todoDAO, MongoTemplate mongoTemplate); @Override @LogMethod("获取指定日期之前所有未完成的待办事项") List<Todo> listUndoBeforeDate(String userId, Date date); @Override @LogMethod("列出指定日期的待办事项") List<Todo> listTodo(String userId, Date doingDate); @Override @LogMethod("列出所有待办事项日期") List<String> listDate(String userId); @Override List<TodoCountVO> listTodoCount(String userId, Date start, Date end); @Override @LogMethod("更新待办事项状态") Todo updateTodoStatus(String todoId, String status); @Override @LogMethod("更新待办事项内容") Todo updateTodo(String todoId, String content); @Override @LogMethod("删除待办事项") void remove(String todoId); @Override @LogMethod("添加待办事项") Todo saveTodo(String userId, TodoVO todoVO); }
TodoServiceImpl implements TodoService { @Override @LogMethod("添加待办事项") public Todo saveTodo(String userId, TodoVO todoVO) { Todo todo = new Todo(); todo.setContent(todoVO.getContent()); todo.setCreateTime(System.currentTimeMillis()); todo.setDoingDate(todoVO.getDoingDate()); todo.setId(IdUtil.simpleUUID()); todo.setStatus("0"); todo.setUserId(userId); todoDAO.save(todo); if (todoVO.getOffsetWell() > 0 && todoVO.getRepeatWell() > 0) { ThreadUtil.execute(() -> { long offset = 0; final long nowMilli = DateUtil.parseDate(todoVO.getDoingDate()).getTime(); final long offsetMillis = (long) todoVO.getOffset() * (long) IntegerConsts.ONE_DAY_MILLIS; for (int i = 0; i < todoVO.getRepeat(); i++) { offset += offsetMillis; Todo another = todo.copyInto(new Todo()); another.setCreateTime(System.currentTimeMillis()); another.setDoingDate(DateUtil.formatDate(new Date(nowMilli + offset))); another.setId(IdUtil.simpleUUID()); another.setUserId(userId); todoDAO.save(another); } }); } return todo; } @Autowired  TodoServiceImpl(TodoDAO todoDAO, MongoTemplate mongoTemplate); @Override @LogMethod("获取指定日期之前所有未完成的待办事项") List<Todo> listUndoBeforeDate(String userId, Date date); @Override @LogMethod("列出指定日期的待办事项") List<Todo> listTodo(String userId, Date doingDate); @Override @LogMethod("列出所有待办事项日期") List<String> listDate(String userId); @Override List<TodoCountVO> listTodoCount(String userId, Date start, Date end); @Override @LogMethod("更新待办事项状态") Todo updateTodoStatus(String todoId, String status); @Override @LogMethod("更新待办事项内容") Todo updateTodo(String todoId, String content); @Override @LogMethod("删除待办事项") void remove(String todoId); @Override @LogMethod("添加待办事项") Todo saveTodo(String userId, TodoVO todoVO);  }