package kr.wisestone.owl.service.impl; import kr.wisestone.owl.domain.UserHistory; import kr.wisestone.owl.repository.UserHistoryRepository; import kr.wisestone.owl.service.UserHistoryService; import kr.wisestone.owl.util.DateUtil; import kr.wisestone.owl.vo.UserVo; import kr.wisestone.owl.web.condition.UserHistoryCondition; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Map; @Service public class UserHistoryServiceImpl extends AbstractServiceImpl> implements UserHistoryService { @Autowired private UserHistoryRepository userHistoryRepository; @Override protected JpaRepository getRepository() { return this.userHistoryRepository; } @Transactional public void addUserHistory(Map resJsonData, UserHistoryCondition userHistoryCondition) { UserVo userVo = this.webAppUtil.getLoginUser(); String historyType = userHistoryCondition.getHistoryType(); UserHistory history = new UserHistory(); history.setHistoryType(historyType); userHistoryRepository.saveAndFlush(history); resJsonData.put("name", userVo.getName()); resJsonData.put("registerDate", DateUtil.convertDateToYYYYMMDD(history.getRegisterDate())); } }