
--- build.gradle
+++ build.gradle
... | ... | @@ -17,7 +17,6 @@ |
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
dependencies { |
20 |
- |
|
21 | 20 |
// postgresql jdbc |
22 | 21 |
implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.0' |
23 | 22 |
// 오라클 jdbc |
... | ... | @@ -89,7 +88,6 @@ |
89 | 88 |
implementation files('libs/httpcore-4.3.2.jar') |
90 | 89 |
implementation files('libs/json-lib-2.4-jdk15.jar') |
91 | 90 |
|
92 |
- |
|
93 | 91 |
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' |
94 | 92 |
|
95 | 93 |
// 지원되지 않은 오라클 DB 문자 집합 문제 해결용 |
... | ... | @@ -100,10 +98,6 @@ |
100 | 98 |
all { |
101 | 99 |
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' |
102 | 100 |
} |
103 |
-} |
|
104 |
- |
|
105 |
-tasks.named('test') { |
|
106 |
- useJUnitPlatform() |
|
107 | 101 |
} |
108 | 102 |
|
109 | 103 |
bootJar{ |
--- src/main/java/com/takensoft/taken_bi_manager/common/connection/ehojoPlus/util/OpenFisCal.java
+++ src/main/java/com/takensoft/taken_bi_manager/common/connection/ehojoPlus/util/OpenFisCal.java
... | ... | @@ -24,31 +24,52 @@ |
24 | 24 |
|
25 | 25 |
public class OpenFisCal { |
26 | 26 |
public CustomeResultMap openFisCal(ConnectionEhojoVO connectionEhojoVO) throws Exception { |
27 |
+ /********************************************************************** |
|
28 |
+ * 필수 값 설정 |
|
29 |
+ *********************************************************************/ |
|
30 |
+ // apiKey 설정 |
|
31 |
+ String apiKey = connectionEhojoVO.getApiKey(); |
|
32 |
+ // 암복호화 key 설정 |
|
33 |
+ String encKey = connectionEhojoVO.getEncKey(); |
|
34 |
+ // 호출 url 설정 |
|
35 |
+ String url = connectionEhojoVO.getUrl() + connectionEhojoVO.getTaskCode() + "/openAPI/" + connectionEhojoVO.getTableName(); |
|
36 |
+ // 인터페이스 ID |
|
37 |
+ String ifId = connectionEhojoVO.getIfId(); |
|
38 |
+ // 송신 기관 코드 |
|
39 |
+ String lafCode = connectionEhojoVO.getLafCode(); |
|
40 |
+ /********************************************************************** |
|
41 |
+ * 필수 값 설정 끝 |
|
42 |
+ *********************************************************************/ |
|
43 |
+ |
|
27 | 44 |
// HTTP Client |
28 | 45 |
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); |
29 | 46 |
HttpClient httpClient = httpClientBuilder.build(); |
30 | 47 |
// HTTP Method |
31 |
- String url = connectionEhojoVO.getUrl() + connectionEhojoVO.getTaskCode() + "/openAPI/" + connectionEhojoVO.getTableName(); |
|
32 | 48 |
HttpPost httpPost = new HttpPost(url); |
33 | 49 |
// HTTP Header |
34 | 50 |
// API 인증키 (외부기관에서 요청 시 필요) |
35 |
- httpPost.setHeader("API_KEY", connectionEhojoVO.getApiKey()); |
|
51 |
+ httpPost.setHeader("API_KEY", apiKey); |
|
36 | 52 |
httpPost.setHeader("Content-Type", "application/json;charset=utf-8"); |
37 | 53 |
// JSON 요청 메시지 |
38 | 54 |
JSONObject jsonReq = new JSONObject(); |
39 |
- // Header |
|
55 |
+ // HEADER |
|
40 | 56 |
JSONObject header = new JSONObject(); |
41 |
- // body |
|
57 |
+ // BODY |
|
42 | 58 |
JSONObject body = new JSONObject(); |
43 | 59 |
|
44 | 60 |
// Header 설정 |
61 |
+ // 필수값 |
|
62 |
+ header.put("ifId", ifId); // 1. 인터페이스 아이디 |
|
63 |
+ header.put("tranId", EncryptionUtils.makeTxId(ifId)); // 2. 트랜잭션 아이디 |
|
64 |
+ header.put("trnmtInstCd", lafCode); // 3. 요청기관코드: 연계데이터 요청 기관 코드 (각 지자체 코드) |
|
65 |
+ header.put("rcptnInstCd", "MOI"); // 4. 응답기관코드: 연계데이터 제공 기관 코드 (고정 : MOI) |
|
66 |
+ header.put("trnmtInstSysCd", "EHJ"); // 5. 요청시스템코드: 연계데이터 요청 시스템 코드 (고정 : EHJ) |
|
67 |
+ header.put("rcptnInstSysCd", "EHJ"); // 6. 응답시스템코드: 연계데이터 제공 시스템 코드 (고정 : EHJ) |
|
68 |
+ // 추가값 |
|
45 | 69 |
for(EhojoPlusParamVO item : connectionEhojoVO.getHeaders()) { |
46 |
- if(item.getKey().equals("tranId")) { |
|
47 |
- header.put(item.getKey(), EncryptionUtils.makeTxId(connectionEhojoVO.getIfId())); // 트랜잭션 아이디 |
|
48 |
- } else { |
|
49 |
- header.put(item.getKey(), item.getValue()); // 다른 값들은 원래 값 그대로 넣기 |
|
50 |
- } |
|
70 |
+ header.put(item.getKey(), item.getValue()); |
|
51 | 71 |
} |
72 |
+ |
|
52 | 73 |
|
53 | 74 |
/********************************************************************** |
54 | 75 |
* 조회 조건 필수 값 설정(인터페이스 정의서 확인 필요) |
... | ... | @@ -58,55 +79,73 @@ |
58 | 79 |
String key = item.getKey(); |
59 | 80 |
body.put(key, item.getValue()); // 다른 값들은 원래 값 그대로 넣기 |
60 | 81 |
} |
61 |
- |
|
62 | 82 |
/********************************************************************** |
63 |
- * 인터페이스 정의서를 참고하여 추가로 필요한 항목 설정 추가 |
|
64 |
- * |
|
65 |
- * 많은 경우 loop 처리하여 페이지 순차 호출 |
|
66 |
- * |
|
67 | 83 |
* 조회 조건 필수 값 설정 끝 |
68 | 84 |
*********************************************************************/ |
69 | 85 |
|
70 | 86 |
// JSON 요청 메시지 설정 |
71 | 87 |
jsonReq.put("header", header); |
72 | 88 |
// body 암호화 (외부기관에서 요청 시 필요) |
73 |
- jsonReq.put("body", EncryptionUtils.encryptStringAria(body.toString(), connectionEhojoVO.getEncKey())); |
|
74 |
- System.out.println("요청 전문" + jsonReq.toString()); |
|
89 |
+ jsonReq.put("body", EncryptionUtils.encryptStringAria(body.toString(), encKey)); |
|
75 | 90 |
|
76 | 91 |
// Request → Response |
77 | 92 |
httpPost.setEntity(new StringEntity(jsonReq.toString(), "UTF-8")); |
78 | 93 |
HttpResponse httpResponse = httpClient.execute(httpPost); |
79 | 94 |
HttpEntity httpEntity = httpResponse.getEntity(); |
80 |
- |
|
81 |
- List<Map<String,Object>> dataList = new ArrayList<>(); |
|
95 |
+ // 응답 코드 |
|
96 |
+ int statusCode = httpResponse.getStatusLine().getStatusCode(); |
|
82 | 97 |
CustomeResultMap customeResultMap = new CustomeResultMap(); |
83 | 98 |
|
84 | 99 |
if (httpResponse != null) { |
85 |
- int statusCode = httpResponse.getStatusLine().getStatusCode(); |
|
86 |
- switch (statusCode) { |
|
87 |
- case 200: |
|
88 |
- try { |
|
89 |
- // 응답 메시지 |
|
90 |
- String strRes = EntityUtils.toString(httpEntity, "UTF-8"); |
|
91 |
- // JSON Parsing |
|
92 |
- JSONObject jsonRes = JSONObject.fromObject(strRes); |
|
100 |
+ if (statusCode == 200) { |
|
101 |
+ try { |
|
102 |
+ // 응답 메시지 |
|
103 |
+ String strRes = EntityUtils.toString(httpEntity, "UTF-8"); |
|
104 |
+ // JSON Parsing |
|
105 |
+ JSONObject jsonRes = JSONObject.fromObject(strRes); |
|
106 |
+ // 요청결과 |
|
107 |
+ JSONObject resResult = (JSONObject)jsonRes.get("result"); |
|
108 |
+ // body 복호화 (외부기관에서 요청 시 필요) |
|
109 |
+ JSONObject resBody = JSONObject.fromObject(EncryptionUtils.decryptStringAria(jsonRes.getString("body"), encKey)); |
|
110 |
+ jsonRes.put("body", resBody); |
|
93 | 111 |
|
94 |
- // 응답 코드 확인 |
|
95 |
- String responseCode = jsonRes.optString("code", ""); |
|
96 |
- String message = ""; |
|
97 |
- boolean isSuccess = false; |
|
112 |
+ String responseCode = (String) resResult.get("rsltCd"); |
|
113 |
+ |
|
114 |
+ if (responseCode.equals("0000")) { |
|
115 |
+ int max = 0; |
|
116 |
+ int indx = 0; |
|
117 |
+ List<Map<String,Object>> dataList = (List<Map<String, Object>>) resBody.get("data"); |
|
118 |
+ |
|
119 |
+ // 최대 길이의 키값을 가진 객체 구하기 |
|
120 |
+ for(int i = 0 ; i < dataList.size() ; i++){ |
|
121 |
+ if(dataList.get(i).keySet().size() > max) { |
|
122 |
+ max = dataList.get(i).keySet().size(); |
|
123 |
+ indx = i; |
|
124 |
+ } |
|
125 |
+ } |
|
126 |
+ // 빈정보 공백으로 채우기 |
|
127 |
+ for(Map<String, Object> item : dataList ) { |
|
128 |
+ if(max != item.size()) { |
|
129 |
+ for (Map.Entry<String, Object> entry : dataList.get(indx).entrySet()) { |
|
130 |
+ if(item.get(entry.getKey()) == null) { |
|
131 |
+ item.put(entry.getKey(),""); |
|
132 |
+ } |
|
133 |
+ } |
|
134 |
+ } |
|
135 |
+ } |
|
136 |
+ |
|
137 |
+ DataTable dataTable = DataUtil.setMaptoDataTable(dataList); |
|
138 |
+ DataUtil.setColumnMetaData(dataTable, false); |
|
139 |
+ DataTypeUtil.convertDataTableColumMeta(dataTable); |
|
140 |
+ HashMap<String, Object> dataMap = new HashMap<>(); |
|
141 |
+ dataMap.put("dataTable", dataTable); // 또는 적절한 키 이름 사용 |
|
142 |
+ customeResultMap.setResultData(dataMap); |
|
143 |
+ |
|
144 |
+ customeResultMap.setCheckMessage(new CheckMessage(true, "정상", 0)); |
|
145 |
+ } else { |
|
146 |
+ String message = "알 수 없는 응답 코드: " + responseCode; |
|
98 | 147 |
|
99 | 148 |
switch (responseCode) { |
100 |
- case "0000": |
|
101 |
- message = "정상"; |
|
102 |
- isSuccess = true; |
|
103 |
- // 정상 처리 시에만 body 복호화 |
|
104 |
- JSONObject resBody = JSONObject.fromObject(EncryptionUtils.decryptStringAria( |
|
105 |
- jsonRes.getString("body"), |
|
106 |
- connectionEhojoVO.getEncKey())); |
|
107 |
- jsonRes.put("body", resBody); |
|
108 |
- dataList.add(jsonRes); |
|
109 |
- break; |
|
110 | 149 |
case "N011": message = "네트워크 오류"; break; |
111 | 150 |
case "D011": message = "DB 접속 오류"; break; |
112 | 151 |
case "D012": message = "DB SQL 오류"; break; |
... | ... | @@ -129,76 +168,39 @@ |
129 | 168 |
case "6011": message = "응용프로그램 호출 실패"; break; |
130 | 169 |
case "6012": message = "응용프로그램 타임 아웃"; break; |
131 | 170 |
case "6021": message = "업무 반영 실패"; break; |
132 |
- default: message = "알 수 없는 응답 코드: " + responseCode; |
|
133 | 171 |
} |
134 |
- |
|
135 |
- CheckMessage checkMessage = new CheckMessage(isSuccess, message, responseCode); |
|
136 |
- customeResultMap.setCheckMessage(checkMessage); |
|
137 |
- |
|
138 |
- // 로깅 |
|
139 |
- System.out.println("요청 결과 :: " + jsonRes.toString()); |
|
140 |
- System.out.println("응답 코드 :: " + responseCode + ", 메시지 :: " + message); |
|
141 |
- |
|
142 |
- } catch (Exception e) { |
|
143 |
- System.err.println("응답 처리 중 오류 발생: " + e.getMessage()); |
|
144 |
- CheckMessage errorMessage = new CheckMessage(false, "응답 처리 중 오류 발생", "5004"); |
|
145 |
- customeResultMap.setCheckMessage(errorMessage); |
|
172 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, message, responseCode)); |
|
146 | 173 |
} |
147 |
- break; |
|
148 |
- |
|
149 |
- case 400: |
|
150 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "잘못된 요청", "4002")); |
|
151 |
- break; |
|
152 |
- case 401: |
|
153 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "인증 실패", "4011")); |
|
154 |
- break; |
|
155 |
- case 403: |
|
156 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "접근 권한 없음", "4012")); |
|
157 |
- break; |
|
158 |
- case 404: |
|
159 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "리소스를 찾을 수 없음", "4041")); |
|
160 |
- break; |
|
161 |
- case 500: |
|
162 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "서버 내부 오류", "5001")); |
|
163 |
- break; |
|
164 |
- case 503: |
|
165 |
- customeResultMap.setCheckMessage(new CheckMessage(false, "서비스 일시적 사용 불가", "5002")); |
|
166 |
- break; |
|
167 |
- default: |
|
168 |
- customeResultMap.setCheckMessage(new CheckMessage(false, |
|
169 |
- "예상치 못한 HTTP 상태 코드: " + statusCode, "5004")); |
|
174 |
+ } catch (Exception e) { |
|
175 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "응답 처리 중 오류 발생", "5004")); |
|
176 |
+ } |
|
177 |
+ } else { |
|
178 |
+ switch (statusCode) { |
|
179 |
+ case 400: |
|
180 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "잘못된 요청", "4002")); |
|
181 |
+ break; |
|
182 |
+ case 401: |
|
183 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "인증 실패", "4011")); |
|
184 |
+ break; |
|
185 |
+ case 403: |
|
186 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "접근 권한 없음", "4012")); |
|
187 |
+ break; |
|
188 |
+ case 404: |
|
189 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "리소스를 찾을 수 없음", "4041")); |
|
190 |
+ break; |
|
191 |
+ case 500: |
|
192 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "서버 내부 오류", "5001")); |
|
193 |
+ break; |
|
194 |
+ case 503: |
|
195 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "서비스 일시적 사용 불가", "5002")); |
|
196 |
+ break; |
|
197 |
+ default: |
|
198 |
+ customeResultMap.setCheckMessage(new CheckMessage(false, "예상치 못한 HTTP 상태 코드: " + statusCode, "5004")); |
|
199 |
+ } |
|
170 | 200 |
} |
171 | 201 |
} else { |
172 | 202 |
customeResultMap.setCheckMessage(new CheckMessage(false, "HTTP 응답이 null입니다", "5004")); |
173 | 203 |
} |
174 |
- |
|
175 |
- int max = 0; |
|
176 |
- int indx = 0; |
|
177 |
- |
|
178 |
- // 최대 길이의 키값을 가진 객체 구하기 |
|
179 |
- for(int i = 0 ; i < dataList.size() ; i++){ |
|
180 |
- if(dataList.get(i).keySet().size() > max) { |
|
181 |
- max = dataList.get(i).keySet().size(); |
|
182 |
- indx = i; |
|
183 |
- } |
|
184 |
- } |
|
185 |
- // 빈정보 공백으로 채우기 |
|
186 |
- for(Map<String, Object> item : dataList ) { |
|
187 |
- if(max != item.size()) { |
|
188 |
- for (Map.Entry<String, Object> entry : dataList.get(indx).entrySet()) |
|
189 |
- { |
|
190 |
- if(item.get(entry.getKey()) == null) { |
|
191 |
- item.put(entry.getKey(),""); |
|
192 |
- } |
|
193 |
- } |
|
194 |
- } |
|
195 |
- } |
|
196 |
- DataTable dataTable = DataUtil.setMaptoDataTable(dataList); |
|
197 |
- DataUtil.setColumnMetaData(dataTable, false); |
|
198 |
- DataTypeUtil.convertDataTableColumMeta(dataTable); |
|
199 |
- HashMap<String, Object> dataMap = new HashMap<>(); |
|
200 |
- dataMap.put("dataTable", dataTable); // 또는 적절한 키 이름 사용 |
|
201 |
- customeResultMap.setResultData(dataMap); |
|
202 | 204 |
return customeResultMap; |
203 | 205 |
} |
204 |
-} |
|
206 |
+}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/department/service/Impl/DepartmentServiceImpl.java
+++ src/main/java/com/takensoft/taken_bi_manager/department/service/Impl/DepartmentServiceImpl.java
... | ... | @@ -47,8 +47,6 @@ |
47 | 47 |
} |
48 | 48 |
} |
49 | 49 |
|
50 |
- /************************************************부서 등록 시작*******************************************************/ |
|
51 |
- |
|
52 | 50 |
/** |
53 | 51 |
* @author 이세현 |
54 | 52 |
* @since 2024.03.21 |
... | ... | @@ -120,10 +118,6 @@ |
120 | 118 |
throw new RuntimeException("부서 권한 등록에 실패하였습니다."); |
121 | 119 |
} |
122 | 120 |
} |
123 |
- |
|
124 |
- /************************************************부서 등록 종료*******************************************************/ |
|
125 |
- |
|
126 |
- /************************************************부서 조회 시작*******************************************************/ |
|
127 | 121 |
|
128 | 122 |
/** |
129 | 123 |
* @author 박민혁 |
... | ... | @@ -217,86 +211,6 @@ |
217 | 211 |
|
218 | 212 |
return resultMap; |
219 | 213 |
} |
220 |
- |
|
221 |
- /************************************************부서 조회 종료*******************************************************/ |
|
222 |
- |
|
223 |
-// /** |
|
224 |
-// * @author 박하 |
|
225 |
-// * @since 2024.02.21 |
|
226 |
-// * |
|
227 |
-// * 부서 데이터 수정 |
|
228 |
-// */ |
|
229 |
-// @Transactional |
|
230 |
-// public CustomeResultMap updateDepartment(DepartmentVO departmentVO) throws Exception { |
|
231 |
-// |
|
232 |
-// CustomeResultMap resultMap = new CustomeResultMap(); |
|
233 |
-// |
|
234 |
-// departmentVO.setUpdt_id(AuthUtil.getLoginUserId()); |
|
235 |
-// |
|
236 |
-// Integer upperDeptDp = departmentDAO.getDeptDpByOrgCode(departmentVO.getUpper_dept()); |
|
237 |
-// |
|
238 |
-// if (upperDeptDp == null) { |
|
239 |
-// |
|
240 |
-// departmentVO.setDept_dp(1); |
|
241 |
-// }else{ |
|
242 |
-// departmentVO.setDept_dp(upperDeptDp + 1); |
|
243 |
-// } |
|
244 |
-// |
|
245 |
-// String upperAddr = departmentDAO.getDeptAddrByOrgCode(departmentVO.getUpper_dept()); |
|
246 |
-// |
|
247 |
-// if (upperAddr == null) { |
|
248 |
-// departmentVO.setDept_addr(departmentVO.getDept_nm()); |
|
249 |
-// } else { |
|
250 |
-// departmentVO.setDept_addr(upperAddr + "/" + departmentVO.getDept_nm()); |
|
251 |
-// } |
|
252 |
-// |
|
253 |
-// |
|
254 |
-// upperupdateChildDepartments(departmentVO.getDept_code(), departmentVO.getDept_dp(), departmentVO.getDept_addr()); |
|
255 |
-// |
|
256 |
-// int result = departmentDAO.updateDepartment(departmentVO); |
|
257 |
-// resultMap.getResultData().put("updateDepartment", result ); |
|
258 |
-// |
|
259 |
-// if(result > 0) { |
|
260 |
-// OrgnztAuthorVO orgnztAuthorVO = new OrgnztAuthorVO(); |
|
261 |
-// orgnztAuthorVO.setDept_code(departmentVO.getDept_code()); |
|
262 |
-// orgnztAuthorVO.setAuthor(departmentVO.getAuthor()); |
|
263 |
-// departmentDAO.updateOrgnztAuthor(orgnztAuthorVO); |
|
264 |
-// }else { |
|
265 |
-// throw new Exception("Department update insertion failed."); |
|
266 |
-// } |
|
267 |
-// |
|
268 |
-// return resultMap; |
|
269 |
-// } |
|
270 |
-// |
|
271 |
-// /** |
|
272 |
-// * @author 박하 |
|
273 |
-// * @since 2024.02.21 |
|
274 |
-// * |
|
275 |
-// * 부서 데이터 수정 - 자식부터 업데이트 |
|
276 |
-// */ |
|
277 |
-// private void upperupdateChildDepartments(String dept_code, int selectedDeptDp, String selectedDeptNm) throws Exception { |
|
278 |
-// |
|
279 |
-// |
|
280 |
-// List<DepartmentVO> childDepartmentList = departmentDAO.getDepartmentsByUpperDept(dept_code); |
|
281 |
-// |
|
282 |
-// |
|
283 |
-// for (DepartmentVO childDepartment : childDepartmentList) { |
|
284 |
-// |
|
285 |
-// String NewAddr = selectedDeptNm +"/"+childDepartment.getDept_nm(); |
|
286 |
-// |
|
287 |
-// childDepartment.setDept_addr(NewAddr); |
|
288 |
-// |
|
289 |
-// childDepartment.setDept_dp(selectedDeptDp+1); |
|
290 |
-// |
|
291 |
-// departmentDAO.updateChildAddr(childDepartment); |
|
292 |
-// |
|
293 |
-// // 재귀적으로 자식 부서를 업데이트 |
|
294 |
-// upperupdateChildDepartments(childDepartment.getDept_code(), childDepartment.getDept_dp(), NewAddr); |
|
295 |
-// |
|
296 |
-// } |
|
297 |
-// } |
|
298 |
- |
|
299 |
- /************************************************부서 수정 시작*******************************************************/ |
|
300 | 214 |
|
301 | 215 |
/** |
302 | 216 |
* @author 이세현 |
... | ... | @@ -407,54 +321,6 @@ |
407 | 321 |
} |
408 | 322 |
} |
409 | 323 |
|
410 |
- /************************************************부서 수정 종료*******************************************************/ |
|
411 |
- |
|
412 |
- |
|
413 |
- |
|
414 |
-// /** |
|
415 |
-// * @author 박하 |
|
416 |
-// * @since 2024.02.28 |
|
417 |
-// * |
|
418 |
-// * 부서 데이터 삭제 |
|
419 |
-// */ |
|
420 |
-// public CustomeResultMap deleteDepartment(DepartmentVO departmentVO) throws Exception { |
|
421 |
-// CustomeResultMap resultMap = new CustomeResultMap(); |
|
422 |
-// |
|
423 |
-// departmentVO.setUse_at(false); |
|
424 |
-// |
|
425 |
-// upperdeleteChildDepartments(departmentVO.getDept_code()); |
|
426 |
-// |
|
427 |
-// resultMap.getResultData().put("deleteDepartment",departmentDAO.deleteDepartment(departmentVO)); |
|
428 |
-// |
|
429 |
-// return resultMap; |
|
430 |
-// } |
|
431 |
-// |
|
432 |
-// /** |
|
433 |
-// * @author 박하 |
|
434 |
-// * @since 2024.02.28 |
|
435 |
-// * |
|
436 |
-// * 부서 데이터 삭제 - 자식부터 업데이트 |
|
437 |
-// */ |
|
438 |
-// private void upperdeleteChildDepartments(String dept_code) throws Exception { |
|
439 |
-// |
|
440 |
-// |
|
441 |
-// List<DepartmentVO> childDepartmentList = departmentDAO.getDepartmentsByUpperDept(dept_code); |
|
442 |
-// |
|
443 |
-// |
|
444 |
-// for (DepartmentVO childDepartment : childDepartmentList) { |
|
445 |
-// |
|
446 |
-// childDepartment.setUse_at(false); |
|
447 |
-// |
|
448 |
-// departmentDAO.deleteDepartment(childDepartment); |
|
449 |
-// |
|
450 |
-// // 재귀적으로 자식 부서를 업데이트 |
|
451 |
-// upperdeleteChildDepartments(childDepartment.getDept_code()); |
|
452 |
-// |
|
453 |
-// } |
|
454 |
-// } |
|
455 |
- |
|
456 |
- /************************************************부서 삭제 시작*******************************************************/ |
|
457 |
- |
|
458 | 324 |
/** |
459 | 325 |
* @author 이세현 |
460 | 326 |
* @since 2024.03.25 |
... | ... | @@ -513,5 +379,21 @@ |
513 | 379 |
if(deptMemberCount != result) throw new RuntimeException("해당 부서 사용자 삭제에 오류가 발생하였습니다."); |
514 | 380 |
} |
515 | 381 |
|
516 |
- /************************************************부서 삭제 종료*******************************************************/ |
|
517 |
-} |
|
382 |
+ /** |
|
383 |
+ * @author 박정하 |
|
384 |
+ * @since 2025.01.07 |
|
385 |
+ * |
|
386 |
+ * 부서 상세 조회 |
|
387 |
+ */ |
|
388 |
+ public CustomeResultMap selectDept(String deptCode) throws Exception { |
|
389 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
390 |
+ result.put("selectDept", departmentDAO.selectDept(deptCode)); // 부서 상세 조회 |
|
391 |
+ result.put("selectDeptUserList", departmentDAO.selectDept(deptCode)); // 부서 사용자 목록 조회 |
|
392 |
+ result.put("selectDeptHostList", departmentDAO.selectDept(deptCode)); // 부서 호스트 목록 조회 |
|
393 |
+ result.put("selectDeptDirectoryList", departmentDAO.selectDept(deptCode)); // 부서 디렉토리 목록 조회 |
|
394 |
+ |
|
395 |
+ CustomeResultMap resultMap = new CustomeResultMap(); |
|
396 |
+ resultMap.setResultData(result); |
|
397 |
+ return resultMap; |
|
398 |
+ } |
|
399 |
+}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/dao/MemberDAO.java
+++ src/main/java/com/takensoft/taken_bi_manager/user/member/dao/MemberDAO.java
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
package com.takensoft.taken_bi_manager.user.member.dao; |
2 | 2 |
|
3 |
+import com.takensoft.taken_bi_manager.common.vo.CustomeResultMap; |
|
3 | 4 |
import com.takensoft.taken_bi_manager.common.vo.SearchVO; |
4 | 5 |
import com.takensoft.taken_bi_manager.user.member.vo.AuthorVO; |
5 | 6 |
import com.takensoft.taken_bi_manager.user.member.vo.UserAuthorVO; |
... | ... | @@ -67,7 +68,15 @@ |
67 | 68 |
* |
68 | 69 |
* 사용자 목록 조회 |
69 | 70 |
*/ |
70 |
- List<Member> selectMembers(SearchVO searchVO) throws Exception; |
|
71 |
+ List<Member> selectMemberListByAdmin(SearchVO searchVO) throws Exception; |
|
72 |
+ |
|
73 |
+ /** |
|
74 |
+ * @author 박하 |
|
75 |
+ * @since 2024.02.01 |
|
76 |
+ * |
|
77 |
+ * 사용자 목록 조회 |
|
78 |
+ */ |
|
79 |
+ List<Member> selectMemberListByUser(SearchVO searchVO) throws Exception; |
|
71 | 80 |
|
72 | 81 |
/** |
73 | 82 |
* @author 박하 |
... | ... | @@ -75,7 +84,15 @@ |
75 | 84 |
* |
76 | 85 |
* 사용자 목록 COUNT 조회 |
77 | 86 |
*/ |
78 |
- int selectMembersCount(SearchVO searchVO) throws Exception; |
|
87 |
+ int selectMemberListByAdminCount(SearchVO searchVO) throws Exception; |
|
88 |
+ |
|
89 |
+ /** |
|
90 |
+ * @author 박하 |
|
91 |
+ * @since 2024.02.01 |
|
92 |
+ * |
|
93 |
+ * 사용자 목록 COUNT 조회 |
|
94 |
+ */ |
|
95 |
+ int selectMemberListByUserCount(SearchVO searchVO) throws Exception; |
|
79 | 96 |
|
80 | 97 |
/** |
81 | 98 |
* @author 하관우 |
... | ... | @@ -244,4 +261,12 @@ |
244 | 261 |
* UserAuthor 권한 개수 조회 |
245 | 262 |
*/ |
246 | 263 |
int getUserAuthorCount(Member member) throws Exception; |
264 |
+ |
|
265 |
+ /** |
|
266 |
+ * @author 박정하 |
|
267 |
+ * @since 2025.01.07 |
|
268 |
+ * |
|
269 |
+ * 사용자 잠금 해제 |
|
270 |
+ */ |
|
271 |
+ int updateUserLockAt(String userId); |
|
247 | 272 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/servie/MemberService.java
+++ src/main/java/com/takensoft/taken_bi_manager/user/member/servie/MemberService.java
... | ... | @@ -5,11 +5,25 @@ |
5 | 5 |
import com.takensoft.taken_bi_manager.common.vo.CustomeResultMap; |
6 | 6 |
import com.takensoft.taken_bi_manager.common.vo.SearchVO; |
7 | 7 |
import com.takensoft.taken_bi_manager.user.member.vo.Member; |
8 |
-import org.bouncycastle.pqc.crypto.ExchangePair; |
|
9 |
-import org.springframework.web.bind.annotation.PathVariable; |
|
10 |
-import org.springframework.web.bind.annotation.RequestBody; |
|
11 | 8 |
|
12 | 9 |
public interface MemberService { |
10 |
+ /** |
|
11 |
+ * @author 김성원 |
|
12 |
+ * @since 2024.01.09 |
|
13 |
+ * |
|
14 |
+ * 사용자 목록 조회 |
|
15 |
+ */ |
|
16 |
+ CustomeResultMap getMemberList(SearchVO searchVO, String type) throws Exception; |
|
17 |
+ |
|
18 |
+ /** |
|
19 |
+ * @author 박하 |
|
20 |
+ * @since 2024.02.14 |
|
21 |
+ * |
|
22 |
+ * 회원 선택 삭제 |
|
23 |
+ */ |
|
24 |
+ CustomeResultMap deleteMember(List<Member> deleteList) throws Exception; |
|
25 |
+ |
|
26 |
+ |
|
13 | 27 |
/** |
14 | 28 |
* @author 김성원 |
15 | 29 |
* @since 2024.01.09 |
... | ... | @@ -67,22 +81,6 @@ |
67 | 81 |
CustomeResultMap updateMemberPw(Member member) throws Exception; |
68 | 82 |
|
69 | 83 |
/** |
70 |
- * @author 박하 |
|
71 |
- * @since 2024.02.14 |
|
72 |
- * |
|
73 |
- * 회원 선택 삭제 |
|
74 |
- */ |
|
75 |
- CustomeResultMap deleteMember(List<String> userid) throws Exception; |
|
76 |
- |
|
77 |
- /** |
|
78 |
- * @author 김성원 |
|
79 |
- * @since 2024.01.09 |
|
80 |
- * |
|
81 |
- * 사용자 목록 조회 |
|
82 |
- */ |
|
83 |
- CustomeResultMap getMemberList(SearchVO searchVO, String type) throws Exception; |
|
84 |
- |
|
85 |
- /** |
|
86 | 84 |
* @author 하관우 |
87 | 85 |
* @since 2024.08.09 |
88 | 86 |
* |
... | ... | @@ -137,4 +135,12 @@ |
137 | 135 |
* 비밀번호 찾기 |
138 | 136 |
*/ |
139 | 137 |
Member findUserPwd(Member member) throws Exception; |
140 |
-} |
|
138 |
+ |
|
139 |
+ /** |
|
140 |
+ * @author 박정하 |
|
141 |
+ * @since 2025.01.07 |
|
142 |
+ * |
|
143 |
+ * 사용자 잠금 해제 |
|
144 |
+ */ |
|
145 |
+ CustomeResultMap updateUserLockAt(String userId); |
|
146 |
+}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/servie/impl/MemberServiceImpl.java
+++ src/main/java/com/takensoft/taken_bi_manager/user/member/servie/impl/MemberServiceImpl.java
... | ... | @@ -27,7 +27,6 @@ |
27 | 27 |
@Service |
28 | 28 |
@RequiredArgsConstructor |
29 | 29 |
public class MemberServiceImpl implements MemberService { |
30 |
- |
|
31 | 30 |
private final MemberDAO memberDAO; |
32 | 31 |
|
33 | 32 |
static class HistoryTypes { |
... | ... | @@ -44,8 +43,13 @@ |
44 | 43 |
*/ |
45 | 44 |
@Override |
46 | 45 |
public Member getMemnberById(String userId) throws Exception { |
47 |
- Member member = memberDAO.getMemnberById(userId); |
|
48 |
- member.dataDecoder(); |
|
46 |
+ Member member = new Member(); |
|
47 |
+ |
|
48 |
+ if (userId != null) { |
|
49 |
+ member = memberDAO.getMemnberById(userId); |
|
50 |
+ member.dataDecoder(); |
|
51 |
+ } |
|
52 |
+ |
|
49 | 53 |
return member; |
50 | 54 |
} |
51 | 55 |
|
... | ... | @@ -62,15 +66,21 @@ |
62 | 66 |
member.setCreatId(AuthUtil.getLoginUserId()); |
63 | 67 |
member.PasswordEncoder(); |
64 | 68 |
member.dataEncoder(); |
69 |
+ |
|
65 | 70 |
//사용자 등록 |
66 | 71 |
int result = insertMemberData(member); |
72 |
+ |
|
67 | 73 |
//사용자 권한 등록 |
68 | 74 |
insertUserAuthor(member); |
75 |
+ |
|
69 | 76 |
//사용자 부서 등록 |
70 | 77 |
insertUserDepartment(member); |
78 |
+ |
|
71 | 79 |
//사용자 히스토리 등록 |
72 | 80 |
insertHistory(INSERT,member); |
81 |
+ |
|
73 | 82 |
resultMap.getResultData().put("insertMember",result); |
83 |
+ |
|
74 | 84 |
return resultMap; |
75 | 85 |
} |
76 | 86 |
|
... | ... | @@ -108,23 +118,23 @@ |
108 | 118 |
@Override |
109 | 119 |
public CustomeResultMap getMemberList(SearchVO searchVO, String type) throws Exception { |
110 | 120 |
CustomeResultMap resultMap = new CustomeResultMap(); |
111 |
- List<Member> members = null; |
|
112 |
- int count = 0; |
|
113 |
- if("dept".equals(type)){ |
|
114 |
- //소속된 부서가 없는 사용자 목록,COUNT 조회 |
|
115 |
- members = memberDAO.selectNoDeptUserList(searchVO); |
|
116 |
- count = memberDAO.selectNoDeptUserCount(searchVO); |
|
117 |
- } else { |
|
118 |
- //일반 사용자 목록,COUNT 조회 |
|
119 |
- members = memberDAO.selectMembers(searchVO); |
|
120 |
- count = memberDAO.selectMembersCount(searchVO); |
|
121 |
+ List<Member> members; |
|
122 |
+ |
|
123 |
+ if (type != null && type.equals("ROLE_ADMIN")) { // 관리자 목록 조회 |
|
124 |
+ members = memberDAO.selectMemberListByAdmin(searchVO); |
|
125 |
+ searchVO.setTotalRows(memberDAO.selectMemberListByAdminCount(searchVO)); |
|
126 |
+ } else { // 관리자 외 목록 조회 |
|
127 |
+ members = memberDAO.selectMemberListByUser(searchVO); |
|
128 |
+ searchVO.setTotalRows(memberDAO.selectMemberListByUserCount(searchVO)); |
|
121 | 129 |
} |
130 |
+ |
|
131 |
+ // 사용자 정보 복호화 |
|
122 | 132 |
for (Member member : members) { |
123 | 133 |
member.dataDecoder(); |
124 | 134 |
} |
125 | 135 |
|
126 |
- resultMap.getResultData().put("selectMemberList", members); |
|
127 |
- resultMap.getResultData().put("totalRow", count); |
|
136 |
+ resultMap.getResultData().put("members", members); |
|
137 |
+ resultMap.getResultData().put("searchVO", searchVO); |
|
128 | 138 |
return resultMap; |
129 | 139 |
} |
130 | 140 |
/** |
... | ... | @@ -339,40 +349,50 @@ |
339 | 349 |
*/ |
340 | 350 |
@Override |
341 | 351 |
@Transactional(rollbackFor = Exception.class) |
342 |
- public CustomeResultMap deleteMember(List<String> userid) throws Exception { |
|
343 |
- //dataAccessException, NullPointerException |
|
352 |
+ public CustomeResultMap deleteMember(List<Member> deleteList) throws Exception { |
|
344 | 353 |
CustomeResultMap resultMap = new CustomeResultMap(); |
345 |
- int deleteMemberCount = 0; |
|
346 |
- int insertHistoryCount = 0; |
|
347 |
- int deleteUserAuthCount = 0; |
|
348 |
- int existingOrgnztMemberCount = 0; |
|
349 |
- int deleteOrgnztMemberCount = 0; |
|
350 |
- for (String userId : userid) { |
|
351 |
- //사용자 삭제 |
|
352 |
- deleteMemberCount += memberDAO.deleteMember(userId); |
|
353 |
- //사용자가 속속된 조직이 있는지 확인 |
|
354 |
- existingOrgnztMemberCount += memberDAO.haveOrgnztUserCount(userId); |
|
355 |
- //사용자 조직 연계 테이블 삭제 |
|
356 |
- deleteOrgnztMemberCount += memberDAO.deleteOrgnztMember(userId); |
|
357 |
- //사용자 권한 연계 테이블 삭제 |
|
358 |
- deleteUserAuthCount += memberDAO.deleteUserAuthor(userId); |
|
359 |
- //사용자 히스토리 등록 |
|
360 |
- Member memberById = memberDAO.getMemnberById(userId); |
|
361 |
- insertHistoryCount += insertHistory(DELETE,memberById); |
|
354 |
+ |
|
355 |
+ //dataAccessException, NullPointerException |
|
356 |
+ try { |
|
357 |
+ int deleteMemberCount = 0; |
|
358 |
+ int insertHistoryCount = 0; |
|
359 |
+ int deleteUserAuthCount = 0; |
|
360 |
+ int existingOrgnztMemberCount = 0; |
|
361 |
+ int deleteOrgnztMemberCount = 0; |
|
362 |
+ for (Member member : deleteList) { |
|
363 |
+ String userId = member.getUserId(); |
|
364 |
+ |
|
365 |
+ //사용자 삭제 |
|
366 |
+ deleteMemberCount += memberDAO.deleteMember(userId); |
|
367 |
+ //사용자가 소속된 조직이 있는지 확인 |
|
368 |
+ existingOrgnztMemberCount += memberDAO.haveOrgnztUserCount(userId); |
|
369 |
+ //사용자 조직 연계 테이블 삭제 |
|
370 |
+ deleteOrgnztMemberCount += memberDAO.deleteOrgnztMember(userId); |
|
371 |
+ //사용자 권한 연계 테이블 삭제 |
|
372 |
+ deleteUserAuthCount += memberDAO.deleteUserAuthor(userId); |
|
373 |
+ //사용자 히스토리 등록 |
|
374 |
+ Member memberById = memberDAO.getMemnberById(userId); |
|
375 |
+ |
|
376 |
+ insertHistoryCount += insertHistory(DELETE,memberById); |
|
377 |
+ } |
|
378 |
+ |
|
379 |
+ //모든 사용자가 성공적으로 삭제되었는지 확인 |
|
380 |
+ if(deleteMemberCount != deleteList.size() |
|
381 |
+ || deleteMemberCount != insertHistoryCount |
|
382 |
+ || deleteMemberCount != deleteUserAuthCount |
|
383 |
+ || existingOrgnztMemberCount != deleteOrgnztMemberCount) throw new RuntimeException("사용자 선택 삭제 오류 발생"); |
|
384 |
+ resultMap.getResultData().put("deleteMember", deleteMemberCount); |
|
385 |
+ } catch(RuntimeException e) { |
|
386 |
+ resultMap.getCheckMessage().setError("선택한 사용자 삭제에 실패하였습니다. 다시 시도해주세요.",HttpStatus.BAD_REQUEST.value()); |
|
387 |
+ } catch(Exception e) { |
|
388 |
+ resultMap.getCheckMessage().setError("삭제오류, 관리자에게 문의바랍니다." ,HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
362 | 389 |
} |
363 | 390 |
|
364 |
- //모든 사용자가 성공적으로 삭제되었는지 확인 |
|
365 |
- if(deleteMemberCount != userid.size() |
|
366 |
- || deleteMemberCount != insertHistoryCount |
|
367 |
- || deleteMemberCount != deleteUserAuthCount |
|
368 |
- || existingOrgnztMemberCount != deleteOrgnztMemberCount) throw new RuntimeException("사용자 선택 삭제 오류 발생"); |
|
369 |
- |
|
370 |
- resultMap.getResultData().put("deleteMember",deleteMemberCount); |
|
371 | 391 |
return resultMap; |
372 | 392 |
} |
373 | 393 |
|
374 | 394 |
//사용자 히스토리 등록 |
375 |
- private int insertHistory(String historyType,Member member) throws Exception { |
|
395 |
+ private int insertHistory(String historyType, Member member) throws Exception { |
|
376 | 396 |
member.dataDecoder(); |
377 | 397 |
member.setHistoryType(historyType); |
378 | 398 |
int result = 0; |
... | ... | @@ -472,4 +492,27 @@ |
472 | 492 |
findUser.dataDecoder(); |
473 | 493 |
return findUser; |
474 | 494 |
} |
495 |
+ |
|
496 |
+ /** |
|
497 |
+ * @author 박정하 |
|
498 |
+ * @since 2025.01.07 |
|
499 |
+ * |
|
500 |
+ * 사용자 잠금 해제 |
|
501 |
+ */ |
|
502 |
+ @Override |
|
503 |
+ public CustomeResultMap updateUserLockAt(String userId) { |
|
504 |
+ CustomeResultMap resultMap = new CustomeResultMap(); |
|
505 |
+ |
|
506 |
+ try { |
|
507 |
+ memberDAO.updateUserLockAt(userId); |
|
508 |
+ resultMap.getResultData().put("result", true); |
|
509 |
+ } catch (Exception e) { |
|
510 |
+ resultMap.getResultData().put("result", false); |
|
511 |
+ String errorMessage = e instanceof RuntimeException ? e.getMessage() : "사용자 부서 등록 오류, 관리자에게 문의 바랍니다."; |
|
512 |
+ int status = e instanceof RuntimeException ? HttpStatus.BAD_REQUEST.value() : HttpStatus.INTERNAL_SERVER_ERROR.value(); |
|
513 |
+ resultMap.getCheckMessage().setError(errorMessage, status); |
|
514 |
+ } |
|
515 |
+ |
|
516 |
+ return resultMap; |
|
517 |
+ } |
|
475 | 518 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/vo/Member.java
+++ src/main/java/com/takensoft/taken_bi_manager/user/member/vo/Member.java
... | ... | @@ -1,12 +1,12 @@ |
1 | 1 |
package com.takensoft.taken_bi_manager.user.member.vo; |
2 | 2 |
|
3 |
-import java.sql.Date; |
|
4 |
-import java.sql.Timestamp; |
|
5 |
-import java.util.List; |
|
6 |
- |
|
7 | 3 |
import com.takensoft.taken_bi_manager.common.util.CryptoUtil; |
8 | 4 |
|
9 | 5 |
import lombok.Data; |
6 |
+ |
|
7 |
+import java.sql.Date; |
|
8 |
+import java.sql.Timestamp; |
|
9 |
+import java.util.List; |
|
10 | 10 |
|
11 | 11 |
/** |
12 | 12 |
* @author 박하 |
... | ... | @@ -16,7 +16,6 @@ |
16 | 16 |
*/ |
17 | 17 |
@Data |
18 | 18 |
public class Member { |
19 |
- |
|
20 | 19 |
// 사용자 ID |
21 | 20 |
private String userId; |
22 | 21 |
|
... | ... | @@ -81,15 +80,13 @@ |
81 | 80 |
private List<String> authList; |
82 | 81 |
|
83 | 82 |
// 권한 |
84 |
- private String author; |
|
83 |
+ private String author; |
|
85 | 84 |
|
86 | 85 |
// 부서코드 |
87 |
- private String dept_code; |
|
86 |
+ private String dept_code; |
|
88 | 87 |
|
89 | 88 |
// 히스토리 타입 |
90 | 89 |
private String historyType; |
91 |
- |
|
92 |
- |
|
93 | 90 |
|
94 | 91 |
|
95 | 92 |
/** |
... | ... | @@ -129,5 +126,4 @@ |
129 | 126 |
this.adres = CryptoUtil.decryptData(this.adres); |
130 | 127 |
this.adresDetail = CryptoUtil.decryptData(this.adresDetail); |
131 | 128 |
} |
132 |
- |
|
133 | 129 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/vo/MemberHistory.java
... | ... | @@ -1,40 +0,0 @@ |
1 | -package com.takensoft.taken_bi_manager.user.member.vo; | |
2 | - | |
3 | -import java.sql.Date; | |
4 | -import java.sql.Timestamp; | |
5 | - | |
6 | -import lombok.Getter; | |
7 | -import lombok.Setter; | |
8 | - | |
9 | -/** | |
10 | - * @author 김성원 | |
11 | - * @since 2023-12-28 | |
12 | - * | |
13 | - * 회원정보 객체 | |
14 | - */ | |
15 | -@Getter | |
16 | -@Setter | |
17 | -public class MemberHistory { | |
18 | - | |
19 | - // 사용자 ID | |
20 | - private String userId; | |
21 | - | |
22 | - // 사용자 이름 | |
23 | - private String userNm; | |
24 | - | |
25 | - // 사용자 이메일 | |
26 | - private String userEmail; | |
27 | - | |
28 | - // 사용자 전화번호 | |
29 | - private String userTel; | |
30 | - | |
31 | - // 사용자 휴대폰 번호 | |
32 | - private String userPhone; | |
33 | - | |
34 | - // 생성일 | |
35 | - private Timestamp creatDt; | |
36 | - | |
37 | - // 부서명 | |
38 | - private String deptCode; | |
39 | - | |
40 | -} |
--- src/main/java/com/takensoft/taken_bi_manager/user/member/web/MemberController.java
+++ src/main/java/com/takensoft/taken_bi_manager/user/member/web/MemberController.java
... | ... | @@ -8,8 +8,7 @@ |
8 | 8 |
import org.springframework.http.HttpStatus; |
9 | 9 |
import org.springframework.web.bind.annotation.*; |
10 | 10 |
|
11 |
-import java.util.HashMap; |
|
12 |
-import java.util.List; |
|
11 |
+import java.util.*; |
|
13 | 12 |
|
14 | 13 |
@RestController |
15 | 14 |
@RequiredArgsConstructor |
... | ... | @@ -19,20 +18,26 @@ |
19 | 18 |
|
20 | 19 |
/** |
21 | 20 |
* @author 이세현 |
21 |
+ * @since 2024.03.21 |
|
22 |
+ * |
|
23 |
+ * 사용자 목록 조회 |
|
24 |
+ * 특정 타입이 있다면 타입에 해당하는 목록 조회 |
|
25 |
+ */ |
|
26 |
+ @PostMapping(value = {"/list", "/list/{type}" }) |
|
27 |
+ public CustomeResultMap selectMemberList(@RequestBody SearchVO searchVO, @PathVariable(required = false) String type) throws Exception { |
|
28 |
+ CustomeResultMap map = memberService.getMemberList(searchVO,type); |
|
29 |
+ return map; |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+ /** |
|
33 |
+ * @author 이세현 |
|
22 | 34 |
* @since 2024.03.19 |
23 | 35 |
* |
24 |
- * 사용자 등록 |
|
36 |
+ * 사용자 삭제 |
|
25 | 37 |
*/ |
26 |
- @PostMapping |
|
27 |
- public CustomeResultMap insertMember(@RequestBody Member member) { |
|
28 |
- CustomeResultMap map = new CustomeResultMap(); |
|
29 |
- try { |
|
30 |
- map = memberService.insertMember(member); |
|
31 |
- } catch(RuntimeException e) { |
|
32 |
- map.getCheckMessage().setError(e.getMessage(),HttpStatus.BAD_REQUEST.value()); |
|
33 |
- } catch(Exception e){ |
|
34 |
- map.getCheckMessage().setError("사용자등록 오류, 관리자에게 문의바랍니다.",HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
35 |
- } |
|
38 |
+ @DeleteMapping |
|
39 |
+ public CustomeResultMap deleteMember(@RequestBody List<Member> deleteList) throws Exception { |
|
40 |
+ CustomeResultMap map = memberService.deleteMember(deleteList); |
|
36 | 41 |
return map; |
37 | 42 |
} |
38 | 43 |
|
... | ... | @@ -63,16 +68,23 @@ |
63 | 68 |
|
64 | 69 |
/** |
65 | 70 |
* @author 이세현 |
66 |
- * @since 2024.03.21 |
|
71 |
+ * @since 2024.03.19 |
|
67 | 72 |
* |
68 |
- * 사용자 목록 조회 |
|
69 |
- * 특정 타입이 있다면 타입에 해당하는 목록 조회 |
|
73 |
+ * 사용자 등록 |
|
70 | 74 |
*/ |
71 |
- @PostMapping(value = {"/list/{type}", "/list"}) |
|
72 |
- public CustomeResultMap selectMemberList(@RequestBody SearchVO searchVO, @PathVariable(required = false) String type) throws Exception { |
|
73 |
- CustomeResultMap map = memberService.getMemberList(searchVO,type); |
|
75 |
+ @PostMapping |
|
76 |
+ public CustomeResultMap insertMember(@RequestBody Member member) { |
|
77 |
+ CustomeResultMap map = new CustomeResultMap(); |
|
78 |
+ try { |
|
79 |
+ map = memberService.insertMember(member); |
|
80 |
+ } catch(RuntimeException e) { |
|
81 |
+ map.getCheckMessage().setError(e.getMessage(),HttpStatus.BAD_REQUEST.value()); |
|
82 |
+ } catch(Exception e){ |
|
83 |
+ map.getCheckMessage().setError("사용자등록 오류, 관리자에게 문의바랍니다.",HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
84 |
+ } |
|
74 | 85 |
return map; |
75 | 86 |
} |
87 |
+ |
|
76 | 88 |
/** |
77 | 89 |
* @author 하관우 |
78 | 90 |
* @since 2024.08.09 |
... | ... | @@ -155,24 +167,6 @@ |
155 | 167 |
} |
156 | 168 |
|
157 | 169 |
|
158 |
- /** |
|
159 |
- * @author 이세현 |
|
160 |
- * @since 2024.03.19 |
|
161 |
- * |
|
162 |
- * 사용자 삭제 |
|
163 |
- */ |
|
164 |
- @DeleteMapping |
|
165 |
- public CustomeResultMap deleteMember(@RequestBody List<String> deleteList) { |
|
166 |
- CustomeResultMap map = new CustomeResultMap(); |
|
167 |
- try { |
|
168 |
- map = memberService.deleteMember(deleteList); |
|
169 |
- } catch(RuntimeException e) { |
|
170 |
- map.getCheckMessage().setError("선택한 사용자 삭제에 실패하였습니다. 다시 시도해주세요.",HttpStatus.BAD_REQUEST.value()); |
|
171 |
- } catch(Exception e) { |
|
172 |
- map.getCheckMessage().setError("삭제오류, 관리자에게 문의바랍니다." ,HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
173 |
- } |
|
174 |
- return map; |
|
175 |
- } |
|
176 | 170 |
|
177 | 171 |
/** |
178 | 172 |
* @author 이세현 |
... | ... | @@ -221,4 +215,28 @@ |
221 | 215 |
Member findUser = memberService.findUserPwd(member); |
222 | 216 |
return findUser.getUserPassword(); |
223 | 217 |
} |
218 |
+ |
|
219 |
+ |
|
220 |
+ /** |
|
221 |
+ * @author 박정하 |
|
222 |
+ * @since 2025.01.03 |
|
223 |
+ * |
|
224 |
+ * 사용자 개별 조회 |
|
225 |
+ * 특정 타입이 있다면 타입에 해당하는 목록 조회 |
|
226 |
+ */ |
|
227 |
+ @PostMapping(value = {"/selectUser", "/selectUser/{userId}"}) |
|
228 |
+ public Member selectUser(@PathVariable(required = false) String userId) throws Exception { |
|
229 |
+ return memberService.getMemnberById(userId); |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ /** |
|
233 |
+ * @author 박정하 |
|
234 |
+ * @since 2025.01.07 |
|
235 |
+ * |
|
236 |
+ * 사용자 잠금 해제 |
|
237 |
+ */ |
|
238 |
+ @PostMapping(value = {"/updateUser/LockAt/{userId}"}) |
|
239 |
+ public CustomeResultMap updateUserLockAt(@PathVariable(required = false) String userId) { |
|
240 |
+ return memberService.updateUserLockAt(userId); |
|
241 |
+ } |
|
224 | 242 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/application.properties
+++ src/main/resources/application.properties
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 |
spring.sql.init.platform=postgres |
8 | 8 |
|
9 | 9 |
# takensoft |
10 |
-spring.datasource.url=jdbc:log4jdbc:postgresql://210.180.118.83:5432/bi_manager?currentSchema=bi_manager |
|
10 |
+spring.datasource.url=jdbc:log4jdbc:postgresql://210.180.118.83:5432/bi_maneger_renewal?currentSchema=bi_manager |
|
11 | 11 |
spring.datasource.username=takensoft |
12 | 12 |
spring.datasource.password=tts96314728!@ |
13 | 13 |
|
--- src/main/resources/spring/mapper/department/department-SQL.xml
+++ src/main/resources/spring/mapper/department/department-SQL.xml
... | ... | @@ -130,7 +130,18 @@ |
130 | 130 |
<!-- 부서 목록 조회 --> |
131 | 131 |
<select id="selectDeptList" parameterType="SearchVO" resultType="DepartmentVO"> |
132 | 132 |
SELECT dept_code |
133 |
+ , upper_dept |
|
134 |
+ , org_code |
|
133 | 135 |
, dept_nm |
136 |
+ , dept_dp |
|
137 |
+ , dept_ordr |
|
138 |
+ , use_at |
|
139 |
+ , creat_dt |
|
140 |
+ , updt_id |
|
141 |
+ , creat_id |
|
142 |
+ , updt_id |
|
143 |
+ , dept_dc |
|
144 |
+ , dept_addr |
|
134 | 145 |
FROM orgnzt_info |
135 | 146 |
WHERE use_at = true |
136 | 147 |
<foreach item="item" index="index" collection="searchObjectList"> |
... | ... | @@ -157,7 +168,10 @@ |
157 | 168 |
</when> |
158 | 169 |
</choose> |
159 | 170 |
</foreach> |
160 |
- ORDER BY dept_code ,dept_ordr, dept_dp ASC |
|
171 |
+ ORDER BY dept_ordr, dept_dp, dept_nm ASC |
|
172 |
+ <if test="perPage != 0 and currentPage != 0"> |
|
173 |
+ LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage}) |
|
174 |
+ </if> |
|
161 | 175 |
</select> |
162 | 176 |
|
163 | 177 |
<!-- orgnzt_author에 데이터 삽입 --> |
... | ... | @@ -278,7 +292,22 @@ |
278 | 292 |
WHERE dept_code = #{dept_code} |
279 | 293 |
</delete> |
280 | 294 |
|
281 |
- |
|
282 |
- |
|
283 |
- |
|
295 |
+ <!-- 부서 상세 조회 --> |
|
296 |
+ <select id="selectDept" parameterType="String" resultType="DepartmentVO"> |
|
297 |
+ SELECT dept_code |
|
298 |
+ , upper_dept |
|
299 |
+ , org_code |
|
300 |
+ , dept_nm |
|
301 |
+ , dept_dp |
|
302 |
+ , dept_ordr |
|
303 |
+ , use_at |
|
304 |
+ , creat_dt |
|
305 |
+ , updt_dt |
|
306 |
+ , creat_id |
|
307 |
+ , updt_id |
|
308 |
+ , dept_dc |
|
309 |
+ , dept_addr |
|
310 |
+ FROM orgnzt_info |
|
311 |
+ WHERE dept_code = {deptCode} |
|
312 |
+ </select> |
|
284 | 313 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/spring/mapper/user/member-SQL.xml
+++ src/main/resources/spring/mapper/user/member-SQL.xml
... | ... | @@ -123,8 +123,8 @@ |
123 | 123 |
WHERE user_email = #{userEmail} |
124 | 124 |
</select> |
125 | 125 |
|
126 |
- <!-- 사용자 목록 조회 --> |
|
127 |
- <select id="selectMembers" parameterType="SearchVO" resultMap="memberResult"> |
|
126 |
+ <!-- SELECT SQL --> |
|
127 |
+ <sql id="selectMember"> |
|
128 | 128 |
SELECT ui.user_id |
129 | 129 |
, ui.user_password |
130 | 130 |
, ui.user_nm |
... | ... | @@ -144,55 +144,99 @@ |
144 | 144 |
, ui.lock_at |
145 | 145 |
, ui.lock_dt |
146 | 146 |
, ui.use_at |
147 |
- , orgnzt_info.dept_nm |
|
148 |
- , orgnzt_info.dept_code |
|
149 |
- , author_info.author |
|
150 |
- FROM user_info AS ui |
|
151 |
- LEFT JOIN orgnzt_member |
|
152 |
- ON ui.user_id = orgnzt_member.user_id |
|
153 |
- LEFT JOIN orgnzt_info |
|
154 |
- ON orgnzt_member.dept_code = orgnzt_info.dept_code |
|
155 |
- LEFT JOIN user_author |
|
156 |
- ON ui.user_id = user_author.user_id |
|
157 |
- LEFT JOIN author_info |
|
158 |
- ON user_author.author = author_info.author |
|
159 |
- WHERE ui.use_at = true |
|
147 |
+ , oi.dept_nm |
|
148 |
+ , oi.dept_code |
|
149 |
+ </sql> |
|
150 |
+ |
|
151 |
+ <!-- 사용자 목록 조회 --> |
|
152 |
+ <select id="selectMemberListByAdmin" parameterType="SearchVO" resultMap="memberResult"> |
|
153 |
+ <include refid="selectMember" /> |
|
154 |
+ FROM ( |
|
155 |
+ SELECT user_id |
|
156 |
+ FROM user_author |
|
157 |
+ WHERE author = 'ROLE_ADMIN' |
|
158 |
+ ) AS list |
|
159 |
+ LEFT JOIN user_info AS ui |
|
160 |
+ ON list.user_id = ui.user_id |
|
161 |
+ LEFT JOIN orgnzt_member AS om |
|
162 |
+ ON list.user_id = om.user_id |
|
163 |
+ LEFT JOIN orgnzt_info AS oi |
|
164 |
+ ON om.dept_code = oi.dept_code |
|
165 |
+ WHERE ui.use_at = true |
|
160 | 166 |
<foreach item="item" index="index" collection="searchObjectList"> |
161 |
- <choose> |
|
162 |
- <when test="item.type != null and item.type !='' and item.value != null and item.value !='' and item.type == ''"> |
|
163 |
- AND ${item.key} = #{item.value} |
|
164 |
- </when> |
|
165 |
- <when test="item.type != null and item.type !='' and item.value != null and item.value !=''"> |
|
166 |
- AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
167 |
- </when> |
|
168 |
- </choose> |
|
167 |
+ <if test="item.type != null and item.type !='' and item.key != null and item.key != '' and item.value != null and item.value != ''"> |
|
168 |
+ AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
169 |
+ </if> |
|
169 | 170 |
</foreach> |
170 |
- ORDER BY ui.creat_dt DESC |
|
171 |
- <!-- 검색영역 끝 --> |
|
171 |
+ ORDER BY ui.creat_dt DESC |
|
172 | 172 |
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage}) |
173 | 173 |
</select> |
174 | 174 |
|
175 | 175 |
<!-- 사용자 목록 COUNT 조회 --> |
176 |
- <select id="selectMembersCount" parameterType="SearchVO" resultType="int"> |
|
176 |
+ <select id="selectMemberListByAdminCount" parameterType="SearchVO" resultType="int"> |
|
177 | 177 |
SELECT COUNT(*) |
178 |
- FROM user_info ui |
|
179 |
- LEFT JOIN orgnzt_member ON ui.user_id = orgnzt_member.user_id |
|
180 |
- LEFT JOIN orgnzt_info ON orgnzt_member.dept_code = orgnzt_info.dept_code |
|
181 |
- LEFT JOIN user_author ON ui.user_id = user_author.user_id |
|
182 |
- LEFT JOIN author_info ON user_author.author = author_info.author |
|
183 |
- WHERE ui.use_at = true |
|
178 |
+ FROM ( |
|
179 |
+ SELECT user_id |
|
180 |
+ FROM user_author |
|
181 |
+ WHERE author = 'ROLE_ADMIN' |
|
182 |
+ ) AS list |
|
183 |
+ LEFT JOIN user_info AS ui |
|
184 |
+ ON list.user_id = ui.user_id |
|
185 |
+ LEFT JOIN orgnzt_member AS om |
|
186 |
+ ON list.user_id = om.user_id |
|
187 |
+ LEFT JOIN orgnzt_info AS oi |
|
188 |
+ ON om.dept_code = oi.dept_code |
|
189 |
+ WHERE ui.use_at = true |
|
184 | 190 |
<foreach item="item" index="index" collection="searchObjectList"> |
185 |
- <choose> |
|
186 |
- <when test="item.type != null and item.type !='' and item.value != null and item.value !='' and item.type == ''"> |
|
187 |
- AND ${item.key} = #{item.value} |
|
188 |
- </when> |
|
189 |
- |
|
190 |
- <when test="item.type != null and item.type !='' and item.value != null and item.value !=''"> |
|
191 |
- AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
192 |
- </when> |
|
193 |
- </choose> |
|
191 |
+ <if test="item.type != null and item.type !='' and item.key != null and item.key != '' and item.value != null and item.value != ''"> |
|
192 |
+ AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
193 |
+ </if> |
|
194 | 194 |
</foreach> |
195 |
- <!-- 검색영역 끝 --> |
|
195 |
+ </select> |
|
196 |
+ |
|
197 |
+ <select id="selectMemberListByUser" parameterType="SearchVO" resultMap="memberResult"> |
|
198 |
+ <include refid="selectMember" /> |
|
199 |
+ FROM ( |
|
200 |
+ SELECT user_id |
|
201 |
+ FROM user_author |
|
202 |
+ WHERE author != 'ROLE_ADMIN' |
|
203 |
+ ) AS list |
|
204 |
+ LEFT JOIN user_info AS ui |
|
205 |
+ ON list.user_id = ui.user_id |
|
206 |
+ LEFT JOIN orgnzt_member AS om |
|
207 |
+ ON list.user_id = om.user_id |
|
208 |
+ LEFT JOIN orgnzt_info AS oi |
|
209 |
+ ON om.dept_code = oi.dept_code |
|
210 |
+ WHERE ui.use_at = true |
|
211 |
+ <foreach item="item" index="index" collection="searchObjectList"> |
|
212 |
+ <if test="item.type != null and item.type !='' and item.key != null and item.key != '' and item.value != null and item.value != ''"> |
|
213 |
+ AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
214 |
+ </if> |
|
215 |
+ </foreach> |
|
216 |
+ ORDER BY ui.creat_dt DESC |
|
217 |
+ LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage}) |
|
218 |
+ </select> |
|
219 |
+ |
|
220 |
+ <!-- 사용자 목록 COUNT 조회 --> |
|
221 |
+ <select id="selectMemberListByUserCount" parameterType="SearchVO" resultType="int"> |
|
222 |
+ SELECT COUNT(*) |
|
223 |
+ FROM ( |
|
224 |
+ SELECT user_id |
|
225 |
+ FROM user_author |
|
226 |
+ WHERE author != 'ROLE_ADMIN' |
|
227 |
+ ) AS list |
|
228 |
+ LEFT JOIN user_info AS ui |
|
229 |
+ ON list.user_id = ui.user_id |
|
230 |
+ LEFT JOIN orgnzt_member AS om |
|
231 |
+ ON list.user_id = om.user_id |
|
232 |
+ LEFT JOIN orgnzt_info AS oi |
|
233 |
+ ON om.dept_code = oi.dept_code |
|
234 |
+ WHERE ui.use_at = true |
|
235 |
+ <foreach item="item" index="index" collection="searchObjectList"> |
|
236 |
+ <if test="item.type != null and item.type !='' and item.key != null and item.key != '' and item.value != null and item.value != ''"> |
|
237 |
+ AND ${item.key} LIKE CONCAT('%', #{item.value}, '%') |
|
238 |
+ </if> |
|
239 |
+ </foreach> |
|
196 | 240 |
</select> |
197 | 241 |
|
198 | 242 |
<!-- 멤버 추가 클릭 시 사용자 조회 --> |
... | ... | @@ -286,21 +330,17 @@ |
286 | 330 |
<!-- 사용자 수정 --> |
287 | 331 |
<update id="updateMember" parameterType="Member"> |
288 | 332 |
UPDATE user_info |
289 |
- SET |
|
290 |
- user_password = #{userPassword} |
|
291 |
- , user_nm = #{userNm} |
|
333 |
+ SET user_nm = #{userNm} |
|
292 | 334 |
, user_email = #{userEmail} |
293 | 335 |
, updt_dt = CURRENT_TIMESTAMP |
294 | 336 |
, updt_id = #{updtId} |
295 |
- , lock_at = #{lockAt} |
|
296 | 337 |
WHERE user_id = #{userId} |
297 | 338 |
</update> |
298 | 339 |
|
299 | 340 |
<!-- 사용자 비밀번호 변경 --> |
300 | 341 |
<update id="updateMemberPw" parameterType="Member"> |
301 | 342 |
UPDATE user_info |
302 |
- SET |
|
303 |
- user_password = #{userPassword} |
|
343 |
+ SET user_password = #{userPassword} |
|
304 | 344 |
, updt_dt = CURRENT_TIMESTAMP |
305 | 345 |
, updt_id = #{updtId} |
306 | 346 |
WHERE user_id = #{userId} |
... | ... | @@ -428,36 +468,10 @@ |
428 | 468 |
</foreach> |
429 | 469 |
</select> |
430 | 470 |
|
431 |
- <!-- 회원정보 --> |
|
432 |
- <sql id="selectMember"> |
|
433 |
- SELECT ui.user_id |
|
434 |
- , user_password |
|
435 |
- , user_nm |
|
436 |
- , user_email |
|
437 |
- , user_tel |
|
438 |
- , user_phone |
|
439 |
- , zip_code |
|
440 |
- , adres |
|
441 |
- , adres_dtail |
|
442 |
- , oi.dept_nm |
|
443 |
- , oi.dept_code |
|
444 |
- , ui.creat_dt |
|
445 |
- , ui.updt_dt |
|
446 |
- , ui.creat_id |
|
447 |
- , ui.updt_id |
|
448 |
- , ui.use_at |
|
449 |
- , gender |
|
450 |
- , birth_dt |
|
451 |
- , login_failr_cnt |
|
452 |
- , lock_at |
|
453 |
- , lock_dt |
|
454 |
- , ua.author |
|
455 |
- FROM user_info AS ui |
|
456 |
- </sql> |
|
457 |
- |
|
458 | 471 |
<!-- 아이디 찾기 --> |
459 | 472 |
<select id="findUserId" parameterType="Member" resultMap="memberResult"> |
460 | 473 |
<include refid="selectMember" /> |
474 |
+ FROM user_info AS ui |
|
461 | 475 |
LEFT JOIN orgnzt_member AS om |
462 | 476 |
ON ui.user_id = om.user_id |
463 | 477 |
LEFT JOIN orgnzt_info AS oi |
... | ... | @@ -471,6 +485,7 @@ |
471 | 485 |
<!-- 비밀번호 찾기 --> |
472 | 486 |
<select id="findUserPwd" parameterType="Member" resultMap="memberResult"> |
473 | 487 |
<include refid="selectMember" /> |
488 |
+ FROM user_info AS ui |
|
474 | 489 |
LEFT JOIN orgnzt_member AS om |
475 | 490 |
ON ui.user_id = om.user_id |
476 | 491 |
LEFT JOIN orgnzt_info AS oi |
... | ... | @@ -481,4 +496,11 @@ |
481 | 496 |
AND ui.user_nm = #{userNm} |
482 | 497 |
AND ui.user_email = #{userEmail} |
483 | 498 |
</select> |
499 |
+ |
|
500 |
+ <!-- 사용자 잠김여부 변경 --> |
|
501 |
+ <update id="updateUserLockAt" parameterType="String"> |
|
502 |
+ UPDATE user_info |
|
503 |
+ SET lock_at = false |
|
504 |
+ WHERE user_id = #{userId} |
|
505 |
+ </update> |
|
484 | 506 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?