OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2021-12-15 de2abff4377c9ee83161c954a51de4c9390fff76
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
package kr.wisestone.owl.web.controller;
 
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.domain.enumType.SocialType;
import kr.wisestone.owl.service.UserService;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.web.condition.UserCondition;
import kr.wisestone.owl.web.form.UserForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
 
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
 
/**
 * Created by jeong on 2017-08-02.
 */
@Controller
public class UserController extends BaseController {
 
    @Autowired
    private UserService userService;
 
    //  로그인 세션 조회
    @RequestMapping(value = "/user/getUserSession", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> getUserSession(HttpServletRequest httpServletRequest) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.getUserSession(resJsonData, httpServletRequest);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  세션을 업데이트한다.
    @RequestMapping(value = "/user/updateUserSession", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> updateUserSession() {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.updateUserSession();
        resJsonData.put(Constants.RES_KEY_CONTENTS, this.webAppUtil.getLoginUser());
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 생성
    @RequestMapping(value = "/user/add", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> addUser(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        Map<String, Object> content = ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT));
        this.userService.addUser(UserForm.make(content), request.getFile("file"));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  구글 아이디로 회원 가입
    @RequestMapping(value = "/googleOAuth2CallBack", method = RequestMethod.GET)
    public ModelAndView googleOAuth2CallBack(@RequestParam("code") String code, @RequestParam("state") String state, HttpServletRequest request) {
        return this.userService.getOAuthToken(code, state, SocialType.GOOGLE, request);
    }
 
    //  네이버 아이디로 회원 가입
    @RequestMapping(value = "/naverOAuth2CallBack", method = RequestMethod.GET)
    public ModelAndView naverOAuth2callBack(@RequestParam("code") String code, @RequestParam("state") String state, HttpServletRequest request) {
        return this.userService.getOAuthToken(code, state, SocialType.NAVER, request);
    }
 
    //  카카오 아이디로 회원 가입
    @RequestMapping(value = "/kakaoOAuth2CallBack", method = RequestMethod.GET)
    public ModelAndView kakaoOAuth2CallBack(@RequestParam("code") String code, @RequestParam("state") String state, HttpServletRequest request) {
        return this.userService.getOAuthToken(code, state, SocialType.KAKAO, request);
    }
 
    //  페이스북 아이디로 회원 가입
    @RequestMapping(value = "/facebookOAuth2CallBack", method = RequestMethod.GET)
    public ModelAndView facebookOAuth2CallBack(@RequestParam("code") String code, @RequestParam("state") String state, HttpServletRequest request) {
        return this.userService.getOAuthToken(code, state, SocialType.FACEBOOK, request);
    }
 
    //  사용자 조회
    @RequestMapping(value = "/user/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> find(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
 
        this.userService.findUser(resJsonData, UserCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  전체 업무공간의 사용자 조회
    @RequestMapping(value = "/user/findByAllWorkspace", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> findByAllWorkspace(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
 
        this.userService.findByAllWorkspace(resJsonData, UserCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 조회
    @RequestMapping(value = "/user/findMyLevelAndDepartment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> findMyLevelAndDepartment(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.findMyLevelAndDepartment(resJsonData);
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 수정
    @RequestMapping(value = "/user/modify", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> modify(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.modifyUser(UserForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFile("file"));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 비밀번호 수정
    @RequestMapping(value = "/user/modifyPassword", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> modifyPassword(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.modifyPassword(UserForm.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 상세 조회
    @RequestMapping(value = "/user/detail", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> detail(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.detailUser(resJsonData, UserCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  비밀번호 찾기
    @RequestMapping(value = "/user/returnEmailPassword", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> returnEmailPassword(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.userService.returnEmailPassword(UserForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자의 마지막 접근 워크스페이스 정보 업데이트
    @RequestMapping(value = "/user/updateLastWorkspace", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> updateLastWorkspace(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.updateLastWorkspace(resJsonData, UserForm.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자의 마지막 접근 프로젝트 정보 업데이트
    @RequestMapping(value = "/user/updateLastProject", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> updateLastProject(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.updateLastProject(resJsonData, UserForm.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자의 마지막 접근 이슈 유형 정보 업데이트
    @RequestMapping(value = "/user/updateLastIssueType", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> updateLastIssueType(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.updateLastIssueType(resJsonData, UserForm.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
 
    //  프로젝트에 참여하는 일반 사용자 목록 조회
    @RequestMapping(value = "/user/findProjectMember", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> findProjectMember(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.findProjectMember(resJsonData, UserCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 탈퇴
    @RequestMapping(value = "/user/withDraw", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> withDraw() {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.userService.withDrawUser();
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  사용자 엑셀 다운로드
    @RequestMapping(value = "/user/downloadExcel", method = RequestMethod.POST)
    public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
        return this.userService.downloadExcel(model);
    }
 
    /*//  이벤트 당첨자 엑셀 다운로드
    @RequestMapping(value = "/user/downloadExcelEvent", method = RequestMethod.POST)
    public ModelAndView downloadExcelEvent(HttpServletRequest request, Model model) {
        return this.userService.downloadExcelEvent(model);
    }*/
}