OWL ITS + 탐지시스템(인터넷 진흥원)
minhee
2022-02-21 95f9639088ab6a5615aa348eb206d14541782000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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<UserHistory, Long, JpaRepository<UserHistory, Long>> implements UserHistoryService {
 
    @Autowired
    private UserHistoryRepository userHistoryRepository;
 
    @Override
    protected JpaRepository<UserHistory, Long> getRepository() {
        return this.userHistoryRepository;
    }
 
    @Transactional
    public void addUserHistory(Map<String, Object> 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()));
    }
}