refactor some code

dao, service and rest service