From 5006ba6ad931372861968f577c397e31c95f259b Mon Sep 17 00:00:00 2001 From: itms-merge-dev Date: Fri, 17 Jul 2026 17:42:45 +0900 Subject: [PATCH] =?UTF-8?q?refactor(itms):=20common=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EC=B6=94=EC=B6=9C=20=E2=80=94=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=20=EB=8B=A8=EC=9D=BC=ED=99=94=20(IN?= =?UTF-8?q?TEGRATION=5FDESIGN=20=C2=A73-2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit behavior-identical 확인된 4개 플레인 클래스를 com.urpsys.common 으로 단일화하고 5개 모듈이 implementation project(':common') 으로 참조하도록 전환. 추출(사본 대조 후 동작 등가 확정): - crypto/Aes256Cipher (5벌→1): 암호로직 전 사본 동일. front 키스토어 상이(UrpSysKeyMng) → 생성자 파라미터화(무인자=UrpSystem 기본, front EncryptConfig 만 명시). 미사용 dead 변수(activeProfile) 제거로 CommonUtil 의존 인라인. - exception/CustomException (5벌→1): 전 사본 로직 동일(주석·brace 스타일 차이만). - util/ConvertUtils (api·front→1): 동일. batch 는 LinkedHashMap 분기(기능 상이) → batch 로컬 유지. - util/DataSourceUtil (api·auth·batch·datatrans→1): 로직 동일(미사용 import 차이만). 모듈 잔류(특화·안전상 미추출, 사유 기록): - config/EncryptConfig·PasswordEncoderConfig(@Configuration): 모듈별 @ComponentScan 이 자기 패키지 한정(api·auth·datatrans·front) → common 이관 시 빈 미등록. EncryptConfig 는 front 키스토어 특화도 겸함. 각 모듈 로컬 유지하되 common Aes256Cipher 참조로 전환. - CommonUtil·RestApiCallUtil·HtmlEmailUtil: 사본 간 실기능 분기 大(73~293라인) → 강제 초집합 시 동작 변경 위험 → 모듈 로컬 유지. 빌드: common·auth·api·batch·datatrans·front compileJava 전부 SUCCESS(--rerun-tasks). 인코딩: 소스 UTF-8, 루트 subprojects JavaCompile encoding=UTF-8 명시(플랫폼 CP949 회귀 방지). Bean 이름(aes256Cipher)·프로파일·포트 불변. 시크릿 미기재. Co-Authored-By: Claude Fable 5 --- api/build.gradle | 4 +- .../common/exception/CustomException.java | 114 - .../baseapi/common/util/CommonUtil.java | 1202 ++++---- .../baseapi/common/util/DataSourceUtil.java | 113 - .../baseapi/common/util/HtmlEmailUtil.java | 426 +-- .../baseapi/common/util/RestApiCallUtil.java | 774 +++--- .../urpsys/baseapi/config/EncryptConfig.java | 76 +- .../com/urpsys/baseapi/config/MailConfig.java | 174 +- .../baseapi/config/Oauth2ResourceConfig.java | 330 +-- .../baseapi/config/PasswordEncoderConfig.java | 152 +- .../baseapi/config/PrimaryDbConfig.java | 224 +- .../cmm/service/FileManageService.java | 248 +- auth/build.gradle | 4 +- .../urpsys/baseauth/common/CommonUtil.java | 912 +++--- .../baseauth/common/DataSourceUtil.java | 111 - .../baseauth/common/crypto/Aes256Cipher.java | 142 - .../common/exception/CustomException.java | 114 - .../urpsys/baseauth/config/EncryptConfig.java | 76 +- .../config/Oauth2AuthorizationConfig.java | 412 +-- .../baseauth/config/PrimaryDbConfig.java | 226 +- batch/build.gradle | 4 +- .../basebatch/common/crypto/Aes256Cipher.java | 152 - .../common/exception/CustomException.java | 124 - .../basebatch/common/util/CommonUtil.java | 1048 +++---- .../basebatch/common/util/DataSourceUtil.java | 113 - .../common/util/RestApiCallUtil.java | 750 ++--- .../basebatch/config/EncryptConfig.java | 78 +- .../basebatch/config/KicInsaDbConfig.java | 252 +- .../urpsys/basebatch/config/MailConfig.java | 170 +- .../basebatch/config/PrimaryDbConfig.java | 226 +- .../basebatch/config/quartz/QuartzConfig.java | 256 +- build.gradle | 4 + common/build.gradle | 37 + .../urpsys}/common/crypto/Aes256Cipher.java | 302 +- .../common/exception/CustomException.java | 2 +- .../com/urpsys}/common/util/ConvertUtils.java | 850 +++--- .../urpsys}/common/util/DataSourceUtil.java | 6 +- datatrans/build.gradle | 2 + .../kccfbat/common/crypto/Aes256Cipher.java | 145 - .../kccfbat/common/util/CommonUtil.java | 2 +- .../urpsys/kccfbat/config/EncryptConfig.java | 2 +- .../kccfbat/config/Oauth2ResourceConfig.java | 2 +- .../urpsys/kccfbat/config/iamsDbConfig.java | 6 +- .../urpsys/kccfbat/config/ncmsDbConfig.java | 6 +- front/build.gradle | 4 +- .../basefront/common/crypto/Aes256Cipher.java | 142 - .../common/exception/CustomException.java | 115 - .../common/service/CommonService.java | 506 ++-- .../basefront/common/util/CommonUtil.java | 1376 +++++----- .../basefront/common/util/ConvertUtils.java | 425 --- .../basefront/common/util/HtmlEmailUtil.java | 308 +-- .../common/util/MultiPartEmailUtil.java | 282 +- .../common/util/RestApiCallUtil.java | 840 +++--- .../basefront/config/EncryptConfig.java | 76 +- .../urpsys/basefront/config/MailConfig.java | 174 +- .../config/handler/CustomSuccessHandler.java | 210 +- .../controller/GoogleOtpController.java | 2 +- .../basefront/controller/MainController.java | 1422 +++++----- .../basefront/controller/SsoController.java | 2 +- .../controller/ArticleCommentController.java | 302 +- .../controller/BBSAdminManageController.java | 1962 ++++++------- .../BBSAttributeManageController.java | 966 +++---- .../BBSUseInfoManageController.java | 526 ++-- .../controller/FileDownloadController.java | 304 +- .../cmm/controller/FileMngController.java | 316 +-- .../cmm/controller/UserSearchController.java | 252 +- .../urpsys/itmsfront/comm/SendMailUtil.java | 110 +- .../controller/PortletManageController.java | 2240 +++++++-------- .../controller/AdminCategoryController.java | 544 ++-- .../controller/AdminServiceController.java | 778 +++--- .../rem/controller/ReportController.java | 686 ++--- .../controller/ResourceManagerController.java | 2334 ++++++++-------- .../ResourceMutilManagerController.java | 640 ++--- .../srm/controller/ReportCheckController.java | 2418 ++++++++-------- .../srm/controller/ReportErrorController.java | 2396 ++++++++-------- .../srm/controller/ReportIssueController.java | 2416 ++++++++-------- .../srm/controller/ReportOtherController.java | 2 +- .../srm/controller/SvcDeskController.java | 2440 ++++++++--------- .../srm/controller/SvcDeskReqController.java | 2 +- .../sys/controller/AuthorGroupController.java | 436 +-- .../controller/AuthorManageController.java | 678 ++--- .../sys/controller/AuthorRoleController.java | 334 +-- .../CcmCmmnClCodeManageController.java | 762 ++--- .../CcmCmmnCodeManageController.java | 834 +++--- .../CcmCmmnDetailCodeManageController.java | 800 +++--- .../sys/controller/DeptAuthorController.java | 496 ++-- .../sys/controller/DeptManageController.java | 718 ++--- .../sys/controller/GroupManageController.java | 816 +++--- .../MenuCreateManageController.java | 522 ++-- .../sys/controller/MenuManageController.java | 934 +++---- .../controller/ProgrmManageController.java | 874 +++--- .../PrsnlPortletCreateManageController.java | 894 +++--- .../PrsnlPortletManageController.java | 984 +++---- .../sys/controller/RoleManageController.java | 816 +++--- .../sys/controller/UserManageController.java | 1612 +++++------ settings.gradle | 3 +- 96 files changed, 24330 insertions(+), 26074 deletions(-) delete mode 100644 api/src/main/java/com/urpsys/baseapi/common/exception/CustomException.java delete mode 100644 api/src/main/java/com/urpsys/baseapi/common/util/DataSourceUtil.java delete mode 100644 auth/src/main/java/com/urpsys/baseauth/common/DataSourceUtil.java delete mode 100644 auth/src/main/java/com/urpsys/baseauth/common/crypto/Aes256Cipher.java delete mode 100644 auth/src/main/java/com/urpsys/baseauth/common/exception/CustomException.java delete mode 100644 batch/src/main/java/com/urpsys/basebatch/common/crypto/Aes256Cipher.java delete mode 100644 batch/src/main/java/com/urpsys/basebatch/common/exception/CustomException.java delete mode 100644 batch/src/main/java/com/urpsys/basebatch/common/util/DataSourceUtil.java create mode 100644 common/build.gradle rename {api/src/main/java/com/urpsys/baseapi => common/src/main/java/com/urpsys}/common/crypto/Aes256Cipher.java (73%) rename {datatrans/src/main/java/com/urpsys/kccfbat => common/src/main/java/com/urpsys}/common/exception/CustomException.java (98%) rename {api/src/main/java/com/urpsys/baseapi => common/src/main/java/com/urpsys}/common/util/ConvertUtils.java (95%) rename {datatrans/src/main/java/com/urpsys/kccfbat => common/src/main/java/com/urpsys}/common/util/DataSourceUtil.java (95%) delete mode 100644 datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java delete mode 100644 front/src/main/java/com/urpsys/basefront/common/crypto/Aes256Cipher.java delete mode 100644 front/src/main/java/com/urpsys/basefront/common/exception/CustomException.java delete mode 100644 front/src/main/java/com/urpsys/basefront/common/util/ConvertUtils.java diff --git a/api/build.gradle b/api/build.gradle index 6c982d53..e3d8f4fb 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -32,7 +32,9 @@ ext } dependencies -{ +{ + implementation project(':common') + implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-cache' diff --git a/api/src/main/java/com/urpsys/baseapi/common/exception/CustomException.java b/api/src/main/java/com/urpsys/baseapi/common/exception/CustomException.java deleted file mode 100644 index 4ee4e6ef..00000000 --- a/api/src/main/java/com/urpsys/baseapi/common/exception/CustomException.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.urpsys.baseapi.common.exception; - -import java.sql.SQLSyntaxErrorException; - -import lombok.Getter; - -/** - * Custom exception 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28    나혁제         최초작성
- *
- * 
- */ - -public class CustomException extends Exception -{ - private static final long serialVersionUID = 3559302713942492181L; - - @Getter - private String errorCode; - - @Getter - private String errorMsg; - - /** - * 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스) - * 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로 - * 변경 가능성 있음 - * @param throwable - */ - public CustomException(Throwable throwable) { - Throwable rootThrowable = getRootCause(throwable); - - // TODO 에러 코드는 상세 정의해서 define 해야 함 - if(rootThrowable instanceof SQLSyntaxErrorException) { - this.errorCode = "100"; - this.errorMsg = "SQL 오류"; - } else if(rootThrowable instanceof ArithmeticException) { - this.errorCode = "200"; - this.errorMsg = "연산 오류"; - } else { - this.errorCode = "900"; - this.errorMsg = "Unknown Error"; - } - } - - /** - * 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅) - * @param errorMsg - */ - public CustomException(String errorMsg) { - super(errorMsg); - this.errorCode = "0"; - this.errorMsg = errorMsg; - } - - /** - * 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해 - * 에러코드를 int 값으로 받으면 string으로 변환하여 저장) - * @param errorCode - * @param errorMsg - */ - public CustomException(int errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = String.valueOf(errorCode); - this.errorMsg = errorMsg; - } - - /** - * 생성자(에러코드, 에러메시지를 받아 세팅) - * @param errorCode - * @param errorMsg - */ - public CustomException(String errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - /** - * stack에서 에러코드 중 root cause를 찾아내는 메소드 - * @param throwable - * @return - */ - private Throwable getRootCause(Throwable throwable) { - Throwable cause = throwable.getCause(); - - if (cause == null) { - return throwable; - } - - while (true) { - - if(cause.getCause() == null) { - break; - } else { - cause = cause.getCause(); - } - } - - return cause; - } -} diff --git a/api/src/main/java/com/urpsys/baseapi/common/util/CommonUtil.java b/api/src/main/java/com/urpsys/baseapi/common/util/CommonUtil.java index 1f67e0d5..cbf600b3 100644 --- a/api/src/main/java/com/urpsys/baseapi/common/util/CommonUtil.java +++ b/api/src/main/java/com/urpsys/baseapi/common/util/CommonUtil.java @@ -1,601 +1,601 @@ -package com.urpsys.baseapi.common.util; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Base64; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.SimpleTimeZone; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; -import org.springframework.http.HttpHeaders; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.jwt.Jwt; -import org.springframework.security.jwt.JwtHelper; -import org.springframework.security.oauth2.provider.token.RemoteTokenServices; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.urpsys.baseapi.common.exception.CustomException; -import com.urpsys.baseapi.domain.TokenInfo; - - -/** - * 공통 유틸리티를 모아둔 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28    나혁제         최초작성
- *
- *      
- */ - -public class CommonUtil -{ - /** - * nvl 메소드 - * @param inputStr - * @return - */ - public static String nvl(String inputStr) { - return (inputStr != null) ? inputStr.trim() : ""; - } - - /** - * nvl 메소드 - * @param inputStr - * @param defaultValue - * @return - */ - public static String nvl(String inputStr, String defaultValue) { - return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); - } - - /** - * nvl 메소드 - * @param inputObj - * @return - */ - public static String nvl(Object inputObj) { - return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; - } - - /** - * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 - * - * @param longTime long type 시간 - * @param dateFormat 변환할 포맷 - * @return 변환된 날짜 String - * @throws SystemException - */ - public static String getTimeString(long longTime, String dateFormat) throws CustomException { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); - - if (longTime < 0) - { - return ""; - } - else { - try { - return sdf.format(new Date(longTime)); - } catch (Exception e) { - throw new CustomException("Date 변환 오류"); - } - } - } - - /** - * 현재(한국기준) 시간정보를 얻는다.
- * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
- * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 - * 0~23시간 타입으로 Return.
- * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
- * @param format 얻고자하는 현재시간의 Type - * @return str 현재 한국 시간. - */ - public static String getKST(String format) - { - //1hour(ms) = 60s * 60m * 1000ms - int millisPerHour = 60 * 60 * 1000; - SimpleDateFormat fmt= new SimpleDateFormat(format); - - SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); - fmt.setTimeZone(timeZone); - - long time=System.currentTimeMillis(); - String str=fmt.format(new java.util.Date(time)); - return str; - } - - /** - * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 - * - * @param date - * string date (19991002) - * @param Day - * 기준이 되는 시간 - * @return String - */ - public static String getDatewithSpan(String date, long Day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month - * = Integer.valueOf(date.substring(4,6)).intValue(); int day = - * Integer.valueOf(date.substring(6,8)).intValue(); - * - * java.util.Calendar aDay = Calendar.getInstance(); - * aDay.set(year+1900,month,day); java.util.Calendar bDay - * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay - * = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); - * - * return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(date, Day, "D", vFORMAT); - - } - - /** - * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
- * - * @param date - * string date (20000315/2000031509/200003150915) - * @param unit - * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 - * @param type - * String type: D:Day H:Hour M:Minute - * @return String 계산된 문자열의 값. - */ - public static String getDatewithSpan(String date, long unit, String type, String strFormatType) - { - /* - * String formatType = strFormatType; int ihour = 0; int itime = 0; - * - * long dhm = 24 * 60 * 60 * 1000; - * - * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else - * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if - * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type - * + "은 부적절한 Type값입니다"; } - * - * switch (date.length()){ case (8): if (type.equals("H") || - * type.equals("M")) { return "HM-ERROR"; } - * - * break; case (10): if (type.equals("M")) { return "M-ERROR"; } - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case - * (12): - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = - * Integer.valueOf(date.substring(10,12)).intValue(); break; default: - * return "date Length Error"; } - * - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int - * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = - * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar - * aDay = Calendar.getInstance(); - * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay - * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date - * cDay = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String formatType = strFormatType; - int ihour = 0; - int itime = 0; - if(!(type.equals("D") || type.equals("H") || type.equals("M"))) - { - return type + "은 부적절한 Type값입니다"; - } - - switch(date.length()) - { - case (8): - if(type.equals("H") || type.equals("M")) - { - return "HM-ERROR"; - } - break; - case (10): - if(type.equals("M")) - { - return "M-ERROR"; - } - ihour = Integer.parseInt(date.substring(8, 10)); - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - break; - case (12): - ihour = Integer.parseInt(date.substring(8, 10)); - itime = Integer.parseInt(date.substring(10, 12)); - - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - // itime = Integer.valueOf(date.substring(10, 12)).intValue(); - break; - default: - return "date Length Error"; - } - int iyear = Integer.parseInt(date.substring(0, 4)); - int imonth = Integer.parseInt(date.substring(4, 6)); - int iday = Integer.parseInt(date.substring(6, 8)); - - /* - int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); - int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); - int iday = Integer.valueOf(date.substring(6, 8)).intValue(); - */ - - int imonth1 = imonth - 1; // 달은 0달부터 시작한다. - java.util.Calendar zDay = Calendar.getInstance(); - zDay.set(iyear, imonth1, iday, ihour, itime); - - if(type.equals("D")) - { - zDay.add(Calendar.DATE, (int) unit); - } - else if(type.equals("H")) - { - zDay.add(Calendar.HOUR_OF_DAY, (int) unit); - } - else if(type.equals("M")) - { - zDay.add(Calendar.MINUTE, (int) unit); - } - else - { - return type + "은 부적절한 Type값입니다"; - } - java.util.Date z1Day = zDay.getTime(); - java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); - return fmt2.format(z1Day); - - } - - /** - * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) - * - * @param day - * 더하려는 날짜 - * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 - */ - public static String getDatewithSpan(long day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 - * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; - * String str=fmt.format(new java.util.Date(time2)); - * - * return str; - */ - String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); - - } - - public static long stol(String str) - { - if(str == null ) return 0; - return (Long.valueOf(str).longValue()); - } - - public static int stoi(String str) - { - if(str == null ) return 0; - return (Integer.valueOf(str).intValue()); - } - - /** - 문자열을 중 특정 문자열을 변환시킨다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param targeter 대상문자열 - @param target_str 변환될 대상문자열 - @param replace_str 변환될 문자열 - @return target_str이 replace_str로 변환된 문자열 - */ - public static String getReplacedString(String targeter, String target_str, String replace_str) - { - if( targeter == null - || target_str == null - || replace_str == null ) - return "debug : parameter value is null"; - - if(target_str.length() == 0) - return targeter; - - StringBuffer str = new StringBuffer(); - int start_ptr = 0; - int current_ptr = 0; - int increment_size = replace_str.length(); - if(increment_size == 0 ) increment_size = 1; - - while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) - { - str.append(targeter.substring(start_ptr, current_ptr)); - str.append(replace_str); - start_ptr = current_ptr + increment_size; - if(start_ptr >= targeter.length()) - break; - }//end while - - if(start_ptr == 0) - return targeter; - - if(start_ptr < targeter.length()) - str.append(targeter.substring(start_ptr)); - - return str.toString(); - }//getReplacedString(String targeter, String target_str, String replace_str) - - /** - 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg 대상문자열 - @param v_s1 변환될 대상문자열 - @param v_s2 변환될 문자열 - @return v_s1이 v_s2 변환된 문자열 - */ - - public static String getReplacedString2(String v_msg, String v_s1, String v_s2) - { - int idx = v_msg.indexOf(v_s1); - - if (idx == -1) return v_msg; - else - { - try - { - return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); - } catch (Exception e) - { - return v_msg.substring(0, idx) + v_s2; - } - } - - } - - public static String getReplacedString3(String sStr, String n1, String n2) - { - int iTmp = 0; - if (sStr == null) return ""; - - String sTmp = sStr; - StringBuffer sbSave = new StringBuffer(); - sbSave.append(""); - while (sTmp.indexOf(n1) > -1) - { - iTmp = sTmp.indexOf(n1); - sbSave.append(sTmp.substring(0,iTmp)); - sbSave.append(n2); - sTmp = sTmp.substring(iTmp + n1.length()); - } - sbSave.append(sTmp); - return sbSave.toString(); - } - - public static Vector arrToDouVector(String strArray, String strDelimt) - { - String[] stArray = strArray.split(strDelimt); - - double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); - Vector vReturn = new Vector(); - - if(dArray==null) return vReturn; - - for(double dTemp: dArray) - { - vReturn.add(dTemp); - } - - return vReturn; - - } - - public static String arrListToString(List list) - { - String strReturn=""; - - if(list == null ) return ""; - - for(int i=0; i"+strTemp); - // double dou = Double.parseDouble(strTemp); - // strReturn = strReturn+","+dou; - strReturn = strReturn+","+strTemp; - } - - strReturn = strReturn.substring(1); - - return strReturn; - - } - - /** - Map 데이터를 JSONObject로 변환. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg Map - @return JSONObject - */ - public static JSONObject getJsonFromMap(Map map) throws JSONException - { - JSONObject jsonData = new JSONObject(); - - for (String key : map.keySet()) - { - Object value = map.get(key); - if (value instanceof Map) - { - value = getJsonFromMap((Map) value); - } - jsonData.put(key, value); - } - return jsonData; - } - - public static TokenInfo getAccessTokenInfo(HttpServletRequest request) - { - TokenInfo tokenInfo = null; - String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); - RemoteTokenServices tokenServices = new RemoteTokenServices(); - - if(StringUtils.startsWithIgnoreCase(authorization, "Bearer")) - { - /* - * FieldNamingPolicy 옵션 - * IDENTITY : 변경 없음 - * LOWER_CASE_WITH_DASHES : '-' 붙이기 - * LOWER_CASE_WITH_DOTS : '.' 붙이기 - * LOWER_CASE_WITH_UNDERSCORES : '_' 붙이기 - * UPPER_CAMEL_CASE : 첫문자 대문자로 - * UPPER_CAMEL_CASE_WITH_SPACES : 첫문자 대문자 + ' ' 공택붙이기 - * - */ - - String strTocken = ""; - strTocken = StringUtils.replace(authorization, "Bearer ",""); - strTocken = StringUtils.replace(authorization, "bearer ",""); - - Jwt jwt = JwtHelper.decode(strTocken); - - // Jwt jwt = JwtHelper.decode(StringUtils.replace(authorization, "Bearer ","")); - // Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); // snakecase to camelcase - Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create(); // snakecase to camelcase - - tokenInfo = gson.fromJson(jwt.getClaims(), TokenInfo.class); - } - - return tokenInfo; - } - - - /** - *
-	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(Object src) - { - if (src == null || src.equals("null") || src.equals("")) - { - return 0; - } - else - { - String str = src+""; - return Integer.parseInt(((String)str).trim()); - } - } - - /** - *
-	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(String src) - { - - if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) - { - return 0; - } - else - { - return Integer.parseInt(src.trim()); - } - } - - /** - 서버(DB)에서 front로 전달시 사용 - @version 1.0 - @author 나혁제 - @since 2025.03.20 - @param txt String - @return String - */ - public static String base64decode(String txt) - { - byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); - - try - { - return new String(bytes, "utf-8"); - } - catch(Exception e) - { - e.printStackTrace(); - return new String(bytes); - } - } - - /** - 랜덤문자열 생성 - @version 1.0 - @author 나혁제 - @since 2025.07.17 - @param txt String - @return String - */ - public static String getRandomChar(int iLimit) - { - int length = iLimit; // 원하는 문자열 길이 - String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; // 사용 가능한 문자 - StringBuilder sb = new StringBuilder(); - Random random = new Random(); - - for (int i = 0; i < length; i++) - { - int index = random.nextInt(characters.length()); // 랜덤 인덱스 선택 - sb.append(characters.charAt(index)); - } - - return sb.toString(); - } - - - - -} +package com.urpsys.baseapi.common.util; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Random; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.jwt.Jwt; +import org.springframework.security.jwt.JwtHelper; +import org.springframework.security.oauth2.provider.token.RemoteTokenServices; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.urpsys.common.exception.CustomException; +import com.urpsys.baseapi.domain.TokenInfo; + + +/** + * 공통 유틸리티를 모아둔 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ *      
+ */ + +public class CommonUtil +{ + /** + * nvl 메소드 + * @param inputStr + * @return + */ + public static String nvl(String inputStr) { + return (inputStr != null) ? inputStr.trim() : ""; + } + + /** + * nvl 메소드 + * @param inputStr + * @param defaultValue + * @return + */ + public static String nvl(String inputStr, String defaultValue) { + return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); + } + + /** + * nvl 메소드 + * @param inputObj + * @return + */ + public static String nvl(Object inputObj) { + return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; + } + + /** + * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 + * + * @param longTime long type 시간 + * @param dateFormat 변환할 포맷 + * @return 변환된 날짜 String + * @throws SystemException + */ + public static String getTimeString(long longTime, String dateFormat) throws CustomException { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); + + if (longTime < 0) + { + return ""; + } + else { + try { + return sdf.format(new Date(longTime)); + } catch (Exception e) { + throw new CustomException("Date 변환 오류"); + } + } + } + + /** + * 현재(한국기준) 시간정보를 얻는다.
+ * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
+ * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 + * 0~23시간 타입으로 Return.
+ * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
+ * @param format 얻고자하는 현재시간의 Type + * @return str 현재 한국 시간. + */ + public static String getKST(String format) + { + //1hour(ms) = 60s * 60m * 1000ms + int millisPerHour = 60 * 60 * 1000; + SimpleDateFormat fmt= new SimpleDateFormat(format); + + SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); + fmt.setTimeZone(timeZone); + + long time=System.currentTimeMillis(); + String str=fmt.format(new java.util.Date(time)); + return str; + } + + /** + * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 + * + * @param date + * string date (19991002) + * @param Day + * 기준이 되는 시간 + * @return String + */ + public static String getDatewithSpan(String date, long Day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month + * = Integer.valueOf(date.substring(4,6)).intValue(); int day = + * Integer.valueOf(date.substring(6,8)).intValue(); + * + * java.util.Calendar aDay = Calendar.getInstance(); + * aDay.set(year+1900,month,day); java.util.Calendar bDay + * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay + * = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); + * + * return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(date, Day, "D", vFORMAT); + + } + + /** + * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
+ * + * @param date + * string date (20000315/2000031509/200003150915) + * @param unit + * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 + * @param type + * String type: D:Day H:Hour M:Minute + * @return String 계산된 문자열의 값. + */ + public static String getDatewithSpan(String date, long unit, String type, String strFormatType) + { + /* + * String formatType = strFormatType; int ihour = 0; int itime = 0; + * + * long dhm = 24 * 60 * 60 * 1000; + * + * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else + * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if + * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type + * + "은 부적절한 Type값입니다"; } + * + * switch (date.length()){ case (8): if (type.equals("H") || + * type.equals("M")) { return "HM-ERROR"; } + * + * break; case (10): if (type.equals("M")) { return "M-ERROR"; } + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case + * (12): + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = + * Integer.valueOf(date.substring(10,12)).intValue(); break; default: + * return "date Length Error"; } + * + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int + * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = + * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar + * aDay = Calendar.getInstance(); + * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay + * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date + * cDay = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String formatType = strFormatType; + int ihour = 0; + int itime = 0; + if(!(type.equals("D") || type.equals("H") || type.equals("M"))) + { + return type + "은 부적절한 Type값입니다"; + } + + switch(date.length()) + { + case (8): + if(type.equals("H") || type.equals("M")) + { + return "HM-ERROR"; + } + break; + case (10): + if(type.equals("M")) + { + return "M-ERROR"; + } + ihour = Integer.parseInt(date.substring(8, 10)); + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + break; + case (12): + ihour = Integer.parseInt(date.substring(8, 10)); + itime = Integer.parseInt(date.substring(10, 12)); + + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + // itime = Integer.valueOf(date.substring(10, 12)).intValue(); + break; + default: + return "date Length Error"; + } + int iyear = Integer.parseInt(date.substring(0, 4)); + int imonth = Integer.parseInt(date.substring(4, 6)); + int iday = Integer.parseInt(date.substring(6, 8)); + + /* + int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); + int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); + int iday = Integer.valueOf(date.substring(6, 8)).intValue(); + */ + + int imonth1 = imonth - 1; // 달은 0달부터 시작한다. + java.util.Calendar zDay = Calendar.getInstance(); + zDay.set(iyear, imonth1, iday, ihour, itime); + + if(type.equals("D")) + { + zDay.add(Calendar.DATE, (int) unit); + } + else if(type.equals("H")) + { + zDay.add(Calendar.HOUR_OF_DAY, (int) unit); + } + else if(type.equals("M")) + { + zDay.add(Calendar.MINUTE, (int) unit); + } + else + { + return type + "은 부적절한 Type값입니다"; + } + java.util.Date z1Day = zDay.getTime(); + java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); + return fmt2.format(z1Day); + + } + + /** + * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) + * + * @param day + * 더하려는 날짜 + * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 + */ + public static String getDatewithSpan(long day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 + * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; + * String str=fmt.format(new java.util.Date(time2)); + * + * return str; + */ + String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); + + } + + public static long stol(String str) + { + if(str == null ) return 0; + return (Long.valueOf(str).longValue()); + } + + public static int stoi(String str) + { + if(str == null ) return 0; + return (Integer.valueOf(str).intValue()); + } + + /** + 문자열을 중 특정 문자열을 변환시킨다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param targeter 대상문자열 + @param target_str 변환될 대상문자열 + @param replace_str 변환될 문자열 + @return target_str이 replace_str로 변환된 문자열 + */ + public static String getReplacedString(String targeter, String target_str, String replace_str) + { + if( targeter == null + || target_str == null + || replace_str == null ) + return "debug : parameter value is null"; + + if(target_str.length() == 0) + return targeter; + + StringBuffer str = new StringBuffer(); + int start_ptr = 0; + int current_ptr = 0; + int increment_size = replace_str.length(); + if(increment_size == 0 ) increment_size = 1; + + while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) + { + str.append(targeter.substring(start_ptr, current_ptr)); + str.append(replace_str); + start_ptr = current_ptr + increment_size; + if(start_ptr >= targeter.length()) + break; + }//end while + + if(start_ptr == 0) + return targeter; + + if(start_ptr < targeter.length()) + str.append(targeter.substring(start_ptr)); + + return str.toString(); + }//getReplacedString(String targeter, String target_str, String replace_str) + + /** + 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg 대상문자열 + @param v_s1 변환될 대상문자열 + @param v_s2 변환될 문자열 + @return v_s1이 v_s2 변환된 문자열 + */ + + public static String getReplacedString2(String v_msg, String v_s1, String v_s2) + { + int idx = v_msg.indexOf(v_s1); + + if (idx == -1) return v_msg; + else + { + try + { + return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); + } catch (Exception e) + { + return v_msg.substring(0, idx) + v_s2; + } + } + + } + + public static String getReplacedString3(String sStr, String n1, String n2) + { + int iTmp = 0; + if (sStr == null) return ""; + + String sTmp = sStr; + StringBuffer sbSave = new StringBuffer(); + sbSave.append(""); + while (sTmp.indexOf(n1) > -1) + { + iTmp = sTmp.indexOf(n1); + sbSave.append(sTmp.substring(0,iTmp)); + sbSave.append(n2); + sTmp = sTmp.substring(iTmp + n1.length()); + } + sbSave.append(sTmp); + return sbSave.toString(); + } + + public static Vector arrToDouVector(String strArray, String strDelimt) + { + String[] stArray = strArray.split(strDelimt); + + double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); + Vector vReturn = new Vector(); + + if(dArray==null) return vReturn; + + for(double dTemp: dArray) + { + vReturn.add(dTemp); + } + + return vReturn; + + } + + public static String arrListToString(List list) + { + String strReturn=""; + + if(list == null ) return ""; + + for(int i=0; i"+strTemp); + // double dou = Double.parseDouble(strTemp); + // strReturn = strReturn+","+dou; + strReturn = strReturn+","+strTemp; + } + + strReturn = strReturn.substring(1); + + return strReturn; + + } + + /** + Map 데이터를 JSONObject로 변환. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg Map + @return JSONObject + */ + public static JSONObject getJsonFromMap(Map map) throws JSONException + { + JSONObject jsonData = new JSONObject(); + + for (String key : map.keySet()) + { + Object value = map.get(key); + if (value instanceof Map) + { + value = getJsonFromMap((Map) value); + } + jsonData.put(key, value); + } + return jsonData; + } + + public static TokenInfo getAccessTokenInfo(HttpServletRequest request) + { + TokenInfo tokenInfo = null; + String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); + RemoteTokenServices tokenServices = new RemoteTokenServices(); + + if(StringUtils.startsWithIgnoreCase(authorization, "Bearer")) + { + /* + * FieldNamingPolicy 옵션 + * IDENTITY : 변경 없음 + * LOWER_CASE_WITH_DASHES : '-' 붙이기 + * LOWER_CASE_WITH_DOTS : '.' 붙이기 + * LOWER_CASE_WITH_UNDERSCORES : '_' 붙이기 + * UPPER_CAMEL_CASE : 첫문자 대문자로 + * UPPER_CAMEL_CASE_WITH_SPACES : 첫문자 대문자 + ' ' 공택붙이기 + * + */ + + String strTocken = ""; + strTocken = StringUtils.replace(authorization, "Bearer ",""); + strTocken = StringUtils.replace(authorization, "bearer ",""); + + Jwt jwt = JwtHelper.decode(strTocken); + + // Jwt jwt = JwtHelper.decode(StringUtils.replace(authorization, "Bearer ","")); + // Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); // snakecase to camelcase + Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create(); // snakecase to camelcase + + tokenInfo = gson.fromJson(jwt.getClaims(), TokenInfo.class); + } + + return tokenInfo; + } + + + /** + *
+	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(Object src) + { + if (src == null || src.equals("null") || src.equals("")) + { + return 0; + } + else + { + String str = src+""; + return Integer.parseInt(((String)str).trim()); + } + } + + /** + *
+	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(String src) + { + + if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) + { + return 0; + } + else + { + return Integer.parseInt(src.trim()); + } + } + + /** + 서버(DB)에서 front로 전달시 사용 + @version 1.0 + @author 나혁제 + @since 2025.03.20 + @param txt String + @return String + */ + public static String base64decode(String txt) + { + byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); + + try + { + return new String(bytes, "utf-8"); + } + catch(Exception e) + { + e.printStackTrace(); + return new String(bytes); + } + } + + /** + 랜덤문자열 생성 + @version 1.0 + @author 나혁제 + @since 2025.07.17 + @param txt String + @return String + */ + public static String getRandomChar(int iLimit) + { + int length = iLimit; // 원하는 문자열 길이 + String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; // 사용 가능한 문자 + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + + for (int i = 0; i < length; i++) + { + int index = random.nextInt(characters.length()); // 랜덤 인덱스 선택 + sb.append(characters.charAt(index)); + } + + return sb.toString(); + } + + + + +} diff --git a/api/src/main/java/com/urpsys/baseapi/common/util/DataSourceUtil.java b/api/src/main/java/com/urpsys/baseapi/common/util/DataSourceUtil.java deleted file mode 100644 index b59b314a..00000000 --- a/api/src/main/java/com/urpsys/baseapi/common/util/DataSourceUtil.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.urpsys.baseapi.common.util; - -import java.sql.Connection; - -import javax.sql.DataSource; - -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.springframework.core.env.Environment; -import org.springframework.core.io.Resource; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; - -import com.urpsys.baseapi.common.crypto.Aes256Cipher; -import com.urpsys.baseapi.common.exception.CustomException; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; - -/** - * Datasource 생성하는 유틸리티 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28    나혁제         최초작성
- *
- * 
- */ - -public class DataSourceUtil -{ - /** - * 데이터 소스 만드는 메소드 - * @param dataSourceName - * @param env - * @param cipher - * @return - */ - public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher) - { - HikariConfig config = new HikariConfig(); - - config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); - config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); - - config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username"))); - config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password"))); - - config.setAutoCommit(false); - - config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" ))); - config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" ))); - config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" ))); - config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" ))); - - config.addDataSourceProperty("cachePrepStmts" , "true"); - config.addDataSourceProperty("prepStmtCacheSize" , "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048"); - - return new HikariDataSource(config); - } - - /** - * SqlSessionFactory 만드는 메소드 - * @param dataSource - * @param configLocation - * @param mapperLocation - * @return - * @throws CustomException - */ - public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation, - Resource[] mapperLocation) throws CustomException - { - SqlSessionFactory sqlSessionFactory; - - try { - SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); - sessionFactoryBean.setDataSource(dataSource); - sessionFactoryBean.setConfigLocation(configLocation); - sessionFactoryBean.setMapperLocations(mapperLocation); - - sqlSessionFactory = sessionFactoryBean.getObject(); - } - catch (Exception ex) - { - throw new CustomException(ex.getMessage()); - } - - return sqlSessionFactory; - } - - /** - * 트랜잭션 처리 메소드 - * @param dataSource - * @return - */ - public static DataSourceTransactionManager createTxManager(DataSource dataSource) - { - DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource); - txManager.setGlobalRollbackOnParticipationFailure(false); - - return txManager; - } - - //end method -} diff --git a/api/src/main/java/com/urpsys/baseapi/common/util/HtmlEmailUtil.java b/api/src/main/java/com/urpsys/baseapi/common/util/HtmlEmailUtil.java index cb9fe6bd..e6a55679 100644 --- a/api/src/main/java/com/urpsys/baseapi/common/util/HtmlEmailUtil.java +++ b/api/src/main/java/com/urpsys/baseapi/common/util/HtmlEmailUtil.java @@ -1,213 +1,213 @@ -package com.urpsys.baseapi.common.util; - -import java.io.IOException; -import java.util.LinkedHashMap; - -import javax.annotation.Resource; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeUtility; - -import org.apache.commons.mail.DefaultAuthenticator; -import org.apache.commons.mail.EmailAttachment; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.MultiPartEmail; -import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.ByteArrayResource; -import org.springframework.mail.MailException; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -import org.springframework.util.StringUtils; - -import org.apache.commons.io.IOUtils; - -import com.urpsys.baseapi.common.crypto.Aes256Cipher; -import com.urpsys.itmsapi.cmm.service.CmmUseService; - -import lombok.extern.slf4j.Slf4j; - -/** - * Html 메일 처리에 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.03.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("HtmlEmailUtil") -public class HtmlEmailUtil -{ - - @Autowired - private HtmlEmailUtil(JavaMailSender mailSender) - { - this.mailSender = mailSender; - } - - @Value("${custom.sendmail.sendEmail}") - private String strMailAddress; - - @Value("${custom.sendmail.senderName}") - private String strMailSendName; - - private static JavaMailSender mailSender; - - @Autowired - CmmUseService cmmUseService; // 공통처리 서비스 - - @Resource(name="egovNtcnEsntlIdGnrService") - private EgovIdGnrService egovNtcnEsntlIdGnrService; - - - /** - 메일처리 기본함수 - @author 나혁제 - @since 2025.02.11 - @param : String to 받는사람 - String sj 제목 - String cn 메시지 - @return String 처리결과 - * @throws Exception - */ - public boolean send(String to, String sj, String cn) - { - if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 - - try - { - MimeMessage message = mailSender.createMimeMessage(); - MimeMessageHelper messageHelper = new MimeMessageHelper(message, false, "UTF-8"); - - messageHelper.setSubject(sj); - messageHelper.setText(cn, true); - messageHelper.setFrom(strMailAddress); - - String[] toArr = to.split(","); - - messageHelper.setTo(toArr); - - mailSender.send(message); // 메일발송 - - return true; - } - catch(MailException es) - { - es.printStackTrace(); - return false; - } - catch(Exception e) - { - e.printStackTrace(); - return false; - } - } - - /** - 메일/카톡 처리 기본함수 - @author 나혁제 - @since 2025.02.11 - @param : String to 받는사람 - String sj 제목 - String cn 메시지 - @return String 처리결과 - * @throws Exception - */ - public boolean SendAlarmInsert(String to, String sj, String cn, String regrId, String strSendGubun) - { - if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 - - try - { - String nctnEsntlId = egovNtcnEsntlIdGnrService.getNextStringId(); - String procTy = strSendGubun; - String ttl = sj; - String bdy = cn; - String rcvrAddr = to; - - LinkedHashMap inMap = new LinkedHashMap(); - - inMap.put("nctnEsntlId", nctnEsntlId); - inMap.put("procTy" , procTy); - inMap.put("ttl" , ttl); - inMap.put("bdy" , bdy); - inMap.put("rcvrAddr" , rcvrAddr); - inMap.put("regrId" , regrId); - - cmmUseService.insertNtcnProcSndInfo(inMap); - - return true; - } - catch(MailException es) - { - es.printStackTrace(); - return false; - } - catch(Exception e) - { - e.printStackTrace(); - return false; - } - } - - - public void sendMultipleMessage( String to - , String cc - , String sj - , String cn - , MultipartFile file) throws MessagingException, IOException - { - MimeMessage message = mailSender.createMimeMessage(); - MimeMessageHelper helper = new MimeMessageHelper(message, true); - - //메일 제목 설정 - helper.setSubject(sj); - - //참조자 설정 - helper.setCc(cc); - - helper.setText(cn, false); - - helper.setFrom(strMailAddress); - - //첨부 파일 설정 - String fileName = StringUtils.cleanPath(file.getOriginalFilename()); - - helper.addAttachment( MimeUtility.encodeText(fileName, "UTF-8", "B") - , new ByteArrayResource(IOUtils.toByteArray(file.getInputStream()))); - - //수신자 개별 전송 -// for(String s : mailDto.getAddress()) { -// helper.setTo(s); -// emailSender.send(message); -// } - //수신자 한번에 전송 - helper.setTo(to); - mailSender.send(message); - log.info("mail multiple send complete."); - - - } - - - - - -} +package com.urpsys.baseapi.common.util; + +import java.io.IOException; +import java.util.LinkedHashMap; + +import javax.annotation.Resource; +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import org.apache.commons.mail.DefaultAuthenticator; +import org.apache.commons.mail.EmailAttachment; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.mail.MailException; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import org.springframework.util.StringUtils; + +import org.apache.commons.io.IOUtils; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.itmsapi.cmm.service.CmmUseService; + +import lombok.extern.slf4j.Slf4j; + +/** + * Html 메일 처리에 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.03.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("HtmlEmailUtil") +public class HtmlEmailUtil +{ + + @Autowired + private HtmlEmailUtil(JavaMailSender mailSender) + { + this.mailSender = mailSender; + } + + @Value("${custom.sendmail.sendEmail}") + private String strMailAddress; + + @Value("${custom.sendmail.senderName}") + private String strMailSendName; + + private static JavaMailSender mailSender; + + @Autowired + CmmUseService cmmUseService; // 공통처리 서비스 + + @Resource(name="egovNtcnEsntlIdGnrService") + private EgovIdGnrService egovNtcnEsntlIdGnrService; + + + /** + 메일처리 기본함수 + @author 나혁제 + @since 2025.02.11 + @param : String to 받는사람 + String sj 제목 + String cn 메시지 + @return String 처리결과 + * @throws Exception + */ + public boolean send(String to, String sj, String cn) + { + if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 + + try + { + MimeMessage message = mailSender.createMimeMessage(); + MimeMessageHelper messageHelper = new MimeMessageHelper(message, false, "UTF-8"); + + messageHelper.setSubject(sj); + messageHelper.setText(cn, true); + messageHelper.setFrom(strMailAddress); + + String[] toArr = to.split(","); + + messageHelper.setTo(toArr); + + mailSender.send(message); // 메일발송 + + return true; + } + catch(MailException es) + { + es.printStackTrace(); + return false; + } + catch(Exception e) + { + e.printStackTrace(); + return false; + } + } + + /** + 메일/카톡 처리 기본함수 + @author 나혁제 + @since 2025.02.11 + @param : String to 받는사람 + String sj 제목 + String cn 메시지 + @return String 처리결과 + * @throws Exception + */ + public boolean SendAlarmInsert(String to, String sj, String cn, String regrId, String strSendGubun) + { + if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 + + try + { + String nctnEsntlId = egovNtcnEsntlIdGnrService.getNextStringId(); + String procTy = strSendGubun; + String ttl = sj; + String bdy = cn; + String rcvrAddr = to; + + LinkedHashMap inMap = new LinkedHashMap(); + + inMap.put("nctnEsntlId", nctnEsntlId); + inMap.put("procTy" , procTy); + inMap.put("ttl" , ttl); + inMap.put("bdy" , bdy); + inMap.put("rcvrAddr" , rcvrAddr); + inMap.put("regrId" , regrId); + + cmmUseService.insertNtcnProcSndInfo(inMap); + + return true; + } + catch(MailException es) + { + es.printStackTrace(); + return false; + } + catch(Exception e) + { + e.printStackTrace(); + return false; + } + } + + + public void sendMultipleMessage( String to + , String cc + , String sj + , String cn + , MultipartFile file) throws MessagingException, IOException + { + MimeMessage message = mailSender.createMimeMessage(); + MimeMessageHelper helper = new MimeMessageHelper(message, true); + + //메일 제목 설정 + helper.setSubject(sj); + + //참조자 설정 + helper.setCc(cc); + + helper.setText(cn, false); + + helper.setFrom(strMailAddress); + + //첨부 파일 설정 + String fileName = StringUtils.cleanPath(file.getOriginalFilename()); + + helper.addAttachment( MimeUtility.encodeText(fileName, "UTF-8", "B") + , new ByteArrayResource(IOUtils.toByteArray(file.getInputStream()))); + + //수신자 개별 전송 +// for(String s : mailDto.getAddress()) { +// helper.setTo(s); +// emailSender.send(message); +// } + //수신자 한번에 전송 + helper.setTo(to); + mailSender.send(message); + log.info("mail multiple send complete."); + + + } + + + + + +} diff --git a/api/src/main/java/com/urpsys/baseapi/common/util/RestApiCallUtil.java b/api/src/main/java/com/urpsys/baseapi/common/util/RestApiCallUtil.java index 1973d0ec..bda2a3b6 100644 --- a/api/src/main/java/com/urpsys/baseapi/common/util/RestApiCallUtil.java +++ b/api/src/main/java/com/urpsys/baseapi/common/util/RestApiCallUtil.java @@ -1,386 +1,388 @@ -package com.urpsys.baseapi.common.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.codec.binary.Base64; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; - -import com.urpsys.baseapi.common.exception.CustomException; -import com.urpsys.baseapi.domain.TokenInfo; - -import kong.unirest.HttpResponse; -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * Rest Api 을 호출하는 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.03.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("RestApiCallUtil") -public class RestApiCallUtil -{ - @Value("${custom.api_server}") - private String strApiServer; // API 서버 - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : HttpServletRequest request - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCall( HttpServletRequest request - , Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info("=============== RestApiCall request ==============="); - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - - return RestApiCall( tokenInfo, bodyMap, strRestUrl); - } - - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCall( TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCall tokenInfo <<<<<<<<<<<<<<<"); - - /* - log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); - log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); - */ - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - - headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); - // Header Setting End --------------------------------- - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - - String strDomain = strApiServer; - String strFullUrl = strDomain + strRestUrl; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - String strFullReturnData = returnObj.toString(); - - log.info("전체 리턴값 => [{}]", returnObj.toString()); - - // Map 변환처리 - Map returnMap = null; - - // 비정상처리 - if(strFullReturnData.indexOf("status")<0) - { - String strError = (String)returnObj.get("error"); - String strMessage = (String)returnObj.get("message"); - - throw new CustomException("9000", strMessage); - } - // 정상처리 - else - { - // log.info("한번 봅시다 2. => [{}]", returnObj.get("status")); - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - } - - // json to Map 변환처리 - returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); - } - - log.info("<<<<<<<<<<<<<<< RestApiCall >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNoAuth ( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNoHead <<<<<<<<<<<<<<<"); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - // Header Setting End --------------------------------- - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - - String strDomain = strApiServer; - String strFullUrl = strDomain + strRestUrl; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - log.info("리턴값 확인 => [{}]", returnObjData.toString()); - } - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallNoHead >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - 네이버 클라우드 카톡 서비스 호출 - @author 나혁제 - @since 2025.03.20 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNaverCloudKaKao() throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNaverCloudKaKao <<<<<<<<<<<<<<<"); - - long timestamp = System.currentTimeMillis(); - - String strTime = timestamp+""; - - String strContentType = "application/json; charset=utf-8"; - String strServiceId = "ncp:kkobizmsg:kr:349487487272:uritms"; - String strAccessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; - String strSignature = makeSignature(strTime, strServiceId); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type" , strContentType ); - headers.put("x-ncp-apigw-timestamp" , strTime ); - headers.put("x-ncp-iam-access-key" , strAccessKey ); - headers.put("x-ncp-apigw-signature-v2" , strSignature ); - // Header Setting End --------------------------------- - - log.info("headers 입력값 확인 => [{}]", headers.toString()); - - Map bodyMap = new HashMap<>(); - - - bodyMap.put("plusFriendId" , "@유알피-uritsm"); - bodyMap.put("templateCode" , "uritms04"); - bodyMap.put("value01" , "나혁제"); - - - List> messagesList = new ArrayList<>(); - - Map messages = new HashMap<>(); - - /* - String strMessage = "" - +"나혁제 이 요청하여 ITSM 에 접수된 SR(서비스요청) 에 대한 정보입니다. \r\n" - +"\r\n" - +"서비스요청 접수번호 : AA\r\n" - +"서비스요청 제목 : BB\r\n" - +"서비스요청 처리요청 : CC\r\n" - +"서비스요청 기타정보 : DD\r\n" - ; - */ - - log.info("headers 입력값 확인 => [{}]", headers.toString()); - - String strMessage = "" - + "[인프라업무알림]\n" - + "\n" - + "안녕하세요.\n" - + "\n" - + "나혁제님 이 요청하여 ITSM 에 접수된 SR(서비스요청) 에 대한 정보입니다.\n" - + "\n" - + "서비스요청 접수번호 : AA\n" - + "서비스요청 제목 : BB\n" - + "서비스요청 처리요청 : CC\n" - + "서비스요청 기타정보 : DD" - ; - - messages.put("countryCode", "82"); - messages.put("to" , "01068028984"); - messages.put("content" , strMessage); - /* - messages.put("srid" , "srid1"); - messages.put("srtitle" , "srtitle1"); - messages.put("value01" , "나혁제"); - messages.put("value02" , "val02"); - messages.put("value03" , "val03"); - messages.put("value04" , "val04"); - messages.put("value05" , "val05"); - */ - - - - messagesList.add(messages); - - bodyMap.put("messages", messagesList); - - log.info("body 입력값 확인 => [{}]", bodyMap.toString()); - - log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); - - String strFullUrl = "https://sens.apigw.ntruss.com/alimtalk/v2/services/"+strServiceId+"/messages"; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - String strFullReturnData = returnObj.toString(); - - log.info("전체 리턴값 => [{}]", returnObj.toString()); - - // Map 변환처리 - Map returnMap = null; - - // json to Map 변환처리 - returnMap = ConvertUtils.getMapFromJSONObject(returnObj); - - log.info("<<<<<<<<<<<<<<< RestApiCallNaverCloudKaKao >>>>>>>>>>>>>>>"); - - return returnMap; - } - - public String makeSignature(String timestamp, String strServiceId) - { - String encodeBase64String = ""; - - try { - String space = " "; // one space - String newLine = "\n"; // new line - String method = "POST"; // method - String url = "/alimtalk/v2/services/"+strServiceId+"/messages"; // url (include query string) - String accessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; // access key id (from portal or Sub Account) - String secretKey = "ncp_iam_BPKMKRIOXMe91u5YQoPjmk5WZ2A1FNEcoR"; - - String message = new StringBuilder() - .append(method) - .append(space) - .append(url) - .append(newLine) - .append(timestamp) - .append(newLine) - .append(accessKey) - .toString(); - - SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); - Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(signingKey); - - byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); - encodeBase64String = Base64.encodeBase64String(rawHmac); - } - catch(Exception e) - { - e.printStackTrace(); - } - - return encodeBase64String; - } - - - - - - - -} +package com.urpsys.baseapi.common.util; + +import com.urpsys.common.util.ConvertUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.baseapi.domain.TokenInfo; + +import kong.unirest.HttpResponse; +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * Rest Api 을 호출하는 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.03.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("RestApiCallUtil") +public class RestApiCallUtil +{ + @Value("${custom.api_server}") + private String strApiServer; // API 서버 + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : HttpServletRequest request + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCall( HttpServletRequest request + , Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info("=============== RestApiCall request ==============="); + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + + return RestApiCall( tokenInfo, bodyMap, strRestUrl); + } + + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCall( TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCall tokenInfo <<<<<<<<<<<<<<<"); + + /* + log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); + log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); + */ + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + + headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); + // Header Setting End --------------------------------- + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + + String strDomain = strApiServer; + String strFullUrl = strDomain + strRestUrl; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + String strFullReturnData = returnObj.toString(); + + log.info("전체 리턴값 => [{}]", returnObj.toString()); + + // Map 변환처리 + Map returnMap = null; + + // 비정상처리 + if(strFullReturnData.indexOf("status")<0) + { + String strError = (String)returnObj.get("error"); + String strMessage = (String)returnObj.get("message"); + + throw new CustomException("9000", strMessage); + } + // 정상처리 + else + { + // log.info("한번 봅시다 2. => [{}]", returnObj.get("status")); + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + } + + // json to Map 변환처리 + returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); + } + + log.info("<<<<<<<<<<<<<<< RestApiCall >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNoAuth ( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNoHead <<<<<<<<<<<<<<<"); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + // Header Setting End --------------------------------- + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + + String strDomain = strApiServer; + String strFullUrl = strDomain + strRestUrl; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + log.info("리턴값 확인 => [{}]", returnObjData.toString()); + } + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallNoHead >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + 네이버 클라우드 카톡 서비스 호출 + @author 나혁제 + @since 2025.03.20 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNaverCloudKaKao() throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNaverCloudKaKao <<<<<<<<<<<<<<<"); + + long timestamp = System.currentTimeMillis(); + + String strTime = timestamp+""; + + String strContentType = "application/json; charset=utf-8"; + String strServiceId = "ncp:kkobizmsg:kr:349487487272:uritms"; + String strAccessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; + String strSignature = makeSignature(strTime, strServiceId); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type" , strContentType ); + headers.put("x-ncp-apigw-timestamp" , strTime ); + headers.put("x-ncp-iam-access-key" , strAccessKey ); + headers.put("x-ncp-apigw-signature-v2" , strSignature ); + // Header Setting End --------------------------------- + + log.info("headers 입력값 확인 => [{}]", headers.toString()); + + Map bodyMap = new HashMap<>(); + + + bodyMap.put("plusFriendId" , "@유알피-uritsm"); + bodyMap.put("templateCode" , "uritms04"); + bodyMap.put("value01" , "나혁제"); + + + List> messagesList = new ArrayList<>(); + + Map messages = new HashMap<>(); + + /* + String strMessage = "" + +"나혁제 이 요청하여 ITSM 에 접수된 SR(서비스요청) 에 대한 정보입니다. \r\n" + +"\r\n" + +"서비스요청 접수번호 : AA\r\n" + +"서비스요청 제목 : BB\r\n" + +"서비스요청 처리요청 : CC\r\n" + +"서비스요청 기타정보 : DD\r\n" + ; + */ + + log.info("headers 입력값 확인 => [{}]", headers.toString()); + + String strMessage = "" + + "[인프라업무알림]\n" + + "\n" + + "안녕하세요.\n" + + "\n" + + "나혁제님 이 요청하여 ITSM 에 접수된 SR(서비스요청) 에 대한 정보입니다.\n" + + "\n" + + "서비스요청 접수번호 : AA\n" + + "서비스요청 제목 : BB\n" + + "서비스요청 처리요청 : CC\n" + + "서비스요청 기타정보 : DD" + ; + + messages.put("countryCode", "82"); + messages.put("to" , "01068028984"); + messages.put("content" , strMessage); + /* + messages.put("srid" , "srid1"); + messages.put("srtitle" , "srtitle1"); + messages.put("value01" , "나혁제"); + messages.put("value02" , "val02"); + messages.put("value03" , "val03"); + messages.put("value04" , "val04"); + messages.put("value05" , "val05"); + */ + + + + messagesList.add(messages); + + bodyMap.put("messages", messagesList); + + log.info("body 입력값 확인 => [{}]", bodyMap.toString()); + + log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); + + String strFullUrl = "https://sens.apigw.ntruss.com/alimtalk/v2/services/"+strServiceId+"/messages"; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + String strFullReturnData = returnObj.toString(); + + log.info("전체 리턴값 => [{}]", returnObj.toString()); + + // Map 변환처리 + Map returnMap = null; + + // json to Map 변환처리 + returnMap = ConvertUtils.getMapFromJSONObject(returnObj); + + log.info("<<<<<<<<<<<<<<< RestApiCallNaverCloudKaKao >>>>>>>>>>>>>>>"); + + return returnMap; + } + + public String makeSignature(String timestamp, String strServiceId) + { + String encodeBase64String = ""; + + try { + String space = " "; // one space + String newLine = "\n"; // new line + String method = "POST"; // method + String url = "/alimtalk/v2/services/"+strServiceId+"/messages"; // url (include query string) + String accessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; // access key id (from portal or Sub Account) + String secretKey = "ncp_iam_BPKMKRIOXMe91u5YQoPjmk5WZ2A1FNEcoR"; + + String message = new StringBuilder() + .append(method) + .append(space) + .append(url) + .append(newLine) + .append(timestamp) + .append(newLine) + .append(accessKey) + .toString(); + + SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(signingKey); + + byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); + encodeBase64String = Base64.encodeBase64String(rawHmac); + } + catch(Exception e) + { + e.printStackTrace(); + } + + return encodeBase64String; + } + + + + + + + +} diff --git a/api/src/main/java/com/urpsys/baseapi/config/EncryptConfig.java b/api/src/main/java/com/urpsys/baseapi/config/EncryptConfig.java index e82f51a9..1f297612 100644 --- a/api/src/main/java/com/urpsys/baseapi/config/EncryptConfig.java +++ b/api/src/main/java/com/urpsys/baseapi/config/EncryptConfig.java @@ -1,38 +1,38 @@ -package com.urpsys.baseapi.config; - -import java.io.IOException; -import java.security.InvalidKeyException; -import org.apache.commons.codec.DecoderException; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.urpsys.baseapi.common.crypto.Aes256Cipher; - -/** - * 암호화 유틸리티를 등록하는 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28   나혁제         최초작성
- *
- * 
- */ - -@Configuration -public class EncryptConfig -{ - @Bean(name="aes256Cipher") - public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException - { - return new Aes256Cipher(); - } -} +package com.urpsys.baseapi.config; + +import java.io.IOException; +import java.security.InvalidKeyException; +import org.apache.commons.codec.DecoderException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.urpsys.common.crypto.Aes256Cipher; + +/** + * 암호화 유틸리티를 등록하는 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28   나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +public class EncryptConfig +{ + @Bean(name="aes256Cipher") + public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException + { + return new Aes256Cipher(); + } +} diff --git a/api/src/main/java/com/urpsys/baseapi/config/MailConfig.java b/api/src/main/java/com/urpsys/baseapi/config/MailConfig.java index f49a22a2..3e5e9226 100644 --- a/api/src/main/java/com/urpsys/baseapi/config/MailConfig.java +++ b/api/src/main/java/com/urpsys/baseapi/config/MailConfig.java @@ -1,87 +1,87 @@ -package com.urpsys.baseapi.config; - -import java.util.Properties; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.ModelAndView; - -import com.urpsys.baseapi.common.crypto.Aes256Cipher; - -import lombok.extern.slf4j.Slf4j; - -/** - * html 메일 설정 클리스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.03.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20    나혁제         최초작성
- *
- * 
- */ - -@Slf4j -@Component -public class MailConfig -{ - @Value("${custom.sendmail.id}") - private String strMailId; - - @Value("${custom.sendmail.password}") - private String strMailPass; - - @Value("${custom.sendmail.port}") - private int strMailPort; - - @Value("${custom.sendmail.host}") - private String strMailHost; - - @Value("${custom.sendmail.socketFactory-class}") - private String strSocketFactoryClass; - - - @Autowired - private Aes256Cipher aes256Cipher; - - Properties pt = new Properties(); - - @Bean - public JavaMailSender javaMailService() - { - JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); - javaMailSender.setHost (this.strMailHost ); - javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); - javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); - javaMailSender.setPort (this.strMailPort ); - - pt.put("mail.smtp.socketFactory.port" , this.strMailPort); - pt.put("mail.smtp.auth" , true); - pt.put("mail.smtp.starttls.enable" , true); - pt.put("mail.smtp.starttls.required" , true); - pt.put("mail.smtp.socketFactory.fallback", false); - // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 - - javaMailSender.setJavaMailProperties(pt); - javaMailSender.setDefaultEncoding("UTF-8"); - - return javaMailSender; - } - -} +package com.urpsys.baseapi.config; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +import com.urpsys.common.crypto.Aes256Cipher; + +import lombok.extern.slf4j.Slf4j; + +/** + * html 메일 설정 클리스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.03.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20    나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@Component +public class MailConfig +{ + @Value("${custom.sendmail.id}") + private String strMailId; + + @Value("${custom.sendmail.password}") + private String strMailPass; + + @Value("${custom.sendmail.port}") + private int strMailPort; + + @Value("${custom.sendmail.host}") + private String strMailHost; + + @Value("${custom.sendmail.socketFactory-class}") + private String strSocketFactoryClass; + + + @Autowired + private Aes256Cipher aes256Cipher; + + Properties pt = new Properties(); + + @Bean + public JavaMailSender javaMailService() + { + JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); + javaMailSender.setHost (this.strMailHost ); + javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); + javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); + javaMailSender.setPort (this.strMailPort ); + + pt.put("mail.smtp.socketFactory.port" , this.strMailPort); + pt.put("mail.smtp.auth" , true); + pt.put("mail.smtp.starttls.enable" , true); + pt.put("mail.smtp.starttls.required" , true); + pt.put("mail.smtp.socketFactory.fallback", false); + // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 + + javaMailSender.setJavaMailProperties(pt); + javaMailSender.setDefaultEncoding("UTF-8"); + + return javaMailSender; + } + +} diff --git a/api/src/main/java/com/urpsys/baseapi/config/Oauth2ResourceConfig.java b/api/src/main/java/com/urpsys/baseapi/config/Oauth2ResourceConfig.java index bc64ad12..a34abff4 100644 --- a/api/src/main/java/com/urpsys/baseapi/config/Oauth2ResourceConfig.java +++ b/api/src/main/java/com/urpsys/baseapi/config/Oauth2ResourceConfig.java @@ -1,165 +1,165 @@ -package com.urpsys.baseapi.config; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; -import org.springframework.security.oauth2.provider.token.TokenStore; -import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; -import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; - -import com.google.gson.Gson; - -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import lombok.extern.slf4j.Slf4j; - -import com.urpsys.baseapi.common.exception.CustomException; -import com.urpsys.baseapi.domain.CommonVO; -import com.urpsys.baseapi.domain.JWTKey; -import com.urpsys.baseapi.service.CommonService; - -/** - * Resource 서버 기본세팅 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * @comment : - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28  나혁제         최초작성
- *
- * 
- */ - -@Slf4j -@Configuration -public class Oauth2ResourceConfig extends ResourceServerConfigurerAdapter -{ - @Autowired - CommonService commonService; // 공통 서비스 - - @Override - public void configure(ResourceServerSecurityConfigurer resources) throws Exception - { - // 최소한 리소스ID 정도는 설정 필요 - resources.resourceId("event") - .accessDeniedHandler(new CustomAccessDeniedHandler()) - .authenticationEntryPoint(new CustomAuthenticationEntryPoint()); - - } - - @Value("${spring.security.oauth2.resourceserver.jwt.jwk-set-uri}") - private String publicKeyUri; // key 정보를 받아오기 위한 인증서버 URL 선언 - - @Override - public void configure(HttpSecurity http) throws Exception - { - http.authorizeRequests().mvcMatchers("/sys/LoginLog**" ).permitAll(); // 로그인 이력처리 - // 2026.01.19 나혁제 로그인화면 부가기능(ID찾기, password 초기화, 회원가입) - http.authorizeRequests().mvcMatchers("/main/noAuth*.do" ).permitAll(); - // http.authorizeRequests().mvcMatchers("/main/SearchIdFind.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가 - // http.authorizeRequests().mvcMatchers("/main/UserPasswordResetExt.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가 - - http.authorizeRequests().anyRequest().authenticated(); - } - - @Bean - public TokenStore tokenStore() - { - log.info(">>>>>>>>>> Oauth2ResourceConfig tokenStore <<<<<<<<<<"); - log.info("<<<<<<<<<< Oauth2ResourceConfig tokenStore >>>>>>>>>>"); - - return new JwtTokenStore(jwtAccessTokenConverter()); - } - - @Bean - public JwtAccessTokenConverter jwtAccessTokenConverter() - { - log.info(">>>>>>>>>> Oauth2ResourceConfig jwtAccessTokenConverter <<<<<<<<<<"); - - try - { - /*** * 직접 oauth 서버를 호출하여 공개키 읽어서 jwt 디코드 키 등록 */ - JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); - - // 보안키 획득 - String strPrivKey = getPublicKeyValue(publicKeyUri); - - // - if(strPrivKey==null || strPrivKey.equals("")) - { - throw new CustomException("보안키 획득 실패1"); - - } - - converter.setVerifierKey(strPrivKey); - - log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); - - return converter; - } - catch (Exception e) - { - log.info("보안키 획득 실패2"); - log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); - - return new JwtAccessTokenConverter(); - } - } - - private String getPublicKeyValue(String uriKey) - { - log.info(">>>>>>>>>> Oauth2ResourceConfig getPublicKeyValue <<<<<<<<<<"); - - String strReturn = ""; - JsonNode response = null; - - try - { - response = Unirest.get(uriKey) - .asJson().getBody(); - - strReturn = response.toString(); - } - catch(Exception e) - { - return strReturn; - } - - - if(StringUtils.isEmpty(strReturn)) - { - strReturn =""; - } - else - { - strReturn =new Gson().fromJson(response.toString(), JWTKey.class).getValue();; - } - - log.info("<<<<<<<<<< Oauth2ResourceConfig getPublicKeyValue : {} >>>>>>>>>>", strReturn); - - return strReturn; - - - } - - - - - - - -} +package com.urpsys.baseapi.config; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; + +import com.google.gson.Gson; + +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import lombok.extern.slf4j.Slf4j; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.baseapi.domain.CommonVO; +import com.urpsys.baseapi.domain.JWTKey; +import com.urpsys.baseapi.service.CommonService; + +/** + * Resource 서버 기본세팅 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * @comment : + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28  나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@Configuration +public class Oauth2ResourceConfig extends ResourceServerConfigurerAdapter +{ + @Autowired + CommonService commonService; // 공통 서비스 + + @Override + public void configure(ResourceServerSecurityConfigurer resources) throws Exception + { + // 최소한 리소스ID 정도는 설정 필요 + resources.resourceId("event") + .accessDeniedHandler(new CustomAccessDeniedHandler()) + .authenticationEntryPoint(new CustomAuthenticationEntryPoint()); + + } + + @Value("${spring.security.oauth2.resourceserver.jwt.jwk-set-uri}") + private String publicKeyUri; // key 정보를 받아오기 위한 인증서버 URL 선언 + + @Override + public void configure(HttpSecurity http) throws Exception + { + http.authorizeRequests().mvcMatchers("/sys/LoginLog**" ).permitAll(); // 로그인 이력처리 + // 2026.01.19 나혁제 로그인화면 부가기능(ID찾기, password 초기화, 회원가입) + http.authorizeRequests().mvcMatchers("/main/noAuth*.do" ).permitAll(); + // http.authorizeRequests().mvcMatchers("/main/SearchIdFind.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가 + // http.authorizeRequests().mvcMatchers("/main/UserPasswordResetExt.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가 + + http.authorizeRequests().anyRequest().authenticated(); + } + + @Bean + public TokenStore tokenStore() + { + log.info(">>>>>>>>>> Oauth2ResourceConfig tokenStore <<<<<<<<<<"); + log.info("<<<<<<<<<< Oauth2ResourceConfig tokenStore >>>>>>>>>>"); + + return new JwtTokenStore(jwtAccessTokenConverter()); + } + + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter() + { + log.info(">>>>>>>>>> Oauth2ResourceConfig jwtAccessTokenConverter <<<<<<<<<<"); + + try + { + /*** * 직접 oauth 서버를 호출하여 공개키 읽어서 jwt 디코드 키 등록 */ + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); + + // 보안키 획득 + String strPrivKey = getPublicKeyValue(publicKeyUri); + + // + if(strPrivKey==null || strPrivKey.equals("")) + { + throw new CustomException("보안키 획득 실패1"); + + } + + converter.setVerifierKey(strPrivKey); + + log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); + + return converter; + } + catch (Exception e) + { + log.info("보안키 획득 실패2"); + log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); + + return new JwtAccessTokenConverter(); + } + } + + private String getPublicKeyValue(String uriKey) + { + log.info(">>>>>>>>>> Oauth2ResourceConfig getPublicKeyValue <<<<<<<<<<"); + + String strReturn = ""; + JsonNode response = null; + + try + { + response = Unirest.get(uriKey) + .asJson().getBody(); + + strReturn = response.toString(); + } + catch(Exception e) + { + return strReturn; + } + + + if(StringUtils.isEmpty(strReturn)) + { + strReturn =""; + } + else + { + strReturn =new Gson().fromJson(response.toString(), JWTKey.class).getValue();; + } + + log.info("<<<<<<<<<< Oauth2ResourceConfig getPublicKeyValue : {} >>>>>>>>>>", strReturn); + + return strReturn; + + + } + + + + + + + +} diff --git a/api/src/main/java/com/urpsys/baseapi/config/PasswordEncoderConfig.java b/api/src/main/java/com/urpsys/baseapi/config/PasswordEncoderConfig.java index fc4802de..a354a990 100644 --- a/api/src/main/java/com/urpsys/baseapi/config/PasswordEncoderConfig.java +++ b/api/src/main/java/com/urpsys/baseapi/config/PasswordEncoderConfig.java @@ -1,77 +1,77 @@ -package com.urpsys.baseapi.config; - -import java.util.Base64; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.crypto.password.PasswordEncoder; - -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; - -import lombok.extern.slf4j.Slf4j; - -/** - * 패스워드 암호화 정책 수립(접근 Client, 회원비미번호) - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * @comment : PasswordEncoder는 SpringSecurity5 이상에서는 필수 생성 처리 - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06    나혁제         최초작성
- *
- * 
- */ - -// -@Slf4j -@Configuration -public class PasswordEncoderConfig -{ - @Bean - public PasswordEncoder passwordEncoder() - { - // 1번설정 - log.info(">>>>>>>>>> 1. WebSecurityConfiguration passwordEncoder <<<<<<<<<<"); - - return new BCryptPasswordEncoder() - { - /** - * 입력정보을 암호화 하여 일치여부 확인 - * - * @param 입력pass, 등록pass - * @return 일치여부 - */ - @Override - public boolean matches(CharSequence rawPassword - , String encodedPassword) - { - log.info(">>>>>>>>>> WebSecurityConfiguration BCryptPasswordEncoder matches <<<<<<<<<<"); - - log.info("입력 rawPassword => {}", rawPassword ); - log.info("DB encodedPassword => {}", encodedPassword ); - log.info("변환 password => {}", super.encode(rawPassword) ); // 양방향 암호화 정책으로 print 부분이 다름 - - if (super.matches(rawPassword, encodedPassword)) - { - log.info("===> password match "); - return true; - } - else - { - log.info("===> password not match "); - return false; - } - } - }; - } - - +package com.urpsys.baseapi.config; + +import java.util.Base64; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.crypto.password.PasswordEncoder; + +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +import lombok.extern.slf4j.Slf4j; + +/** + * 패스워드 암호화 정책 수립(접근 Client, 회원비미번호) + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0.0 + * @see + * @comment : PasswordEncoder는 SpringSecurity5 이상에서는 필수 생성 처리 + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.06    나혁제         최초작성
+ *
+ * 
+ */ + +// +@Slf4j +@Configuration +public class PasswordEncoderConfig +{ + @Bean + public PasswordEncoder passwordEncoder() + { + // 1번설정 + log.info(">>>>>>>>>> 1. WebSecurityConfiguration passwordEncoder <<<<<<<<<<"); + + return new BCryptPasswordEncoder() + { + /** + * 입력정보을 암호화 하여 일치여부 확인 + * + * @param 입력pass, 등록pass + * @return 일치여부 + */ + @Override + public boolean matches(CharSequence rawPassword + , String encodedPassword) + { + log.info(">>>>>>>>>> WebSecurityConfiguration BCryptPasswordEncoder matches <<<<<<<<<<"); + + log.info("입력 rawPassword => {}", rawPassword ); + log.info("DB encodedPassword => {}", encodedPassword ); + log.info("변환 password => {}", super.encode(rawPassword) ); // 양방향 암호화 정책으로 print 부분이 다름 + + if (super.matches(rawPassword, encodedPassword)) + { + log.info("===> password match "); + return true; + } + else + { + log.info("===> password not match "); + return false; + } + } + }; + } + + } \ No newline at end of file diff --git a/api/src/main/java/com/urpsys/baseapi/config/PrimaryDbConfig.java b/api/src/main/java/com/urpsys/baseapi/config/PrimaryDbConfig.java index adcdf33d..24f52f27 100644 --- a/api/src/main/java/com/urpsys/baseapi/config/PrimaryDbConfig.java +++ b/api/src/main/java/com/urpsys/baseapi/config/PrimaryDbConfig.java @@ -1,112 +1,112 @@ -package com.urpsys.baseapi.config; - -import java.io.IOException; -import java.sql.Connection; - -import javax.sql.DataSource; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.urpsys.baseapi.common.crypto.Aes256Cipher; -import com.urpsys.baseapi.common.exception.CustomException; -import com.urpsys.baseapi.common.util.DataSourceUtil; - -/** - * primary db config 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28    나혁제         최초작성
- *
- * 
- */ - -@Configuration -@EnableTransactionManagement -@MapperScan( value={"com.urpsys.baseapi", "com.urpsys.itmsapi"} - , sqlSessionFactoryRef="primarySqlSessionFactory") -public class PrimaryDbConfig -{ - @Autowired - private Environment env; - - @Autowired - private Aes256Cipher aes256Cipher; - - - /** - * 데이터소스 등록하는 메소드 - * @return - */ - @Bean(name="primaryDataSource") - public DataSource primaryDataSource() - { - return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); - } - - /** - * sqlsessionfactory 등록하는 메소드 - * - * @param dataSource - * @param context - * @return - * @throws SchedulerException - * @throws IOException - */ - @Bean(name="primarySqlSessionFactory") - public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) - throws CustomException, IOException - { - SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource - , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") - , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") - ); - - sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); - - return sqlSessionFactory; - } - - /** - * sqlsessiontemplate 등록하는 메소드 - * @param primarySqlSessionFactory - * @return - */ - @Bean("primarySqlSessionTemplate") - public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) - { - return new SqlSessionTemplate(primarySqlSessionFactory); - } - - /** - * 트랜잭션 매니저 등록하는 메소드 - * @param dataSource - * @return - */ - @Bean(name="primaryTxManager") - public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) - { - return DataSourceUtil.createTxManager(dataSource); - } -} - +package com.urpsys.baseapi.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; +import com.urpsys.common.util.DataSourceUtil; + +/** + * primary db config 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan( value={"com.urpsys.baseapi", "com.urpsys.itmsapi"} + , sqlSessionFactoryRef="primarySqlSessionFactory") +public class PrimaryDbConfig +{ + @Autowired + private Environment env; + + @Autowired + private Aes256Cipher aes256Cipher; + + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="primaryDataSource") + public DataSource primaryDataSource() + { + return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="primarySqlSessionFactory") + public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") + , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("primarySqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) + { + return new SqlSessionTemplate(primarySqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="primaryTxManager") + public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/api/src/main/java/com/urpsys/itmsapi/cmm/service/FileManageService.java b/api/src/main/java/com/urpsys/itmsapi/cmm/service/FileManageService.java index 71329c3a..ab24e092 100644 --- a/api/src/main/java/com/urpsys/itmsapi/cmm/service/FileManageService.java +++ b/api/src/main/java/com/urpsys/itmsapi/cmm/service/FileManageService.java @@ -1,124 +1,124 @@ -package com.urpsys.itmsapi.cmm.service; - -import java.util.LinkedHashMap; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.urpsys.itmsapi.cmm.dao.FileManageDao; - -import com.urpsys.baseapi.common.exception.CustomException; - -/** - * 파일을 처리하하는 비즈니스 구현 클래스를 정의 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일     수정자      수정내용
- * -----------  ---------    ------------------------
- * 2025.01.20   나혁제      최초작성
- *
- *      
- */ - -@Service -@Transactional -public class FileManageService -{ - @Autowired - FileManageDao fileManageDao; - - // 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. - public int insertFileInfs(List> inList) throws Exception - { - int iResult = -1; - - LinkedHashMap masterMap = inList.get(0); - - iResult = fileManageDao.insertFileMaster(masterMap); - - if(iResult<1) throw new CustomException("이상함"); - - - for(LinkedHashMap inMap : inList) - { - iResult = fileManageDao.insertFileDetail(inMap); - - if(iResult<1) throw new CustomException("이상함"); - } - - return iResult; - } - - // 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. - public int updateFileInfs(List> inList) throws Exception - { - int iResult = -1; - - for(LinkedHashMap inMap : inList) - { - iResult = fileManageDao.insertFileDetail(inMap); - - if(iResult<1) throw new CustomException("이상함"); - } - - return iResult; - } - - - // 파일에 대한 목록을 조회한다. - public List> selectFileInfs(LinkedHashMap inMap) throws Exception - { - return fileManageDao.selectFileList(inMap); - } - - // 파일에 대한 상세정보를 조회 - public LinkedHashMap selectFileInf (LinkedHashMap inMap) throws Exception - { - return fileManageDao.selectFileInf(inMap); - } - - // 파일 구분자에 대한 최대값을 구한다. - public int getMaxFileSN(LinkedHashMap inMap) throws Exception - { - return fileManageDao.getMaxFileSN(inMap); - } - - // 하나의 파일을 삭제 - public int deleteFileInf(LinkedHashMap inMap) throws Exception - { - return fileManageDao.deleteFileDetail(inMap); - } - - // 전체 파일을 삭제한다.(마스터) - public int deleteAllFileInf(LinkedHashMap inMap) throws Exception - { - return fileManageDao.deleteCOMTNFILE(inMap); - } - - // 전체 파일을 삭제한다.(상세파일) - public int deleteFileDetailAll(LinkedHashMap inMap) throws Exception - { - return fileManageDao.deleteFileDetailAll(inMap); - } - - - // 이미지 파일에 대한 목록을 조회한다. - public List> selectImageFileList(LinkedHashMap inMap) throws Exception - { - return fileManageDao.selectImageFileList(inMap); - } - - - - -} +package com.urpsys.itmsapi.cmm.service; + +import java.util.LinkedHashMap; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.urpsys.itmsapi.cmm.dao.FileManageDao; + +import com.urpsys.common.exception.CustomException; + +/** + * 파일을 처리하하는 비즈니스 구현 클래스를 정의 + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일     수정자      수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.20   나혁제      최초작성
+ *
+ *      
+ */ + +@Service +@Transactional +public class FileManageService +{ + @Autowired + FileManageDao fileManageDao; + + // 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + public int insertFileInfs(List> inList) throws Exception + { + int iResult = -1; + + LinkedHashMap masterMap = inList.get(0); + + iResult = fileManageDao.insertFileMaster(masterMap); + + if(iResult<1) throw new CustomException("이상함"); + + + for(LinkedHashMap inMap : inList) + { + iResult = fileManageDao.insertFileDetail(inMap); + + if(iResult<1) throw new CustomException("이상함"); + } + + return iResult; + } + + // 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + public int updateFileInfs(List> inList) throws Exception + { + int iResult = -1; + + for(LinkedHashMap inMap : inList) + { + iResult = fileManageDao.insertFileDetail(inMap); + + if(iResult<1) throw new CustomException("이상함"); + } + + return iResult; + } + + + // 파일에 대한 목록을 조회한다. + public List> selectFileInfs(LinkedHashMap inMap) throws Exception + { + return fileManageDao.selectFileList(inMap); + } + + // 파일에 대한 상세정보를 조회 + public LinkedHashMap selectFileInf (LinkedHashMap inMap) throws Exception + { + return fileManageDao.selectFileInf(inMap); + } + + // 파일 구분자에 대한 최대값을 구한다. + public int getMaxFileSN(LinkedHashMap inMap) throws Exception + { + return fileManageDao.getMaxFileSN(inMap); + } + + // 하나의 파일을 삭제 + public int deleteFileInf(LinkedHashMap inMap) throws Exception + { + return fileManageDao.deleteFileDetail(inMap); + } + + // 전체 파일을 삭제한다.(마스터) + public int deleteAllFileInf(LinkedHashMap inMap) throws Exception + { + return fileManageDao.deleteCOMTNFILE(inMap); + } + + // 전체 파일을 삭제한다.(상세파일) + public int deleteFileDetailAll(LinkedHashMap inMap) throws Exception + { + return fileManageDao.deleteFileDetailAll(inMap); + } + + + // 이미지 파일에 대한 목록을 조회한다. + public List> selectImageFileList(LinkedHashMap inMap) throws Exception + { + return fileManageDao.selectImageFileList(inMap); + } + + + + +} diff --git a/auth/build.gradle b/auth/build.gradle index 33d24bb5..901ea32c 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -29,7 +29,9 @@ ext } dependencies -{ +{ + implementation project(':common') + implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-cache' diff --git a/auth/src/main/java/com/urpsys/baseauth/common/CommonUtil.java b/auth/src/main/java/com/urpsys/baseauth/common/CommonUtil.java index 62e5ae74..15de4324 100644 --- a/auth/src/main/java/com/urpsys/baseauth/common/CommonUtil.java +++ b/auth/src/main/java/com/urpsys/baseauth/common/CommonUtil.java @@ -1,456 +1,456 @@ -package com.urpsys.baseauth.common; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.SimpleTimeZone; -import java.util.Vector; - -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; - -import com.urpsys.baseauth.common.exception.CustomException; - -/** - * 공통 유틸리티를 모아둔 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자          수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28   나혁제           최초작성
- *
- *      
- */ - -public class CommonUtil -{ - /** - * nvl 메소드 - * @param inputStr - * @return - */ - public static String nvl(String inputStr) { - return (inputStr != null) ? inputStr.trim() : ""; - } - - /** - * nvl 메소드 - * @param inputStr - * @param defaultValue - * @return - */ - public static String nvl(String inputStr, String defaultValue) { - return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); - } - - /** - * nvl 메소드 - * @param inputObj - * @return - */ - public static String nvl(Object inputObj) { - return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; - } - - /** - * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 - * - * @param longTime long type 시간 - * @param dateFormat 변환할 포맷 - * @return 변환된 날짜 String - * @throws SystemException - */ - public static String getTimeString(long longTime, String dateFormat) throws CustomException { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); - - if (longTime < 0) - { - return ""; - } - else { - try { - return sdf.format(new Date(longTime)); - } catch (Exception e) { - throw new CustomException("Date 변환 오류"); - } - } - } - - /** - * 현재(한국기준) 시간정보를 얻는다.
- * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
- * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 - * 0~23시간 타입으로 Return.
- * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
- * @param format 얻고자하는 현재시간의 Type - * @return str 현재 한국 시간. - */ - public static String getKST(String format) - { - //1hour(ms) = 60s * 60m * 1000ms - int millisPerHour = 60 * 60 * 1000; - SimpleDateFormat fmt= new SimpleDateFormat(format); - - SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); - fmt.setTimeZone(timeZone); - - long time=System.currentTimeMillis(); - String str=fmt.format(new java.util.Date(time)); - return str; - } - - /** - * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 - * - * @param date - * string date (19991002) - * @param Day - * 기준이 되는 시간 - * @return String - */ - public static String getDatewithSpan(String date, long Day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month - * = Integer.valueOf(date.substring(4,6)).intValue(); int day = - * Integer.valueOf(date.substring(6,8)).intValue(); - * - * java.util.Calendar aDay = Calendar.getInstance(); - * aDay.set(year+1900,month,day); java.util.Calendar bDay - * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay - * = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); - * - * return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(date, Day, "D", vFORMAT); - - } - - /** - * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
- * - * @param date - * string date (20000315/2000031509/200003150915) - * @param unit - * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 - * @param type - * String type: D:Day H:Hour M:Minute - * @return String 계산된 문자열의 값. - */ - public static String getDatewithSpan(String date, long unit, String type, String strFormatType) - { - /* - * String formatType = strFormatType; int ihour = 0; int itime = 0; - * - * long dhm = 24 * 60 * 60 * 1000; - * - * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else - * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if - * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type - * + "은 부적절한 Type값입니다"; } - * - * switch (date.length()){ case (8): if (type.equals("H") || - * type.equals("M")) { return "HM-ERROR"; } - * - * break; case (10): if (type.equals("M")) { return "M-ERROR"; } - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case - * (12): - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = - * Integer.valueOf(date.substring(10,12)).intValue(); break; default: - * return "date Length Error"; } - * - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int - * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = - * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar - * aDay = Calendar.getInstance(); - * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay - * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date - * cDay = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String formatType = strFormatType; - int ihour = 0; - int itime = 0; - if(!(type.equals("D") || type.equals("H") || type.equals("M"))) - { - return type + "은 부적절한 Type값입니다"; - } - - switch(date.length()) - { - case (8): - if(type.equals("H") || type.equals("M")) - { - return "HM-ERROR"; - } - break; - case (10): - if(type.equals("M")) - { - return "M-ERROR"; - } - ihour = Integer.parseInt(date.substring(8, 10)); - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - break; - case (12): - ihour = Integer.parseInt(date.substring(8, 10)); - itime = Integer.parseInt(date.substring(10, 12)); - - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - // itime = Integer.valueOf(date.substring(10, 12)).intValue(); - break; - default: - return "date Length Error"; - } - int iyear = Integer.parseInt(date.substring(0, 4)); - int imonth = Integer.parseInt(date.substring(4, 6)); - int iday = Integer.parseInt(date.substring(6, 8)); - - /* - int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); - int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); - int iday = Integer.valueOf(date.substring(6, 8)).intValue(); - */ - - int imonth1 = imonth - 1; // 달은 0달부터 시작한다. - java.util.Calendar zDay = Calendar.getInstance(); - zDay.set(iyear, imonth1, iday, ihour, itime); - - if(type.equals("D")) - { - zDay.add(Calendar.DATE, (int) unit); - } - else if(type.equals("H")) - { - zDay.add(Calendar.HOUR_OF_DAY, (int) unit); - } - else if(type.equals("M")) - { - zDay.add(Calendar.MINUTE, (int) unit); - } - else - { - return type + "은 부적절한 Type값입니다"; - } - java.util.Date z1Day = zDay.getTime(); - java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); - return fmt2.format(z1Day); - - } - - /** - * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) - * - * @param day - * 더하려는 날짜 - * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 - */ - public static String getDatewithSpan(long day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 - * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; - * String str=fmt.format(new java.util.Date(time2)); - * - * return str; - */ - String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); - - } - - public static long stol(String str) - { - if(str == null ) return 0; - return (Long.valueOf(str).longValue()); - } - - /** - 문자열을 중 특정 문자열을 변환시킨다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param targeter 대상문자열 - @param target_str 변환될 대상문자열 - @param replace_str 변환될 문자열 - @return target_str이 replace_str로 변환된 문자열 - */ - public static String getReplacedString(String targeter, String target_str, String replace_str) - { - if( targeter == null - || target_str == null - || replace_str == null ) - return "debug : parameter value is null"; - - if(target_str.length() == 0) - return targeter; - - StringBuffer str = new StringBuffer(); - int start_ptr = 0; - int current_ptr = 0; - int increment_size = replace_str.length(); - if(increment_size == 0 ) increment_size = 1; - - while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) - { - str.append(targeter.substring(start_ptr, current_ptr)); - str.append(replace_str); - start_ptr = current_ptr + increment_size; - if(start_ptr >= targeter.length()) - break; - }//end while - - if(start_ptr == 0) - return targeter; - - if(start_ptr < targeter.length()) - str.append(targeter.substring(start_ptr)); - - return str.toString(); - }//getReplacedString(String targeter, String target_str, String replace_str) - - /** - 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg 대상문자열 - @param v_s1 변환될 대상문자열 - @param v_s2 변환될 문자열 - @return v_s1이 v_s2 변환된 문자열 - */ - - public static String getReplacedString2(String v_msg, String v_s1, String v_s2) - { - int idx = v_msg.indexOf(v_s1); - - if (idx == -1) return v_msg; - else - { - try - { - return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); - } catch (Exception e) - { - return v_msg.substring(0, idx) + v_s2; - } - } - - } - - public static String getReplacedString3(String sStr, String n1, String n2) - { - int iTmp = 0; - if (sStr == null) return ""; - - String sTmp = sStr; - StringBuffer sbSave = new StringBuffer(); - sbSave.append(""); - while (sTmp.indexOf(n1) > -1) - { - iTmp = sTmp.indexOf(n1); - sbSave.append(sTmp.substring(0,iTmp)); - sbSave.append(n2); - sTmp = sTmp.substring(iTmp + n1.length()); - } - sbSave.append(sTmp); - return sbSave.toString(); - } - - public static Vector arrToDouVector(String strArray, String strDelimt) - { - String[] stArray = strArray.split(strDelimt); - - double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); - Vector vReturn = new Vector(); - - if(dArray==null) return vReturn; - - for(double dTemp: dArray) - { - vReturn.add(dTemp); - } - - return vReturn; - - } - - public static String arrListToString(List list) - { - String strReturn=""; - - if(list == null ) return ""; - - for(int i=0; i"+strTemp); - // double dou = Double.parseDouble(strTemp); - // strReturn = strReturn+","+dou; - strReturn = strReturn+","+strTemp; - } - - strReturn = strReturn.substring(1); - - return strReturn; - - } - - /** - Map 데이터를 JSONObject로 변환. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg Map - @return JSONObject - */ - public static JSONObject getJsonFromMap(Map map) throws JSONException - { - JSONObject jsonData = new JSONObject(); - - for (String key : map.keySet()) - { - Object value = map.get(key); - if (value instanceof Map) - { - value = getJsonFromMap((Map) value); - } - jsonData.put(key, value); - } - return jsonData; - } - - - -} +package com.urpsys.baseauth.common; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; + +import com.urpsys.common.exception.CustomException; + +/** + * 공통 유틸리티를 모아둔 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자          수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28   나혁제           최초작성
+ *
+ *      
+ */ + +public class CommonUtil +{ + /** + * nvl 메소드 + * @param inputStr + * @return + */ + public static String nvl(String inputStr) { + return (inputStr != null) ? inputStr.trim() : ""; + } + + /** + * nvl 메소드 + * @param inputStr + * @param defaultValue + * @return + */ + public static String nvl(String inputStr, String defaultValue) { + return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); + } + + /** + * nvl 메소드 + * @param inputObj + * @return + */ + public static String nvl(Object inputObj) { + return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; + } + + /** + * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 + * + * @param longTime long type 시간 + * @param dateFormat 변환할 포맷 + * @return 변환된 날짜 String + * @throws SystemException + */ + public static String getTimeString(long longTime, String dateFormat) throws CustomException { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); + + if (longTime < 0) + { + return ""; + } + else { + try { + return sdf.format(new Date(longTime)); + } catch (Exception e) { + throw new CustomException("Date 변환 오류"); + } + } + } + + /** + * 현재(한국기준) 시간정보를 얻는다.
+ * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
+ * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 + * 0~23시간 타입으로 Return.
+ * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
+ * @param format 얻고자하는 현재시간의 Type + * @return str 현재 한국 시간. + */ + public static String getKST(String format) + { + //1hour(ms) = 60s * 60m * 1000ms + int millisPerHour = 60 * 60 * 1000; + SimpleDateFormat fmt= new SimpleDateFormat(format); + + SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); + fmt.setTimeZone(timeZone); + + long time=System.currentTimeMillis(); + String str=fmt.format(new java.util.Date(time)); + return str; + } + + /** + * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 + * + * @param date + * string date (19991002) + * @param Day + * 기준이 되는 시간 + * @return String + */ + public static String getDatewithSpan(String date, long Day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month + * = Integer.valueOf(date.substring(4,6)).intValue(); int day = + * Integer.valueOf(date.substring(6,8)).intValue(); + * + * java.util.Calendar aDay = Calendar.getInstance(); + * aDay.set(year+1900,month,day); java.util.Calendar bDay + * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay + * = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); + * + * return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(date, Day, "D", vFORMAT); + + } + + /** + * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
+ * + * @param date + * string date (20000315/2000031509/200003150915) + * @param unit + * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 + * @param type + * String type: D:Day H:Hour M:Minute + * @return String 계산된 문자열의 값. + */ + public static String getDatewithSpan(String date, long unit, String type, String strFormatType) + { + /* + * String formatType = strFormatType; int ihour = 0; int itime = 0; + * + * long dhm = 24 * 60 * 60 * 1000; + * + * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else + * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if + * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type + * + "은 부적절한 Type값입니다"; } + * + * switch (date.length()){ case (8): if (type.equals("H") || + * type.equals("M")) { return "HM-ERROR"; } + * + * break; case (10): if (type.equals("M")) { return "M-ERROR"; } + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case + * (12): + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = + * Integer.valueOf(date.substring(10,12)).intValue(); break; default: + * return "date Length Error"; } + * + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int + * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = + * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar + * aDay = Calendar.getInstance(); + * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay + * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date + * cDay = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String formatType = strFormatType; + int ihour = 0; + int itime = 0; + if(!(type.equals("D") || type.equals("H") || type.equals("M"))) + { + return type + "은 부적절한 Type값입니다"; + } + + switch(date.length()) + { + case (8): + if(type.equals("H") || type.equals("M")) + { + return "HM-ERROR"; + } + break; + case (10): + if(type.equals("M")) + { + return "M-ERROR"; + } + ihour = Integer.parseInt(date.substring(8, 10)); + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + break; + case (12): + ihour = Integer.parseInt(date.substring(8, 10)); + itime = Integer.parseInt(date.substring(10, 12)); + + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + // itime = Integer.valueOf(date.substring(10, 12)).intValue(); + break; + default: + return "date Length Error"; + } + int iyear = Integer.parseInt(date.substring(0, 4)); + int imonth = Integer.parseInt(date.substring(4, 6)); + int iday = Integer.parseInt(date.substring(6, 8)); + + /* + int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); + int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); + int iday = Integer.valueOf(date.substring(6, 8)).intValue(); + */ + + int imonth1 = imonth - 1; // 달은 0달부터 시작한다. + java.util.Calendar zDay = Calendar.getInstance(); + zDay.set(iyear, imonth1, iday, ihour, itime); + + if(type.equals("D")) + { + zDay.add(Calendar.DATE, (int) unit); + } + else if(type.equals("H")) + { + zDay.add(Calendar.HOUR_OF_DAY, (int) unit); + } + else if(type.equals("M")) + { + zDay.add(Calendar.MINUTE, (int) unit); + } + else + { + return type + "은 부적절한 Type값입니다"; + } + java.util.Date z1Day = zDay.getTime(); + java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); + return fmt2.format(z1Day); + + } + + /** + * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) + * + * @param day + * 더하려는 날짜 + * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 + */ + public static String getDatewithSpan(long day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 + * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; + * String str=fmt.format(new java.util.Date(time2)); + * + * return str; + */ + String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); + + } + + public static long stol(String str) + { + if(str == null ) return 0; + return (Long.valueOf(str).longValue()); + } + + /** + 문자열을 중 특정 문자열을 변환시킨다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param targeter 대상문자열 + @param target_str 변환될 대상문자열 + @param replace_str 변환될 문자열 + @return target_str이 replace_str로 변환된 문자열 + */ + public static String getReplacedString(String targeter, String target_str, String replace_str) + { + if( targeter == null + || target_str == null + || replace_str == null ) + return "debug : parameter value is null"; + + if(target_str.length() == 0) + return targeter; + + StringBuffer str = new StringBuffer(); + int start_ptr = 0; + int current_ptr = 0; + int increment_size = replace_str.length(); + if(increment_size == 0 ) increment_size = 1; + + while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) + { + str.append(targeter.substring(start_ptr, current_ptr)); + str.append(replace_str); + start_ptr = current_ptr + increment_size; + if(start_ptr >= targeter.length()) + break; + }//end while + + if(start_ptr == 0) + return targeter; + + if(start_ptr < targeter.length()) + str.append(targeter.substring(start_ptr)); + + return str.toString(); + }//getReplacedString(String targeter, String target_str, String replace_str) + + /** + 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg 대상문자열 + @param v_s1 변환될 대상문자열 + @param v_s2 변환될 문자열 + @return v_s1이 v_s2 변환된 문자열 + */ + + public static String getReplacedString2(String v_msg, String v_s1, String v_s2) + { + int idx = v_msg.indexOf(v_s1); + + if (idx == -1) return v_msg; + else + { + try + { + return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); + } catch (Exception e) + { + return v_msg.substring(0, idx) + v_s2; + } + } + + } + + public static String getReplacedString3(String sStr, String n1, String n2) + { + int iTmp = 0; + if (sStr == null) return ""; + + String sTmp = sStr; + StringBuffer sbSave = new StringBuffer(); + sbSave.append(""); + while (sTmp.indexOf(n1) > -1) + { + iTmp = sTmp.indexOf(n1); + sbSave.append(sTmp.substring(0,iTmp)); + sbSave.append(n2); + sTmp = sTmp.substring(iTmp + n1.length()); + } + sbSave.append(sTmp); + return sbSave.toString(); + } + + public static Vector arrToDouVector(String strArray, String strDelimt) + { + String[] stArray = strArray.split(strDelimt); + + double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); + Vector vReturn = new Vector(); + + if(dArray==null) return vReturn; + + for(double dTemp: dArray) + { + vReturn.add(dTemp); + } + + return vReturn; + + } + + public static String arrListToString(List list) + { + String strReturn=""; + + if(list == null ) return ""; + + for(int i=0; i"+strTemp); + // double dou = Double.parseDouble(strTemp); + // strReturn = strReturn+","+dou; + strReturn = strReturn+","+strTemp; + } + + strReturn = strReturn.substring(1); + + return strReturn; + + } + + /** + Map 데이터를 JSONObject로 변환. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg Map + @return JSONObject + */ + public static JSONObject getJsonFromMap(Map map) throws JSONException + { + JSONObject jsonData = new JSONObject(); + + for (String key : map.keySet()) + { + Object value = map.get(key); + if (value instanceof Map) + { + value = getJsonFromMap((Map) value); + } + jsonData.put(key, value); + } + return jsonData; + } + + + +} diff --git a/auth/src/main/java/com/urpsys/baseauth/common/DataSourceUtil.java b/auth/src/main/java/com/urpsys/baseauth/common/DataSourceUtil.java deleted file mode 100644 index d850aa45..00000000 --- a/auth/src/main/java/com/urpsys/baseauth/common/DataSourceUtil.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.urpsys.baseauth.common; - -import javax.sql.DataSource; - -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.springframework.core.env.Environment; -import org.springframework.core.io.Resource; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; - -import com.urpsys.baseauth.common.crypto.Aes256Cipher; -import com.urpsys.baseauth.common.exception.CustomException; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; - -/** - * Datasource 생성하는 유틸리티 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28   나혁제         최초작성
- *
- * 
- */ - -public class DataSourceUtil -{ - /** - * 데이터 소스 만드는 메소드 - * @param dataSourceName - * @param env - * @param cipher - * @return - */ - public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher) - { - HikariConfig config = new HikariConfig(); - - config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); - config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); - - config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username"))); - config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password"))); - - config.setAutoCommit(false); - - config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" ))); - config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" ))); - config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" ))); - config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" ))); - - config.addDataSourceProperty("cachePrepStmts" , "true"); - config.addDataSourceProperty("prepStmtCacheSize" , "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048"); - - return new HikariDataSource(config); - } - - /** - * SqlSessionFactory 만드는 메소드 - * @param dataSource - * @param configLocation - * @param mapperLocation - * @return - * @throws CustomException - */ - public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation, - Resource[] mapperLocation) throws CustomException - { - SqlSessionFactory sqlSessionFactory; - - try { - SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); - sessionFactoryBean.setDataSource(dataSource); - sessionFactoryBean.setConfigLocation(configLocation); - sessionFactoryBean.setMapperLocations(mapperLocation); - - sqlSessionFactory = sessionFactoryBean.getObject(); - } - catch (Exception ex) - { - throw new CustomException(ex.getMessage()); - } - - return sqlSessionFactory; - } - - /** - * 트랜잭션 처리 메소드 - * @param dataSource - * @return - */ - public static DataSourceTransactionManager createTxManager(DataSource dataSource) - { - DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource); - txManager.setGlobalRollbackOnParticipationFailure(false); - - return txManager; - } - - //end method -} diff --git a/auth/src/main/java/com/urpsys/baseauth/common/crypto/Aes256Cipher.java b/auth/src/main/java/com/urpsys/baseauth/common/crypto/Aes256Cipher.java deleted file mode 100644 index 6407a4c8..00000000 --- a/auth/src/main/java/com/urpsys/baseauth/common/crypto/Aes256Cipher.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.urpsys.baseauth.common.crypto; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.util.Properties; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.springframework.core.io.ClassPathResource; - -import com.urpsys.baseauth.common.CommonUtil; - -/** - * aes 256 암호화 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28     나혁제         최초작성
- *
- * 
- */ - -public class Aes256Cipher -{ - private SecretKey keySpec; // keySpec - private IvParameterSpec ivSpec; // ivSpec - - /** - * Aes256Cipher 생성자 - * - * @param keyFile 키 파일 위치를 입력 받음 - * @throws IOException 파일 io 시 발생하는 익셉션 - * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 - * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 - */ - public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException { - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - InputStream fis = null; - String secretKey = null; - - try - { - fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream(); - - Properties props = new Properties(); - props.load(fis); - secretKey = props.getProperty("aes256.key"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - fis.close(); - } - - byte[] secretKeyBytes = Hex.decodeHex(secretKey); - - if (secretKeyBytes.length != 32) { - throw new InvalidKeyException("Invalid key (key length is not valid) "); - } - - byte[] ivBytes = new byte[16]; - - System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); - - keySpec = new SecretKeySpec(secretKeyBytes, "AES"); - ivSpec = new IvParameterSpec(ivBytes); - } - - /** - * encryption 하는 메소드 - * - * @param plainStr 평문을 입력 받음 - * @return 암호화된 문자열 - */ - public String encrypt(String plainStr) { - if (plainStr == null) { - return null; - } - - String encryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); - byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); - encryptedStr = new String(Base64.encodeBase64(encrypted)); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return encryptedStr; - } - - /** - * 암호화된 문자열을 복호화하는 메소드 - * - * @param encryptedStr 암호화된 문자열 - * @return 암호화가 해제된 문자열 - */ - public String decrypt(String encryptedStr) { - if (encryptedStr == null) - { - return null; - } - - String decryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); - decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return decryptedStr; - } -} diff --git a/auth/src/main/java/com/urpsys/baseauth/common/exception/CustomException.java b/auth/src/main/java/com/urpsys/baseauth/common/exception/CustomException.java deleted file mode 100644 index bcf20646..00000000 --- a/auth/src/main/java/com/urpsys/baseauth/common/exception/CustomException.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.urpsys.baseauth.common.exception; - -import java.sql.SQLSyntaxErrorException; - -import lombok.Getter; - -/** - * Custom exception 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28   나혁제         최초작성
- *
- * 
- */ - -public class CustomException extends Exception -{ - private static final long serialVersionUID = 3559302713942492181L; - - @Getter - private String errorCode; - - @Getter - private String errorMsg; - - /** - * 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스) - * 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로 - * 변경 가능성 있음 - * @param throwable - */ - public CustomException(Throwable throwable) { - Throwable rootThrowable = getRootCause(throwable); - - // TODO 에러 코드는 상세 정의해서 define 해야 함 - if(rootThrowable instanceof SQLSyntaxErrorException) { - this.errorCode = "100"; - this.errorMsg = "SQL 오류"; - } else if(rootThrowable instanceof ArithmeticException) { - this.errorCode = "200"; - this.errorMsg = "연산 오류"; - } else { - this.errorCode = "900"; - this.errorMsg = "Unknown Error"; - } - } - - /** - * 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅) - * @param errorMsg - */ - public CustomException(String errorMsg) { - super(errorMsg); - this.errorCode = "0"; - this.errorMsg = errorMsg; - } - - /** - * 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해 - * 에러코드를 int 값으로 받으면 string으로 변환하여 저장) - * @param errorCode - * @param errorMsg - */ - public CustomException(int errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = String.valueOf(errorCode); - this.errorMsg = errorMsg; - } - - /** - * 생성자(에러코드, 에러메시지를 받아 세팅) - * @param errorCode - * @param errorMsg - */ - public CustomException(String errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - /** - * stack에서 에러코드 중 root cause를 찾아내는 메소드 - * @param throwable - * @return - */ - private Throwable getRootCause(Throwable throwable) { - Throwable cause = throwable.getCause(); - - if (cause == null) { - return throwable; - } - - while (true) { - - if(cause.getCause() == null) { - break; - } else { - cause = cause.getCause(); - } - } - - return cause; - } -} diff --git a/auth/src/main/java/com/urpsys/baseauth/config/EncryptConfig.java b/auth/src/main/java/com/urpsys/baseauth/config/EncryptConfig.java index f2d7bf12..f427cbab 100644 --- a/auth/src/main/java/com/urpsys/baseauth/config/EncryptConfig.java +++ b/auth/src/main/java/com/urpsys/baseauth/config/EncryptConfig.java @@ -1,38 +1,38 @@ -package com.urpsys.baseauth.config; - -import java.io.IOException; -import java.security.InvalidKeyException; -import org.apache.commons.codec.DecoderException; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.urpsys.baseauth.common.crypto.Aes256Cipher; - -/** - * 암호화 유틸리티를 등록하는 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28   나혁제         최초작성
- *
- * 
- */ - -@Configuration -public class EncryptConfig -{ - @Bean(name="aes256Cipher") - public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException - { - return new Aes256Cipher(); - } -} +package com.urpsys.baseauth.config; + +import java.io.IOException; +import java.security.InvalidKeyException; +import org.apache.commons.codec.DecoderException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.urpsys.common.crypto.Aes256Cipher; + +/** + * 암호화 유틸리티를 등록하는 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28   나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +public class EncryptConfig +{ + @Bean(name="aes256Cipher") + public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException + { + return new Aes256Cipher(); + } +} diff --git a/auth/src/main/java/com/urpsys/baseauth/config/Oauth2AuthorizationConfig.java b/auth/src/main/java/com/urpsys/baseauth/config/Oauth2AuthorizationConfig.java index 14817c0b..67e21444 100644 --- a/auth/src/main/java/com/urpsys/baseauth/config/Oauth2AuthorizationConfig.java +++ b/auth/src/main/java/com/urpsys/baseauth/config/Oauth2AuthorizationConfig.java @@ -1,206 +1,206 @@ -package com.urpsys.baseauth.config; - -import java.util.Arrays; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ClassPathResource; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; -import org.springframework.security.oauth2.provider.approval.ApprovalStore; -import org.springframework.security.oauth2.provider.approval.JdbcApprovalStore; -import org.springframework.security.oauth2.provider.token.TokenEnhancerChain; -import org.springframework.security.oauth2.provider.token.TokenStore; -import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; -import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; -import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; - -import com.urpsys.baseauth.common.crypto.Aes256Cipher; -import com.urpsys.baseauth.service.UserDetailService; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; - -import lombok.extern.slf4j.Slf4j; - -/** - * 인증서버 기본세팅 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * @comment : - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28  나혁제         최초작성
- *
- * 
- */ - -@Slf4j -@EnableAuthorizationServer -@Configuration -public class Oauth2AuthorizationConfig extends AuthorizationServerConfigurerAdapter -{ - @Autowired - private UserDetailService userDetailService; - - @Autowired - private AuthenticationManager authenticationManager; - - /* DB 접속정보 */ - @Autowired - private DataSource dataSource; - - /* 환경정보 */ - @Autowired - private Environment env; - - /* aes256 암호화 유틸리티 */ - @Autowired - private Aes256Cipher aes256Cipher; - - @Autowired - private PasswordEncoder passwordEncoder; - - /** - * 인증허용범위 설정 (5번 설정등록) - * - * @param 인증 범위 객체 - * @return 인증 범위 상세객체 - */ - @Override - public void configure(AuthorizationServerSecurityConfigurer security) throws Exception - { - log.info(">>>>>>>>>> 5. Oauth2AuthorizationConfig | AuthorizationServerSecurityConfigurer | configure | 허용범위설정 <<<<<<<<<<"); - - security.tokenKeyAccess("permitAll()") - .checkTokenAccess("isAuthenticated()") - .allowFormAuthenticationForClients() - ; - - log.info("<<<<<<<<<< 5. Oauth2AuthorizationConfig | AuthorizationServerSecurityConfigurer | configure | 허용범위설정 >>>>>>>>>>"); - - } - - /** - * 접근 client 설정 (4번 설정등록) - * - * @param 클라이언트 접근정보 객체 - * @return 클라이언트 접근정보 상세 객체 - */ - @Override - public void configure(ClientDetailsServiceConfigurer clients) throws Exception - { - log.info(">>>>>>>>>> 4. Oauth2AuthorizationConfig | ClientDetailsServiceConfigurer | configure | 접근 클라이언트 설정 <<<<<<<<<<"); - - clients.inMemory() - .withClient("clientId") - .secret(passwordEncoder.encode("secretKey")) - .authorizedGrantTypes("authorization_code","password", "refresh_token", "client_credentials") // 가능한 토큰 발행 타입 - .scopes("read", "write") // 가능한 접근 범위 - .accessTokenValiditySeconds (60*60*24) // access 토큰 유효 시간 : 24시간 - .refreshTokenValiditySeconds(60*60*24) // refresh 토큰 유효 시간 : 24시간 - .redirectUris("http://localhost:9010/callback") // 가능한 redirect uri - .autoApprove(true); // 권한 동의는 자동으로 yes (false 로 할시 권한 동의 여부를 묻는다.) - - log.info("<<<<<<<<<< 4. Oauth2AuthorizationConfig | ClientDetailsServiceConfigurer | configure | 접근 클라이언트 설정 >>>>>>>>>>"); - } - - /** - * 인증, 토큰유형, 토큰발행처리등 토큰발행정보설정 (3번 설정등록) - * - * @param 인증,토큰정보 객체 - * @return 인증,토큰정보 상세객체 - */ - @Override - public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception - { - log.info(">>>>>>>>>> 3. Oauth2AuthorizationConfig | AuthorizationServerEndpointsConfigurer | configure | 인증, 토큰 설정 <<<<<<<<<<"); - - TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain(); - tokenEnhancerChain.setTokenEnhancers(Arrays.asList(new CustomTokenEnhancer(), jwtAccessTokenConverter())); // 토큰 enhancer 객체 생성 - - endpoints.authenticationManager(authenticationManager) // grant_type password를 사용하기 위함 - // (manager 지정 안할시 password type 으로 토큰 발행시 Unsupported grant type: password 오류 발생) - .userDetailsService(userDetailService) // refrash token 발행시 유저 정보 검사 하는데 사용하는 서비스 설정 - .tokenEnhancer(tokenEnhancerChain) // enhancer 설정 - .accessTokenConverter(jwtAccessTokenConverter()) - .approvalStore(approvalStore()) - ; - - log.info("<<<<<<<<<< 3. Oauth2AuthorizationConfig | AuthorizationServerEndpointsConfigurer | configure | 인증, 토큰 설정 >>>>>>>>>>"); - } - - - // 토큰 DB 저장 - public HikariDataSource datasource2() - { - HikariConfig config = new HikariConfig(); - - String dataSourceName = "primarydb"; - - config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); - config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); - - config.setUsername (aes256Cipher.decrypt(env.getProperty(dataSourceName + ".username"))); - config.setPassword (aes256Cipher.decrypt(env.getProperty(dataSourceName + ".password"))); - - return new HikariDataSource(config); - } - - // 토큰 DB 저장 - @Bean - public TokenStore tokenStore() - { - DataSource ds2 = datasource2(); - return new JdbcTokenStore(ds2); - } - - // 권한 동의 DB 저장 - @Bean - public ApprovalStore approvalStore() - { - DataSource ds2 = datasource2(); - return new JdbcApprovalStore(ds2); - } - - - /** - * 자바토큰 발행 및 암호와 처리 - * - * @param 인증,토큰정보 객체 - * @return 인증,토큰정보 상세객체 - */ - @Bean - public JwtAccessTokenConverter jwtAccessTokenConverter() - { - // RSA 암호화 : 비 대칭키 암호화 : 공개키로 암호화 하면 개인키로 복호화 - KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwtkey.jks"), "corin1234".toCharArray()); - JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); - converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwtkey")); - - return converter; - } - - - - - - - -} +package com.urpsys.baseauth.config; + +import java.util.Arrays; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.io.ClassPathResource; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; +import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.approval.ApprovalStore; +import org.springframework.security.oauth2.provider.approval.JdbcApprovalStore; +import org.springframework.security.oauth2.provider.token.TokenEnhancerChain; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.baseauth.service.UserDetailService; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; + +import lombok.extern.slf4j.Slf4j; + +/** + * 인증서버 기본세팅 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * @comment : + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28  나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@EnableAuthorizationServer +@Configuration +public class Oauth2AuthorizationConfig extends AuthorizationServerConfigurerAdapter +{ + @Autowired + private UserDetailService userDetailService; + + @Autowired + private AuthenticationManager authenticationManager; + + /* DB 접속정보 */ + @Autowired + private DataSource dataSource; + + /* 환경정보 */ + @Autowired + private Environment env; + + /* aes256 암호화 유틸리티 */ + @Autowired + private Aes256Cipher aes256Cipher; + + @Autowired + private PasswordEncoder passwordEncoder; + + /** + * 인증허용범위 설정 (5번 설정등록) + * + * @param 인증 범위 객체 + * @return 인증 범위 상세객체 + */ + @Override + public void configure(AuthorizationServerSecurityConfigurer security) throws Exception + { + log.info(">>>>>>>>>> 5. Oauth2AuthorizationConfig | AuthorizationServerSecurityConfigurer | configure | 허용범위설정 <<<<<<<<<<"); + + security.tokenKeyAccess("permitAll()") + .checkTokenAccess("isAuthenticated()") + .allowFormAuthenticationForClients() + ; + + log.info("<<<<<<<<<< 5. Oauth2AuthorizationConfig | AuthorizationServerSecurityConfigurer | configure | 허용범위설정 >>>>>>>>>>"); + + } + + /** + * 접근 client 설정 (4번 설정등록) + * + * @param 클라이언트 접근정보 객체 + * @return 클라이언트 접근정보 상세 객체 + */ + @Override + public void configure(ClientDetailsServiceConfigurer clients) throws Exception + { + log.info(">>>>>>>>>> 4. Oauth2AuthorizationConfig | ClientDetailsServiceConfigurer | configure | 접근 클라이언트 설정 <<<<<<<<<<"); + + clients.inMemory() + .withClient("clientId") + .secret(passwordEncoder.encode("secretKey")) + .authorizedGrantTypes("authorization_code","password", "refresh_token", "client_credentials") // 가능한 토큰 발행 타입 + .scopes("read", "write") // 가능한 접근 범위 + .accessTokenValiditySeconds (60*60*24) // access 토큰 유효 시간 : 24시간 + .refreshTokenValiditySeconds(60*60*24) // refresh 토큰 유효 시간 : 24시간 + .redirectUris("http://localhost:9010/callback") // 가능한 redirect uri + .autoApprove(true); // 권한 동의는 자동으로 yes (false 로 할시 권한 동의 여부를 묻는다.) + + log.info("<<<<<<<<<< 4. Oauth2AuthorizationConfig | ClientDetailsServiceConfigurer | configure | 접근 클라이언트 설정 >>>>>>>>>>"); + } + + /** + * 인증, 토큰유형, 토큰발행처리등 토큰발행정보설정 (3번 설정등록) + * + * @param 인증,토큰정보 객체 + * @return 인증,토큰정보 상세객체 + */ + @Override + public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception + { + log.info(">>>>>>>>>> 3. Oauth2AuthorizationConfig | AuthorizationServerEndpointsConfigurer | configure | 인증, 토큰 설정 <<<<<<<<<<"); + + TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain(); + tokenEnhancerChain.setTokenEnhancers(Arrays.asList(new CustomTokenEnhancer(), jwtAccessTokenConverter())); // 토큰 enhancer 객체 생성 + + endpoints.authenticationManager(authenticationManager) // grant_type password를 사용하기 위함 + // (manager 지정 안할시 password type 으로 토큰 발행시 Unsupported grant type: password 오류 발생) + .userDetailsService(userDetailService) // refrash token 발행시 유저 정보 검사 하는데 사용하는 서비스 설정 + .tokenEnhancer(tokenEnhancerChain) // enhancer 설정 + .accessTokenConverter(jwtAccessTokenConverter()) + .approvalStore(approvalStore()) + ; + + log.info("<<<<<<<<<< 3. Oauth2AuthorizationConfig | AuthorizationServerEndpointsConfigurer | configure | 인증, 토큰 설정 >>>>>>>>>>"); + } + + + // 토큰 DB 저장 + public HikariDataSource datasource2() + { + HikariConfig config = new HikariConfig(); + + String dataSourceName = "primarydb"; + + config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); + config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); + + config.setUsername (aes256Cipher.decrypt(env.getProperty(dataSourceName + ".username"))); + config.setPassword (aes256Cipher.decrypt(env.getProperty(dataSourceName + ".password"))); + + return new HikariDataSource(config); + } + + // 토큰 DB 저장 + @Bean + public TokenStore tokenStore() + { + DataSource ds2 = datasource2(); + return new JdbcTokenStore(ds2); + } + + // 권한 동의 DB 저장 + @Bean + public ApprovalStore approvalStore() + { + DataSource ds2 = datasource2(); + return new JdbcApprovalStore(ds2); + } + + + /** + * 자바토큰 발행 및 암호와 처리 + * + * @param 인증,토큰정보 객체 + * @return 인증,토큰정보 상세객체 + */ + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter() + { + // RSA 암호화 : 비 대칭키 암호화 : 공개키로 암호화 하면 개인키로 복호화 + KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwtkey.jks"), "corin1234".toCharArray()); + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); + converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwtkey")); + + return converter; + } + + + + + + + +} diff --git a/auth/src/main/java/com/urpsys/baseauth/config/PrimaryDbConfig.java b/auth/src/main/java/com/urpsys/baseauth/config/PrimaryDbConfig.java index c5d858c8..36778cf9 100644 --- a/auth/src/main/java/com/urpsys/baseauth/config/PrimaryDbConfig.java +++ b/auth/src/main/java/com/urpsys/baseauth/config/PrimaryDbConfig.java @@ -1,113 +1,113 @@ -package com.urpsys.baseauth.config; - -import java.io.IOException; -import java.sql.Connection; - -import javax.sql.DataSource; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.urpsys.baseauth.common.DataSourceUtil; -import com.urpsys.baseauth.common.crypto.Aes256Cipher; -import com.urpsys.baseauth.common.exception.CustomException; - -/** - * primary db config 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28  나혁제         최초작성
- *
- * 
- */ - -@Configuration -@EnableTransactionManagement -@MapperScan(value="com.urpsys.baseauth.dao", sqlSessionFactoryRef="primarySqlSessionFactory") -public class PrimaryDbConfig -{ - /* spring environment class */ - @Autowired - private Environment env; - - /* aes256 암호화 유틸리티 */ - @Autowired - private Aes256Cipher aes256Cipher; - - - /** - * 데이터소스 등록하는 메소드 - * @return - */ - @Bean(name="primaryDataSource") - public DataSource primaryDataSource() - { - return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); - } - - /** - * sqlsessionfactory 등록하는 메소드 - * - * @param dataSource - * @param context - * @return - * @throws SchedulerException - * @throws IOException - */ - @Bean(name="primarySqlSessionFactory") - public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) - throws CustomException, IOException - { - SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource - , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") - , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") - ); - - sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); - - return sqlSessionFactory; - } - - /** - * sqlsessiontemplate 등록하는 메소드 - * @param primarySqlSessionFactory - * @return - */ - @Bean("primarySqlSessionTemplate") - public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) - { - return new SqlSessionTemplate(primarySqlSessionFactory); - } - - /** - * 트랜잭션 매니저 등록하는 메소드 - * @param dataSource - * @return - */ - @Bean(name="primaryTxManager") - public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) - { - return DataSourceUtil.createTxManager(dataSource); - } -} - +package com.urpsys.baseauth.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.common.util.DataSourceUtil; +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; + +/** + * primary db config 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28  나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan(value="com.urpsys.baseauth.dao", sqlSessionFactoryRef="primarySqlSessionFactory") +public class PrimaryDbConfig +{ + /* spring environment class */ + @Autowired + private Environment env; + + /* aes256 암호화 유틸리티 */ + @Autowired + private Aes256Cipher aes256Cipher; + + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="primaryDataSource") + public DataSource primaryDataSource() + { + return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="primarySqlSessionFactory") + public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") + , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("primarySqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) + { + return new SqlSessionTemplate(primarySqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="primaryTxManager") + public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/batch/build.gradle b/batch/build.gradle index 7ee31cbd..907d56f3 100644 --- a/batch/build.gradle +++ b/batch/build.gradle @@ -32,7 +32,9 @@ ext } dependencies -{ +{ + implementation project(':common') + implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-quartz' diff --git a/batch/src/main/java/com/urpsys/basebatch/common/crypto/Aes256Cipher.java b/batch/src/main/java/com/urpsys/basebatch/common/crypto/Aes256Cipher.java deleted file mode 100644 index e390933d..00000000 --- a/batch/src/main/java/com/urpsys/basebatch/common/crypto/Aes256Cipher.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.urpsys.basebatch.common.crypto; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.util.Properties; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import com.urpsys.basebatch.common.util.CommonUtil; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.springframework.core.io.ClassPathResource; - -/** - * aes 256 암호화 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03     나혁제         최초작성
- *
- * 
- */ - -public class Aes256Cipher -{ - private SecretKey keySpec; // keySpec - private IvParameterSpec ivSpec; // ivSpec - - /** - * Aes256Cipher 생성자 - * - * @param keyFile 키 파일 위치를 입력 받음 - * @throws IOException 파일 io 시 발생하는 익셉션 - * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 - * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 - */ - public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException - { - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - InputStream fis = null; - String secretKey = null; - - try - { - fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream(); - - Properties props = new Properties(); - props.load(fis); - secretKey = props.getProperty("aes256.key"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - fis.close(); - } - - byte[] secretKeyBytes = Hex.decodeHex(secretKey); - - if (secretKeyBytes.length != 32) { - throw new InvalidKeyException("Invalid key (key length is not valid) "); - } - - byte[] ivBytes = new byte[16]; - - System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); - - keySpec = new SecretKeySpec(secretKeyBytes, "AES"); - ivSpec = new IvParameterSpec(ivBytes); - } - - /** - * encryption 하는 메소드 - * - * @param plainStr 평문을 입력 받음 - * @return 암호화된 문자열 - */ - public String encrypt(String plainStr) - { - if (plainStr == null) - { - return null; - } - - String encryptedStr = null; - - try - { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); - byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); - encryptedStr = new String(Base64.encodeBase64(encrypted)); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - return encryptedStr; - } - - /** - * 암호화된 문자열을 복호화하는 메소드 - * - * @param encryptedStr 암호화된 문자열 - * @return 암호화가 해제된 문자열 - */ - public String decrypt(String encryptedStr) - { - if (encryptedStr == null) - { - return null; - } - - String decryptedStr = null; - - try - { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); - decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - return decryptedStr; - } -} diff --git a/batch/src/main/java/com/urpsys/basebatch/common/exception/CustomException.java b/batch/src/main/java/com/urpsys/basebatch/common/exception/CustomException.java deleted file mode 100644 index 6f355f6f..00000000 --- a/batch/src/main/java/com/urpsys/basebatch/common/exception/CustomException.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.urpsys.basebatch.common.exception; - -import java.sql.SQLSyntaxErrorException; - -import lombok.Getter; - -/** - * Custom exception 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- * 
- */ - -public class CustomException extends Exception -{ - private static final long serialVersionUID = 3559302713942492181L; - - @Getter - private String errorCode; - - @Getter - private String errorMsg; - - /** - * 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스) - * 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로 - * 변경 가능성 있음 - * @param throwable - */ - public CustomException(Throwable throwable) - { - Throwable rootThrowable = getRootCause(throwable); - - // TODO 에러 코드는 상세 정의해서 define 해야 함 - if(rootThrowable instanceof SQLSyntaxErrorException) - { - this.errorCode = "100"; - this.errorMsg = "SQL 오류"; - } - else if(rootThrowable instanceof ArithmeticException) - { - this.errorCode = "200"; - this.errorMsg = "연산 오류"; - } - else - { - this.errorCode = "900"; - this.errorMsg = "Unknown Error"; - } - } - - /** - * 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅) - * @param errorMsg - */ - public CustomException(String errorMsg) - { - super(errorMsg); - this.errorCode = "0"; - this.errorMsg = errorMsg; - } - - /** - * 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해 - * 에러코드를 int 값으로 받으면 string으로 변환하여 저장) - * @param errorCode - * @param errorMsg - */ - public CustomException(int errorCode, String errorMsg) - { - super(errorMsg); - this.errorCode = String.valueOf(errorCode); - this.errorMsg = errorMsg; - } - - /** - * 생성자(에러코드, 에러메시지를 받아 세팅) - * @param errorCode - * @param errorMsg - */ - public CustomException(String errorCode, String errorMsg) - { - super(errorMsg); - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - /** - * stack에서 에러코드 중 root cause를 찾아내는 메소드 - * @param throwable - * @return - */ - private Throwable getRootCause(Throwable throwable) - { - Throwable cause = throwable.getCause(); - - if (cause == null) { - return throwable; - } - - while (true) { - - if(cause.getCause() == null) { - break; - } else { - cause = cause.getCause(); - } - } - - return cause; - } -} diff --git a/batch/src/main/java/com/urpsys/basebatch/common/util/CommonUtil.java b/batch/src/main/java/com/urpsys/basebatch/common/util/CommonUtil.java index 933591ad..c11dd1a8 100644 --- a/batch/src/main/java/com/urpsys/basebatch/common/util/CommonUtil.java +++ b/batch/src/main/java/com/urpsys/basebatch/common/util/CommonUtil.java @@ -1,524 +1,524 @@ -package com.urpsys.basebatch.common.util; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Base64; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.SimpleTimeZone; -import java.util.Vector; - -import com.urpsys.basebatch.common.exception.CustomException; - -/** - * 공통 유틸리티를 모아둔 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- *      
- */ - -public class CommonUtil -{ - /** - * nvl 메소드 - * @param inputStr - * @return - */ - public static String nvl(String inputStr) - { - return (inputStr != null) ? inputStr.trim() : ""; - } - - /** - * nvl 메소드 - * @param inputStr - * @param defaultValue - * @return - */ - public static String nvl(String inputStr, String defaultValue) - { - return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); - } - - /** - * nvl 메소드 - * @param inputObj - * @return - */ - public static String nvl(Object inputObj) - { - return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; - } - - /** - * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 - * - * @param longTime long type 시간 - * @param dateFormat 변환할 포맷 - * @return 변환된 날짜 String - * @throws SystemException - */ - public static String getTimeString(long longTime, String dateFormat) throws CustomException - { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); - - if (longTime < 0) - { - return ""; - } - else - { - try - { - return sdf.format(new Date(longTime)); - } - catch (Exception e) - { - throw new CustomException("Date 변환 오류"); - } - } - } - - /** - * 현재(한국기준) 시간정보를 얻는다.
- * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
- * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 - * 0~23시간 타입으로 Return.
- * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
- * @param format 얻고자하는 현재시간의 Type - * @return str 현재 한국 시간. - */ - public static String getKST(String format) - { - //1hour(ms) = 60s * 60m * 1000ms - int millisPerHour = 60 * 60 * 1000; - SimpleDateFormat fmt= new SimpleDateFormat(format); - - SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); - fmt.setTimeZone(timeZone); - - long time=System.currentTimeMillis(); - String str=fmt.format(new java.util.Date(time)); - return str; - } - - /** - * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 - * - * @param date - * string date (19991002) - * @param Day - * 기준이 되는 시간 - * @return String - */ - public static String getDatewithSpan(String date, long Day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month - * = Integer.valueOf(date.substring(4,6)).intValue(); int day = - * Integer.valueOf(date.substring(6,8)).intValue(); - * - * java.util.Calendar aDay = Calendar.getInstance(); - * aDay.set(year+1900,month,day); java.util.Calendar bDay - * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay - * = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); - * - * return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(date, Day, "D", vFORMAT); - - } - - /** - * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
- * - * @param date - * string date (20000315/2000031509/200003150915) - * @param unit - * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 - * @param type - * String type: D:Day H:Hour M:Minute - * @return String 계산된 문자열의 값. - */ - public static String getDatewithSpan(String date, long unit, String type, String strFormatType) - { - /* - * String formatType = strFormatType; int ihour = 0; int itime = 0; - * - * long dhm = 24 * 60 * 60 * 1000; - * - * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else - * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if - * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type - * + "은 부적절한 Type값입니다"; } - * - * switch (date.length()){ case (8): if (type.equals("H") || - * type.equals("M")) { return "HM-ERROR"; } - * - * break; case (10): if (type.equals("M")) { return "M-ERROR"; } - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case - * (12): - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = - * Integer.valueOf(date.substring(10,12)).intValue(); break; default: - * return "date Length Error"; } - * - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int - * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = - * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar - * aDay = Calendar.getInstance(); - * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay - * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date - * cDay = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String formatType = strFormatType; - int ihour = 0; - int itime = 0; - if(!(type.equals("D") || type.equals("H") || type.equals("M"))) - { - return type + "은 부적절한 Type값입니다"; - } - - switch(date.length()) - { - case (8): - if(type.equals("H") || type.equals("M")) - { - return "HM-ERROR"; - } - break; - case (10): - if(type.equals("M")) - { - return "M-ERROR"; - } - ihour = Integer.parseInt(date.substring(8, 10)); - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - break; - case (12): - ihour = Integer.parseInt(date.substring(8, 10)); - itime = Integer.parseInt(date.substring(10, 12)); - - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - // itime = Integer.valueOf(date.substring(10, 12)).intValue(); - break; - default: - return "date Length Error"; - } - int iyear = Integer.parseInt(date.substring(0, 4)); - int imonth = Integer.parseInt(date.substring(4, 6)); - int iday = Integer.parseInt(date.substring(6, 8)); - - /* - int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); - int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); - int iday = Integer.valueOf(date.substring(6, 8)).intValue(); - */ - - int imonth1 = imonth - 1; // 달은 0달부터 시작한다. - java.util.Calendar zDay = Calendar.getInstance(); - zDay.set(iyear, imonth1, iday, ihour, itime); - - if(type.equals("D")) - { - zDay.add(Calendar.DATE, (int) unit); - } - else if(type.equals("H")) - { - zDay.add(Calendar.HOUR_OF_DAY, (int) unit); - } - else if(type.equals("M")) - { - zDay.add(Calendar.MINUTE, (int) unit); - } - else - { - return type + "은 부적절한 Type값입니다"; - } - java.util.Date z1Day = zDay.getTime(); - java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); - return fmt2.format(z1Day); - - } - - /** - * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) - * - * @param day - * 더하려는 날짜 - * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 - */ - public static String getDatewithSpan(long day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 - * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; - * String str=fmt.format(new java.util.Date(time2)); - * - * return str; - */ - String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); - - } - - public static long stol(String str) - { - if(str == null ) return 0; - return (Long.valueOf(str).longValue()); - } - - /** - 문자열을 중 특정 문자열을 변환시킨다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param targeter 대상문자열 - @param target_str 변환될 대상문자열 - @param replace_str 변환될 문자열 - @return target_str이 replace_str로 변환된 문자열 - */ - public static String getReplacedString(String targeter, String target_str, String replace_str) - { - if( targeter == null - || target_str == null - || replace_str == null ) - return "debug : parameter value is null"; - - if(target_str.length() == 0) - return targeter; - - StringBuffer str = new StringBuffer(); - int start_ptr = 0; - int current_ptr = 0; - int increment_size = replace_str.length(); - if(increment_size == 0 ) increment_size = 1; - - while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) - { - str.append(targeter.substring(start_ptr, current_ptr)); - str.append(replace_str); - start_ptr = current_ptr + increment_size; - if(start_ptr >= targeter.length()) - break; - }//end while - - if(start_ptr == 0) - return targeter; - - if(start_ptr < targeter.length()) - str.append(targeter.substring(start_ptr)); - - return str.toString(); - }//getReplacedString(String targeter, String target_str, String replace_str) - - /** - 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg 대상문자열 - @param v_s1 변환될 대상문자열 - @param v_s2 변환될 문자열 - @return v_s1이 v_s2 변환된 문자열 - */ - - public static String getReplacedString2(String v_msg, String v_s1, String v_s2) - { - int idx = v_msg.indexOf(v_s1); - - if (idx == -1) return v_msg; - else - { - try - { - return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); - } catch (Exception e) - { - return v_msg.substring(0, idx) + v_s2; - } - } - - } - - public static String getReplacedString3(String sStr, String n1, String n2) - { - int iTmp = 0; - if (sStr == null) return ""; - - String sTmp = sStr; - StringBuffer sbSave = new StringBuffer(); - sbSave.append(""); - while (sTmp.indexOf(n1) > -1) - { - iTmp = sTmp.indexOf(n1); - sbSave.append(sTmp.substring(0,iTmp)); - sbSave.append(n2); - sTmp = sTmp.substring(iTmp + n1.length()); - } - sbSave.append(sTmp); - return sbSave.toString(); - } - - public static Vector arrToDouVector(String strArray, String strDelimt) - { - String[] stArray = strArray.split(strDelimt); - - double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); - Vector vReturn = new Vector(); - - if(dArray==null) return vReturn; - - for(double dTemp: dArray) - { - vReturn.add(dTemp); - } - - return vReturn; - - } - - public static String arrListToString(List list) - { - String strReturn=""; - - if(list == null ) return ""; - - for(int i=0; i"+strTemp); - // double dou = Double.parseDouble(strTemp); - // strReturn = strReturn+","+dou; - strReturn = strReturn+","+strTemp; - } - - strReturn = strReturn.substring(1); - - return strReturn; - - } - - /** - 보고서 body base64 변환 - front로 부터 받아서 DB저장시 사용 - @version 1.0 - @author 나혁제 - @since 2025.02.06 - @param txt String - @return String - */ - public static String base64encode(String txt) - { - try - { - byte[] bytes = Base64.getEncoder().encode((txt).getBytes("utf-8")); - return new String(bytes); - } - catch(Exception e) - { - e.printStackTrace(); - byte[] bytes = Base64.getEncoder().encode((txt).getBytes()); - return new String(bytes); - } - } - - /** - 서버(DB)에서 front로 전달시 사용 - @version 1.0 - @author 나혁제 - @since 2025.02.06 - @param txt String - @return String - */ - public static String base64decode(String txt) - { - byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); - - try - { - return new String(bytes, "utf-8"); - } - catch(Exception e) - { - e.printStackTrace(); - return new String(bytes); - } - } - - /** - *
-	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(Object src) - { - String src2 = src+""; - if (src == null || src.equals("null")) - { - return 0; - } - else - { - return Integer.parseInt(((String)src2).trim()); - } - } - - /** - *
-	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(String src) - { - - if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) - { - return 0; - } - else - { - return Integer.parseInt(src.trim()); - } - } - - - -} +package com.urpsys.basebatch.common.util; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import com.urpsys.common.exception.CustomException; + +/** + * 공통 유틸리티를 모아둔 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.04.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.04.03    나혁제         최초작성
+ *
+ *      
+ */ + +public class CommonUtil +{ + /** + * nvl 메소드 + * @param inputStr + * @return + */ + public static String nvl(String inputStr) + { + return (inputStr != null) ? inputStr.trim() : ""; + } + + /** + * nvl 메소드 + * @param inputStr + * @param defaultValue + * @return + */ + public static String nvl(String inputStr, String defaultValue) + { + return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); + } + + /** + * nvl 메소드 + * @param inputObj + * @return + */ + public static String nvl(Object inputObj) + { + return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; + } + + /** + * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 + * + * @param longTime long type 시간 + * @param dateFormat 변환할 포맷 + * @return 변환된 날짜 String + * @throws SystemException + */ + public static String getTimeString(long longTime, String dateFormat) throws CustomException + { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); + + if (longTime < 0) + { + return ""; + } + else + { + try + { + return sdf.format(new Date(longTime)); + } + catch (Exception e) + { + throw new CustomException("Date 변환 오류"); + } + } + } + + /** + * 현재(한국기준) 시간정보를 얻는다.
+ * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
+ * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 + * 0~23시간 타입으로 Return.
+ * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
+ * @param format 얻고자하는 현재시간의 Type + * @return str 현재 한국 시간. + */ + public static String getKST(String format) + { + //1hour(ms) = 60s * 60m * 1000ms + int millisPerHour = 60 * 60 * 1000; + SimpleDateFormat fmt= new SimpleDateFormat(format); + + SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); + fmt.setTimeZone(timeZone); + + long time=System.currentTimeMillis(); + String str=fmt.format(new java.util.Date(time)); + return str; + } + + /** + * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 + * + * @param date + * string date (19991002) + * @param Day + * 기준이 되는 시간 + * @return String + */ + public static String getDatewithSpan(String date, long Day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month + * = Integer.valueOf(date.substring(4,6)).intValue(); int day = + * Integer.valueOf(date.substring(6,8)).intValue(); + * + * java.util.Calendar aDay = Calendar.getInstance(); + * aDay.set(year+1900,month,day); java.util.Calendar bDay + * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay + * = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); + * + * return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(date, Day, "D", vFORMAT); + + } + + /** + * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
+ * + * @param date + * string date (20000315/2000031509/200003150915) + * @param unit + * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 + * @param type + * String type: D:Day H:Hour M:Minute + * @return String 계산된 문자열의 값. + */ + public static String getDatewithSpan(String date, long unit, String type, String strFormatType) + { + /* + * String formatType = strFormatType; int ihour = 0; int itime = 0; + * + * long dhm = 24 * 60 * 60 * 1000; + * + * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else + * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if + * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type + * + "은 부적절한 Type값입니다"; } + * + * switch (date.length()){ case (8): if (type.equals("H") || + * type.equals("M")) { return "HM-ERROR"; } + * + * break; case (10): if (type.equals("M")) { return "M-ERROR"; } + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case + * (12): + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = + * Integer.valueOf(date.substring(10,12)).intValue(); break; default: + * return "date Length Error"; } + * + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int + * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = + * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar + * aDay = Calendar.getInstance(); + * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay + * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date + * cDay = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String formatType = strFormatType; + int ihour = 0; + int itime = 0; + if(!(type.equals("D") || type.equals("H") || type.equals("M"))) + { + return type + "은 부적절한 Type값입니다"; + } + + switch(date.length()) + { + case (8): + if(type.equals("H") || type.equals("M")) + { + return "HM-ERROR"; + } + break; + case (10): + if(type.equals("M")) + { + return "M-ERROR"; + } + ihour = Integer.parseInt(date.substring(8, 10)); + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + break; + case (12): + ihour = Integer.parseInt(date.substring(8, 10)); + itime = Integer.parseInt(date.substring(10, 12)); + + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + // itime = Integer.valueOf(date.substring(10, 12)).intValue(); + break; + default: + return "date Length Error"; + } + int iyear = Integer.parseInt(date.substring(0, 4)); + int imonth = Integer.parseInt(date.substring(4, 6)); + int iday = Integer.parseInt(date.substring(6, 8)); + + /* + int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); + int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); + int iday = Integer.valueOf(date.substring(6, 8)).intValue(); + */ + + int imonth1 = imonth - 1; // 달은 0달부터 시작한다. + java.util.Calendar zDay = Calendar.getInstance(); + zDay.set(iyear, imonth1, iday, ihour, itime); + + if(type.equals("D")) + { + zDay.add(Calendar.DATE, (int) unit); + } + else if(type.equals("H")) + { + zDay.add(Calendar.HOUR_OF_DAY, (int) unit); + } + else if(type.equals("M")) + { + zDay.add(Calendar.MINUTE, (int) unit); + } + else + { + return type + "은 부적절한 Type값입니다"; + } + java.util.Date z1Day = zDay.getTime(); + java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); + return fmt2.format(z1Day); + + } + + /** + * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) + * + * @param day + * 더하려는 날짜 + * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 + */ + public static String getDatewithSpan(long day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 + * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; + * String str=fmt.format(new java.util.Date(time2)); + * + * return str; + */ + String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); + + } + + public static long stol(String str) + { + if(str == null ) return 0; + return (Long.valueOf(str).longValue()); + } + + /** + 문자열을 중 특정 문자열을 변환시킨다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param targeter 대상문자열 + @param target_str 변환될 대상문자열 + @param replace_str 변환될 문자열 + @return target_str이 replace_str로 변환된 문자열 + */ + public static String getReplacedString(String targeter, String target_str, String replace_str) + { + if( targeter == null + || target_str == null + || replace_str == null ) + return "debug : parameter value is null"; + + if(target_str.length() == 0) + return targeter; + + StringBuffer str = new StringBuffer(); + int start_ptr = 0; + int current_ptr = 0; + int increment_size = replace_str.length(); + if(increment_size == 0 ) increment_size = 1; + + while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) + { + str.append(targeter.substring(start_ptr, current_ptr)); + str.append(replace_str); + start_ptr = current_ptr + increment_size; + if(start_ptr >= targeter.length()) + break; + }//end while + + if(start_ptr == 0) + return targeter; + + if(start_ptr < targeter.length()) + str.append(targeter.substring(start_ptr)); + + return str.toString(); + }//getReplacedString(String targeter, String target_str, String replace_str) + + /** + 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg 대상문자열 + @param v_s1 변환될 대상문자열 + @param v_s2 변환될 문자열 + @return v_s1이 v_s2 변환된 문자열 + */ + + public static String getReplacedString2(String v_msg, String v_s1, String v_s2) + { + int idx = v_msg.indexOf(v_s1); + + if (idx == -1) return v_msg; + else + { + try + { + return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); + } catch (Exception e) + { + return v_msg.substring(0, idx) + v_s2; + } + } + + } + + public static String getReplacedString3(String sStr, String n1, String n2) + { + int iTmp = 0; + if (sStr == null) return ""; + + String sTmp = sStr; + StringBuffer sbSave = new StringBuffer(); + sbSave.append(""); + while (sTmp.indexOf(n1) > -1) + { + iTmp = sTmp.indexOf(n1); + sbSave.append(sTmp.substring(0,iTmp)); + sbSave.append(n2); + sTmp = sTmp.substring(iTmp + n1.length()); + } + sbSave.append(sTmp); + return sbSave.toString(); + } + + public static Vector arrToDouVector(String strArray, String strDelimt) + { + String[] stArray = strArray.split(strDelimt); + + double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); + Vector vReturn = new Vector(); + + if(dArray==null) return vReturn; + + for(double dTemp: dArray) + { + vReturn.add(dTemp); + } + + return vReturn; + + } + + public static String arrListToString(List list) + { + String strReturn=""; + + if(list == null ) return ""; + + for(int i=0; i"+strTemp); + // double dou = Double.parseDouble(strTemp); + // strReturn = strReturn+","+dou; + strReturn = strReturn+","+strTemp; + } + + strReturn = strReturn.substring(1); + + return strReturn; + + } + + /** + 보고서 body base64 변환 + front로 부터 받아서 DB저장시 사용 + @version 1.0 + @author 나혁제 + @since 2025.02.06 + @param txt String + @return String + */ + public static String base64encode(String txt) + { + try + { + byte[] bytes = Base64.getEncoder().encode((txt).getBytes("utf-8")); + return new String(bytes); + } + catch(Exception e) + { + e.printStackTrace(); + byte[] bytes = Base64.getEncoder().encode((txt).getBytes()); + return new String(bytes); + } + } + + /** + 서버(DB)에서 front로 전달시 사용 + @version 1.0 + @author 나혁제 + @since 2025.02.06 + @param txt String + @return String + */ + public static String base64decode(String txt) + { + byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); + + try + { + return new String(bytes, "utf-8"); + } + catch(Exception e) + { + e.printStackTrace(); + return new String(bytes); + } + } + + /** + *
+	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(Object src) + { + String src2 = src+""; + if (src == null || src.equals("null")) + { + return 0; + } + else + { + return Integer.parseInt(((String)src2).trim()); + } + } + + /** + *
+	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(String src) + { + + if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) + { + return 0; + } + else + { + return Integer.parseInt(src.trim()); + } + } + + + +} diff --git a/batch/src/main/java/com/urpsys/basebatch/common/util/DataSourceUtil.java b/batch/src/main/java/com/urpsys/basebatch/common/util/DataSourceUtil.java deleted file mode 100644 index 7b87c9b2..00000000 --- a/batch/src/main/java/com/urpsys/basebatch/common/util/DataSourceUtil.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.urpsys.basebatch.common.util; - -import javax.sql.DataSource; - -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.springframework.core.env.Environment; -import org.springframework.core.io.Resource; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; -import com.urpsys.basebatch.common.exception.CustomException; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; - -import java.util.LinkedHashMap; - -/** - * Datasource 생성하는 유틸리티 - * - * @author 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- * 
- */ - -public class DataSourceUtil -{ - /** - * 데이터 소스 만드는 메소드 - * @param dataSourceName - * @param env - * @param cipher - * @return - */ - public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher) - { - HikariConfig config = new HikariConfig(); - - config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); - config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); - - config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username"))); - config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password"))); - - config.setAutoCommit(false); - - config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" ))); - config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" ))); - config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" ))); - config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" ))); - - config.addDataSourceProperty("cachePrepStmts" , "true"); - config.addDataSourceProperty("prepStmtCacheSize" , "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048"); - - return new HikariDataSource(config); - } - - /** - * SqlSessionFactory 만드는 메소드 - * @param dataSource - * @param configLocation - * @param mapperLocation - * @return - * @throws CustomException - */ - public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation, - Resource[] mapperLocation) throws CustomException - { - SqlSessionFactory sqlSessionFactory; - - try { - SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); - sessionFactoryBean.setDataSource(dataSource); - sessionFactoryBean.setConfigLocation(configLocation); - sessionFactoryBean.setMapperLocations(mapperLocation); - - sqlSessionFactory = sessionFactoryBean.getObject(); - } - catch (Exception ex) - { - throw new CustomException(ex.getMessage()); - } - - return sqlSessionFactory; - } - - /** - * 트랜잭션 처리 메소드 - * @param dataSource - * @return - */ - public static DataSourceTransactionManager createTxManager(DataSource dataSource) - { - DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource); - txManager.setGlobalRollbackOnParticipationFailure(false); - - return txManager; - } - - //end method -} diff --git a/batch/src/main/java/com/urpsys/basebatch/common/util/RestApiCallUtil.java b/batch/src/main/java/com/urpsys/basebatch/common/util/RestApiCallUtil.java index 6cffd813..94dc15d9 100644 --- a/batch/src/main/java/com/urpsys/basebatch/common/util/RestApiCallUtil.java +++ b/batch/src/main/java/com/urpsys/basebatch/common/util/RestApiCallUtil.java @@ -1,375 +1,375 @@ -package com.urpsys.basebatch.common.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.binary.Base64; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -import com.urpsys.basebatch.common.exception.CustomException; -import com.urpsys.basebatch.domain.TokenInfo; -import com.urpsys.basebatch.common.util.ConvertUtils; - -import kong.unirest.HttpRequestWithBody; -import kong.unirest.HttpResponse; -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * Rest Api 을 호출하는 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.03.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("RestApiCallUtil") -public class RestApiCallUtil -{ - @Value("${custom.sendkakaoTalk.serviceId}") - private String strServiceId; - - @Value("${custom.sendkakaoTalk.accessKey}") - private String strAccessKey; - - @Value("${custom.sendkakaoTalk.secretKey}") - private String strSecretKey; - - @Value("${custom.sendkakaoTalk.friendId}") - private String strFriendId; - - @Value("${custom.api_search_server}") - private String strApiSearchSvr; // API 서버 - - - @Value("${custom.api_kic_mail_server}") - private String strKicMailSvr; // KIC 메일서버 - - @Value("${custom.api_kic_msg_server}") - private String strKicMsgSvr; // KIC 메신저서버 - - /** - 네이버 클라우드 카톡 서비스 호출 - @author 나혁제 - @since 2025.03.20 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNaverCloudKaKao(String strTemplateCd, String to, String msg) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNaverCloudKaKao <<<<<<<<<<<<<<<"); - - long timestamp = System.currentTimeMillis(); - - String strTime = timestamp+""; - - String strContentType = "application/json; charset=utf-8" ; - - String strSignature = makeSignature(strTime, strServiceId, strAccessKey, strSecretKey); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type" , strContentType ); - headers.put("x-ncp-apigw-timestamp" , strTime ); - headers.put("x-ncp-iam-access-key" , strAccessKey ); - headers.put("x-ncp-apigw-signature-v2" , strSignature ); - // Header Setting End --------------------------------- - - log.info("headers 입력값 확인 => [{}]", headers.toString()); - - Map bodyMap = new HashMap<>(); - - bodyMap.put("plusFriendId" , "@"+strFriendId ); - bodyMap.put("templateCode" , strTemplateCd ); - - List> messagesList = new ArrayList<>(); - - Map messages = new HashMap<>(); - - messages.put("countryCode", "82"); - messages.put("to" , to); - messages.put("content" , msg); - - messagesList.add(messages); - - bodyMap.put("messages", messagesList); - - log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); - - String strFullUrl = "https://sens.apigw.ntruss.com/alimtalk/v2/services/"+strServiceId+"/messages"; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body (bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - // JSONObject returnObjData = new JSONObject(); - - // String strFullReturnData = returnObj.toString(); - - // Map 변환처리 - Map returnMap = null; - - // json to Map 변환처리 - returnMap = ConvertUtils.getMapFromJSONObject(returnObj); - - log.info("전체 리턴값 => [{}]", returnMap.toString()); - - log.info("<<<<<<<<<<<<<<< RestApiCallNaverCloudKaKao >>>>>>>>>>>>>>>"); - - return returnMap; - } - - public String makeSignature(String timestamp, String strServiceId, String strAccessKey, String strSecretKey) - { - String encodeBase64String = ""; - - try - { - String space = " " ; // one space - String newLine = "\n" ; // new line - String method = "POST"; // method - String url = "/alimtalk/v2/services/"+strServiceId+"/messages" ; // url (include query string) - String accessKey = strAccessKey ; // access key id (from portal or Sub Account) - String secretKey = strSecretKey ; - - String message = new StringBuilder() - .append(method) - .append(space) - .append(url) - .append(newLine) - .append(timestamp) - .append(newLine) - .append(accessKey) - .toString(); - - SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); - Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(signingKey); - - byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); - encodeBase64String = Base64.encodeBase64String(rawHmac); - } - catch(Exception e) - { - e.printStackTrace(); - } - - return encodeBase64String; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNoAuth ( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNoAuth <<<<<<<<<<<<<<<"); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - // Header Setting End --------------------------------- - - String strDomain = strApiSearchSvr; - String strFullUrl = strDomain + strRestUrl; - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); - log.info("입력 strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - - // JSONObject returnObjData = new JSONObject(); - - log.info("리턴값 확인 => [{}]", returnObj.toString()); - - /* - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - log.info("리턴값 확인 => [{}]", returnObjData.toString()); - } - */ - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallNoAuth >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.06.11 - @param : Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNoAuthKicMailTextHtml ( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNoAuthKicMailTextHtml <<<<<<<<<<<<<<<"); - - String strDomain = strKicMailSvr; - String strFullUrl = strDomain + strRestUrl; - - log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); - log.info("입력 strFullUrl => [{}]", strFullUrl); - - /* - HttpRequestWithBody request = Unirest.post("https://example.com/api"); - - for (Map.Entry entry : bodyMap.entrySet()) - { - // request = request.field(entry.getKey(), entry.getValue()); - - request = request.field(entry.getKey(), entry.getValue()); - } - */ - - /* - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .field("email" , (String)bodyMap.get("email" )) - .field("to" , (String)bodyMap.get("to" )) - .field("subject" , (String)bodyMap.get("subject" )) - .field("content" , (String)bodyMap.get("content" )) - .field("contentType" , (String)bodyMap.get("contentType")) - .asJson(); - */ - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .fields(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - - log.info("리턴값 확인 => [{}]", returnObj.toString()); - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallNoAuthKicMailTextHtml >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNoAuthKicMsg ( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNoAuthKicMsg <<<<<<<<<<<<<<<"); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - // Header Setting End --------------------------------- - - String strDomain = strKicMsgSvr; - String strFullUrl = strDomain + strRestUrl; - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); - log.info("입력 strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - - // JSONObject returnObjData = new JSONObject(); - - log.info("리턴값 확인 => [{}]", returnObj.toString()); - - /* - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - log.info("리턴값 확인 => [{}]", returnObjData.toString()); - } - */ - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallNoAuthKicMsg >>>>>>>>>>>>>>>"); - - return returnMap; - } - - - - - - -} +package com.urpsys.basebatch.common.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.basebatch.domain.TokenInfo; +import com.urpsys.basebatch.common.util.ConvertUtils; + +import kong.unirest.HttpRequestWithBody; +import kong.unirest.HttpResponse; +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * Rest Api 을 호출하는 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.03.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("RestApiCallUtil") +public class RestApiCallUtil +{ + @Value("${custom.sendkakaoTalk.serviceId}") + private String strServiceId; + + @Value("${custom.sendkakaoTalk.accessKey}") + private String strAccessKey; + + @Value("${custom.sendkakaoTalk.secretKey}") + private String strSecretKey; + + @Value("${custom.sendkakaoTalk.friendId}") + private String strFriendId; + + @Value("${custom.api_search_server}") + private String strApiSearchSvr; // API 서버 + + + @Value("${custom.api_kic_mail_server}") + private String strKicMailSvr; // KIC 메일서버 + + @Value("${custom.api_kic_msg_server}") + private String strKicMsgSvr; // KIC 메신저서버 + + /** + 네이버 클라우드 카톡 서비스 호출 + @author 나혁제 + @since 2025.03.20 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNaverCloudKaKao(String strTemplateCd, String to, String msg) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNaverCloudKaKao <<<<<<<<<<<<<<<"); + + long timestamp = System.currentTimeMillis(); + + String strTime = timestamp+""; + + String strContentType = "application/json; charset=utf-8" ; + + String strSignature = makeSignature(strTime, strServiceId, strAccessKey, strSecretKey); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type" , strContentType ); + headers.put("x-ncp-apigw-timestamp" , strTime ); + headers.put("x-ncp-iam-access-key" , strAccessKey ); + headers.put("x-ncp-apigw-signature-v2" , strSignature ); + // Header Setting End --------------------------------- + + log.info("headers 입력값 확인 => [{}]", headers.toString()); + + Map bodyMap = new HashMap<>(); + + bodyMap.put("plusFriendId" , "@"+strFriendId ); + bodyMap.put("templateCode" , strTemplateCd ); + + List> messagesList = new ArrayList<>(); + + Map messages = new HashMap<>(); + + messages.put("countryCode", "82"); + messages.put("to" , to); + messages.put("content" , msg); + + messagesList.add(messages); + + bodyMap.put("messages", messagesList); + + log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); + + String strFullUrl = "https://sens.apigw.ntruss.com/alimtalk/v2/services/"+strServiceId+"/messages"; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body (bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + // JSONObject returnObjData = new JSONObject(); + + // String strFullReturnData = returnObj.toString(); + + // Map 변환처리 + Map returnMap = null; + + // json to Map 변환처리 + returnMap = ConvertUtils.getMapFromJSONObject(returnObj); + + log.info("전체 리턴값 => [{}]", returnMap.toString()); + + log.info("<<<<<<<<<<<<<<< RestApiCallNaverCloudKaKao >>>>>>>>>>>>>>>"); + + return returnMap; + } + + public String makeSignature(String timestamp, String strServiceId, String strAccessKey, String strSecretKey) + { + String encodeBase64String = ""; + + try + { + String space = " " ; // one space + String newLine = "\n" ; // new line + String method = "POST"; // method + String url = "/alimtalk/v2/services/"+strServiceId+"/messages" ; // url (include query string) + String accessKey = strAccessKey ; // access key id (from portal or Sub Account) + String secretKey = strSecretKey ; + + String message = new StringBuilder() + .append(method) + .append(space) + .append(url) + .append(newLine) + .append(timestamp) + .append(newLine) + .append(accessKey) + .toString(); + + SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(signingKey); + + byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); + encodeBase64String = Base64.encodeBase64String(rawHmac); + } + catch(Exception e) + { + e.printStackTrace(); + } + + return encodeBase64String; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNoAuth ( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNoAuth <<<<<<<<<<<<<<<"); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + // Header Setting End --------------------------------- + + String strDomain = strApiSearchSvr; + String strFullUrl = strDomain + strRestUrl; + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); + log.info("입력 strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + + // JSONObject returnObjData = new JSONObject(); + + log.info("리턴값 확인 => [{}]", returnObj.toString()); + + /* + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + log.info("리턴값 확인 => [{}]", returnObjData.toString()); + } + */ + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallNoAuth >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.06.11 + @param : Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNoAuthKicMailTextHtml ( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNoAuthKicMailTextHtml <<<<<<<<<<<<<<<"); + + String strDomain = strKicMailSvr; + String strFullUrl = strDomain + strRestUrl; + + log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); + log.info("입력 strFullUrl => [{}]", strFullUrl); + + /* + HttpRequestWithBody request = Unirest.post("https://example.com/api"); + + for (Map.Entry entry : bodyMap.entrySet()) + { + // request = request.field(entry.getKey(), entry.getValue()); + + request = request.field(entry.getKey(), entry.getValue()); + } + */ + + /* + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .field("email" , (String)bodyMap.get("email" )) + .field("to" , (String)bodyMap.get("to" )) + .field("subject" , (String)bodyMap.get("subject" )) + .field("content" , (String)bodyMap.get("content" )) + .field("contentType" , (String)bodyMap.get("contentType")) + .asJson(); + */ + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .fields(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + + log.info("리턴값 확인 => [{}]", returnObj.toString()); + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallNoAuthKicMailTextHtml >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNoAuthKicMsg ( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNoAuthKicMsg <<<<<<<<<<<<<<<"); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + // Header Setting End --------------------------------- + + String strDomain = strKicMsgSvr; + String strFullUrl = strDomain + strRestUrl; + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); + log.info("입력 strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + + // JSONObject returnObjData = new JSONObject(); + + log.info("리턴값 확인 => [{}]", returnObj.toString()); + + /* + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + log.info("리턴값 확인 => [{}]", returnObjData.toString()); + } + */ + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallNoAuthKicMsg >>>>>>>>>>>>>>>"); + + return returnMap; + } + + + + + + +} diff --git a/batch/src/main/java/com/urpsys/basebatch/config/EncryptConfig.java b/batch/src/main/java/com/urpsys/basebatch/config/EncryptConfig.java index 5004dcde..31b3eee8 100644 --- a/batch/src/main/java/com/urpsys/basebatch/config/EncryptConfig.java +++ b/batch/src/main/java/com/urpsys/basebatch/config/EncryptConfig.java @@ -1,39 +1,39 @@ -package com.urpsys.basebatch.config; - -import java.io.IOException; -import java.security.InvalidKeyException; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; - -import org.apache.commons.codec.DecoderException; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * 암호화 유틸리티를 등록하는 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- * 
- */ - -@Configuration -public class EncryptConfig -{ - @Bean(name="aes256Cipher") - public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException - { - return new Aes256Cipher(); - } -} +package com.urpsys.basebatch.config; + +import java.io.IOException; +import java.security.InvalidKeyException; + +import com.urpsys.common.crypto.Aes256Cipher; + +import org.apache.commons.codec.DecoderException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 암호화 유틸리티를 등록하는 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.04.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.04.03    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +public class EncryptConfig +{ + @Bean(name="aes256Cipher") + public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException + { + return new Aes256Cipher(); + } +} diff --git a/batch/src/main/java/com/urpsys/basebatch/config/KicInsaDbConfig.java b/batch/src/main/java/com/urpsys/basebatch/config/KicInsaDbConfig.java index 455047a0..2d9cb4d0 100644 --- a/batch/src/main/java/com/urpsys/basebatch/config/KicInsaDbConfig.java +++ b/batch/src/main/java/com/urpsys/basebatch/config/KicInsaDbConfig.java @@ -1,126 +1,126 @@ -package com.urpsys.basebatch.config; - -import java.io.IOException; -import java.sql.Connection; - -import javax.sql.DataSource; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; -import com.urpsys.basebatch.common.exception.CustomException; -import com.urpsys.basebatch.common.util.DataSourceUtil; - -/** - * kic insa db config 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.06.04 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.06.04    나혁제         최초작성
- *
- * 
- */ - -@Configuration -@EnableTransactionManagement -@MapperScan( value={"com.urpsys.kicinsa"} , sqlSessionFactoryRef="kicinsaSqlSessionFactory") -public class KicInsaDbConfig -{ - @Autowired - private Environment env; - - @Autowired - private Aes256Cipher aes256Cipher; - - @Value("${custom.client}") - private String strClient; // 고객확인 - - /** - * 데이터소스 등록하는 메소드 - * @return - */ - @Bean(name="kicinsaDataSource") - public DataSource kicinsaDataSource() - { - DataSource dataSource = null; - - if(strClient.equals("kic")) - { - dataSource = new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("kicinsadb", env, aes256Cipher)); - } - else - { - dataSource = new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); - } - - return dataSource; - // return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("kicinsadb", env, aes256Cipher)); - } - - /** - * sqlsessionfactory 등록하는 메소드 - * - * @param dataSource - * @param context - * @return - * @throws SchedulerException - * @throws IOException - */ - @Bean(name="kicinsaSqlSessionFactory") - public SqlSessionFactory kicinsaSqlSessionFactory(@Qualifier("kicinsaDataSource") DataSource dataSource, ApplicationContext context) - throws CustomException, IOException - { - SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource - , context.getResource ("classpath:mapper/kicinsadb/config/MybatisConfig.xml") - , context.getResources("classpath:mapper/kicinsadb/sqlmap/**/*Mapper*.xml") - ); - - sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); - - return sqlSessionFactory; - } - - /** - * sqlsessiontemplate 등록하는 메소드 - * @param primarySqlSessionFactory - * @return - */ - @Bean("kicinsaSqlSessionTemplate") - public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("kicinsaSqlSessionFactory") SqlSessionFactory kicinsaSqlSessionFactory) - { - return new SqlSessionTemplate(kicinsaSqlSessionFactory); - } - - /** - * 트랜잭션 매니저 등록하는 메소드 - * @param dataSource - * @return - */ - @Bean(name="kicinsaTxManager") - public PlatformTransactionManager kicinsaTxManager(@Qualifier("kicinsaDataSource") DataSource dataSource) - { - return DataSourceUtil.createTxManager(dataSource); - } -} - +package com.urpsys.basebatch.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; +import com.urpsys.common.util.DataSourceUtil; + +/** + * kic insa db config 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.06.04 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.06.04    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan( value={"com.urpsys.kicinsa"} , sqlSessionFactoryRef="kicinsaSqlSessionFactory") +public class KicInsaDbConfig +{ + @Autowired + private Environment env; + + @Autowired + private Aes256Cipher aes256Cipher; + + @Value("${custom.client}") + private String strClient; // 고객확인 + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="kicinsaDataSource") + public DataSource kicinsaDataSource() + { + DataSource dataSource = null; + + if(strClient.equals("kic")) + { + dataSource = new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("kicinsadb", env, aes256Cipher)); + } + else + { + dataSource = new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); + } + + return dataSource; + // return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("kicinsadb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="kicinsaSqlSessionFactory") + public SqlSessionFactory kicinsaSqlSessionFactory(@Qualifier("kicinsaDataSource") DataSource dataSource, ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/kicinsadb/config/MybatisConfig.xml") + , context.getResources("classpath:mapper/kicinsadb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("kicinsaSqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("kicinsaSqlSessionFactory") SqlSessionFactory kicinsaSqlSessionFactory) + { + return new SqlSessionTemplate(kicinsaSqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="kicinsaTxManager") + public PlatformTransactionManager kicinsaTxManager(@Qualifier("kicinsaDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/batch/src/main/java/com/urpsys/basebatch/config/MailConfig.java b/batch/src/main/java/com/urpsys/basebatch/config/MailConfig.java index a80eb6f4..b75de938 100644 --- a/batch/src/main/java/com/urpsys/basebatch/config/MailConfig.java +++ b/batch/src/main/java/com/urpsys/basebatch/config/MailConfig.java @@ -1,85 +1,85 @@ -package com.urpsys.basebatch.config; - -import java.util.Properties; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.ModelAndView; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; - -import lombok.extern.slf4j.Slf4j; - -/** - * html 메일 설정 클리스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20    나혁제         최초작성
- *
- * 
- */ - -@Slf4j -@Component -public class MailConfig -{ - @Value("${custom.sendmail.id}") - private String strMailId; - - @Value("${custom.sendmail.password}") - private String strMailPass; - - @Value("${custom.sendmail.port}") - private int strMailPort; - - @Value("${custom.sendmail.host}") - private String strMailHost; - - @Value("${custom.sendmail.socketFactory-class}") - private String strSocketFactoryClass; - - @Autowired - private Aes256Cipher aes256Cipher; - - Properties pt = new Properties(); - - @Bean - public JavaMailSender javaMailService() - { - JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); - - javaMailSender.setHost (this.strMailHost ); - javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); - javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); - javaMailSender.setPort (this.strMailPort ); - - pt.put("mail.smtp.socketFactory.port" , this.strMailPort); - pt.put("mail.smtp.auth" , true); - pt.put("mail.smtp.starttls.enable" , true); - pt.put("mail.smtp.starttls.required" , true); - pt.put("mail.smtp.socketFactory.fallback", false); - - // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 - - javaMailSender.setJavaMailProperties(pt); - javaMailSender.setDefaultEncoding("UTF-8"); - - return javaMailSender; - } - -} +package com.urpsys.basebatch.config; + +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +import com.urpsys.common.crypto.Aes256Cipher; + +import lombok.extern.slf4j.Slf4j; + +/** + * html 메일 설정 클리스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.04.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20    나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@Component +public class MailConfig +{ + @Value("${custom.sendmail.id}") + private String strMailId; + + @Value("${custom.sendmail.password}") + private String strMailPass; + + @Value("${custom.sendmail.port}") + private int strMailPort; + + @Value("${custom.sendmail.host}") + private String strMailHost; + + @Value("${custom.sendmail.socketFactory-class}") + private String strSocketFactoryClass; + + @Autowired + private Aes256Cipher aes256Cipher; + + Properties pt = new Properties(); + + @Bean + public JavaMailSender javaMailService() + { + JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); + + javaMailSender.setHost (this.strMailHost ); + javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); + javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); + javaMailSender.setPort (this.strMailPort ); + + pt.put("mail.smtp.socketFactory.port" , this.strMailPort); + pt.put("mail.smtp.auth" , true); + pt.put("mail.smtp.starttls.enable" , true); + pt.put("mail.smtp.starttls.required" , true); + pt.put("mail.smtp.socketFactory.fallback", false); + + // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 + + javaMailSender.setJavaMailProperties(pt); + javaMailSender.setDefaultEncoding("UTF-8"); + + return javaMailSender; + } + +} diff --git a/batch/src/main/java/com/urpsys/basebatch/config/PrimaryDbConfig.java b/batch/src/main/java/com/urpsys/basebatch/config/PrimaryDbConfig.java index 2e827d1b..45c00d74 100644 --- a/batch/src/main/java/com/urpsys/basebatch/config/PrimaryDbConfig.java +++ b/batch/src/main/java/com/urpsys/basebatch/config/PrimaryDbConfig.java @@ -1,113 +1,113 @@ -package com.urpsys.basebatch.config; - -import java.io.IOException; -import java.sql.Connection; - -import javax.sql.DataSource; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; -import com.urpsys.basebatch.common.exception.CustomException; -import com.urpsys.basebatch.common.util.DataSourceUtil; - -/** - * primary db config 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- * 
- */ - -@Configuration -@EnableTransactionManagement -@MapperScan( value={"com.urpsys.basebatch","com.urpsys.itmsbatch"} - , sqlSessionFactoryRef="primarySqlSessionFactory") -public class PrimaryDbConfig -{ - @Autowired - private Environment env; - - @Autowired - private Aes256Cipher aes256Cipher; - - /** - * 데이터소스 등록하는 메소드 - * @return - */ - @Bean(name="primaryDataSource") - public DataSource primaryDataSource() - { - return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); - } - - /** - * sqlsessionfactory 등록하는 메소드 - * - * @param dataSource - * @param context - * @return - * @throws SchedulerException - * @throws IOException - */ - @Bean(name="primarySqlSessionFactory") - public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) - throws CustomException, IOException - { - SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource - , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") - , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") - ); - - sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); - - return sqlSessionFactory; - } - - /** - * sqlsessiontemplate 등록하는 메소드 - * @param primarySqlSessionFactory - * @return - */ - @Bean("primarySqlSessionTemplate") - public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) - { - return new SqlSessionTemplate(primarySqlSessionFactory); - } - - /** - * 트랜잭션 매니저 등록하는 메소드 - * @param dataSource - * @return - */ - @Bean(name="primaryTxManager") - @Primary - public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) - { - return DataSourceUtil.createTxManager(dataSource); - } -} - +package com.urpsys.basebatch.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; +import com.urpsys.common.util.DataSourceUtil; + +/** + * primary db config 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.04.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.04.03    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan( value={"com.urpsys.basebatch","com.urpsys.itmsbatch"} + , sqlSessionFactoryRef="primarySqlSessionFactory") +public class PrimaryDbConfig +{ + @Autowired + private Environment env; + + @Autowired + private Aes256Cipher aes256Cipher; + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="primaryDataSource") + public DataSource primaryDataSource() + { + return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("primarydb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="primarySqlSessionFactory") + public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource dataSource, ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/primarydb/config/MybatisConfig.xml") + , context.getResources("classpath:mapper/primarydb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("primarySqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("primarySqlSessionFactory") SqlSessionFactory primarySqlSessionFactory) + { + return new SqlSessionTemplate(primarySqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="primaryTxManager") + @Primary + public PlatformTransactionManager primaryTxManager(@Qualifier("primaryDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/batch/src/main/java/com/urpsys/basebatch/config/quartz/QuartzConfig.java b/batch/src/main/java/com/urpsys/basebatch/config/quartz/QuartzConfig.java index ef9c35e2..7e0ea2af 100644 --- a/batch/src/main/java/com/urpsys/basebatch/config/quartz/QuartzConfig.java +++ b/batch/src/main/java/com/urpsys/basebatch/config/quartz/QuartzConfig.java @@ -1,129 +1,129 @@ -package com.urpsys.basebatch.config.quartz; - -import java.io.IOException; -import java.util.Properties; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.config.PropertiesFactoryBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.ClassPathResource; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; - -import com.urpsys.basebatch.common.crypto.Aes256Cipher; -import com.urpsys.basebatch.common.util.CommonUtil; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * Quartz 설정 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.04.03 - * @version 1.0.0 - * @see : https://pooney.tistory.com/99#article-17--qrtz_cron_triggers - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.04.03    나혁제         최초작성
- *
- * 
- */ - -@Configuration -@Slf4j -public class QuartzConfig -{ - @Autowired - private Aes256Cipher aes256Cipher; - - private final DataSource dataSource; - private final ApplicationContext applicationContext; - private final PlatformTransactionManager platformTransactionManager; - - public QuartzConfig( @Qualifier("primaryDataSource") DataSource dataSource - , ApplicationContext applicationContext - , @Qualifier("primaryTxManager") PlatformTransactionManager platformTransactionManager - ) - { - this.dataSource = dataSource; - this.applicationContext = applicationContext; - this.platformTransactionManager = platformTransactionManager; - } - - /* - public QuartzConfig(@Qualifier("primaryDataSource") DataSource dataSource) { - this.dataSource = dataSource; - applicationContext = null; - platformTransactionManager = null; - } - */ - - @Bean - public SchedulerFactoryBean schedulerFactoryBean() - { - SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); - - AutoWiringSpringBeanJobFactory autoWiringSpringBeanJobFactory = new AutoWiringSpringBeanJobFactory(); - - autoWiringSpringBeanJobFactory.setApplicationContext(applicationContext); - - schedulerFactoryBean.setJobFactory (autoWiringSpringBeanJobFactory); - schedulerFactoryBean.setDataSource (dataSource); - schedulerFactoryBean.setOverwriteExistingJobs (true); - schedulerFactoryBean.setAutoStartup (true); - schedulerFactoryBean.setTransactionManager (platformTransactionManager); - schedulerFactoryBean.setQuartzProperties (quartzProperties()); - - return schedulerFactoryBean; - } - - private Properties quartzProperties() - { - log.info(">>>>>>>>>> quartzProperties <<<<<<<<<<"); - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); - - String strProFile = "quartz-"+activeProfile+".properties"; - log.info("strProFile [{}]", strProFile); - - propertiesFactoryBean.setLocation(new ClassPathResource(strProFile)); - - Properties properties = null; - - try - { - propertiesFactoryBean.afterPropertiesSet(); - properties = propertiesFactoryBean.getObject(); - - String strDbUser = aes256Cipher.decrypt((String)properties.get("org.quartz.dataSource.pooney.user")); - String strDbPassword = aes256Cipher.decrypt((String)properties.get("org.quartz.dataSource.pooney.password")); - - properties.setProperty("org.quartz.dataSource.pooney.user" , strDbUser ); - properties.setProperty("org.quartz.dataSource.pooney.password", strDbPassword ); - - // System.out.println("자 봅시다 =>"+ properties.get("org.quartz.dataSource.pooney.user") ); - // System.out.println("자 봅시다 =>"+ properties.get("org.quartz.dataSource.pooney.password") ); - } - catch (IOException e) - { - log.error("quartzProperties parse error : {}", e); - } - - log.info("<<<<<<<<<< quartzProperties >>>>>>>>>>"); - - return properties; - } +package com.urpsys.basebatch.config.quartz; + +import java.io.IOException; +import java.util.Properties; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.PropertiesFactoryBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; + +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.basebatch.common.util.CommonUtil; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * Quartz 설정 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.04.03 + * @version 1.0.0 + * @see : https://pooney.tistory.com/99#article-17--qrtz_cron_triggers + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.04.03    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@Slf4j +public class QuartzConfig +{ + @Autowired + private Aes256Cipher aes256Cipher; + + private final DataSource dataSource; + private final ApplicationContext applicationContext; + private final PlatformTransactionManager platformTransactionManager; + + public QuartzConfig( @Qualifier("primaryDataSource") DataSource dataSource + , ApplicationContext applicationContext + , @Qualifier("primaryTxManager") PlatformTransactionManager platformTransactionManager + ) + { + this.dataSource = dataSource; + this.applicationContext = applicationContext; + this.platformTransactionManager = platformTransactionManager; + } + + /* + public QuartzConfig(@Qualifier("primaryDataSource") DataSource dataSource) { + this.dataSource = dataSource; + applicationContext = null; + platformTransactionManager = null; + } + */ + + @Bean + public SchedulerFactoryBean schedulerFactoryBean() + { + SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); + + AutoWiringSpringBeanJobFactory autoWiringSpringBeanJobFactory = new AutoWiringSpringBeanJobFactory(); + + autoWiringSpringBeanJobFactory.setApplicationContext(applicationContext); + + schedulerFactoryBean.setJobFactory (autoWiringSpringBeanJobFactory); + schedulerFactoryBean.setDataSource (dataSource); + schedulerFactoryBean.setOverwriteExistingJobs (true); + schedulerFactoryBean.setAutoStartup (true); + schedulerFactoryBean.setTransactionManager (platformTransactionManager); + schedulerFactoryBean.setQuartzProperties (quartzProperties()); + + return schedulerFactoryBean; + } + + private Properties quartzProperties() + { + log.info(">>>>>>>>>> quartzProperties <<<<<<<<<<"); + + String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); + + PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); + + String strProFile = "quartz-"+activeProfile+".properties"; + log.info("strProFile [{}]", strProFile); + + propertiesFactoryBean.setLocation(new ClassPathResource(strProFile)); + + Properties properties = null; + + try + { + propertiesFactoryBean.afterPropertiesSet(); + properties = propertiesFactoryBean.getObject(); + + String strDbUser = aes256Cipher.decrypt((String)properties.get("org.quartz.dataSource.pooney.user")); + String strDbPassword = aes256Cipher.decrypt((String)properties.get("org.quartz.dataSource.pooney.password")); + + properties.setProperty("org.quartz.dataSource.pooney.user" , strDbUser ); + properties.setProperty("org.quartz.dataSource.pooney.password", strDbPassword ); + + // System.out.println("자 봅시다 =>"+ properties.get("org.quartz.dataSource.pooney.user") ); + // System.out.println("자 봅시다 =>"+ properties.get("org.quartz.dataSource.pooney.password") ); + } + catch (IOException e) + { + log.error("quartzProperties parse error : {}", e); + } + + log.info("<<<<<<<<<< quartzProperties >>>>>>>>>>"); + + return properties; + } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index d14138df..eeaf5ae9 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ allprojects { } subprojects { + // 소스는 UTF-8. 컴파일러 기본 인코딩이 플랫폼(CP949)일 수 있어 명시 고정(동작 등가·결정론). + tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + } repositories { mavenCentral() // egovframe maven 원격 저장소. 단, spring-modules-validation 은 아래 artifact-only 저장소에서 취득. diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 00000000..69d2cc4a --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,37 @@ +// ITMS 통합 common 모듈 (INTEGRATION_DESIGN.md §2, §3-2) +// 5개 모듈에 복붙 포크되어 있던 공통 클래스(behavior-identical 확인분)를 단일화. +// 플레인 Java 라이브러리 — Boot 애플리케이션 아님(bootJar/bootWar 미생성). +plugins { + id 'io.spring.dependency-management' + id 'java' +} + +group = 'com.urpsys' +version = '1.0.0-SNAPSHOT' +sourceCompatibility = '11' // 소비 모듈(11/16) 최저 호환. JDK17 컴파일러로 빌드. + +configurations { + compileOnly { + extendsFrom annotationProcessor + } +} + +dependencyManagement { + imports { + mavenBom "org.springframework.boot:spring-boot-dependencies:2.6.2" + } +} + +// repositories: 루트 build.gradle subprojects 로 승격 +dependencies { + implementation 'org.springframework.boot:spring-boot-starter' // spring-core / spring-context (ClassPathResource, @Configuration/@Bean) + implementation 'org.springframework.boot:spring-boot-starter-json' // jackson-databind (ConvertUtils) + implementation 'org.springframework.boot:spring-boot-starter-jdbc' // spring-jdbc + HikariCP (DataSourceUtil) + implementation 'org.springframework.security:spring-security-crypto' // PasswordEncoder / BCrypt (PasswordEncoderConfig) + implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2' // SqlSessionFactoryBean (DataSourceUtil) + implementation 'commons-codec:commons-codec:1.15' // Aes256Cipher / EncryptConfig + implementation 'com.konghq:unirest-java:3.7.02' // kong.unirest.json (ConvertUtils) + + compileOnly 'org.projectlombok:lombok:1.18.20' + annotationProcessor 'org.projectlombok:lombok:1.18.20' +} diff --git a/api/src/main/java/com/urpsys/baseapi/common/crypto/Aes256Cipher.java b/common/src/main/java/com/urpsys/common/crypto/Aes256Cipher.java similarity index 73% rename from api/src/main/java/com/urpsys/baseapi/common/crypto/Aes256Cipher.java rename to common/src/main/java/com/urpsys/common/crypto/Aes256Cipher.java index ad90a780..08d82f8c 100644 --- a/api/src/main/java/com/urpsys/baseapi/common/crypto/Aes256Cipher.java +++ b/common/src/main/java/com/urpsys/common/crypto/Aes256Cipher.java @@ -1,145 +1,157 @@ -package com.urpsys.baseapi.common.crypto; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.util.Properties; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.springframework.core.io.ClassPathResource; - -import com.urpsys.baseapi.common.util.CommonUtil; - -/** - * aes 256 암호화 클래스 - * - * @author 나혁제 - * @since 2025.01.02 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.02     나혁제         최초작성
- *
- * 
- */ - -public class Aes256Cipher -{ - private SecretKey keySpec; // keySpec - private IvParameterSpec ivSpec; // ivSpec - - /** - * Aes256Cipher 생성자 - * - * @param keyFile 키 파일 위치를 입력 받음 - * @throws IOException 파일 io 시 발생하는 익셉션 - * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 - * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 - */ - public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException - { - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - InputStream fis = null; - String secretKey = null; - - try - { - fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream(); - - Properties props = new Properties(); - props.load(fis); - secretKey = props.getProperty("aes256.key"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - fis.close(); - } - - byte[] secretKeyBytes = Hex.decodeHex(secretKey); - - if (secretKeyBytes.length != 32) { - throw new InvalidKeyException("Invalid key (key length is not valid) "); - } - - byte[] ivBytes = new byte[16]; - - System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); - - keySpec = new SecretKeySpec(secretKeyBytes, "AES"); - ivSpec = new IvParameterSpec(ivBytes); - } - - /** - * encryption 하는 메소드 - * - * @param plainStr 평문을 입력 받음 - * @return 암호화된 문자열 - */ - public String encrypt(String plainStr) - { - if (plainStr == null) { - return null; - } - - String encryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); - byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); - encryptedStr = new String(Base64.encodeBase64(encrypted)); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return encryptedStr; - } - - /** - * 암호화된 문자열을 복호화하는 메소드 - * - * @param encryptedStr 암호화된 문자열 - * @return 암호화가 해제된 문자열 - */ - public String decrypt(String encryptedStr) - { - if (encryptedStr == null) - { - return null; - } - - String decryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); - decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return decryptedStr; - } -} +package com.urpsys.common.crypto; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidKeyException; +import java.util.Properties; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.Hex; +import org.springframework.core.io.ClassPathResource; + +/** + * aes 256 암호화 클래스 + * + * @author 나혁제 + * @since 2025.01.02 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일         수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.02     나혁제         최초작성
+ *
+ * 
+ */ + +public class Aes256Cipher +{ + // 통합 시 모듈별 키스토어 상이(front=UrpSysKeyMng.keystore, 그 외=UrpSystem.keystore) → 생성자 파라미터화. + // 무인자 생성자는 기존 다수 모듈과 동일한 기본값 사용(동작 등가). + private static final String DEFAULT_KEYSTORE = "secrets/UrpSystem.keystore"; + + private SecretKey keySpec; // keySpec + private IvParameterSpec ivSpec; // ivSpec + + /** + * Aes256Cipher 생성자 (기본 키스토어: secrets/UrpSystem.keystore) + * + * @throws IOException 파일 io 시 발생하는 익셉션 + * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 + * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 + */ + public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException + { + this(DEFAULT_KEYSTORE); + } + + /** + * Aes256Cipher 생성자 + * + * @param keystoreResource 클래스패스 상의 키스토어 리소스 경로 + * @throws IOException 파일 io 시 발생하는 익셉션 + * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 + * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 + */ + public Aes256Cipher(String keystoreResource) throws IOException, InvalidKeyException, DecoderException + { + // 기존 무인자 생성자에서 spring.profiles.active 를 조회했으나 이후 미사용(dead) → 제거(동작 등가). + InputStream fis = null; + String secretKey = null; + + try + { + fis = new ClassPathResource(keystoreResource).getInputStream(); + + Properties props = new Properties(); + props.load(fis); + secretKey = props.getProperty("aes256.key"); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + finally + { + fis.close(); + } + + byte[] secretKeyBytes = Hex.decodeHex(secretKey); + + if (secretKeyBytes.length != 32) { + throw new InvalidKeyException("Invalid key (key length is not valid) "); + } + + byte[] ivBytes = new byte[16]; + + System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); + + keySpec = new SecretKeySpec(secretKeyBytes, "AES"); + ivSpec = new IvParameterSpec(ivBytes); + } + + /** + * encryption 하는 메소드 + * + * @param plainStr 평문을 입력 받음 + * @return 암호화된 문자열 + */ + public String encrypt(String plainStr) + { + if (plainStr == null) { + return null; + } + + String encryptedStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); + byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); + encryptedStr = new String(Base64.encodeBase64(encrypted)); + } catch (Exception ex) { + ex.printStackTrace(); + } + + return encryptedStr; + } + + /** + * 암호화된 문자열을 복호화하는 메소드 + * + * @param encryptedStr 암호화된 문자열 + * @return 암호화가 해제된 문자열 + */ + public String decrypt(String encryptedStr) + { + if (encryptedStr == null) + { + return null; + } + + String decryptedStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); + decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); + } catch (Exception ex) { + ex.printStackTrace(); + } + + return decryptedStr; + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java b/common/src/main/java/com/urpsys/common/exception/CustomException.java similarity index 98% rename from datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java rename to common/src/main/java/com/urpsys/common/exception/CustomException.java index 74f1f592..4f298a27 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java +++ b/common/src/main/java/com/urpsys/common/exception/CustomException.java @@ -1,4 +1,4 @@ -package com.urpsys.kccfbat.common.exception; +package com.urpsys.common.exception; import java.sql.SQLSyntaxErrorException; diff --git a/api/src/main/java/com/urpsys/baseapi/common/util/ConvertUtils.java b/common/src/main/java/com/urpsys/common/util/ConvertUtils.java similarity index 95% rename from api/src/main/java/com/urpsys/baseapi/common/util/ConvertUtils.java rename to common/src/main/java/com/urpsys/common/util/ConvertUtils.java index cb2c01f0..9fa1d070 100644 --- a/api/src/main/java/com/urpsys/baseapi/common/util/ConvertUtils.java +++ b/common/src/main/java/com/urpsys/common/util/ConvertUtils.java @@ -1,425 +1,425 @@ -package com.urpsys.baseapi.common.util; - -import java.lang.reflect.Field; -import java.util.*; - -import org.springframework.util.ObjectUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import kong.unirest.json.JSONArray; -import kong.unirest.json.JSONException; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * 데이터 유형 변환 처리 모음 Util 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.03.20 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자        수정내용
- * -----------  ---------    ------------------------
- * 2025.03.20    나혁제         최초작성
- *
- *      
- */ -@Slf4j -public class ConvertUtils -{ - private ConvertUtils() {} - - /** - Object Type을 Map 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param Object obj - @return Map - */ - public static Map convertToMap(Object obj) - { - try - { - if (Objects.isNull(obj)) - { - return Collections.emptyMap(); - } - - Map convertMap = new HashMap<>(); - - Field[] fields = obj.getClass().getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - convertMap.put(field.getName(), field.get(obj)); - } - - return convertMap; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Object Type의 List을 Map List 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param List list - @return List> - */ - public static List> convertToMaps(List list) - { - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List> convertList = new ArrayList<>(list.size()); - - for (Object obj : list) - { - convertList.add(ConvertUtils.convertToMap(obj)); - } - return convertList; - } - - - /** - Object Type을 Map 타입으로 변환처리 (확장영역까지 변환) - @version 1.0 - @author 나혁제 - @param Object obj - @return Map - */ - public static Map convertToMapAll(Object obj) - { - try - { - if (Objects.isNull(obj)) - { - return Collections.emptyMap(); - } - - Class upType = obj.getClass(); - - Map convertMap = new HashMap<>(); - - while(true) - { - - Field[] fields = upType.getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - convertMap.put(field.getName(), field.get(obj)); - } - - if(upType.getSuperclass() == null ) - { - break; - } - else - { - upType = upType.getSuperclass(); - } - } - - return convertMap; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map 데이터를 입력괸 클래스 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param Map map 입력맵 - Class type 변환 클래스 - @return T 변환된 븤래스 - */ - public static T convertToValueObject(Map map, Class type) - { - try - { - Objects.requireNonNull(type, "Class cannot be null"); - T instance = type.getConstructor().newInstance(); - - if (map == null || map.isEmpty()) - { - return instance; - } - - for (Map.Entry entry : map.entrySet()) - { - Field[] fields = type.getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - String name = field.getName(); - - boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); - boolean isSameName = entry.getKey().equals(name); - - if (isSameType && isSameName) - { - field.set(instance, map.get(name)); - break; - } - } - } - return instance; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param List> list - Class type 변환 클래스 - @return T 변환된 리스트 - */ - public static List convertToValueObjects(List> list, Class type) - { - Objects.requireNonNull(type, "Class cannot be null"); - - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List convertList = new ArrayList<>(list.size()); - - for (Map map : list) - { - convertList.add(ConvertUtils.convertToValueObject(map, type)); - } - return convertList; - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장영역) - @version 1.0 - @author 나혁제 - @param Map map 입력맵 - Class type 변환 클래스 - @return T 변환된 븤래스 - */ - public static T convertToValueObjectAll(Map map, Class type) - { - try - { - Objects.requireNonNull(type, "Class cannot be null"); - T instance = type.getConstructor().newInstance(); - - if (map == null || map.isEmpty()) - { - return instance; - } - - for (Map.Entry entry : map.entrySet()) - { - Class upType = type; - - while(true) - { - Boolean bExist = false; - Field[] fields = upType.getDeclaredFields(); - - if(fields == null || fields.length==0) break; - - for (Field field : fields) - { - field.setAccessible(true); - String name = field.getName(); - - boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); - boolean isSameName = entry.getKey().equals(name); - - if (isSameType && isSameName) - { - field.set(instance, map.get(name)); - bExist = true; - break; - } - } - - if(bExist) break; - - if(upType.getSuperclass().getClass() == null) - { - break; - } - else - { - upType = upType.getSuperclass(); - } - } - } - - return instance; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장된 클래스 처리) - @version 1.0 - @author 나혁제 - @param v_msg Map - @return List - */ - public static List convertToValueObjectsAll(List> list, Class type) - { - Objects.requireNonNull(type, "Class cannot be null"); - - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List convertList = new ArrayList<>(list.size()); - - for (Map map : list) - { - convertList.add(ConvertUtils.convertToValueObjectAll(map, type)); - } - return convertList; - } - - private static Class getReferenceType(Class type) - { - switch (type.getName()) { - case "boolean" : return Boolean.class; - case "byte" : return Byte.class; - case "short" : return Short.class; - case "char" : return Character.class; - case "int" : return Integer.class; - case "long" : return Long.class; - case "float" : return Float.class; - case "double" : return Double.class; - default : return type; - } - } - - /** - Map 데이터를 JSONObject로 변환. - @version 1.0 - @author 나혁제 - @param v_msg Map - @return JSONObject - */ - public static JSONObject getJsonFromMap(Map map) throws JSONException - { - JSONObject jsonData = new JSONObject(); - - for (String key : map.keySet()) - { - Object value = map.get(key); - if (value instanceof Map) - { - value = getJsonFromMap((Map) value); - } - jsonData.put(key, value); - } - return jsonData; - } - - /** - List 데이터를 JSONArray로 변환. - @version 1.0 - @author 나혁제 - @param v_msg Map - @return JSONObject - */ - public static JSONArray getJsonFromList(List> list) throws JSONException - { - - JSONArray jsonArr = new JSONArray(); - - for(Map map : list) - { - JSONObject jsonObj = getJsonFromMap(map); - jsonArr.put(jsonObj); - } - - return jsonArr; - } - - - /** - * jsonObject --> map 으로 변경 - * JSONObject 에 JSONArray 없어야 햠. - * @author 나혁제 - * @param obj - * @return - */ - public static Map getMapFromJSONObject(JSONObject obj) - { - if (ObjectUtils.isEmpty(obj)) - { - log.error("BAD REQUEST obj : {}", obj); - throw new IllegalArgumentException(String.format("BAD REQUEST obj %s", obj)); - } - - try - { - return new ObjectMapper().readValue(obj.toString(), Map.class); - } - catch (Exception e) - { - log.error(e.getMessage(), e); - throw new RuntimeException(e); - } - } - - /** - * json array 를 list map 으로 변경. - * - * @author 나혁제 - * @param jsonArray - * @return 값이 있으면 list map, 없으면 list 빈 값 return - */ - public static List> getListMapFromJsonArray(JSONArray jsonArray) - { - if (ObjectUtils.isEmpty(jsonArray)) - { - log.error("jsonArray is null."); - throw new IllegalArgumentException("jsonArray is null"); - } - - List> list = new ArrayList<>(); - - for (Object jsonObject : jsonArray) - { - list.add(getMapFromJSONObject((JSONObject) jsonObject)); - } - return list; - } - - - - - -} +package com.urpsys.common.util; + +import java.lang.reflect.Field; +import java.util.*; + +import org.springframework.util.ObjectUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import kong.unirest.json.JSONArray; +import kong.unirest.json.JSONException; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * 데이터 유형 변환 처리 모음 Util 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.03.20 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일         수정자        수정내용
+ * -----------  ---------    ------------------------
+ * 2025.03.20    나혁제         최초작성
+ *
+ *      
+ */ +@Slf4j +public class ConvertUtils +{ + private ConvertUtils() {} + + /** + Object Type을 Map 타입으로 변환처리 + @version 1.0 + @author 나혁제 + @param Object obj + @return Map + */ + public static Map convertToMap(Object obj) + { + try + { + if (Objects.isNull(obj)) + { + return Collections.emptyMap(); + } + + Map convertMap = new HashMap<>(); + + Field[] fields = obj.getClass().getDeclaredFields(); + + for (Field field : fields) + { + field.setAccessible(true); + convertMap.put(field.getName(), field.get(obj)); + } + + return convertMap; + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + /** + Object Type의 List을 Map List 타입으로 변환처리 + @version 1.0 + @author 나혁제 + @param List list + @return List> + */ + public static List> convertToMaps(List list) + { + if (list == null || list.isEmpty()) + { + return Collections.emptyList(); + } + + List> convertList = new ArrayList<>(list.size()); + + for (Object obj : list) + { + convertList.add(ConvertUtils.convertToMap(obj)); + } + return convertList; + } + + + /** + Object Type을 Map 타입으로 변환처리 (확장영역까지 변환) + @version 1.0 + @author 나혁제 + @param Object obj + @return Map + */ + public static Map convertToMapAll(Object obj) + { + try + { + if (Objects.isNull(obj)) + { + return Collections.emptyMap(); + } + + Class upType = obj.getClass(); + + Map convertMap = new HashMap<>(); + + while(true) + { + + Field[] fields = upType.getDeclaredFields(); + + for (Field field : fields) + { + field.setAccessible(true); + convertMap.put(field.getName(), field.get(obj)); + } + + if(upType.getSuperclass() == null ) + { + break; + } + else + { + upType = upType.getSuperclass(); + } + } + + return convertMap; + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + /** + Map 데이터를 입력괸 클래스 타입으로 변환처리 + @version 1.0 + @author 나혁제 + @param Map map 입력맵 + Class type 변환 클래스 + @return T 변환된 븤래스 + */ + public static T convertToValueObject(Map map, Class type) + { + try + { + Objects.requireNonNull(type, "Class cannot be null"); + T instance = type.getConstructor().newInstance(); + + if (map == null || map.isEmpty()) + { + return instance; + } + + for (Map.Entry entry : map.entrySet()) + { + Field[] fields = type.getDeclaredFields(); + + for (Field field : fields) + { + field.setAccessible(true); + String name = field.getName(); + + boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); + boolean isSameName = entry.getKey().equals(name); + + if (isSameType && isSameName) + { + field.set(instance, map.get(name)); + break; + } + } + } + return instance; + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + /** + Map List 데이터를 입력괸 클래스 타입으로 변환처리 + @version 1.0 + @author 나혁제 + @param List> list + Class type 변환 클래스 + @return T 변환된 리스트 + */ + public static List convertToValueObjects(List> list, Class type) + { + Objects.requireNonNull(type, "Class cannot be null"); + + if (list == null || list.isEmpty()) + { + return Collections.emptyList(); + } + + List convertList = new ArrayList<>(list.size()); + + for (Map map : list) + { + convertList.add(ConvertUtils.convertToValueObject(map, type)); + } + return convertList; + } + + /** + Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장영역) + @version 1.0 + @author 나혁제 + @param Map map 입력맵 + Class type 변환 클래스 + @return T 변환된 븤래스 + */ + public static T convertToValueObjectAll(Map map, Class type) + { + try + { + Objects.requireNonNull(type, "Class cannot be null"); + T instance = type.getConstructor().newInstance(); + + if (map == null || map.isEmpty()) + { + return instance; + } + + for (Map.Entry entry : map.entrySet()) + { + Class upType = type; + + while(true) + { + Boolean bExist = false; + Field[] fields = upType.getDeclaredFields(); + + if(fields == null || fields.length==0) break; + + for (Field field : fields) + { + field.setAccessible(true); + String name = field.getName(); + + boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); + boolean isSameName = entry.getKey().equals(name); + + if (isSameType && isSameName) + { + field.set(instance, map.get(name)); + bExist = true; + break; + } + } + + if(bExist) break; + + if(upType.getSuperclass().getClass() == null) + { + break; + } + else + { + upType = upType.getSuperclass(); + } + } + } + + return instance; + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + /** + Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장된 클래스 처리) + @version 1.0 + @author 나혁제 + @param v_msg Map + @return List + */ + public static List convertToValueObjectsAll(List> list, Class type) + { + Objects.requireNonNull(type, "Class cannot be null"); + + if (list == null || list.isEmpty()) + { + return Collections.emptyList(); + } + + List convertList = new ArrayList<>(list.size()); + + for (Map map : list) + { + convertList.add(ConvertUtils.convertToValueObjectAll(map, type)); + } + return convertList; + } + + private static Class getReferenceType(Class type) + { + switch (type.getName()) { + case "boolean" : return Boolean.class; + case "byte" : return Byte.class; + case "short" : return Short.class; + case "char" : return Character.class; + case "int" : return Integer.class; + case "long" : return Long.class; + case "float" : return Float.class; + case "double" : return Double.class; + default : return type; + } + } + + /** + Map 데이터를 JSONObject로 변환. + @version 1.0 + @author 나혁제 + @param v_msg Map + @return JSONObject + */ + public static JSONObject getJsonFromMap(Map map) throws JSONException + { + JSONObject jsonData = new JSONObject(); + + for (String key : map.keySet()) + { + Object value = map.get(key); + if (value instanceof Map) + { + value = getJsonFromMap((Map) value); + } + jsonData.put(key, value); + } + return jsonData; + } + + /** + List 데이터를 JSONArray로 변환. + @version 1.0 + @author 나혁제 + @param v_msg Map + @return JSONObject + */ + public static JSONArray getJsonFromList(List> list) throws JSONException + { + + JSONArray jsonArr = new JSONArray(); + + for(Map map : list) + { + JSONObject jsonObj = getJsonFromMap(map); + jsonArr.put(jsonObj); + } + + return jsonArr; + } + + + /** + * jsonObject --> map 으로 변경 + * JSONObject 에 JSONArray 없어야 햠. + * @author 나혁제 + * @param obj + * @return + */ + public static Map getMapFromJSONObject(JSONObject obj) + { + if (ObjectUtils.isEmpty(obj)) + { + log.error("BAD REQUEST obj : {}", obj); + throw new IllegalArgumentException(String.format("BAD REQUEST obj %s", obj)); + } + + try + { + return new ObjectMapper().readValue(obj.toString(), Map.class); + } + catch (Exception e) + { + log.error(e.getMessage(), e); + throw new RuntimeException(e); + } + } + + /** + * json array 를 list map 으로 변경. + * + * @author 나혁제 + * @param jsonArray + * @return 값이 있으면 list map, 없으면 list 빈 값 return + */ + public static List> getListMapFromJsonArray(JSONArray jsonArray) + { + if (ObjectUtils.isEmpty(jsonArray)) + { + log.error("jsonArray is null."); + throw new IllegalArgumentException("jsonArray is null"); + } + + List> list = new ArrayList<>(); + + for (Object jsonObject : jsonArray) + { + list.add(getMapFromJSONObject((JSONObject) jsonObject)); + } + return list; + } + + + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java b/common/src/main/java/com/urpsys/common/util/DataSourceUtil.java similarity index 95% rename from datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java rename to common/src/main/java/com/urpsys/common/util/DataSourceUtil.java index 840be922..af69c251 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java +++ b/common/src/main/java/com/urpsys/common/util/DataSourceUtil.java @@ -1,4 +1,4 @@ -package com.urpsys.kccfbat.common.util; +package com.urpsys.common.util; import java.sql.Connection; @@ -10,8 +10,8 @@ import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import com.urpsys.kccfbat.common.crypto.Aes256Cipher; -import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; diff --git a/datatrans/build.gradle b/datatrans/build.gradle index 07f35dd0..02ee7eb9 100644 --- a/datatrans/build.gradle +++ b/datatrans/build.gradle @@ -28,6 +28,8 @@ ext dependencies { + implementation project(':common') + implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-cache' diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java deleted file mode 100644 index 3e0d3461..00000000 --- a/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.urpsys.kccfbat.common.crypto; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.util.Properties; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.springframework.core.io.ClassPathResource; - -import com.urpsys.kccfbat.common.util.CommonUtil; - -/** - * aes 256 암호화 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28     나혁제         최초작성
- *
- * 
- */ - -public class Aes256Cipher -{ - private SecretKey keySpec; // keySpec - private IvParameterSpec ivSpec; // ivSpec - - /** - * Aes256Cipher 생성자 - * - * @param keyFile 키 파일 위치를 입력 받음 - * @throws IOException 파일 io 시 발생하는 익셉션 - * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 - * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 - */ - public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException - { - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - InputStream fis = null; - String secretKey = null; - - try - { - fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream(); - - Properties props = new Properties(); - props.load(fis); - secretKey = props.getProperty("aes256.key"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - fis.close(); - } - - byte[] secretKeyBytes = Hex.decodeHex(secretKey); - - if (secretKeyBytes.length != 32) { - throw new InvalidKeyException("Invalid key (key length is not valid) "); - } - - byte[] ivBytes = new byte[16]; - - System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); - - keySpec = new SecretKeySpec(secretKeyBytes, "AES"); - ivSpec = new IvParameterSpec(ivBytes); - } - - /** - * encryption 하는 메소드 - * - * @param plainStr 평문을 입력 받음 - * @return 암호화된 문자열 - */ - public String encrypt(String plainStr) - { - if (plainStr == null) { - return null; - } - - String encryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); - byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); - encryptedStr = new String(Base64.encodeBase64(encrypted)); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return encryptedStr; - } - - /** - * 암호화된 문자열을 복호화하는 메소드 - * - * @param encryptedStr 암호화된 문자열 - * @return 암호화가 해제된 문자열 - */ - public String decrypt(String encryptedStr) - { - if (encryptedStr == null) - { - return null; - } - - String decryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); - decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return decryptedStr; - } -} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java index fe2b0869..cb925a3e 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java @@ -23,7 +23,7 @@ import org.springframework.security.oauth2.provider.token.RemoteTokenServices; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.common.exception.CustomException; import com.urpsys.kccfbat.domain.TokenInfo; /** diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java index 1dd03f66..823c0edc 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java @@ -6,7 +6,7 @@ import org.apache.commons.codec.DecoderException; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.urpsys.kccfbat.common.crypto.Aes256Cipher; +import com.urpsys.common.crypto.Aes256Cipher; /** * 암호화 유틸리티를 등록하는 클래스 diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java index 79eefb5a..b596df97 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java @@ -19,7 +19,7 @@ import kong.unirest.JsonNode; import kong.unirest.Unirest; import lombok.extern.slf4j.Slf4j; -import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.common.exception.CustomException; import com.urpsys.kccfbat.domain.CommonVO; import com.urpsys.kccfbat.domain.JWTKey; import com.urpsys.kccfbat.service.CommonService; diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java index ba68852b..82f534e0 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java @@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import com.urpsys.kccfbat.common.crypto.Aes256Cipher; -import com.urpsys.kccfbat.common.exception.CustomException; -import com.urpsys.kccfbat.common.util.DataSourceUtil; +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; +import com.urpsys.common.util.DataSourceUtil; /** * iams(통합자료관리시스템) db config 클래스 diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java index 5c08b882..b1ea1dc9 100644 --- a/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java @@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import com.urpsys.kccfbat.common.crypto.Aes256Cipher; -import com.urpsys.kccfbat.common.exception.CustomException; -import com.urpsys.kccfbat.common.util.DataSourceUtil; +import com.urpsys.common.crypto.Aes256Cipher; +import com.urpsys.common.exception.CustomException; +import com.urpsys.common.util.DataSourceUtil; /** * ncms(자산관리시스템) db config 클래스 diff --git a/front/build.gradle b/front/build.gradle index aa968d5a..aebd1e8b 100644 --- a/front/build.gradle +++ b/front/build.gradle @@ -31,7 +31,9 @@ ext } dependencies -{ +{ + implementation project(':common') + implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-cache' diff --git a/front/src/main/java/com/urpsys/basefront/common/crypto/Aes256Cipher.java b/front/src/main/java/com/urpsys/basefront/common/crypto/Aes256Cipher.java deleted file mode 100644 index 0d8ffff2..00000000 --- a/front/src/main/java/com/urpsys/basefront/common/crypto/Aes256Cipher.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.urpsys.basefront.common.crypto; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.util.Properties; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.springframework.core.io.ClassPathResource; - -import com.urpsys.basefront.common.util.CommonUtil; - -/** - * AES 256 암호화 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06     나혁제         최초작성
- *
- * 
- */ - -public class Aes256Cipher -{ - private SecretKey keySpec; // keySpec - private IvParameterSpec ivSpec; // ivSpec - - /** - * Aes256Cipher 생성자 - * - * @param keyFile 키 파일 위치를 입력 받음 - * @throws IOException 파일 io 시 발생하는 익셉션 - * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 - * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 - */ - public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException { - - String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); - - InputStream fis = null; - String secretKey = null; - - try - { - fis = new ClassPathResource("secrets/UrpSysKeyMng.keystore").getInputStream(); - - Properties props = new Properties(); - props.load(fis); - secretKey = props.getProperty("aes256.key"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - fis.close(); - } - - byte[] secretKeyBytes = Hex.decodeHex(secretKey); - - if (secretKeyBytes.length != 32) { - throw new InvalidKeyException("Invalid key (key length is not valid) "); - } - - byte[] ivBytes = new byte[16]; - - System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); - - keySpec = new SecretKeySpec(secretKeyBytes, "AES"); - ivSpec = new IvParameterSpec(ivBytes); - } - - /** - * encryption 하는 메소드 - * - * @param plainStr 평문을 입력 받음 - * @return 암호화된 문자열 - */ - public String encrypt(String plainStr) { - if (plainStr == null) { - return null; - } - - String encryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); - byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); - encryptedStr = new String(Base64.encodeBase64(encrypted)); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return encryptedStr; - } - - /** - * 암호화된 문자열을 복호화하는 메소드 - * - * @param encryptedStr 암호화된 문자열 - * @return 암호화가 해제된 문자열 - */ - public String decrypt(String encryptedStr) { - if (encryptedStr == null) - { - return null; - } - - String decryptedStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); - decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return decryptedStr; - } -} diff --git a/front/src/main/java/com/urpsys/basefront/common/exception/CustomException.java b/front/src/main/java/com/urpsys/basefront/common/exception/CustomException.java deleted file mode 100644 index 002ee753..00000000 --- a/front/src/main/java/com/urpsys/basefront/common/exception/CustomException.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.urpsys.basefront.common.exception; - -import java.sql.SQLSyntaxErrorException; - -import lombok.Getter; - -/** - * Custom exception 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06     나혁제         최초작성
- *
- * 
- */ - -public class CustomException extends Exception -{ - private static final long serialVersionUID = 3559302713942492181L; - - @Getter - private String errorCode; - - @Getter - private String errorMsg; - - /** - * 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스) - * 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로 - * 변경 가능성 있음 - * @param throwable - */ - public CustomException(Throwable throwable) - { - Throwable rootThrowable = getRootCause(throwable); - - // TODO 에러 코드는 상세 정의해서 define 해야 함 - if(rootThrowable instanceof SQLSyntaxErrorException) { - this.errorCode = "100"; - this.errorMsg = "SQL 오류"; - } else if(rootThrowable instanceof ArithmeticException) { - this.errorCode = "200"; - this.errorMsg = "연산 오류"; - } else { - this.errorCode = "900"; - this.errorMsg = "Unknown Error"; - } - } - - /** - * 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅) - * @param errorMsg - */ - public CustomException(String errorMsg) { - super(errorMsg); - this.errorCode = "0"; - this.errorMsg = errorMsg; - } - - /** - * 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해 - * 에러코드를 int 값으로 받으면 string으로 변환하여 저장) - * @param errorCode - * @param errorMsg - */ - public CustomException(int errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = String.valueOf(errorCode); - this.errorMsg = errorMsg; - } - - /** - * 생성자(에러코드, 에러메시지를 받아 세팅) - * @param errorCode - * @param errorMsg - */ - public CustomException(String errorCode, String errorMsg) { - super(errorMsg); - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - /** - * stack에서 에러코드 중 root cause를 찾아내는 메소드 - * @param throwable - * @return - */ - private Throwable getRootCause(Throwable throwable) { - Throwable cause = throwable.getCause(); - - if (cause == null) { - return throwable; - } - - while (true) { - - if(cause.getCause() == null) { - break; - } else { - cause = cause.getCause(); - } - } - - return cause; - } -} diff --git a/front/src/main/java/com/urpsys/basefront/common/service/CommonService.java b/front/src/main/java/com/urpsys/basefront/common/service/CommonService.java index 102b7c1e..23a83e46 100644 --- a/front/src/main/java/com/urpsys/basefront/common/service/CommonService.java +++ b/front/src/main/java/com/urpsys/basefront/common/service/CommonService.java @@ -1,253 +1,253 @@ -package com.urpsys.basefront.common.service; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; - -import kong.unirest.HttpResponse; -import kong.unirest.Unirest; -import lombok.extern.slf4j.Slf4j; - -/** - * 공통정보 추출 서비스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.03 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자       수정내용
- * -----------  ---------  ------------------------
- * 2025.01.03   나혁제       최초작성
- *
- * 
- */ - -@Slf4j -@Service -public class CommonService -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 각 기능에 대한 고유ID 획득 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - public String GetIdGen(String strIdName) throws Exception - { - log.info(">>>>>>>>>> GetIdGen <<<<<<<<<<"); - - log.info("strIdName [{}]", strIdName); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("IdName", strIdName); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/GetIdGen.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String uniqId = (String)returnMap.get("strGenId"); - // Return Data Setting End -------------------------- - - log.info("<<<<<<<<<< GetIdGen >>>>>>>>>>"); - - return uniqId; - } - - /** - * 각 기능에 대한 고유ID 획득(미인증) - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - public String noAuthGetIdGen(String strIdName) throws Exception - { - log.info(">>>>>>>>>> noAuthGetIdGen <<<<<<<<<<"); - - log.info("strIdName [{}]", strIdName); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("IdName", strIdName); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthGetIdGen.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String uniqId = (String)returnMap.get("strGenId"); - // Return Data Setting End -------------------------- - - log.info("<<<<<<<<<< noAuthGetIdGen >>>>>>>>>>"); - - return uniqId; - } - - - /** - * 코드정보 추출 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - public Map GetCodeList(String strCodeIds) throws Exception - { - log.info(">>>>>>>>>> GetCodeList <<<<<<<<<<"); - - log.info("strCodeIds [{}]", strCodeIds); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 값 정의 - Map returnCodeMap = new LinkedHashMap(); - - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId(strCodeIds); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - - String[] srCodeId = StringUtils.split(strCodeIds, ","); - - for(String str : srCodeId) - { - listComCode = (List>)returnMap.get("resultList_"+str); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - - returnCodeMap.put(str+"_result", chglistComCode); - } - - log.info("<<<<<<<<<< GetCodeList >>>>>>>>>>"); - - return returnCodeMap; - } - - /** - * 인스던트 액션별 메일처리 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.20 - */ - public Map sendIncidentMail(int type, int incidentSeq) throws Exception - { - log.info(">>>>>>>>>> sendIncidentMail <<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - try - { - log.info("strCodeIds [{}]", type); - log.info("strCodeIds [{}]", incidentSeq); - - // Body Setting Start --------------------------------- - bodyMap.put("type" , type ); - bodyMap.put("incidentSeq" , incidentSeq ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/sendIncidentMail.do"); - // RestApi Call End --------------------------------- - } - catch (Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<< sendIncidentMail >>>>>>>>>>"); - - return returnMap; - } - - /** - * 보고서 액션별 메일처리 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.04.03 - */ - public Map sendReportMail(int type, int reportType, int reportSeq) throws Exception - { - log.info(">>>>>>>>>> sendReportMail <<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - try - { - // reportType => 1 : 점검보고서 , 2: 장애보고서, 3:이슈보고서 - log.info("type [{}]", type ); - log.info("reportType [{}]", reportType ); - log.info("reportSeq [{}]", reportSeq ); - - // Body Setting Start --------------------------------- - bodyMap.put("type" , type ); - bodyMap.put("reportType" , reportType ); - bodyMap.put("reportSeq" , reportSeq ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/sendReportMail.do"); - // RestApi Call End --------------------------------- - } - catch (Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<< sendReportMail >>>>>>>>>>"); - - return returnMap; - } - - - - - - - -} +package com.urpsys.basefront.common.service; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; + +import kong.unirest.HttpResponse; +import kong.unirest.Unirest; +import lombok.extern.slf4j.Slf4j; + +/** + * 공통정보 추출 서비스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자       수정내용
+ * -----------  ---------  ------------------------
+ * 2025.01.03   나혁제       최초작성
+ *
+ * 
+ */ + +@Slf4j +@Service +public class CommonService +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 각 기능에 대한 고유ID 획득 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + public String GetIdGen(String strIdName) throws Exception + { + log.info(">>>>>>>>>> GetIdGen <<<<<<<<<<"); + + log.info("strIdName [{}]", strIdName); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("IdName", strIdName); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/GetIdGen.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String uniqId = (String)returnMap.get("strGenId"); + // Return Data Setting End -------------------------- + + log.info("<<<<<<<<<< GetIdGen >>>>>>>>>>"); + + return uniqId; + } + + /** + * 각 기능에 대한 고유ID 획득(미인증) + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + public String noAuthGetIdGen(String strIdName) throws Exception + { + log.info(">>>>>>>>>> noAuthGetIdGen <<<<<<<<<<"); + + log.info("strIdName [{}]", strIdName); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("IdName", strIdName); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthGetIdGen.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String uniqId = (String)returnMap.get("strGenId"); + // Return Data Setting End -------------------------- + + log.info("<<<<<<<<<< noAuthGetIdGen >>>>>>>>>>"); + + return uniqId; + } + + + /** + * 코드정보 추출 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + public Map GetCodeList(String strCodeIds) throws Exception + { + log.info(">>>>>>>>>> GetCodeList <<<<<<<<<<"); + + log.info("strCodeIds [{}]", strCodeIds); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 값 정의 + Map returnCodeMap = new LinkedHashMap(); + + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId(strCodeIds); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + + String[] srCodeId = StringUtils.split(strCodeIds, ","); + + for(String str : srCodeId) + { + listComCode = (List>)returnMap.get("resultList_"+str); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + + returnCodeMap.put(str+"_result", chglistComCode); + } + + log.info("<<<<<<<<<< GetCodeList >>>>>>>>>>"); + + return returnCodeMap; + } + + /** + * 인스던트 액션별 메일처리 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.20 + */ + public Map sendIncidentMail(int type, int incidentSeq) throws Exception + { + log.info(">>>>>>>>>> sendIncidentMail <<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + try + { + log.info("strCodeIds [{}]", type); + log.info("strCodeIds [{}]", incidentSeq); + + // Body Setting Start --------------------------------- + bodyMap.put("type" , type ); + bodyMap.put("incidentSeq" , incidentSeq ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/sendIncidentMail.do"); + // RestApi Call End --------------------------------- + } + catch (Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<< sendIncidentMail >>>>>>>>>>"); + + return returnMap; + } + + /** + * 보고서 액션별 메일처리 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.04.03 + */ + public Map sendReportMail(int type, int reportType, int reportSeq) throws Exception + { + log.info(">>>>>>>>>> sendReportMail <<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + try + { + // reportType => 1 : 점검보고서 , 2: 장애보고서, 3:이슈보고서 + log.info("type [{}]", type ); + log.info("reportType [{}]", reportType ); + log.info("reportSeq [{}]", reportSeq ); + + // Body Setting Start --------------------------------- + bodyMap.put("type" , type ); + bodyMap.put("reportType" , reportType ); + bodyMap.put("reportSeq" , reportSeq ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/sendReportMail.do"); + // RestApi Call End --------------------------------- + } + catch (Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<< sendReportMail >>>>>>>>>>"); + + return returnMap; + } + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/common/util/CommonUtil.java b/front/src/main/java/com/urpsys/basefront/common/util/CommonUtil.java index 48a8ea50..41bc6d84 100644 --- a/front/src/main/java/com/urpsys/basefront/common/util/CommonUtil.java +++ b/front/src/main/java/com/urpsys/basefront/common/util/CommonUtil.java @@ -1,688 +1,688 @@ -package com.urpsys.basefront.common.util; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Base64; -import java.util.Calendar; -import java.util.Date; -import java.util.Hashtable; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.SimpleTimeZone; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; - -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; - -import com.urpsys.basefront.common.exception.CustomException; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; - -/** - * 공통 유틸리티를 모아둔 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자          수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06    나혁제          최초작성
- *
- *      
- */ - -public class CommonUtil -{ - - /** - * nvl 메소드 - * @param inputStr - * @return - */ - public static String nvl(String inputStr) { - return (inputStr != null) ? inputStr.trim() : ""; - } - - /** - * nvl 메소드 - * @param inputStr - * @param defaultValue - * @return - */ - public static String nvl(String inputStr, String defaultValue) { - return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); - } - - /** - * nvl 메소드 - * @param inputObj - * @return - */ - public static String nvl(Object inputObj) { - return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; - } - - /** - * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 - * - * @param longTime long type 시간 - * @param dateFormat 변환할 포맷 - * @return 변환된 날짜 String - * @throws SystemException - */ - public static String getTimeString(long longTime, String dateFormat) throws CustomException { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); - - if (longTime < 0) - { - return ""; - } - else { - try { - return sdf.format(new Date(longTime)); - } catch (Exception e) { - throw new CustomException("Date 변환 오류"); - } - } - } - - /** - * 현재(한국기준) 시간정보를 얻는다.
- * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
- * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 - * 0~23시간 타입으로 Return.
- * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
- * @param format 얻고자하는 현재시간의 Type - * @return str 현재 한국 시간. - */ - public static String getKST(String format) - { - //1hour(ms) = 60s * 60m * 1000ms - int millisPerHour = 60 * 60 * 1000; - SimpleDateFormat fmt= new SimpleDateFormat(format); - - SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); - fmt.setTimeZone(timeZone); - - long time=System.currentTimeMillis(); - String str=fmt.format(new java.util.Date(time)); - return str; - } - - /** - * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 - * - * @param date - * string date (19991002) - * @param Day - * 기준이 되는 시간 - * @return String - */ - public static String getDatewithSpan(String date, long Day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month - * = Integer.valueOf(date.substring(4,6)).intValue(); int day = - * Integer.valueOf(date.substring(6,8)).intValue(); - * - * java.util.Calendar aDay = Calendar.getInstance(); - * aDay.set(year+1900,month,day); java.util.Calendar bDay - * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay - * = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); - * - * return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(date, Day, "D", vFORMAT); - - } - - /** - * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
- * - * @param date - * string date (20000315/2000031509/200003150915) - * @param unit - * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 - * @param type - * String type: D:Day H:Hour M:Minute - * @return String 계산된 문자열의 값. - */ - public static String getDatewithSpan(String date, long unit, String type, String strFormatType) - { - /* - * String formatType = strFormatType; int ihour = 0; int itime = 0; - * - * long dhm = 24 * 60 * 60 * 1000; - * - * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else - * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if - * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type - * + "은 부적절한 Type값입니다"; } - * - * switch (date.length()){ case (8): if (type.equals("H") || - * type.equals("M")) { return "HM-ERROR"; } - * - * break; case (10): if (type.equals("M")) { return "M-ERROR"; } - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case - * (12): - * - * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = - * Integer.valueOf(date.substring(10,12)).intValue(); break; default: - * return "date Length Error"; } - * - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int - * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = - * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar - * aDay = Calendar.getInstance(); - * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay - * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date - * cDay = new java.util.Date((aDay.getTime()).getTime() - - * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); - */ - // 2006-09-04 7:03오후 오동원수정 - String formatType = strFormatType; - int ihour = 0; - int itime = 0; - if(!(type.equals("D") || type.equals("H") || type.equals("M"))) - { - return type + "은 부적절한 Type값입니다"; - } - - switch(date.length()) - { - case (8): - if(type.equals("H") || type.equals("M")) - { - return "HM-ERROR"; - } - break; - case (10): - if(type.equals("M")) - { - return "M-ERROR"; - } - ihour = Integer.parseInt(date.substring(8, 10)); - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - break; - case (12): - ihour = Integer.parseInt(date.substring(8, 10)); - itime = Integer.parseInt(date.substring(10, 12)); - - // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); - // itime = Integer.valueOf(date.substring(10, 12)).intValue(); - break; - default: - return "date Length Error"; - } - int iyear = Integer.parseInt(date.substring(0, 4)); - int imonth = Integer.parseInt(date.substring(4, 6)); - int iday = Integer.parseInt(date.substring(6, 8)); - - /* - int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); - int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); - int iday = Integer.valueOf(date.substring(6, 8)).intValue(); - */ - - int imonth1 = imonth - 1; // 달은 0달부터 시작한다. - java.util.Calendar zDay = Calendar.getInstance(); - zDay.set(iyear, imonth1, iday, ihour, itime); - - if(type.equals("D")) - { - zDay.add(Calendar.DATE, (int) unit); - } - else if(type.equals("H")) - { - zDay.add(Calendar.HOUR_OF_DAY, (int) unit); - } - else if(type.equals("M")) - { - zDay.add(Calendar.MINUTE, (int) unit); - } - else - { - return type + "은 부적절한 Type값입니다"; - } - java.util.Date z1Day = zDay.getTime(); - java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); - return fmt2.format(z1Day); - - } - - /** - * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) - * - * @param day - * 더하려는 날짜 - * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 - */ - public static String getDatewithSpan(long day) - { - /* - * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new - * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new - * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); - * - * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 - * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; - * String str=fmt.format(new java.util.Date(time2)); - * - * return str; - */ - String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 - String vFORMAT = "yyyy/MM/dd"; - return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); - - } - - public static long stol(String str) - { - if(str == null ) return 0; - return (Long.valueOf(str).longValue()); - } - - public static int stoi(String str) - { - if(str == null ) return 0; - return (Integer.valueOf(str).intValue()); - } - - /** - 문자열을 중 특정 문자열을 변환시킨다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param targeter 대상문자열 - @param target_str 변환될 대상문자열 - @param replace_str 변환될 문자열 - @return target_str이 replace_str로 변환된 문자열 - */ - public static String getReplacedString(String targeter, String target_str, String replace_str) - { - if( targeter == null - || target_str == null - || replace_str == null ) - return "debug : parameter value is null"; - - if(target_str.length() == 0) - return targeter; - - StringBuffer str = new StringBuffer(); - int start_ptr = 0; - int current_ptr = 0; - int increment_size = replace_str.length(); - if(increment_size == 0 ) increment_size = 1; - - while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) - { - str.append(targeter.substring(start_ptr, current_ptr)); - str.append(replace_str); - start_ptr = current_ptr + increment_size; - if(start_ptr >= targeter.length()) - break; - }//end while - - if(start_ptr == 0) - return targeter; - - if(start_ptr < targeter.length()) - str.append(targeter.substring(start_ptr)); - - return str.toString(); - }//getReplacedString(String targeter, String target_str, String replace_str) - - /** - 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. - @version 1.0 - @author Yoon Su-wan - @since JDK1.0 - @param v_msg 대상문자열 - @param v_s1 변환될 대상문자열 - @param v_s2 변환될 문자열 - @return v_s1이 v_s2 변환된 문자열 - */ - - public static String getReplacedString2(String v_msg, String v_s1, String v_s2) - { - int idx = v_msg.indexOf(v_s1); - - if (idx == -1) return v_msg; - else - { - try - { - return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); - } catch (Exception e) - { - return v_msg.substring(0, idx) + v_s2; - } - } - - } - - public static String getReplacedString3(String sStr, String n1, String n2) - { - int iTmp = 0; - if (sStr == null) return ""; - - String sTmp = sStr; - StringBuffer sbSave = new StringBuffer(); - sbSave.append(""); - while (sTmp.indexOf(n1) > -1) - { - iTmp = sTmp.indexOf(n1); - sbSave.append(sTmp.substring(0,iTmp)); - sbSave.append(n2); - sTmp = sTmp.substring(iTmp + n1.length()); - } - sbSave.append(sTmp); - return sbSave.toString(); - } - - public static Vector arrToDouVector(String strArray, String strDelimt) - { - String[] stArray = strArray.split(strDelimt); - - double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); - Vector vReturn = new Vector(); - - if(dArray==null) return vReturn; - - for(double dTemp: dArray) - { - vReturn.add(dTemp); - } - - return vReturn; - - } - - public static String arrListToString(List list) - { - String strReturn=""; - - if(list == null ) return ""; - - for(int i=0; i"+strTemp); - // double dou = Double.parseDouble(strTemp); - // strReturn = strReturn+","+dou; - strReturn = strReturn+","+strTemp; - } - - strReturn = strReturn.substring(1); - - return strReturn; - - } - - /** - Map 데이터를 JSONObject로 변환. - @version 1.0 - @author 나혁제 - @since JDK1.0 - @param v_msg Map - @return JSONObject - */ - public static JSONObject getJsonFromMap(Map map) throws JSONException - { - JSONObject jsonData = new JSONObject(); - - for (String key : map.keySet()) - { - Object value = map.get(key); - if (value instanceof Map) - { - value = getJsonFromMap((Map) value); - } - jsonData.put(key, value); - } - return jsonData; - } - - public static String getClientIp(HttpServletRequest req) - { - String ip = req.getHeader("X-Forwarded-For"); - if (ip == null) ip = req.getRemoteAddr(); - return ip; - } - - /** - 보고서 body base64 변환 - front로 부터 받아서 DB저장시 사용 - @version 1.0 - @author 나혁제 - @since 2025.02.06 - @param txt String - @return String - */ - public static String base64encode(String txt) - { - try - { - byte[] bytes = Base64.getEncoder().encode((txt).getBytes("utf-8")); - return new String(bytes); - } - catch(Exception e) - { - e.printStackTrace(); - byte[] bytes = Base64.getEncoder().encode((txt).getBytes()); - return new String(bytes); - } - } - - /** - 서버(DB)에서 front로 전달시 사용 - @version 1.0 - @author 나혁제 - @since 2025.02.06 - @param txt String - @return String - */ - public static String base64decode(String txt) - { - byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); - - try - { - return new String(bytes, "utf-8"); - } - catch(Exception e) - { - e.printStackTrace(); - return new String(bytes); - } - } - - /** - *
-	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(Object src) - { - String src2 = src+""; - if (src == null || src.equals("null")) - { - return 0; - } - else - { - return Integer.parseInt(((String)src2).trim()); - } - } - - /** - *
-	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
-	 * @param src null값일 가능성이 있는 String 값.
-	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
-	 *
- */ - public static int zeroConvert(String src) - { - - if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) - { - return 0; - } - else - { - return Integer.parseInt(src.trim()); - } - } - - /** - *
-	 * 토큰정보 가져오기 
-	 *
- */ - public static TokenInfo getTokenInfo() - { - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - return memberVo.getTokenInfo(); - } - - /** - * Request에서 값을 가져온다. - * - * @version 1.0 - * @author Yoon Su-wan - * @since JDK1.0 - * @param req - * request - * @param v_s - * request key - * @return request key의 값 - */ - public static String getData(HttpServletRequest req, String v_s) - { - return getData(req, v_s, ""); - } - - /** - * Request에서 값을 가져온다. - * - * @version 1.0 - * @author Yoon Su-wan - * @since JDK1.0 - * @param req - * request - * @param v_s - * request key - * @param v_val - * 일치하는 key가 없을 경우의 return 값 - * @return request key의 값, 일치하는 키가 없을 경우 v_val로 리턴한다. - */ - public static String getData(HttpServletRequest req, String v_s, String v_val) - { - try - { - String rtn_val = req.getParameter(v_s); - if(rtn_val == null || rtn_val.equals("")) - rtn_val = v_val; - return rtn_val; - } - catch(Exception e) - { - return v_val; - } - } - - /** - * HashTable에서 값을 가져온다. - * - * @version 1.0 - * @author Yoon Su-wan - * @since JDK1.0 - * @param req - * Hashtable - * @param v_s - * Hashtable key - * @return Hashtable key의 값 - */ - public static String getData(Hashtable ht, String v_s) - { - return getData(ht, v_s, ""); - } - - /** - * Hashtable에서 값을 가져온다. - * - * @version 1.0 - * @author Yoon Su-wan - * @since JDK1.0 - * @param req - * Hashtable - * @param v_s - * Hashtable key - * @param v_val - * 일치하는 key가 없을 경우의 return 값 - * @return Hashtable key의 값, 일치하는 키가 없을 경우 v_val로 리턴한다. - */ - public static String getData(Hashtable ht, String v_s, String v_val) - { - try - { - String rtn_val = (String) ht.get(v_s); - if(rtn_val == null || rtn_val.equals("")) - rtn_val = v_val; - return rtn_val; - } - catch(Exception e) - { - return v_val; - } - } - - /** - * 2025.08.29 나혁제 환경정보 추출 - */ - public static String getEnvData(Environment env, String strProp) - { - String strReturn = env.getProperty(strProp); - - if(strReturn == null) strReturn =""; - - return strReturn; - } - - - - - - - - - -} +package com.urpsys.basefront.common.util; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; + +/** + * 공통 유틸리티를 모아둔 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자          수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.06    나혁제          최초작성
+ *
+ *      
+ */ + +public class CommonUtil +{ + + /** + * nvl 메소드 + * @param inputStr + * @return + */ + public static String nvl(String inputStr) { + return (inputStr != null) ? inputStr.trim() : ""; + } + + /** + * nvl 메소드 + * @param inputStr + * @param defaultValue + * @return + */ + public static String nvl(String inputStr, String defaultValue) { + return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); + } + + /** + * nvl 메소드 + * @param inputObj + * @return + */ + public static String nvl(Object inputObj) { + return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; + } + + /** + * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 + * + * @param longTime long type 시간 + * @param dateFormat 변환할 포맷 + * @return 변환된 날짜 String + * @throws SystemException + */ + public static String getTimeString(long longTime, String dateFormat) throws CustomException { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); + + if (longTime < 0) + { + return ""; + } + else { + try { + return sdf.format(new Date(longTime)); + } catch (Exception e) { + throw new CustomException("Date 변환 오류"); + } + } + } + + /** + * 현재(한국기준) 시간정보를 얻는다.
+ * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
+ * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 + * 0~23시간 타입으로 Return.
+ * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
+ * @param format 얻고자하는 현재시간의 Type + * @return str 현재 한국 시간. + */ + public static String getKST(String format) + { + //1hour(ms) = 60s * 60m * 1000ms + int millisPerHour = 60 * 60 * 1000; + SimpleDateFormat fmt= new SimpleDateFormat(format); + + SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); + fmt.setTimeZone(timeZone); + + long time=System.currentTimeMillis(); + String str=fmt.format(new java.util.Date(time)); + return str; + } + + /** + * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 + * + * @param date + * string date (19991002) + * @param Day + * 기준이 되는 시간 + * @return String + */ + public static String getDatewithSpan(String date, long Day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month + * = Integer.valueOf(date.substring(4,6)).intValue(); int day = + * Integer.valueOf(date.substring(6,8)).intValue(); + * + * java.util.Calendar aDay = Calendar.getInstance(); + * aDay.set(year+1900,month,day); java.util.Calendar bDay + * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay + * = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); + * + * return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(date, Day, "D", vFORMAT); + + } + + /** + * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
+ * + * @param date + * string date (20000315/2000031509/200003150915) + * @param unit + * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 + * @param type + * String type: D:Day H:Hour M:Minute + * @return String 계산된 문자열의 값. + */ + public static String getDatewithSpan(String date, long unit, String type, String strFormatType) + { + /* + * String formatType = strFormatType; int ihour = 0; int itime = 0; + * + * long dhm = 24 * 60 * 60 * 1000; + * + * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else + * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if + * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type + * + "은 부적절한 Type값입니다"; } + * + * switch (date.length()){ case (8): if (type.equals("H") || + * type.equals("M")) { return "HM-ERROR"; } + * + * break; case (10): if (type.equals("M")) { return "M-ERROR"; } + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case + * (12): + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = + * Integer.valueOf(date.substring(10,12)).intValue(); break; default: + * return "date Length Error"; } + * + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int + * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = + * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar + * aDay = Calendar.getInstance(); + * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay + * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date + * cDay = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String formatType = strFormatType; + int ihour = 0; + int itime = 0; + if(!(type.equals("D") || type.equals("H") || type.equals("M"))) + { + return type + "은 부적절한 Type값입니다"; + } + + switch(date.length()) + { + case (8): + if(type.equals("H") || type.equals("M")) + { + return "HM-ERROR"; + } + break; + case (10): + if(type.equals("M")) + { + return "M-ERROR"; + } + ihour = Integer.parseInt(date.substring(8, 10)); + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + break; + case (12): + ihour = Integer.parseInt(date.substring(8, 10)); + itime = Integer.parseInt(date.substring(10, 12)); + + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + // itime = Integer.valueOf(date.substring(10, 12)).intValue(); + break; + default: + return "date Length Error"; + } + int iyear = Integer.parseInt(date.substring(0, 4)); + int imonth = Integer.parseInt(date.substring(4, 6)); + int iday = Integer.parseInt(date.substring(6, 8)); + + /* + int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); + int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); + int iday = Integer.valueOf(date.substring(6, 8)).intValue(); + */ + + int imonth1 = imonth - 1; // 달은 0달부터 시작한다. + java.util.Calendar zDay = Calendar.getInstance(); + zDay.set(iyear, imonth1, iday, ihour, itime); + + if(type.equals("D")) + { + zDay.add(Calendar.DATE, (int) unit); + } + else if(type.equals("H")) + { + zDay.add(Calendar.HOUR_OF_DAY, (int) unit); + } + else if(type.equals("M")) + { + zDay.add(Calendar.MINUTE, (int) unit); + } + else + { + return type + "은 부적절한 Type값입니다"; + } + java.util.Date z1Day = zDay.getTime(); + java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); + return fmt2.format(z1Day); + + } + + /** + * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) + * + * @param day + * 더하려는 날짜 + * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 + */ + public static String getDatewithSpan(long day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 + * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; + * String str=fmt.format(new java.util.Date(time2)); + * + * return str; + */ + String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); + + } + + public static long stol(String str) + { + if(str == null ) return 0; + return (Long.valueOf(str).longValue()); + } + + public static int stoi(String str) + { + if(str == null ) return 0; + return (Integer.valueOf(str).intValue()); + } + + /** + 문자열을 중 특정 문자열을 변환시킨다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param targeter 대상문자열 + @param target_str 변환될 대상문자열 + @param replace_str 변환될 문자열 + @return target_str이 replace_str로 변환된 문자열 + */ + public static String getReplacedString(String targeter, String target_str, String replace_str) + { + if( targeter == null + || target_str == null + || replace_str == null ) + return "debug : parameter value is null"; + + if(target_str.length() == 0) + return targeter; + + StringBuffer str = new StringBuffer(); + int start_ptr = 0; + int current_ptr = 0; + int increment_size = replace_str.length(); + if(increment_size == 0 ) increment_size = 1; + + while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) + { + str.append(targeter.substring(start_ptr, current_ptr)); + str.append(replace_str); + start_ptr = current_ptr + increment_size; + if(start_ptr >= targeter.length()) + break; + }//end while + + if(start_ptr == 0) + return targeter; + + if(start_ptr < targeter.length()) + str.append(targeter.substring(start_ptr)); + + return str.toString(); + }//getReplacedString(String targeter, String target_str, String replace_str) + + /** + 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg 대상문자열 + @param v_s1 변환될 대상문자열 + @param v_s2 변환될 문자열 + @return v_s1이 v_s2 변환된 문자열 + */ + + public static String getReplacedString2(String v_msg, String v_s1, String v_s2) + { + int idx = v_msg.indexOf(v_s1); + + if (idx == -1) return v_msg; + else + { + try + { + return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); + } catch (Exception e) + { + return v_msg.substring(0, idx) + v_s2; + } + } + + } + + public static String getReplacedString3(String sStr, String n1, String n2) + { + int iTmp = 0; + if (sStr == null) return ""; + + String sTmp = sStr; + StringBuffer sbSave = new StringBuffer(); + sbSave.append(""); + while (sTmp.indexOf(n1) > -1) + { + iTmp = sTmp.indexOf(n1); + sbSave.append(sTmp.substring(0,iTmp)); + sbSave.append(n2); + sTmp = sTmp.substring(iTmp + n1.length()); + } + sbSave.append(sTmp); + return sbSave.toString(); + } + + public static Vector arrToDouVector(String strArray, String strDelimt) + { + String[] stArray = strArray.split(strDelimt); + + double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); + Vector vReturn = new Vector(); + + if(dArray==null) return vReturn; + + for(double dTemp: dArray) + { + vReturn.add(dTemp); + } + + return vReturn; + + } + + public static String arrListToString(List list) + { + String strReturn=""; + + if(list == null ) return ""; + + for(int i=0; i"+strTemp); + // double dou = Double.parseDouble(strTemp); + // strReturn = strReturn+","+dou; + strReturn = strReturn+","+strTemp; + } + + strReturn = strReturn.substring(1); + + return strReturn; + + } + + /** + Map 데이터를 JSONObject로 변환. + @version 1.0 + @author 나혁제 + @since JDK1.0 + @param v_msg Map + @return JSONObject + */ + public static JSONObject getJsonFromMap(Map map) throws JSONException + { + JSONObject jsonData = new JSONObject(); + + for (String key : map.keySet()) + { + Object value = map.get(key); + if (value instanceof Map) + { + value = getJsonFromMap((Map) value); + } + jsonData.put(key, value); + } + return jsonData; + } + + public static String getClientIp(HttpServletRequest req) + { + String ip = req.getHeader("X-Forwarded-For"); + if (ip == null) ip = req.getRemoteAddr(); + return ip; + } + + /** + 보고서 body base64 변환 + front로 부터 받아서 DB저장시 사용 + @version 1.0 + @author 나혁제 + @since 2025.02.06 + @param txt String + @return String + */ + public static String base64encode(String txt) + { + try + { + byte[] bytes = Base64.getEncoder().encode((txt).getBytes("utf-8")); + return new String(bytes); + } + catch(Exception e) + { + e.printStackTrace(); + byte[] bytes = Base64.getEncoder().encode((txt).getBytes()); + return new String(bytes); + } + } + + /** + 서버(DB)에서 front로 전달시 사용 + @version 1.0 + @author 나혁제 + @since 2025.02.06 + @param txt String + @return String + */ + public static String base64decode(String txt) + { + byte[] bytes = Base64.getDecoder().decode(txt.getBytes()); + + try + { + return new String(bytes, "utf-8"); + } + catch(Exception e) + { + e.printStackTrace(); + return new String(bytes); + } + } + + /** + *
+	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(Object src) + { + String src2 = src+""; + if (src == null || src.equals("null")) + { + return 0; + } + else + { + return Integer.parseInt(((String)src2).trim()); + } + } + + /** + *
+	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+	 * @param src null값일 가능성이 있는 String 값.
+	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+	 *
+ */ + public static int zeroConvert(String src) + { + + if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) + { + return 0; + } + else + { + return Integer.parseInt(src.trim()); + } + } + + /** + *
+	 * 토큰정보 가져오기 
+	 *
+ */ + public static TokenInfo getTokenInfo() + { + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + return memberVo.getTokenInfo(); + } + + /** + * Request에서 값을 가져온다. + * + * @version 1.0 + * @author Yoon Su-wan + * @since JDK1.0 + * @param req + * request + * @param v_s + * request key + * @return request key의 값 + */ + public static String getData(HttpServletRequest req, String v_s) + { + return getData(req, v_s, ""); + } + + /** + * Request에서 값을 가져온다. + * + * @version 1.0 + * @author Yoon Su-wan + * @since JDK1.0 + * @param req + * request + * @param v_s + * request key + * @param v_val + * 일치하는 key가 없을 경우의 return 값 + * @return request key의 값, 일치하는 키가 없을 경우 v_val로 리턴한다. + */ + public static String getData(HttpServletRequest req, String v_s, String v_val) + { + try + { + String rtn_val = req.getParameter(v_s); + if(rtn_val == null || rtn_val.equals("")) + rtn_val = v_val; + return rtn_val; + } + catch(Exception e) + { + return v_val; + } + } + + /** + * HashTable에서 값을 가져온다. + * + * @version 1.0 + * @author Yoon Su-wan + * @since JDK1.0 + * @param req + * Hashtable + * @param v_s + * Hashtable key + * @return Hashtable key의 값 + */ + public static String getData(Hashtable ht, String v_s) + { + return getData(ht, v_s, ""); + } + + /** + * Hashtable에서 값을 가져온다. + * + * @version 1.0 + * @author Yoon Su-wan + * @since JDK1.0 + * @param req + * Hashtable + * @param v_s + * Hashtable key + * @param v_val + * 일치하는 key가 없을 경우의 return 값 + * @return Hashtable key의 값, 일치하는 키가 없을 경우 v_val로 리턴한다. + */ + public static String getData(Hashtable ht, String v_s, String v_val) + { + try + { + String rtn_val = (String) ht.get(v_s); + if(rtn_val == null || rtn_val.equals("")) + rtn_val = v_val; + return rtn_val; + } + catch(Exception e) + { + return v_val; + } + } + + /** + * 2025.08.29 나혁제 환경정보 추출 + */ + public static String getEnvData(Environment env, String strProp) + { + String strReturn = env.getProperty(strProp); + + if(strReturn == null) strReturn =""; + + return strReturn; + } + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/common/util/ConvertUtils.java b/front/src/main/java/com/urpsys/basefront/common/util/ConvertUtils.java deleted file mode 100644 index 4f8ff826..00000000 --- a/front/src/main/java/com/urpsys/basefront/common/util/ConvertUtils.java +++ /dev/null @@ -1,425 +0,0 @@ -package com.urpsys.basefront.common.util; - -import java.lang.reflect.Field; -import java.util.*; - -import org.springframework.util.ObjectUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import kong.unirest.json.JSONArray; -import kong.unirest.json.JSONException; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * 데이터 유형 변환 처리 모음 Util 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자        수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06    나혁제         최초작성
- *
- *      
- */ -@Slf4j -public class ConvertUtils -{ - private ConvertUtils() {} - - /** - Object Type을 Map 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param Object obj - @return Map - */ - public static Map convertToMap(Object obj) - { - try - { - if (Objects.isNull(obj)) - { - return Collections.emptyMap(); - } - - Map convertMap = new HashMap<>(); - - Field[] fields = obj.getClass().getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - convertMap.put(field.getName(), field.get(obj)); - } - - return convertMap; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Object Type의 List을 Map List 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param List list - @return List> - */ - public static List> convertToMaps(List list) - { - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List> convertList = new ArrayList<>(list.size()); - - for (Object obj : list) - { - convertList.add(ConvertUtils.convertToMap(obj)); - } - return convertList; - } - - - /** - Object Type을 Map 타입으로 변환처리 (확장영역까지 변환) - @version 1.0 - @author 나혁제 - @param Object obj - @return Map - */ - public static Map convertToMapAll(Object obj) - { - try - { - if (Objects.isNull(obj)) - { - return Collections.emptyMap(); - } - - Class upType = obj.getClass(); - - Map convertMap = new HashMap<>(); - - while(true) - { - - Field[] fields = upType.getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - convertMap.put(field.getName(), field.get(obj)); - } - - if(upType.getSuperclass() == null ) - { - break; - } - else - { - upType = upType.getSuperclass(); - } - } - - return convertMap; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map 데이터를 입력괸 클래스 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param Map map 입력맵 - Class type 변환 클래스 - @return T 변환된 븤래스 - */ - public static T convertToValueObject(Map map, Class type) - { - try - { - Objects.requireNonNull(type, "Class cannot be null"); - T instance = type.getConstructor().newInstance(); - - if (map == null || map.isEmpty()) - { - return instance; - } - - for (Map.Entry entry : map.entrySet()) - { - Field[] fields = type.getDeclaredFields(); - - for (Field field : fields) - { - field.setAccessible(true); - String name = field.getName(); - - boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); - boolean isSameName = entry.getKey().equals(name); - - if (isSameType && isSameName) - { - field.set(instance, map.get(name)); - break; - } - } - } - return instance; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 - @version 1.0 - @author 나혁제 - @param List> list - Class type 변환 클래스 - @return T 변환된 리스트 - */ - public static List convertToValueObjects(List> list, Class type) - { - Objects.requireNonNull(type, "Class cannot be null"); - - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List convertList = new ArrayList<>(list.size()); - - for (Map map : list) - { - convertList.add(ConvertUtils.convertToValueObject(map, type)); - } - return convertList; - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장영역) - @version 1.0 - @author 나혁제 - @param Map map 입력맵 - Class type 변환 클래스 - @return T 변환된 븤래스 - */ - public static T convertToValueObjectAll(Map map, Class type) - { - try - { - Objects.requireNonNull(type, "Class cannot be null"); - T instance = type.getConstructor().newInstance(); - - if (map == null || map.isEmpty()) - { - return instance; - } - - for (Map.Entry entry : map.entrySet()) - { - Class upType = type; - - while(true) - { - Boolean bExist = false; - Field[] fields = upType.getDeclaredFields(); - - if(fields == null || fields.length==0) break; - - for (Field field : fields) - { - field.setAccessible(true); - String name = field.getName(); - - boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType())); - boolean isSameName = entry.getKey().equals(name); - - if (isSameType && isSameName) - { - field.set(instance, map.get(name)); - bExist = true; - break; - } - } - - if(bExist) break; - - if(upType.getSuperclass().getClass() == null) - { - break; - } - else - { - upType = upType.getSuperclass(); - } - } - } - - return instance; - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장된 클래스 처리) - @version 1.0 - @author 나혁제 - @param v_msg Map - @return List - */ - public static List convertToValueObjectsAll(List> list, Class type) - { - Objects.requireNonNull(type, "Class cannot be null"); - - if (list == null || list.isEmpty()) - { - return Collections.emptyList(); - } - - List convertList = new ArrayList<>(list.size()); - - for (Map map : list) - { - convertList.add(ConvertUtils.convertToValueObjectAll(map, type)); - } - return convertList; - } - - private static Class getReferenceType(Class type) - { - switch (type.getName()) { - case "boolean" : return Boolean.class; - case "byte" : return Byte.class; - case "short" : return Short.class; - case "char" : return Character.class; - case "int" : return Integer.class; - case "long" : return Long.class; - case "float" : return Float.class; - case "double" : return Double.class; - default : return type; - } - } - - /** - Map 데이터를 JSONObject로 변환. - @version 1.0 - @author 나혁제 - @param v_msg Map - @return JSONObject - */ - public static JSONObject getJsonFromMap(Map map) throws JSONException - { - JSONObject jsonData = new JSONObject(); - - for (String key : map.keySet()) - { - Object value = map.get(key); - if (value instanceof Map) - { - value = getJsonFromMap((Map) value); - } - jsonData.put(key, value); - } - return jsonData; - } - - /** - List 데이터를 JSONArray로 변환. - @version 1.0 - @author 나혁제 - @param v_msg Map - @return JSONObject - */ - public static JSONArray getJsonFromList(List> list) throws JSONException - { - - JSONArray jsonArr = new JSONArray(); - - for(Map map : list) - { - JSONObject jsonObj = getJsonFromMap(map); - jsonArr.put(jsonObj); - } - - return jsonArr; - } - - - /** - * jsonObject --> map 으로 변경 - * JSONObject 에 JSONArray 없어야 햠. - * @author 나혁제 - * @param obj - * @return - */ - public static Map getMapFromJSONObject(JSONObject obj) - { - if (ObjectUtils.isEmpty(obj)) - { - log.error("BAD REQUEST obj : {}", obj); - throw new IllegalArgumentException(String.format("BAD REQUEST obj %s", obj)); - } - - try - { - return new ObjectMapper().readValue(obj.toString(), Map.class); - } - catch (Exception e) - { - log.error(e.getMessage(), e); - throw new RuntimeException(e); - } - } - - /** - * json array 를 list map 으로 변경. - * - * @author 나혁제 - * @param jsonArray - * @return 값이 있으면 list map, 없으면 list 빈 값 return - */ - public static List> getListMapFromJsonArray(JSONArray jsonArray) - { - if (ObjectUtils.isEmpty(jsonArray)) - { - log.error("jsonArray is null."); - throw new IllegalArgumentException("jsonArray is null"); - } - - List> list = new ArrayList<>(); - - for (Object jsonObject : jsonArray) - { - list.add(getMapFromJSONObject((JSONObject) jsonObject)); - } - return list; - } - - - - - -} diff --git a/front/src/main/java/com/urpsys/basefront/common/util/HtmlEmailUtil.java b/front/src/main/java/com/urpsys/basefront/common/util/HtmlEmailUtil.java index 77d0fec8..9efdd834 100644 --- a/front/src/main/java/com/urpsys/basefront/common/util/HtmlEmailUtil.java +++ b/front/src/main/java/com/urpsys/basefront/common/util/HtmlEmailUtil.java @@ -1,154 +1,154 @@ -package com.urpsys.basefront.common.util; - -import java.io.IOException; - -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeUtility; - -import org.apache.commons.mail.DefaultAuthenticator; -import org.apache.commons.mail.EmailAttachment; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.MultiPartEmail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.ByteArrayResource; -import org.springframework.mail.MailException; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -import org.springframework.util.StringUtils; - -import org.apache.commons.io.IOUtils; - -import com.urpsys.basefront.common.crypto.Aes256Cipher; - -import lombok.extern.slf4j.Slf4j; - -/** - * Html 메일 처리에 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.02.11 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.02.11   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("HtmlEmailUtil") -public class HtmlEmailUtil -{ - - @Autowired - private HtmlEmailUtil(JavaMailSender mailSender) - { - this.mailSender = mailSender; - } - - @Value("${custom.sendmail.sendEmail}") - private String strMailAddress; - - @Value("${custom.sendmail.senderName}") - private String strMailSendName; - - private static JavaMailSender mailSender; - - /** - 메일처리 기본함수 - @author 나혁제 - @since 2025.02.11 - @param : String to 받는사람 - String sj 제목 - String cn 메시지 - @return String 처리결과 - * @throws Exception - */ - public boolean send(String to, String sj, String cn) - { - if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 - - try - { - MimeMessage message = mailSender.createMimeMessage(); - MimeMessageHelper messageHelper = new MimeMessageHelper(message, false, "UTF-8"); - - messageHelper.setSubject(sj); - messageHelper.setText(cn, true); - messageHelper.setFrom(strMailAddress); - - String[] toArr = to.split(","); - - messageHelper.setTo(toArr); - - mailSender.send(message); // 메일발송 - - return true; - } - catch(MailException es) - { - es.printStackTrace(); - return false; - } - catch(Exception e) - { - e.printStackTrace(); - return false; - } - } - - public void sendMultipleMessage( String to - , String cc - , String sj - , String cn - , MultipartFile file) throws MessagingException, IOException - { - MimeMessage message = mailSender.createMimeMessage(); - MimeMessageHelper helper = new MimeMessageHelper(message, true); - - //메일 제목 설정 - helper.setSubject(sj); - - //참조자 설정 - helper.setCc(cc); - - helper.setText(cn, false); - - helper.setFrom(strMailAddress); - - //첨부 파일 설정 - String fileName = StringUtils.cleanPath(file.getOriginalFilename()); - - helper.addAttachment( MimeUtility.encodeText(fileName, "UTF-8", "B") - , new ByteArrayResource(IOUtils.toByteArray(file.getInputStream()))); - - //수신자 개별 전송 -// for(String s : mailDto.getAddress()) { -// helper.setTo(s); -// emailSender.send(message); -// } - //수신자 한번에 전송 - helper.setTo(to); - mailSender.send(message); - log.info("mail multiple send complete."); - - - } - - - - - -} +package com.urpsys.basefront.common.util; + +import java.io.IOException; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import org.apache.commons.mail.DefaultAuthenticator; +import org.apache.commons.mail.EmailAttachment; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.mail.MailException; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import org.springframework.util.StringUtils; + +import org.apache.commons.io.IOUtils; + +import com.urpsys.common.crypto.Aes256Cipher; + +import lombok.extern.slf4j.Slf4j; + +/** + * Html 메일 처리에 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.02.11 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.02.11   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("HtmlEmailUtil") +public class HtmlEmailUtil +{ + + @Autowired + private HtmlEmailUtil(JavaMailSender mailSender) + { + this.mailSender = mailSender; + } + + @Value("${custom.sendmail.sendEmail}") + private String strMailAddress; + + @Value("${custom.sendmail.senderName}") + private String strMailSendName; + + private static JavaMailSender mailSender; + + /** + 메일처리 기본함수 + @author 나혁제 + @since 2025.02.11 + @param : String to 받는사람 + String sj 제목 + String cn 메시지 + @return String 처리결과 + * @throws Exception + */ + public boolean send(String to, String sj, String cn) + { + if (StringUtils.isEmpty(to)) return false; // 수신자가 없을 경우 종료 + + try + { + MimeMessage message = mailSender.createMimeMessage(); + MimeMessageHelper messageHelper = new MimeMessageHelper(message, false, "UTF-8"); + + messageHelper.setSubject(sj); + messageHelper.setText(cn, true); + messageHelper.setFrom(strMailAddress); + + String[] toArr = to.split(","); + + messageHelper.setTo(toArr); + + mailSender.send(message); // 메일발송 + + return true; + } + catch(MailException es) + { + es.printStackTrace(); + return false; + } + catch(Exception e) + { + e.printStackTrace(); + return false; + } + } + + public void sendMultipleMessage( String to + , String cc + , String sj + , String cn + , MultipartFile file) throws MessagingException, IOException + { + MimeMessage message = mailSender.createMimeMessage(); + MimeMessageHelper helper = new MimeMessageHelper(message, true); + + //메일 제목 설정 + helper.setSubject(sj); + + //참조자 설정 + helper.setCc(cc); + + helper.setText(cn, false); + + helper.setFrom(strMailAddress); + + //첨부 파일 설정 + String fileName = StringUtils.cleanPath(file.getOriginalFilename()); + + helper.addAttachment( MimeUtility.encodeText(fileName, "UTF-8", "B") + , new ByteArrayResource(IOUtils.toByteArray(file.getInputStream()))); + + //수신자 개별 전송 +// for(String s : mailDto.getAddress()) { +// helper.setTo(s); +// emailSender.send(message); +// } + //수신자 한번에 전송 + helper.setTo(to); + mailSender.send(message); + log.info("mail multiple send complete."); + + + } + + + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/common/util/MultiPartEmailUtil.java b/front/src/main/java/com/urpsys/basefront/common/util/MultiPartEmailUtil.java index bd645735..622241e6 100644 --- a/front/src/main/java/com/urpsys/basefront/common/util/MultiPartEmailUtil.java +++ b/front/src/main/java/com/urpsys/basefront/common/util/MultiPartEmailUtil.java @@ -1,141 +1,141 @@ -package com.urpsys.basefront.common.util; - -import org.apache.commons.mail.DefaultAuthenticator; -import org.apache.commons.mail.EmailAttachment; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.MultiPartEmail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import com.urpsys.basefront.common.crypto.Aes256Cipher; - -import lombok.extern.slf4j.Slf4j; - -/** - * 메일 처리에 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.02.11 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.02.11   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("MultiPartEmailUtil") -public class MultiPartEmailUtil -{ - @Value("${custom.sendmail.id}") - private String strMailId; - - @Value("${custom.sendmail.password}") - private String strMailPass; - - @Value("${custom.sendmail.port}") - private int strMailPort; - - @Value("${custom.sendmail.host}") - private String strMailHost; - - @Value("${custom.sendmail.sendEmail}") - private String strMailAddress; - - @Value("${custom.sendmail.senderName}") - private String strMailSendName; - - @Autowired - private Aes256Cipher aes256Cipher; - - /** - 메일처리 기본함수 - @author 나혁제 - @since 2025.01.06 - @param : 없음 - @return String 처리결과 - * @throws Exception - */ - public String send() throws EmailException - { - MultiPartEmail email = new MultiPartEmail(); - - email.setCharset("UTF-8"); - email.setHostName(this.strMailHost); - email.setSmtpPort(this.strMailPort); - email.setStartTLSEnabled(true); - email.setAuthenticator(new DefaultAuthenticator( aes256Cipher.decrypt(this.strMailId) - , aes256Cipher.decrypt(this.strMailPass) - )); - email.setSocketConnectionTimeout(60000); - email.setSocketTimeout(60000); - email.setFrom(this.strMailAddress, this.strMailSendName); - - return email.send(); - } - - /** - 메일처리 기본함수 - @author 나혁제 - @since 2025.02.11 - @param : String addTo 받는사람 - String subject 제목 - String msg 메시지 - @return String 처리결과 - * @throws Exception - */ - public String send(String addTo, String subject, String msg) throws EmailException - { - return send(addTo, subject, msg, null); - } - - /** - 메일처리 기본함수 - @author 나혁제 - @since 2025.02.11 - @param : String addTo 받는사람 - String subject 제목 - String msg 메시지 - EmailAttachment attachment 첨부파일 - @return String 처리결과 - * @throws Exception - */ - public String send(String addTo, String subject, String msg, EmailAttachment attachment) throws EmailException - { - MultiPartEmail email = new MultiPartEmail(); - - email.setCharset("UTF-8"); - email.setHostName(this.strMailHost); - email.setSmtpPort(this.strMailPort); - email.setStartTLSEnabled(true); - email.setAuthenticator(new DefaultAuthenticator( aes256Cipher.decrypt(this.strMailId) - , aes256Cipher.decrypt(this.strMailPass) - )); - email.setSocketConnectionTimeout(60000); - email.setSocketTimeout(60000); - email.setFrom(this.strMailAddress, this.strMailSendName); - email.addTo(addTo); - email.setSubject(subject); - email.setMsg(msg); - - if (attachment != null) - { - email.attach(attachment); - } - - return email.send(); - - } - - - -} +package com.urpsys.basefront.common.util; + +import org.apache.commons.mail.DefaultAuthenticator; +import org.apache.commons.mail.EmailAttachment; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.urpsys.common.crypto.Aes256Cipher; + +import lombok.extern.slf4j.Slf4j; + +/** + * 메일 처리에 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.02.11 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.02.11   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("MultiPartEmailUtil") +public class MultiPartEmailUtil +{ + @Value("${custom.sendmail.id}") + private String strMailId; + + @Value("${custom.sendmail.password}") + private String strMailPass; + + @Value("${custom.sendmail.port}") + private int strMailPort; + + @Value("${custom.sendmail.host}") + private String strMailHost; + + @Value("${custom.sendmail.sendEmail}") + private String strMailAddress; + + @Value("${custom.sendmail.senderName}") + private String strMailSendName; + + @Autowired + private Aes256Cipher aes256Cipher; + + /** + 메일처리 기본함수 + @author 나혁제 + @since 2025.01.06 + @param : 없음 + @return String 처리결과 + * @throws Exception + */ + public String send() throws EmailException + { + MultiPartEmail email = new MultiPartEmail(); + + email.setCharset("UTF-8"); + email.setHostName(this.strMailHost); + email.setSmtpPort(this.strMailPort); + email.setStartTLSEnabled(true); + email.setAuthenticator(new DefaultAuthenticator( aes256Cipher.decrypt(this.strMailId) + , aes256Cipher.decrypt(this.strMailPass) + )); + email.setSocketConnectionTimeout(60000); + email.setSocketTimeout(60000); + email.setFrom(this.strMailAddress, this.strMailSendName); + + return email.send(); + } + + /** + 메일처리 기본함수 + @author 나혁제 + @since 2025.02.11 + @param : String addTo 받는사람 + String subject 제목 + String msg 메시지 + @return String 처리결과 + * @throws Exception + */ + public String send(String addTo, String subject, String msg) throws EmailException + { + return send(addTo, subject, msg, null); + } + + /** + 메일처리 기본함수 + @author 나혁제 + @since 2025.02.11 + @param : String addTo 받는사람 + String subject 제목 + String msg 메시지 + EmailAttachment attachment 첨부파일 + @return String 처리결과 + * @throws Exception + */ + public String send(String addTo, String subject, String msg, EmailAttachment attachment) throws EmailException + { + MultiPartEmail email = new MultiPartEmail(); + + email.setCharset("UTF-8"); + email.setHostName(this.strMailHost); + email.setSmtpPort(this.strMailPort); + email.setStartTLSEnabled(true); + email.setAuthenticator(new DefaultAuthenticator( aes256Cipher.decrypt(this.strMailId) + , aes256Cipher.decrypt(this.strMailPass) + )); + email.setSocketConnectionTimeout(60000); + email.setSocketTimeout(60000); + email.setFrom(this.strMailAddress, this.strMailSendName); + email.addTo(addTo); + email.setSubject(subject); + email.setMsg(msg); + + if (attachment != null) + { + email.attach(attachment); + } + + return email.send(); + + } + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/common/util/RestApiCallUtil.java b/front/src/main/java/com/urpsys/basefront/common/util/RestApiCallUtil.java index 359207c2..1099fd35 100644 --- a/front/src/main/java/com/urpsys/basefront/common/util/RestApiCallUtil.java +++ b/front/src/main/java/com/urpsys/basefront/common/util/RestApiCallUtil.java @@ -1,420 +1,420 @@ -package com.urpsys.basefront.common.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.codec.binary.Base64; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.exception.CustomException; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; - -import kong.unirest.HttpResponse; -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import kong.unirest.json.JSONArray; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * Rest Api 을 호출하는 필요한 유틸리티 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일       수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06   나혁제         최초작성
- *
- *      
- */ - - -@Slf4j -@Component("RestApiCallUtil") -public class RestApiCallUtil -{ - @Value("${custom.api_server}") - private String strApiServer; // API 서버 - - @Value("${custom.api_search_server}") - private String strApiSearchSvr; // API 서버 - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCall( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info("=============== RestApiCall null ==============="); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - return RestApiCall( memberVo.getTokenInfo(), bodyMap, strRestUrl); - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : HttpServletRequest request - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCall( HttpServletRequest request - , Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info("=============== RestApiCall request ==============="); - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - - return RestApiCall( tokenInfo, bodyMap, strRestUrl); - } - - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCall( TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCall tokenInfo <<<<<<<<<<<<<<<"); - - /* - log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); - log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); - */ - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - - headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); - // Header Setting End --------------------------------- - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - - String strDomain = strApiServer; - String strFullUrl = strDomain + strRestUrl; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - String strFullReturnData = returnObj.toString(); - - // 개발완료 후 주석처리 - // log.info("전체 리턴값 => [{}]", returnObj.toString()); - - // Map 변환처리 - Map returnMap = null; - - // 비정상처리 - if(strFullReturnData.indexOf("status")<0) - { - String strError = (String)returnObj.get("error"); - String strMessage = (String)returnObj.get("message"); - - throw new CustomException("9000", strMessage); - } - // 정상처리 - else - { - // log.info("한번 봅시다 2. => [{}]", returnObj.get("status")); - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - } - - // json to Map 변환처리 - returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); - } - - log.info("<<<<<<<<<<<<<<< RestApiCall >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNoAuth ( Map bodyMap - , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNoHead <<<<<<<<<<<<<<<"); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - // Header Setting End --------------------------------- - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - - String strDomain = strApiServer; - String strFullUrl = strDomain + strRestUrl; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - int iReturnStatus = (int)returnObj.get("status"); - - if(iReturnStatus != 200) - { - String strError = (String)returnObj.get("error"); - String strErrTrace = (String)returnObj.get("trace"); - - throw new CustomException("9000", strErrTrace); - } - else - { - returnObjData = returnObj.getJSONObject("data"); - log.info("리턴값 확인 => [{}]", returnObjData.toString()); - } - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallNoHead >>>>>>>>>>>>>>>"); - - return returnMap; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.01.06 - @param : TokenInfo tokenInfo - , Map bodyMap - , String strRestUrl - @return Map - * @throws CustomException - */ - public Map RestApiCallNaver() throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallNaver <<<<<<<<<<<<<<<"); - - /* - log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); - log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); - */ - - long timestamp = System.currentTimeMillis(); - - String strTime = timestamp+""; - - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type" , "application/json; charset=utf-8" ); - headers.put("x-ncp-apigw-timestamp" , strTime ); - headers.put("x-ncp-iam-access-key" , "ncp_iam_BPAMKR4Le2ali6vfRCsG" ); - headers.put("x-ncp-apigw-signature-v2" , makeSignature(strTime) ); - // Header Setting End --------------------------------- - - log.info("headers 입력값 확인 => [{}]", headers.toString()); - - Map bodyMap = new HashMap<>(); - - - bodyMap.put("type", "SMS"); - bodyMap.put("contentType", "COMM"); - bodyMap.put("countryCode", "82"); - bodyMap.put("from", "001068028984"); - bodyMap.put("content", "화이팅"); - - List> messagesList = new ArrayList<>(); - - Map messages = new HashMap<>(); - messages.put("to", "001068028984"); - - messagesList.add(messages); - - bodyMap.put("messages", messagesList); - - log.info("body 입력값 확인 => [{}]", bodyMap.toString()); - - log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); - - - - String strFullUrl = "https://sens.apigw.ntruss.com/sms/v2/services/ncp:sms:kr:349487426099:uritms/messages"; - - log.info("strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.post(strFullUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = new JSONObject(); - - String strFullReturnData = returnObj.toString(); - - log.info("전체 리턴값 => [{}]", returnObj.toString()); - - // Map 변환처리 - Map returnMap = null; - - // json to Map 변환처리 - returnMap = ConvertUtils.getMapFromJSONObject(returnObj); - - log.info("<<<<<<<<<<<<<<< RestApiCallNaver >>>>>>>>>>>>>>>"); - - return returnMap; - } - - public String makeSignature(String timestamp) - { - String encodeBase64String = ""; - - try { - String space = " "; // one space - String newLine = "\n"; // new line - String method = "POST"; // method - String url = "/sms/v2/services/ncp:sms:kr:349487426099:uritms/messages"; // url (include query string) - String accessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; // access key id (from portal or Sub Account) - String secretKey = "ncp_iam_BPKMKRIOXMe91u5YQoPjmk5WZ2A1FNEcoR"; - - String message = new StringBuilder() - .append(method) - .append(space) - .append(url) - .append(newLine) - .append(timestamp) - .append(newLine) - .append(accessKey) - .toString(); - - SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); - Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(signingKey); - - byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); - encodeBase64String = Base64.encodeBase64String(rawHmac); - } - catch(Exception e) - { - e.printStackTrace(); - } - - return encodeBase64String; - } - - /** - RestApi 호출 함수 - @author 나혁제 - @since 2025.04.25 - * @throws CustomException - */ - public Map RestApiCallSearch ( Map bodyMap , String strRestUrl ) throws CustomException - { - log.info(">>>>>>>>>>>>>>> RestApiCallSearch <<<<<<<<<<<<<<<"); - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - // Header Setting End --------------------------------- - - String strDomain = strApiSearchSvr; - String strFullUrl = strDomain + strRestUrl; - - // strFullUrl = "http://109.26.11.21:48381/api/v1/search?sch_keyword=%EC%9E%A5%EC%95%A0&search_gb=1&page_no=1&recode_per_page=5"; - - log.info("입력값 확인 => [{}]", bodyMap.toString()); - log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); - log.info("입력 strFullUrl => [{}]", strFullUrl); - - HttpResponse jsonResponse = Unirest.get(strFullUrl) - .headers(headers) - .asJson() - ; - - // JSONArray returnArray = jsonResponse.getBody().getArray(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - - log.info("returnArray 리턴값 확인 => [{}]", returnObj.toString()); - - // List> returnList = ConvertUtils.getListMapFromJsonArray(returnArray); // Map 변환처리 - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 - - log.info("<<<<<<<<<<<<<<< RestApiCallSearch >>>>>>>>>>>>>>>"); - - return returnMap; - } - - - - - - - -} +package com.urpsys.basefront.common.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.common.exception.CustomException; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; + +import kong.unirest.HttpResponse; +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import kong.unirest.json.JSONArray; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * Rest Api 을 호출하는 필요한 유틸리티 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.06   나혁제         최초작성
+ *
+ *      
+ */ + + +@Slf4j +@Component("RestApiCallUtil") +public class RestApiCallUtil +{ + @Value("${custom.api_server}") + private String strApiServer; // API 서버 + + @Value("${custom.api_search_server}") + private String strApiSearchSvr; // API 서버 + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCall( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info("=============== RestApiCall null ==============="); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + return RestApiCall( memberVo.getTokenInfo(), bodyMap, strRestUrl); + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : HttpServletRequest request + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCall( HttpServletRequest request + , Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info("=============== RestApiCall request ==============="); + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + + return RestApiCall( tokenInfo, bodyMap, strRestUrl); + } + + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCall( TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCall tokenInfo <<<<<<<<<<<<<<<"); + + /* + log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); + log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); + */ + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + + headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); + // Header Setting End --------------------------------- + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + + String strDomain = strApiServer; + String strFullUrl = strDomain + strRestUrl; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + String strFullReturnData = returnObj.toString(); + + // 개발완료 후 주석처리 + // log.info("전체 리턴값 => [{}]", returnObj.toString()); + + // Map 변환처리 + Map returnMap = null; + + // 비정상처리 + if(strFullReturnData.indexOf("status")<0) + { + String strError = (String)returnObj.get("error"); + String strMessage = (String)returnObj.get("message"); + + throw new CustomException("9000", strMessage); + } + // 정상처리 + else + { + // log.info("한번 봅시다 2. => [{}]", returnObj.get("status")); + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + } + + // json to Map 변환처리 + returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); + } + + log.info("<<<<<<<<<<<<<<< RestApiCall >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNoAuth ( Map bodyMap + , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNoHead <<<<<<<<<<<<<<<"); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + // Header Setting End --------------------------------- + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + + String strDomain = strApiServer; + String strFullUrl = strDomain + strRestUrl; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + int iReturnStatus = (int)returnObj.get("status"); + + if(iReturnStatus != 200) + { + String strError = (String)returnObj.get("error"); + String strErrTrace = (String)returnObj.get("trace"); + + throw new CustomException("9000", strErrTrace); + } + else + { + returnObjData = returnObj.getJSONObject("data"); + log.info("리턴값 확인 => [{}]", returnObjData.toString()); + } + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallNoHead >>>>>>>>>>>>>>>"); + + return returnMap; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.01.06 + @param : TokenInfo tokenInfo + , Map bodyMap + , String strRestUrl + @return Map + * @throws CustomException + */ + public Map RestApiCallNaver() throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallNaver <<<<<<<<<<<<<<<"); + + /* + log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); + log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); + */ + + long timestamp = System.currentTimeMillis(); + + String strTime = timestamp+""; + + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type" , "application/json; charset=utf-8" ); + headers.put("x-ncp-apigw-timestamp" , strTime ); + headers.put("x-ncp-iam-access-key" , "ncp_iam_BPAMKR4Le2ali6vfRCsG" ); + headers.put("x-ncp-apigw-signature-v2" , makeSignature(strTime) ); + // Header Setting End --------------------------------- + + log.info("headers 입력값 확인 => [{}]", headers.toString()); + + Map bodyMap = new HashMap<>(); + + + bodyMap.put("type", "SMS"); + bodyMap.put("contentType", "COMM"); + bodyMap.put("countryCode", "82"); + bodyMap.put("from", "001068028984"); + bodyMap.put("content", "화이팅"); + + List> messagesList = new ArrayList<>(); + + Map messages = new HashMap<>(); + messages.put("to", "001068028984"); + + messagesList.add(messages); + + bodyMap.put("messages", messagesList); + + log.info("body 입력값 확인 => [{}]", bodyMap.toString()); + + log.info("body 입력값 확인 json => [{}]", ConvertUtils.getJsonFromMap(bodyMap).toString() ); + + + + String strFullUrl = "https://sens.apigw.ntruss.com/sms/v2/services/ncp:sms:kr:349487426099:uritms/messages"; + + log.info("strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.post(strFullUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = new JSONObject(); + + String strFullReturnData = returnObj.toString(); + + log.info("전체 리턴값 => [{}]", returnObj.toString()); + + // Map 변환처리 + Map returnMap = null; + + // json to Map 변환처리 + returnMap = ConvertUtils.getMapFromJSONObject(returnObj); + + log.info("<<<<<<<<<<<<<<< RestApiCallNaver >>>>>>>>>>>>>>>"); + + return returnMap; + } + + public String makeSignature(String timestamp) + { + String encodeBase64String = ""; + + try { + String space = " "; // one space + String newLine = "\n"; // new line + String method = "POST"; // method + String url = "/sms/v2/services/ncp:sms:kr:349487426099:uritms/messages"; // url (include query string) + String accessKey = "ncp_iam_BPAMKR4Le2ali6vfRCsG"; // access key id (from portal or Sub Account) + String secretKey = "ncp_iam_BPKMKRIOXMe91u5YQoPjmk5WZ2A1FNEcoR"; + + String message = new StringBuilder() + .append(method) + .append(space) + .append(url) + .append(newLine) + .append(timestamp) + .append(newLine) + .append(accessKey) + .toString(); + + SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(signingKey); + + byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8")); + encodeBase64String = Base64.encodeBase64String(rawHmac); + } + catch(Exception e) + { + e.printStackTrace(); + } + + return encodeBase64String; + } + + /** + RestApi 호출 함수 + @author 나혁제 + @since 2025.04.25 + * @throws CustomException + */ + public Map RestApiCallSearch ( Map bodyMap , String strRestUrl ) throws CustomException + { + log.info(">>>>>>>>>>>>>>> RestApiCallSearch <<<<<<<<<<<<<<<"); + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + // Header Setting End --------------------------------- + + String strDomain = strApiSearchSvr; + String strFullUrl = strDomain + strRestUrl; + + // strFullUrl = "http://109.26.11.21:48381/api/v1/search?sch_keyword=%EC%9E%A5%EC%95%A0&search_gb=1&page_no=1&recode_per_page=5"; + + log.info("입력값 확인 => [{}]", bodyMap.toString()); + log.info("입력값 확인 JSON => [{}]", ConvertUtils.getJsonFromMap(bodyMap)); + log.info("입력 strFullUrl => [{}]", strFullUrl); + + HttpResponse jsonResponse = Unirest.get(strFullUrl) + .headers(headers) + .asJson() + ; + + // JSONArray returnArray = jsonResponse.getBody().getArray(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + + log.info("returnArray 리턴값 확인 => [{}]", returnObj.toString()); + + // List> returnList = ConvertUtils.getListMapFromJsonArray(returnArray); // Map 변환처리 + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObj); // Map 변환처리 + + log.info("<<<<<<<<<<<<<<< RestApiCallSearch >>>>>>>>>>>>>>>"); + + return returnMap; + } + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/config/EncryptConfig.java b/front/src/main/java/com/urpsys/basefront/config/EncryptConfig.java index 16aa3d5d..9df9ede0 100644 --- a/front/src/main/java/com/urpsys/basefront/config/EncryptConfig.java +++ b/front/src/main/java/com/urpsys/basefront/config/EncryptConfig.java @@ -1,38 +1,38 @@ -package com.urpsys.basefront.config; - -import java.io.IOException; -import java.security.InvalidKeyException; -import org.apache.commons.codec.DecoderException; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.urpsys.basefront.common.crypto.Aes256Cipher; - -/** - * 암호화 유틸리티를 등록하는 클래스 - * - * @author 나혁제 - * @since 2023.02.28 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일         수정자         수정내용
- * -----------  ---------    ------------------------
- * 2023.02.28     나혁제         최초작성
- *
- * 
- */ - -@Configuration -public class EncryptConfig -{ - @Bean(name="aes256Cipher") - public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException - { - return new Aes256Cipher(); - } -} +package com.urpsys.basefront.config; + +import java.io.IOException; +import java.security.InvalidKeyException; +import org.apache.commons.codec.DecoderException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.urpsys.common.crypto.Aes256Cipher; + +/** + * 암호화 유틸리티를 등록하는 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일         수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28     나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +public class EncryptConfig +{ + @Bean(name="aes256Cipher") + public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException + { + return new Aes256Cipher("secrets/UrpSysKeyMng.keystore"); + } +} diff --git a/front/src/main/java/com/urpsys/basefront/config/MailConfig.java b/front/src/main/java/com/urpsys/basefront/config/MailConfig.java index babb42fa..9c52d7f7 100644 --- a/front/src/main/java/com/urpsys/basefront/config/MailConfig.java +++ b/front/src/main/java/com/urpsys/basefront/config/MailConfig.java @@ -1,87 +1,87 @@ -package com.urpsys.basefront.config; - -import java.util.Properties; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.ModelAndView; - -import com.urpsys.basefront.common.crypto.Aes256Cipher; - -import lombok.extern.slf4j.Slf4j; - -/** - * html 메일 설정 클리스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.02.11 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.02.11    나혁제         최초작성
- *
- * 
- */ - -@Slf4j -@Component -public class MailConfig -{ - @Value("${custom.sendmail.id}") - private String strMailId; - - @Value("${custom.sendmail.password}") - private String strMailPass; - - @Value("${custom.sendmail.port}") - private int strMailPort; - - @Value("${custom.sendmail.host}") - private String strMailHost; - - @Value("${custom.sendmail.socketFactory-class}") - private String strSocketFactoryClass; - - - @Autowired - private Aes256Cipher aes256Cipher; - - Properties pt = new Properties(); - - @Bean - public JavaMailSender javaMailService() - { - JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); - javaMailSender.setHost (this.strMailHost ); - javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); - javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); - javaMailSender.setPort (this.strMailPort ); - - pt.put("mail.smtp.socketFactory.port" , this.strMailPort); - pt.put("mail.smtp.auth" , true); - pt.put("mail.smtp.starttls.enable" , true); - pt.put("mail.smtp.starttls.required" , true); - pt.put("mail.smtp.socketFactory.fallback", false); - // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 - - javaMailSender.setJavaMailProperties(pt); - javaMailSender.setDefaultEncoding("UTF-8"); - - return javaMailSender; - } - -} +package com.urpsys.basefront.config; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +import com.urpsys.common.crypto.Aes256Cipher; + +import lombok.extern.slf4j.Slf4j; + +/** + * html 메일 설정 클리스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.02.11 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.02.11    나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@Component +public class MailConfig +{ + @Value("${custom.sendmail.id}") + private String strMailId; + + @Value("${custom.sendmail.password}") + private String strMailPass; + + @Value("${custom.sendmail.port}") + private int strMailPort; + + @Value("${custom.sendmail.host}") + private String strMailHost; + + @Value("${custom.sendmail.socketFactory-class}") + private String strSocketFactoryClass; + + + @Autowired + private Aes256Cipher aes256Cipher; + + Properties pt = new Properties(); + + @Bean + public JavaMailSender javaMailService() + { + JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); + javaMailSender.setHost (this.strMailHost ); + javaMailSender.setUsername (aes256Cipher.decrypt(this.strMailId) ); + javaMailSender.setPassword (aes256Cipher.decrypt(this.strMailPass) ); + javaMailSender.setPort (this.strMailPort ); + + pt.put("mail.smtp.socketFactory.port" , this.strMailPort); + pt.put("mail.smtp.auth" , true); + pt.put("mail.smtp.starttls.enable" , true); + pt.put("mail.smtp.starttls.required" , true); + pt.put("mail.smtp.socketFactory.fallback", false); + // pt.put("mail.smtp.socketFactory.class" , this.strSocketFactoryClass); // SSL 접속처리 + + javaMailSender.setJavaMailProperties(pt); + javaMailSender.setDefaultEncoding("UTF-8"); + + return javaMailSender; + } + +} diff --git a/front/src/main/java/com/urpsys/basefront/config/handler/CustomSuccessHandler.java b/front/src/main/java/com/urpsys/basefront/config/handler/CustomSuccessHandler.java index ede54808..39aca07c 100644 --- a/front/src/main/java/com/urpsys/basefront/config/handler/CustomSuccessHandler.java +++ b/front/src/main/java/com/urpsys/basefront/config/handler/CustomSuccessHandler.java @@ -1,105 +1,105 @@ -package com.urpsys.basefront.config.handler; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; -import org.springframework.stereotype.Component; - -import com.urpsys.basefront.common.exception.CustomException; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 회원인증 성공시 처리 handler - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.23 - * @version 1.0.0 - * @see - * @comment : - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자         수정내용
- * -----------  ---------    ------------------------
- * 2025.01.23    나혁제         최초작성
- *
- * 
- */ - - -@Slf4j -@Component -public class CustomSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Override - public void onAuthenticationSuccess(HttpServletRequest request - , HttpServletResponse response - , Authentication authentication) throws ServletException, IOException - { - log.info(">>>>>>>>>> CustomSuccessHandler onAuthenticationSuccess <<<<<<<<<<"); - - log.info("### login success => {}", authentication.getAuthorities()); - - MemberVO memberVo = (MemberVO)authentication.getPrincipal(); - - TokenInfo tokenInfo = memberVo.getTokenInfo(); - - request.getSession().setMaxInactiveInterval(60*60); // timeout 설정 - request.getSession().setAttribute("tokenInfo", tokenInfo); // 세션처리1 - - // 접속 이력 남기기 - try - { - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("loginId" , tokenInfo.getUniqId() ); - bodyMap.put("loginIp" , CommonUtil.getClientIp(request) ); - bodyMap.put("loginMthd" , "I" ); // 로그인:I, 로그아웃:O - bodyMap.put("errOccrrAt" , "N" ); - bodyMap.put("errorCode" , "" ); - bodyMap.put("logId" , "" ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/sys/LoginLogInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - } - catch (Exception e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - super.onAuthenticationSuccess(request, response, authentication); - - log.info("<<<<<<<<<< CustomSuccessHandler onAuthenticationSuccess >>>>>>>>>>"); - - } - -} +package com.urpsys.basefront.config.handler; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; +import org.springframework.stereotype.Component; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 회원인증 성공시 처리 handler + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.23 + * @version 1.0.0 + * @see + * @comment : + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.23    나혁제         최초작성
+ *
+ * 
+ */ + + +@Slf4j +@Component +public class CustomSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Override + public void onAuthenticationSuccess(HttpServletRequest request + , HttpServletResponse response + , Authentication authentication) throws ServletException, IOException + { + log.info(">>>>>>>>>> CustomSuccessHandler onAuthenticationSuccess <<<<<<<<<<"); + + log.info("### login success => {}", authentication.getAuthorities()); + + MemberVO memberVo = (MemberVO)authentication.getPrincipal(); + + TokenInfo tokenInfo = memberVo.getTokenInfo(); + + request.getSession().setMaxInactiveInterval(60*60); // timeout 설정 + request.getSession().setAttribute("tokenInfo", tokenInfo); // 세션처리1 + + // 접속 이력 남기기 + try + { + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("loginId" , tokenInfo.getUniqId() ); + bodyMap.put("loginIp" , CommonUtil.getClientIp(request) ); + bodyMap.put("loginMthd" , "I" ); // 로그인:I, 로그아웃:O + bodyMap.put("errOccrrAt" , "N" ); + bodyMap.put("errorCode" , "" ); + bodyMap.put("logId" , "" ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/sys/LoginLogInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + super.onAuthenticationSuccess(request, response, authentication); + + log.info("<<<<<<<<<< CustomSuccessHandler onAuthenticationSuccess >>>>>>>>>>"); + + } + +} diff --git a/front/src/main/java/com/urpsys/basefront/controller/GoogleOtpController.java b/front/src/main/java/com/urpsys/basefront/controller/GoogleOtpController.java index 019cb9ac..c7f7a979 100644 --- a/front/src/main/java/com/urpsys/basefront/controller/GoogleOtpController.java +++ b/front/src/main/java/com/urpsys/basefront/controller/GoogleOtpController.java @@ -45,7 +45,7 @@ import com.urpsys.basefront.common.service.CommonService; import com.urpsys.basefront.common.service.GoogleOtpService; import com.urpsys.basefront.common.service.LoginService; import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; +import com.urpsys.common.util.ConvertUtils; import com.urpsys.basefront.common.util.RestApiCallUtil; import com.urpsys.basefront.config.handler.CustomSuccessHandler; import com.urpsys.basefront.domain.MemberVO; diff --git a/front/src/main/java/com/urpsys/basefront/controller/MainController.java b/front/src/main/java/com/urpsys/basefront/controller/MainController.java index 892624ff..d0a4aa42 100644 --- a/front/src/main/java/com/urpsys/basefront/controller/MainController.java +++ b/front/src/main/java/com/urpsys/basefront/controller/MainController.java @@ -1,711 +1,711 @@ -package com.urpsys.basefront.controller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.service.LoginService; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.handler.CustomSuccessHandler; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; -import com.urpsys.itmsfront.sys.domain.UserDefaultVO; -import com.urpsys.itmsfront.sys.domain.UserManageVO; - -import kong.unirest.HttpResponse; -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * 메인처리 Controller - * @author urp 인프라본부 나혁제 - * @since 2025.01.03 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일           수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.03     나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class MainController -{ - @Value("${custom.auth_server}") - private String strAuthServer; // 인증서버 - - @Value("${custom.api_server}") - private String strApiServer; // Api Server - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Autowired - private CommonService commonService; - - @Autowired - private LoginService loginService; - - @Autowired - private CustomSuccessHandler customSuccessHandler; - - // @Autowired - // HtmlEmailUtil htmlEmailUtil; - - @Value("${custom.client}") - private String strClient; // 납품고객 - - @Value("${custom.urlAuthCheck}") - private String strUrlAuthCheck; // 2026.03.12 나혁제 url 보안체크 여부 - - @RequestMapping(value={ "/", "/main/actionMain.do"}) - public String actionMain(HttpServletRequest request - , HttpServletResponse response - , ModelMap model) - { - log.info(">>>>>>>>>>>>>>> /main/actionMain.do <<<<<<<<<<<<<<<"); - - // htmlEmailUtil.send("sydongeun21@urp-ai.co.kr", "잘해봅시다1", "잘해봅시다1"); - - HttpSession session = request.getSession(); - - log.info("tokenInfo1 세션값 체크 =>"+request.getSession().getAttribute("tokenInfo")); - log.info("오류갑확인 =>"+request.getParameter("error")); - - String strError = request.getParameter("error"); - if(strError==null) strError =""; - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - - log.info("tokenInfo=>{}", tokenInfo); - - String strReturnJsp = ""; - - // 로그인 처리 - if(tokenInfo == null ) - { - log.info("여기서 확인해보자 =>"+strError); - - String strErrorMsg = ""; - - if(!strError.equals("")) - { - String[] srError = strError.split(":"); - - log.info("srError1 =>"+srError[0]); - log.info("srError2 =>"+srError[1]); - - // 에러메세지 생성 - if(srError[0].equals("-1")) - { - strErrorMsg = "고객님의 아이디는 5회 로그인 오류로 인해 잠금처리 되었습니다. 시스템 관리자에게 연락해 주세요."; - } - else if(srError[0].equals("-2")) - { - strErrorMsg = "아이디 혹은 비밀번호을 확인해주세요. 5회 로그인 오류인경우 아이디가 잠금처리가 됩니다."; - } - else if(srError[0].equals("-3")) - { - strErrorMsg = "아이디 혹은 비밀번호을 확인해주세요. 5회 로그인 오류인경우 아이디가 잠금처리가 됩니다."; - } - else if(srError[0].equals("-4")) - { - strErrorMsg = "사용자 정보는 존재하나 권한정보가 존재하지 않습니다. 시스템 관리자에게 연락해 주세요."; - } - else if(srError[0].equals("-5")) - { - strErrorMsg = "SSO 인증처리 실패하였습니다. 시스템 관리자에게 연락해 주세요."; - } - else - { - strErrorMsg = ""; - } - } - - model.addAttribute("strErrorMsg", strErrorMsg); - - // 2025.12.04 한국투자공사 한국투자공사 로그인 화면 변경 - if(strClient.equals("kic")) - { - strReturnJsp = "/main/LoginUsr_kic"; - } - else - { - strReturnJsp = "/main/LoginUsr"; - } - - - } - else - { - // 메인 페이지 이동 - strReturnJsp = "forward:/main/mainPage.do"; - // strReturnJsp = "forward:/otpOrRegist.do"; - - } - - log.info("<<<<<<<<<<<<<<< /main/actionMain.do >>>>>>>>>>>>>>>"); - - return strReturnJsp; - } - - /** - * 일반(스프링 시큐리티) 로그인을 처리한다 - * @param vo - 아이디, 비밀번호가 담긴 LoginVO - * @param request - 세션처리를 위한 HttpServletRequest - * @return result - 로그인결과(세션정보) - * @exception Exception - */ - @RequestMapping(value = "/main/actionSecurityLogin.do") - public String actionSecurityLogin( HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/actionSecurityLogin.do <<<<<<<<<<<<<<<"); - - String strId = (String)request.getParameter("userId"); - String strPassWord = (String)request.getParameter("password"); - - log.info("strId =>{}" , strId); - log.info("strPassWord =>{}" , strPassWord); - - String strAuthUrl = strAuthServer+"/oauth/token"; - HttpResponse resAuth = Unirest.post(strAuthUrl) - .basicAuth("clientId", "secretKey") - .queryString("grant_type", "password") - .queryString("username", strId) - .queryString("password", strPassWord) - .asString(); - - String returnAuth = resAuth.getBody(); - - Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create(); // snakecase to camelcase - TokenInfo tokenInfo = gson.fromJson(returnAuth, TokenInfo.class); - - String strReturnJsp = ""; - - // 오류 발생 - if( (tokenInfo.getError_description() != null && !tokenInfo.getError_description().equals("")) - || (tokenInfo.getError() != null && !tokenInfo.getError().equals("")) - ) - { - strReturnJsp = "/main/LoginUsr"; - } - // 정상로그인 - else - { - strReturnJsp = "forward:/main/mainPage.do"; - - // timeout 설정 - request.getSession().setMaxInactiveInterval(60*60); - - // 세션처리1 - request.getSession().setAttribute("tokenInfo", tokenInfo); - } - - log.info("<<<<<<<<<<<<<<< /main/actionSecurityLogin.do >>>>>>>>>>>>>>>"); - - return strReturnJsp; - - } - - /** - * 템플릿 메인 페이지 조회 - * @return 메인페이지 정보 Map [key : 항목명] - * - * @param request - * @param model - * @exception Exception Exception - */ - @RequestMapping(value = "/main/mainPage.do") - public String getMgtMainPage( HttpServletRequest request - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/mainPage.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - PrsnlPortletCreateVO prsnlPortletCreateVO = new PrsnlPortletCreateVO(); - - prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(prsnlPortletCreateVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/potl/mainPortletPage.do"); - - List> resultList = (List>)returnMap.get("resultList"); - - int portletCnt=(int)returnMap.get("totCnt"); - - model.addAttribute("resultList" , resultList); - model.addAttribute("portletCnt" , portletCnt); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - // Body Setting Start ------------------------------- - prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); - - prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall( bodyMap2, "/sys/selectPortletManageList.do"); - // RestApi Call End ----------------------------------- - - List> resultList2 = (List>) returnMap2.get("resultList"); - - - model.addAttribute("resultList2", resultList2); - - - log.info("<<<<<<<<<<<<<<< /main/mainPage.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles1/main/MainView"; - } - - /** - * 로그아웃 처리를 수행 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.24 - */ - @RequestMapping(value = "/main/logout.do") - public String loout(HttpServletRequest request, HttpServletResponse response) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/logout.do <<<<<<<<<<<<<<<"); - request.getSession().setAttribute("tokenInfo", null); - request.logout(); - - log.info("<<<<<<<<<<<<<<< /main/logout.do >>>>>>>>>>>>>>>"); - - return "forward:/main/actionMain.do"; - } - - - /** - * Header Page를 조회한다. - * @param menuManageVO MenuManageVO - * @return 출력페이지정보 "EgovIncHeader" - * @exception Exception - */ - @RequestMapping(value="/main/EgovHeader.do") - public String selectHeader( HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/EgovHeader.do <<<<<<<<<<<<<<<"); - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - // log.info("tokenInfo=>{}", tokenInfo); - - List> list_headmenu = (List>)request.getSession().getAttribute("list_headmenu"); - List> list_menulist = (List>)request.getSession().getAttribute("list_menulist"); - - String strMainYn = CommonUtil.nvl(request.getParameter("main_view")); // 2025.04.25 나혁제 메인화면 여부 - - // if(tokenInfo != null && tokenInfo.getStrMEM_ID() != null && tokenInfo.getStrMEM_ID().equals("")) - if( ( tokenInfo != null) - && (list_headmenu==null || list_menulist==null) ) - { - Map headers = new HashMap<>(); - - headers.put("Content-Type", "application/json"); - - // log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); - // log.info("tokenInfo.getToken_type()=>{}", tokenInfo.getToken_type()); - - // headers.put("Authorization", "Bearer "+tokenInfo.getAccess_token()); - - headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); - - // 2026.03.12 나혁제 형 변경 - // Map body = new HashMap<>(); - Map body = new HashMap<>(); - - String strApiUrl = strApiServer+"/main/EgovHeader.do"; - - log.info("한번 봅시다. strApiUrl =>"+strApiUrl); - - // HttpResponse jsonResponse = Unirest.put("http://localhost:9012/main/EgovHeader.do") - HttpResponse jsonResponse = Unirest.put(strApiUrl) - .headers(headers) - .body(body) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = returnObj.getJSONObject("data"); - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 - - list_headmenu = (List>)returnMap.get("list_headmenu"); - list_menulist = (List>)returnMap.get("list_menulist"); - - // 2026.03.12 나혁제 메뉴url 맵핑 정보 가져오기 - if(strUrlAuthCheck.equals("Y")) - { - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(body, "/main/selectMenuScrnAuth.do"); - // RestApi Call End --------------------------------- - - List> listMeunUrl = (List>) returnMap.get("listMeunUrl"); - - log.info("listMeunUrl size [{}] =>" , listMeunUrl.size()); - - request.getSession().setAttribute("listMeunUrl", listMeunUrl); - } - } - - request.getSession().setAttribute("list_headmenu", list_headmenu); - request.getSession().setAttribute("list_menulist", list_menulist); - - // log.info("한번 봅시다. [{}]", list_menulist.toString()); - - model.addAttribute("list_headmenu", list_headmenu); - model.addAttribute("list_menulist", list_menulist); - model.addAttribute("strMainYn", strMainYn); - - - log.info("<<<<<<<<<<<<<<< /main/EgovHeader.do >>>>>>>>>>>>>>>"); - - return "main/inc/IncHeader"; // 업무화면의 상단메뉴 화면 - - } - - /** - * 좌측메뉴를 조회한다. - * @param - * @return 출력페이지정보 "EgovIncLeftmenu" - * @exception Exception - */ - @RequestMapping(value="/main/EgovMenuLeft.do") - public String selectMenuLeft(ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/EgovMenuLeft.do <<<<<<<<<<<<<<<"); - - model.addAttribute("lastLogoutDateTime", "로그아웃 타임: 2021-08-12 11:30"); - - log.info("<<<<<<<<<<<<<<< /main/EgovMenuLeft.do >>>>>>>>>>>>>>>"); - - return "main/inc/IncLeftmenu"; - } - - /** - * Footer Page를 조회한다. - * @param - * @return 출력페이지정보 "EgovIncFooter" - * @exception Exception - */ - @RequestMapping(value="/main/EgovFooter.do") - public String selectFooter(ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/EgovFooter.do <<<<<<<<<<<<<<<"); - log.info("<<<<<<<<<<<<<<< /main/EgovFooter.do >>>>>>>>>>>>>>>"); - - return "main/inc/IncFooter"; - } - - /** - * ID 찾기를 수행한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.14 - */ - @ResponseBody - @RequestMapping(value="/main/noAuthSearchIdFind.do") - public LinkedHashMap searchIdFind( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/noAuthSearchIdFind.do <<<<<<<<<<<<<<<"); - - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - bodyMap.put("userNm" , CommonUtil.getData(request, "userNm")); - bodyMap.put("userEmail" , CommonUtil.getData(request, "userEmail")); - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSearchIdFind.do"); - // RestApi Call End --------------------------------- - - String userId = (String)returnMap.get("userId"); - - resBody.put("userId", userId ); - - log.info("<<<<<<<<<<<<<<< /main/noAuthSearchIdFind.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 패스워드 초기화 수행한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.14 - */ - @ResponseBody - @RequestMapping(value="/main/noAuthUserPasswordResetExt.do") - public LinkedHashMap UserPasswordResetExt( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/noAuthUserPasswordResetExt.do <<<<<<<<<<<<<<<"); - - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - bodyMap.put("userId" , CommonUtil.getData(request, "userId")); - bodyMap.put("userNm" , CommonUtil.getData(request, "userNm")); - bodyMap.put("userEmail" , CommonUtil.getData(request, "userEmail")); - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthUserPasswordResetExt.do"); - // RestApi Call End --------------------------------- - - int resultCd = (int)returnMap.get("resultCd"); - String resultMsg = (String)returnMap.get("resultMsg"); - - resBody.put("resultCd" , resultCd ); - resBody.put("resultMsg" , resultMsg ); - - log.info("<<<<<<<<<<<<<<< /main/noAuthUserPasswordResetExt.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 사용자 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.20 - */ - @RequestMapping("/main/noAuthUserInsertView.do") - public String noAuthUserInsertView( @ModelAttribute("userSearchVO" ) UserDefaultVO userSearchVO - , @ModelAttribute("userManageExtVO") UserManageVO userManageVO - , Model model) throws Exception - { - log.info(" >>>>>>>>>>>>>>> /main/noAuthUserInsertView.do <<<<<<<<<<<<<<< "); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - // 조직정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSelectOgrnztIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("orgnztId_result", chglistComCode); - - // 그룹정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSelectGroupIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 - - log.info(" <<<<<<<<<<<<<<< /main/noAuthUserInsertView.do >>>>>>>>>>>>>>> "); - - return "uritms-base-popup1/main/PopUserRegist"; - } - - /** - * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인(미인증) - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.20 - */ - @RequestMapping(value = "/main/noAuthIdDplctCnfirmAjax.do") - public ModelAndView noAuthIdDplctCnfirmAjax(@RequestParam Map commandMap) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/noAuthIdDplctCnfirmAjax.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("jsonView"); - - String checkId = (String) commandMap.get("checkId"); - - // Body Setting Start --------------------------------- - // bodyMap = ConvertUtils.convertToMap(commandMap); - bodyMap.put("checkId", checkId); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthIdDplctCnfirmAjax.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int usedCnt = (int)returnMap.get("usedCnt"); - // Return Data Setting End -------------------------- - - modelAndView.addObject("usedCnt", usedCnt); - modelAndView.addObject("checkId", checkId); - - log.info("<<<<<<<<<<<<<<< /main/noAuthIdDplctCnfirmAjax.do >>>>>>>>>>>>>>>"); - - return modelAndView; - } - - /** - * 회원가입(미인증) - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.21 - */ - @ResponseBody - @RequestMapping("/main/noAuthUserInsertExt.do") - public LinkedHashMap noAuthUserInsertExt( @ModelAttribute("userManageExtVO") UserManageVO userManageVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /main/noAuthUserInsertExt.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strReturnUrl=""; - - String uniqId = commonService.noAuthGetIdGen("egovUsrCnfrmIdGnrService"); - - if(uniqId==null || uniqId.equals("")) - { - resBody.put("resultCd" , -1 ); - resBody.put("resultMsg" , "사용자 고유번호 획득시 오류가 발생했습니다. " ); - } - - userManageVO.setUniqId(uniqId); - - // KISA 보안약점 조치 - if ("".equals(userManageVO.getOrgnztId())) - { - userManageVO.setOrgnztId(null); - } - - //KISA 보안약점 조치 - if ("".equals(userManageVO.getGroupId())) - { - userManageVO.setGroupId(null); - } - - // 기본정보 세팅 - userManageVO.setPasswordHint ("P01"); - userManageVO.setPasswordCnsr ("없음"); - userManageVO.setAreaNo ("0000"); - userManageVO.setHomemiddleTelno("0000"); - userManageVO.setHomeendTelno ("0000"); - userManageVO.setHomeadres ("주소없음"); - userManageVO.setZip (""); - userManageVO.setEmplyrSttusCode("A"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthUserInsertExt.do"); - // RestApi Call End --------------------------------- - - resBody = (LinkedHashMap)returnMap; - - log.info(">>>>>>>>>>>>>>> /main/noAuthUserInsertExt.do <<<<<<<<<<<<<<<"); - - return resBody; - } - - - - - - - - -} +package com.urpsys.basefront.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.common.service.LoginService; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.handler.CustomSuccessHandler; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; +import com.urpsys.itmsfront.sys.domain.UserDefaultVO; +import com.urpsys.itmsfront.sys.domain.UserManageVO; + +import kong.unirest.HttpResponse; +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * 메인처리 Controller + * @author urp 인프라본부 나혁제 + * @since 2025.01.03 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일           수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.03     나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class MainController +{ + @Value("${custom.auth_server}") + private String strAuthServer; // 인증서버 + + @Value("${custom.api_server}") + private String strApiServer; // Api Server + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + private CommonService commonService; + + @Autowired + private LoginService loginService; + + @Autowired + private CustomSuccessHandler customSuccessHandler; + + // @Autowired + // HtmlEmailUtil htmlEmailUtil; + + @Value("${custom.client}") + private String strClient; // 납품고객 + + @Value("${custom.urlAuthCheck}") + private String strUrlAuthCheck; // 2026.03.12 나혁제 url 보안체크 여부 + + @RequestMapping(value={ "/", "/main/actionMain.do"}) + public String actionMain(HttpServletRequest request + , HttpServletResponse response + , ModelMap model) + { + log.info(">>>>>>>>>>>>>>> /main/actionMain.do <<<<<<<<<<<<<<<"); + + // htmlEmailUtil.send("sydongeun21@urp-ai.co.kr", "잘해봅시다1", "잘해봅시다1"); + + HttpSession session = request.getSession(); + + log.info("tokenInfo1 세션값 체크 =>"+request.getSession().getAttribute("tokenInfo")); + log.info("오류갑확인 =>"+request.getParameter("error")); + + String strError = request.getParameter("error"); + if(strError==null) strError =""; + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + + log.info("tokenInfo=>{}", tokenInfo); + + String strReturnJsp = ""; + + // 로그인 처리 + if(tokenInfo == null ) + { + log.info("여기서 확인해보자 =>"+strError); + + String strErrorMsg = ""; + + if(!strError.equals("")) + { + String[] srError = strError.split(":"); + + log.info("srError1 =>"+srError[0]); + log.info("srError2 =>"+srError[1]); + + // 에러메세지 생성 + if(srError[0].equals("-1")) + { + strErrorMsg = "고객님의 아이디는 5회 로그인 오류로 인해 잠금처리 되었습니다. 시스템 관리자에게 연락해 주세요."; + } + else if(srError[0].equals("-2")) + { + strErrorMsg = "아이디 혹은 비밀번호을 확인해주세요. 5회 로그인 오류인경우 아이디가 잠금처리가 됩니다."; + } + else if(srError[0].equals("-3")) + { + strErrorMsg = "아이디 혹은 비밀번호을 확인해주세요. 5회 로그인 오류인경우 아이디가 잠금처리가 됩니다."; + } + else if(srError[0].equals("-4")) + { + strErrorMsg = "사용자 정보는 존재하나 권한정보가 존재하지 않습니다. 시스템 관리자에게 연락해 주세요."; + } + else if(srError[0].equals("-5")) + { + strErrorMsg = "SSO 인증처리 실패하였습니다. 시스템 관리자에게 연락해 주세요."; + } + else + { + strErrorMsg = ""; + } + } + + model.addAttribute("strErrorMsg", strErrorMsg); + + // 2025.12.04 한국투자공사 한국투자공사 로그인 화면 변경 + if(strClient.equals("kic")) + { + strReturnJsp = "/main/LoginUsr_kic"; + } + else + { + strReturnJsp = "/main/LoginUsr"; + } + + + } + else + { + // 메인 페이지 이동 + strReturnJsp = "forward:/main/mainPage.do"; + // strReturnJsp = "forward:/otpOrRegist.do"; + + } + + log.info("<<<<<<<<<<<<<<< /main/actionMain.do >>>>>>>>>>>>>>>"); + + return strReturnJsp; + } + + /** + * 일반(스프링 시큐리티) 로그인을 처리한다 + * @param vo - 아이디, 비밀번호가 담긴 LoginVO + * @param request - 세션처리를 위한 HttpServletRequest + * @return result - 로그인결과(세션정보) + * @exception Exception + */ + @RequestMapping(value = "/main/actionSecurityLogin.do") + public String actionSecurityLogin( HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/actionSecurityLogin.do <<<<<<<<<<<<<<<"); + + String strId = (String)request.getParameter("userId"); + String strPassWord = (String)request.getParameter("password"); + + log.info("strId =>{}" , strId); + log.info("strPassWord =>{}" , strPassWord); + + String strAuthUrl = strAuthServer+"/oauth/token"; + HttpResponse resAuth = Unirest.post(strAuthUrl) + .basicAuth("clientId", "secretKey") + .queryString("grant_type", "password") + .queryString("username", strId) + .queryString("password", strPassWord) + .asString(); + + String returnAuth = resAuth.getBody(); + + Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create(); // snakecase to camelcase + TokenInfo tokenInfo = gson.fromJson(returnAuth, TokenInfo.class); + + String strReturnJsp = ""; + + // 오류 발생 + if( (tokenInfo.getError_description() != null && !tokenInfo.getError_description().equals("")) + || (tokenInfo.getError() != null && !tokenInfo.getError().equals("")) + ) + { + strReturnJsp = "/main/LoginUsr"; + } + // 정상로그인 + else + { + strReturnJsp = "forward:/main/mainPage.do"; + + // timeout 설정 + request.getSession().setMaxInactiveInterval(60*60); + + // 세션처리1 + request.getSession().setAttribute("tokenInfo", tokenInfo); + } + + log.info("<<<<<<<<<<<<<<< /main/actionSecurityLogin.do >>>>>>>>>>>>>>>"); + + return strReturnJsp; + + } + + /** + * 템플릿 메인 페이지 조회 + * @return 메인페이지 정보 Map [key : 항목명] + * + * @param request + * @param model + * @exception Exception Exception + */ + @RequestMapping(value = "/main/mainPage.do") + public String getMgtMainPage( HttpServletRequest request + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/mainPage.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + PrsnlPortletCreateVO prsnlPortletCreateVO = new PrsnlPortletCreateVO(); + + prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(prsnlPortletCreateVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/potl/mainPortletPage.do"); + + List> resultList = (List>)returnMap.get("resultList"); + + int portletCnt=(int)returnMap.get("totCnt"); + + model.addAttribute("resultList" , resultList); + model.addAttribute("portletCnt" , portletCnt); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + // Body Setting Start ------------------------------- + prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); + + prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall( bodyMap2, "/sys/selectPortletManageList.do"); + // RestApi Call End ----------------------------------- + + List> resultList2 = (List>) returnMap2.get("resultList"); + + + model.addAttribute("resultList2", resultList2); + + + log.info("<<<<<<<<<<<<<<< /main/mainPage.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles1/main/MainView"; + } + + /** + * 로그아웃 처리를 수행 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.24 + */ + @RequestMapping(value = "/main/logout.do") + public String loout(HttpServletRequest request, HttpServletResponse response) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/logout.do <<<<<<<<<<<<<<<"); + request.getSession().setAttribute("tokenInfo", null); + request.logout(); + + log.info("<<<<<<<<<<<<<<< /main/logout.do >>>>>>>>>>>>>>>"); + + return "forward:/main/actionMain.do"; + } + + + /** + * Header Page를 조회한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "EgovIncHeader" + * @exception Exception + */ + @RequestMapping(value="/main/EgovHeader.do") + public String selectHeader( HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/EgovHeader.do <<<<<<<<<<<<<<<"); + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + // log.info("tokenInfo=>{}", tokenInfo); + + List> list_headmenu = (List>)request.getSession().getAttribute("list_headmenu"); + List> list_menulist = (List>)request.getSession().getAttribute("list_menulist"); + + String strMainYn = CommonUtil.nvl(request.getParameter("main_view")); // 2025.04.25 나혁제 메인화면 여부 + + // if(tokenInfo != null && tokenInfo.getStrMEM_ID() != null && tokenInfo.getStrMEM_ID().equals("")) + if( ( tokenInfo != null) + && (list_headmenu==null || list_menulist==null) ) + { + Map headers = new HashMap<>(); + + headers.put("Content-Type", "application/json"); + + // log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); + // log.info("tokenInfo.getToken_type()=>{}", tokenInfo.getToken_type()); + + // headers.put("Authorization", "Bearer "+tokenInfo.getAccess_token()); + + headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); + + // 2026.03.12 나혁제 형 변경 + // Map body = new HashMap<>(); + Map body = new HashMap<>(); + + String strApiUrl = strApiServer+"/main/EgovHeader.do"; + + log.info("한번 봅시다. strApiUrl =>"+strApiUrl); + + // HttpResponse jsonResponse = Unirest.put("http://localhost:9012/main/EgovHeader.do") + HttpResponse jsonResponse = Unirest.put(strApiUrl) + .headers(headers) + .body(body) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = returnObj.getJSONObject("data"); + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 + + list_headmenu = (List>)returnMap.get("list_headmenu"); + list_menulist = (List>)returnMap.get("list_menulist"); + + // 2026.03.12 나혁제 메뉴url 맵핑 정보 가져오기 + if(strUrlAuthCheck.equals("Y")) + { + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(body, "/main/selectMenuScrnAuth.do"); + // RestApi Call End --------------------------------- + + List> listMeunUrl = (List>) returnMap.get("listMeunUrl"); + + log.info("listMeunUrl size [{}] =>" , listMeunUrl.size()); + + request.getSession().setAttribute("listMeunUrl", listMeunUrl); + } + } + + request.getSession().setAttribute("list_headmenu", list_headmenu); + request.getSession().setAttribute("list_menulist", list_menulist); + + // log.info("한번 봅시다. [{}]", list_menulist.toString()); + + model.addAttribute("list_headmenu", list_headmenu); + model.addAttribute("list_menulist", list_menulist); + model.addAttribute("strMainYn", strMainYn); + + + log.info("<<<<<<<<<<<<<<< /main/EgovHeader.do >>>>>>>>>>>>>>>"); + + return "main/inc/IncHeader"; // 업무화면의 상단메뉴 화면 + + } + + /** + * 좌측메뉴를 조회한다. + * @param + * @return 출력페이지정보 "EgovIncLeftmenu" + * @exception Exception + */ + @RequestMapping(value="/main/EgovMenuLeft.do") + public String selectMenuLeft(ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/EgovMenuLeft.do <<<<<<<<<<<<<<<"); + + model.addAttribute("lastLogoutDateTime", "로그아웃 타임: 2021-08-12 11:30"); + + log.info("<<<<<<<<<<<<<<< /main/EgovMenuLeft.do >>>>>>>>>>>>>>>"); + + return "main/inc/IncLeftmenu"; + } + + /** + * Footer Page를 조회한다. + * @param + * @return 출력페이지정보 "EgovIncFooter" + * @exception Exception + */ + @RequestMapping(value="/main/EgovFooter.do") + public String selectFooter(ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/EgovFooter.do <<<<<<<<<<<<<<<"); + log.info("<<<<<<<<<<<<<<< /main/EgovFooter.do >>>>>>>>>>>>>>>"); + + return "main/inc/IncFooter"; + } + + /** + * ID 찾기를 수행한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.14 + */ + @ResponseBody + @RequestMapping(value="/main/noAuthSearchIdFind.do") + public LinkedHashMap searchIdFind( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/noAuthSearchIdFind.do <<<<<<<<<<<<<<<"); + + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + bodyMap.put("userNm" , CommonUtil.getData(request, "userNm")); + bodyMap.put("userEmail" , CommonUtil.getData(request, "userEmail")); + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSearchIdFind.do"); + // RestApi Call End --------------------------------- + + String userId = (String)returnMap.get("userId"); + + resBody.put("userId", userId ); + + log.info("<<<<<<<<<<<<<<< /main/noAuthSearchIdFind.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 패스워드 초기화 수행한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.14 + */ + @ResponseBody + @RequestMapping(value="/main/noAuthUserPasswordResetExt.do") + public LinkedHashMap UserPasswordResetExt( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/noAuthUserPasswordResetExt.do <<<<<<<<<<<<<<<"); + + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + bodyMap.put("userId" , CommonUtil.getData(request, "userId")); + bodyMap.put("userNm" , CommonUtil.getData(request, "userNm")); + bodyMap.put("userEmail" , CommonUtil.getData(request, "userEmail")); + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthUserPasswordResetExt.do"); + // RestApi Call End --------------------------------- + + int resultCd = (int)returnMap.get("resultCd"); + String resultMsg = (String)returnMap.get("resultMsg"); + + resBody.put("resultCd" , resultCd ); + resBody.put("resultMsg" , resultMsg ); + + log.info("<<<<<<<<<<<<<<< /main/noAuthUserPasswordResetExt.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 사용자 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.20 + */ + @RequestMapping("/main/noAuthUserInsertView.do") + public String noAuthUserInsertView( @ModelAttribute("userSearchVO" ) UserDefaultVO userSearchVO + , @ModelAttribute("userManageExtVO") UserManageVO userManageVO + , Model model) throws Exception + { + log.info(" >>>>>>>>>>>>>>> /main/noAuthUserInsertView.do <<<<<<<<<<<<<<< "); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + // 조직정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSelectOgrnztIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("orgnztId_result", chglistComCode); + + // 그룹정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthSelectGroupIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 + + log.info(" <<<<<<<<<<<<<<< /main/noAuthUserInsertView.do >>>>>>>>>>>>>>> "); + + return "uritms-base-popup1/main/PopUserRegist"; + } + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인(미인증) + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.20 + */ + @RequestMapping(value = "/main/noAuthIdDplctCnfirmAjax.do") + public ModelAndView noAuthIdDplctCnfirmAjax(@RequestParam Map commandMap) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/noAuthIdDplctCnfirmAjax.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + String checkId = (String) commandMap.get("checkId"); + + // Body Setting Start --------------------------------- + // bodyMap = ConvertUtils.convertToMap(commandMap); + bodyMap.put("checkId", checkId); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthIdDplctCnfirmAjax.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int usedCnt = (int)returnMap.get("usedCnt"); + // Return Data Setting End -------------------------- + + modelAndView.addObject("usedCnt", usedCnt); + modelAndView.addObject("checkId", checkId); + + log.info("<<<<<<<<<<<<<<< /main/noAuthIdDplctCnfirmAjax.do >>>>>>>>>>>>>>>"); + + return modelAndView; + } + + /** + * 회원가입(미인증) + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.21 + */ + @ResponseBody + @RequestMapping("/main/noAuthUserInsertExt.do") + public LinkedHashMap noAuthUserInsertExt( @ModelAttribute("userManageExtVO") UserManageVO userManageVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /main/noAuthUserInsertExt.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strReturnUrl=""; + + String uniqId = commonService.noAuthGetIdGen("egovUsrCnfrmIdGnrService"); + + if(uniqId==null || uniqId.equals("")) + { + resBody.put("resultCd" , -1 ); + resBody.put("resultMsg" , "사용자 고유번호 획득시 오류가 발생했습니다. " ); + } + + userManageVO.setUniqId(uniqId); + + // KISA 보안약점 조치 + if ("".equals(userManageVO.getOrgnztId())) + { + userManageVO.setOrgnztId(null); + } + + //KISA 보안약점 조치 + if ("".equals(userManageVO.getGroupId())) + { + userManageVO.setGroupId(null); + } + + // 기본정보 세팅 + userManageVO.setPasswordHint ("P01"); + userManageVO.setPasswordCnsr ("없음"); + userManageVO.setAreaNo ("0000"); + userManageVO.setHomemiddleTelno("0000"); + userManageVO.setHomeendTelno ("0000"); + userManageVO.setHomeadres ("주소없음"); + userManageVO.setZip (""); + userManageVO.setEmplyrSttusCode("A"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCallNoAuth(bodyMap, "/main/noAuthUserInsertExt.do"); + // RestApi Call End --------------------------------- + + resBody = (LinkedHashMap)returnMap; + + log.info(">>>>>>>>>>>>>>> /main/noAuthUserInsertExt.do <<<<<<<<<<<<<<<"); + + return resBody; + } + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/basefront/controller/SsoController.java b/front/src/main/java/com/urpsys/basefront/controller/SsoController.java index 2f958f90..b3196c35 100644 --- a/front/src/main/java/com/urpsys/basefront/controller/SsoController.java +++ b/front/src/main/java/com/urpsys/basefront/controller/SsoController.java @@ -38,7 +38,7 @@ import com.urpsys.basefront.common.egov.util.EgovStringUtil; import com.urpsys.basefront.common.service.CommonService; import com.urpsys.basefront.common.service.LoginService; import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; +import com.urpsys.common.util.ConvertUtils; import com.urpsys.basefront.common.util.RestApiCallUtil; import com.urpsys.basefront.config.handler.CustomSuccessHandler; import com.urpsys.basefront.domain.MemberVO; diff --git a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/ArticleCommentController.java b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/ArticleCommentController.java index 16b3a3d8..a10d5629 100644 --- a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/ArticleCommentController.java +++ b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/ArticleCommentController.java @@ -1,151 +1,151 @@ -package com.urpsys.itmsfront.bbs.controller; - - -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Resource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.itmsfront.bbs.domain.Comment; -import com.urpsys.itmsfront.bbs.domain.CommentVO; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 댓글 관리를 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.04.01 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.04.01   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ArticleCommentController -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 댓글을 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.04.01 - */ - @RequestMapping("/bbs/insertArticleComment.do") - public String insertArticleComment(@ModelAttribute("searchVO") CommentVO commentVO - , @ModelAttribute("comment") Comment comment - , ModelMap model - , @RequestParam HashMap map) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/insertArticleComment.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - comment.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - comment.setWrterId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - comment.setWrterNm (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUserName())); - - String strAnswerNo = commonService.GetIdGen("egovAnswerNoGnrService"); - - comment.setCommentNo(strAnswerNo); - - Map bodyMap = ConvertUtils.convertToMapAll(comment); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/insertArticleComment.do"); - // RestApi Call End --------------------------------- - - String strMoveUrl = ""; - - // 인스던트 상세화면을 이동 - if(comment.getBbsId().equals("INCIDENT")) - { - strMoveUrl = "redirect:/srm/getIncidentBySeq.do?inIncidentSeq="+comment.getNttId(); - } - // 게시판 - else - { - strMoveUrl ="forward:/bbs/admin/selectBoardArticle.do"; - } - - log.info("strMoveUrl [{}]", strMoveUrl); - log.info("<<<<<<<<<<<<<<< /bbs/insertArticleComment.do >>>>>>>>>>>>>>>"); - - - return strMoveUrl; - - } - - /** - * 댓글을 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.04.01 - */ - @RequestMapping("/bbs/deleteArticleComment.do") - public String deleteArticleComment(@ModelAttribute("searchVO") CommentVO commentVO - , @ModelAttribute("comment") Comment comment - , ModelMap model, @RequestParam HashMap map) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/deleteArticleComment.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(commentVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/deleteArticleComment.do"); - // RestApi Call End --------------------------------- - - String strMoveUrl = ""; - - // 인스던트 상세화면을 이동 - if(comment.getBbsId().equals("INCIDENT")) - { - strMoveUrl = "redirect:/srm/getIncidentBySeq.do?inIncidentSeq="+comment.getNttId(); - } - // 게시판 - else - { - strMoveUrl ="forward:/bbs/admin/selectBoardArticle.do"; - } - - log.info("strMoveUrl [{}]", strMoveUrl); - log.info("<<<<<<<<<<<<<<< /bbs/deleteArticleComment.do >>>>>>>>>>>>>>>"); - - return strMoveUrl; - } - -} +package com.urpsys.itmsfront.bbs.controller; + + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.itmsfront.bbs.domain.Comment; +import com.urpsys.itmsfront.bbs.domain.CommentVO; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 댓글 관리를 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.04.01 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.04.01   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ArticleCommentController +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 댓글을 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.04.01 + */ + @RequestMapping("/bbs/insertArticleComment.do") + public String insertArticleComment(@ModelAttribute("searchVO") CommentVO commentVO + , @ModelAttribute("comment") Comment comment + , ModelMap model + , @RequestParam HashMap map) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/insertArticleComment.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + comment.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + comment.setWrterId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + comment.setWrterNm (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUserName())); + + String strAnswerNo = commonService.GetIdGen("egovAnswerNoGnrService"); + + comment.setCommentNo(strAnswerNo); + + Map bodyMap = ConvertUtils.convertToMapAll(comment); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/insertArticleComment.do"); + // RestApi Call End --------------------------------- + + String strMoveUrl = ""; + + // 인스던트 상세화면을 이동 + if(comment.getBbsId().equals("INCIDENT")) + { + strMoveUrl = "redirect:/srm/getIncidentBySeq.do?inIncidentSeq="+comment.getNttId(); + } + // 게시판 + else + { + strMoveUrl ="forward:/bbs/admin/selectBoardArticle.do"; + } + + log.info("strMoveUrl [{}]", strMoveUrl); + log.info("<<<<<<<<<<<<<<< /bbs/insertArticleComment.do >>>>>>>>>>>>>>>"); + + + return strMoveUrl; + + } + + /** + * 댓글을 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.04.01 + */ + @RequestMapping("/bbs/deleteArticleComment.do") + public String deleteArticleComment(@ModelAttribute("searchVO") CommentVO commentVO + , @ModelAttribute("comment") Comment comment + , ModelMap model, @RequestParam HashMap map) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/deleteArticleComment.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(commentVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/deleteArticleComment.do"); + // RestApi Call End --------------------------------- + + String strMoveUrl = ""; + + // 인스던트 상세화면을 이동 + if(comment.getBbsId().equals("INCIDENT")) + { + strMoveUrl = "redirect:/srm/getIncidentBySeq.do?inIncidentSeq="+comment.getNttId(); + } + // 게시판 + else + { + strMoveUrl ="forward:/bbs/admin/selectBoardArticle.do"; + } + + log.info("strMoveUrl [{}]", strMoveUrl); + log.info("<<<<<<<<<<<<<<< /bbs/deleteArticleComment.do >>>>>>>>>>>>>>>"); + + return strMoveUrl; + } + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAdminManageController.java b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAdminManageController.java index 8b73c5a0..c10f2654 100644 --- a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAdminManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAdminManageController.java @@ -1,981 +1,981 @@ -package com.urpsys.itmsfront.bbs.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.support.SessionStatus; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.egov.util.EgovDateUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.MemberVO; - -import com.urpsys.itmsfront.bbs.domain.Board; -import com.urpsys.itmsfront.bbs.domain.BoardMaster; -import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; -import com.urpsys.itmsfront.bbs.domain.BoardVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 게시물 관리를 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.20 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.20   나혁제       최초 생성
- *
- * 
- */ - -@Slf4j -@Controller -public class BBSAdminManageController -{ - - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * XSS 방지 처리. - * - * @param data - * @return - */ - protected String unscript(String data) - { - if ( data == null - || data.trim().equals("") ) - { - return ""; - } - - String ret = data; - - ret = ret.replaceAll("<(S|s)(C|c)(R|r)(I|i)(P|p)(T|t)" , "<script"); - ret = ret.replaceAll(">>>>>>>>>>>>>> /bbs/admin/selectBoardList.do <<<<<<<<<<<<<<<"); - - - // 메인화면에서 넘어온 경우 메뉴 갱신을 위해 추가 - request.getSession().setAttribute("baseMenuNo", "5000000"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - boardVO.setBbsId(boardVO.getBbsId()); - boardVO.setBbsNm(boardVO.getBbsNm()); - - // Body Setting Start --------------------------------- - BoardMasterVO vo = new BoardMasterVO(); - - vo.setBbsId (boardVO.getBbsId()); - vo.setUniqId (memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - BoardMasterVO master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - //------------------------------- - // 방명록이면 방명록 URL로 forward - //------------------------------- - if (master.getBbsTyCode().equals("BBST04")) - { - return "forward:/bbs/admin/selectGuestList.do"; - } - ////----------------------------- - - - // Body Setting Start --------------------------------- - boardVO.setPageUnit(propertyService.getInt("pageUnit")); - boardVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); - paginationInfo.setPageSize (boardVO.getPageSize()); - - boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - String attrbFlag = vo.getBbsAttrbCode(); - - // 2025.04.03 나혁제 사용중인 게시물만 조회 - boardVO.setUseAt("Y"); - - bodyMap.put("attrbFlag", attrbFlag); - bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - //List resultList = ConvertUtils.convertToValueObjectsAll((List>) returnMap.get("resultList"), BoardVO.class); - int totCnt = (int) returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - //------------------------------- - // 기본 BBS template 지정 - //------------------------------- - if ( master.getTmplatCours() == null - || master.getTmplatCours().equals("") ) - { - master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - ////----------------------------- - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("boardVO" , boardVO); - model.addAttribute("brdMstrVO" , master); - model.addAttribute("paginationInfo" , paginationInfo); - - - log.info("<<<<<<<<<<<<<<< /bbs/admin/selectBoardList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/admin/NoticeList"; - } - - /** - * 게시물 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/addBoardArticle.do") - public String addBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/addBoardArticle.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - BoardMasterVO bdMstr = new BoardMasterVO(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // Body Setting Start --------------------------------- - BoardMasterVO vo = new BoardMasterVO(); - vo.setBbsId (boardVO.getBbsId()); - vo.setUniqId(memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - Map bodyMap = new LinkedHashMap(); - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - bdMstr = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - model.addAttribute("bdMstr", bdMstr); - - //---------------------------- - // 기본 BBS template 지정 - //---------------------------- - if (bdMstr.getTmplatCours() == null || bdMstr.getTmplatCours().equals("")) - { - bdMstr.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", bdMstr); - ////----------------------------- - - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - // 기본날짜 세팅 addMonth - String strCurDate = EgovDateUtil.getToday(); - - String strNtceBgnde = EgovDateUtil.formatDate(strCurDate, "-"); - String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 1), "-"); - - /* - String strNtceBgnde = EgovDateUtil.getCurrentDate("yyyy-MM-dd"); - String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(EgovDateUtil.getCurrentDate(""), 1), "-") ; - */ - - model.addAttribute("ntceBgnde" , strNtceBgnde); - model.addAttribute("ntceEndde" , strNtceEndde); - - log.info("<<<<<<<<<<<<<<< /bbs/admin/addBoardArticle.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/admin/NoticeRegist"; - } - - /** - * 게시물을 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/insertBoardArticle.do") - public String insertBoardArticle(final MultipartHttpServletRequest multiRequest - , @ModelAttribute("searchVO") BoardVO boardVO - , @ModelAttribute("bdMstr") BoardMaster bdMstr - , @ModelAttribute("board") Board board - , BindingResult bindingResult - , SessionStatus status - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/insertBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(board, bindingResult); - if (bindingResult.hasErrors()) - { - // Body Setting Start --------------------------------- - BoardMasterVO master = new BoardMasterVO(); - BoardMasterVO vo = new BoardMasterVO(); - - vo.setBbsId (boardVO.getBbsId()); - vo.setUniqId(memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(vo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - model.addAttribute("bdMstr", master); - - //---------------------------- - // 기본 BBS template 지정 - //---------------------------- - if ( master.getTmplatCours() == null - || master.getTmplatCours().equals("") ) - { - master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", master); - ////----------------------------- - - return "uritms-tile2/bbs/admin/NoticeRegist"; - } - - // Body Setting Start --------------------------------- - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - // 리턴받은 첨부파일ID를 셋팅한다.. - board.setAtchFileId(_atchFileId); - } - else - { - board.setAtchFileId(null); - } - - List> fileList = new ArrayList(); - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - - board.setFrstRegisterId(memberVo.getTokenInfo().getUniqId()); - board.setBbsId(board.getBbsId()); - - board.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - - board.setNttCn(unscript(board.getNttCn())); // XSS 방지 - - bodyMap.put("fileList" , fileList); - bodyMap.put("board" , ConvertUtils.convertToMapAll(board)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/insertBoardArticle.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /bbs/admin/insertBoardArticle.do >>>>>>>>>>>>>>>"); - - // 추가 : 블로그 게시판에서 등록한 게시물일 경우 해당 블로그로 이동 - String blogAt = board.getBlogAt(); - if( blogAt!=null - && blogAt.equals("Y")) - { - // return "forward:/bbs/selectArticleBlogList.do"; - return "redirect:/bbs/selectArticleBlogList.do?bbsId="+boardVO.getBbsId(); - } - - // return "forward:/bbs/admin/selectBoardList.do"; - return "redirect:/bbs/admin/selectBoardList.do?bbsId="+boardVO.getBbsId(); - } - - /** - * 게시물에 대한 상세 정보를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/selectBoardArticle.do") - public String selectBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/selectBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // 조회수 증가 여부 지정 - boardVO.setPlusCount(true); - - if (!boardVO.getSubPageIndex().equals("")) - { - boardVO.setPlusCount(false); - } - ////------------------------------- - - bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); - // RestApi Call End --------------------------------- - - //BoardVO vo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); - - //model.addAttribute("result" , vo); - model.addAttribute("result" , returnMap.get("resultMap")); - model.addAttribute("resultCnList" , returnMap.get("resultCnList")); // 2025.04.01 나혁제 댓글정보 추가 - model.addAttribute("sessionUniqId", memberVo.getTokenInfo().getUniqId()); - - //---------------------------- - // template 처리 (기본 BBS template 지정 포함) - //---------------------------- - // Body Setting Start --------------------------------- - BoardMasterVO master = new BoardMasterVO(); - - master.setBbsId (boardVO.getBbsId()); - master.setUniqId(memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - BoardMasterVO masterVo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - if ( masterVo.getTmplatCours() == null - || masterVo.getTmplatCours().equals("")) - { - masterVo.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", masterVo); - - - log.info("<<<<<<<<<<<<<<< /bbs/admin/selectBoardArticle.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/admin/NoticeInqire"; - } - - /** - * 게시물 수정을 위한 수정페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/forUpdateBoardArticle.do") - public String selectBoardArticleForUpdt(@ModelAttribute("searchVO") BoardVO boardVO - , @ModelAttribute("board") BoardVO vo - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/forUpdateBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - BoardMaster master = new BoardMaster(); - BoardMasterVO bmvo = new BoardMasterVO(); - BoardVO bdvo = new BoardVO(); - - vo.setBbsId(boardVO.getBbsId()); - - master.setBbsId (boardVO.getBbsId()); - master.setUniqId(memberVo.getTokenInfo().getUniqId()); - - // Body Setting Start --------------------------------- - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - bmvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - //model.addAttribute("bdMstr", bmvo); - model.addAttribute("bdMstr", returnMap.get("resultMap")); - - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); - // RestApi Call End --------------------------------- - - bdvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); - //model.addAttribute("result", bdvo); - model.addAttribute("result", returnMap.get("resultMap")); - - - //---------------------------- - // 기본 BBS template 지정 - //---------------------------- - if ( bmvo.getTmplatCours() == null - || bmvo.getTmplatCours().equals("")) - { - bmvo.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", bmvo); - ////----------------------------- - - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - - log.info("<<<<<<<<<<<<<<< /bbs/admin/forUpdateBoardArticle.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/admin/NoticeUpdt"; - } - - /** - * 게시물에 대한 내용을 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/updateBoardArticle.do") - public String updateBoardArticle(final MultipartHttpServletRequest multiRequest - , @ModelAttribute("searchVO") BoardVO boardVO - , @ModelAttribute("bdMstr") BoardMaster bdMstr - , @ModelAttribute("board") Board board - , BindingResult bindingResult - , ModelMap model - , SessionStatus status) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/updateBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(board, bindingResult); - if (bindingResult.hasErrors()) - { - boardVO.setFrstRegisterId(memberVo.getTokenInfo().getUniqId()); - - BoardMaster master = new BoardMaster(); - BoardMasterVO bmvo = new BoardMasterVO(); - BoardVO bdvo = new BoardVO(); - - master.setBbsId(boardVO.getBbsId()); - master.setUniqId(memberVo.getTokenInfo().getUniqId()); - - // Body Setting Start --------------------------------- - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - bmvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - //model.addAttribute("bdMstr", bmvo); - model.addAttribute("bdMstr", returnMap.get("resultMap")); - - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); - // RestApi Call End --------------------------------- - - bdvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); - //model.addAttribute("result", bdvo); - model.addAttribute("result", returnMap.get("resultMap")); - - return "uritms-tiles2/bbs/admin/NoticeUpdt"; - } - - - // Body Setting Start --------------------------------- - // 첨부파일 관련 첨부파일ID 생성 - String _atchFileId = boardVO.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - if( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - List> fileList = new ArrayList(); - - if ("".equals(_atchFileId)) - { - _result = fileUtil.parseFileInf(files, "BBS_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - board.setAtchFileId(_atchFileId); - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "BBS_", _cnt, _atchFileId, ""); - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - - bodyMap.put("fileList" , fileList); - } - - board.setLastUpdusrId(memberVo.getTokenInfo().getUniqId()); - - board.setNtcrNm (""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - - board.setNttCn(unscript(board.getNttCn())); // XSS 방지 - - bodyMap.put("board", ConvertUtils.convertToMapAll(board)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/updateBoardArticle.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /bbs/admin/updateBoardArticle.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/admin/selectBoardList.do"; - } - - /** - * 게시물에 대한 내용을 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/deleteBoardArticle.do") - public String deleteBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO - , @ModelAttribute("board") Board board - , @ModelAttribute("bdMstr") BoardMaster bdMstr - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/deleteBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - board.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - board.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // Body Setting Start --------------------------------- - // 첨부파일 삭제를 위한 ID 생성 start.... - String _atchFileId = board.getAtchFileId(); - - // 첨부파일을 삭제하기 위한 Vo - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // 파일 정보 세팅 - Map fileMap = ConvertUtils.convertToMap(fvo); - - bodyMap.put("fileMap", fileMap); - // 첨부파일 삭제 셋팅 End............. - - bodyMap.put("board", ConvertUtils.convertToMapAll(board)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/deleteBoardArticle.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /bbs/admin/deleteBoardArticle.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/admin/selectBoardList.do"; - } - - /** - * 게시물에 대한 답변 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/addReplyBoardArticle.do") - public String addReplyBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/addReplyBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // Body Setting Start --------------------------------- - BoardMasterVO master = new BoardMasterVO(); - BoardMasterVO vo = new BoardMasterVO(); - - vo.setBbsId (boardVO.getBbsId()); - vo.setUniqId(memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - //master = bbsAttrbService.selectBBSMasterInf(vo); - master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - log.info("boardVO getNtceBgnde {}", boardVO.getNtceBgnde()); - log.info("boardVO getNtceEndde {}", boardVO.getNtceEndde()); - - log.info(">>>>>>>>>>>>>>> /bbs/admin/addReplyBoardArticle.do <<<<<<<<<<<<<<<"); - - //model.addAttribute("bdMstr", master); - model.addAttribute("bdMstr", returnMap.get("resultMap")); - model.addAttribute("result", boardVO); - - //---------------------------- - // 기본 BBS template 지정 - //---------------------------- - if ( master.getTmplatCours() == null - || master.getTmplatCours().equals("")) - { - master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", master); - ////----------------------------- - - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - // 기본날짜 세팅 addMonth - String strCurDate = EgovDateUtil.getToday(); - - String strNtceBgnde = EgovDateUtil.formatDate(strCurDate, "-"); - String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 1), "-"); - - model.addAttribute("ntceBgnde" , strNtceBgnde); - model.addAttribute("ntceEndde" , strNtceEndde); - - log.info("<<<<<<<<<<<<<<< /bbs/admin/addReplyBoardArticle.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/admin/NoticeReply"; - } - - /** - * 게시물에 대한 답변을 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/admin/replyBoardArticle.do") - public String replyBoardArticle(final MultipartHttpServletRequest multiRequest - , @ModelAttribute("searchVO") BoardVO boardVO - , @ModelAttribute("bdMstr") BoardMaster bdMstr - , @ModelAttribute("board") Board board - , BindingResult bindingResult - , ModelMap model - , SessionStatus status) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/admin/replyBoardArticle.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(board, bindingResult); - if (bindingResult.hasErrors()) - { - BoardMasterVO master = new BoardMasterVO(); - BoardMasterVO vo = new BoardMasterVO(); - - vo.setBbsId(boardVO.getBbsId()); - vo.setUniqId(memberVo.getTokenInfo().getUniqId()); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - //master = bbsAttrbService.selectBBSMasterInf(vo); - master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); - - //model.addAttribute("bdMstr", master); - model.addAttribute("bdMstr", returnMap.get("resultMap")); - model.addAttribute("result", boardVO); - - //---------------------------- - // 기본 BBS template 지정 - //---------------------------- - if ( master.getTmplatCours() == null - || master.getTmplatCours().equals("")) - { - master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); - } - - model.addAttribute("brdMstrVO", master); - ////----------------------------- - - return "uritms-tiles2/bbs/admin/NoticeReply"; - } - - - // Body Setting Start --------------------------------- - - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - //final Map files = multiRequest.getFileMap(); - final List files = multiRequest.getFiles("file_1"); - - if( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - - board.setAtchFileId (_atchFileId); - board.setReplyAt ("Y"); - board.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); - board.setBbsId (board.getBbsId()); - board.setParnts (Long.toString(boardVO.getNttId())); - board.setSortOrdr (boardVO.getSortOrdr()); - board.setReplyLc (Integer.toString(Integer.parseInt(boardVO.getReplyLc()) + 1)); - - board.setNtcrNm (""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) - - board.setNttCn(unscript(board.getNttCn())); // XSS 방지 - - bodyMap.put("fileList" , fileList); - bodyMap.put("board" , ConvertUtils.convertToMapAll(board)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/insertBoardArticle.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /bbs/admin/replyBoardArticle.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/admin/selectBoardList.do"; - } - -} +package com.urpsys.itmsfront.bbs.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.egov.util.EgovDateUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.MemberVO; + +import com.urpsys.itmsfront.bbs.domain.Board; +import com.urpsys.itmsfront.bbs.domain.BoardMaster; +import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; +import com.urpsys.itmsfront.bbs.domain.BoardVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 게시물 관리를 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.20 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.20   나혁제       최초 생성
+ *
+ * 
+ */ + +@Slf4j +@Controller +public class BBSAdminManageController +{ + + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * XSS 방지 처리. + * + * @param data + * @return + */ + protected String unscript(String data) + { + if ( data == null + || data.trim().equals("") ) + { + return ""; + } + + String ret = data; + + ret = ret.replaceAll("<(S|s)(C|c)(R|r)(I|i)(P|p)(T|t)" , "<script"); + ret = ret.replaceAll(">>>>>>>>>>>>>> /bbs/admin/selectBoardList.do <<<<<<<<<<<<<<<"); + + + // 메인화면에서 넘어온 경우 메뉴 갱신을 위해 추가 + request.getSession().setAttribute("baseMenuNo", "5000000"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + boardVO.setBbsId(boardVO.getBbsId()); + boardVO.setBbsNm(boardVO.getBbsNm()); + + // Body Setting Start --------------------------------- + BoardMasterVO vo = new BoardMasterVO(); + + vo.setBbsId (boardVO.getBbsId()); + vo.setUniqId (memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + BoardMasterVO master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + //------------------------------- + // 방명록이면 방명록 URL로 forward + //------------------------------- + if (master.getBbsTyCode().equals("BBST04")) + { + return "forward:/bbs/admin/selectGuestList.do"; + } + ////----------------------------- + + + // Body Setting Start --------------------------------- + boardVO.setPageUnit(propertyService.getInt("pageUnit")); + boardVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); + paginationInfo.setPageSize (boardVO.getPageSize()); + + boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + String attrbFlag = vo.getBbsAttrbCode(); + + // 2025.04.03 나혁제 사용중인 게시물만 조회 + boardVO.setUseAt("Y"); + + bodyMap.put("attrbFlag", attrbFlag); + bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + //List resultList = ConvertUtils.convertToValueObjectsAll((List>) returnMap.get("resultList"), BoardVO.class); + int totCnt = (int) returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + //------------------------------- + // 기본 BBS template 지정 + //------------------------------- + if ( master.getTmplatCours() == null + || master.getTmplatCours().equals("") ) + { + master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + ////----------------------------- + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("boardVO" , boardVO); + model.addAttribute("brdMstrVO" , master); + model.addAttribute("paginationInfo" , paginationInfo); + + + log.info("<<<<<<<<<<<<<<< /bbs/admin/selectBoardList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/admin/NoticeList"; + } + + /** + * 게시물 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/addBoardArticle.do") + public String addBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/addBoardArticle.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + BoardMasterVO bdMstr = new BoardMasterVO(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // Body Setting Start --------------------------------- + BoardMasterVO vo = new BoardMasterVO(); + vo.setBbsId (boardVO.getBbsId()); + vo.setUniqId(memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + Map bodyMap = new LinkedHashMap(); + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + bdMstr = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + model.addAttribute("bdMstr", bdMstr); + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (bdMstr.getTmplatCours() == null || bdMstr.getTmplatCours().equals("")) + { + bdMstr.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", bdMstr); + ////----------------------------- + + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + // 기본날짜 세팅 addMonth + String strCurDate = EgovDateUtil.getToday(); + + String strNtceBgnde = EgovDateUtil.formatDate(strCurDate, "-"); + String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 1), "-"); + + /* + String strNtceBgnde = EgovDateUtil.getCurrentDate("yyyy-MM-dd"); + String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(EgovDateUtil.getCurrentDate(""), 1), "-") ; + */ + + model.addAttribute("ntceBgnde" , strNtceBgnde); + model.addAttribute("ntceEndde" , strNtceEndde); + + log.info("<<<<<<<<<<<<<<< /bbs/admin/addBoardArticle.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/admin/NoticeRegist"; + } + + /** + * 게시물을 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/insertBoardArticle.do") + public String insertBoardArticle(final MultipartHttpServletRequest multiRequest + , @ModelAttribute("searchVO") BoardVO boardVO + , @ModelAttribute("bdMstr") BoardMaster bdMstr + , @ModelAttribute("board") Board board + , BindingResult bindingResult + , SessionStatus status + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/insertBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) + { + // Body Setting Start --------------------------------- + BoardMasterVO master = new BoardMasterVO(); + BoardMasterVO vo = new BoardMasterVO(); + + vo.setBbsId (boardVO.getBbsId()); + vo.setUniqId(memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(vo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + model.addAttribute("bdMstr", master); + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if ( master.getTmplatCours() == null + || master.getTmplatCours().equals("") ) + { + master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", master); + ////----------------------------- + + return "uritms-tile2/bbs/admin/NoticeRegist"; + } + + // Body Setting Start --------------------------------- + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + // 리턴받은 첨부파일ID를 셋팅한다.. + board.setAtchFileId(_atchFileId); + } + else + { + board.setAtchFileId(null); + } + + List> fileList = new ArrayList(); + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + + board.setFrstRegisterId(memberVo.getTokenInfo().getUniqId()); + board.setBbsId(board.getBbsId()); + + board.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + + bodyMap.put("fileList" , fileList); + bodyMap.put("board" , ConvertUtils.convertToMapAll(board)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/insertBoardArticle.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /bbs/admin/insertBoardArticle.do >>>>>>>>>>>>>>>"); + + // 추가 : 블로그 게시판에서 등록한 게시물일 경우 해당 블로그로 이동 + String blogAt = board.getBlogAt(); + if( blogAt!=null + && blogAt.equals("Y")) + { + // return "forward:/bbs/selectArticleBlogList.do"; + return "redirect:/bbs/selectArticleBlogList.do?bbsId="+boardVO.getBbsId(); + } + + // return "forward:/bbs/admin/selectBoardList.do"; + return "redirect:/bbs/admin/selectBoardList.do?bbsId="+boardVO.getBbsId(); + } + + /** + * 게시물에 대한 상세 정보를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/selectBoardArticle.do") + public String selectBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/selectBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // 조회수 증가 여부 지정 + boardVO.setPlusCount(true); + + if (!boardVO.getSubPageIndex().equals("")) + { + boardVO.setPlusCount(false); + } + ////------------------------------- + + bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); + // RestApi Call End --------------------------------- + + //BoardVO vo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); + + //model.addAttribute("result" , vo); + model.addAttribute("result" , returnMap.get("resultMap")); + model.addAttribute("resultCnList" , returnMap.get("resultCnList")); // 2025.04.01 나혁제 댓글정보 추가 + model.addAttribute("sessionUniqId", memberVo.getTokenInfo().getUniqId()); + + //---------------------------- + // template 처리 (기본 BBS template 지정 포함) + //---------------------------- + // Body Setting Start --------------------------------- + BoardMasterVO master = new BoardMasterVO(); + + master.setBbsId (boardVO.getBbsId()); + master.setUniqId(memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + BoardMasterVO masterVo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + if ( masterVo.getTmplatCours() == null + || masterVo.getTmplatCours().equals("")) + { + masterVo.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", masterVo); + + + log.info("<<<<<<<<<<<<<<< /bbs/admin/selectBoardArticle.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/admin/NoticeInqire"; + } + + /** + * 게시물 수정을 위한 수정페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/forUpdateBoardArticle.do") + public String selectBoardArticleForUpdt(@ModelAttribute("searchVO") BoardVO boardVO + , @ModelAttribute("board") BoardVO vo + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/forUpdateBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + BoardMaster master = new BoardMaster(); + BoardMasterVO bmvo = new BoardMasterVO(); + BoardVO bdvo = new BoardVO(); + + vo.setBbsId(boardVO.getBbsId()); + + master.setBbsId (boardVO.getBbsId()); + master.setUniqId(memberVo.getTokenInfo().getUniqId()); + + // Body Setting Start --------------------------------- + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + bmvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + //model.addAttribute("bdMstr", bmvo); + model.addAttribute("bdMstr", returnMap.get("resultMap")); + + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); + // RestApi Call End --------------------------------- + + bdvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); + //model.addAttribute("result", bdvo); + model.addAttribute("result", returnMap.get("resultMap")); + + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if ( bmvo.getTmplatCours() == null + || bmvo.getTmplatCours().equals("")) + { + bmvo.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", bmvo); + ////----------------------------- + + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + + log.info("<<<<<<<<<<<<<<< /bbs/admin/forUpdateBoardArticle.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/admin/NoticeUpdt"; + } + + /** + * 게시물에 대한 내용을 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/updateBoardArticle.do") + public String updateBoardArticle(final MultipartHttpServletRequest multiRequest + , @ModelAttribute("searchVO") BoardVO boardVO + , @ModelAttribute("bdMstr") BoardMaster bdMstr + , @ModelAttribute("board") Board board + , BindingResult bindingResult + , ModelMap model + , SessionStatus status) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/updateBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) + { + boardVO.setFrstRegisterId(memberVo.getTokenInfo().getUniqId()); + + BoardMaster master = new BoardMaster(); + BoardMasterVO bmvo = new BoardMasterVO(); + BoardVO bdvo = new BoardVO(); + + master.setBbsId(boardVO.getBbsId()); + master.setUniqId(memberVo.getTokenInfo().getUniqId()); + + // Body Setting Start --------------------------------- + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO" , ConvertUtils.convertToMapAll(master)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + bmvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + //model.addAttribute("bdMstr", bmvo); + model.addAttribute("bdMstr", returnMap.get("resultMap")); + + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardArticle.do"); + // RestApi Call End --------------------------------- + + bdvo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardVO.class); + //model.addAttribute("result", bdvo); + model.addAttribute("result", returnMap.get("resultMap")); + + return "uritms-tiles2/bbs/admin/NoticeUpdt"; + } + + + // Body Setting Start --------------------------------- + // 첨부파일 관련 첨부파일ID 생성 + String _atchFileId = boardVO.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + if( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + List> fileList = new ArrayList(); + + if ("".equals(_atchFileId)) + { + _result = fileUtil.parseFileInf(files, "BBS_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + board.setAtchFileId(_atchFileId); + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "BBS_", _cnt, _atchFileId, ""); + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + + bodyMap.put("fileList" , fileList); + } + + board.setLastUpdusrId(memberVo.getTokenInfo().getUniqId()); + + board.setNtcrNm (""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + + bodyMap.put("board", ConvertUtils.convertToMapAll(board)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/updateBoardArticle.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /bbs/admin/updateBoardArticle.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/admin/selectBoardList.do"; + } + + /** + * 게시물에 대한 내용을 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/deleteBoardArticle.do") + public String deleteBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO + , @ModelAttribute("board") Board board + , @ModelAttribute("bdMstr") BoardMaster bdMstr + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/deleteBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + board.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + board.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // Body Setting Start --------------------------------- + // 첨부파일 삭제를 위한 ID 생성 start.... + String _atchFileId = board.getAtchFileId(); + + // 첨부파일을 삭제하기 위한 Vo + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // 파일 정보 세팅 + Map fileMap = ConvertUtils.convertToMap(fvo); + + bodyMap.put("fileMap", fileMap); + // 첨부파일 삭제 셋팅 End............. + + bodyMap.put("board", ConvertUtils.convertToMapAll(board)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/deleteBoardArticle.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /bbs/admin/deleteBoardArticle.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/admin/selectBoardList.do"; + } + + /** + * 게시물에 대한 답변 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/addReplyBoardArticle.do") + public String addReplyBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/addReplyBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // Body Setting Start --------------------------------- + BoardMasterVO master = new BoardMasterVO(); + BoardMasterVO vo = new BoardMasterVO(); + + vo.setBbsId (boardVO.getBbsId()); + vo.setUniqId(memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + //master = bbsAttrbService.selectBBSMasterInf(vo); + master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + log.info("boardVO getNtceBgnde {}", boardVO.getNtceBgnde()); + log.info("boardVO getNtceEndde {}", boardVO.getNtceEndde()); + + log.info(">>>>>>>>>>>>>>> /bbs/admin/addReplyBoardArticle.do <<<<<<<<<<<<<<<"); + + //model.addAttribute("bdMstr", master); + model.addAttribute("bdMstr", returnMap.get("resultMap")); + model.addAttribute("result", boardVO); + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if ( master.getTmplatCours() == null + || master.getTmplatCours().equals("")) + { + master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", master); + ////----------------------------- + + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + // 기본날짜 세팅 addMonth + String strCurDate = EgovDateUtil.getToday(); + + String strNtceBgnde = EgovDateUtil.formatDate(strCurDate, "-"); + String strNtceEndde = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 1), "-"); + + model.addAttribute("ntceBgnde" , strNtceBgnde); + model.addAttribute("ntceEndde" , strNtceEndde); + + log.info("<<<<<<<<<<<<<<< /bbs/admin/addReplyBoardArticle.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/admin/NoticeReply"; + } + + /** + * 게시물에 대한 답변을 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/admin/replyBoardArticle.do") + public String replyBoardArticle(final MultipartHttpServletRequest multiRequest + , @ModelAttribute("searchVO") BoardVO boardVO + , @ModelAttribute("bdMstr") BoardMaster bdMstr + , @ModelAttribute("board") Board board + , BindingResult bindingResult + , ModelMap model + , SessionStatus status) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/admin/replyBoardArticle.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) + { + BoardMasterVO master = new BoardMasterVO(); + BoardMasterVO vo = new BoardMasterVO(); + + vo.setBbsId(boardVO.getBbsId()); + vo.setUniqId(memberVo.getTokenInfo().getUniqId()); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(vo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + //master = bbsAttrbService.selectBBSMasterInf(vo); + master = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardMasterVO.class); + + //model.addAttribute("bdMstr", master); + model.addAttribute("bdMstr", returnMap.get("resultMap")); + model.addAttribute("result", boardVO); + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if ( master.getTmplatCours() == null + || master.getTmplatCours().equals("")) + { + master.setTmplatCours("/css/egovframework/cop/bbs/egovBaseTemplate.css"); + } + + model.addAttribute("brdMstrVO", master); + ////----------------------------- + + return "uritms-tiles2/bbs/admin/NoticeReply"; + } + + + // Body Setting Start --------------------------------- + + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + + if( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + + board.setAtchFileId (_atchFileId); + board.setReplyAt ("Y"); + board.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); + board.setBbsId (board.getBbsId()); + board.setParnts (Long.toString(boardVO.getNttId())); + board.setSortOrdr (boardVO.getSortOrdr()); + board.setReplyLc (Integer.toString(Integer.parseInt(boardVO.getReplyLc()) + 1)); + + board.setNtcrNm (""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + + bodyMap.put("fileList" , fileList); + bodyMap.put("board" , ConvertUtils.convertToMapAll(board)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/insertBoardArticle.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /bbs/admin/replyBoardArticle.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/admin/selectBoardList.do"; + } + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAttributeManageController.java b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAttributeManageController.java index f145ee63..428de4e1 100644 --- a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAttributeManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSAttributeManageController.java @@ -1,483 +1,483 @@ -package com.urpsys.itmsfront.bbs.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.support.SessionStatus; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.bbs.domain.BoardMaster; -import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 게시판 속성관리를 위한 컨트롤러 클래스 (게시판생성관리-enterprise) - * @author urp 인프라본부 나혁제 - * @since 2025.01.17 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.17   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class BBSAttributeManageController -{ - - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Autowired - CommonService commonService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - - /** - * 게시판 마스터 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/SelectBBSMasterInfs.do") - public String selectBBSMasterInfs(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , ModelMap model - , HttpServletRequest request) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInfs.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // 메인화면에서 넘어온 경우 메뉴 갱신을 위해 추가 - request.getSession().setAttribute("baseMenuNo", "5000000"); - - // Body Setting Start --------------------------------- - boardMasterVO.setPageUnit(propertyService.getInt("pageUnit")); - boardMasterVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardMasterVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardMasterVO.getPageUnit()); - paginationInfo.setPageSize (boardMasterVO.getPageSize()); - - boardMasterVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardMasterVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardMasterVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/SelectBBSMasterInfs.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - - - log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInfs.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/BoardMstrList"; - } - - /** - * 신규 게시판 마스터 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/addBBSMaster.do") - public String addBBSMaster(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/addBBSMaster.do <<<<<<<<<<<<<<<"); - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - BoardMaster boardMaster = new BoardMaster(); - - /* - * --------------------------------------------- - * 공통코드 게시판종류 : Start - */ - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("COM004,COM009"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>) returnMap.get("resultList_COM004"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("typeList", chglistComCode); - - listComCode = (List>) returnMap.get("resultList_COM009"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("attrbList", chglistComCode); - /* - * 공통코드 게시판종류 : End - * --------------------------------------------- - */ - - model.addAttribute("boardMasterVO", boardMasterVO); - - String flag = propertyService.getString("Globals.addedOptions"); - - if ( flag != null - && flag.trim().equalsIgnoreCase("true")) - { - model.addAttribute("addedOptions", "true"); - } - - - log.info("<<<<<<<<<<<<<<< /bbs/addBBSMaster.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/BoardMstrRegist"; - } - - /** - * 신규 게시판 마스터 정보를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/insertBBSMasterInf.do") - public String insertBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , @ModelAttribute("boardMaster") BoardMaster boardMaster - , BindingResult bindingResult - , SessionStatus status - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/insertBBSMasterInf.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardMaster.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardMaster.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - beanValidator.validate(boardMaster, bindingResult); - if (bindingResult.hasErrors()) - { - // Body Setting Start --------------------------------- - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("COM004,COM009"); - - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>) returnMap.get("resultList_COM004"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("typeList", chglistComCode); - - listComCode = (List>) returnMap.get("resultList_COM009"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("attrbList", chglistComCode); - - return "uritms-tiles2/bbs/BoardMstrRegist"; - } - - String strBbsId = commonService.GetIdGen("egovBBSMstrIdGnrService"); - - if(strBbsId==null || strBbsId.equals("")) - { - model.addAttribute("resultMsg", "fail.common.insert"); - return "forward:/bbs/SelectBBSMasterInfs.do"; - } - - - // Body Setting Start --------------------------------- - boardMaster.setUseAt ("Y"); - boardMaster.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); - boardMaster.setTrgetId ("SYSTEMDEFAULT_REGIST"); - boardMaster.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize")); - boardMaster.setBbsId (strBbsId); - - bodyMap = ConvertUtils.convertToMapAll(boardMaster); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/insertBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /bbs/insertBBSMasterInf.do >>>>>>>>>>>>>>>"); - - String blogId = boardMasterVO.getBlogId(); - if( (blogId != null) - && (blogId != "") ) - { - return "redirect:/bbs/selectArticleBlogList.do?blogId="+blogId+"&bbsId="+boardMasterVO.getBbsId(); - } - else - { - return "forward:/bbs/SelectBBSMasterInfs.do"; - } - } - - /** - * 게시판 마스터 상세내용을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/SelectBBSMasterInf.do") - public String selectBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInf.do <<<<<<<<<<<<<<<"); - - - // Body Setting Start --------------------------------- - Map bodyMap = new LinkedHashMap(); - - String flag = propertyService.getString("Globals.addedOptions"); - - bodyMap.put("flag" , flag); - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(searchVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - Map resultMap = (Map) returnMap.get("resultMap"); - //resultMap.put("posblAtchFileNumber", (int)((double) resultMap.get("posblAtchFileNumber"))); - BoardMasterVO vo = ConvertUtils.convertToValueObjectAll(resultMap, BoardMasterVO.class); - - model.addAttribute("result" , vo); - model.addAttribute("boardMasterVO", vo); - - if ( flag != null - && flag.trim().equalsIgnoreCase("true") ) - { - model.addAttribute("addedOptions", "true"); - } - - - log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInf.do >>>>>>>>>>>>>>>"+vo); - - return "uritms-tiles2/bbs/BoardMstrUpdt"; - } - - /** - * 게시판 마스터 정보를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/UpdateBBSMasterInf.do") - public String updateBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , @ModelAttribute("boardMaster") BoardMaster boardMaster - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/UpdateBBSMasterInf.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - //아이디 설정 - boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - String flag = propertyService.getString("Globals.addedOptions"); - bodyMap.put("flag", flag); - - beanValidator.validate(boardMaster, bindingResult); - if (bindingResult.hasErrors()) - { - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(boardMasterVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - Map resultMap = (Map) returnMap.get("resultMap"); - BoardMasterVO vo = ConvertUtils.convertToValueObjectAll(resultMap, BoardMasterVO.class); - - model.addAttribute("result", vo); - - return "uritms-tiles2/bbs/BoardMstrUpdt"; - } - - - boardMasterVO.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize")); - - bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(boardMasterVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/UpdateBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /bbs/UpdateBBSMasterInf.do >>>>>>>>>>>>>>>"); - - String blogId = boardMasterVO.getBlogId(); - if( blogId!=null - && blogId!="" ) - { - return "redirect:/bbs/selectBlogListManager.do?blogId="+blogId; - } - else - { - return "forward:/bbs/SelectBBSMasterInfs.do"; - } - } - - /** - * 게시판 마스터 정보를 삭제한다. - * ** 삭제처리가 아닌 사용상태를 N으로 바꾸어 사용중지로 만들어준다. ** - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/DeleteBBSMasterInf.do") - public String deleteBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , @ModelAttribute("boardMaster") BoardMaster boardMaster - , SessionStatus status) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/DeleteBBSMasterInf.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //아이디 설정 - boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - boardMasterVO.setLastUpdusrId((String)memberVo.getTokenInfo().getUniqId()); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/DeleteBBSMasterInf.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /bbs/DeleteBBSMasterInf.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/SelectBBSMasterInfs.do"; - } - - /** - * 게시판 마스터 선택 팝업을 위한 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping("/bbs/SelectBBSMasterInfsPop.do") - public String selectBBSMasterInfsPop(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInfsPop.do <<<<<<<<<<<<<<<"); - - - // Body Setting Start --------------------------------- - boardMasterVO.setPageUnit(propertyService.getInt("pageUnit")); - boardMasterVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardMasterVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardMasterVO.getPageUnit()); - paginationInfo.setPageSize (boardMasterVO.getPageSize()); - - boardMasterVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardMasterVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardMasterVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - boardMasterVO.setUseAt("Y"); - - Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInfsPop.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - int totCnt = (int) returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - - - log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInfsPop.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/bbs/BoardMstrListPop"; - } - -} +package com.urpsys.itmsfront.bbs.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.bbs.domain.BoardMaster; +import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 게시판 속성관리를 위한 컨트롤러 클래스 (게시판생성관리-enterprise) + * @author urp 인프라본부 나혁제 + * @since 2025.01.17 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.17   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class BBSAttributeManageController +{ + + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + CommonService commonService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + + /** + * 게시판 마스터 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/SelectBBSMasterInfs.do") + public String selectBBSMasterInfs(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , ModelMap model + , HttpServletRequest request) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInfs.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // 메인화면에서 넘어온 경우 메뉴 갱신을 위해 추가 + request.getSession().setAttribute("baseMenuNo", "5000000"); + + // Body Setting Start --------------------------------- + boardMasterVO.setPageUnit(propertyService.getInt("pageUnit")); + boardMasterVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardMasterVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardMasterVO.getPageUnit()); + paginationInfo.setPageSize (boardMasterVO.getPageSize()); + + boardMasterVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardMasterVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardMasterVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/SelectBBSMasterInfs.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + + + log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInfs.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/BoardMstrList"; + } + + /** + * 신규 게시판 마스터 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/addBBSMaster.do") + public String addBBSMaster(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/addBBSMaster.do <<<<<<<<<<<<<<<"); + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + BoardMaster boardMaster = new BoardMaster(); + + /* + * --------------------------------------------- + * 공통코드 게시판종류 : Start + */ + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM004,COM009"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>) returnMap.get("resultList_COM004"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("typeList", chglistComCode); + + listComCode = (List>) returnMap.get("resultList_COM009"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("attrbList", chglistComCode); + /* + * 공통코드 게시판종류 : End + * --------------------------------------------- + */ + + model.addAttribute("boardMasterVO", boardMasterVO); + + String flag = propertyService.getString("Globals.addedOptions"); + + if ( flag != null + && flag.trim().equalsIgnoreCase("true")) + { + model.addAttribute("addedOptions", "true"); + } + + + log.info("<<<<<<<<<<<<<<< /bbs/addBBSMaster.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/BoardMstrRegist"; + } + + /** + * 신규 게시판 마스터 정보를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/insertBBSMasterInf.do") + public String insertBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , @ModelAttribute("boardMaster") BoardMaster boardMaster + , BindingResult bindingResult + , SessionStatus status + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/insertBBSMasterInf.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardMaster.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardMaster.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + beanValidator.validate(boardMaster, bindingResult); + if (bindingResult.hasErrors()) + { + // Body Setting Start --------------------------------- + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM004,COM009"); + + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>) returnMap.get("resultList_COM004"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("typeList", chglistComCode); + + listComCode = (List>) returnMap.get("resultList_COM009"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("attrbList", chglistComCode); + + return "uritms-tiles2/bbs/BoardMstrRegist"; + } + + String strBbsId = commonService.GetIdGen("egovBBSMstrIdGnrService"); + + if(strBbsId==null || strBbsId.equals("")) + { + model.addAttribute("resultMsg", "fail.common.insert"); + return "forward:/bbs/SelectBBSMasterInfs.do"; + } + + + // Body Setting Start --------------------------------- + boardMaster.setUseAt ("Y"); + boardMaster.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); + boardMaster.setTrgetId ("SYSTEMDEFAULT_REGIST"); + boardMaster.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize")); + boardMaster.setBbsId (strBbsId); + + bodyMap = ConvertUtils.convertToMapAll(boardMaster); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/insertBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /bbs/insertBBSMasterInf.do >>>>>>>>>>>>>>>"); + + String blogId = boardMasterVO.getBlogId(); + if( (blogId != null) + && (blogId != "") ) + { + return "redirect:/bbs/selectArticleBlogList.do?blogId="+blogId+"&bbsId="+boardMasterVO.getBbsId(); + } + else + { + return "forward:/bbs/SelectBBSMasterInfs.do"; + } + } + + /** + * 게시판 마스터 상세내용을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/SelectBBSMasterInf.do") + public String selectBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInf.do <<<<<<<<<<<<<<<"); + + + // Body Setting Start --------------------------------- + Map bodyMap = new LinkedHashMap(); + + String flag = propertyService.getString("Globals.addedOptions"); + + bodyMap.put("flag" , flag); + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(searchVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + Map resultMap = (Map) returnMap.get("resultMap"); + //resultMap.put("posblAtchFileNumber", (int)((double) resultMap.get("posblAtchFileNumber"))); + BoardMasterVO vo = ConvertUtils.convertToValueObjectAll(resultMap, BoardMasterVO.class); + + model.addAttribute("result" , vo); + model.addAttribute("boardMasterVO", vo); + + if ( flag != null + && flag.trim().equalsIgnoreCase("true") ) + { + model.addAttribute("addedOptions", "true"); + } + + + log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInf.do >>>>>>>>>>>>>>>"+vo); + + return "uritms-tiles2/bbs/BoardMstrUpdt"; + } + + /** + * 게시판 마스터 정보를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/UpdateBBSMasterInf.do") + public String updateBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , @ModelAttribute("boardMaster") BoardMaster boardMaster + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/UpdateBBSMasterInf.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + //아이디 설정 + boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + String flag = propertyService.getString("Globals.addedOptions"); + bodyMap.put("flag", flag); + + beanValidator.validate(boardMaster, bindingResult); + if (bindingResult.hasErrors()) + { + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(boardMasterVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + Map resultMap = (Map) returnMap.get("resultMap"); + BoardMasterVO vo = ConvertUtils.convertToValueObjectAll(resultMap, BoardMasterVO.class); + + model.addAttribute("result", vo); + + return "uritms-tiles2/bbs/BoardMstrUpdt"; + } + + + boardMasterVO.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize")); + + bodyMap.put("boardMasterVO", ConvertUtils.convertToMapAll(boardMasterVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/UpdateBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /bbs/UpdateBBSMasterInf.do >>>>>>>>>>>>>>>"); + + String blogId = boardMasterVO.getBlogId(); + if( blogId!=null + && blogId!="" ) + { + return "redirect:/bbs/selectBlogListManager.do?blogId="+blogId; + } + else + { + return "forward:/bbs/SelectBBSMasterInfs.do"; + } + } + + /** + * 게시판 마스터 정보를 삭제한다. + * ** 삭제처리가 아닌 사용상태를 N으로 바꾸어 사용중지로 만들어준다. ** + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/DeleteBBSMasterInf.do") + public String deleteBBSMasterInf(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , @ModelAttribute("boardMaster") BoardMaster boardMaster + , SessionStatus status) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/DeleteBBSMasterInf.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //아이디 설정 + boardMasterVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardMasterVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + boardMasterVO.setLastUpdusrId((String)memberVo.getTokenInfo().getUniqId()); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/DeleteBBSMasterInf.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /bbs/DeleteBBSMasterInf.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/SelectBBSMasterInfs.do"; + } + + /** + * 게시판 마스터 선택 팝업을 위한 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping("/bbs/SelectBBSMasterInfsPop.do") + public String selectBBSMasterInfsPop(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/SelectBBSMasterInfsPop.do <<<<<<<<<<<<<<<"); + + + // Body Setting Start --------------------------------- + boardMasterVO.setPageUnit(propertyService.getInt("pageUnit")); + boardMasterVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardMasterVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardMasterVO.getPageUnit()); + paginationInfo.setPageSize (boardMasterVO.getPageSize()); + + boardMasterVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardMasterVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardMasterVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + boardMasterVO.setUseAt("Y"); + + Map bodyMap = ConvertUtils.convertToMapAll(boardMasterVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/SelectBBSMasterInfsPop.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + int totCnt = (int) returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + + + log.info("<<<<<<<<<<<<<<< /bbs/SelectBBSMasterInfsPop.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/bbs/BoardMstrListPop"; + } + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSUseInfoManageController.java b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSUseInfoManageController.java index fe04ffb2..b80d3def 100644 --- a/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSUseInfoManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/bbs/controller/BBSUseInfoManageController.java @@ -1,263 +1,263 @@ -package com.urpsys.itmsfront.bbs.controller; - -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; -import com.urpsys.itmsfront.bbs.domain.BoardUseInf; -import com.urpsys.itmsfront.bbs.domain.BoardUseInfVO; - -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 게시판의 이용정보를 관리하기 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.20 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.20   나혁제       최초 생성
- *
- * 
- */ - -@Slf4j -@Controller -public class BBSUseInfoManageController -{ - - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 게시판 사용정보 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/selectBBSUseInfs.do") - public String selectBBSUseInfs(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/selectBBSUseInfs.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - bdUseVO.setPageUnit(propertyService.getInt("pageUnit")); - bdUseVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (bdUseVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(bdUseVO.getPageUnit()); - paginationInfo.setPageSize (bdUseVO.getPageSize()); - - bdUseVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - bdUseVO.setLastIndex (paginationInfo.getLastRecordIndex()); - bdUseVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMapAll(bdUseVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/selectBBSUseInfs.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - int totCnt = (int)returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - - - log.info("<<<<<<<<<<<<<<< /bbs/selectBBSUseInfs.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/BoardUseInfList"; - } - - /** - * 게사판 사용정보 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/addBBSUseInf.do") - public String addBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO - , ModelMap model) throws Exception - { - return "uritms-tiles2/bbs/BoardUseInfRegist"; - } - - /** - * 게시판 사용정보를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/insertBBSUseInf.do") - public String insertBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO - , @ModelAttribute("boardUseInf") BoardUseInf boardUseInf - , BindingResult bindingResult - , @RequestParam Map commandMap, ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/insertBBSUseInf.do <<<<<<<<<<<<<<<>>>>>>>>>>>>>>>"); - - MemberVO memberVo = (MemberVO) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // 아이디 설정 - boardUseInf.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - boardUseInf.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(boardUseInf, bindingResult); - if (bindingResult.hasErrors()) - { - return "uritms-tiles2/bbs/BoardUseInfRegist"; - } - - String trgetType = (String) commandMap.get("param_trgetType"); - String registSeCode = ""; - - // CMMNTY 06/CLUB 05/SYSTEM(REGC01) - if ("CMMNTY".equals(trgetType)) - { - registSeCode = "REGC06"; - } - else if ("CLUB".equals(trgetType)) - { - registSeCode = "REGC05"; - } - else - { - registSeCode = "REGC01"; - } - - // Body Setting Start --------------------------------- - boardUseInf.setUseAt ("Y"); - boardUseInf.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); - boardUseInf.setRegistSeCode (registSeCode); - - Map bodyMap = ConvertUtils.convertToMapAll(boardUseInf); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/insertBBSUseInf.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /bbs/insertBBSUseInf.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/selectBBSUseInfs.do"; - } - - /** - * 게시판 사용정보에 대한 상세정보를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/selectBBSUseInf.do") - public String selectBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/selectBBSUseInf.do <<<<<<<<<<<<<<<"); - - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(bdUseVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/selectBBSUseInf.do"); - // RestApi Call End --------------------------------- - - BoardUseInfVO vo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardUseInfVO.class); - - // 시스템 사용 게시판의 경우 URL 표시 - if ( "SYSTEM_DEFAULT_BOARD".equals(vo.getTrgetId()) - || "SYSTEMDEFAULT_REGIST".equals(vo.getTrgetId()) ) //블로그에서 생성한 게시판일 때 추가 - { - if (vo.getBbsTyCode().equals("BBST02")) - { - // 익명게시판 - vo.setProvdUrl("/bbs/anonymous/selectBoardList.do?bbsId=" + vo.getBbsId()); - } - else - { - //vo.setProvdUrl("/bbs/selectBoardList.do?bbsId=" + vo.getBbsId()); - vo.setProvdUrl("/bbs/admin/selectBoardList.do?bbsId=" + vo.getBbsId()); //제공 url - } - } - - model.addAttribute("bdUseVO", vo); - - - log.info("<<<<<<<<<<<<<<< /bbs/selectBBSUseInf.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/bbs/BoardUseInfInqire"; - } - - /** - * 게시판 사용정보를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/bbs/updateBBSUseInf.do") - public String updateBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO - , @ModelAttribute("boardUseInf") BoardUseInf boardUseInf - , @ModelAttribute("boardMasterVO") BoardMasterVO boardMasterVO - , HttpServletRequest request - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /bbs/updateBBSUseInf.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - //아이디 설정 - boardUseInf.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(boardUseInf); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/updateBBSUseInf.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /bbs/updateBBSUseInf.do >>>>>>>>>>>>>>>"); - - return "forward:/bbs/selectBBSUseInfs.do"; - } - -} +package com.urpsys.itmsfront.bbs.controller; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; +import com.urpsys.itmsfront.bbs.domain.BoardUseInf; +import com.urpsys.itmsfront.bbs.domain.BoardUseInfVO; + +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 게시판의 이용정보를 관리하기 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.20 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.20   나혁제       최초 생성
+ *
+ * 
+ */ + +@Slf4j +@Controller +public class BBSUseInfoManageController +{ + + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 게시판 사용정보 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/selectBBSUseInfs.do") + public String selectBBSUseInfs(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/selectBBSUseInfs.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + bdUseVO.setPageUnit(propertyService.getInt("pageUnit")); + bdUseVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (bdUseVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bdUseVO.getPageUnit()); + paginationInfo.setPageSize (bdUseVO.getPageSize()); + + bdUseVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + bdUseVO.setLastIndex (paginationInfo.getLastRecordIndex()); + bdUseVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMapAll(bdUseVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/selectBBSUseInfs.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + int totCnt = (int)returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + + + log.info("<<<<<<<<<<<<<<< /bbs/selectBBSUseInfs.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/BoardUseInfList"; + } + + /** + * 게사판 사용정보 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/addBBSUseInf.do") + public String addBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO + , ModelMap model) throws Exception + { + return "uritms-tiles2/bbs/BoardUseInfRegist"; + } + + /** + * 게시판 사용정보를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/insertBBSUseInf.do") + public String insertBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO + , @ModelAttribute("boardUseInf") BoardUseInf boardUseInf + , BindingResult bindingResult + , @RequestParam Map commandMap, ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/insertBBSUseInf.do <<<<<<<<<<<<<<<>>>>>>>>>>>>>>>"); + + MemberVO memberVo = (MemberVO) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // 아이디 설정 + boardUseInf.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + boardUseInf.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(boardUseInf, bindingResult); + if (bindingResult.hasErrors()) + { + return "uritms-tiles2/bbs/BoardUseInfRegist"; + } + + String trgetType = (String) commandMap.get("param_trgetType"); + String registSeCode = ""; + + // CMMNTY 06/CLUB 05/SYSTEM(REGC01) + if ("CMMNTY".equals(trgetType)) + { + registSeCode = "REGC06"; + } + else if ("CLUB".equals(trgetType)) + { + registSeCode = "REGC05"; + } + else + { + registSeCode = "REGC01"; + } + + // Body Setting Start --------------------------------- + boardUseInf.setUseAt ("Y"); + boardUseInf.setFrstRegisterId (memberVo.getTokenInfo().getUniqId()); + boardUseInf.setRegistSeCode (registSeCode); + + Map bodyMap = ConvertUtils.convertToMapAll(boardUseInf); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/insertBBSUseInf.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /bbs/insertBBSUseInf.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/selectBBSUseInfs.do"; + } + + /** + * 게시판 사용정보에 대한 상세정보를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/selectBBSUseInf.do") + public String selectBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/selectBBSUseInf.do <<<<<<<<<<<<<<<"); + + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(bdUseVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/selectBBSUseInf.do"); + // RestApi Call End --------------------------------- + + BoardUseInfVO vo = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), BoardUseInfVO.class); + + // 시스템 사용 게시판의 경우 URL 표시 + if ( "SYSTEM_DEFAULT_BOARD".equals(vo.getTrgetId()) + || "SYSTEMDEFAULT_REGIST".equals(vo.getTrgetId()) ) //블로그에서 생성한 게시판일 때 추가 + { + if (vo.getBbsTyCode().equals("BBST02")) + { + // 익명게시판 + vo.setProvdUrl("/bbs/anonymous/selectBoardList.do?bbsId=" + vo.getBbsId()); + } + else + { + //vo.setProvdUrl("/bbs/selectBoardList.do?bbsId=" + vo.getBbsId()); + vo.setProvdUrl("/bbs/admin/selectBoardList.do?bbsId=" + vo.getBbsId()); //제공 url + } + } + + model.addAttribute("bdUseVO", vo); + + + log.info("<<<<<<<<<<<<<<< /bbs/selectBBSUseInf.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/bbs/BoardUseInfInqire"; + } + + /** + * 게시판 사용정보를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/bbs/updateBBSUseInf.do") + public String updateBBSUseInf(@ModelAttribute("searchVO") BoardUseInfVO bdUseVO + , @ModelAttribute("boardUseInf") BoardUseInf boardUseInf + , @ModelAttribute("boardMasterVO") BoardMasterVO boardMasterVO + , HttpServletRequest request + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /bbs/updateBBSUseInf.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + //아이디 설정 + boardUseInf.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(boardUseInf); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/bbs/updateBBSUseInf.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /bbs/updateBBSUseInf.do >>>>>>>>>>>>>>>"); + + return "forward:/bbs/selectBBSUseInfs.do"; + } + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileDownloadController.java b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileDownloadController.java index 6eba7dba..adf25925 100644 --- a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileDownloadController.java +++ b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileDownloadController.java @@ -1,152 +1,152 @@ -package com.urpsys.itmsfront.cmm.controller; - - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.stereotype.Controller; -import org.springframework.util.FileCopyUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.urpsys.basefront.common.egov.util.EgovBrowserUtil; -import com.urpsys.basefront.common.egov.util.EgovWebUtil; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; - -import lombok.extern.slf4j.Slf4j; - -/** - * 파일 다운로드를 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.20 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.20   나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class FileDownloadController -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping(value = "/cmm/FileDown.do") - public void cvplFileDownload( @RequestParam Map commandMap - , HttpServletRequest request - , HttpServletResponse response) throws Exception - { - log.info(">>>>>>>>>>>>>>> /cmm/FileDown.do <<<<<<<<<<<<<<<"); - - String atchFileId = (String)commandMap.get("atchFileId"); - String fileSn = (String)commandMap.get("fileSn"); - - FileVO fileVO = new FileVO(); - - fileVO.setAtchFileId (atchFileId); - fileVO.setFileSn (fileSn); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(fileVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/FileDown.do"); - Map chgMap = (Map)returnMap.get("fvo"); - - FileVO fvo = ConvertUtils.convertToValueObject(chgMap, FileVO.class ); - - File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm()); - long fSize = uFile.length(); - - if (fSize > 0) - { - String mimetype = "application/x-msdownload"; - - String userAgent = request.getHeader("User-Agent"); - HashMap result = EgovBrowserUtil.getBrowser(userAgent); - - if (!EgovBrowserUtil.MSIE.equals(result.get(EgovBrowserUtil.TYPEKEY))) - { - mimetype = "application/x-stuff"; - } - - String contentDisposition = EgovBrowserUtil.getDisposition(fvo.getOrignlFileNm(), userAgent, "UTF-8"); - response.setContentType(mimetype); - response.setHeader("Content-Disposition", contentDisposition); - response.setContentLengthLong(fSize); - - /* - * FileCopyUtils.copy(in, response.getOutputStream()); - * in.close(); - * response.getOutputStream().flush(); - * response.getOutputStream().close(); - */ - BufferedInputStream in = null; - BufferedOutputStream out = null; - - try - { - in = new BufferedInputStream(new FileInputStream(uFile)); - out = new BufferedOutputStream(response.getOutputStream()); - - FileCopyUtils.copy(in, out); - out.flush(); - } - catch (IOException ex) - { - ex.printStackTrace(); - } - finally - { - in.close(); - out.close(); - } - - } - else - { - response.setContentType("application/x-msdownload"); - - PrintWriter printwriter = response.getWriter(); - - printwriter.println(""); - printwriter.println("


Could not get file name:
"+ EgovWebUtil.clearXSSMaximum(fvo.getOrignlFileNm()) + "

");//2022.01 Potential XSS in Servlet - printwriter.println("


Back

"); - printwriter.println("


© webAccess"); - printwriter.println(""); - - printwriter.flush(); - printwriter.close(); - } - } - - - - -} +package com.urpsys.itmsfront.cmm.controller; + + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import com.urpsys.basefront.common.egov.util.EgovBrowserUtil; +import com.urpsys.basefront.common.egov.util.EgovWebUtil; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; + +import lombok.extern.slf4j.Slf4j; + +/** + * 파일 다운로드를 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.20 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.20   나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class FileDownloadController +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping(value = "/cmm/FileDown.do") + public void cvplFileDownload( @RequestParam Map commandMap + , HttpServletRequest request + , HttpServletResponse response) throws Exception + { + log.info(">>>>>>>>>>>>>>> /cmm/FileDown.do <<<<<<<<<<<<<<<"); + + String atchFileId = (String)commandMap.get("atchFileId"); + String fileSn = (String)commandMap.get("fileSn"); + + FileVO fileVO = new FileVO(); + + fileVO.setAtchFileId (atchFileId); + fileVO.setFileSn (fileSn); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(fileVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/FileDown.do"); + Map chgMap = (Map)returnMap.get("fvo"); + + FileVO fvo = ConvertUtils.convertToValueObject(chgMap, FileVO.class ); + + File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm()); + long fSize = uFile.length(); + + if (fSize > 0) + { + String mimetype = "application/x-msdownload"; + + String userAgent = request.getHeader("User-Agent"); + HashMap result = EgovBrowserUtil.getBrowser(userAgent); + + if (!EgovBrowserUtil.MSIE.equals(result.get(EgovBrowserUtil.TYPEKEY))) + { + mimetype = "application/x-stuff"; + } + + String contentDisposition = EgovBrowserUtil.getDisposition(fvo.getOrignlFileNm(), userAgent, "UTF-8"); + response.setContentType(mimetype); + response.setHeader("Content-Disposition", contentDisposition); + response.setContentLengthLong(fSize); + + /* + * FileCopyUtils.copy(in, response.getOutputStream()); + * in.close(); + * response.getOutputStream().flush(); + * response.getOutputStream().close(); + */ + BufferedInputStream in = null; + BufferedOutputStream out = null; + + try + { + in = new BufferedInputStream(new FileInputStream(uFile)); + out = new BufferedOutputStream(response.getOutputStream()); + + FileCopyUtils.copy(in, out); + out.flush(); + } + catch (IOException ex) + { + ex.printStackTrace(); + } + finally + { + in.close(); + out.close(); + } + + } + else + { + response.setContentType("application/x-msdownload"); + + PrintWriter printwriter = response.getWriter(); + + printwriter.println(""); + printwriter.println("


Could not get file name:
"+ EgovWebUtil.clearXSSMaximum(fvo.getOrignlFileNm()) + "

");//2022.01 Potential XSS in Servlet + printwriter.println("


Back

"); + printwriter.println("


© webAccess"); + printwriter.println(""); + + printwriter.flush(); + printwriter.close(); + } + } + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileMngController.java b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileMngController.java index d1b9f1e7..a6e39f0d 100644 --- a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileMngController.java +++ b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/FileMngController.java @@ -1,158 +1,158 @@ -package com.urpsys.itmsfront.cmm.controller; - -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; - -import lombok.extern.slf4j.Slf4j; - -/** - * 파일 조회, 삭제, 다운로드 처리를 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.20 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.20   나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class FileMngController -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 첨부파일에 대한 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/cmm/selectFileInfs.do") - public String selectFileInfs(@ModelAttribute("searchVO") FileVO fileVO - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /cmm/selectFileInfs.do <<<<<<<<<<<<<<<"); - - String atchFileId = (String)commandMap.get("param_atchFileId"); - String strItmsYn = CommonUtil.nvl((String)commandMap.get("strItmsYn")); - - fileVO.setAtchFileId(atchFileId); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(fileVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectFileInfs.do"); - - List> result = (List>)returnMap.get("result"); - - model.addAttribute("fileList" , result); - model.addAttribute("updateFlag" , "N"); - model.addAttribute("fileListCnt" , result.size()); - model.addAttribute("atchFileId" , atchFileId); - - // 2025.02.05 나혁제 itms 파일첨부 방식 추가 - String strJspPage = ""; - if(strItmsYn.equals("Y")) - { - strJspPage = "/itms/cmm/ItsmFileList"; - } - else - { - strJspPage = "/itms/cmm/FileList"; - } - - log.info("<<<<<<<<<<<<<<< /cmm/selectFileInfs.do >>>>>>>>>>>>>>>"); - - - - return strJspPage; - } - - /** - * 첨부파일 변경을 위한 수정페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/cmm/selectFileInfsForUpdate.do") - public String selectFileInfsForUpdate( @ModelAttribute("searchVO") FileVO fileVO - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /cmm/selectFileInfsForUpdate.do <<<<<<<<<<<<<<<"); - - String atchFileId = (String)commandMap.get("param_atchFileId"); - - fileVO.setAtchFileId(atchFileId); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(fileVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectFileInfsForUpdate.do"); - - List> result = (List>)returnMap.get("result"); - - model.addAttribute("fileList" , result); - model.addAttribute("updateFlag" , "Y"); - model.addAttribute("fileListCnt" , result.size()); - model.addAttribute("atchFileId" , atchFileId); - - log.info("<<<<<<<<<<<<<<< /cmm/selectFileInfsForUpdate.do >>>>>>>>>>>>>>>"); - - return "/itms/cmm/FileList"; - } - - /** - * 첨부파일에 대한 삭제를 처리한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.20 - */ - @RequestMapping("/cmm/deleteFileInfs.do") - public String deleteFileInf( @ModelAttribute("searchVO") FileVO fileVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /cmm/deleteFileInfs.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(fileVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/deleteFileInfs.do"); - - int result = (int)returnMap.get("result"); - - log.info("<<<<<<<<<<<<<<< /cmm/deleteFileInfs.do >>>>>>>>>>>>>>>"); - - - return "blank"; - } - - - - - - -} +package com.urpsys.itmsfront.cmm.controller; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; + +import lombok.extern.slf4j.Slf4j; + +/** + * 파일 조회, 삭제, 다운로드 처리를 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.20 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.20   나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class FileMngController +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 첨부파일에 대한 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/cmm/selectFileInfs.do") + public String selectFileInfs(@ModelAttribute("searchVO") FileVO fileVO + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /cmm/selectFileInfs.do <<<<<<<<<<<<<<<"); + + String atchFileId = (String)commandMap.get("param_atchFileId"); + String strItmsYn = CommonUtil.nvl((String)commandMap.get("strItmsYn")); + + fileVO.setAtchFileId(atchFileId); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(fileVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectFileInfs.do"); + + List> result = (List>)returnMap.get("result"); + + model.addAttribute("fileList" , result); + model.addAttribute("updateFlag" , "N"); + model.addAttribute("fileListCnt" , result.size()); + model.addAttribute("atchFileId" , atchFileId); + + // 2025.02.05 나혁제 itms 파일첨부 방식 추가 + String strJspPage = ""; + if(strItmsYn.equals("Y")) + { + strJspPage = "/itms/cmm/ItsmFileList"; + } + else + { + strJspPage = "/itms/cmm/FileList"; + } + + log.info("<<<<<<<<<<<<<<< /cmm/selectFileInfs.do >>>>>>>>>>>>>>>"); + + + + return strJspPage; + } + + /** + * 첨부파일 변경을 위한 수정페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/cmm/selectFileInfsForUpdate.do") + public String selectFileInfsForUpdate( @ModelAttribute("searchVO") FileVO fileVO + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /cmm/selectFileInfsForUpdate.do <<<<<<<<<<<<<<<"); + + String atchFileId = (String)commandMap.get("param_atchFileId"); + + fileVO.setAtchFileId(atchFileId); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(fileVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectFileInfsForUpdate.do"); + + List> result = (List>)returnMap.get("result"); + + model.addAttribute("fileList" , result); + model.addAttribute("updateFlag" , "Y"); + model.addAttribute("fileListCnt" , result.size()); + model.addAttribute("atchFileId" , atchFileId); + + log.info("<<<<<<<<<<<<<<< /cmm/selectFileInfsForUpdate.do >>>>>>>>>>>>>>>"); + + return "/itms/cmm/FileList"; + } + + /** + * 첨부파일에 대한 삭제를 처리한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.20 + */ + @RequestMapping("/cmm/deleteFileInfs.do") + public String deleteFileInf( @ModelAttribute("searchVO") FileVO fileVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /cmm/deleteFileInfs.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(fileVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/deleteFileInfs.do"); + + int result = (int)returnMap.get("result"); + + log.info("<<<<<<<<<<<<<<< /cmm/deleteFileInfs.do >>>>>>>>>>>>>>>"); + + + return "blank"; + } + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/UserSearchController.java b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/UserSearchController.java index c23f6044..84486022 100644 --- a/front/src/main/java/com/urpsys/itmsfront/cmm/controller/UserSearchController.java +++ b/front/src/main/java/com/urpsys/itmsfront/cmm/controller/UserSearchController.java @@ -1,126 +1,126 @@ -package com.urpsys.itmsfront.cmm.controller; - -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.urpsys.basefront.domain.ComDefaultVO; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; - -import lombok.extern.slf4j.Slf4j; - -/** - * 사용자 검색 처리를 위한 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.02.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.06   나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class UserSearchController -{ - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - /** - * 사용자 정보에 대한 팝업 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.06 - */ - @RequestMapping("/cmm/selectUserListPopup.do") - public String selectUserListPopup( @ModelAttribute("searchVO") ComDefaultVO searchVO - , @RequestParam("multiUserSelectYn") String strMultiUserSelectYn - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /cmm/selectUserListPopup.do <<<<<<<<<<<<<<<"); - - log.info("strMultiUserSelectYn : {}", strMultiUserSelectYn); - - // Body Setting Start ------------------------------- - searchVO.setPageUnit(propertyService.getInt("pageUnit")); - searchVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/cmm/selectUserListPopup.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - int totCnt = (int) returnMap.get("totCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - // 2025.11.19 나혁제 선잭조건이 없는경우 1 로 세팅 - if(searchVO.getSearchCondition() == null || searchVO.getSearchCondition().equals("")) - { - searchVO.setSearchCondition("1"); - } - - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - - String strJsp=""; - if(strMultiUserSelectYn.equals("Y")) - { - strJsp="uritms-popup1/cmm/UserListPopupMulti"; - } - else - { - strJsp="uritms-popup1/cmm/UserListPopupOne"; - } - - - log.info("<<<<<<<<<<<<<<< /cmm/selectUserListPopup.do >>>>>>>>>>>>>>>"); - - - - return strJsp; - } - - - - - - -} +package com.urpsys.itmsfront.cmm.controller; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import com.urpsys.basefront.domain.ComDefaultVO; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; + +import lombok.extern.slf4j.Slf4j; + +/** + * 사용자 검색 처리를 위한 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.02.06 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.06   나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class UserSearchController +{ + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + /** + * 사용자 정보에 대한 팝업 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.06 + */ + @RequestMapping("/cmm/selectUserListPopup.do") + public String selectUserListPopup( @ModelAttribute("searchVO") ComDefaultVO searchVO + , @RequestParam("multiUserSelectYn") String strMultiUserSelectYn + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /cmm/selectUserListPopup.do <<<<<<<<<<<<<<<"); + + log.info("strMultiUserSelectYn : {}", strMultiUserSelectYn); + + // Body Setting Start ------------------------------- + searchVO.setPageUnit(propertyService.getInt("pageUnit")); + searchVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/cmm/selectUserListPopup.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + int totCnt = (int) returnMap.get("totCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + // 2025.11.19 나혁제 선잭조건이 없는경우 1 로 세팅 + if(searchVO.getSearchCondition() == null || searchVO.getSearchCondition().equals("")) + { + searchVO.setSearchCondition("1"); + } + + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + + String strJsp=""; + if(strMultiUserSelectYn.equals("Y")) + { + strJsp="uritms-popup1/cmm/UserListPopupMulti"; + } + else + { + strJsp="uritms-popup1/cmm/UserListPopupOne"; + } + + + log.info("<<<<<<<<<<<<<<< /cmm/selectUserListPopup.do >>>>>>>>>>>>>>>"); + + + + return strJsp; + } + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/comm/SendMailUtil.java b/front/src/main/java/com/urpsys/itmsfront/comm/SendMailUtil.java index b52cc517..c885e68d 100644 --- a/front/src/main/java/com/urpsys/itmsfront/comm/SendMailUtil.java +++ b/front/src/main/java/com/urpsys/itmsfront/comm/SendMailUtil.java @@ -1,55 +1,55 @@ -package com.urpsys.itmsfront.comm; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Base64; -import java.util.Calendar; -import java.util.Date; -import java.util.Hashtable; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.SimpleTimeZone; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; - -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; -import org.springframework.security.core.context.SecurityContextHolder; - -import com.urpsys.basefront.common.exception.CustomException; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; - -/** - * itsm 메일처리 유틸리티를 모아둔 클래스 - * - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0.0 - * @see - * - *
- *
- * << 개정이력(Modification information) >>
- *
- *   수정일        수정자          수정내용
- * -----------  ---------    ------------------------
- * 2025.01.06    나혁제          최초작성
- *
- *      
- */ - -public class SendMailUtil -{ - - - - - - - - - -} +package com.urpsys.itmsfront.comm; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.springframework.security.core.context.SecurityContextHolder; + +import com.urpsys.common.exception.CustomException; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; + +/** + * itsm 메일처리 유틸리티를 모아둔 클래스 + * + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자          수정내용
+ * -----------  ---------    ------------------------
+ * 2025.01.06    나혁제          최초작성
+ *
+ *      
+ */ + +public class SendMailUtil +{ + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/pot/controller/PortletManageController.java b/front/src/main/java/com/urpsys/itmsfront/pot/controller/PortletManageController.java index 3794eeb6..5cdf45a8 100644 --- a/front/src/main/java/com/urpsys/itmsfront/pot/controller/PortletManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/pot/controller/PortletManageController.java @@ -1,1120 +1,1120 @@ -package com.urpsys.itmsfront.pot.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import com.urpsys.itmsfront.bbs.domain.BoardVO; -import com.urpsys.itmsfront.srm.domain.ReportOtherVo; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; - -import kong.unirest.json.JSONArray; -import lombok.extern.slf4j.Slf4j; - -/** - * 포틀릿을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.03.10 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.03.10   나혁제       최초 생성
- *
- * 
- * - */ -@Slf4j -@Controller -public class PortletManageController -{ - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** EgovMessageSource */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - /** - * 포틀릿 배치 수정 - * @author urp 인프라본부 나혁제 - * 작성일 : 2022.12.20 - */ - @RequestMapping("/potl/updatePortletSeq.do") - public ModelAndView updatePortletSeq( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , @RequestParam("portletSeqForInsert") String portletSeqForInsert - , @RequestParam("prsnlIdForInsert") String prsnlIdForInsert - , HttpServletRequest request - , ModelMap model) throws Exception { - log.info(">>>>>>>>>>>>>>> /potl/updatePortletSeq.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String userId=memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); - - Map bodyMap = new LinkedHashMap(); - // Body Setting Start --------------------------------- - bodyMap.put("portletSeqForInsert", portletSeqForInsert); - bodyMap.put("prsnlIdForInsert" , prsnlIdForInsert); - bodyMap.put("userId", userId); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/updatePortletSeq.do"); - log.info("<<<<<<<<<<<<<<< /potl/updatePortletSeq.do >>>>>>>>>>>>>>>"); - - ModelAndView mav = new ModelAndView("jsonView"); - - return mav; - } - - /** - * 사용자 포틀릿 등록 - * @author urp 인프라본부 나혁제 - * 작성일 : 2022.12.23 - */ - @RequestMapping("/potl/insertUserPortlet.do") - public ModelAndView insertUserPortlet( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , @RequestParam Map commandMap - , HttpServletRequest request - , ModelMap model) throws Exception - { - - log.info(">>>>>>>>>>>>>>> /potl/insertUserPortlet.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String userId = memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); - - prsnlPortletCreateVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); - - Map bodyMap = new LinkedHashMap(); - - prsnlPortletCreateVO.setPrsnlId((String)commandMap.get("insPrnslIds")); - prsnlPortletCreateVO.setPortletSeq(CommonUtil.stoi((String)commandMap.get("insPrnslSeq"))); - prsnlPortletCreateVO.setUserId(userId); - - // Body Setting Start --------------------------------- - // 2025.11.12 나혁제 불필요코딩 삭제 - // bodyMap.put("insPrnslIds" , commandMap.get("insPrnslIds") ); - // bodyMap.put("insPrnslSeq" , commandMap.get("insPrnslSeq") ); // 2025.11.12 나혁제 포틀릿 순서 추가 - // bodyMap.put("userId" , userId); - - bodyMap.put("prsnlPortletCreateVO", ConvertUtils.convertToMapAll(prsnlPortletCreateVO)); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/insertUserPortlet.do"); - - log.info("<<<<<<<<<<<<<<< /potl/insertUserPortlet.do >>>>>>>>>>>>>>>"); - - ModelAndView mav = new ModelAndView("jsonView"); - - return mav; - } - - /** - * 사용자 포틀릿 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2022.12.22 - */ - @RequestMapping("/potl/deleteUserPortlet.do") - public ModelAndView deleteUserPortlet( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , @RequestParam("prsnlIdForInsert") String prsnlIdForInsert - , HttpServletRequest request - , ModelMap model) throws Exception { - log.info(">>>>>>>>>>>>>>> /potl/deleteUserPortlet.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String userId = memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); - - Map bodyMap = new LinkedHashMap(); - // Body Setting Start --------------------------------- - bodyMap.put("prsnlIdForInsert" , prsnlIdForInsert); - bodyMap.put("userId", userId); - - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/deleteUserPortlet.do"); - log.info("<<<<<<<<<<<<<<< /potl/deleteUserPortlet.do >>>>>>>>>>>>>>>"); - - ModelAndView mav = new ModelAndView("jsonView"); - - return mav; - } - - /** - * 업무게시판 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping(value = "/potl/taskPortlet.do") - public String getTaskPortlet( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/taskPortlet.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - BoardVO boardVO = new BoardVO(); - boardVO.setPageUnit(5); - boardVO.setPageSize(10); - boardVO.setBbsId ("BBSMSTR_CCCCCCCCCCCC"); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); - paginationInfo.setPageSize (boardVO.getPageSize()); - - boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); - // bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - // returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("bbsList", resultList); - model.addAttribute("potlId" , potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - log.info("<<<<<<<<<<<<<<< /potl/taskPortlet.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/TaskPortlet"; - } - - /** - * 기본업무게시판 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.05.14 - */ - @RequestMapping(value = "/potl/taskPortlet2.do") - public String getTaskPortlet2( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/taskPortlet2.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - BoardVO boardVO = new BoardVO(); - boardVO.setPageUnit(5); - boardVO.setPageSize(10); - boardVO.setBbsId ("BBSMSTR_CCCCCCCCCCCC"); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); - paginationInfo.setPageSize (boardVO.getPageSize()); - - boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("bbsList", resultList); - model.addAttribute("potlId" , potlId); - log.info("<<<<<<<<<<<<<<< /potl/taskPortlet2.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/taskPortlet2"; - } - - /** - * 공지사항 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping(value = "/potl/infPortlet.do") - public String getInfPortlet( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/infPortlet.do <<<<<<<<<<<<<<<"); - - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - BoardVO boardVO = new BoardVO(); - boardVO.setPageUnit(10); - boardVO.setPageSize(10); - boardVO.setBbsId ("BBSMSTR_AAAAAAAAAAAA"); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); - paginationInfo.setPageSize (boardVO.getPageSize()); - - boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); - // bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - // returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("notiList", resultList); - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - log.info("<<<<<<<<<<<<<<< /potl/infPortlet.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/InfPortlet"; - } - - /** - * 기본공지사항 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.05.14 - */ - @RequestMapping(value = "/potl/infPortlet2.do") - public String getInfPortlet2( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/infPortlet.do <<<<<<<<<<<<<<<"); - - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - BoardVO boardVO = new BoardVO(); - boardVO.setPageUnit(10); - boardVO.setPageSize(10); - boardVO.setBbsId ("BBSMSTR_AAAAAAAAAAAA"); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); - paginationInfo.setPageSize (boardVO.getPageSize()); - - boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); - boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(boardVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - - model.addAttribute("notiList", resultList); - log.info("<<<<<<<<<<<<<<< /potl/infPortlet.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/infPortlet2"; - } - - - /** - * 서비스데스크 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping(value = "/potl/getMyIncidents.do") - public String getMyIncidents( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getMyIncidents.do <<<<<<<<<<<<<<<"); - - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - // Body Setting Start --------------------------------- - bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyIncidents.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("resultList", resultList); - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - log.info("<<<<<<<<<<<<<<< /potl/getMyIncidents.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyIncidentsPortlet"; - } - - /** - * 보고서 현황 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping(value = "/potl/getMyReports.do") - public String getMyReports( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getMyReports.do <<<<<<<<<<<<<<<"); - - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - // Body Setting Start --------------------------------- - bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyReports.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("resultList", resultList); - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - log.info("<<<<<<<<<<<<<<< /potl/getMyReports.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyReportsPortlet"; - } - - /** - * 보고서 현황 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping(value = "/potl/getMyTodo.do") - public String getMyTodo( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getMyTodo.do <<<<<<<<<<<<<<<"); - - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - // Body Setting Start --------------------------------- - bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyTodo.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("resultList", resultList); - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - log.info("<<<<<<<<<<<<<<< /potl/getMyTodo.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyTodoPortlet"; - } - - - /** - * 자산 현황 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.11.11 - */ - @RequestMapping(value = "/potl/getResouceTotalStat.do") - public String getResouceTotalStat( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getResouceTotalStat.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - List> resultList = new ArrayList(); - - // Body Setting Start --------------------------------- - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sta/getResouceTotalStat.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String potlId=(String) commandMap.get("prsnlId"); - - - JSONArray jsonArr = ConvertUtils.getJsonFromList(resultList); - - model.addAttribute("resultJson", jsonArr.toString()); - model.addAttribute("resultList", resultList); - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - log.info("<<<<<<<<<<<<<<< /potl/getResouceTotalStat.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyResouceTotalStat"; - } - - /** - * SR 현황 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.11.11 - */ - @RequestMapping(value = "/potl/getIncidentStat.do") - public String getIncidentStat( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getIncidentStat.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 - - log.info("<<<<<<<<<<<<<<< /potl/getIncidentStat.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyIncidentStat"; - } - - /** - * 월간 SR 현황 통계 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.11.13 - */ - @ResponseBody - @RequestMapping(value="/potl/getIncidentMonStatus.do") - public LinkedHashMap getIncidentMonStatus( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getIncidentMonStatus.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentMonStatus.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - JSONArray jsonArr = ConvertUtils.getJsonFromList(resultList); - - log.info("jsonArr [{}]", jsonArr.toString()); - - // resBody.put("resultList" , jsonArr.toString() ); - resBody.put("resultList" , resultList ); - - - log.info("<<<<<<<<<<<<<<< /potl/getIncidentMonStatus.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 월간 보고서 현황 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.11.14 - */ - @RequestMapping(value = "/potl/getReportStat.do") - public String getReportStat( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getReportStat.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 - - log.info("<<<<<<<<<<<<<<< /potl/getReportStat.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyReportStat"; - } - - /** - * 월간 보고서 현황 통계 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.11.14 - */ - @ResponseBody - @RequestMapping(value="/potl/getReportMonStatus.do") - public LinkedHashMap getReportMonStatus( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getReportMonStatus.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportMonStatus.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - resBody.put("resultList" , resultList ); - - log.info("<<<<<<<<<<<<<<< /potl/getReportMonStatus.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * SR 처리준수율 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.10 - */ - @RequestMapping(value = "/potl/getSrProPromiseRate.do") - public String getSrProPromiseRate( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getSrProPromiseRate.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 - - log.info("<<<<<<<<<<<<<<< /potl/getSrProPromiseRate.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MySrProPromiseRate"; - } - - /** - * 월간 SR 처리준수율 현황 통계 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.09 - */ - @ResponseBody - @RequestMapping(value="/potl/getSrProPromiseRateData.do") - public LinkedHashMap getSrProPromiseRateData( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getSrProPromiseRateData.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSrProPromiseRate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - resBody.put("resultList" , resultList ); - - log.info("<<<<<<<<<<<<<<< /potl/getSrProPromiseRateData.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * SR 만족율 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.10 - */ - @RequestMapping(value = "/potl/getSrStsfdgRatePage.do") - public String getSrStsfdgRatePage( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getSrStsfdgRatePage.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 - - log.info("<<<<<<<<<<<<<<< /potl/getSrStsfdgRatePage.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MySrStsfdgRate"; - } - - /** - * SR 만족율 통계 통계 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.09 - */ - @ResponseBody - @RequestMapping(value="/potl/getSrStsfdgRate.do") - public LinkedHashMap getSrStsfdgRate( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getSrStsfdgRate.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSrStsfdgRate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - resBody.put("resultList" , resultList ); - - log.info("<<<<<<<<<<<<<<< /potl/getSrStsfdgRate.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 만족율 통계 포틀릿 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.10 - */ - @RequestMapping(value = "/potl/getReportStsfdgRatePage.do") - public String getReportStsfdgRatePage( HttpServletRequest request - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getReportStsfdgRatePage.do <<<<<<<<<<<<<<<"); - - PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); - - prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); - - // Body Setting Start --------------------------------- - Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - // RestApi Call Start --------------------------------- - Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultList2 = (Map)returnMap2.get("resultList"); - // Return Data Setting End -------------------------- - - int potlWidth= (int) resultList2.get("portletWidth"); - int potlHeight= (int) resultList2.get("portletHeight"); - - String potlId=(String) commandMap.get("prsnlId"); - - model.addAttribute("potlId", potlId); - model.addAttribute("potlWidth" , potlWidth); - model.addAttribute("potlHeight", potlHeight); - - model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 - - log.info("<<<<<<<<<<<<<<< /potl/getReportStsfdgRatePage.do >>>>>>>>>>>>>>>"); - - return "/itms/pot/MyReportStsfdgRate"; - } - - /** - * SR 만족율 통계 통계 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.12.09 - */ - @ResponseBody - @RequestMapping(value="/potl/getReportStsfdgRate.do") - public LinkedHashMap getReportStsfdgRate( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /potl/getReportStsfdgRate.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportStsfdgRate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - resBody.put("resultList" , resultList ); - - log.info("<<<<<<<<<<<<<<< /potl/getReportStsfdgRate.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - - - -} +package com.urpsys.itmsfront.pot.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.urpsys.itmsfront.bbs.domain.BoardVO; +import com.urpsys.itmsfront.srm.domain.ReportOtherVo; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; + +import kong.unirest.json.JSONArray; +import lombok.extern.slf4j.Slf4j; + +/** + * 포틀릿을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.03.10 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.03.10   나혁제       최초 생성
+ *
+ * 
+ * + */ +@Slf4j +@Controller +public class PortletManageController +{ + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** EgovMessageSource */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + /** + * 포틀릿 배치 수정 + * @author urp 인프라본부 나혁제 + * 작성일 : 2022.12.20 + */ + @RequestMapping("/potl/updatePortletSeq.do") + public ModelAndView updatePortletSeq( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , @RequestParam("portletSeqForInsert") String portletSeqForInsert + , @RequestParam("prsnlIdForInsert") String prsnlIdForInsert + , HttpServletRequest request + , ModelMap model) throws Exception { + log.info(">>>>>>>>>>>>>>> /potl/updatePortletSeq.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String userId=memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); + + Map bodyMap = new LinkedHashMap(); + // Body Setting Start --------------------------------- + bodyMap.put("portletSeqForInsert", portletSeqForInsert); + bodyMap.put("prsnlIdForInsert" , prsnlIdForInsert); + bodyMap.put("userId", userId); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/updatePortletSeq.do"); + log.info("<<<<<<<<<<<<<<< /potl/updatePortletSeq.do >>>>>>>>>>>>>>>"); + + ModelAndView mav = new ModelAndView("jsonView"); + + return mav; + } + + /** + * 사용자 포틀릿 등록 + * @author urp 인프라본부 나혁제 + * 작성일 : 2022.12.23 + */ + @RequestMapping("/potl/insertUserPortlet.do") + public ModelAndView insertUserPortlet( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , @RequestParam Map commandMap + , HttpServletRequest request + , ModelMap model) throws Exception + { + + log.info(">>>>>>>>>>>>>>> /potl/insertUserPortlet.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String userId = memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); + + prsnlPortletCreateVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); + + Map bodyMap = new LinkedHashMap(); + + prsnlPortletCreateVO.setPrsnlId((String)commandMap.get("insPrnslIds")); + prsnlPortletCreateVO.setPortletSeq(CommonUtil.stoi((String)commandMap.get("insPrnslSeq"))); + prsnlPortletCreateVO.setUserId(userId); + + // Body Setting Start --------------------------------- + // 2025.11.12 나혁제 불필요코딩 삭제 + // bodyMap.put("insPrnslIds" , commandMap.get("insPrnslIds") ); + // bodyMap.put("insPrnslSeq" , commandMap.get("insPrnslSeq") ); // 2025.11.12 나혁제 포틀릿 순서 추가 + // bodyMap.put("userId" , userId); + + bodyMap.put("prsnlPortletCreateVO", ConvertUtils.convertToMapAll(prsnlPortletCreateVO)); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/insertUserPortlet.do"); + + log.info("<<<<<<<<<<<<<<< /potl/insertUserPortlet.do >>>>>>>>>>>>>>>"); + + ModelAndView mav = new ModelAndView("jsonView"); + + return mav; + } + + /** + * 사용자 포틀릿 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2022.12.22 + */ + @RequestMapping("/potl/deleteUserPortlet.do") + public ModelAndView deleteUserPortlet( @ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , @RequestParam("prsnlIdForInsert") String prsnlIdForInsert + , HttpServletRequest request + , ModelMap model) throws Exception { + log.info(">>>>>>>>>>>>>>> /potl/deleteUserPortlet.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String userId = memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID()); + + Map bodyMap = new LinkedHashMap(); + // Body Setting Start --------------------------------- + bodyMap.put("prsnlIdForInsert" , prsnlIdForInsert); + bodyMap.put("userId", userId); + + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/potl/deleteUserPortlet.do"); + log.info("<<<<<<<<<<<<<<< /potl/deleteUserPortlet.do >>>>>>>>>>>>>>>"); + + ModelAndView mav = new ModelAndView("jsonView"); + + return mav; + } + + /** + * 업무게시판 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping(value = "/potl/taskPortlet.do") + public String getTaskPortlet( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/taskPortlet.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + BoardVO boardVO = new BoardVO(); + boardVO.setPageUnit(5); + boardVO.setPageSize(10); + boardVO.setBbsId ("BBSMSTR_CCCCCCCCCCCC"); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); + paginationInfo.setPageSize (boardVO.getPageSize()); + + boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); + // bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + // returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("bbsList", resultList); + model.addAttribute("potlId" , potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + log.info("<<<<<<<<<<<<<<< /potl/taskPortlet.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/TaskPortlet"; + } + + /** + * 기본업무게시판 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.05.14 + */ + @RequestMapping(value = "/potl/taskPortlet2.do") + public String getTaskPortlet2( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/taskPortlet2.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + BoardVO boardVO = new BoardVO(); + boardVO.setPageUnit(5); + boardVO.setPageSize(10); + boardVO.setBbsId ("BBSMSTR_CCCCCCCCCCCC"); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); + paginationInfo.setPageSize (boardVO.getPageSize()); + + boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("bbsList", resultList); + model.addAttribute("potlId" , potlId); + log.info("<<<<<<<<<<<<<<< /potl/taskPortlet2.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/taskPortlet2"; + } + + /** + * 공지사항 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping(value = "/potl/infPortlet.do") + public String getInfPortlet( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/infPortlet.do <<<<<<<<<<<<<<<"); + + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + BoardVO boardVO = new BoardVO(); + boardVO.setPageUnit(10); + boardVO.setPageSize(10); + boardVO.setBbsId ("BBSMSTR_AAAAAAAAAAAA"); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); + paginationInfo.setPageSize (boardVO.getPageSize()); + + boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap.put("boardVO" , ConvertUtils.convertToMapAll(boardVO)); + // bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + // returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/bbs/admin/selectBoardList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("notiList", resultList); + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + log.info("<<<<<<<<<<<<<<< /potl/infPortlet.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/InfPortlet"; + } + + /** + * 기본공지사항 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.05.14 + */ + @RequestMapping(value = "/potl/infPortlet2.do") + public String getInfPortlet2( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/infPortlet.do <<<<<<<<<<<<<<<"); + + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + BoardVO boardVO = new BoardVO(); + boardVO.setPageUnit(10); + boardVO.setPageSize(10); + boardVO.setBbsId ("BBSMSTR_AAAAAAAAAAAA"); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (boardVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(boardVO.getPageUnit()); + paginationInfo.setPageSize (boardVO.getPageSize()); + + boardVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + boardVO.setLastIndex (paginationInfo.getLastRecordIndex()); + boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(boardVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/main/mainPage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + + model.addAttribute("notiList", resultList); + log.info("<<<<<<<<<<<<<<< /potl/infPortlet.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/infPortlet2"; + } + + + /** + * 서비스데스크 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping(value = "/potl/getMyIncidents.do") + public String getMyIncidents( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getMyIncidents.do <<<<<<<<<<<<<<<"); + + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + // Body Setting Start --------------------------------- + bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyIncidents.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("resultList", resultList); + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + log.info("<<<<<<<<<<<<<<< /potl/getMyIncidents.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyIncidentsPortlet"; + } + + /** + * 보고서 현황 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping(value = "/potl/getMyReports.do") + public String getMyReports( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getMyReports.do <<<<<<<<<<<<<<<"); + + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + // Body Setting Start --------------------------------- + bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyReports.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("resultList", resultList); + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + log.info("<<<<<<<<<<<<<<< /potl/getMyReports.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyReportsPortlet"; + } + + /** + * 보고서 현황 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping(value = "/potl/getMyTodo.do") + public String getMyTodo( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getMyTodo.do <<<<<<<<<<<<<<<"); + + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + // Body Setting Start --------------------------------- + bodyMap.put("ym" , CommonUtil.getKST("yyyy-MM")); // 시작일시 + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getMyTodo.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("resultList", resultList); + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + log.info("<<<<<<<<<<<<<<< /potl/getMyTodo.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyTodoPortlet"; + } + + + /** + * 자산 현황 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.11.11 + */ + @RequestMapping(value = "/potl/getResouceTotalStat.do") + public String getResouceTotalStat( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getResouceTotalStat.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + List> resultList = new ArrayList(); + + // Body Setting Start --------------------------------- + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sta/getResouceTotalStat.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String potlId=(String) commandMap.get("prsnlId"); + + + JSONArray jsonArr = ConvertUtils.getJsonFromList(resultList); + + model.addAttribute("resultJson", jsonArr.toString()); + model.addAttribute("resultList", resultList); + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + log.info("<<<<<<<<<<<<<<< /potl/getResouceTotalStat.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyResouceTotalStat"; + } + + /** + * SR 현황 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.11.11 + */ + @RequestMapping(value = "/potl/getIncidentStat.do") + public String getIncidentStat( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getIncidentStat.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 + + log.info("<<<<<<<<<<<<<<< /potl/getIncidentStat.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyIncidentStat"; + } + + /** + * 월간 SR 현황 통계 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.11.13 + */ + @ResponseBody + @RequestMapping(value="/potl/getIncidentMonStatus.do") + public LinkedHashMap getIncidentMonStatus( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getIncidentMonStatus.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentMonStatus.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + JSONArray jsonArr = ConvertUtils.getJsonFromList(resultList); + + log.info("jsonArr [{}]", jsonArr.toString()); + + // resBody.put("resultList" , jsonArr.toString() ); + resBody.put("resultList" , resultList ); + + + log.info("<<<<<<<<<<<<<<< /potl/getIncidentMonStatus.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 월간 보고서 현황 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.11.14 + */ + @RequestMapping(value = "/potl/getReportStat.do") + public String getReportStat( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getReportStat.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 + + log.info("<<<<<<<<<<<<<<< /potl/getReportStat.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyReportStat"; + } + + /** + * 월간 보고서 현황 통계 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.11.14 + */ + @ResponseBody + @RequestMapping(value="/potl/getReportMonStatus.do") + public LinkedHashMap getReportMonStatus( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getReportMonStatus.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportMonStatus.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + resBody.put("resultList" , resultList ); + + log.info("<<<<<<<<<<<<<<< /potl/getReportMonStatus.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * SR 처리준수율 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.10 + */ + @RequestMapping(value = "/potl/getSrProPromiseRate.do") + public String getSrProPromiseRate( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getSrProPromiseRate.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 + + log.info("<<<<<<<<<<<<<<< /potl/getSrProPromiseRate.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MySrProPromiseRate"; + } + + /** + * 월간 SR 처리준수율 현황 통계 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.09 + */ + @ResponseBody + @RequestMapping(value="/potl/getSrProPromiseRateData.do") + public LinkedHashMap getSrProPromiseRateData( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getSrProPromiseRateData.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSrProPromiseRate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + resBody.put("resultList" , resultList ); + + log.info("<<<<<<<<<<<<<<< /potl/getSrProPromiseRateData.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * SR 만족율 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.10 + */ + @RequestMapping(value = "/potl/getSrStsfdgRatePage.do") + public String getSrStsfdgRatePage( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getSrStsfdgRatePage.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 + + log.info("<<<<<<<<<<<<<<< /potl/getSrStsfdgRatePage.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MySrStsfdgRate"; + } + + /** + * SR 만족율 통계 통계 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.09 + */ + @ResponseBody + @RequestMapping(value="/potl/getSrStsfdgRate.do") + public LinkedHashMap getSrStsfdgRate( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getSrStsfdgRate.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSrStsfdgRate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + resBody.put("resultList" , resultList ); + + log.info("<<<<<<<<<<<<<<< /potl/getSrStsfdgRate.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 만족율 통계 포틀릿 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.10 + */ + @RequestMapping(value = "/potl/getReportStsfdgRatePage.do") + public String getReportStsfdgRatePage( HttpServletRequest request + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getReportStsfdgRatePage.do <<<<<<<<<<<<<<<"); + + PrsnlPortletManageVO prsnlPortletManageVO = new PrsnlPortletManageVO(); + + prsnlPortletManageVO.setPrsnlId((String) commandMap.get("prsnlId")); + + // Body Setting Start --------------------------------- + Map bodyMap2 = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + // RestApi Call Start --------------------------------- + Map returnMap2 = restApiCallUtil.RestApiCall(bodyMap2, "/potl/selectPotlSize.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultList2 = (Map)returnMap2.get("resultList"); + // Return Data Setting End -------------------------- + + int potlWidth= (int) resultList2.get("portletWidth"); + int potlHeight= (int) resultList2.get("portletHeight"); + + String potlId=(String) commandMap.get("prsnlId"); + + model.addAttribute("potlId", potlId); + model.addAttribute("potlWidth" , potlWidth); + model.addAttribute("potlHeight", potlHeight); + + model.addAttribute("dtCurMonth" , CommonUtil.getKST("yyyy-MM")); // 조회일시 + + log.info("<<<<<<<<<<<<<<< /potl/getReportStsfdgRatePage.do >>>>>>>>>>>>>>>"); + + return "/itms/pot/MyReportStsfdgRate"; + } + + /** + * SR 만족율 통계 통계 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.12.09 + */ + @ResponseBody + @RequestMapping(value="/potl/getReportStsfdgRate.do") + public LinkedHashMap getReportStsfdgRate( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /potl/getReportStsfdgRate.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("strSearchMon" , (String)requestMap.get("strSearchMon")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportStsfdgRate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + resBody.put("resultList" , resultList ); + + log.info("<<<<<<<<<<<<<<< /potl/getReportStsfdgRate.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminCategoryController.java b/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminCategoryController.java index 9454051a..f3445ac6 100644 --- a/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminCategoryController.java +++ b/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminCategoryController.java @@ -1,272 +1,272 @@ -package com.urpsys.itmsfront.rem.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovDateUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.rem.domain.AdminCategoryManage; -import com.urpsys.itmsfront.rem.domain.ResourceManage; - -import lombok.extern.slf4j.Slf4j; - -/** - * 자산분류 관련 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.03.05 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.03.05   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class AdminCategoryController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 자산분류 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.05 - */ - @RequestMapping("/rem/searchAdminCategory.do") - public String searchAdminService( @ModelAttribute("adminCategoryManage") AdminCategoryManage adminCategoryManage - , HttpServletRequest request - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/searchAdminCategory.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(adminCategoryManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminCategory.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - model.addAttribute("resultList" , resultList); - - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - // 자산분류코드 추출 End -------------------- // - - if(adminCategoryManage.getInCate1()!=null && !adminCategoryManage.getInCate1().equals("")) - { - bodyMap.put("inCate1", adminCategoryManage.getInCate1()); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); - List> resultCate2 = (List>)returnMap.get("resultCate2"); - - model.addAttribute("resultCate2", resultCate2); // 자산중분류 - } - - log.info("<<<<<<<<<<<<<<< /rem/searchAdminCategory.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/AdminCategoryList"; - } - - /** - * 자산 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.03 - */ - @RequestMapping(value = "/rem/insertViewCategory.do") - public String insertViewCategory( HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertViewCategory.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - - bodyMap.put("inCate1", "1"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); - List> resultCate2 = (List>)returnMap.get("resultCate2"); - // 자산분류코드 추출 End -------------------- // - - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - model.addAttribute("resultCate2", resultCate2); // 자산중분류 - - log.info("<<<<<<<<<<<<<<< /rem/insertViewCategory.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/rem/PopCategoryRegist"; - } - - - /** - * 자산 소분류 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @ResponseBody - @RequestMapping(value="/rem/regAssetCategory.do") - public LinkedHashMap regAssetCategory( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/regAssetCategory.do <<<<<<<<<<<<<<<"); - log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - LinkedHashMap resBody = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = requestMap; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/regAssetCategory.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/insertMultiResource.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 소분류 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @ResponseBody - @RequestMapping(value="/rem/editAssetCategory.do") - public LinkedHashMap editAssetCategory( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/editAssetCategory.do <<<<<<<<<<<<<<<"); - log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - LinkedHashMap resBody = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = requestMap; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/editAssetCategory.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/editAssetCategory.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 소분류 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @ResponseBody - @RequestMapping(value="/rem/deleteCategory.do") - public LinkedHashMap deleteCategory( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/deleteCategory.do <<<<<<<<<<<<<<<"); - log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - LinkedHashMap resBody = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = requestMap; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteCategory.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/deleteCategory.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - -} +package com.urpsys.itmsfront.rem.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovDateUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.rem.domain.AdminCategoryManage; +import com.urpsys.itmsfront.rem.domain.ResourceManage; + +import lombok.extern.slf4j.Slf4j; + +/** + * 자산분류 관련 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.03.05 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.03.05   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class AdminCategoryController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 자산분류 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.05 + */ + @RequestMapping("/rem/searchAdminCategory.do") + public String searchAdminService( @ModelAttribute("adminCategoryManage") AdminCategoryManage adminCategoryManage + , HttpServletRequest request + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/searchAdminCategory.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(adminCategoryManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminCategory.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + model.addAttribute("resultList" , resultList); + + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + // 자산분류코드 추출 End -------------------- // + + if(adminCategoryManage.getInCate1()!=null && !adminCategoryManage.getInCate1().equals("")) + { + bodyMap.put("inCate1", adminCategoryManage.getInCate1()); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); + List> resultCate2 = (List>)returnMap.get("resultCate2"); + + model.addAttribute("resultCate2", resultCate2); // 자산중분류 + } + + log.info("<<<<<<<<<<<<<<< /rem/searchAdminCategory.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/AdminCategoryList"; + } + + /** + * 자산 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.03 + */ + @RequestMapping(value = "/rem/insertViewCategory.do") + public String insertViewCategory( HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertViewCategory.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + + bodyMap.put("inCate1", "1"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); + List> resultCate2 = (List>)returnMap.get("resultCate2"); + // 자산분류코드 추출 End -------------------- // + + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + model.addAttribute("resultCate2", resultCate2); // 자산중분류 + + log.info("<<<<<<<<<<<<<<< /rem/insertViewCategory.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/rem/PopCategoryRegist"; + } + + + /** + * 자산 소분류 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @ResponseBody + @RequestMapping(value="/rem/regAssetCategory.do") + public LinkedHashMap regAssetCategory( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/regAssetCategory.do <<<<<<<<<<<<<<<"); + log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + LinkedHashMap resBody = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = requestMap; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/regAssetCategory.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/insertMultiResource.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 소분류 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @ResponseBody + @RequestMapping(value="/rem/editAssetCategory.do") + public LinkedHashMap editAssetCategory( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/editAssetCategory.do <<<<<<<<<<<<<<<"); + log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + LinkedHashMap resBody = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = requestMap; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/editAssetCategory.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/editAssetCategory.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 소분류 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @ResponseBody + @RequestMapping(value="/rem/deleteCategory.do") + public LinkedHashMap deleteCategory( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/deleteCategory.do <<<<<<<<<<<<<<<"); + log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + LinkedHashMap resBody = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = requestMap; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteCategory.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/deleteCategory.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminServiceController.java b/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminServiceController.java index de79e402..9cfccf36 100644 --- a/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminServiceController.java +++ b/front/src/main/java/com/urpsys/itmsfront/rem/controller/AdminServiceController.java @@ -1,389 +1,389 @@ -package com.urpsys.itmsfront.rem.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovDateUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.rem.domain.AdminServiceManage; -import com.urpsys.itmsfront.rem.domain.AdminServiceVo; -import com.urpsys.itmsfront.rem.domain.AssetVo; -import com.urpsys.itmsfront.rem.domain.ResourceManage; - - -import lombok.extern.slf4j.Slf4j; - -/** - * 서비스템플릿 관련 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.02.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.06   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class AdminServiceController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 서비스 템플릿 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.06 - */ - @RequestMapping("/rem/searchAdminService.do") - public String searchAdminService( @ModelAttribute("adminServiceManage") AdminServiceManage adminServiceManage - , ModelMap model - , HttpServletRequest request) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/searchAdminService.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (adminServiceManage.getPageIndex()); - paginationInfo.setRecordCountPerPage(adminServiceManage.getPageUnit()); - paginationInfo.setPageSize (adminServiceManage.getPageSize()); - - adminServiceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); - adminServiceManage.setLastIndex(paginationInfo.getLastRecordIndex()); - adminServiceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(adminServiceManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminService.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - - log.info("<<<<<<<<<<<<<<< /rem/searchAdminService.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/AdminServiceList"; - } - - /** - * 서비스 정보 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.06 - */ - @RequestMapping(value = "/rem/getServiceBySeq.do") - public String getServiceBySeq( @ModelAttribute("adminServiceManage") AdminServiceManage adminServiceManage - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getServiceBySeq.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - //** 자산상세조회 Start -------------------- // - // 자산 상세조회 - int iInServiceCode = adminServiceManage.getInServiceCode(); - - // Body Setting Start --------------------------------- - bodyMap.put("inServiceCode", iInServiceCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getServiceBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultService = (Map)returnMap.get("resultService"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - // RestApi Call End --------------------------------- - //** 자산상세조회 End -------------------- // - - // 양식 복호화처리 - String strTxDefaultForm = (String)resultService.get("txDefaultForm"); - String strTxDefaultFormDec = CommonUtil.base64decode(strTxDefaultForm); - - resultService.put("txDefaultForm", strTxDefaultFormDec); - - model.addAttribute("resultService" , resultService ); - model.addAttribute("resultApprovals", resultApprovals ); - - log.info("<<<<<<<<<<<<<<< /rem/getServiceBySeq.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/AdminServiceDetail"; - } - - - /** - * 서비스 템플릿 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.06 - */ - @RequestMapping(value = "/rem/insertViewService.do") - public String insertViewService( @ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertViewService.do <<<<<<<<<<<<<<<"); - - log.info("<<<<<<<<<<<<<<< /rem/insertViewService.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/AdminServiceInsert"; - } - - /** - * 서비스 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.03 - */ - @ResponseBody - @RequestMapping(value="/rem/addForm.do") - public LinkedHashMap addForm( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/addForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=1; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - - // 양식 암호화처리 - String strTxDefaultForm = adminServiceVo.getTxDefaultForm(); - String strTxDefaultFormEnc = CommonUtil.base64encode(strTxDefaultForm); - - log.info("strTxDefaultForm [{}]", strTxDefaultForm); - log.info("strTxDefaultFormEnc [{}]", strTxDefaultFormEnc); - - adminServiceVo.setTxDefaultForm(strTxDefaultFormEnc); - - // Body Setting Start --------------------------------- - // bodyMap.put("fileList" , fileList); - bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); - bodyMap.put("approvalsList" , approvalsList); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/addForm.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 서비스 변경 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.07 - */ - @ResponseBody - @RequestMapping(value="/rem/updateForm.do") - public LinkedHashMap updateForm( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/updateForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq = 1; - for(int i=0; i mapApp = new LinkedHashMap(); - - if(srApprovalsId[i] ==null || srApprovalsId[i].equals("")) continue; - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - - // 양식 암호화처리 - String strTxDefaultForm = adminServiceVo.getTxDefaultForm(); - String strTxDefaultFormEnc = CommonUtil.base64encode(strTxDefaultForm); - - log.info("strTxDefaultForm [{}]", strTxDefaultForm); - log.info("strTxDefaultFormEnc [{}]", strTxDefaultFormEnc); - - adminServiceVo.setTxDefaultForm(strTxDefaultFormEnc); - - // Body Setting Start --------------------------------- - // bodyMap.put("fileList" , fileList); - bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); - bodyMap.put("approvalsList" , approvalsList); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateForm.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 서비스 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.07 - */ - @ResponseBody - @RequestMapping(value="/rem/serviceDelete.do") - public LinkedHashMap serviceDelete( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/updateForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - - // Body Setting Start --------------------------------- - // bodyMap.put("fileList" , fileList); - bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/serviceDelete.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - - - - - - - - -} +package com.urpsys.itmsfront.rem.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovDateUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.rem.domain.AdminServiceManage; +import com.urpsys.itmsfront.rem.domain.AdminServiceVo; +import com.urpsys.itmsfront.rem.domain.AssetVo; +import com.urpsys.itmsfront.rem.domain.ResourceManage; + + +import lombok.extern.slf4j.Slf4j; + +/** + * 서비스템플릿 관련 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.02.06 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.06   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class AdminServiceController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 서비스 템플릿 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.06 + */ + @RequestMapping("/rem/searchAdminService.do") + public String searchAdminService( @ModelAttribute("adminServiceManage") AdminServiceManage adminServiceManage + , ModelMap model + , HttpServletRequest request) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/searchAdminService.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (adminServiceManage.getPageIndex()); + paginationInfo.setRecordCountPerPage(adminServiceManage.getPageUnit()); + paginationInfo.setPageSize (adminServiceManage.getPageSize()); + + adminServiceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); + adminServiceManage.setLastIndex(paginationInfo.getLastRecordIndex()); + adminServiceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(adminServiceManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminService.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + + log.info("<<<<<<<<<<<<<<< /rem/searchAdminService.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/AdminServiceList"; + } + + /** + * 서비스 정보 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.06 + */ + @RequestMapping(value = "/rem/getServiceBySeq.do") + public String getServiceBySeq( @ModelAttribute("adminServiceManage") AdminServiceManage adminServiceManage + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getServiceBySeq.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + //** 자산상세조회 Start -------------------- // + // 자산 상세조회 + int iInServiceCode = adminServiceManage.getInServiceCode(); + + // Body Setting Start --------------------------------- + bodyMap.put("inServiceCode", iInServiceCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getServiceBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultService = (Map)returnMap.get("resultService"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + // RestApi Call End --------------------------------- + //** 자산상세조회 End -------------------- // + + // 양식 복호화처리 + String strTxDefaultForm = (String)resultService.get("txDefaultForm"); + String strTxDefaultFormDec = CommonUtil.base64decode(strTxDefaultForm); + + resultService.put("txDefaultForm", strTxDefaultFormDec); + + model.addAttribute("resultService" , resultService ); + model.addAttribute("resultApprovals", resultApprovals ); + + log.info("<<<<<<<<<<<<<<< /rem/getServiceBySeq.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/AdminServiceDetail"; + } + + + /** + * 서비스 템플릿 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.06 + */ + @RequestMapping(value = "/rem/insertViewService.do") + public String insertViewService( @ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertViewService.do <<<<<<<<<<<<<<<"); + + log.info("<<<<<<<<<<<<<<< /rem/insertViewService.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/AdminServiceInsert"; + } + + /** + * 서비스 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.03 + */ + @ResponseBody + @RequestMapping(value="/rem/addForm.do") + public LinkedHashMap addForm( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/addForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=1; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + + // 양식 암호화처리 + String strTxDefaultForm = adminServiceVo.getTxDefaultForm(); + String strTxDefaultFormEnc = CommonUtil.base64encode(strTxDefaultForm); + + log.info("strTxDefaultForm [{}]", strTxDefaultForm); + log.info("strTxDefaultFormEnc [{}]", strTxDefaultFormEnc); + + adminServiceVo.setTxDefaultForm(strTxDefaultFormEnc); + + // Body Setting Start --------------------------------- + // bodyMap.put("fileList" , fileList); + bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); + bodyMap.put("approvalsList" , approvalsList); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/addForm.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 서비스 변경 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.07 + */ + @ResponseBody + @RequestMapping(value="/rem/updateForm.do") + public LinkedHashMap updateForm( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/updateForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq = 1; + for(int i=0; i mapApp = new LinkedHashMap(); + + if(srApprovalsId[i] ==null || srApprovalsId[i].equals("")) continue; + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + + // 양식 암호화처리 + String strTxDefaultForm = adminServiceVo.getTxDefaultForm(); + String strTxDefaultFormEnc = CommonUtil.base64encode(strTxDefaultForm); + + log.info("strTxDefaultForm [{}]", strTxDefaultForm); + log.info("strTxDefaultFormEnc [{}]", strTxDefaultFormEnc); + + adminServiceVo.setTxDefaultForm(strTxDefaultFormEnc); + + // Body Setting Start --------------------------------- + // bodyMap.put("fileList" , fileList); + bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); + bodyMap.put("approvalsList" , approvalsList); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateForm.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 서비스 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.07 + */ + @ResponseBody + @RequestMapping(value="/rem/serviceDelete.do") + public LinkedHashMap serviceDelete( final @ModelAttribute("adminServiceVo") AdminServiceVo adminServiceVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/updateForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + + // Body Setting Start --------------------------------- + // bodyMap.put("fileList" , fileList); + bodyMap.put("adminServiceVo" , ConvertUtils.convertToMapAll(adminServiceVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/serviceDelete.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ReportController.java b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ReportController.java index 4db0d994..c60524f3 100644 --- a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ReportController.java +++ b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ReportController.java @@ -1,343 +1,343 @@ -package com.urpsys.itmsfront.rem.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.domain.ComDefaultVO; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.rem.domain.ReportVo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 보고서 양식 관련 컨트롤러 클래스 (게시판생성관리-enterprise) - * @author urp 인프라본부 나혁제 - * @since 2025.02.08 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.08   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ReportController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 보고서 약식 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @RequestMapping("/rem/getReportForms.do") - public String getReportForms( @ModelAttribute("searchVO") ComDefaultVO searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getReportForms.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getReportForms.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - // 공통 코드 추출 Start ------ // - // 보고서 양식 - Map codeMap = commonService.GetCodeList("SM_002"); - model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 - // 공통 코드 추출 End ------ // - - log.info("<<<<<<<<<<<<<<< /rem/getReportForms.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ReportList"; - } - - /** - * 보고서 양식 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @RequestMapping(value = "/rem/insertViewReport.do") - public String insertViewReport( @ModelAttribute("searchVO") ComDefaultVO searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertViewReport.do <<<<<<<<<<<<<<<"); - - // 공통 코드 추출 Start ------ // - // 보고서 양식 - Map codeMap = commonService.GetCodeList("SM_002"); - model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 - // 공통 코드 추출 End ------ // - - log.info("<<<<<<<<<<<<<<< /rem/insertViewReport.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ReportInsert"; - } - - /** - * 보고서 양식 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @RequestMapping(value = "/rem/getReportFormDetail.do") - public String getReportFormDetail( @ModelAttribute("searchVO") ComDefaultVO searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getReportFormDetail.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportForm = CommonUtil.zeroConvert(request.getParameter("inReportForm")); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportForm", inReportForm); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getReportFormDetail.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReport = (Map)returnMap.get("resultReport"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - String strTxReportForm = (String)resultReport.get("txReportForm"); - String strTxReportFormDec = CommonUtil.base64decode(strTxReportForm); - - resultReport.put("txReportForm", strTxReportFormDec); - - model.addAttribute("resultReport" , resultReport ); - - // 공통 코드 추출 Start ------ // - // 보고서 양식 - Map codeMap = commonService.GetCodeList("SM_002"); - model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 - // 공통 코드 추출 End ------ // - - log.info("<<<<<<<<<<<<<<< /rem/getReportFormDetail.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ReportDetail"; - } - - - /** - * 보고서 양식 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @ResponseBody - @RequestMapping(value="/rem/addReportForm.do") - public LinkedHashMap addForm( final @ModelAttribute("reportVo") ReportVo reportVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/addReportForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strTxReportForm = reportVo.getTxReportForm(); - String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); - - reportVo.setTxReportForm(strTxReportFormEnc); - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/addReportForm.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 양식 변경 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @ResponseBody - @RequestMapping(value="/rem/updateReportForm.do") - public LinkedHashMap updateReportForm( final @ModelAttribute("reportVo") ReportVo reportVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/updateReportForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strTxReportForm = reportVo.getTxReportForm(); - String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); - - reportVo.setTxReportForm(strTxReportFormEnc); - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateReportForm.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/updateReportForm.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 보고서 양식 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - @ResponseBody - @RequestMapping(value="/rem/deleteReportForm.do") - public LinkedHashMap deleteReportForm( final @ModelAttribute("reportVo") ReportVo reportVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/deleteReportForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strTxReportForm = reportVo.getTxReportForm(); - String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); - - reportVo.setTxReportForm(strTxReportFormEnc); - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteReportForm.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/deleteReportForm.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - - - - - - - - - - - -} +package com.urpsys.itmsfront.rem.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.domain.ComDefaultVO; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.rem.domain.ReportVo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 보고서 양식 관련 컨트롤러 클래스 (게시판생성관리-enterprise) + * @author urp 인프라본부 나혁제 + * @since 2025.02.08 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.08   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ReportController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 보고서 약식 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @RequestMapping("/rem/getReportForms.do") + public String getReportForms( @ModelAttribute("searchVO") ComDefaultVO searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getReportForms.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getReportForms.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + // 공통 코드 추출 Start ------ // + // 보고서 양식 + Map codeMap = commonService.GetCodeList("SM_002"); + model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 + // 공통 코드 추출 End ------ // + + log.info("<<<<<<<<<<<<<<< /rem/getReportForms.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ReportList"; + } + + /** + * 보고서 양식 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @RequestMapping(value = "/rem/insertViewReport.do") + public String insertViewReport( @ModelAttribute("searchVO") ComDefaultVO searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertViewReport.do <<<<<<<<<<<<<<<"); + + // 공통 코드 추출 Start ------ // + // 보고서 양식 + Map codeMap = commonService.GetCodeList("SM_002"); + model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 + // 공통 코드 추출 End ------ // + + log.info("<<<<<<<<<<<<<<< /rem/insertViewReport.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ReportInsert"; + } + + /** + * 보고서 양식 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @RequestMapping(value = "/rem/getReportFormDetail.do") + public String getReportFormDetail( @ModelAttribute("searchVO") ComDefaultVO searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getReportFormDetail.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportForm = CommonUtil.zeroConvert(request.getParameter("inReportForm")); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportForm", inReportForm); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getReportFormDetail.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReport = (Map)returnMap.get("resultReport"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + String strTxReportForm = (String)resultReport.get("txReportForm"); + String strTxReportFormDec = CommonUtil.base64decode(strTxReportForm); + + resultReport.put("txReportForm", strTxReportFormDec); + + model.addAttribute("resultReport" , resultReport ); + + // 공통 코드 추출 Start ------ // + // 보고서 양식 + Map codeMap = commonService.GetCodeList("SM_002"); + model.addAttribute("SM_002_result", codeMap.get("SM_002_result")); // 보고서 양식 + // 공통 코드 추출 End ------ // + + log.info("<<<<<<<<<<<<<<< /rem/getReportFormDetail.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ReportDetail"; + } + + + /** + * 보고서 양식 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @ResponseBody + @RequestMapping(value="/rem/addReportForm.do") + public LinkedHashMap addForm( final @ModelAttribute("reportVo") ReportVo reportVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/addReportForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strTxReportForm = reportVo.getTxReportForm(); + String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); + + reportVo.setTxReportForm(strTxReportFormEnc); + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/addReportForm.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/addForm.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 양식 변경 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @ResponseBody + @RequestMapping(value="/rem/updateReportForm.do") + public LinkedHashMap updateReportForm( final @ModelAttribute("reportVo") ReportVo reportVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/updateReportForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strTxReportForm = reportVo.getTxReportForm(); + String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); + + reportVo.setTxReportForm(strTxReportFormEnc); + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateReportForm.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/updateReportForm.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 보고서 양식 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + @ResponseBody + @RequestMapping(value="/rem/deleteReportForm.do") + public LinkedHashMap deleteReportForm( final @ModelAttribute("reportVo") ReportVo reportVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/deleteReportForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strTxReportForm = reportVo.getTxReportForm(); + String strTxReportFormEnc = CommonUtil.base64encode(strTxReportForm); + + reportVo.setTxReportForm(strTxReportFormEnc); + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteReportForm.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/deleteReportForm.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceManagerController.java b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceManagerController.java index 0918b938..12a56d11 100644 --- a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceManagerController.java +++ b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceManagerController.java @@ -1,1167 +1,1167 @@ -package com.urpsys.itmsfront.rem.controller; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.util.FileCopyUtils; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.support.SessionStatus; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovBrowserUtil; -import com.urpsys.basefront.common.egov.util.EgovDateUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.egov.util.EgovWebUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.domain.ComDefaultVO; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.bbs.domain.BoardMaster; -import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.rem.domain.AssetVo; -import com.urpsys.itmsfront.rem.domain.InResourceManage; -import com.urpsys.itmsfront.rem.domain.ResourceManage; - -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; - - -import lombok.extern.slf4j.Slf4j; - -/** - * 장비관련 컨트롤러 클래스 (게시판생성관리-enterprise) - * @author urp 인프라본부 나혁제 - * @since 2025.01.31 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.31   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ResourceManagerController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - // 2025.08.29 나혁제 환경정보 추출 - @Autowired - private Environment env; - - @Value("${custom.file_store}") - private String storePathString; // 파일저장 물리적주소 - - @Value("${custom.client}") - private String strClient; // 납품고객 - - /** - * 자산 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.31 - */ - @RequestMapping("/rem/SelectResource.do") - public String SelectResource( @ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model - , HttpServletRequest request) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/SelectResource.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); - paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); - paginationInfo.setPageSize (resourceManage.getPageSize()); - - resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); - resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); - resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - String strCurDate = EgovDateUtil.getToday(); - - // 2025.12.03 나혁제 eos 일자는 kintex 인경우만 반영 - if(strClient.equals("kintex")) - { - if(resourceManage.getSdateEos() == null || resourceManage.getSdateEos().equals("")) - { - resourceManage.setSdateEos(EgovDateUtil.formatDate(EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, -12), "-"), "-")); - } - - if(resourceManage.getEdateEos() == null || resourceManage.getEdateEos().equals("")) - { - resourceManage.setEdateEos(EgovDateUtil.formatDate("2999-12-31", "-")); - } - } - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(resourceManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAsset.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); - - model.addAttribute("resourceList" , resourceList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - // 자산분류코드 추출 End -------------------- // - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("SM_001"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_SM_001"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 - // 공통코드 추출 End -------------------- // - - // 2025.12.03 나혁제 납품고객 반영 - model.addAttribute("strClient", strClient); // 납품고객 - - - log.info("<<<<<<<<<<<<<<< /rem/SelectResource.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ResourceList"; - } - - /** - * 자산정보 목록 엑셀 저장 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.31 - */ - @RequestMapping("/rem/SelectResourceExecl.do") - public void SelectResourceExCel( @ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/SelectResourceExecl.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(resourceManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAssetExcel.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - String strFileNm = "assetExcelSave"+CommonUtil.getKST("yyyyMMddHHmmss")+".xlsx"; - - String filePath = storePathString + "/" +strFileNm; - Workbook workbook = new XSSFWorkbook(); - Sheet sheet = workbook.createSheet("자산"); - - // 헤더 생성 - Row headerRow = sheet.createRow(0); - - headerRow.createCell(0 ).setCellValue("자산번호"); - headerRow.createCell(1 ).setCellValue("대분류"); - headerRow.createCell(2 ).setCellValue("중분류"); - headerRow.createCell(3 ).setCellValue("소분류"); - headerRow.createCell(4 ).setCellValue("자산명"); - headerRow.createCell(5 ).setCellValue("도입일자"); - headerRow.createCell(6 ).setCellValue("제조사"); - headerRow.createCell(7 ).setCellValue("제품명"); - headerRow.createCell(8 ).setCellValue("도입가격"); - headerRow.createCell(9 ).setCellValue("자산상태"); - headerRow.createCell(10).setCellValue("유지보수여부"); - headerRow.createCell(11).setCellValue("유지보수요율"); - headerRow.createCell(12).setCellValue("유지보수점검주기"); - headerRow.createCell(13).setCellValue("유지보수시작일"); - headerRow.createCell(14).setCellValue("유지보수종료일"); - headerRow.createCell(15).setCellValue("버전"); - headerRow.createCell(16).setCellValue("시리얼"); - headerRow.createCell(17).setCellValue("호스트명"); - headerRow.createCell(18).setCellValue("EOS일"); - headerRow.createCell(19).setCellValue("용도"); - headerRow.createCell(20).setCellValue("비고"); - headerRow.createCell(21).setCellValue("IP"); - headerRow.createCell(22).setCellValue("CPU"); - headerRow.createCell(23).setCellValue("DISK"); - headerRow.createCell(24).setCellValue("MEM"); - headerRow.createCell(25).setCellValue("점검대상여부"); - headerRow.createCell(26).setCellValue("업무명"); - headerRow.createCell(27).setCellValue("무상유지보수시작일자"); - headerRow.createCell(28).setCellValue("무상유지보수종료일자"); - headerRow.createCell(29).setCellValue("라이센스종류"); - headerRow.createCell(30).setCellValue("라이센스종료일자"); - headerRow.createCell(31).setCellValue("EOL일자"); - headerRow.createCell(32).setCellValue("포트정보"); - headerRow.createCell(33).setCellValue("실사용자"); - - - // 데이터 입력 - int rowNum = 1; - for(Map vo: resultList ) - { - Row row = sheet.createRow(rowNum++); - - row.createCell(0 ).setCellValue(vo.get("vcAssetId" )==null ? "" : (String)vo.get("vcAssetId" )); - row.createCell(1 ).setCellValue(vo.get("vcCate1" )==null ? "" : (String)vo.get("vcCate1" )); - row.createCell(2 ).setCellValue(vo.get("vcCate2" )==null ? "" : (String)vo.get("vcCate2" )); - row.createCell(3 ).setCellValue(vo.get("vcCate3" )==null ? "" : (String)vo.get("vcCate3" )); - row.createCell(4 ).setCellValue(vo.get("vcAssetName" )==null ? "" : (String)vo.get("vcAssetName" )); - row.createCell(5 ).setCellValue(vo.get("dtPurchaseDatetime" )==null ? "" : (String)vo.get("dtPurchaseDatetime" )); - row.createCell(6 ).setCellValue(vo.get("vcVendor" )==null ? "" : (String)vo.get("vcVendor" )); - row.createCell(7 ).setCellValue(vo.get("vcModel" )==null ? "" : (String)vo.get("vcModel" )); - row.createCell(8 ).setCellValue(vo.get("inPrice" )==null ? 0 : (int)vo.get("inPrice" )); - row.createCell(9 ).setCellValue(vo.get("inAssetStatus" )==null ? "" : (String)vo.get("inAssetStatus" )); - row.createCell(10).setCellValue(vo.get("inMasTarget" )==null ? "" : (String)vo.get("inMasTarget" )); - row.createCell(11).setCellValue(vo.get("inMasRate" )==null ? 0 : (int)vo.get("inMasRate" )); - row.createCell(12).setCellValue(vo.get("vcMasCheckPeriod" )==null ? "" : (String)vo.get("vcMasCheckPeriod" )); - row.createCell(13).setCellValue(vo.get("dtMasStart" )==null ? "" : (String)vo.get("dtMasStart" )); - row.createCell(14).setCellValue(vo.get("dtMasFinish" )==null ? "" : (String)vo.get("dtMasFinish" )); - row.createCell(15).setCellValue(vo.get("vcVersion" )==null ? "" : (String)vo.get("vcVersion" )); - row.createCell(16).setCellValue(vo.get("vcAssetSerial" )==null ? "" : (String)vo.get("vcAssetSerial" )); - row.createCell(17).setCellValue(vo.get("vcHost" )==null ? "" : (String)vo.get("vcHost" )); - row.createCell(18).setCellValue(vo.get("dtEos" )==null ? "" : (String)vo.get("dtEos" )); - row.createCell(19).setCellValue(vo.get("txUsage" )==null ? "" : (String)vo.get("txUsage" )); - row.createCell(20).setCellValue(vo.get("txAssetDesc" )==null ? "" : (String)vo.get("txAssetDesc" )); - row.createCell(21).setCellValue(vo.get("vcIp" )==null ? "" : (String)vo.get("vcIp" )); - row.createCell(22).setCellValue(vo.get("vcDtlCpu" )==null ? "" : (String)vo.get("vcDtlCpu" )); - row.createCell(23).setCellValue(vo.get("vcDtlDisk" )==null ? "" : (String)vo.get("vcDtlDisk" )); - row.createCell(24).setCellValue(vo.get("vcDtlMem" )==null ? "" : (String)vo.get("vcDtlMem" )); - row.createCell(25).setCellValue(vo.get("vcChkTrgYn" )==null ? "" : (String)vo.get("vcChkTrgYn" )); - row.createCell(26).setCellValue(vo.get("vcTaskNm" )==null ? "" : (String)vo.get("vcTaskNm" )); - row.createCell(27).setCellValue(vo.get("vcNrwdMicnStrtDt" )==null ? "" : (String)vo.get("vcNrwdMicnStrtDt" )); - row.createCell(28).setCellValue(vo.get("vcNrwdMicnEndDt" )==null ? "" : (String)vo.get("vcNrwdMicnEndDt" )); - row.createCell(29).setCellValue(vo.get("vcLLicenseKnd" )==null ? "" : (String)vo.get("vcLLicenseKnd" )); - row.createCell(30).setCellValue(vo.get("dtLLicenseEnd" )==null ? "" : (String)vo.get("dtLLicenseEnd" )); - row.createCell(31).setCellValue(vo.get("dtEol" )==null ? "" : (String)vo.get("dtEol" )); - row.createCell(32).setCellValue(vo.get("inPortInfo" )==null ? 0 : (int)vo.get("inPortInfo" )); - row.createCell(33).setCellValue(vo.get("vcRealChargrNm" )==null ? "" : (String)vo.get("vcRealChargrNm" )); - - /* - row.createCell(0 ).setCellValue((String)vo.get("vcAssetId" )); - row.createCell(1 ).setCellValue((String)vo.get("vcCate1" )); - row.createCell(3 ).setCellValue((String)vo.get("vcCate2" )); - row.createCell(4 ).setCellValue((String)vo.get("vcCate3" )); - row.createCell(5 ).setCellValue((String)vo.get("vcAssetName" )); - row.createCell(6 ).setCellValue((String)vo.get("dtPurchaseDatetime" ) ); - row.createCell(7 ).setCellValue((String)vo.get("vcVendor") ); - row.createCell(8 ).setCellValue((String)vo.get("vcModel") ); - row.createCell(9 ).setCellValue((int)vo.get("inPrice") ); - row.createCell(10).setCellValue((String)vo.get("inAssetStatus") ); - row.createCell(11).setCellValue((String)vo.get("inMasTarget") ); - row.createCell(12).setCellValue((int)vo.get("inMasRate") ); - row.createCell(13).setCellValue((String)vo.get("vcMasCheckPeriod") ); - row.createCell(14).setCellValue((String)vo.get("dtMasStart") ); - row.createCell(15).setCellValue((String)vo.get("dtMasFinish") ); - row.createCell(16).setCellValue((String)vo.get("vcVersion") ); - row.createCell(17).setCellValue((String)vo.get("vcAssetSerial") ); - row.createCell(18).setCellValue((String)vo.get("vcHost") ); - row.createCell(19).setCellValue((String)vo.get("dtEos") ); - row.createCell(20).setCellValue((String)vo.get("txUsage") ); - row.createCell(21).setCellValue((String)vo.get("txAssetDesc") ); - row.createCell(22).setCellValue((String)vo.get("vcIp") ); - row.createCell(23).setCellValue((String)vo.get("vcDtlCpu") ); - row.createCell(24).setCellValue((String)vo.get("vcDtlDisk") ); - row.createCell(25).setCellValue((String)vo.get("vcDtlMem") ); - row.createCell(26).setCellValue((String)vo.get("vcChkTrgYn") ); - row.createCell(27).setCellValue((String)vo.get("vcTaskNm") ); - row.createCell(28).setCellValue((String)vo.get("vcNrwdMicnStrtDt") ); - row.createCell(29).setCellValue((String)vo.get("vcNrwdMicnEndDt") ); - row.createCell(30).setCellValue((String)vo.get("vcLLicenseKnd") ); - row.createCell(31).setCellValue((String)vo.get("dtLLicenseEnd") ); - row.createCell(32).setCellValue((String)vo.get("dtEol") ); - row.createCell(33).setCellValue((String)vo.get("inPortInfo") ); - */ - } - - // 열 너비 자동 조정 - for (int i = 0; i < 4; i++) - { - sheet.autoSizeColumn(i); - } - - // 파일 저장 - try (FileOutputStream outputStream = new FileOutputStream(filePath)) - { - workbook.write(outputStream); - } - - // 파일 다운로드 - File uFile = new File(filePath); - - String mimetype = "application/x-msdownload"; - - String userAgent = request.getHeader("User-Agent"); - HashMap result = EgovBrowserUtil.getBrowser(userAgent); - - if (!EgovBrowserUtil.MSIE.equals(result.get(EgovBrowserUtil.TYPEKEY))) - { - mimetype = "application/x-stuff"; - } - - String contentDisposition = EgovBrowserUtil.getDisposition(strFileNm, userAgent, "UTF-8"); - response.setContentType(mimetype); - response.setHeader("Content-Disposition", contentDisposition); - - BufferedInputStream in = null; - BufferedOutputStream out = null; - - try - { - in = new BufferedInputStream(new FileInputStream(uFile)); - out = new BufferedOutputStream(response.getOutputStream()); - - FileCopyUtils.copy(in, out); - out.flush(); - } - catch (IOException ex) - { - ex.printStackTrace(); - } - finally - { - in.close(); - out.close(); - } - - log.info("<<<<<<<<<<<<<<< /rem/SelectResourceExecl.do >>>>>>>>>>>>>>>"); - } - - - /** - * 자산이력 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.31 - */ - @RequestMapping("/rem/SelectResourceHist.do") - public String SelectResourceHist( @ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model - , HttpServletRequest request) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/SelectResourceHist.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); - paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); - paginationInfo.setPageSize (resourceManage.getPageSize()); - - resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); - resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); - resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(resourceManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAssetHist.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - // List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); - - // model.addAttribute("resourceList" , resourceList); - model.addAttribute("resourceList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - - log.info("<<<<<<<<<<<<<<< /rem/SelectResourceHist.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/rem/ResourceHistListPopup"; - } - - - /** - * 자산 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.03 - */ - @RequestMapping(value = "/rem/insertViewResource.do") - public String insertViewDeptManage( @ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertViewResource.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - - bodyMap.put("inCate1", "1"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); - List> resultCate2 = (List>)returnMap.get("resultCate2"); - - bodyMap.put("inCate1", "1"); - bodyMap.put("inCate2", "1"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); - List> resultCate3 = (List>)returnMap.get("resultCate3"); - // 자산분류코드 추출 End -------------------- // - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("SM_001"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_SM_001"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - // 공통코드 추출 End -------------------- // - - - - // 기본날짜 세팅 addMonth - String strCurDate = EgovDateUtil.getToday(); - - String datePicker_dtPurchaseDatetime = EgovDateUtil.formatDate(strCurDate, "-"); - - String datePicker_dtMasStart = EgovDateUtil.formatDate(strCurDate, "-"); - String datePicker_dtMasFinish = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); - - // 2025.09.01 나혁제 무상유지보수기산 추가 - String dateNrwdMicnStrtDt = EgovDateUtil.formatDate(strCurDate, "-"); - String dateNrwdMicnEndDt = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); - - String datePicker_DT_EOS = EgovDateUtil.formatDate("2999-12-31", "-"); - - // 2025.09.01 나혁제 추가사항 - String dtLLicenseEnd = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); - String dtEol = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); - - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - model.addAttribute("resultCate2", resultCate2); // 자산중분류 - model.addAttribute("resultCate3", resultCate3); // 자산소분류 - - model.addAttribute("resourceManage", resourceManage); - - model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 - - model.addAttribute("dtPurchaseDatetime" , datePicker_dtPurchaseDatetime); - model.addAttribute("dtMasStart" , datePicker_dtMasStart); - model.addAttribute("dtMasFinish" , datePicker_dtMasFinish); - model.addAttribute("dtEos" , datePicker_DT_EOS); - model.addAttribute("dateNrwdMicnStrtDt" , dateNrwdMicnStrtDt); - model.addAttribute("dateNrwdMicnEndDt" , dateNrwdMicnEndDt); - model.addAttribute("dtLLicenseEnd" , dtLLicenseEnd); - model.addAttribute("dtEol" , dtEol); - - // 2025.12.03 나혁제 납품고객 반영 - model.addAttribute("strClient", strClient); // 납품고객 - - log.info("<<<<<<<<<<<<<<< /rem/insertViewResource.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ResourceInsert"; - } - - /** - * 자산 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.03 - */ - @ResponseBody - @RequestMapping(value="/rem/insertResource.do") - public LinkedHashMap insertResource( final MultipartHttpServletRequest multiRequest - , @ModelAttribute("AssetVo") AssetVo assetVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertResource.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - log.info(" inResourceManage TxUsage =>"+assetVo.getTxAssetDesc()); - - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "ASSET_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - assetVo.setAtchFileId(_atchFileId); - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO fileVo : _result) - { - log.info("file fileVo : {}", fileVo.toString()); - - Map fileMap = ConvertUtils.convertToMap(fileVo); - - /* - LinkedHashMap fileMap = new LinkedHashMap(); - - fileMap.put("size" , resultMap.getFileMg ()); - fileMap.put("vcFilePath" , resultMap.getFileStreCours()); - fileMap.put("vcOrgFileName" , resultMap.getOrignlFileNm ()); - fileMap.put("vcFileName" , resultMap.getStreFileNm ()); - */ - - fileList.add(fileMap); - } - } - - // 상위 자산이 존재하지 않은 경우 "0" 으로 세팅 - if(assetVo.getInParentSeq() == null || assetVo.getInParentSeq().equals("")) - { - assetVo.setInParentSeq("0"); - } - - // 뭔지 모르겠음 - if(assetVo.getInRemainPrice() == null || assetVo.getInRemainPrice().equals("")) - { - assetVo.setInRemainPrice("0"); - } - - // 뭔지 모르겠음 - if(assetVo.getInPhysical() == null || assetVo.getInPhysical().equals("")) - { - assetVo.setInPhysical("0"); - } - - // Body Setting Start --------------------------------- - // bodyMap.put("fileList" , fileList); - bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); - bodyMap.put("fileList" , fileList); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/insertResource.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , "0" ); - resBody.put("resultMsg" , "정상" ); - - log.info("<<<<<<<<<<<<<<< /rem/insertResource.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 자산 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.05 - */ - @ResponseBody - @RequestMapping(value="/rem/updateAsset.do") - public LinkedHashMap updateAsset( final MultipartHttpServletRequest multiRequest - , @ModelAttribute("AssetVo") AssetVo assetVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/updateAsset.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String _atchFileId = assetVo.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - log.info(" _atchFileId =>"+_atchFileId); - - if( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - List> fileList = new ArrayList(); - - if (_atchFileId==null || "".equals(_atchFileId) ) - { - _result = fileUtil.parseFileInf(files, "ASSET_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - assetVo.setAtchFileId(_atchFileId); - assetVo.setAtchFileInUpGb("I"); // 새로만들기 - - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "ASSET_", _cnt, _atchFileId, ""); - assetVo.setAtchFileInUpGb("U"); // 기존자료변경 - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - - bodyMap.put("fileList" , fileList); - } - - // 상위 자산이 존재하지 않은 경우 "0" 으로 세팅 - if(assetVo.getInParentSeq() == null || assetVo.getInParentSeq().equals("")) - { - assetVo.setInParentSeq("0"); - } - - // 뭔지 모르겠음 - if(assetVo.getInRemainPrice() == null || assetVo.getInRemainPrice().equals("")) - { - assetVo.setInRemainPrice("0"); - } - - // 뭔지 모르겠음 - if(assetVo.getInPhysical() == null || assetVo.getInPhysical().equals("")) - { - assetVo.setInPhysical("0"); - } - - // Body Setting Start --------------------------------- - // bodyMap.put("fileList" , fileList); - bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateAsset.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/updateAsset.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.05 - */ - @ResponseBody - @RequestMapping(value="/rem/deleteAsset.do") - public LinkedHashMap deleteAsset( final MultipartHttpServletRequest multiRequest - , @ModelAttribute("AssetVo") AssetVo assetVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/deleteAsset.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteAsset.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/deleteAsset.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 복수 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.05 - */ - @ResponseBody - @RequestMapping(value="/rem/deleteMultiAsset.do") - public LinkedHashMap deleteMultiAsset( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/deleteMultiAsset.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strInAssetSeqMulti = CommonUtil.nvl(request.getParameter("inAssetSeqMulti" )); - - log.info(" strInAssetSeqMulti [{}]", strInAssetSeqMulti); - - // Body Setting Start --------------------------------- - bodyMap.put("inAssetSeqMulti" , strInAssetSeqMulti); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteMultiAsset.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /rem/deleteMultiAsset.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - /** - * 자산 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.04 - */ - @RequestMapping(value = "/rem/getAssetInfo.do") - public String getAssetInfo( @ModelAttribute("resourceManage") ResourceManage resourceManage - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getAssetInfo.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - //** 자산상세조회 Start -------------------- // - // 자산 상세조회 - int iInAssetSeq = resourceManage.getInAssetSeq(); - - // Body Setting Start --------------------------------- - bodyMap.put("inAssetSeq", iInAssetSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getAssetInfo.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultAsset = (Map)returnMap.get("resultAsset" ); - List> resultAssetReport = (List>)returnMap.get("resultAssetReport"); - // RestApi Call End --------------------------------- - //** 자산상세조회 End -------------------- // - - //** 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - - bodyMap.put("inCate1", "1"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); - List> resultCate2 = (List>)returnMap.get("resultCate2"); - - bodyMap.put("inCate1", "1"); - bodyMap.put("inCate2", "1"); - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); - List> resultCate3 = (List>)returnMap.get("resultCate3"); - //** 자산분류코드 추출 End -------------------- // - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("SM_001"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_SM_001"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - // 공통코드 추출 End -------------------- // - - model.addAttribute("resultAsset" , resultAsset ); - model.addAttribute("resultAssetReport" , resultAssetReport); - - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - model.addAttribute("resultCate2", resultCate2); // 자산중분류 - model.addAttribute("resultCate3", resultCate3); // 자산소분류 - - model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 - - // 2025.12.03 나혁제 납품고객 반영 - model.addAttribute("strClient", strClient); // 납품고객 - - log.info("<<<<<<<<<<<<<<< /rem/getAssetInfo.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ResourceDetail"; - } - - - - - - - - - - - /** - * 자산 대분류 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.31 - */ - @ResponseBody - @RequestMapping(value="/rem/getCate1List.do") - public LinkedHashMap getCate1List( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getCate1List.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - bodyMap = requestMap; - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - resBody.put("resultCate1" , resultCate1 ); - - - - - log.info("<<<<<<<<<<<<<<< /rem/getCate1List.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 중분류 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.31 - */ - @ResponseBody - @RequestMapping(value="/rem/getCate2List.do") - public LinkedHashMap getCate2List( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getCate2List.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - bodyMap = requestMap; - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); - // RestApi Call End --------------------------------- - - List> resultCate2 = (List>)returnMap.get("resultCate2"); - resBody.put("resultCate2" , resultCate2 ); - - log.info("<<<<<<<<<<<<<<< /rem/getCate2List.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 소분류 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.31 - */ - @ResponseBody - @RequestMapping(value="/rem/getCate3List.do") - public LinkedHashMap getCate3List( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/getCate3List.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - bodyMap = requestMap; - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); - // RestApi Call End --------------------------------- - - List> resultCate3 = (List>)returnMap.get("resultCate3"); - resBody.put("resultCate3" , resultCate3 ); - - log.info("<<<<<<<<<<<<<<< /rem/getCate3List.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 자산 목록을 조회한다.(팝업) - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.17 - */ - @RequestMapping("/rem/SelectResourcePopup.do") - public String SelectResourcePopup(@ModelAttribute("resourceManage") ResourceManage resourceManage - , ModelMap model - , HttpServletRequest request) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/SelectResourcePopup.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); - paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); - paginationInfo.setPageSize (resourceManage.getPageSize()); - - resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); - resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); - resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(resourceManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAsset.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); - - model.addAttribute("resourceList" , resourceList); - model.addAttribute("paginationInfo" , paginationInfo); - - // 2025.09.22 나혁제 추가 --------------------// - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - model.addAttribute("resultCate1", resultCate1); // 자산대분류 - // 자산분류코드 추출 End -------------------- // - - - log.info("<<<<<<<<<<<<<<< /rem/SelectResourcePopup.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/rem/ResourceListPopup"; - } - - /** - * 자산번호 중복여부 확인 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.05 - */ - @ResponseBody - @RequestMapping(value = "/rem/checkAssetIdDup.do") - public LinkedHashMap checkAssetIdDup( @ModelAttribute("AssetVo") AssetVo assetVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/checkAssetIdDup.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("vcAssetId", assetVo.getVcAssetId()); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/checkAssetIdDup.do"); - // RestApi Call End --------------------------------- - - int iDup = (int)returnMap.get("result"); - - resBody.put("iDup" , iDup); - - log.info("<<<<<<<<<<<<<<< /rem/checkAssetIdDup.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - - -} +package com.urpsys.itmsfront.rem.controller; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.util.FileCopyUtils; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovBrowserUtil; +import com.urpsys.basefront.common.egov.util.EgovDateUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.egov.util.EgovWebUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.domain.ComDefaultVO; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.bbs.domain.BoardMaster; +import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.rem.domain.AssetVo; +import com.urpsys.itmsfront.rem.domain.InResourceManage; +import com.urpsys.itmsfront.rem.domain.ResourceManage; + +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + + +import lombok.extern.slf4j.Slf4j; + +/** + * 장비관련 컨트롤러 클래스 (게시판생성관리-enterprise) + * @author urp 인프라본부 나혁제 + * @since 2025.01.31 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.31   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ResourceManagerController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + // 2025.08.29 나혁제 환경정보 추출 + @Autowired + private Environment env; + + @Value("${custom.file_store}") + private String storePathString; // 파일저장 물리적주소 + + @Value("${custom.client}") + private String strClient; // 납품고객 + + /** + * 자산 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.31 + */ + @RequestMapping("/rem/SelectResource.do") + public String SelectResource( @ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model + , HttpServletRequest request) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/SelectResource.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); + paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); + paginationInfo.setPageSize (resourceManage.getPageSize()); + + resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); + resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); + resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + String strCurDate = EgovDateUtil.getToday(); + + // 2025.12.03 나혁제 eos 일자는 kintex 인경우만 반영 + if(strClient.equals("kintex")) + { + if(resourceManage.getSdateEos() == null || resourceManage.getSdateEos().equals("")) + { + resourceManage.setSdateEos(EgovDateUtil.formatDate(EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, -12), "-"), "-")); + } + + if(resourceManage.getEdateEos() == null || resourceManage.getEdateEos().equals("")) + { + resourceManage.setEdateEos(EgovDateUtil.formatDate("2999-12-31", "-")); + } + } + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(resourceManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAsset.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); + + model.addAttribute("resourceList" , resourceList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + // 자산분류코드 추출 End -------------------- // + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("SM_001"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_SM_001"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 + // 공통코드 추출 End -------------------- // + + // 2025.12.03 나혁제 납품고객 반영 + model.addAttribute("strClient", strClient); // 납품고객 + + + log.info("<<<<<<<<<<<<<<< /rem/SelectResource.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ResourceList"; + } + + /** + * 자산정보 목록 엑셀 저장 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.31 + */ + @RequestMapping("/rem/SelectResourceExecl.do") + public void SelectResourceExCel( @ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/SelectResourceExecl.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(resourceManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAssetExcel.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + String strFileNm = "assetExcelSave"+CommonUtil.getKST("yyyyMMddHHmmss")+".xlsx"; + + String filePath = storePathString + "/" +strFileNm; + Workbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet("자산"); + + // 헤더 생성 + Row headerRow = sheet.createRow(0); + + headerRow.createCell(0 ).setCellValue("자산번호"); + headerRow.createCell(1 ).setCellValue("대분류"); + headerRow.createCell(2 ).setCellValue("중분류"); + headerRow.createCell(3 ).setCellValue("소분류"); + headerRow.createCell(4 ).setCellValue("자산명"); + headerRow.createCell(5 ).setCellValue("도입일자"); + headerRow.createCell(6 ).setCellValue("제조사"); + headerRow.createCell(7 ).setCellValue("제품명"); + headerRow.createCell(8 ).setCellValue("도입가격"); + headerRow.createCell(9 ).setCellValue("자산상태"); + headerRow.createCell(10).setCellValue("유지보수여부"); + headerRow.createCell(11).setCellValue("유지보수요율"); + headerRow.createCell(12).setCellValue("유지보수점검주기"); + headerRow.createCell(13).setCellValue("유지보수시작일"); + headerRow.createCell(14).setCellValue("유지보수종료일"); + headerRow.createCell(15).setCellValue("버전"); + headerRow.createCell(16).setCellValue("시리얼"); + headerRow.createCell(17).setCellValue("호스트명"); + headerRow.createCell(18).setCellValue("EOS일"); + headerRow.createCell(19).setCellValue("용도"); + headerRow.createCell(20).setCellValue("비고"); + headerRow.createCell(21).setCellValue("IP"); + headerRow.createCell(22).setCellValue("CPU"); + headerRow.createCell(23).setCellValue("DISK"); + headerRow.createCell(24).setCellValue("MEM"); + headerRow.createCell(25).setCellValue("점검대상여부"); + headerRow.createCell(26).setCellValue("업무명"); + headerRow.createCell(27).setCellValue("무상유지보수시작일자"); + headerRow.createCell(28).setCellValue("무상유지보수종료일자"); + headerRow.createCell(29).setCellValue("라이센스종류"); + headerRow.createCell(30).setCellValue("라이센스종료일자"); + headerRow.createCell(31).setCellValue("EOL일자"); + headerRow.createCell(32).setCellValue("포트정보"); + headerRow.createCell(33).setCellValue("실사용자"); + + + // 데이터 입력 + int rowNum = 1; + for(Map vo: resultList ) + { + Row row = sheet.createRow(rowNum++); + + row.createCell(0 ).setCellValue(vo.get("vcAssetId" )==null ? "" : (String)vo.get("vcAssetId" )); + row.createCell(1 ).setCellValue(vo.get("vcCate1" )==null ? "" : (String)vo.get("vcCate1" )); + row.createCell(2 ).setCellValue(vo.get("vcCate2" )==null ? "" : (String)vo.get("vcCate2" )); + row.createCell(3 ).setCellValue(vo.get("vcCate3" )==null ? "" : (String)vo.get("vcCate3" )); + row.createCell(4 ).setCellValue(vo.get("vcAssetName" )==null ? "" : (String)vo.get("vcAssetName" )); + row.createCell(5 ).setCellValue(vo.get("dtPurchaseDatetime" )==null ? "" : (String)vo.get("dtPurchaseDatetime" )); + row.createCell(6 ).setCellValue(vo.get("vcVendor" )==null ? "" : (String)vo.get("vcVendor" )); + row.createCell(7 ).setCellValue(vo.get("vcModel" )==null ? "" : (String)vo.get("vcModel" )); + row.createCell(8 ).setCellValue(vo.get("inPrice" )==null ? 0 : (int)vo.get("inPrice" )); + row.createCell(9 ).setCellValue(vo.get("inAssetStatus" )==null ? "" : (String)vo.get("inAssetStatus" )); + row.createCell(10).setCellValue(vo.get("inMasTarget" )==null ? "" : (String)vo.get("inMasTarget" )); + row.createCell(11).setCellValue(vo.get("inMasRate" )==null ? 0 : (int)vo.get("inMasRate" )); + row.createCell(12).setCellValue(vo.get("vcMasCheckPeriod" )==null ? "" : (String)vo.get("vcMasCheckPeriod" )); + row.createCell(13).setCellValue(vo.get("dtMasStart" )==null ? "" : (String)vo.get("dtMasStart" )); + row.createCell(14).setCellValue(vo.get("dtMasFinish" )==null ? "" : (String)vo.get("dtMasFinish" )); + row.createCell(15).setCellValue(vo.get("vcVersion" )==null ? "" : (String)vo.get("vcVersion" )); + row.createCell(16).setCellValue(vo.get("vcAssetSerial" )==null ? "" : (String)vo.get("vcAssetSerial" )); + row.createCell(17).setCellValue(vo.get("vcHost" )==null ? "" : (String)vo.get("vcHost" )); + row.createCell(18).setCellValue(vo.get("dtEos" )==null ? "" : (String)vo.get("dtEos" )); + row.createCell(19).setCellValue(vo.get("txUsage" )==null ? "" : (String)vo.get("txUsage" )); + row.createCell(20).setCellValue(vo.get("txAssetDesc" )==null ? "" : (String)vo.get("txAssetDesc" )); + row.createCell(21).setCellValue(vo.get("vcIp" )==null ? "" : (String)vo.get("vcIp" )); + row.createCell(22).setCellValue(vo.get("vcDtlCpu" )==null ? "" : (String)vo.get("vcDtlCpu" )); + row.createCell(23).setCellValue(vo.get("vcDtlDisk" )==null ? "" : (String)vo.get("vcDtlDisk" )); + row.createCell(24).setCellValue(vo.get("vcDtlMem" )==null ? "" : (String)vo.get("vcDtlMem" )); + row.createCell(25).setCellValue(vo.get("vcChkTrgYn" )==null ? "" : (String)vo.get("vcChkTrgYn" )); + row.createCell(26).setCellValue(vo.get("vcTaskNm" )==null ? "" : (String)vo.get("vcTaskNm" )); + row.createCell(27).setCellValue(vo.get("vcNrwdMicnStrtDt" )==null ? "" : (String)vo.get("vcNrwdMicnStrtDt" )); + row.createCell(28).setCellValue(vo.get("vcNrwdMicnEndDt" )==null ? "" : (String)vo.get("vcNrwdMicnEndDt" )); + row.createCell(29).setCellValue(vo.get("vcLLicenseKnd" )==null ? "" : (String)vo.get("vcLLicenseKnd" )); + row.createCell(30).setCellValue(vo.get("dtLLicenseEnd" )==null ? "" : (String)vo.get("dtLLicenseEnd" )); + row.createCell(31).setCellValue(vo.get("dtEol" )==null ? "" : (String)vo.get("dtEol" )); + row.createCell(32).setCellValue(vo.get("inPortInfo" )==null ? 0 : (int)vo.get("inPortInfo" )); + row.createCell(33).setCellValue(vo.get("vcRealChargrNm" )==null ? "" : (String)vo.get("vcRealChargrNm" )); + + /* + row.createCell(0 ).setCellValue((String)vo.get("vcAssetId" )); + row.createCell(1 ).setCellValue((String)vo.get("vcCate1" )); + row.createCell(3 ).setCellValue((String)vo.get("vcCate2" )); + row.createCell(4 ).setCellValue((String)vo.get("vcCate3" )); + row.createCell(5 ).setCellValue((String)vo.get("vcAssetName" )); + row.createCell(6 ).setCellValue((String)vo.get("dtPurchaseDatetime" ) ); + row.createCell(7 ).setCellValue((String)vo.get("vcVendor") ); + row.createCell(8 ).setCellValue((String)vo.get("vcModel") ); + row.createCell(9 ).setCellValue((int)vo.get("inPrice") ); + row.createCell(10).setCellValue((String)vo.get("inAssetStatus") ); + row.createCell(11).setCellValue((String)vo.get("inMasTarget") ); + row.createCell(12).setCellValue((int)vo.get("inMasRate") ); + row.createCell(13).setCellValue((String)vo.get("vcMasCheckPeriod") ); + row.createCell(14).setCellValue((String)vo.get("dtMasStart") ); + row.createCell(15).setCellValue((String)vo.get("dtMasFinish") ); + row.createCell(16).setCellValue((String)vo.get("vcVersion") ); + row.createCell(17).setCellValue((String)vo.get("vcAssetSerial") ); + row.createCell(18).setCellValue((String)vo.get("vcHost") ); + row.createCell(19).setCellValue((String)vo.get("dtEos") ); + row.createCell(20).setCellValue((String)vo.get("txUsage") ); + row.createCell(21).setCellValue((String)vo.get("txAssetDesc") ); + row.createCell(22).setCellValue((String)vo.get("vcIp") ); + row.createCell(23).setCellValue((String)vo.get("vcDtlCpu") ); + row.createCell(24).setCellValue((String)vo.get("vcDtlDisk") ); + row.createCell(25).setCellValue((String)vo.get("vcDtlMem") ); + row.createCell(26).setCellValue((String)vo.get("vcChkTrgYn") ); + row.createCell(27).setCellValue((String)vo.get("vcTaskNm") ); + row.createCell(28).setCellValue((String)vo.get("vcNrwdMicnStrtDt") ); + row.createCell(29).setCellValue((String)vo.get("vcNrwdMicnEndDt") ); + row.createCell(30).setCellValue((String)vo.get("vcLLicenseKnd") ); + row.createCell(31).setCellValue((String)vo.get("dtLLicenseEnd") ); + row.createCell(32).setCellValue((String)vo.get("dtEol") ); + row.createCell(33).setCellValue((String)vo.get("inPortInfo") ); + */ + } + + // 열 너비 자동 조정 + for (int i = 0; i < 4; i++) + { + sheet.autoSizeColumn(i); + } + + // 파일 저장 + try (FileOutputStream outputStream = new FileOutputStream(filePath)) + { + workbook.write(outputStream); + } + + // 파일 다운로드 + File uFile = new File(filePath); + + String mimetype = "application/x-msdownload"; + + String userAgent = request.getHeader("User-Agent"); + HashMap result = EgovBrowserUtil.getBrowser(userAgent); + + if (!EgovBrowserUtil.MSIE.equals(result.get(EgovBrowserUtil.TYPEKEY))) + { + mimetype = "application/x-stuff"; + } + + String contentDisposition = EgovBrowserUtil.getDisposition(strFileNm, userAgent, "UTF-8"); + response.setContentType(mimetype); + response.setHeader("Content-Disposition", contentDisposition); + + BufferedInputStream in = null; + BufferedOutputStream out = null; + + try + { + in = new BufferedInputStream(new FileInputStream(uFile)); + out = new BufferedOutputStream(response.getOutputStream()); + + FileCopyUtils.copy(in, out); + out.flush(); + } + catch (IOException ex) + { + ex.printStackTrace(); + } + finally + { + in.close(); + out.close(); + } + + log.info("<<<<<<<<<<<<<<< /rem/SelectResourceExecl.do >>>>>>>>>>>>>>>"); + } + + + /** + * 자산이력 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.31 + */ + @RequestMapping("/rem/SelectResourceHist.do") + public String SelectResourceHist( @ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model + , HttpServletRequest request) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/SelectResourceHist.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); + paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); + paginationInfo.setPageSize (resourceManage.getPageSize()); + + resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); + resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); + resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(resourceManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAssetHist.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + // List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); + + // model.addAttribute("resourceList" , resourceList); + model.addAttribute("resourceList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + + log.info("<<<<<<<<<<<<<<< /rem/SelectResourceHist.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/rem/ResourceHistListPopup"; + } + + + /** + * 자산 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.03 + */ + @RequestMapping(value = "/rem/insertViewResource.do") + public String insertViewDeptManage( @ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertViewResource.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + + bodyMap.put("inCate1", "1"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); + List> resultCate2 = (List>)returnMap.get("resultCate2"); + + bodyMap.put("inCate1", "1"); + bodyMap.put("inCate2", "1"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); + List> resultCate3 = (List>)returnMap.get("resultCate3"); + // 자산분류코드 추출 End -------------------- // + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("SM_001"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_SM_001"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + // 공통코드 추출 End -------------------- // + + + + // 기본날짜 세팅 addMonth + String strCurDate = EgovDateUtil.getToday(); + + String datePicker_dtPurchaseDatetime = EgovDateUtil.formatDate(strCurDate, "-"); + + String datePicker_dtMasStart = EgovDateUtil.formatDate(strCurDate, "-"); + String datePicker_dtMasFinish = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); + + // 2025.09.01 나혁제 무상유지보수기산 추가 + String dateNrwdMicnStrtDt = EgovDateUtil.formatDate(strCurDate, "-"); + String dateNrwdMicnEndDt = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); + + String datePicker_DT_EOS = EgovDateUtil.formatDate("2999-12-31", "-"); + + // 2025.09.01 나혁제 추가사항 + String dtLLicenseEnd = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); + String dtEol = EgovDateUtil.formatDate(EgovDateUtil.addMonth(strCurDate, 12), "-"); + + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + model.addAttribute("resultCate2", resultCate2); // 자산중분류 + model.addAttribute("resultCate3", resultCate3); // 자산소분류 + + model.addAttribute("resourceManage", resourceManage); + + model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 + + model.addAttribute("dtPurchaseDatetime" , datePicker_dtPurchaseDatetime); + model.addAttribute("dtMasStart" , datePicker_dtMasStart); + model.addAttribute("dtMasFinish" , datePicker_dtMasFinish); + model.addAttribute("dtEos" , datePicker_DT_EOS); + model.addAttribute("dateNrwdMicnStrtDt" , dateNrwdMicnStrtDt); + model.addAttribute("dateNrwdMicnEndDt" , dateNrwdMicnEndDt); + model.addAttribute("dtLLicenseEnd" , dtLLicenseEnd); + model.addAttribute("dtEol" , dtEol); + + // 2025.12.03 나혁제 납품고객 반영 + model.addAttribute("strClient", strClient); // 납품고객 + + log.info("<<<<<<<<<<<<<<< /rem/insertViewResource.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ResourceInsert"; + } + + /** + * 자산 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.03 + */ + @ResponseBody + @RequestMapping(value="/rem/insertResource.do") + public LinkedHashMap insertResource( final MultipartHttpServletRequest multiRequest + , @ModelAttribute("AssetVo") AssetVo assetVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertResource.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + log.info(" inResourceManage TxUsage =>"+assetVo.getTxAssetDesc()); + + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "ASSET_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + assetVo.setAtchFileId(_atchFileId); + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO fileVo : _result) + { + log.info("file fileVo : {}", fileVo.toString()); + + Map fileMap = ConvertUtils.convertToMap(fileVo); + + /* + LinkedHashMap fileMap = new LinkedHashMap(); + + fileMap.put("size" , resultMap.getFileMg ()); + fileMap.put("vcFilePath" , resultMap.getFileStreCours()); + fileMap.put("vcOrgFileName" , resultMap.getOrignlFileNm ()); + fileMap.put("vcFileName" , resultMap.getStreFileNm ()); + */ + + fileList.add(fileMap); + } + } + + // 상위 자산이 존재하지 않은 경우 "0" 으로 세팅 + if(assetVo.getInParentSeq() == null || assetVo.getInParentSeq().equals("")) + { + assetVo.setInParentSeq("0"); + } + + // 뭔지 모르겠음 + if(assetVo.getInRemainPrice() == null || assetVo.getInRemainPrice().equals("")) + { + assetVo.setInRemainPrice("0"); + } + + // 뭔지 모르겠음 + if(assetVo.getInPhysical() == null || assetVo.getInPhysical().equals("")) + { + assetVo.setInPhysical("0"); + } + + // Body Setting Start --------------------------------- + // bodyMap.put("fileList" , fileList); + bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); + bodyMap.put("fileList" , fileList); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/insertResource.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , "0" ); + resBody.put("resultMsg" , "정상" ); + + log.info("<<<<<<<<<<<<<<< /rem/insertResource.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 자산 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.05 + */ + @ResponseBody + @RequestMapping(value="/rem/updateAsset.do") + public LinkedHashMap updateAsset( final MultipartHttpServletRequest multiRequest + , @ModelAttribute("AssetVo") AssetVo assetVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/updateAsset.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String _atchFileId = assetVo.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + log.info(" _atchFileId =>"+_atchFileId); + + if( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + List> fileList = new ArrayList(); + + if (_atchFileId==null || "".equals(_atchFileId) ) + { + _result = fileUtil.parseFileInf(files, "ASSET_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + assetVo.setAtchFileId(_atchFileId); + assetVo.setAtchFileInUpGb("I"); // 새로만들기 + + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "ASSET_", _cnt, _atchFileId, ""); + assetVo.setAtchFileInUpGb("U"); // 기존자료변경 + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + + bodyMap.put("fileList" , fileList); + } + + // 상위 자산이 존재하지 않은 경우 "0" 으로 세팅 + if(assetVo.getInParentSeq() == null || assetVo.getInParentSeq().equals("")) + { + assetVo.setInParentSeq("0"); + } + + // 뭔지 모르겠음 + if(assetVo.getInRemainPrice() == null || assetVo.getInRemainPrice().equals("")) + { + assetVo.setInRemainPrice("0"); + } + + // 뭔지 모르겠음 + if(assetVo.getInPhysical() == null || assetVo.getInPhysical().equals("")) + { + assetVo.setInPhysical("0"); + } + + // Body Setting Start --------------------------------- + // bodyMap.put("fileList" , fileList); + bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/updateAsset.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/updateAsset.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.05 + */ + @ResponseBody + @RequestMapping(value="/rem/deleteAsset.do") + public LinkedHashMap deleteAsset( final MultipartHttpServletRequest multiRequest + , @ModelAttribute("AssetVo") AssetVo assetVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/deleteAsset.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("assetVo" , ConvertUtils.convertToMapAll(assetVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteAsset.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/deleteAsset.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 복수 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.05 + */ + @ResponseBody + @RequestMapping(value="/rem/deleteMultiAsset.do") + public LinkedHashMap deleteMultiAsset( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/deleteMultiAsset.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strInAssetSeqMulti = CommonUtil.nvl(request.getParameter("inAssetSeqMulti" )); + + log.info(" strInAssetSeqMulti [{}]", strInAssetSeqMulti); + + // Body Setting Start --------------------------------- + bodyMap.put("inAssetSeqMulti" , strInAssetSeqMulti); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/deleteMultiAsset.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /rem/deleteMultiAsset.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + /** + * 자산 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.04 + */ + @RequestMapping(value = "/rem/getAssetInfo.do") + public String getAssetInfo( @ModelAttribute("resourceManage") ResourceManage resourceManage + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getAssetInfo.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + //** 자산상세조회 Start -------------------- // + // 자산 상세조회 + int iInAssetSeq = resourceManage.getInAssetSeq(); + + // Body Setting Start --------------------------------- + bodyMap.put("inAssetSeq", iInAssetSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getAssetInfo.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultAsset = (Map)returnMap.get("resultAsset" ); + List> resultAssetReport = (List>)returnMap.get("resultAssetReport"); + // RestApi Call End --------------------------------- + //** 자산상세조회 End -------------------- // + + //** 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + + bodyMap.put("inCate1", "1"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); + List> resultCate2 = (List>)returnMap.get("resultCate2"); + + bodyMap.put("inCate1", "1"); + bodyMap.put("inCate2", "1"); + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); + List> resultCate3 = (List>)returnMap.get("resultCate3"); + //** 자산분류코드 추출 End -------------------- // + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("SM_001"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_SM_001"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + // 공통코드 추출 End -------------------- // + + model.addAttribute("resultAsset" , resultAsset ); + model.addAttribute("resultAssetReport" , resultAssetReport); + + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + model.addAttribute("resultCate2", resultCate2); // 자산중분류 + model.addAttribute("resultCate3", resultCate3); // 자산소분류 + + model.addAttribute("SM_001_result", chglistComCode); // 사용자상태코드목록 + + // 2025.12.03 나혁제 납품고객 반영 + model.addAttribute("strClient", strClient); // 납품고객 + + log.info("<<<<<<<<<<<<<<< /rem/getAssetInfo.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ResourceDetail"; + } + + + + + + + + + + + /** + * 자산 대분류 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.31 + */ + @ResponseBody + @RequestMapping(value="/rem/getCate1List.do") + public LinkedHashMap getCate1List( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getCate1List.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + bodyMap = requestMap; + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + resBody.put("resultCate1" , resultCate1 ); + + + + + log.info("<<<<<<<<<<<<<<< /rem/getCate1List.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 중분류 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.31 + */ + @ResponseBody + @RequestMapping(value="/rem/getCate2List.do") + public LinkedHashMap getCate2List( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getCate2List.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + bodyMap = requestMap; + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate2List.do"); + // RestApi Call End --------------------------------- + + List> resultCate2 = (List>)returnMap.get("resultCate2"); + resBody.put("resultCate2" , resultCate2 ); + + log.info("<<<<<<<<<<<<<<< /rem/getCate2List.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 소분류 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.31 + */ + @ResponseBody + @RequestMapping(value="/rem/getCate3List.do") + public LinkedHashMap getCate3List( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/getCate3List.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + bodyMap = requestMap; + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate3List.do"); + // RestApi Call End --------------------------------- + + List> resultCate3 = (List>)returnMap.get("resultCate3"); + resBody.put("resultCate3" , resultCate3 ); + + log.info("<<<<<<<<<<<<<<< /rem/getCate3List.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 자산 목록을 조회한다.(팝업) + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.17 + */ + @RequestMapping("/rem/SelectResourcePopup.do") + public String SelectResourcePopup(@ModelAttribute("resourceManage") ResourceManage resourceManage + , ModelMap model + , HttpServletRequest request) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/SelectResourcePopup.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (resourceManage.getPageIndex()); + paginationInfo.setRecordCountPerPage(resourceManage.getPageUnit()); + paginationInfo.setPageSize (resourceManage.getPageSize()); + + resourceManage.setFirstIndex(paginationInfo.getFirstRecordIndex()); + resourceManage.setLastIndex(paginationInfo.getLastRecordIndex()); + resourceManage.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(resourceManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAsset.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + List resourceList = ConvertUtils.convertToValueObjectsAll(resultList, ResourceManage.class); + + model.addAttribute("resourceList" , resourceList); + model.addAttribute("paginationInfo" , paginationInfo); + + // 2025.09.22 나혁제 추가 --------------------// + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCate1List.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + model.addAttribute("resultCate1", resultCate1); // 자산대분류 + // 자산분류코드 추출 End -------------------- // + + + log.info("<<<<<<<<<<<<<<< /rem/SelectResourcePopup.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/rem/ResourceListPopup"; + } + + /** + * 자산번호 중복여부 확인 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.05 + */ + @ResponseBody + @RequestMapping(value = "/rem/checkAssetIdDup.do") + public LinkedHashMap checkAssetIdDup( @ModelAttribute("AssetVo") AssetVo assetVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/checkAssetIdDup.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("vcAssetId", assetVo.getVcAssetId()); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/checkAssetIdDup.do"); + // RestApi Call End --------------------------------- + + int iDup = (int)returnMap.get("result"); + + resBody.put("iDup" , iDup); + + log.info("<<<<<<<<<<<<<<< /rem/checkAssetIdDup.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceMutilManagerController.java b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceMutilManagerController.java index 7e021d82..1738a980 100644 --- a/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceMutilManagerController.java +++ b/front/src/main/java/com/urpsys/itmsfront/rem/controller/ResourceMutilManagerController.java @@ -1,320 +1,320 @@ -package com.urpsys.itmsfront.rem.controller; - -import java.io.File; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.support.SessionStatus; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovDateUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.domain.ComDefaultVO; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.bbs.domain.BoardMaster; -import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.rem.domain.AdminCategoryManage; -import com.urpsys.itmsfront.rem.domain.AssetVo; -import com.urpsys.itmsfront.rem.domain.InResourceManage; -import com.urpsys.itmsfront.rem.domain.ResourceManage; - - -import lombok.extern.slf4j.Slf4j; - -/** - * 자산관련 대용량 처리 컨트롤러 클래스 (게시판생성관리-enterprise) - * @author urp 인프라본부 나혁제 - * @since 2025.02.26 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.26   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ResourceMutilManagerController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 자산 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping("/rem/MultiResourceView.do") - public String MultiResourceView( HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/MultiResourceView.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 자산분류코드 추출 Start -------------------- // - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCateListFull.do"); - // RestApi Call End --------------------------------- - - List> resultCate1 = (List>)returnMap.get("resultCate1"); - List> resultCate2 = (List>)returnMap.get("resultCate2"); - List> resultCate3 = (List>)returnMap.get("resultCate3"); - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("SM_001"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_SM_001"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - // 공통코드 추출 End -------------------- // - - // 2025.09.01 나혁제 현재일자 추가 - String strCurDate = EgovDateUtil.formatDate(EgovDateUtil.getToday(), "-"); - - // json 데이터로 변환 - model.addAttribute("resultCate1" , ConvertUtils.getJsonFromList(resultCate1)); // 자산대분류 - model.addAttribute("resultCate2" , ConvertUtils.getJsonFromList(resultCate2)); // 자산중분류 - model.addAttribute("resultCate3" , ConvertUtils.getJsonFromList(resultCate3)); // 자산소분류 - model.addAttribute("cdid_sm001" , ConvertUtils.getJsonFromList(listComCode)); // 자산상태 - model.addAttribute("strCurDate" , strCurDate); // 현재일자 - // 자산분류코드 추출 End -------------------- // - - log.info("<<<<<<<<<<<<<<< /rem/MultiResourceView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/rem/ResourceMultiList"; - } - - /** - * 자산 코드 세트 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.04.14 - */ - @RequestMapping("/rem/ResourceCodeSetSearch.do") - public String ResourceCodeSetSearch( HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/ResourceCodeSetSearch.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - AdminCategoryManage adminCategoryManage = new AdminCategoryManage(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(adminCategoryManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminCategory.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - // Return Data Setting End -------------------------- - - - // 공통코드 추출 Start -------------------- // - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("SM_001"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_SM_001"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - // 공통코드 추출 End -------------------- // - - - model.addAttribute("categoryList" , resultList); - model.addAttribute("cdid_sm001" , listComCode); // 자산상태 - - log.info("<<<<<<<<<<<<<<< /rem/ResourceCodeSetSearch.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/rem/ResourceCodeSet"; - } - - - /** - * 자산 대용량 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.27 - */ - @ResponseBody - @RequestMapping(value="/rem/insertMultiResource.do") - public LinkedHashMap insertMultiResource( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /rem/insertMultiResource.do <<<<<<<<<<<<<<<"); - log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - LinkedHashMap resBody = new LinkedHashMap(); - - boolean iCheck = true; - // Body Setting Start --------------------------------- - bodyMap.put("vcAssetId",requestMap.get("vcAssetId")); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/checkAssetIdDup.do"); - // RestApi Call End --------------------------------- - - int iDup = (int)returnMap.get("result"); - - if(iDup>0) - { - resBody.put("resultCd" , "E" ); - resBody.put("resultMsg" , "중복된 [자산번호] 입니다." ); - iCheck = false; - } - - // 실사용자 정보 가져오기 - if(iCheck) - { - String strVcRealChargrNm = CommonUtil.nvl( requestMap.get("vcRealChargrNm")); - if(!strVcRealChargrNm.equals("")) - { - // Body Setting Start --------------------------------- - bodyMap.put("vcRealChargrNm",strVcRealChargrNm); - // Body Setting End - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/realUserList.do"); - // RestApi Call End --------------------------------- - - List> listResult = (List>)returnMap.get("result"); - - if(listResult.size()>1) - { - resBody.put("resultCd" , "E" ); - resBody.put("resultMsg" , "실사용자가 중복 되었습니다." ); - iCheck = false; - } - - else if(listResult.size()<1) - { - resBody.put("resultCd" , "E" ); - resBody.put("resultMsg" , "실사용자가 존재하지 않습니다." ); - iCheck = false; - } - else - { - requestMap.put("inRealChargr", listResult.get(0).get("esntlId") ); - } - } - } - - if(iCheck) - { - requestMap.put("inParentSeq" , "0"); // 상위자산 0 으로 세팅 - requestMap.put("inRemainPrice" , "0"); - requestMap.put("inParentSeq" , "0"); - requestMap.put("inPhysical" , "0"); - - // Body Setting Start --------------------------------- - bodyMap.put("assetVo" , requestMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/insertResource.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , "A" ); - resBody.put("resultMsg" , "정상적으로 처리되었습니다."); - } - - log.info("<<<<<<<<<<<<<<< /rem/insertMultiResource.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - - - - - - - - - -} +package com.urpsys.itmsfront.rem.controller; + +import java.io.File; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovDateUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.domain.ComDefaultVO; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.bbs.domain.BoardMaster; +import com.urpsys.itmsfront.bbs.domain.BoardMasterVO; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.rem.domain.AdminCategoryManage; +import com.urpsys.itmsfront.rem.domain.AssetVo; +import com.urpsys.itmsfront.rem.domain.InResourceManage; +import com.urpsys.itmsfront.rem.domain.ResourceManage; + + +import lombok.extern.slf4j.Slf4j; + +/** + * 자산관련 대용량 처리 컨트롤러 클래스 (게시판생성관리-enterprise) + * @author urp 인프라본부 나혁제 + * @since 2025.02.26 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.26   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ResourceMutilManagerController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 자산 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping("/rem/MultiResourceView.do") + public String MultiResourceView( HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/MultiResourceView.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 자산분류코드 추출 Start -------------------- // + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/getCateListFull.do"); + // RestApi Call End --------------------------------- + + List> resultCate1 = (List>)returnMap.get("resultCate1"); + List> resultCate2 = (List>)returnMap.get("resultCate2"); + List> resultCate3 = (List>)returnMap.get("resultCate3"); + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("SM_001"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_SM_001"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + // 공통코드 추출 End -------------------- // + + // 2025.09.01 나혁제 현재일자 추가 + String strCurDate = EgovDateUtil.formatDate(EgovDateUtil.getToday(), "-"); + + // json 데이터로 변환 + model.addAttribute("resultCate1" , ConvertUtils.getJsonFromList(resultCate1)); // 자산대분류 + model.addAttribute("resultCate2" , ConvertUtils.getJsonFromList(resultCate2)); // 자산중분류 + model.addAttribute("resultCate3" , ConvertUtils.getJsonFromList(resultCate3)); // 자산소분류 + model.addAttribute("cdid_sm001" , ConvertUtils.getJsonFromList(listComCode)); // 자산상태 + model.addAttribute("strCurDate" , strCurDate); // 현재일자 + // 자산분류코드 추출 End -------------------- // + + log.info("<<<<<<<<<<<<<<< /rem/MultiResourceView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/rem/ResourceMultiList"; + } + + /** + * 자산 코드 세트 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.04.14 + */ + @RequestMapping("/rem/ResourceCodeSetSearch.do") + public String ResourceCodeSetSearch( HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/ResourceCodeSetSearch.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + AdminCategoryManage adminCategoryManage = new AdminCategoryManage(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(adminCategoryManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/searchAdminCategory.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + // Return Data Setting End -------------------------- + + + // 공통코드 추출 Start -------------------- // + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("SM_001"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_SM_001"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + // 공통코드 추출 End -------------------- // + + + model.addAttribute("categoryList" , resultList); + model.addAttribute("cdid_sm001" , listComCode); // 자산상태 + + log.info("<<<<<<<<<<<<<<< /rem/ResourceCodeSetSearch.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/rem/ResourceCodeSet"; + } + + + /** + * 자산 대용량 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.27 + */ + @ResponseBody + @RequestMapping(value="/rem/insertMultiResource.do") + public LinkedHashMap insertMultiResource( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /rem/insertMultiResource.do <<<<<<<<<<<<<<<"); + log.info("입력값 확인 requestMap [{}]", requestMap.toString() ); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + LinkedHashMap resBody = new LinkedHashMap(); + + boolean iCheck = true; + // Body Setting Start --------------------------------- + bodyMap.put("vcAssetId",requestMap.get("vcAssetId")); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/checkAssetIdDup.do"); + // RestApi Call End --------------------------------- + + int iDup = (int)returnMap.get("result"); + + if(iDup>0) + { + resBody.put("resultCd" , "E" ); + resBody.put("resultMsg" , "중복된 [자산번호] 입니다." ); + iCheck = false; + } + + // 실사용자 정보 가져오기 + if(iCheck) + { + String strVcRealChargrNm = CommonUtil.nvl( requestMap.get("vcRealChargrNm")); + if(!strVcRealChargrNm.equals("")) + { + // Body Setting Start --------------------------------- + bodyMap.put("vcRealChargrNm",strVcRealChargrNm); + // Body Setting End + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/realUserList.do"); + // RestApi Call End --------------------------------- + + List> listResult = (List>)returnMap.get("result"); + + if(listResult.size()>1) + { + resBody.put("resultCd" , "E" ); + resBody.put("resultMsg" , "실사용자가 중복 되었습니다." ); + iCheck = false; + } + + else if(listResult.size()<1) + { + resBody.put("resultCd" , "E" ); + resBody.put("resultMsg" , "실사용자가 존재하지 않습니다." ); + iCheck = false; + } + else + { + requestMap.put("inRealChargr", listResult.get(0).get("esntlId") ); + } + } + } + + if(iCheck) + { + requestMap.put("inParentSeq" , "0"); // 상위자산 0 으로 세팅 + requestMap.put("inRemainPrice" , "0"); + requestMap.put("inParentSeq" , "0"); + requestMap.put("inPhysical" , "0"); + + // Body Setting Start --------------------------------- + bodyMap.put("assetVo" , requestMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/rem/insertResource.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , "A" ); + resBody.put("resultMsg" , "정상적으로 처리되었습니다."); + } + + log.info("<<<<<<<<<<<<<<< /rem/insertMultiResource.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportCheckController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportCheckController.java index 68684b25..9fe18721 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportCheckController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportCheckController.java @@ -1,1209 +1,1209 @@ -package com.urpsys.itmsfront.srm.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.srm.domain.ReportCheckListVo; -import com.urpsys.itmsfront.srm.domain.ReportCheckVo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 점검보고서 관련 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.02.17 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.17   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ReportCheckController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 점검보고서 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.17 - */ - @RequestMapping("/srm/searchReportCheck.do") - public String searchReportCheck( @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/searchReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportCheck.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - // 2025.11.24 나혁제 그룹정보가 없는경우 메세지 처리 - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - if(tokenInfo.getStrGRP_ID() == null || tokenInfo.getStrGRP_ID().equals("")) - { - model.addAttribute("error_msg", "그룹지정이 안되어 있습니다. 시스템관리자에게 연락하여 그룹지정을 해주세요."); - } - - - log.info("<<<<<<<<<<<<<<< /srm/searchReportCheck.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportCheckList"; - } - - - /** - * 점검보고서 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.18 - */ - @RequestMapping(value = "/srm/getReportWithBodyCheck.do") - public String getReportWithBodyCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo - , @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); - - // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 - if(resultReportCheck == null) - { - model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); - return "forward:/srm/searchReportCheck.do"; - } - - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportCheck.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportCheck.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportCheck ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyCheck.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportCheckDetail"; - } - - /** - * 보고서 인쇄 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.24 - */ - @RequestMapping(value = "/srm/getReportWithBodyCheckPrint.do") - public String getReportWithBodyCheckPrint( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo - , @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyCheckPrint.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); - String strAssetDtlYn = CommonUtil.getData(request, "assetDtlYn"); // 2025.08.19 나혁제 자산정보 상세여부 - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportCheck.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportCheck.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - model.addAttribute("assetDtlYn" , strAssetDtlYn ); // 2025.08.19 나혁제 자산정보 상세여부 - - model.addAttribute("resultReport" , resultReportCheck ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyCheckPrint.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/srm/ReportCheckPrintPop"; - } - - /** - * 점검보고서 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.17 - */ - @RequestMapping(value = "/srm/insertViewReportCheck.do") - public String insertViewReportCheck( @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertViewReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 서비스 정보 추출 - bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); - bodyMap.put("inAssetSeq" , CommonUtil.getData(request, "inAssetSeq" )); // 2025.08.20 나혁제 연결자산 추가 - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - Map resultTaskMap = (Map)returnMap.get("resultTask"); - Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 - Map resultAsset = (Map)returnMap.get("resultAsset"); // 2025.08.20 나혁제 자산정보추가 - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 - model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - model.addAttribute("resultAsset" , resultAsset ); // 보고서 양식 정보 - - // 인스던트 정보가 없는경우 0 으로 세팅 - if(resultIncident.get("inIncidentSeq") == null) - { - model.addAttribute("inIncidentSeq", 0 ); - } - else - { - model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); - } - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/insertViewReportCheck.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportCheckInsert"; - } - - /** - * 보고서 수정 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.18 - */ - @RequestMapping(value = "/srm/updateViewReportCheck.do") - public String updateViewReportCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo - , @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateViewReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportCheck.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportCheck.put("txReportBody", strReportBodyDec); - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportCheck ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/updateViewReportCheck.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportCheckUpdate"; - } - - /** - * 보고서 새로만들기 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.22 - */ - @RequestMapping(value = "/srm/insertCopyViewReportCheck.do") - public String insertCopyViewReportCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo - , @ModelAttribute("searchVO") ReportCheckListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportCheck.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportCheck.put("txReportBody", strReportBodyDec); - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportCheck ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - model.addAttribute("inIncidentSeq", 0 ); - - log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportCheck.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportCheckCopyInsert"; - } - - - - - - - - - - /** - * 보고서 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.18 - */ - @ResponseBody - @RequestMapping(value="/srm/addReportCheck.do") - public LinkedHashMap addReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/addReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportCheckVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportCheckVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - reportCheckVo.setAtchFileId(_atchFileId); - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO fileVo : _result) - { - log.info("file fileVo : {}", fileVo.toString()); - - Map fileMap = ConvertUtils.convertToMap(fileVo); - - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inUserSeq" , reportCheckVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(1, 1, inReportSeq); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 1, inReportSeq); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/addReportCheck.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 보고서 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.18 - */ - @ResponseBody - @RequestMapping(value="/srm/updateReportCheck.do") - public LinkedHashMap updateReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportCheckVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportCheckVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - String _atchFileId = reportCheckVo.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - List> fileList = new ArrayList(); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - - if (_atchFileId==null || "".equals(_atchFileId) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - reportCheckVo.setAtchFileId(_atchFileId); - reportCheckVo.setAtchFileInUpGb("I"); // 새로만들기 - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); - reportCheckVo.setAtchFileInUpGb("U"); // 기존자료변경 - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inReportSeq" , reportCheckVo.getInReportSeq() ); - reqApprovalMap.put("inUserSeq" , reportCheckVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 메일/카톡 처리 - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(2, 1, CommonUtil.zeroConvert(reportCheckVo.getInReportSeq()) ); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(reportCheckVo.getInReportSeq()) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/updateReportCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.19 - */ - @ResponseBody - @RequestMapping(value="/srm/deleteReportCheck.do") - public LinkedHashMap deleteReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/deleteReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /srm/deleteReportCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 승인요청 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.19 - */ - @ResponseBody - @RequestMapping(value="/srm/procApprovalReportCheck.do") - public LinkedHashMap procApprovalReportCheck( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 승인 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.19 - */ - @ResponseBody - @RequestMapping(value="/srm/approvalReportCheck.do") - public LinkedHashMap approvalReportCheck( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/approvalReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); - - log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); - - // - if(returnMap.get("resultCd").equals("0")) - { - // 승인완료 - if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) - { - commonService.sendReportMail(4, 1, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - // 다음승인 - else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) - { - commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/approvalReportCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 반려 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.19 - */ - @ResponseBody - @RequestMapping(value="/srm/rejectReportCheck.do") - public LinkedHashMap rejectReportCheck( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/rejectReportCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportCheck.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - // 메일/카톡 처리 - try - { - String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); - - // - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(5, 1, CommonUtil.zeroConvert(strInReportSeq) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/rejectReportCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - /** - * 서비스 정보 결재라인 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.17 - */ - @ResponseBody - @RequestMapping(value = "/srm/getSvcApprovalListCheck.do") - public LinkedHashMap getSvcApprovalListCheck( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - //** 서비스 상세조회 Start -------------------- // - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListCheck.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - List> resultApprovals = (List>)returnMap.get("resultList"); - // RestApi Call End --------------------------------- - //** 서비스 상세조회 End -------------------- // - - resBody.put("resultApprovals" , resultApprovals ); - - log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 양식 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.17 - */ - @ResponseBody - @RequestMapping(value = "/srm/getReportFormCheck.do") - public LinkedHashMap getReportFormCheck( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportFormCheck.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormCheck.do"); - // RestApi Call End --------------------------------- - - // 2025.05.21 나혁제 작업자 정보 추가 - // 결과값 추출 Start --------------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); - String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); - String strInTaskUser = (String)resultMap.get("inTaskUser"); - String strVcTaskUser = (String)resultMap.get("vcTaskUser"); - - resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); - resBody.put("strInTaskUser" , strInTaskUser ); - resBody.put("strVcTaskUser" , strVcTaskUser ); - - log.info("<<<<<<<<<<<<<<< /srm/getReportFormCheck.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - -} +package com.urpsys.itmsfront.srm.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.srm.domain.ReportCheckListVo; +import com.urpsys.itmsfront.srm.domain.ReportCheckVo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 점검보고서 관련 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.02.17 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.17   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ReportCheckController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 점검보고서 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.17 + */ + @RequestMapping("/srm/searchReportCheck.do") + public String searchReportCheck( @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/searchReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportCheck.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + // 2025.11.24 나혁제 그룹정보가 없는경우 메세지 처리 + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + if(tokenInfo.getStrGRP_ID() == null || tokenInfo.getStrGRP_ID().equals("")) + { + model.addAttribute("error_msg", "그룹지정이 안되어 있습니다. 시스템관리자에게 연락하여 그룹지정을 해주세요."); + } + + + log.info("<<<<<<<<<<<<<<< /srm/searchReportCheck.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportCheckList"; + } + + + /** + * 점검보고서 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.18 + */ + @RequestMapping(value = "/srm/getReportWithBodyCheck.do") + public String getReportWithBodyCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo + , @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); + + // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 + if(resultReportCheck == null) + { + model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); + return "forward:/srm/searchReportCheck.do"; + } + + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportCheck.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportCheck.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportCheck ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyCheck.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportCheckDetail"; + } + + /** + * 보고서 인쇄 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.24 + */ + @RequestMapping(value = "/srm/getReportWithBodyCheckPrint.do") + public String getReportWithBodyCheckPrint( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo + , @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyCheckPrint.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); + String strAssetDtlYn = CommonUtil.getData(request, "assetDtlYn"); // 2025.08.19 나혁제 자산정보 상세여부 + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportCheck.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportCheck.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + model.addAttribute("assetDtlYn" , strAssetDtlYn ); // 2025.08.19 나혁제 자산정보 상세여부 + + model.addAttribute("resultReport" , resultReportCheck ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyCheckPrint.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/srm/ReportCheckPrintPop"; + } + + /** + * 점검보고서 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.17 + */ + @RequestMapping(value = "/srm/insertViewReportCheck.do") + public String insertViewReportCheck( @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertViewReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 서비스 정보 추출 + bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); + bodyMap.put("inAssetSeq" , CommonUtil.getData(request, "inAssetSeq" )); // 2025.08.20 나혁제 연결자산 추가 + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + Map resultTaskMap = (Map)returnMap.get("resultTask"); + Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 + Map resultAsset = (Map)returnMap.get("resultAsset"); // 2025.08.20 나혁제 자산정보추가 + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 + model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + model.addAttribute("resultAsset" , resultAsset ); // 보고서 양식 정보 + + // 인스던트 정보가 없는경우 0 으로 세팅 + if(resultIncident.get("inIncidentSeq") == null) + { + model.addAttribute("inIncidentSeq", 0 ); + } + else + { + model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); + } + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/insertViewReportCheck.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportCheckInsert"; + } + + /** + * 보고서 수정 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.18 + */ + @RequestMapping(value = "/srm/updateViewReportCheck.do") + public String updateViewReportCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo + , @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateViewReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportCheck.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportCheck.put("txReportBody", strReportBodyDec); + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportCheck ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/updateViewReportCheck.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportCheckUpdate"; + } + + /** + * 보고서 새로만들기 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.22 + */ + @RequestMapping(value = "/srm/insertCopyViewReportCheck.do") + public String insertCopyViewReportCheck( @ModelAttribute("ReportCheckListVo") ReportCheckListVo reportCheckListVo + , @ModelAttribute("searchVO") ReportCheckListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportCheckListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyCheck.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportCheck = (Map)returnMap.get("resultReportCheck"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportCheck.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportCheck.put("txReportBody", strReportBodyDec); + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportCheck ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportCheck.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + model.addAttribute("inIncidentSeq", 0 ); + + log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportCheck.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportCheckCopyInsert"; + } + + + + + + + + + + /** + * 보고서 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.18 + */ + @ResponseBody + @RequestMapping(value="/srm/addReportCheck.do") + public LinkedHashMap addReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/addReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportCheckVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportCheckVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + reportCheckVo.setAtchFileId(_atchFileId); + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO fileVo : _result) + { + log.info("file fileVo : {}", fileVo.toString()); + + Map fileMap = ConvertUtils.convertToMap(fileVo); + + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inUserSeq" , reportCheckVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(1, 1, inReportSeq); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 1, inReportSeq); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/addReportCheck.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 보고서 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.18 + */ + @ResponseBody + @RequestMapping(value="/srm/updateReportCheck.do") + public LinkedHashMap updateReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportCheckVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportCheckVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + String _atchFileId = reportCheckVo.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + List> fileList = new ArrayList(); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + + if (_atchFileId==null || "".equals(_atchFileId) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + reportCheckVo.setAtchFileId(_atchFileId); + reportCheckVo.setAtchFileInUpGb("I"); // 새로만들기 + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); + reportCheckVo.setAtchFileInUpGb("U"); // 기존자료변경 + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inReportSeq" , reportCheckVo.getInReportSeq() ); + reqApprovalMap.put("inUserSeq" , reportCheckVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 메일/카톡 처리 + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(2, 1, CommonUtil.zeroConvert(reportCheckVo.getInReportSeq()) ); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(reportCheckVo.getInReportSeq()) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/updateReportCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.19 + */ + @ResponseBody + @RequestMapping(value="/srm/deleteReportCheck.do") + public LinkedHashMap deleteReportCheck( final @ModelAttribute("reportCheckVo") ReportCheckVo reportCheckVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/deleteReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportCheckVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /srm/deleteReportCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 승인요청 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.19 + */ + @ResponseBody + @RequestMapping(value="/srm/procApprovalReportCheck.do") + public LinkedHashMap procApprovalReportCheck( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 승인 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.19 + */ + @ResponseBody + @RequestMapping(value="/srm/approvalReportCheck.do") + public LinkedHashMap approvalReportCheck( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/approvalReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); + + log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); + + // + if(returnMap.get("resultCd").equals("0")) + { + // 승인완료 + if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) + { + commonService.sendReportMail(4, 1, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + // 다음승인 + else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) + { + commonService.sendReportMail(3, 1, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/approvalReportCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 반려 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.19 + */ + @ResponseBody + @RequestMapping(value="/srm/rejectReportCheck.do") + public LinkedHashMap rejectReportCheck( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/rejectReportCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportCheck.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + // 메일/카톡 처리 + try + { + String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); + + // + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(5, 1, CommonUtil.zeroConvert(strInReportSeq) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/rejectReportCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + /** + * 서비스 정보 결재라인 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.17 + */ + @ResponseBody + @RequestMapping(value = "/srm/getSvcApprovalListCheck.do") + public LinkedHashMap getSvcApprovalListCheck( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + //** 서비스 상세조회 Start -------------------- // + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListCheck.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + List> resultApprovals = (List>)returnMap.get("resultList"); + // RestApi Call End --------------------------------- + //** 서비스 상세조회 End -------------------- // + + resBody.put("resultApprovals" , resultApprovals ); + + log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 양식 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.17 + */ + @ResponseBody + @RequestMapping(value = "/srm/getReportFormCheck.do") + public LinkedHashMap getReportFormCheck( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportFormCheck.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormCheck.do"); + // RestApi Call End --------------------------------- + + // 2025.05.21 나혁제 작업자 정보 추가 + // 결과값 추출 Start --------------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); + String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); + String strInTaskUser = (String)resultMap.get("inTaskUser"); + String strVcTaskUser = (String)resultMap.get("vcTaskUser"); + + resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); + resBody.put("strInTaskUser" , strInTaskUser ); + resBody.put("strVcTaskUser" , strVcTaskUser ); + + log.info("<<<<<<<<<<<<<<< /srm/getReportFormCheck.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportErrorController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportErrorController.java index 39ed8edf..fa221657 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportErrorController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportErrorController.java @@ -1,1198 +1,1198 @@ -package com.urpsys.itmsfront.srm.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.srm.domain.ReportErrorListVo; -import com.urpsys.itmsfront.srm.domain.ReportErrorVo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 장애보고서 관련 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.02.25 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.25   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ReportErrorController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 장애보고서 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @RequestMapping("/srm/searchReportError.do") - public String searchReportError( @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/searchReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportError.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /srm/searchReportError.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportErrorList"; - } - - /** - * 장애보고서 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @RequestMapping(value = "/srm/getReportWithBodyError.do") - public String getReportWithBodyError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo - , @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportError = (Map)returnMap.get("resultReportError"); - - // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 - if(resultReportError == null) - { - model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); - return "forward:/srm/searchReportError.do"; - } - - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportError.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportError.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportError ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyError.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportErrorDetail"; - } - - /** - * 장애보고서 인쇄 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @RequestMapping(value = "/srm/getReportWithBodyErrorPrint.do") - public String getReportWithBodyErrorPrint( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo - , @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyErrorPrint.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportError = (Map)returnMap.get("resultReportError"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportError.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportError.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportError ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyErrorPrint.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/srm/ReportErrorPrintPop"; - } - - /** - * 장애보고서 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @RequestMapping(value = "/srm/insertViewReportError.do") - public String insertViewReportError( @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertViewReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 서비스 정보 추출 - bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - Map resultTaskMap = (Map)returnMap.get("resultTask"); - Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 - model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - // 인스던트 정보가 없는경우 0 으로 세팅 - if(resultIncident.get("inIncidentSeq") == null) - { - model.addAttribute("inIncidentSeq", 0 ); - } - else - { - model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); - } - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/insertViewReportError.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportErrorInsert"; - } - - /** - * 장애보고서 수정 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @RequestMapping(value = "/srm/updateViewReportError.do") - public String updateViewReportError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo - , @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateViewReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportError = (Map)returnMap.get("resultReportError"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportError.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportError.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportError ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/updateViewReportError.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportErrorUpdate"; - } - - /** - * 보고서 새로만들기 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.22 - */ - @RequestMapping(value = "/srm/insertCopyViewReportError.do") - public String insertCopyViewReportError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo - , @ModelAttribute("searchVO") ReportErrorListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportError = (Map)returnMap.get("resultReportError"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportError.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportError.put("txReportBody", strReportBodyDec); - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportError ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - model.addAttribute("inIncidentSeq", 0 ); - - log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportError.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportErrorCopyInsert"; - } - - - /** - * 장애보고서 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/addReportError.do") - public LinkedHashMap addReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/addReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportErrorVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportErrorVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - reportErrorVo.setAtchFileId(_atchFileId); - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO fileVo : _result) - { - log.info("file fileVo : {}", fileVo.toString()); - - Map fileMap = ConvertUtils.convertToMap(fileVo); - - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inUserSeq" , reportErrorVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(1, 2, inReportSeq); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 2, inReportSeq); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/addReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 장애보고서 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/updateReportError.do") - public LinkedHashMap updateReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportErrorVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportErrorVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - String _atchFileId = reportErrorVo.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - List> fileList = new ArrayList(); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - - if (_atchFileId==null || "".equals(_atchFileId) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - reportErrorVo.setAtchFileId(_atchFileId); - reportErrorVo.setAtchFileInUpGb("I"); // 새로만들기 - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); - reportErrorVo.setAtchFileInUpGb("U"); // 기존자료변경 - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inReportSeq" , reportErrorVo.getInReportSeq() ); - reqApprovalMap.put("inUserSeq" , reportErrorVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 메일/카톡 처리 - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(2, 2, CommonUtil.zeroConvert(reportErrorVo.getInReportSeq()) ); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(reportErrorVo.getInReportSeq()) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/updateReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 장애보고서 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/deleteReportError.do") - public LinkedHashMap deleteReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/deleteReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /srm/deleteReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 장애보고서 승인요청 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/procApprovalReportError.do") - public LinkedHashMap procApprovalReportError( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 장애보고서 승인 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/approvalReportError.do") - public LinkedHashMap approvalReportError( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/approvalReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); - - log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); - - // - if(returnMap.get("resultCd").equals("0")) - { - // 승인완료 - if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) - { - commonService.sendReportMail(4, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - // 다음승인 - else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - - log.info("<<<<<<<<<<<<<<< /srm/approvalReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 장애보고서 반려 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value="/srm/rejectReportError.do") - public LinkedHashMap rejectReportError( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/rejectReportError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportError.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - // 메일/카톡 처리 - try - { - String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); - - // - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(5, 2, CommonUtil.zeroConvert(strInReportSeq) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/rejectReportError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 서비스 정보 결재라인 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value = "/srm/getSvcApprovalListError.do") - public LinkedHashMap getSvcApprovalListError( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - //** 서비스 상세조회 Start -------------------- // - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListError.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - List> resultApprovals = (List>)returnMap.get("resultList"); - // RestApi Call End --------------------------------- - //** 서비스 상세조회 End -------------------- // - - resBody.put("resultApprovals" , resultApprovals ); - - log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 양식 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.25 - */ - @ResponseBody - @RequestMapping(value = "/srm/getReportFormError.do") - public LinkedHashMap getReportFormError( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportFormError.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormError.do"); - // RestApi Call End --------------------------------- - - // 2025.05.21 나혁제 작업자 정보 추가 - // 결과값 추출 Start --------------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); - String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); - String strInTaskUser = (String)resultMap.get("inTaskUser"); - String strVcTaskUser = (String)resultMap.get("vcTaskUser"); - - resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); - resBody.put("strInTaskUser" , strInTaskUser ); - resBody.put("strVcTaskUser" , strVcTaskUser ); - - /* - // 결과값 추출 Start --------------------------------- - String resultStr = (String)returnMap.get("resultStr"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); - - resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); - */ - - log.info("<<<<<<<<<<<<<<< /srm/getReportFormError.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - -} +package com.urpsys.itmsfront.srm.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.srm.domain.ReportErrorListVo; +import com.urpsys.itmsfront.srm.domain.ReportErrorVo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 장애보고서 관련 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.02.25 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.25   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ReportErrorController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 장애보고서 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @RequestMapping("/srm/searchReportError.do") + public String searchReportError( @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/searchReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportError.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /srm/searchReportError.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportErrorList"; + } + + /** + * 장애보고서 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @RequestMapping(value = "/srm/getReportWithBodyError.do") + public String getReportWithBodyError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo + , @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportError = (Map)returnMap.get("resultReportError"); + + // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 + if(resultReportError == null) + { + model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); + return "forward:/srm/searchReportError.do"; + } + + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportError.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportError.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportError ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyError.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportErrorDetail"; + } + + /** + * 장애보고서 인쇄 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @RequestMapping(value = "/srm/getReportWithBodyErrorPrint.do") + public String getReportWithBodyErrorPrint( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo + , @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyErrorPrint.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportError = (Map)returnMap.get("resultReportError"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportError.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportError.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportError ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyErrorPrint.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/srm/ReportErrorPrintPop"; + } + + /** + * 장애보고서 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @RequestMapping(value = "/srm/insertViewReportError.do") + public String insertViewReportError( @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertViewReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 서비스 정보 추출 + bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + Map resultTaskMap = (Map)returnMap.get("resultTask"); + Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 + model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + // 인스던트 정보가 없는경우 0 으로 세팅 + if(resultIncident.get("inIncidentSeq") == null) + { + model.addAttribute("inIncidentSeq", 0 ); + } + else + { + model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); + } + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/insertViewReportError.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportErrorInsert"; + } + + /** + * 장애보고서 수정 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @RequestMapping(value = "/srm/updateViewReportError.do") + public String updateViewReportError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo + , @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateViewReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportError = (Map)returnMap.get("resultReportError"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportError.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportError.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportError ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/updateViewReportError.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportErrorUpdate"; + } + + /** + * 보고서 새로만들기 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.22 + */ + @RequestMapping(value = "/srm/insertCopyViewReportError.do") + public String insertCopyViewReportError( @ModelAttribute("ReportErrorListVo") ReportErrorListVo reportErrorListVo + , @ModelAttribute("searchVO") ReportErrorListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportErrorListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyError.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportError = (Map)returnMap.get("resultReportError"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportError.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportError.put("txReportBody", strReportBodyDec); + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportError ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportError.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + model.addAttribute("inIncidentSeq", 0 ); + + log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportError.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportErrorCopyInsert"; + } + + + /** + * 장애보고서 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/addReportError.do") + public LinkedHashMap addReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/addReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportErrorVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportErrorVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + reportErrorVo.setAtchFileId(_atchFileId); + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO fileVo : _result) + { + log.info("file fileVo : {}", fileVo.toString()); + + Map fileMap = ConvertUtils.convertToMap(fileVo); + + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inUserSeq" , reportErrorVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(1, 2, inReportSeq); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 2, inReportSeq); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/addReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 장애보고서 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/updateReportError.do") + public LinkedHashMap updateReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportErrorVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportErrorVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + String _atchFileId = reportErrorVo.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + List> fileList = new ArrayList(); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + + if (_atchFileId==null || "".equals(_atchFileId) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + reportErrorVo.setAtchFileId(_atchFileId); + reportErrorVo.setAtchFileInUpGb("I"); // 새로만들기 + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); + reportErrorVo.setAtchFileInUpGb("U"); // 기존자료변경 + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inReportSeq" , reportErrorVo.getInReportSeq() ); + reqApprovalMap.put("inUserSeq" , reportErrorVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 메일/카톡 처리 + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(2, 2, CommonUtil.zeroConvert(reportErrorVo.getInReportSeq()) ); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(reportErrorVo.getInReportSeq()) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/updateReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 장애보고서 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/deleteReportError.do") + public LinkedHashMap deleteReportError( final @ModelAttribute("reportErrorVo") ReportErrorVo reportErrorVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/deleteReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportErrorVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /srm/deleteReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 장애보고서 승인요청 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/procApprovalReportError.do") + public LinkedHashMap procApprovalReportError( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 장애보고서 승인 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/approvalReportError.do") + public LinkedHashMap approvalReportError( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/approvalReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); + + log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); + + // + if(returnMap.get("resultCd").equals("0")) + { + // 승인완료 + if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) + { + commonService.sendReportMail(4, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + // 다음승인 + else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + + log.info("<<<<<<<<<<<<<<< /srm/approvalReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 장애보고서 반려 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value="/srm/rejectReportError.do") + public LinkedHashMap rejectReportError( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/rejectReportError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportError.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + // 메일/카톡 처리 + try + { + String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); + + // + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(5, 2, CommonUtil.zeroConvert(strInReportSeq) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/rejectReportError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 서비스 정보 결재라인 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value = "/srm/getSvcApprovalListError.do") + public LinkedHashMap getSvcApprovalListError( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + //** 서비스 상세조회 Start -------------------- // + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListError.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + List> resultApprovals = (List>)returnMap.get("resultList"); + // RestApi Call End --------------------------------- + //** 서비스 상세조회 End -------------------- // + + resBody.put("resultApprovals" , resultApprovals ); + + log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 양식 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.25 + */ + @ResponseBody + @RequestMapping(value = "/srm/getReportFormError.do") + public LinkedHashMap getReportFormError( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportFormError.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormError.do"); + // RestApi Call End --------------------------------- + + // 2025.05.21 나혁제 작업자 정보 추가 + // 결과값 추출 Start --------------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); + String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); + String strInTaskUser = (String)resultMap.get("inTaskUser"); + String strVcTaskUser = (String)resultMap.get("vcTaskUser"); + + resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); + resBody.put("strInTaskUser" , strInTaskUser ); + resBody.put("strVcTaskUser" , strVcTaskUser ); + + /* + // 결과값 추출 Start --------------------------------- + String resultStr = (String)returnMap.get("resultStr"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); + + resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); + */ + + log.info("<<<<<<<<<<<<<<< /srm/getReportFormError.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportIssueController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportIssueController.java index ea5c07d6..e4ef38c1 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportIssueController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportIssueController.java @@ -1,1208 +1,1208 @@ -package com.urpsys.itmsfront.srm.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.srm.domain.ReportIssueListVo; -import com.urpsys.itmsfront.srm.domain.ReportIssueVo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 이슈보고서 관련 컨트롤러 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.02.26 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.26   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class ReportIssueController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 이슈보고서 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping("/srm/searchReportIssue.do") - public String searchReportIssue( @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/searchReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportIssue.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /srm/searchReportIssue.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportIssueList"; - } - - /** - * 이슈보고서 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping(value = "/srm/getReportWithBodyIssue.do") - public String getReportWithBodyIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo - , @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); - - // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 - if(resultReportIssue == null) - { - model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); - return "forward:/srm/searchReportIssue.do"; - } - - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportIssue.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportIssue.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportIssue ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyIssue.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportIssueDetail"; - } - - /** - * 이슈보고서 인쇄 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping(value = "/srm/getReportWithBodyIssuePrint.do") - public String getReportWithBodyIssuePrint( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo - , @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyIssuePrint.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strReportBody = (String)resultReportIssue.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportIssue.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportIssue ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - - log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyIssuePrint.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/srm/ReportIssuePrintPop"; - } - - /** - * 이슈보고서 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping(value = "/srm/insertViewReportIssue.do") - public String insertViewReportIssue( @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertViewReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 서비스 정보 추출 - bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - Map resultTaskMap = (Map)returnMap.get("resultTask"); - Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 - model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - // 인스던트 정보가 없는경우 0 으로 세팅 - if(resultIncident.get("inIncidentSeq") == null) - { - model.addAttribute("inIncidentSeq", 0 ); - } - else - { - model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); - } - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/insertViewReportIssue.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportIssueInsert"; - } - - /** - * 이슈보고서 수정 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @RequestMapping(value = "/srm/updateViewReportIssue.do") - public String updateViewReportIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo - , @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateViewReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportIssue.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportIssue.put("txReportBody", strReportBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportIssue ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/updateViewReportIssue.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportIssueUpdate"; - } - - /** - * 보고서 새로만들기 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.22 - */ - @RequestMapping(value = "/srm/insertCopyViewReportIssue.do") - public String insertCopyViewReportIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo - , @ModelAttribute("searchVO") ReportIssueListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inReportSeq", inReportSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultAssets = (List>)returnMap.get("resultAssets"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - String incidentId = (String)returnMap.get("incidentId"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("approvalReq [{}]", approvalReq); - // 결과값 추출 End --------------------------------- - - // 보고서 본문 복호화처리 - String strReportBody = (String)resultReportIssue.get("txReportBody"); - String strReportBodyDec = CommonUtil.base64decode(strReportBody); - - resultReportIssue.put("txReportBody", strReportBodyDec); - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("privType" , privType ); // String - model.addAttribute("incidentId" , incidentId ); // String - model.addAttribute("approvalReq" , approvalReq ); // int - - model.addAttribute("resultReport" , resultReportIssue ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultAssets" , resultAssets ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); - // RestApi Call End --------------------------------- - List> resultService = (List>)returnMap.get("resultService"); - List> resultForm = (List>)returnMap.get("resultForm"); - - model.addAttribute("resultService" , resultService ); // 서비스 정보 - model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 - - model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 - model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 - model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 - model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - model.addAttribute("inIncidentSeq", 0 ); - - log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportIssue.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/ReportIssueCopyInsert"; - } - - - - - - - - /** - * 이슈보고서 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/addReportIssue.do") - public LinkedHashMap addReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/addReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportIssueVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportIssueVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - reportIssueVo.setAtchFileId(_atchFileId); - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO fileVo : _result) - { - log.info("file fileVo : {}", fileVo.toString()); - - Map fileMap = ConvertUtils.convertToMap(fileVo); - - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inUserSeq" , reportIssueVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(1, 2, inReportSeq); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 2, inReportSeq); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/addReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 이슈보고서 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/updateReportIssue.do") - public LinkedHashMap updateReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 양식 암호화처리 - String strBody = reportIssueVo.getTxReportBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - reportIssueVo.setTxReportBody(strBodyEnc); - - // 자산 라인 Setting Start -----------// - String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); - String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); - - log.info("strAssetSeqs [{}]", strAssetSeqs); - log.info("strCommentAsset [{}]", strCommentAsset); - - String srAssetSeqs [] = strAssetSeqs .split(",", -1); - String srCommentAsset[] = strCommentAsset.split(",", -1); - - List> assetList = new ArrayList(); - - if(srAssetSeqs != null && srAssetSeqs.length > 0) - { - int iSeq=0; - for(int i=0; i mapAsset = new LinkedHashMap(); - - mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); - mapAsset.put("txComment" , srCommentAsset[i] ); - - assetList.add(mapAsset); - } - } - // 자산 라인 Setting End -----------// - - // 결재 라인 Setting Start -----------// - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - // 결재 라인 Setting End -----------// - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - String _atchFileId = reportIssueVo.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - List> fileList = new ArrayList(); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - - if (_atchFileId==null || "".equals(_atchFileId) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - reportIssueVo.setAtchFileId(_atchFileId); - reportIssueVo.setAtchFileInUpGb("I"); // 새로만들기 - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); - reportIssueVo.setAtchFileInUpGb("U"); // 기존자료변경 - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inReportSeq" , reportIssueVo.getInReportSeq() ); - reqApprovalMap.put("inUserSeq" , reportIssueVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); - bodyMap.put("assetList" , assetList); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 메일/카톡 처리 - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(2, 2, CommonUtil.zeroConvert(reportIssueVo.getInReportSeq()) ); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(reportIssueVo.getInReportSeq()) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/updateReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 이슈보고서 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/deleteReportIssue.do") - public LinkedHashMap deleteReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/deleteReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /srm/deleteReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 이슈보고서 승인요청 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/procApprovalReportIssue.do") - public LinkedHashMap procApprovalReportIssue( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 이슈보고서 승인 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/approvalReportIssue.do") - public LinkedHashMap approvalReportIssue( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/approvalReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); - - log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); - - // - if(returnMap.get("resultCd").equals("0")) - { - // 승인완료 - if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) - { - commonService.sendReportMail(4, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - // 다음승인 - else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) - { - commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/approvalReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 이슈보고서 반려 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value="/srm/rejectReportIssue.do") - public LinkedHashMap rejectReportIssue( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/rejectReportIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportIssue.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - // 메일/카톡 처리 - try - { - String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); - - // - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendReportMail(5, 2, CommonUtil.zeroConvert(strInReportSeq) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - - log.info("<<<<<<<<<<<<<<< /srm/rejectReportIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 서비스 정보 결재라인 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value = "/srm/getSvcApprovalListIssue.do") - public LinkedHashMap getSvcApprovalListIssue( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - //** 서비스 상세조회 Start -------------------- // - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - List> resultApprovals = (List>)returnMap.get("resultList"); - // RestApi Call End --------------------------------- - //** 서비스 상세조회 End -------------------- // - - resBody.put("resultApprovals" , resultApprovals ); - - log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 보고서 양식 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.26 - */ - @ResponseBody - @RequestMapping(value = "/srm/getReportFormIssue.do") - public LinkedHashMap getReportFormIssue( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getReportFormIssue.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap = requestMap; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormIssue.do"); - // RestApi Call End --------------------------------- - - // 2025.05.21 나혁제 작업자 정보 추가 - // 결과값 추출 Start --------------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); - String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); - String strInTaskUser = (String)resultMap.get("inTaskUser"); - String strVcTaskUser = (String)resultMap.get("vcTaskUser"); - - resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); - resBody.put("strInTaskUser" , strInTaskUser ); - resBody.put("strVcTaskUser" , strVcTaskUser ); - - /* - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormIssue.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - String resultStr = (String)returnMap.get("resultStr"); - // RestApi Call End --------------------------------- - - // 양식 복호화처리 - String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); - - resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); - */ - - log.info("<<<<<<<<<<<<<<< /srm/getReportFormIssue.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - -} +package com.urpsys.itmsfront.srm.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.srm.domain.ReportIssueListVo; +import com.urpsys.itmsfront.srm.domain.ReportIssueVo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 이슈보고서 관련 컨트롤러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.02.26 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.26   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class ReportIssueController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 이슈보고서 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping("/srm/searchReportIssue.do") + public String searchReportIssue( @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/searchReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchReportIssue.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /srm/searchReportIssue.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportIssueList"; + } + + /** + * 이슈보고서 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping(value = "/srm/getReportWithBodyIssue.do") + public String getReportWithBodyIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo + , @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); + + // 2025.11.20 나혁제 기본정보가 없는경우 목록 화면으로 이동 + if(resultReportIssue == null) + { + model.addAttribute("error_msg", "기본정보가 삭제되었습니다."); + return "forward:/srm/searchReportIssue.do"; + } + + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportIssue.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportIssue.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportIssue ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyIssue.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportIssueDetail"; + } + + /** + * 이슈보고서 인쇄 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping(value = "/srm/getReportWithBodyIssuePrint.do") + public String getReportWithBodyIssuePrint( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo + , @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportWithBodyIssuePrint.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strReportBody = (String)resultReportIssue.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportIssue.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportIssue ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + + log.info("<<<<<<<<<<<<<<< /srm/getReportWithBodyIssuePrint.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/srm/ReportIssuePrintPop"; + } + + /** + * 이슈보고서 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping(value = "/srm/insertViewReportIssue.do") + public String insertViewReportIssue( @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertViewReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 서비스 정보 추출 + bodyMap.put("inIncidentSeq", CommonUtil.getData(request, "inIncidentSeq")); + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + Map resultTaskMap = (Map)returnMap.get("resultTask"); + Map resultIncident = (Map)returnMap.get("resultIncident"); // 인스던트 정보 확인 + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultTaskMap" , resultTaskMap ); // 작업정보 + model.addAttribute("resultIncident" , resultIncident ); // 인스던트 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + // 인스던트 정보가 없는경우 0 으로 세팅 + if(resultIncident.get("inIncidentSeq") == null) + { + model.addAttribute("inIncidentSeq", 0 ); + } + else + { + model.addAttribute("inIncidentSeq", resultIncident.get("inIncidentSeq")); + } + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/insertViewReportIssue.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportIssueInsert"; + } + + /** + * 이슈보고서 수정 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @RequestMapping(value = "/srm/updateViewReportIssue.do") + public String updateViewReportIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo + , @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateViewReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportIssue.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportIssue.put("txReportBody", strReportBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportIssue ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/updateViewReportIssue.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportIssueUpdate"; + } + + /** + * 보고서 새로만들기 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.22 + */ + @RequestMapping(value = "/srm/insertCopyViewReportIssue.do") + public String insertCopyViewReportIssue( @ModelAttribute("ReportIssueListVo") ReportIssueListVo reportIssueListVo + , @ModelAttribute("searchVO") ReportIssueListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inReportSeq = CommonUtil.zeroConvert(reportIssueListVo.getInReportSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inReportSeq", inReportSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportWithBodyIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReportIssue = (Map)returnMap.get("resultReportIssue"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultAssets = (List>)returnMap.get("resultAssets"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + String incidentId = (String)returnMap.get("incidentId"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("approvalReq [{}]", approvalReq); + // 결과값 추출 End --------------------------------- + + // 보고서 본문 복호화처리 + String strReportBody = (String)resultReportIssue.get("txReportBody"); + String strReportBodyDec = CommonUtil.base64decode(strReportBody); + + resultReportIssue.put("txReportBody", strReportBodyDec); + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("privType" , privType ); // String + model.addAttribute("incidentId" , incidentId ); // String + model.addAttribute("approvalReq" , approvalReq ); // int + + model.addAttribute("resultReport" , resultReportIssue ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultAssets" , resultAssets ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getInitReportIssue.do"); + // RestApi Call End --------------------------------- + List> resultService = (List>)returnMap.get("resultService"); + List> resultForm = (List>)returnMap.get("resultForm"); + + model.addAttribute("resultService" , resultService ); // 서비스 정보 + model.addAttribute("resultForm" , resultForm ); // 보고서 양식 정보 + + model.addAttribute("dtDownstartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 시작일시 + model.addAttribute("dtDownfinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 종료일시 + model.addAttribute("dtStartDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운시작일시 + model.addAttribute("dtFinishDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 서비스다운종료일시 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId ()); // 접속자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접속자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + model.addAttribute("inIncidentSeq", 0 ); + + log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewReportIssue.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/ReportIssueCopyInsert"; + } + + + + + + + + /** + * 이슈보고서 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/addReportIssue.do") + public LinkedHashMap addReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/addReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportIssueVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportIssueVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + reportIssueVo.setAtchFileId(_atchFileId); + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO fileVo : _result) + { + log.info("file fileVo : {}", fileVo.toString()); + + Map fileMap = ConvertUtils.convertToMap(fileVo); + + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment") ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inUserSeq" , reportIssueVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addReportIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + int inReportSeq = Integer.parseInt((String)returnMap.get("inReportSeq")); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(1, 2, inReportSeq); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 2, inReportSeq); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/addReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 이슈보고서 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/updateReportIssue.do") + public LinkedHashMap updateReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 양식 암호화처리 + String strBody = reportIssueVo.getTxReportBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + reportIssueVo.setTxReportBody(strBodyEnc); + + // 자산 라인 Setting Start -----------// + String strAssetSeqs = CommonUtil.nvl(request.getParameter("assetSeqs" )); + String strCommentAsset = CommonUtil.nvl(request.getParameter("assetCommnets")); + + log.info("strAssetSeqs [{}]", strAssetSeqs); + log.info("strCommentAsset [{}]", strCommentAsset); + + String srAssetSeqs [] = strAssetSeqs .split(",", -1); + String srCommentAsset[] = strCommentAsset.split(",", -1); + + List> assetList = new ArrayList(); + + if(srAssetSeqs != null && srAssetSeqs.length > 0) + { + int iSeq=0; + for(int i=0; i mapAsset = new LinkedHashMap(); + + mapAsset.put("inAssetSeq" , srAssetSeqs [i] ); + mapAsset.put("txComment" , srCommentAsset[i] ); + + assetList.add(mapAsset); + } + } + // 자산 라인 Setting End -----------// + + // 결재 라인 Setting Start -----------// + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + // 결재 라인 Setting End -----------// + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + String _atchFileId = reportIssueVo.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + List> fileList = new ArrayList(); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + + if (_atchFileId==null || "".equals(_atchFileId) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + reportIssueVo.setAtchFileId(_atchFileId); + reportIssueVo.setAtchFileInUpGb("I"); // 새로만들기 + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); + reportIssueVo.setAtchFileInUpGb("U"); // 기존자료변경 + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqTxComment" ) ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inReportSeq" , reportIssueVo.getInReportSeq() ); + reqApprovalMap.put("inUserSeq" , reportIssueVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); + bodyMap.put("assetList" , assetList); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateReportIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 메일/카톡 처리 + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(2, 2, CommonUtil.zeroConvert(reportIssueVo.getInReportSeq()) ); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(reportIssueVo.getInReportSeq()) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/updateReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 이슈보고서 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/deleteReportIssue.do") + public LinkedHashMap deleteReportIssue( final @ModelAttribute("reportIssueVo") ReportIssueVo reportIssueVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/deleteReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("reportVo" , ConvertUtils.convertToMapAll(reportIssueVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteReportIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /srm/deleteReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 이슈보고서 승인요청 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/procApprovalReportIssue.do") + public LinkedHashMap procApprovalReportIssue( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/procApprovalReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalReportIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(CommonUtil.getData(request, "inReportSeq"))); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/procApprovalReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 이슈보고서 승인 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/approvalReportIssue.do") + public LinkedHashMap approvalReportIssue( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/approvalReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inReportSeq"); + + log.info("inReportStatus : [{}] ", returnMap.get("resultInReportStatus")); + + // + if(returnMap.get("resultCd").equals("0")) + { + // 승인완료 + if(CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 3) + { + commonService.sendReportMail(4, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + // 다음승인 + else if( CommonUtil.zeroConvert( returnMap.get("resultInReportStatus")) == 1) + { + commonService.sendReportMail(3, 2, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/approvalReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 이슈보고서 반려 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value="/srm/rejectReportIssue.do") + public LinkedHashMap rejectReportIssue( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/rejectReportIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inReportSeq" , CommonUtil.getData(request, "inReportSeq" ) ); + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectReportIssue.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + // 메일/카톡 처리 + try + { + String strInReportSeq = CommonUtil.getData(request, "inReportSeq"); + + // + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendReportMail(5, 2, CommonUtil.zeroConvert(strInReportSeq) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + + log.info("<<<<<<<<<<<<<<< /srm/rejectReportIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 서비스 정보 결재라인 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value = "/srm/getSvcApprovalListIssue.do") + public LinkedHashMap getSvcApprovalListIssue( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getSvcApprovalListIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + //** 서비스 상세조회 Start -------------------- // + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getSvcApprovalListIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + List> resultApprovals = (List>)returnMap.get("resultList"); + // RestApi Call End --------------------------------- + //** 서비스 상세조회 End -------------------- // + + resBody.put("resultApprovals" , resultApprovals ); + + log.info("<<<<<<<<<<<<<<< /srm/getSvcApprovalListIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 보고서 양식 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.26 + */ + @ResponseBody + @RequestMapping(value = "/srm/getReportFormIssue.do") + public LinkedHashMap getReportFormIssue( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getReportFormIssue.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap = requestMap; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormIssue.do"); + // RestApi Call End --------------------------------- + + // 2025.05.21 나혁제 작업자 정보 추가 + // 결과값 추출 Start --------------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + // String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); + String strTxDefaultFormDec = CommonUtil.base64decode((String)resultMap.get("txReportForm")); + String strInTaskUser = (String)resultMap.get("inTaskUser"); + String strVcTaskUser = (String)resultMap.get("vcTaskUser"); + + resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); + resBody.put("strInTaskUser" , strInTaskUser ); + resBody.put("strVcTaskUser" , strVcTaskUser ); + + /* + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReportFormIssue.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + String resultStr = (String)returnMap.get("resultStr"); + // RestApi Call End --------------------------------- + + // 양식 복호화처리 + String strTxDefaultFormDec = CommonUtil.base64decode(resultStr); + + resBody.put("strTxDefaultFormDec" , strTxDefaultFormDec ); + */ + + log.info("<<<<<<<<<<<<<<< /srm/getReportFormIssue.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportOtherController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportOtherController.java index dd773830..43bee873 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportOtherController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/ReportOtherController.java @@ -23,7 +23,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; +import com.urpsys.common.util.ConvertUtils; import com.urpsys.basefront.common.util.RestApiCallUtil; import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; import com.urpsys.basefront.common.service.CommonService; diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskController.java index ac4731ae..54edf5d5 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskController.java @@ -1,1220 +1,1220 @@ -package com.urpsys.itmsfront.srm.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.domain.FileVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.itmsfront.srm.domain.IncidentVo; -import com.urpsys.itmsfront.srm.domain.SvcDeskListVo; - -import lombok.extern.slf4j.Slf4j; - -/** - * 서비스 데스크 관련 컨트롤러 클래스 (게시판생성관리-enterprise) - * @author urp 인프라본부 나혁제 - * @since 2025.02.08 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.02.08   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class SvcDeskController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /* 파일처리 */ - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - CommonService commonService; - - /** - * 서비스 데스크 인스던트 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.08 - */ - // @PostMapping("/srm/searchIncident.do") - @RequestMapping("/srm/searchIncident.do") - public String searchIncident( @ModelAttribute("searchVO") SvcDeskListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/searchIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - if(searchVO.getComplete()==null || searchVO.getComplete().equals("")) searchVO.setComplete("0,1"); - if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchIncident.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /srm/searchIncident.do >>>>>>>>>>>>>>>"); - - // 2025.03.19 sms 테스트 - // restApiCallUtil.RestApiCallNaver(); - - - // 네이버 알림서빗 테스트 - - return "uritms-tiles2/srm/SvcDeskList"; - } - - /** - * 서비스 데스크 인스던트 상세조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.13 - */ - @RequestMapping(value = "/srm/getIncidentBySeq.do") - public String getIncidentBySeq( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo - , @ModelAttribute("searchVO") SvcDeskListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getIncidentBySeq.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inIncidentSeq", inIncidentSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultIncident = (Map)returnMap.get("resultIncident"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultReports = (List>)returnMap.get("resultReports"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - List> resultTransgers = (List>)returnMap.get("resultTransgers"); - List> resultCnList = (List>)returnMap.get("resultCnList"); // 2025.04.01 나혁제 댓글정보 추가 - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - int transfer_avail = (int)returnMap.get("transfer_avail"); - int editDifficulty = (int)returnMap.get("editDifficulty"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("transfer_avail [{}]", transfer_avail); - log.info("editDifficulty [{}]", editDifficulty); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strIncidentBody = (String)resultIncident.get("txIncidentBody"); - String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); - - resultIncident.put("txIncidentBody", strIncidentBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("transfer_avail" , transfer_avail ); // int - model.addAttribute("editDifficulty" , editDifficulty ); // int - model.addAttribute("approvalReq" , approvalReq ); // int - model.addAttribute("privType" , privType ); // String - - - log.info("111vcDevUser [{}]", resultIncident.get("vcDevUser")); - - model.addAttribute("resultIncident" , resultIncident ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultReports" , resultReports ); // List 연결보고서 - model.addAttribute("resultApprovals" , resultApprovals ); // List 결재라인 - model.addAttribute("resultTransgers" , resultTransgers ); // List - model.addAttribute("resultCnList" , resultCnList ); // List 2025.04.01 나혁제 댓글정보 - - log.info("<<<<<<<<<<<<<<< /srm/getIncidentBySeq.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/SvcDeskDetail"; - } - - /** - * 서비스 데스크 인스던트 인쇄 화면 오픈 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.15 - */ - @RequestMapping(value = "/srm/getIncidentBySeqPrint.do") - public String getIncidentBySeqPrint( HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getIncidentBySeqPrint.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inIncidentSeq = CommonUtil.zeroConvert(CommonUtil.getData(request, "inIncidentSeq")); - - // Body Setting Start --------------------------------- - bodyMap.put("inIncidentSeq", inIncidentSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultIncident = (Map)returnMap.get("resultIncident"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultReports = (List>)returnMap.get("resultReports"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - List> resultTransgers = (List>)returnMap.get("resultTransgers"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - int transfer_avail = (int)returnMap.get("transfer_avail"); - int editDifficulty = (int)returnMap.get("editDifficulty"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("transfer_avail [{}]", transfer_avail); - log.info("editDifficulty [{}]", editDifficulty); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strIncidentBody = (String)resultIncident.get("txIncidentBody"); - String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); - - resultIncident.put("txIncidentBody", strIncidentBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("transfer_avail" , transfer_avail ); // int - model.addAttribute("editDifficulty" , editDifficulty ); // int - model.addAttribute("approvalReq" , approvalReq ); // int - model.addAttribute("privType" , privType ); // String - - model.addAttribute("resultIncident" , resultIncident ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultReports" , resultReports ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - model.addAttribute("resultTransgers" , resultTransgers ); // List - - log.info("<<<<<<<<<<<<<<< /srm/getIncidentBySeqPrint.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/srm/SvcDeskPrintPop"; - } - - - /** - * 서비스 데스크 인스던트 등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.13 - */ - // @RequestMapping(value = "/srm/insertViewIncident.do") - @PostMapping(value = "/srm/insertViewIncident.do") - public String insertViewIncident( @ModelAttribute("searchVO") SvcDeskListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertViewIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); - // RestApi Call End --------------------------------- - List> resultList = (List>)returnMap.get("resultList"); - - model.addAttribute("serviceList", resultList); // 서비스 정보 - - String strReqIncidentNum = CommonUtil.nvl(request.getParameter("vcReqIncidentNum" )); - - // 출력데이터 - String dtReqDatetime = ""; - - // 2025.12.17 나혁제 신청화면에서 오는 경우 - if(!strReqIncidentNum.equals("")) - { - // Body Setting Start --------------------------------- - bodyMap.put("vcReqIncidentNum", strReqIncidentNum); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReqIncidentBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultReqIncident = (Map)returnMap.get("resultReqIncident"); - // RestApi Call End --------------------------------- - - // 조치예정일일 - dtReqDatetime = CommonUtil.nvl(resultReqIncident.get("dtCompleteReqDateTime")); - // 첨부파일 - String strRegAtchFileId = CommonUtil.nvl(resultReqIncident.get("atchFileId")); - // 서비스코드 - String strInServiceCode = CommonUtil.nvl(resultReqIncident.get("inServiceCode")); - - // 인스던트 본문 복호화처리 - String strIncidentBody = (String)resultReqIncident.get("txIncidentBody"); - String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); - - model.addAttribute("reqTxIncidentBody" , strIncidentBodyDec ); // 본문내용 - model.addAttribute("reqAtchFileId" , strRegAtchFileId ); // 신청첨부파일 - model.addAttribute("reqInServiceCode" , strInServiceCode ); // 서비스코드 - model.addAttribute("reqVcIncidentTitle" , CommonUtil.nvl(resultReqIncident.get("vcIncidentTitle")) ); // 제목 - - model.addAttribute("reqInChargeUser", CommonUtil.nvl(resultReqIncident.get("inChargeUser")) ); // 조치예정자 ID - model.addAttribute("reqVcChargeUser", CommonUtil.nvl(resultReqIncident.get("vcChargeUser")) ); // 조치예정자 명 - - model.addAttribute("reqRptRejTxComment", CommonUtil.nvl(request.getParameter("reqRptRejTxComment")) ); // 접수의견 - } - else - { - dtReqDatetime = CommonUtil.getDatewithSpan(CommonUtil.getKST("yyyyMMddHHmm"), 7, "D", "yyyy-MM-dd HH:mm"); - } - - log.info(" dtReqDatetime [{}]", dtReqDatetime); - - model.addAttribute("dtReceiptDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 접수일시 - model.addAttribute("dtReqDatetime" , dtReqDatetime); // 완료요청일시는 7일 이후 - model.addAttribute("vcReqIncidentNum" , strReqIncidentNum); // 신청번호 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId()); // 접수자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접수자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/insertViewIncident.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/SvcDeskInsert"; - } - - /** - * 서비스 데스크 인스던트 수정 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.13 - */ - // 2025.11.19 나혁제 호출방식 변경 - // @RequestMapping(value = "/srm/updateViewIncident.do") - @PostMapping(value = "/srm/updateViewIncident.do") - public String updateViewIncident( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo - , @ModelAttribute("searchVO") SvcDeskListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateViewIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inIncidentSeq", inIncidentSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultIncident = (Map)returnMap.get("resultIncident"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultReports = (List>)returnMap.get("resultReports"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - List> resultTransgers = (List>)returnMap.get("resultTransgers"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - - int transfer_avail = (int)returnMap.get("transfer_avail"); - int editDifficulty = (int)returnMap.get("editDifficulty"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("transfer_avail [{}]", transfer_avail); - log.info("editDifficulty [{}]", editDifficulty); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strIncidentBody = (String)resultIncident.get("txIncidentBody"); - String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); - - resultIncident.put("txIncidentBody", strIncidentBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("transfer_avail" , transfer_avail ); // int - model.addAttribute("editDifficulty" , editDifficulty ); // int - model.addAttribute("approvalReq" , approvalReq ); // int - model.addAttribute("privType" , privType ); // String - - model.addAttribute("resultIncident" , resultIncident ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultReports" , resultReports ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - model.addAttribute("resultTransgers" , resultTransgers ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); - // RestApi Call End --------------------------------- - List> resultList = (List>)returnMap.get("resultList"); - - model.addAttribute("serviceList", resultList); // 서비스 정보 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/updateViewIncident.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/SvcDeskUpdate"; - } - - /** - * 서비스 데스크 인스던트 새로만들기 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2026.01.21 - */ - @PostMapping(value = "/srm/insertCopyViewIncident.do") - public String insertCopyViewIncident( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo - , @ModelAttribute("searchVO") SvcDeskListVo searchVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); - - // Body Setting Start --------------------------------- - bodyMap.put("inIncidentSeq", inIncidentSeq); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultIncident = (Map)returnMap.get("resultIncident"); - List> resultSharings = (List>)returnMap.get("resultSharings"); - List> resultReports = (List>)returnMap.get("resultReports"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - List> resultTransgers = (List>)returnMap.get("resultTransgers"); - - String sharingTxt = (String)returnMap.get("sharingTxt"); - String privType = (String)returnMap.get("privType"); - - int transfer_avail = (int)returnMap.get("transfer_avail"); - int editDifficulty = (int)returnMap.get("editDifficulty"); - int approvalReq = (int)returnMap.get("approvalReq"); - - log.info("sharingTxt [{}]", sharingTxt); - log.info("privType [{}]", privType); - log.info("transfer_avail [{}]", transfer_avail); - log.info("editDifficulty [{}]", editDifficulty); - log.info("approvalReq [{}]", approvalReq); - - // RestApi Call End --------------------------------- - - // 인스던트 본문 복호화처리 - String strIncidentBody = (String)resultIncident.get("txIncidentBody"); - String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); - - resultIncident.put("txIncidentBody", strIncidentBodyDec); - - model.addAttribute("sharingTxt" , sharingTxt ); // String - model.addAttribute("transfer_avail" , transfer_avail ); // int - model.addAttribute("editDifficulty" , editDifficulty ); // int - model.addAttribute("approvalReq" , approvalReq ); // int - model.addAttribute("privType" , privType ); // String - - model.addAttribute("resultIncident" , resultIncident ); // Map - model.addAttribute("resultSharings" , resultSharings ); // List - model.addAttribute("resultReports" , resultReports ); // List - model.addAttribute("resultApprovals" , resultApprovals ); // List - model.addAttribute("resultTransgers" , resultTransgers ); // List - - // 서비스 정보 추출 - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); - // RestApi Call End --------------------------------- - List> resultList = (List>)returnMap.get("resultList"); - - model.addAttribute("serviceList", resultList); // 서비스 정보 - - String dtReqDatetime = CommonUtil.getDatewithSpan(CommonUtil.getKST("yyyyMMddHHmm"), 7, "D", "yyyy-MM-dd HH:mm"); - - model.addAttribute("dtReceiptDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 접수일시 - model.addAttribute("dtReqDatetime" , dtReqDatetime); // 완료요청일시는 7일 이후 - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - model.addAttribute("inRegUser", tokenInfo.getUniqId()); // 접수자ID - model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접수자명 - - // 2025.12.03 나혁제 파일체크 로직 추가 - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewIncident.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/srm/SvcDeskCopyInsert"; - } - - - - - - - - - - - - - - - - /** - * 서비스데스크 인스던트 등록 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.13 - */ - @ResponseBody - @RequestMapping(value="/srm/addIncident.do") - public LinkedHashMap addIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/addIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - log.info("reqRptRejTxComment [{}]", incidentVo.getReqRptRejTxComment()); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - - // 양식 암호화처리 - String strBody = incidentVo.getTxIncidentBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - incidentVo.setTxIncidentBody(strBodyEnc); - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - List _result = null; - String _atchFileId = ""; - - final List files = multiRequest.getFiles("file_1"); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); - _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. - - incidentVo.setAtchFileId(_atchFileId); - } - - List> fileList = new ArrayList(); - - // 파일저장 정보 세팅 - if(_result != null) - { - for(FileVO fileVo : _result) - { - log.info("file fileVo : {}", fileVo.toString()); - - Map fileMap = ConvertUtils.convertToMap(fileVo); - - fileList.add(fileMap); - } - } - // 첨부파일 Setting End **********************/ - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "txComment" ) ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inUserSeq" , incidentVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendIncidentMail(1, (int)returnMap.get("inIncidentSeq")); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendIncidentMail(3, (int)returnMap.get("inIncidentSeq")); - } - - log.info("<<<<<<<<<<<<<<< /srm/addIncident.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 서비스데스크 인스던트 수정 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.14 - */ - @ResponseBody - @RequestMapping(value="/srm/updateIncident.do") - public LinkedHashMap updateIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/updateIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); - String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); - - log.info("strApprovalsId [{}]", strApprovalsId); - log.info("strApprovalsName [{}]", strApprovalsName); - - String srApprovalsId[] = strApprovalsId.split(","); - String srApprovalsName[] = strApprovalsName.split(","); - - List> approvalsList = new ArrayList(); - - if(srApprovalsId != null && srApprovalsId.length > 0) - { - int iSeq=0; - for(int i=0; i mapApp = new LinkedHashMap(); - - mapApp.put("idx" , iSeq++ ); - mapApp.put("inUserSeq" , srApprovalsId [i] ); - mapApp.put("vcUserName" , srApprovalsName[i] ); - - approvalsList.add(mapApp); - } - } - - // 양식 암호화처리 - String strBody = incidentVo.getTxIncidentBody(); - String strBodyEnc = CommonUtil.base64encode(strBody); - - log.info("strBody [{}]", strBody); - log.info("strBodyEnc [{}]", strBodyEnc); - - incidentVo.setTxIncidentBody(strBodyEnc); - - - // 첨부파일 Setting Start ********************** / - // 첨부파일 관련 첨부파일ID 생성 - String _atchFileId = incidentVo.getAtchFileId(); - final List files = multiRequest.getFiles("file_1"); - - List> fileList = new ArrayList(); - - if ( (!files.isEmpty()) - && (files.get(0).getSize()>0) ) - { - List _result = null; - - if (_atchFileId==null || "".equals(_atchFileId) ) - { - _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); - _atchFileId = _result.get(0).getAtchFileId(); - - incidentVo.setAtchFileId(_atchFileId); - incidentVo.setAtchFileInUpGb("I"); // 새로만들기 - } - else - { - FileVO fvo = new FileVO(); - fvo.setAtchFileId(_atchFileId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(fvo); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); - // RestApi Call End --------------------------------- - - int _cnt = (int)returnMap.get("result"); - - _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); - incidentVo.setAtchFileInUpGb("U"); // 기존자료변경 - } - - // 파일저장 정보 세팅 - for(FileVO inMap : _result) - { - Map fileMap = ConvertUtils.convertToMap(inMap); - fileList.add(fileMap); - } - } - // 첨부파일 Setting End ********************** / - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "txComment" ) ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inIncidentSeq" , incidentVo.getInIncidentSeq() ); - reqApprovalMap.put("inUserSeq" , incidentVo.getInRegUser() ); - // 승인요청 정보 Setting End ****************** / - - - // Body Setting Start --------------------------------- - bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); - bodyMap.put("approvalsList" , approvalsList); - bodyMap.put("fileList" , fileList); - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); - - // 접수처리 메일처리 - if(returnMap.get("resultCd").equals("0")) - { - commonService.sendIncidentMail(2, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); - } - - // 승인요청 메일처리 - if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) - { - commonService.sendIncidentMail(3, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - - log.info("<<<<<<<<<<<<<<< /rem/updateIncident.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 서비스데스크 인스던트 삭제 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.24 - */ - @ResponseBody - @RequestMapping(value="/srm/deleteIncident.do") - public LinkedHashMap deleteIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/deleteIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // Body Setting Start --------------------------------- - bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - log.info("<<<<<<<<<<<<<<< /srm/deleteIncident.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 서비스데스크 인스던트 승인요청 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.24 - */ - @ResponseBody - @RequestMapping(value="/srm/procApprovalIncident.do") - public LinkedHashMap procApprovalIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo - , final MultipartHttpServletRequest multiRequest - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/procApprovalIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 접속자정보 - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - // 승인요청 정보 Setting Start ****************** / - Map reqApprovalMap = new LinkedHashMap(); - - reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); - reqApprovalMap.put("inIncidentSeq" , incidentVo.getInIncidentSeq() ); - reqApprovalMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // 승인요청 정보 Setting End ****************** / - - // Body Setting Start --------------------------------- - bodyMap.put("reqApprovalMap" , reqApprovalMap); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - // 승인요청 메일처리 - try - { - if(returnMap.get("resultCd").equals("0") ) - { - commonService.sendIncidentMail(3, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/procApprovalIncident.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - /** - * 서비스데스크 인스던트 처리완료 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.15 - */ - @ResponseBody - @RequestMapping(value="/srm/completedIncident.do") - public LinkedHashMap completedIncident( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/completedIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // completed 정보 세팅 - LinkedHashMap completed = new LinkedHashMap(); - - completed.put("inUserSeq" , tokenInfo.getUniqId()); - completed.put("dtCompleteDatetime" , CommonUtil.getData(request, "dtCompleteDatetime" )); - completed.put("dtServiceStartDatetime" , CommonUtil.getData(request, "dtServiceStartDatetime")); - completed.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment" )); - completed.put("inDifficulty" , CommonUtil.getData(request, "inDifficulty" )); - completed.put("inSatisfaction" , CommonUtil.getData(request, "inSatisfaction" )); - completed.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" )); - - // 2025.04.17 나혁제 조치자 처리 - completed.put("inDevUser", tokenInfo.getStrESNTL_ID()); - completed.put("vcDevUser", tokenInfo.getUserName()); - - // Body Setting Start --------------------------------- - bodyMap.put("completed" , completed); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/completedIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); - commonService.sendIncidentMail(6, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/completedIncident.do >>>>>>>>>>>>>>>"); - - - return resBody; - } - - /** - * 인스던트 승인 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.24 - */ - @ResponseBody - @RequestMapping(value="/srm/approvalIncident.do") - public LinkedHashMap approvalIncident( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/ApprovalIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" ) ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/approvalIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); - - log.info("inIncidentStatus : [{}] ", returnMap.get("resultIncidentStatus")); - - // 승인완료 - if(CommonUtil.zeroConvert( returnMap.get("resultIncidentStatus")) == 3) - { - commonService.sendIncidentMail(4, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - // 다음승인 - else if( CommonUtil.zeroConvert( returnMap.get("resultIncidentStatus")) == 1) - { - commonService.sendIncidentMail(3, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - - log.info("<<<<<<<<<<<<<<< /srm/approvalIncident.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - /** - * 인스던트 반려 처리를 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.24 - */ - @ResponseBody - @RequestMapping(value="/srm/rejectIncident.do") - public LinkedHashMap rejectIncident( HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/rejectIncident.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - TokenInfo tokenInfo = CommonUtil.getTokenInfo(); - - // Body Setting Start --------------------------------- - bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); - bodyMap.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" ) ); - bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 - bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectIncident.do"); - // RestApi Call End --------------------------------- - - resBody.put("resultCd" , returnMap.get("resultCd") ); - resBody.put("resultMsg" , returnMap.get("resultMsg") ); - - try - { - String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); - - commonService.sendIncidentMail(5, CommonUtil.zeroConvert(strInIcidentSeq) ); - } - catch(Exception e) - { - e.printStackTrace(); - } - - - log.info("<<<<<<<<<<<<<<< /srm/rejectIncident.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - /** - * 서비스 정보 상세 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.02.13 - */ - @ResponseBody - @RequestMapping(value = "/srm/getIncidentForm.do") - public LinkedHashMap getServiceBySeq( @RequestBody LinkedHashMap requestMap - , HttpServletRequest request - , HttpServletResponse response ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /srm/getIncidentForm.do <<<<<<<<<<<<<<<"); - - // api in/out map 정의 - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // return 처리 - LinkedHashMap resBody = new LinkedHashMap(); // Response Map - - //** 서비스 상세조회 Start -------------------- // - // Body Setting Start --------------------------------- - bodyMap = requestMap; ; - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentForm.do"); - // RestApi Call End --------------------------------- - - // 결과값 추출 Start --------------------------------- - Map resultService = (Map)returnMap.get("resultService"); - List> resultApprovals = (List>)returnMap.get("resultApprovals"); - // RestApi Call End --------------------------------- - //** 자산상세조회 End -------------------- // - - // 양식 복호화처리 - String strTxDefaultForm = (String)resultService.get("txDefaultForm"); - String strTxDefaultFormDec = CommonUtil.base64decode(strTxDefaultForm); - - resultService.put("txDefaultForm", strTxDefaultFormDec); - - resBody.put("resultService" , resultService ); - resBody.put("resultApprovals" , resultApprovals ); - - log.info("<<<<<<<<<<<<<<< /srm/getIncidentForm.do >>>>>>>>>>>>>>>"); - - return resBody; - } - - - - - - - - - -} +package com.urpsys.itmsfront.srm.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.domain.FileVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.itmsfront.srm.domain.IncidentVo; +import com.urpsys.itmsfront.srm.domain.SvcDeskListVo; + +import lombok.extern.slf4j.Slf4j; + +/** + * 서비스 데스크 관련 컨트롤러 클래스 (게시판생성관리-enterprise) + * @author urp 인프라본부 나혁제 + * @since 2025.02.08 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.02.08   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class SvcDeskController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /* 파일처리 */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + CommonService commonService; + + /** + * 서비스 데스크 인스던트 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.08 + */ + // @PostMapping("/srm/searchIncident.do") + @RequestMapping("/srm/searchIncident.do") + public String searchIncident( @ModelAttribute("searchVO") SvcDeskListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/searchIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex(paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + if(searchVO.getComplete()==null || searchVO.getComplete().equals("")) searchVO.setComplete("0,1"); + if(searchVO.getStatus ()==null || searchVO.getStatus() .equals("")) searchVO.setStatus("0,1,2,3"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/searchIncident.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /srm/searchIncident.do >>>>>>>>>>>>>>>"); + + // 2025.03.19 sms 테스트 + // restApiCallUtil.RestApiCallNaver(); + + + // 네이버 알림서빗 테스트 + + return "uritms-tiles2/srm/SvcDeskList"; + } + + /** + * 서비스 데스크 인스던트 상세조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.13 + */ + @RequestMapping(value = "/srm/getIncidentBySeq.do") + public String getIncidentBySeq( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo + , @ModelAttribute("searchVO") SvcDeskListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getIncidentBySeq.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inIncidentSeq", inIncidentSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultIncident = (Map)returnMap.get("resultIncident"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultReports = (List>)returnMap.get("resultReports"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + List> resultTransgers = (List>)returnMap.get("resultTransgers"); + List> resultCnList = (List>)returnMap.get("resultCnList"); // 2025.04.01 나혁제 댓글정보 추가 + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + int transfer_avail = (int)returnMap.get("transfer_avail"); + int editDifficulty = (int)returnMap.get("editDifficulty"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("transfer_avail [{}]", transfer_avail); + log.info("editDifficulty [{}]", editDifficulty); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strIncidentBody = (String)resultIncident.get("txIncidentBody"); + String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); + + resultIncident.put("txIncidentBody", strIncidentBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("transfer_avail" , transfer_avail ); // int + model.addAttribute("editDifficulty" , editDifficulty ); // int + model.addAttribute("approvalReq" , approvalReq ); // int + model.addAttribute("privType" , privType ); // String + + + log.info("111vcDevUser [{}]", resultIncident.get("vcDevUser")); + + model.addAttribute("resultIncident" , resultIncident ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultReports" , resultReports ); // List 연결보고서 + model.addAttribute("resultApprovals" , resultApprovals ); // List 결재라인 + model.addAttribute("resultTransgers" , resultTransgers ); // List + model.addAttribute("resultCnList" , resultCnList ); // List 2025.04.01 나혁제 댓글정보 + + log.info("<<<<<<<<<<<<<<< /srm/getIncidentBySeq.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/SvcDeskDetail"; + } + + /** + * 서비스 데스크 인스던트 인쇄 화면 오픈 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.15 + */ + @RequestMapping(value = "/srm/getIncidentBySeqPrint.do") + public String getIncidentBySeqPrint( HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getIncidentBySeqPrint.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inIncidentSeq = CommonUtil.zeroConvert(CommonUtil.getData(request, "inIncidentSeq")); + + // Body Setting Start --------------------------------- + bodyMap.put("inIncidentSeq", inIncidentSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultIncident = (Map)returnMap.get("resultIncident"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultReports = (List>)returnMap.get("resultReports"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + List> resultTransgers = (List>)returnMap.get("resultTransgers"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + int transfer_avail = (int)returnMap.get("transfer_avail"); + int editDifficulty = (int)returnMap.get("editDifficulty"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("transfer_avail [{}]", transfer_avail); + log.info("editDifficulty [{}]", editDifficulty); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strIncidentBody = (String)resultIncident.get("txIncidentBody"); + String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); + + resultIncident.put("txIncidentBody", strIncidentBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("transfer_avail" , transfer_avail ); // int + model.addAttribute("editDifficulty" , editDifficulty ); // int + model.addAttribute("approvalReq" , approvalReq ); // int + model.addAttribute("privType" , privType ); // String + + model.addAttribute("resultIncident" , resultIncident ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultReports" , resultReports ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + model.addAttribute("resultTransgers" , resultTransgers ); // List + + log.info("<<<<<<<<<<<<<<< /srm/getIncidentBySeqPrint.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/srm/SvcDeskPrintPop"; + } + + + /** + * 서비스 데스크 인스던트 등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.13 + */ + // @RequestMapping(value = "/srm/insertViewIncident.do") + @PostMapping(value = "/srm/insertViewIncident.do") + public String insertViewIncident( @ModelAttribute("searchVO") SvcDeskListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertViewIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); + // RestApi Call End --------------------------------- + List> resultList = (List>)returnMap.get("resultList"); + + model.addAttribute("serviceList", resultList); // 서비스 정보 + + String strReqIncidentNum = CommonUtil.nvl(request.getParameter("vcReqIncidentNum" )); + + // 출력데이터 + String dtReqDatetime = ""; + + // 2025.12.17 나혁제 신청화면에서 오는 경우 + if(!strReqIncidentNum.equals("")) + { + // Body Setting Start --------------------------------- + bodyMap.put("vcReqIncidentNum", strReqIncidentNum); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getReqIncidentBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultReqIncident = (Map)returnMap.get("resultReqIncident"); + // RestApi Call End --------------------------------- + + // 조치예정일일 + dtReqDatetime = CommonUtil.nvl(resultReqIncident.get("dtCompleteReqDateTime")); + // 첨부파일 + String strRegAtchFileId = CommonUtil.nvl(resultReqIncident.get("atchFileId")); + // 서비스코드 + String strInServiceCode = CommonUtil.nvl(resultReqIncident.get("inServiceCode")); + + // 인스던트 본문 복호화처리 + String strIncidentBody = (String)resultReqIncident.get("txIncidentBody"); + String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); + + model.addAttribute("reqTxIncidentBody" , strIncidentBodyDec ); // 본문내용 + model.addAttribute("reqAtchFileId" , strRegAtchFileId ); // 신청첨부파일 + model.addAttribute("reqInServiceCode" , strInServiceCode ); // 서비스코드 + model.addAttribute("reqVcIncidentTitle" , CommonUtil.nvl(resultReqIncident.get("vcIncidentTitle")) ); // 제목 + + model.addAttribute("reqInChargeUser", CommonUtil.nvl(resultReqIncident.get("inChargeUser")) ); // 조치예정자 ID + model.addAttribute("reqVcChargeUser", CommonUtil.nvl(resultReqIncident.get("vcChargeUser")) ); // 조치예정자 명 + + model.addAttribute("reqRptRejTxComment", CommonUtil.nvl(request.getParameter("reqRptRejTxComment")) ); // 접수의견 + } + else + { + dtReqDatetime = CommonUtil.getDatewithSpan(CommonUtil.getKST("yyyyMMddHHmm"), 7, "D", "yyyy-MM-dd HH:mm"); + } + + log.info(" dtReqDatetime [{}]", dtReqDatetime); + + model.addAttribute("dtReceiptDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 접수일시 + model.addAttribute("dtReqDatetime" , dtReqDatetime); // 완료요청일시는 7일 이후 + model.addAttribute("vcReqIncidentNum" , strReqIncidentNum); // 신청번호 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId()); // 접수자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접수자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/insertViewIncident.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/SvcDeskInsert"; + } + + /** + * 서비스 데스크 인스던트 수정 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.13 + */ + // 2025.11.19 나혁제 호출방식 변경 + // @RequestMapping(value = "/srm/updateViewIncident.do") + @PostMapping(value = "/srm/updateViewIncident.do") + public String updateViewIncident( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo + , @ModelAttribute("searchVO") SvcDeskListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateViewIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inIncidentSeq", inIncidentSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultIncident = (Map)returnMap.get("resultIncident"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultReports = (List>)returnMap.get("resultReports"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + List> resultTransgers = (List>)returnMap.get("resultTransgers"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + + int transfer_avail = (int)returnMap.get("transfer_avail"); + int editDifficulty = (int)returnMap.get("editDifficulty"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("transfer_avail [{}]", transfer_avail); + log.info("editDifficulty [{}]", editDifficulty); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strIncidentBody = (String)resultIncident.get("txIncidentBody"); + String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); + + resultIncident.put("txIncidentBody", strIncidentBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("transfer_avail" , transfer_avail ); // int + model.addAttribute("editDifficulty" , editDifficulty ); // int + model.addAttribute("approvalReq" , approvalReq ); // int + model.addAttribute("privType" , privType ); // String + + model.addAttribute("resultIncident" , resultIncident ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultReports" , resultReports ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + model.addAttribute("resultTransgers" , resultTransgers ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); + // RestApi Call End --------------------------------- + List> resultList = (List>)returnMap.get("resultList"); + + model.addAttribute("serviceList", resultList); // 서비스 정보 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/updateViewIncident.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/SvcDeskUpdate"; + } + + /** + * 서비스 데스크 인스던트 새로만들기 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2026.01.21 + */ + @PostMapping(value = "/srm/insertCopyViewIncident.do") + public String insertCopyViewIncident( @ModelAttribute("SvcDeskListVo") SvcDeskListVo svcDeskListVo + , @ModelAttribute("searchVO") SvcDeskListVo searchVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/insertCopyViewIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + int inIncidentSeq = CommonUtil.zeroConvert(svcDeskListVo.getInIncidentSeq()); + + // Body Setting Start --------------------------------- + bodyMap.put("inIncidentSeq", inIncidentSeq); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentBySeq.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultIncident = (Map)returnMap.get("resultIncident"); + List> resultSharings = (List>)returnMap.get("resultSharings"); + List> resultReports = (List>)returnMap.get("resultReports"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + List> resultTransgers = (List>)returnMap.get("resultTransgers"); + + String sharingTxt = (String)returnMap.get("sharingTxt"); + String privType = (String)returnMap.get("privType"); + + int transfer_avail = (int)returnMap.get("transfer_avail"); + int editDifficulty = (int)returnMap.get("editDifficulty"); + int approvalReq = (int)returnMap.get("approvalReq"); + + log.info("sharingTxt [{}]", sharingTxt); + log.info("privType [{}]", privType); + log.info("transfer_avail [{}]", transfer_avail); + log.info("editDifficulty [{}]", editDifficulty); + log.info("approvalReq [{}]", approvalReq); + + // RestApi Call End --------------------------------- + + // 인스던트 본문 복호화처리 + String strIncidentBody = (String)resultIncident.get("txIncidentBody"); + String strIncidentBodyDec = CommonUtil.base64decode(strIncidentBody); + + resultIncident.put("txIncidentBody", strIncidentBodyDec); + + model.addAttribute("sharingTxt" , sharingTxt ); // String + model.addAttribute("transfer_avail" , transfer_avail ); // int + model.addAttribute("editDifficulty" , editDifficulty ); // int + model.addAttribute("approvalReq" , approvalReq ); // int + model.addAttribute("privType" , privType ); // String + + model.addAttribute("resultIncident" , resultIncident ); // Map + model.addAttribute("resultSharings" , resultSharings ); // List + model.addAttribute("resultReports" , resultReports ); // List + model.addAttribute("resultApprovals" , resultApprovals ); // List + model.addAttribute("resultTransgers" , resultTransgers ); // List + + // 서비스 정보 추출 + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getServiceCombo.do"); + // RestApi Call End --------------------------------- + List> resultList = (List>)returnMap.get("resultList"); + + model.addAttribute("serviceList", resultList); // 서비스 정보 + + String dtReqDatetime = CommonUtil.getDatewithSpan(CommonUtil.getKST("yyyyMMddHHmm"), 7, "D", "yyyy-MM-dd HH:mm"); + + model.addAttribute("dtReceiptDatetime" , CommonUtil.getKST("yyyy-MM-dd HH:mm")); // 접수일시 + model.addAttribute("dtReqDatetime" , dtReqDatetime); // 완료요청일시는 7일 이후 + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + model.addAttribute("inRegUser", tokenInfo.getUniqId()); // 접수자ID + model.addAttribute("vcRegUser", tokenInfo.getUserName()); // 접수자명 + + // 2025.12.03 나혁제 파일체크 로직 추가 + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /srm/insertCopyViewIncident.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/srm/SvcDeskCopyInsert"; + } + + + + + + + + + + + + + + + + /** + * 서비스데스크 인스던트 등록 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.13 + */ + @ResponseBody + @RequestMapping(value="/srm/addIncident.do") + public LinkedHashMap addIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/addIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + log.info("reqRptRejTxComment [{}]", incidentVo.getReqRptRejTxComment()); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + + // 양식 암호화처리 + String strBody = incidentVo.getTxIncidentBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + incidentVo.setTxIncidentBody(strBodyEnc); + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final List files = multiRequest.getFiles("file_1"); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, "", ""); + _atchFileId = _result.get(0).getAtchFileId(); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + incidentVo.setAtchFileId(_atchFileId); + } + + List> fileList = new ArrayList(); + + // 파일저장 정보 세팅 + if(_result != null) + { + for(FileVO fileVo : _result) + { + log.info("file fileVo : {}", fileVo.toString()); + + Map fileMap = ConvertUtils.convertToMap(fileVo); + + fileList.add(fileMap); + } + } + // 첨부파일 Setting End **********************/ + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "txComment" ) ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inUserSeq" , incidentVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/addIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendIncidentMail(1, (int)returnMap.get("inIncidentSeq")); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendIncidentMail(3, (int)returnMap.get("inIncidentSeq")); + } + + log.info("<<<<<<<<<<<<<<< /srm/addIncident.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 서비스데스크 인스던트 수정 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.14 + */ + @ResponseBody + @RequestMapping(value="/srm/updateIncident.do") + public LinkedHashMap updateIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/updateIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + String strApprovalsId = CommonUtil.nvl(request.getParameter("approvalsId" )); + String strApprovalsName = CommonUtil.nvl(request.getParameter("approvalsName")); + + log.info("strApprovalsId [{}]", strApprovalsId); + log.info("strApprovalsName [{}]", strApprovalsName); + + String srApprovalsId[] = strApprovalsId.split(","); + String srApprovalsName[] = strApprovalsName.split(","); + + List> approvalsList = new ArrayList(); + + if(srApprovalsId != null && srApprovalsId.length > 0) + { + int iSeq=0; + for(int i=0; i mapApp = new LinkedHashMap(); + + mapApp.put("idx" , iSeq++ ); + mapApp.put("inUserSeq" , srApprovalsId [i] ); + mapApp.put("vcUserName" , srApprovalsName[i] ); + + approvalsList.add(mapApp); + } + } + + // 양식 암호화처리 + String strBody = incidentVo.getTxIncidentBody(); + String strBodyEnc = CommonUtil.base64encode(strBody); + + log.info("strBody [{}]", strBody); + log.info("strBodyEnc [{}]", strBodyEnc); + + incidentVo.setTxIncidentBody(strBodyEnc); + + + // 첨부파일 Setting Start ********************** / + // 첨부파일 관련 첨부파일ID 생성 + String _atchFileId = incidentVo.getAtchFileId(); + final List files = multiRequest.getFiles("file_1"); + + List> fileList = new ArrayList(); + + if ( (!files.isEmpty()) + && (files.get(0).getSize()>0) ) + { + List _result = null; + + if (_atchFileId==null || "".equals(_atchFileId) ) + { + _result = fileUtil.parseFileInf(files, "INCID_", 0, _atchFileId, ""); + _atchFileId = _result.get(0).getAtchFileId(); + + incidentVo.setAtchFileId(_atchFileId); + incidentVo.setAtchFileInUpGb("I"); // 새로만들기 + } + else + { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(fvo); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/getMaxFileSN.do"); + // RestApi Call End --------------------------------- + + int _cnt = (int)returnMap.get("result"); + + _result = fileUtil.parseFileInf(files, "INCID_", _cnt, _atchFileId, ""); + incidentVo.setAtchFileInUpGb("U"); // 기존자료변경 + } + + // 파일저장 정보 세팅 + for(FileVO inMap : _result) + { + Map fileMap = ConvertUtils.convertToMap(inMap); + fileList.add(fileMap); + } + } + // 첨부파일 Setting End ********************** / + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "txComment" ) ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inIncidentSeq" , incidentVo.getInIncidentSeq() ); + reqApprovalMap.put("inUserSeq" , incidentVo.getInRegUser() ); + // 승인요청 정보 Setting End ****************** / + + + // Body Setting Start --------------------------------- + bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); + bodyMap.put("approvalsList" , approvalsList); + bodyMap.put("fileList" , fileList); + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/updateIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strReqApprovalYn = CommonUtil.getData(request, "reqApprovalYn"); + + // 접수처리 메일처리 + if(returnMap.get("resultCd").equals("0")) + { + commonService.sendIncidentMail(2, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); + } + + // 승인요청 메일처리 + if(strReqApprovalYn.equals("Y") && returnMap.get("resultCd").equals("0") ) + { + commonService.sendIncidentMail(3, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + + log.info("<<<<<<<<<<<<<<< /rem/updateIncident.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 서비스데스크 인스던트 삭제 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.24 + */ + @ResponseBody + @RequestMapping(value="/srm/deleteIncident.do") + public LinkedHashMap deleteIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/deleteIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // Body Setting Start --------------------------------- + bodyMap.put("incidentVo" , ConvertUtils.convertToMapAll(incidentVo)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/deleteIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + log.info("<<<<<<<<<<<<<<< /srm/deleteIncident.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 서비스데스크 인스던트 승인요청 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.24 + */ + @ResponseBody + @RequestMapping(value="/srm/procApprovalIncident.do") + public LinkedHashMap procApprovalIncident( final @ModelAttribute("incidentVo") IncidentVo incidentVo + , final MultipartHttpServletRequest multiRequest + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/procApprovalIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 접속자정보 + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + // 승인요청 정보 Setting Start ****************** / + Map reqApprovalMap = new LinkedHashMap(); + + reqApprovalMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + reqApprovalMap.put("reqApprovalYn" , CommonUtil.getData(request, "reqApprovalYn") ); + reqApprovalMap.put("inIncidentSeq" , incidentVo.getInIncidentSeq() ); + reqApprovalMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // 승인요청 정보 Setting End ****************** / + + // Body Setting Start --------------------------------- + bodyMap.put("reqApprovalMap" , reqApprovalMap); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/procApprovalIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + // 승인요청 메일처리 + try + { + if(returnMap.get("resultCd").equals("0") ) + { + commonService.sendIncidentMail(3, CommonUtil.zeroConvert(incidentVo.getInIncidentSeq()) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/procApprovalIncident.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + /** + * 서비스데스크 인스던트 처리완료 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.15 + */ + @ResponseBody + @RequestMapping(value="/srm/completedIncident.do") + public LinkedHashMap completedIncident( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/completedIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // completed 정보 세팅 + LinkedHashMap completed = new LinkedHashMap(); + + completed.put("inUserSeq" , tokenInfo.getUniqId()); + completed.put("dtCompleteDatetime" , CommonUtil.getData(request, "dtCompleteDatetime" )); + completed.put("dtServiceStartDatetime" , CommonUtil.getData(request, "dtServiceStartDatetime")); + completed.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment" )); + completed.put("inDifficulty" , CommonUtil.getData(request, "inDifficulty" )); + completed.put("inSatisfaction" , CommonUtil.getData(request, "inSatisfaction" )); + completed.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" )); + + // 2025.04.17 나혁제 조치자 처리 + completed.put("inDevUser", tokenInfo.getStrESNTL_ID()); + completed.put("vcDevUser", tokenInfo.getUserName()); + + // Body Setting Start --------------------------------- + bodyMap.put("completed" , completed); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/completedIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); + commonService.sendIncidentMail(6, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/completedIncident.do >>>>>>>>>>>>>>>"); + + + return resBody; + } + + /** + * 인스던트 승인 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.24 + */ + @ResponseBody + @RequestMapping(value="/srm/approvalIncident.do") + public LinkedHashMap approvalIncident( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/ApprovalIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" ) ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/approvalIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); + + log.info("inIncidentStatus : [{}] ", returnMap.get("resultIncidentStatus")); + + // 승인완료 + if(CommonUtil.zeroConvert( returnMap.get("resultIncidentStatus")) == 3) + { + commonService.sendIncidentMail(4, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + // 다음승인 + else if( CommonUtil.zeroConvert( returnMap.get("resultIncidentStatus")) == 1) + { + commonService.sendIncidentMail(3, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + log.info("<<<<<<<<<<<<<<< /srm/approvalIncident.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + /** + * 인스던트 반려 처리를 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.24 + */ + @ResponseBody + @RequestMapping(value="/srm/rejectIncident.do") + public LinkedHashMap rejectIncident( HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/rejectIncident.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + TokenInfo tokenInfo = CommonUtil.getTokenInfo(); + + // Body Setting Start --------------------------------- + bodyMap.put("txComment" , CommonUtil.getData(request, "reqAppRejTxComment") ); + bodyMap.put("inIncidentSeq" , CommonUtil.getData(request, "inIncidentSeq" ) ); + bodyMap.put("stsfdgCd" , CommonUtil.getData(request, "stsfdgCd" ) ); // 2025.11.17 나혁제 만족도 추가 + bodyMap.put("inUserSeq" , tokenInfo.getUniqId() ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/rejectIncident.do"); + // RestApi Call End --------------------------------- + + resBody.put("resultCd" , returnMap.get("resultCd") ); + resBody.put("resultMsg" , returnMap.get("resultMsg") ); + + try + { + String strInIcidentSeq = CommonUtil.getData(request, "inIncidentSeq"); + + commonService.sendIncidentMail(5, CommonUtil.zeroConvert(strInIcidentSeq) ); + } + catch(Exception e) + { + e.printStackTrace(); + } + + + log.info("<<<<<<<<<<<<<<< /srm/rejectIncident.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + /** + * 서비스 정보 상세 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.02.13 + */ + @ResponseBody + @RequestMapping(value = "/srm/getIncidentForm.do") + public LinkedHashMap getServiceBySeq( @RequestBody LinkedHashMap requestMap + , HttpServletRequest request + , HttpServletResponse response ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /srm/getIncidentForm.do <<<<<<<<<<<<<<<"); + + // api in/out map 정의 + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // return 처리 + LinkedHashMap resBody = new LinkedHashMap(); // Response Map + + //** 서비스 상세조회 Start -------------------- // + // Body Setting Start --------------------------------- + bodyMap = requestMap; ; + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/srm/getIncidentForm.do"); + // RestApi Call End --------------------------------- + + // 결과값 추출 Start --------------------------------- + Map resultService = (Map)returnMap.get("resultService"); + List> resultApprovals = (List>)returnMap.get("resultApprovals"); + // RestApi Call End --------------------------------- + //** 자산상세조회 End -------------------- // + + // 양식 복호화처리 + String strTxDefaultForm = (String)resultService.get("txDefaultForm"); + String strTxDefaultFormDec = CommonUtil.base64decode(strTxDefaultForm); + + resultService.put("txDefaultForm", strTxDefaultFormDec); + + resBody.put("resultService" , resultService ); + resBody.put("resultApprovals" , resultApprovals ); + + log.info("<<<<<<<<<<<<<<< /srm/getIncidentForm.do >>>>>>>>>>>>>>>"); + + return resBody; + } + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskReqController.java b/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskReqController.java index ea53c59e..b0dfa3f5 100644 --- a/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskReqController.java +++ b/front/src/main/java/com/urpsys/itmsfront/srm/controller/SvcDeskReqController.java @@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; +import com.urpsys.common.util.ConvertUtils; import com.urpsys.basefront.common.util.RestApiCallUtil; import com.urpsys.basefront.common.egov.util.EgovFileMngUtil; import com.urpsys.basefront.common.service.CommonService; diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorGroupController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorGroupController.java index 48f4a1b6..63630d21 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorGroupController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorGroupController.java @@ -1,218 +1,218 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.sys.domain.AuthorGroup; -import com.urpsys.itmsfront.sys.domain.AuthorGroupVO; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 권한그룹을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.17 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.17    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class AuthorGroupController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 그룹별 할당된 권한 목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/AuthorGroupList.do") - // @GetMapping(value="/sys/AuthorGroupList.do") - public String selectAuthorGroupList( @ModelAttribute("authorGroupVO") AuthorGroupVO authorGroupVO - , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (authorGroupVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (authorGroupVO.getPageUnit()); - paginationInfo.setPageSize (authorGroupVO.getPageSize()); - - authorGroupVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - authorGroupVO.setLastIndex (paginationInfo.getLastRecordIndex()); - authorGroupVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap.put("authorGroupVO" , ConvertUtils.convertToMapAll(authorGroupVO)); - bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultListGroup = (List>)returnMap.get("resultListGroup"); - List> resultListAll = (List>)returnMap.get("resultListAll"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - List authorGroupList = ConvertUtils.convertToValueObjectsAll(resultListGroup, AuthorGroupVO.class); - List authorManageList = ConvertUtils.convertToValueObjectsAll(resultListAll , AuthorManageVO.class); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("authorGroupList", authorGroupList); - model.addAttribute("authorManageList", authorManageList); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/AuthorGroupManage"; - // return "egovframework/com/sec/rgm/EgovAuthorGroupManage"; - } - - /** - * 그룹에 권한정보를 할당하여 데이터베이스에 등록 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/AuthorGroupInsert.do") - public String insertAuthorGroup( @RequestParam("userIds") String userIds - , @RequestParam("authorCodes") String authorCodes - , @RequestParam("regYns") String regYns - , @RequestParam("mberTyCodes") String mberTyCodes - , @ModelAttribute("authorGroup") AuthorGroup authorGroup - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("userIds" , userIds ); - bodyMap.put("authorCodes" , authorCodes ); - bodyMap.put("regYns" , regYns ); - bodyMap.put("mberTyCodes" , mberTyCodes ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iInSucc = (int)returnMap.get("iInSucc"); - int iUpSucc = (int)returnMap.get("iUpSucc"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - - log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupInsert.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/AuthorGroupList.do"; - } - - /** - * 그룹별 할당된 시스템 메뉴 접근권한을 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/AuthorGroupDelete.do") - public String deleteAuthorGroup( @RequestParam("userIds") String userIds - , @ModelAttribute("authorGroup") AuthorGroup authorGroup - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("userIds" , userIds ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iDeSucc = (int)returnMap.get("iDeSucc"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/AuthorGroupList.do"; - } - - - - - - - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.sys.domain.AuthorGroup; +import com.urpsys.itmsfront.sys.domain.AuthorGroupVO; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 권한그룹을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.17 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.17    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class AuthorGroupController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 그룹별 할당된 권한 목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/AuthorGroupList.do") + // @GetMapping(value="/sys/AuthorGroupList.do") + public String selectAuthorGroupList( @ModelAttribute("authorGroupVO") AuthorGroupVO authorGroupVO + , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (authorGroupVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (authorGroupVO.getPageUnit()); + paginationInfo.setPageSize (authorGroupVO.getPageSize()); + + authorGroupVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + authorGroupVO.setLastIndex (paginationInfo.getLastRecordIndex()); + authorGroupVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap.put("authorGroupVO" , ConvertUtils.convertToMapAll(authorGroupVO)); + bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultListGroup = (List>)returnMap.get("resultListGroup"); + List> resultListAll = (List>)returnMap.get("resultListAll"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + List authorGroupList = ConvertUtils.convertToValueObjectsAll(resultListGroup, AuthorGroupVO.class); + List authorManageList = ConvertUtils.convertToValueObjectsAll(resultListAll , AuthorManageVO.class); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("authorGroupList", authorGroupList); + model.addAttribute("authorManageList", authorManageList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/AuthorGroupManage"; + // return "egovframework/com/sec/rgm/EgovAuthorGroupManage"; + } + + /** + * 그룹에 권한정보를 할당하여 데이터베이스에 등록 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/AuthorGroupInsert.do") + public String insertAuthorGroup( @RequestParam("userIds") String userIds + , @RequestParam("authorCodes") String authorCodes + , @RequestParam("regYns") String regYns + , @RequestParam("mberTyCodes") String mberTyCodes + , @ModelAttribute("authorGroup") AuthorGroup authorGroup + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("userIds" , userIds ); + bodyMap.put("authorCodes" , authorCodes ); + bodyMap.put("regYns" , regYns ); + bodyMap.put("mberTyCodes" , mberTyCodes ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iInSucc = (int)returnMap.get("iInSucc"); + int iUpSucc = (int)returnMap.get("iUpSucc"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupInsert.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/AuthorGroupList.do"; + } + + /** + * 그룹별 할당된 시스템 메뉴 접근권한을 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/AuthorGroupDelete.do") + public String deleteAuthorGroup( @RequestParam("userIds") String userIds + , @ModelAttribute("authorGroup") AuthorGroup authorGroup + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorGroupDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("userIds" , userIds ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorGroupDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iDeSucc = (int)returnMap.get("iDeSucc"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/AuthorGroupDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/AuthorGroupList.do"; + } + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorManageController.java index 47d795c7..d64fafb8 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorManageController.java @@ -1,339 +1,339 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.itmsfront.sys.domain.AuthorManage; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; -import com.urpsys.itmsfront.sys.domain.RoleManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 권한관리을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.06    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class AuthorManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 권한 목록을 조회한다 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/AuthorList.do") - public String selectAuthorList( @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (authorManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(authorManageVO.getPageUnit()); - paginationInfo.setPageSize (authorManageVO.getPageSize()); - - authorManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - authorManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); - authorManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(authorManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - List authorList = ConvertUtils.convertToValueObjectsAll(resultList, AuthorManageVO.class); - - model.addAttribute("authorList" , authorList); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/AuthorList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/AuthorManage"; - - } - - /** - * 권한 세부정보를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/Author.do") - public String selectAuthor(@RequestParam("authorCode") String authorCode - , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/Author.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - authorManageVO.setAuthorCode(authorCode); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(authorManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Author.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map authorManageMap = (Map)returnMap.get("authorManage"); - // Return Data Setting End -------------------------- - - AuthorManageVO authorManage = ConvertUtils.convertToValueObjectAll(authorManageMap, AuthorManageVO.class); - - model.addAttribute("authorManage", authorManage); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/Author.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/AuthorUpdate"; - } - - /** - * 권한 등록화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping("/sys/AuthorInsertView.do") - public String insertAuthorView(@ModelAttribute("authorManage") AuthorManage authorManage) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorInsertView.do <<<<<<<<<<<<<<<"); - log.info("<<<<<<<<<<<<<<< /sys/AuthorInsertView.do >>>>>>>>>>>>>>>"); - - // return "egovframework/com/sec/ram/EgovAuthorInsert"; - return "uritms-tiles2/sys/AuthorInsert"; - } - - /** - * 권한 세부정보를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/AuthorInsert.do") - public String insertAuthor( @ModelAttribute("authorManage") AuthorManage authorManage - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(authorManage, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/AuthorInsert"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(authorManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - strReturnUrl = "forward:/sys/AuthorList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/AuthorInsert.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 권한 세부정보를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/AuthorUpdate.do") - public String updateAuthor( @ModelAttribute("authorManage") AuthorManage authorManage - , BindingResult bindingResult - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorUpdate.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(authorManage, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/AuthorUpdate"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(authorManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorUpdate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); - strReturnUrl ="forward:/sys/AuthorList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/AuthorUpdate.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - - } - - - /** - * 권한목록을 삭제한다. - * @param authorCodes String - * @param authorManage AuthorManage - * @return String - * @exception Exception - */ - @RequestMapping(value="/sys/AuthorListDelete.do") - public String deleteAuthorList( @RequestParam("authorCodes") String authorCodes - , @ModelAttribute("authorManage") AuthorManage authorManage - , Model model) throws Exception - { - - log.info(">>>>>>>>>>>>>>> /sys/AuthorListDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("authorCodes", authorCodes); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorListDeleteCheck.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - // 2025.05.16 나혁제 메뉴등록이 안된경우만 삭제 - if(iResult < 1) - { - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorListDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("resultMsg", egovMessageSource.getMessage("success.common.delete")); - } - else - { - model.addAttribute("resultMsg", "삭제 권한코드중 메뉴등록이 된 코드가 존재합니다. 메뉴초기화 이후 삭제처리 해주시길 바랍니다. "); - } - - log.info("<<<<<<<<<<<<<<< /sys/AuthorListDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/AuthorList.do"; - } - - - - - - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.itmsfront.sys.domain.AuthorManage; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; +import com.urpsys.itmsfront.sys.domain.RoleManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 권한관리을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.06    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class AuthorManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 권한 목록을 조회한다 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/AuthorList.do") + public String selectAuthorList( @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (authorManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(authorManageVO.getPageUnit()); + paginationInfo.setPageSize (authorManageVO.getPageSize()); + + authorManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + authorManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + authorManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(authorManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + List authorList = ConvertUtils.convertToValueObjectsAll(resultList, AuthorManageVO.class); + + model.addAttribute("authorList" , authorList); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/AuthorList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/AuthorManage"; + + } + + /** + * 권한 세부정보를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/Author.do") + public String selectAuthor(@RequestParam("authorCode") String authorCode + , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/Author.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + authorManageVO.setAuthorCode(authorCode); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(authorManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Author.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map authorManageMap = (Map)returnMap.get("authorManage"); + // Return Data Setting End -------------------------- + + AuthorManageVO authorManage = ConvertUtils.convertToValueObjectAll(authorManageMap, AuthorManageVO.class); + + model.addAttribute("authorManage", authorManage); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/Author.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/AuthorUpdate"; + } + + /** + * 권한 등록화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping("/sys/AuthorInsertView.do") + public String insertAuthorView(@ModelAttribute("authorManage") AuthorManage authorManage) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorInsertView.do <<<<<<<<<<<<<<<"); + log.info("<<<<<<<<<<<<<<< /sys/AuthorInsertView.do >>>>>>>>>>>>>>>"); + + // return "egovframework/com/sec/ram/EgovAuthorInsert"; + return "uritms-tiles2/sys/AuthorInsert"; + } + + /** + * 권한 세부정보를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/AuthorInsert.do") + public String insertAuthor( @ModelAttribute("authorManage") AuthorManage authorManage + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(authorManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/AuthorInsert"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(authorManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + strReturnUrl = "forward:/sys/AuthorList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/AuthorInsert.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 권한 세부정보를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/AuthorUpdate.do") + public String updateAuthor( @ModelAttribute("authorManage") AuthorManage authorManage + , BindingResult bindingResult + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorUpdate.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(authorManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/AuthorUpdate"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(authorManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorUpdate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + strReturnUrl ="forward:/sys/AuthorList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/AuthorUpdate.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + + } + + + /** + * 권한목록을 삭제한다. + * @param authorCodes String + * @param authorManage AuthorManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sys/AuthorListDelete.do") + public String deleteAuthorList( @RequestParam("authorCodes") String authorCodes + , @ModelAttribute("authorManage") AuthorManage authorManage + , Model model) throws Exception + { + + log.info(">>>>>>>>>>>>>>> /sys/AuthorListDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("authorCodes", authorCodes); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorListDeleteCheck.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + // 2025.05.16 나혁제 메뉴등록이 안된경우만 삭제 + if(iResult < 1) + { + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorListDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("resultMsg", egovMessageSource.getMessage("success.common.delete")); + } + else + { + model.addAttribute("resultMsg", "삭제 권한코드중 메뉴등록이 된 코드가 존재합니다. 메뉴초기화 이후 삭제처리 해주시길 바랍니다. "); + } + + log.info("<<<<<<<<<<<<<<< /sys/AuthorListDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/AuthorList.do"; + } + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorRoleController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorRoleController.java index 38368d42..8e7f7e3c 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorRoleController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/AuthorRoleController.java @@ -1,167 +1,167 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.sys.domain.AuthorRoleManage; -import com.urpsys.itmsfront.sys.domain.AuthorRoleManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 권한별 롤관리를 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.21 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.21    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class AuthorRoleController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 권한별 할당된 롤 목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/AuthorRoleList.do") - public String selectAuthorRoleList( @ModelAttribute("authorRoleManageVO") AuthorRoleManageVO authorRoleManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/AuthorRoleList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (authorRoleManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (authorRoleManageVO.getPageUnit()); - paginationInfo.setPageSize (authorRoleManageVO.getPageSize()); - - authorRoleManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - authorRoleManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - authorRoleManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(authorRoleManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorRoleList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - List authorRoleList = ConvertUtils.convertToValueObjectsAll(resultList, AuthorRoleManageVO.class); - - model.addAttribute("authorRoleList" , authorRoleList); - model.addAttribute("searchVO" , authorRoleManageVO); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/AuthorRoleList.do >>>>>>>>>>>>>>>"); - - // return "egovframework/com/sec/ram/EgovAuthorRoleManage"; - return "uritms-tiles2/sys/AuthorRoleManage"; - } - - - /** - * 권한정보에 롤을 할당하여 데이터베이스에 등록 - * @param authorCode String - * @param roleCodes String - * @param regYns String - * @param authorRoleManage AuthorRoleManage - * @return String - * @exception Exception - */ - @RequestMapping(value="/sys/AuthorRoleInsert.do") - public String insertAuthorRole( @RequestParam("authorCode") String authorCode - , @RequestParam("roleCodes") String roleCodes - , @RequestParam("regYns") String regYns - , @RequestParam Map commandMap - , @ModelAttribute("authorRoleManage") AuthorRoleManage authorRoleManage - , ModelMap model) throws Exception { - - log.info(">>>>>>>>>>>>>>> /sys/AuthorRoleInsert.do <<<<<<<<<<<<<<<"); - - String [] strRoleCodes = roleCodes.split(";"); - String [] strRegYns = regYns.split(";"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - - for(int i=0; i>>>>>>>>>>>>>>"); - - return "redirect:/sys/AuthorRoleList.do?searchKeyword="+authorCode; - } -} - - - - - +package com.urpsys.itmsfront.sys.controller; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.sys.domain.AuthorRoleManage; +import com.urpsys.itmsfront.sys.domain.AuthorRoleManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 권한별 롤관리를 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.21 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.21    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class AuthorRoleController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 권한별 할당된 롤 목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/AuthorRoleList.do") + public String selectAuthorRoleList( @ModelAttribute("authorRoleManageVO") AuthorRoleManageVO authorRoleManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/AuthorRoleList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (authorRoleManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (authorRoleManageVO.getPageUnit()); + paginationInfo.setPageSize (authorRoleManageVO.getPageSize()); + + authorRoleManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + authorRoleManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + authorRoleManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(authorRoleManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/AuthorRoleList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + List authorRoleList = ConvertUtils.convertToValueObjectsAll(resultList, AuthorRoleManageVO.class); + + model.addAttribute("authorRoleList" , authorRoleList); + model.addAttribute("searchVO" , authorRoleManageVO); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/AuthorRoleList.do >>>>>>>>>>>>>>>"); + + // return "egovframework/com/sec/ram/EgovAuthorRoleManage"; + return "uritms-tiles2/sys/AuthorRoleManage"; + } + + + /** + * 권한정보에 롤을 할당하여 데이터베이스에 등록 + * @param authorCode String + * @param roleCodes String + * @param regYns String + * @param authorRoleManage AuthorRoleManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sys/AuthorRoleInsert.do") + public String insertAuthorRole( @RequestParam("authorCode") String authorCode + , @RequestParam("roleCodes") String roleCodes + , @RequestParam("regYns") String regYns + , @RequestParam Map commandMap + , @ModelAttribute("authorRoleManage") AuthorRoleManage authorRoleManage + , ModelMap model) throws Exception { + + log.info(">>>>>>>>>>>>>>> /sys/AuthorRoleInsert.do <<<<<<<<<<<<<<<"); + + String [] strRoleCodes = roleCodes.split(";"); + String [] strRegYns = regYns.split(";"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + + for(int i=0; i>>>>>>>>>>>>>>"); + + return "redirect:/sys/AuthorRoleList.do?searchKeyword="+authorCode; + } +} + + + + + diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnClCodeManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnClCodeManageController.java index c6e7cc16..e4f54d4e 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnClCodeManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnClCodeManageController.java @@ -1,381 +1,381 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.MemberVO; - -import com.urpsys.itmsfront.sys.domain.CmmnClCode; -import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 공통분류코드을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.21 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.21    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class CcmCmmnClCodeManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 공통분류코드 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnClCodeList.do") - public String selectCmmnClCodeList( @ModelAttribute("searchVO") CmmnClCodeVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnClCodeList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** EgovPropertyService.sample */ - searchVO.setPageUnit(propertiesService.getInt("pageUnit")); - searchVO.setPageSize(propertiesService.getInt("pageSize")); - - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnClCodeList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList ); - model.addAttribute("paginationInfo", paginationInfo ); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnClCodeList"; - - } - - /** - * 공통분류코드 상세항목을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnClCodeDetail.do") - public String selectCmmnClCodeDetail( CmmnClCodeVO cmmnClCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnClCodeDetail.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnClCodeDetail.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnClCode vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnClCode.class); - - model.addAttribute("result", vo); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeDetail.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnClCodeDetail"; - // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeDetail"; - } - - /** - * 공통분류코드 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/RegistCcmCmmnClCodeView.do") - public String insertCmmnClCodeView( @ModelAttribute("searchVO")CmmnClCodeVO cmmnClCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); - model.addAttribute("cmmnClCodeVO", new CmmnClCodeVO()); - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); - - return "uritms-tiles2/sys/CcmCmmnClCodeRegist"; - // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; - } - - /** - * 공통분류코드 수정을 위한 수정페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/UpdateCcmCmmnClCodeView.do") - public String updateCmmnClCodeView( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnClCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnClCode result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnClCode.class); - - model.addAttribute("cmmnClCodeVO", result); - - log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnClCodeView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnClCodeUpdt"; - // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeUpdt"; - } - - /** - * 공통분류코드를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/RegistCcmCmmnClCode.do") - public String insertCmmnClCode(@ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO - , BindingResult bindingResult, ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnClCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeRegist"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnClCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String resultMsgCode = (String)returnMap.get("resultMsgCode"); - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - - if(!resultMsgCode.equals("")) - { - model.addAttribute("message", egovMessageSource.getMessage(resultMsgCode)); - strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeRegist"; - } - else - { - strReturnUrl = "forward:/sys/SelectCcmCmmnClCodeList.do"; - } - } - - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); - - return strReturnUrl; - } - - /** - * 공통분류코드를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/UpdateCcmCmmnClCode.do") - public String updateCmmnClCode( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode - , @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnClCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnClCodeVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(cmmnClCodeVO, bindingResult); - if (bindingResult.hasErrors()) - { - model.addAttribute("cmmnClCodeVO", cmmnClCode); - - strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeUpdt"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnClCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - strReturnUrl = "forward:/sys/SelectCcmCmmnClCodeList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnClCode.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 공통분류코드를 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/RemoveCcmCmmnClCode.do") - public String deleteCmmnClCode( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode - , @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnClCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnClCodeVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnClCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - return "forward:/sys/SelectCcmCmmnClCodeList.do"; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.MemberVO; + +import com.urpsys.itmsfront.sys.domain.CmmnClCode; +import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 공통분류코드을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.21 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.21    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class CcmCmmnClCodeManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 공통분류코드 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnClCodeList.do") + public String selectCmmnClCodeList( @ModelAttribute("searchVO") CmmnClCodeVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnClCodeList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** EgovPropertyService.sample */ + searchVO.setPageUnit(propertiesService.getInt("pageUnit")); + searchVO.setPageSize(propertiesService.getInt("pageSize")); + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnClCodeList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList ); + model.addAttribute("paginationInfo", paginationInfo ); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnClCodeList"; + + } + + /** + * 공통분류코드 상세항목을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnClCodeDetail.do") + public String selectCmmnClCodeDetail( CmmnClCodeVO cmmnClCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnClCodeDetail.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnClCodeDetail.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnClCode vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnClCode.class); + + model.addAttribute("result", vo); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeDetail.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnClCodeDetail"; + // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeDetail"; + } + + /** + * 공통분류코드 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/RegistCcmCmmnClCodeView.do") + public String insertCmmnClCodeView( @ModelAttribute("searchVO")CmmnClCodeVO cmmnClCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); + model.addAttribute("cmmnClCodeVO", new CmmnClCodeVO()); + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); + + return "uritms-tiles2/sys/CcmCmmnClCodeRegist"; + // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; + } + + /** + * 공통분류코드 수정을 위한 수정페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/UpdateCcmCmmnClCodeView.do") + public String updateCmmnClCodeView( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnClCodeView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnClCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnClCode result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnClCode.class); + + model.addAttribute("cmmnClCodeVO", result); + + log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnClCodeView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnClCodeUpdt"; + // return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeUpdt"; + } + + /** + * 공통분류코드를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/RegistCcmCmmnClCode.do") + public String insertCmmnClCode(@ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO + , BindingResult bindingResult, ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnClCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeRegist"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnClCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String resultMsgCode = (String)returnMap.get("resultMsgCode"); + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + + if(!resultMsgCode.equals("")) + { + model.addAttribute("message", egovMessageSource.getMessage(resultMsgCode)); + strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeRegist"; + } + else + { + strReturnUrl = "forward:/sys/SelectCcmCmmnClCodeList.do"; + } + } + + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); + + return strReturnUrl; + } + + /** + * 공통분류코드를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/UpdateCcmCmmnClCode.do") + public String updateCmmnClCode( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode + , @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnClCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnClCodeVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(cmmnClCodeVO, bindingResult); + if (bindingResult.hasErrors()) + { + model.addAttribute("cmmnClCodeVO", cmmnClCode); + + strReturnUrl = "uritms-tiles2/sys/CcmCmmnClCodeUpdt"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnClCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + strReturnUrl = "forward:/sys/SelectCcmCmmnClCodeList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnClCode.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 공통분류코드를 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/RemoveCcmCmmnClCode.do") + public String deleteCmmnClCode( @ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode + , @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnClCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnClCodeVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnClCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnClCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + return "forward:/sys/SelectCcmCmmnClCodeList.do"; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnCodeManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnCodeManageController.java index 9f3c75e6..63311236 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnCodeManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnCodeManageController.java @@ -1,417 +1,417 @@ -package com.urpsys.itmsfront.sys.controller; - - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.MemberVO; - -import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; -import com.urpsys.itmsfront.sys.domain.CmmnCodeVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 공통코드을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.22 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.22    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class CcmCmmnCodeManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 공통코드 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnCodeList.do") - public String selectCmmnCodeList( @ModelAttribute("searchVO") CmmnCodeVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnCodeList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** EgovPropertyService.sample */ - searchVO.setPageUnit(propertiesService.getInt("pageUnit")); - searchVO.setPageSize(propertiesService.getInt("pageSize")); - - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnCodeList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList ); - model.addAttribute("paginationInfo", paginationInfo ); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnCodeList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnCodeList"; - } - - /** - * 공통코드 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/RegistCcmCmmnCodeView.do") - public String insertCmmnCodeView( @ModelAttribute("cmmnCodeVO")CmmnCodeVO cmmnCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); - // Return Data Setting End -------------------------- - - List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnClCodeVO.class); - - model.addAttribute("clCodeList", clCodeList); - - log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnCodeView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnCodeRegist"; - } - - /** - * 공통코드를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/RegistCcmCmmnCode.do") - public String insertCmmnCode( @ModelAttribute("searchVO") CmmnCodeVO cmmnCode - , @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO - , BindingResult bindingResult, ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); - // Return Data Setting End -------------------------- - - List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnClCodeVO.class); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - beanValidator.validate(cmmnCodeVO, bindingResult); - - if (bindingResult.hasErrors()) - { - model.addAttribute("clCodeList", CmmnCodeList); - - strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeRegist"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String resultMsgCode = (String)returnMap.get("resultMsgCode"); - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - if(!resultMsgCode.equals("")) - { - model.addAttribute("message", egovMessageSource.getMessage(resultMsgCode)); - strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeRegist"; - } - else - { - strReturnUrl = "forward:/sys/SelectCcmCmmnCodeList.do"; - } - } - - log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnClCode.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 공통코드 상세항목을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnCodeDetail.do") - public String selectCmmnCodeDetail( CmmnCodeVO cmmnCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnCodeDetail.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnCodeDetail.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnCodeVO vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); - - model.addAttribute("result", vo); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnCodeDetail.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnCodeDetail"; - } - - /** - * 공통코드를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/UpdateCcmCmmnCode.do") - public String updateCmmnCode( @ModelAttribute("searchVO") CmmnCodeVO cmmnCode - , @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO - , BindingResult bindingResult, ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String strReturnUrl=""; - - - beanValidator.validate(cmmnCodeVO, bindingResult); - if (bindingResult.hasErrors()) - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnCodeVO result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); - - model.addAttribute("cmmnCodeVO", result); - - strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeUpdt"; - // return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeUpdt"; - } - else - { - cmmnCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - strReturnUrl = "forward:/sys/SelectCcmCmmnCodeList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnCode.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - - /** - * 공통코드 수정을 위한 수정페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/UpdateCcmCmmnCodeView.do") - public String updateCmmnCodeView( @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnCodeVO result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); - - model.addAttribute("cmmnCodeVO", result); - - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); - - return "uritms-tiles2/sys/CcmCmmnCodeUpdt"; - } - - /** - * 공통코드를 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/RemoveCcmCmmnCode.do") - public String deleteCmmnCode(@ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO - , BindingResult bindingResult, ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - log.info("<<<<<<<<<<<<<<< /sys/RemoveCcmCmmnCode.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/SelectCcmCmmnCodeList.do"; - } - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.MemberVO; + +import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; +import com.urpsys.itmsfront.sys.domain.CmmnCodeVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 공통코드을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.22 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.22    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class CcmCmmnCodeManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 공통코드 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnCodeList.do") + public String selectCmmnCodeList( @ModelAttribute("searchVO") CmmnCodeVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnCodeList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** EgovPropertyService.sample */ + searchVO.setPageUnit(propertiesService.getInt("pageUnit")); + searchVO.setPageSize(propertiesService.getInt("pageSize")); + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnCodeList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList ); + model.addAttribute("paginationInfo", paginationInfo ); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnCodeList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnCodeList"; + } + + /** + * 공통코드 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/RegistCcmCmmnCodeView.do") + public String insertCmmnCodeView( @ModelAttribute("cmmnCodeVO")CmmnCodeVO cmmnCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); + // Return Data Setting End -------------------------- + + List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnClCodeVO.class); + + model.addAttribute("clCodeList", clCodeList); + + log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnCodeView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnCodeRegist"; + } + + /** + * 공통코드를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/RegistCcmCmmnCode.do") + public String insertCmmnCode( @ModelAttribute("searchVO") CmmnCodeVO cmmnCode + , @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO + , BindingResult bindingResult, ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnClCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); + // Return Data Setting End -------------------------- + + List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnClCodeVO.class); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + beanValidator.validate(cmmnCodeVO, bindingResult); + + if (bindingResult.hasErrors()) + { + model.addAttribute("clCodeList", CmmnCodeList); + + strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeRegist"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String resultMsgCode = (String)returnMap.get("resultMsgCode"); + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + if(!resultMsgCode.equals("")) + { + model.addAttribute("message", egovMessageSource.getMessage(resultMsgCode)); + strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeRegist"; + } + else + { + strReturnUrl = "forward:/sys/SelectCcmCmmnCodeList.do"; + } + } + + log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnClCode.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 공통코드 상세항목을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnCodeDetail.do") + public String selectCmmnCodeDetail( CmmnCodeVO cmmnCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnCodeDetail.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnCodeDetail.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnCodeVO vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); + + model.addAttribute("result", vo); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnCodeDetail.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnCodeDetail"; + } + + /** + * 공통코드를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/UpdateCcmCmmnCode.do") + public String updateCmmnCode( @ModelAttribute("searchVO") CmmnCodeVO cmmnCode + , @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO + , BindingResult bindingResult, ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String strReturnUrl=""; + + + beanValidator.validate(cmmnCodeVO, bindingResult); + if (bindingResult.hasErrors()) + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnCodeVO result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); + + model.addAttribute("cmmnCodeVO", result); + + strReturnUrl = "uritms-tiles2/sys/CcmCmmnCodeUpdt"; + // return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeUpdt"; + } + else + { + cmmnCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + strReturnUrl = "forward:/sys/SelectCcmCmmnCodeList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnCode.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + + /** + * 공통코드 수정을 위한 수정페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/UpdateCcmCmmnCodeView.do") + public String updateCmmnCodeView( @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnCodeVO result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnCodeVO.class); + + model.addAttribute("cmmnCodeVO", result); + + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnCodeView.do <<<<<<<<<<<<<<<"); + + return "uritms-tiles2/sys/CcmCmmnCodeUpdt"; + } + + /** + * 공통코드를 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/RemoveCcmCmmnCode.do") + public String deleteCmmnCode(@ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO + , BindingResult bindingResult, ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + log.info("<<<<<<<<<<<<<<< /sys/RemoveCcmCmmnCode.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/SelectCcmCmmnCodeList.do"; + } + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnDetailCodeManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnDetailCodeManageController.java index e07ca96b..da572106 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnDetailCodeManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/CcmCmmnDetailCodeManageController.java @@ -1,400 +1,400 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.MemberVO; - -import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; -import com.urpsys.itmsfront.sys.domain.CmmnCodeVO; -import com.urpsys.itmsfront.sys.domain.CmmnDetailCode; -import com.urpsys.itmsfront.sys.domain.CmmnDetailCodeVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 공통상세코드을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.22 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.22    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class CcmCmmnDetailCodeManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 공통상세코드 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnDetailCodeList.do") - public String selectCmmnDetailCodeList( @ModelAttribute("searchVO") CmmnDetailCodeVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnDetailCodeList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** EgovPropertyService.sample */ - searchVO.setPageUnit(propertiesService.getInt("pageUnit")); - searchVO.setPageSize(propertiesService.getInt("pageSize")); - - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnDetailCodeList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList ); - model.addAttribute("paginationInfo", paginationInfo ); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnDetailCodeList"; - } - - /** - * 공통상세코드 등록을 위한 등록페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/RegistCcmCmmnDetailCodeView.do") - public String insertCmmnDetailCodeView( @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO - , @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCodeView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnDetailCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> CmmnClCodeList = (List>)returnMap.get("CmmnClCodeList"); - List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); - // Return Data Setting End -------------------------- - - List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnClCodeList , CmmnClCodeVO.class); - List codeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnCodeVO.class); - - model.addAttribute("clCodeList", clCodeList); - model.addAttribute("codeList" , codeList ); - - log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCodeView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; - } - - /** - * 공통상세코드 상세항목을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/SelectCcmCmmnDetailCodeDetail.do") - public String selectCmmnDetailCodeDetail( CmmnDetailCodeVO cmmnDetailCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnDetailCodeDetail.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnDetailCodeDetail.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnDetailCode vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnDetailCode.class); - - model.addAttribute("result", vo); - - log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnDetailCodeDetail.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnDetailCodeDetail"; - } - - /** - * 공통상세코드 수정을 위한 수정페이지로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/UpdateCcmCmmnDetailCodeView.do") - public String updateCmmnDetailCodeView( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnDetailCodeView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnDetailCodeView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - CmmnDetailCode result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnDetailCode.class); - - model.addAttribute("cmmnDetailCodeVO", result); - - log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnDetailCodeView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/CcmCmmnDetailCodeUpdt"; - } - - /** - * 공통상세코드를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/RegistCcmCmmnDetailCode.do") - public String insertCmmnDetailCode( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnDetailCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - CmmnClCodeVO searchClCodeVO = new CmmnClCodeVO(); - - beanValidator.validate(cmmnDetailCodeVO, bindingResult); - - String strBindErr = "" ; - if (bindingResult.hasErrors()) - { - strBindErr = "O"; - } - - // Body Setting Start --------------------------------- - bodyMap.put("bindErr", strBindErr); - bodyMap.put("searchClCodeVO" , ConvertUtils.convertToMapAll(searchClCodeVO)); - bodyMap.put("cmmnDetailCodeVO", ConvertUtils.convertToMapAll(cmmnDetailCodeVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnDetailCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String strRetuenMsgCdoe = (String)returnMap.get("resultMsgCode"); - List> CmmnClCodeList = (List>)returnMap.get("CmmnClCodeList"); - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnClCodeList, CmmnClCodeVO.class); - - if(!strBindErr.equals("")) - { - model.addAttribute("clCodeList", clCodeList); - - strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; - // return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"; - } - else if(!strRetuenMsgCdoe.equals("")) - { - model.addAttribute("message", strRetuenMsgCdoe); - model.addAttribute("clCodeList", clCodeList); - - strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; - } - else - { - strReturnUrl ="forward:/sys/SelectCcmCmmnDetailCodeList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 공통상세코드를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping("/sys/UpdateCcmCmmnDetailCode.do") - public String updateCmmnDetailCode( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO - , ModelMap model, BindingResult bindingResult) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - cmmnDetailCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); - - String strBindErr = "" ; - if (bindingResult.hasErrors()) - { - strBindErr = "O"; - } - - // Body Setting Start --------------------------------- - bodyMap.put("bindErr", strBindErr); - bodyMap.put("cmmnDetailCodeVO", ConvertUtils.convertToMapAll(cmmnDetailCodeVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnDetailCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultCmmnDetailCode = (Map)returnMap.get("resultCmmnDetailCode"); - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - CmmnDetailCode result = ConvertUtils.convertToValueObjectAll(resultCmmnDetailCode, CmmnDetailCode.class); - - if(!strBindErr.equals("")) - { - model.addAttribute("cmmnDetailCodeVO", result); - - strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeUpdt"; - } - else - { - strReturnUrl ="forward:/sys/SelectCcmCmmnDetailCodeList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - - /** - * 공통상세코드를 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.22 - */ - @RequestMapping(value = "/sys/RemoveCcmCmmnDetailCode.do") - public String deleteCmmnDetailCode( CmmnDetailCodeVO cmmnDetailCodeVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnDetailCode.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - log.info("<<<<<<<<<<<<<<< /sys/RemoveCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/SelectCcmCmmnDetailCodeList.do"; - } - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.MemberVO; + +import com.urpsys.itmsfront.sys.domain.CmmnClCodeVO; +import com.urpsys.itmsfront.sys.domain.CmmnCodeVO; +import com.urpsys.itmsfront.sys.domain.CmmnDetailCode; +import com.urpsys.itmsfront.sys.domain.CmmnDetailCodeVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 공통상세코드을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.22 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.22    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class CcmCmmnDetailCodeManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 공통상세코드 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnDetailCodeList.do") + public String selectCmmnDetailCodeList( @ModelAttribute("searchVO") CmmnDetailCodeVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnDetailCodeList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** EgovPropertyService.sample */ + searchVO.setPageUnit(propertiesService.getInt("pageUnit")); + searchVO.setPageSize(propertiesService.getInt("pageSize")); + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnDetailCodeList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList ); + model.addAttribute("paginationInfo", paginationInfo ); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnClCodeList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnDetailCodeList"; + } + + /** + * 공통상세코드 등록을 위한 등록페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/RegistCcmCmmnDetailCodeView.do") + public String insertCmmnDetailCodeView( @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO + , @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCodeView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnDetailCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> CmmnClCodeList = (List>)returnMap.get("CmmnClCodeList"); + List> CmmnCodeList = (List>)returnMap.get("CmmnCodeList"); + // Return Data Setting End -------------------------- + + List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnClCodeList , CmmnClCodeVO.class); + List codeList = ConvertUtils.convertToValueObjectsAll(CmmnCodeList , CmmnCodeVO.class); + + model.addAttribute("clCodeList", clCodeList); + model.addAttribute("codeList" , codeList ); + + log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCodeView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; + } + + /** + * 공통상세코드 상세항목을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/SelectCcmCmmnDetailCodeDetail.do") + public String selectCmmnDetailCodeDetail( CmmnDetailCodeVO cmmnDetailCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/SelectCcmCmmnDetailCodeDetail.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/SelectCcmCmmnDetailCodeDetail.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnDetailCode vo = ConvertUtils.convertToValueObjectAll(resultMap, CmmnDetailCode.class); + + model.addAttribute("result", vo); + + log.info("<<<<<<<<<<<<<<< /sys/SelectCcmCmmnDetailCodeDetail.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnDetailCodeDetail"; + } + + /** + * 공통상세코드 수정을 위한 수정페이지로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/UpdateCcmCmmnDetailCodeView.do") + public String updateCmmnDetailCodeView( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UpdateCcmCmmnDetailCodeView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnDetailCodeView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + CmmnDetailCode result = ConvertUtils.convertToValueObjectAll(resultMap, CmmnDetailCode.class); + + model.addAttribute("cmmnDetailCodeVO", result); + + log.info("<<<<<<<<<<<<<<< /sys/UpdateCcmCmmnDetailCodeView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/CcmCmmnDetailCodeUpdt"; + } + + /** + * 공통상세코드를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/RegistCcmCmmnDetailCode.do") + public String insertCmmnDetailCode( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnDetailCodeVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + CmmnClCodeVO searchClCodeVO = new CmmnClCodeVO(); + + beanValidator.validate(cmmnDetailCodeVO, bindingResult); + + String strBindErr = "" ; + if (bindingResult.hasErrors()) + { + strBindErr = "O"; + } + + // Body Setting Start --------------------------------- + bodyMap.put("bindErr", strBindErr); + bodyMap.put("searchClCodeVO" , ConvertUtils.convertToMapAll(searchClCodeVO)); + bodyMap.put("cmmnDetailCodeVO", ConvertUtils.convertToMapAll(cmmnDetailCodeVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RegistCcmCmmnDetailCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String strRetuenMsgCdoe = (String)returnMap.get("resultMsgCode"); + List> CmmnClCodeList = (List>)returnMap.get("CmmnClCodeList"); + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + List clCodeList = ConvertUtils.convertToValueObjectsAll(CmmnClCodeList, CmmnClCodeVO.class); + + if(!strBindErr.equals("")) + { + model.addAttribute("clCodeList", clCodeList); + + strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; + // return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"; + } + else if(!strRetuenMsgCdoe.equals("")) + { + model.addAttribute("message", strRetuenMsgCdoe); + model.addAttribute("clCodeList", clCodeList); + + strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeRegist"; + } + else + { + strReturnUrl ="forward:/sys/SelectCcmCmmnDetailCodeList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 공통상세코드를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping("/sys/UpdateCcmCmmnDetailCode.do") + public String updateCmmnDetailCode( @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO + , ModelMap model, BindingResult bindingResult) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RegistCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + cmmnDetailCodeVO.setLastUpdusrId((memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId()))); + + String strBindErr = "" ; + if (bindingResult.hasErrors()) + { + strBindErr = "O"; + } + + // Body Setting Start --------------------------------- + bodyMap.put("bindErr", strBindErr); + bodyMap.put("cmmnDetailCodeVO", ConvertUtils.convertToMapAll(cmmnDetailCodeVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UpdateCcmCmmnDetailCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultCmmnDetailCode = (Map)returnMap.get("resultCmmnDetailCode"); + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + CmmnDetailCode result = ConvertUtils.convertToValueObjectAll(resultCmmnDetailCode, CmmnDetailCode.class); + + if(!strBindErr.equals("")) + { + model.addAttribute("cmmnDetailCodeVO", result); + + strReturnUrl ="uritms-tiles2/sys/CcmCmmnDetailCodeUpdt"; + } + else + { + strReturnUrl ="forward:/sys/SelectCcmCmmnDetailCodeList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/RegistCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + + /** + * 공통상세코드를 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.22 + */ + @RequestMapping(value = "/sys/RemoveCcmCmmnDetailCode.do") + public String deleteCmmnDetailCode( CmmnDetailCodeVO cmmnDetailCodeVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RemoveCcmCmmnDetailCode.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(cmmnDetailCodeVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RemoveCcmCmmnDetailCode.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + log.info("<<<<<<<<<<<<<<< /sys/RemoveCcmCmmnDetailCode.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/SelectCcmCmmnDetailCodeList.do"; + } + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptAuthorController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptAuthorController.java index ed0e7424..6d618735 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptAuthorController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptAuthorController.java @@ -1,248 +1,248 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; -import com.urpsys.itmsfront.sys.domain.DeptAuthor; -import com.urpsys.itmsfront.sys.domain.DeptAuthorVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 부서권한을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.16 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.16    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class DeptAuthorController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 부서별 할당된 권한목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value="/sys/DeptAuthorList.do") - public String selectDeptAuthorList( @ModelAttribute("deptAuthorVO") DeptAuthorVO deptAuthorVO - , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (deptAuthorVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (deptAuthorVO.getPageUnit()); - paginationInfo.setPageSize (deptAuthorVO.getPageSize()); - - deptAuthorVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - deptAuthorVO.setLastIndex (paginationInfo.getLastRecordIndex()); - deptAuthorVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap.put("deptAuthorVO" , ConvertUtils.convertToMapAll(deptAuthorVO)); - bodyMap.put("authorManageVO" , ConvertUtils.convertToMapAll(authorManageVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultListDept = (List>)returnMap.get("resultListDept"); - List> resultListAll = (List>)returnMap.get("resultListAll"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - List deptAuthorList = ConvertUtils.convertToValueObjectsAll(resultListDept , DeptAuthorVO.class); - List authorManageList = ConvertUtils.convertToValueObjectsAll(resultListAll , AuthorManageVO.class); - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("deptAuthorList" , deptAuthorList); - model.addAttribute("authorManageList", authorManageList); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/DeptAuthorList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/DeptAuthorManage"; - } - - /** - * 부서목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - //@IncludedInfo(name="부서목록관리", order = 101) - @RequestMapping(value="/sys/DeptSearchList.do") - public String selectDeptList( @ModelAttribute("deptAuthorVO") DeptAuthorVO deptAuthorVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> sys/DeptAuthorList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (deptAuthorVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(deptAuthorVO.getPageUnit()); - paginationInfo.setPageSize (deptAuthorVO.getPageSize()); - - deptAuthorVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - deptAuthorVO.setLastIndex (paginationInfo.getLastRecordIndex()); - deptAuthorVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptAuthorVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptSearchList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - // DeptAuthorVO 형석으로 형변환 처리 - List deptList = ConvertUtils.convertToValueObjectsAll(resultList, DeptAuthorVO.class); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("deptList", deptList); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< sys/DeptAuthorList.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/sys/DeptSearch"; - } - - /** - * 부서에 권한정보를 할당하여 데이터베이스에 등록 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value="/sys/DeptAuthorInsert.do") - public String insertDeptAuthor( @RequestParam("userIds") String userIds - , @RequestParam("authorCodes") String authorCodes - , @RequestParam("regYns") String regYns - , @ModelAttribute("deptAuthor") DeptAuthor deptAuthor - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("userIds" , userIds ); - bodyMap.put("authorCodes" , authorCodes ); - bodyMap.put("regYns" , regYns ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iInSucc = (int)returnMap.get("iInSucc"); - int iUpSucc = (int)returnMap.get("iUpSucc"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - - log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorInsert.do <<<<<<<<<<<<<<<"); - - return "forward:/sys/DeptAuthorList.do"; - } - - /** - * 부서별 할당된 시스템 메뉴 접근권한을 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value="/sys/DeptAuthorDelete.do") - public String deleteDeptAuthor ( @RequestParam("userIds") String userIds - , @ModelAttribute("deptAuthor") DeptAuthor deptAuthor - , ModelMap model) throws Exception - { - - log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("userIds" , userIds ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iDeSucc = (int)returnMap.get("iDeSucc"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/DeptAuthorDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/DeptAuthorList.do"; - } - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; +import com.urpsys.itmsfront.sys.domain.DeptAuthor; +import com.urpsys.itmsfront.sys.domain.DeptAuthorVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 부서권한을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.16 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.16    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class DeptAuthorController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 부서별 할당된 권한목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value="/sys/DeptAuthorList.do") + public String selectDeptAuthorList( @ModelAttribute("deptAuthorVO") DeptAuthorVO deptAuthorVO + , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (deptAuthorVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (deptAuthorVO.getPageUnit()); + paginationInfo.setPageSize (deptAuthorVO.getPageSize()); + + deptAuthorVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + deptAuthorVO.setLastIndex (paginationInfo.getLastRecordIndex()); + deptAuthorVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap.put("deptAuthorVO" , ConvertUtils.convertToMapAll(deptAuthorVO)); + bodyMap.put("authorManageVO" , ConvertUtils.convertToMapAll(authorManageVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultListDept = (List>)returnMap.get("resultListDept"); + List> resultListAll = (List>)returnMap.get("resultListAll"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + List deptAuthorList = ConvertUtils.convertToValueObjectsAll(resultListDept , DeptAuthorVO.class); + List authorManageList = ConvertUtils.convertToValueObjectsAll(resultListAll , AuthorManageVO.class); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("deptAuthorList" , deptAuthorList); + model.addAttribute("authorManageList", authorManageList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/DeptAuthorList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/DeptAuthorManage"; + } + + /** + * 부서목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + //@IncludedInfo(name="부서목록관리", order = 101) + @RequestMapping(value="/sys/DeptSearchList.do") + public String selectDeptList( @ModelAttribute("deptAuthorVO") DeptAuthorVO deptAuthorVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> sys/DeptAuthorList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (deptAuthorVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(deptAuthorVO.getPageUnit()); + paginationInfo.setPageSize (deptAuthorVO.getPageSize()); + + deptAuthorVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + deptAuthorVO.setLastIndex (paginationInfo.getLastRecordIndex()); + deptAuthorVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptAuthorVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptSearchList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + // DeptAuthorVO 형석으로 형변환 처리 + List deptList = ConvertUtils.convertToValueObjectsAll(resultList, DeptAuthorVO.class); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("deptList", deptList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< sys/DeptAuthorList.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/sys/DeptSearch"; + } + + /** + * 부서에 권한정보를 할당하여 데이터베이스에 등록 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value="/sys/DeptAuthorInsert.do") + public String insertDeptAuthor( @RequestParam("userIds") String userIds + , @RequestParam("authorCodes") String authorCodes + , @RequestParam("regYns") String regYns + , @ModelAttribute("deptAuthor") DeptAuthor deptAuthor + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("userIds" , userIds ); + bodyMap.put("authorCodes" , authorCodes ); + bodyMap.put("regYns" , regYns ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iInSucc = (int)returnMap.get("iInSucc"); + int iUpSucc = (int)returnMap.get("iUpSucc"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorInsert.do <<<<<<<<<<<<<<<"); + + return "forward:/sys/DeptAuthorList.do"; + } + + /** + * 부서별 할당된 시스템 메뉴 접근권한을 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value="/sys/DeptAuthorDelete.do") + public String deleteDeptAuthor ( @RequestParam("userIds") String userIds + , @ModelAttribute("deptAuthor") DeptAuthor deptAuthor + , ModelMap model) throws Exception + { + + log.info(">>>>>>>>>>>>>>> /sys/DeptAuthorDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("userIds" , userIds ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/DeptAuthorDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iDeSucc = (int)returnMap.get("iDeSucc"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/DeptAuthorDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/DeptAuthorList.do"; + } + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptManageController.java index 39b23955..4e6e086b 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/DeptManageController.java @@ -1,359 +1,359 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; -import com.urpsys.itmsfront.sys.domain.DeptManageVO; -import com.urpsys.itmsfront.sys.domain.RoleManage; -import com.urpsys.itmsfront.sys.domain.RoleManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 부서관리플 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.16 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.16    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class DeptManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /** Message ID Generation */ - /* - @Resource(name = "egovDeptManageIdGnrService") - private EgovIdGnrService egovDeptManageIdGnrService; - */ - - @Autowired - CommonService commonService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 부서 목록화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/selectDeptManageListView.do") - public String selectDeptManageListView() throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/selectDeptManageListView.do <<<<<<<<<<<<<<<"); - log.info("<<<<<<<<<<<<<<< /sys/selectDeptManageListView.do >>>>>>>>>>>>>>>"); - return "forward:/sys/selectDeptManageList.do"; - } - - /** - * 부서를 관리하기 위해 등록된 부서목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/selectDeptManageList.do") - public String selectDeptManageList( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/selectDeptManageList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (deptManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(deptManageVO.getPageUnit()); - paginationInfo.setPageSize (deptManageVO.getPageSize()); - - deptManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - deptManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); - deptManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/selectDeptManageList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - // DeptManageVO 형석으로 형변환 처리 - List deptManageList = ConvertUtils.convertToValueObjectsAll(resultList, DeptManageVO.class); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("deptManageList", deptManageList); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/selectDeptManageList.do >>>>>>>>>>>>>>>"); - - // return "egovframework/com/uss/umt/EgovDeptManageList"; - return "uritms-tiles2/sys/DeptManageList"; - } - - /** - * 등록된 부서의 상세정보를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/getDeptManage.do") - public String selectDeptManage( @RequestParam("orgnztId") String orgnztId - , @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/getDeptManage.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - deptManageVO.setOrgnztId(orgnztId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/getDeptManage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - // DeptManageVO 형석으로 형변환 처리 - DeptManageVO deptManage = ConvertUtils.convertToValueObjectAll(resultMap, DeptManageVO.class); - - model.addAttribute("deptManage", deptManage); - model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/getDeptManage.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/DeptManageUpdt"; - // return "egovframework/com/uss/umt/EgovDeptManageUpdt"; - } - - /** - * 부서등록 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/addViewDeptManage.do") - public String insertViewDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/addViewDeptManage.do <<<<<<<<<<<<<<<"); - model.addAttribute("deptManage", deptManageVO); - log.info("<<<<<<<<<<<<<<< /sys/addViewDeptManage.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/DeptManageInsert"; - } - - /** - * 부서정보를 신규로 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/addDeptManage.do") - public String insertDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/addDeptManage.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(deptManageVO, bindingResult); //validation 수행 - - String strOrgnztId = commonService.GetIdGen("egovDeptManageIdGnrService"); - - if(strOrgnztId==null || strOrgnztId.equals("")) - { - model.addAttribute("resultMsg", "fail.common.insert"); - return "forward:/sys/selectDeptManageList.do"; - } - - - // deptManageVO.setOrgnztId(egovDeptManageIdGnrService.getNextStringId()); - - deptManageVO.setOrgnztId(strOrgnztId); - - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/DeptManageInsert"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/addDeptManage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - - strReturnUrl = "forward:/sys/selectDeptManageList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/addDeptManage.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 기 등록된 부서정보를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/updtDeptManage.do") - public String updateDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/updtDeptManage.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(deptManageVO, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/DeptManageUpdt"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updtDeptManage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - strReturnUrl = "forward:/sys/selectDeptManageList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/addDeptManage.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 기 등록된 부서정보를 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/removeDeptManage.do") - public String deleteDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/removeDeptManage.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(deptManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/removeDeptManage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/removeDeptManage.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectDeptManageList.do"; - } - - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; +import com.urpsys.itmsfront.sys.domain.DeptManageVO; +import com.urpsys.itmsfront.sys.domain.RoleManage; +import com.urpsys.itmsfront.sys.domain.RoleManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 부서관리플 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.16 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.16    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class DeptManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** Message ID Generation */ + /* + @Resource(name = "egovDeptManageIdGnrService") + private EgovIdGnrService egovDeptManageIdGnrService; + */ + + @Autowired + CommonService commonService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 부서 목록화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/selectDeptManageListView.do") + public String selectDeptManageListView() throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/selectDeptManageListView.do <<<<<<<<<<<<<<<"); + log.info("<<<<<<<<<<<<<<< /sys/selectDeptManageListView.do >>>>>>>>>>>>>>>"); + return "forward:/sys/selectDeptManageList.do"; + } + + /** + * 부서를 관리하기 위해 등록된 부서목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/selectDeptManageList.do") + public String selectDeptManageList( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/selectDeptManageList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (deptManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(deptManageVO.getPageUnit()); + paginationInfo.setPageSize (deptManageVO.getPageSize()); + + deptManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + deptManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + deptManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/selectDeptManageList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + // DeptManageVO 형석으로 형변환 처리 + List deptManageList = ConvertUtils.convertToValueObjectsAll(resultList, DeptManageVO.class); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("deptManageList", deptManageList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/selectDeptManageList.do >>>>>>>>>>>>>>>"); + + // return "egovframework/com/uss/umt/EgovDeptManageList"; + return "uritms-tiles2/sys/DeptManageList"; + } + + /** + * 등록된 부서의 상세정보를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/getDeptManage.do") + public String selectDeptManage( @RequestParam("orgnztId") String orgnztId + , @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/getDeptManage.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + deptManageVO.setOrgnztId(orgnztId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/getDeptManage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + // DeptManageVO 형석으로 형변환 처리 + DeptManageVO deptManage = ConvertUtils.convertToValueObjectAll(resultMap, DeptManageVO.class); + + model.addAttribute("deptManage", deptManage); + model.addAttribute("message" , egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/getDeptManage.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/DeptManageUpdt"; + // return "egovframework/com/uss/umt/EgovDeptManageUpdt"; + } + + /** + * 부서등록 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/addViewDeptManage.do") + public String insertViewDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/addViewDeptManage.do <<<<<<<<<<<<<<<"); + model.addAttribute("deptManage", deptManageVO); + log.info("<<<<<<<<<<<<<<< /sys/addViewDeptManage.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/DeptManageInsert"; + } + + /** + * 부서정보를 신규로 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/addDeptManage.do") + public String insertDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/addDeptManage.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(deptManageVO, bindingResult); //validation 수행 + + String strOrgnztId = commonService.GetIdGen("egovDeptManageIdGnrService"); + + if(strOrgnztId==null || strOrgnztId.equals("")) + { + model.addAttribute("resultMsg", "fail.common.insert"); + return "forward:/sys/selectDeptManageList.do"; + } + + + // deptManageVO.setOrgnztId(egovDeptManageIdGnrService.getNextStringId()); + + deptManageVO.setOrgnztId(strOrgnztId); + + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/DeptManageInsert"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/addDeptManage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + strReturnUrl = "forward:/sys/selectDeptManageList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/addDeptManage.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 기 등록된 부서정보를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/updtDeptManage.do") + public String updateDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/updtDeptManage.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(deptManageVO, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/DeptManageUpdt"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updtDeptManage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + strReturnUrl = "forward:/sys/selectDeptManageList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/addDeptManage.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 기 등록된 부서정보를 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/removeDeptManage.do") + public String deleteDeptManage( @ModelAttribute("deptManageVO") DeptManageVO deptManageVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/removeDeptManage.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(deptManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/removeDeptManage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/removeDeptManage.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectDeptManageList.do"; + } + + + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/GroupManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/GroupManageController.java index b67bee32..29568bb4 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/GroupManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/GroupManageController.java @@ -1,408 +1,408 @@ -package com.urpsys.itmsfront.sys.controller; - - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; - -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.sys.domain.GroupManage; -import com.urpsys.itmsfront.sys.domain.GroupManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 그룹관리을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.17 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.17    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class GroupManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Autowired - CommonService commonService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 시스템사용 목적별 그룹 목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupList.do") - public String selectGroupList( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupList.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (groupManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (groupManageVO.getPageUnit()); - paginationInfo.setPageSize (groupManageVO.getPageSize()); - - groupManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - groupManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - groupManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - List groupList = ConvertUtils.convertToValueObjectsAll(resultList, GroupManageVO.class); - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("groupList", groupList); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/GroupList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/GroupManage"; - } - - /** - * 그룹 등록화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupInsertView.do") - public String insertGroupView(@ModelAttribute("groupManage") GroupManage groupManage) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupInsertView.do <<<<<<<<<<<<<<<"); - log.info("<<<<<<<<<<<<<<< /sys/GroupInsertView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/GroupInsert"; - } - - /** - * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupInsert.do") - public String insertGroup( @ModelAttribute("groupManage") GroupManage groupManage - , @ModelAttribute("groupManageVO") GroupManageVO groupManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(groupManage, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/GroupInsert"; - } - else - { - String strGroupId = commonService.GetIdGen("egovGroupIdGnrService"); - - if(strGroupId==null || strGroupId.equals("")) - { - model.addAttribute("resultMsg", "fail.common.insert"); - return "forward:/sys/GroupList.do"; - } - - groupManage.setGroupId(strGroupId); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - GroupManageVO groupManageOut = ConvertUtils.convertToValueObjectAll(resultMap, GroupManageVO.class); - - model.addAttribute("message" , egovMessageSource.getMessage("success.common.insert")); - model.addAttribute("groupManage", groupManageOut); - - strReturnUrl = "forward:/sys/GroupList.do"; - } - - log.info(">>>>>>>>>>>>>>> /sys/GroupInsert.do <<<<<<<<<<<<<<<"); - - return strReturnUrl; - - } - - /** - * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupUpdate.do") - public String updateGroup( @ModelAttribute("groupManage") GroupManage groupManage - , BindingResult bindingResult - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupUpdate.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(groupManage, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/GroupUpdate"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupUpdate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); - strReturnUrl = "forward:/sys/GroupList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/GroupUpdate.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupDelete.do") - public String deleteGroup( @ModelAttribute("groupManage") GroupManage groupManage - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - strReturnUrl = "forward:/sys/GroupList.do"; - - log.info("<<<<<<<<<<<<<<< /sys/GroupDelete.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - - } - - /** - * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupListDelete.do") - public String deleteGroupList( @RequestParam("groupIds") String groupIds - , @ModelAttribute("groupManage") GroupManage groupManage - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupListDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("groupIds", groupIds); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupListDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/GroupListDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/GroupList.do"; - } - - /** - * 검색조건에 따른 그룹정보를 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/Group.do") - public String selectGroup( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO - , @ModelAttribute("groupManage") GroupManage groupManage - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/Group.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Group.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - GroupManageVO groupManageOut = ConvertUtils.convertToValueObjectAll(resultMap, GroupManageVO.class); - - model.addAttribute("groupManage", groupManageOut); - - log.info("<<<<<<<<<<<<<<< /sys/Group.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/GroupUpdate"; - } - - /** - * 시스템사용 목적별 그룹 목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.17 - */ - @RequestMapping(value="/sys/GroupSearchList.do") - public String selectGroupSearchList( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO - , HttpServletRequest request - , HttpServletResponse response - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/GroupSearchList.do <<<<<<<<<<<<<<<"); - - // 2025.08.17 팝업 결과처리 플래그 추가 - String strResType = CommonUtil.nvl(request.getParameter("resType" )); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (groupManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (groupManageVO.getPageUnit()); - paginationInfo.setPageSize (groupManageVO.getPageSize()); - - groupManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - groupManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - groupManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(groupManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupSearchList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - List groupList = ConvertUtils.convertToValueObjectsAll(resultList, GroupManageVO.class); - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resType" , strResType); - model.addAttribute("groupList", groupList); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/GroupSearchList.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/sys/GroupSearch"; - } - - -} +package com.urpsys.itmsfront.sys.controller; + + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; + +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.sys.domain.GroupManage; +import com.urpsys.itmsfront.sys.domain.GroupManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 그룹관리을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.17 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.17    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class GroupManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + CommonService commonService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupList.do") + public String selectGroupList( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupList.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (groupManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (groupManageVO.getPageUnit()); + paginationInfo.setPageSize (groupManageVO.getPageSize()); + + groupManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + groupManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + groupManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + List groupList = ConvertUtils.convertToValueObjectsAll(resultList, GroupManageVO.class); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("groupList", groupList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/GroupList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/GroupManage"; + } + + /** + * 그룹 등록화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupInsertView.do") + public String insertGroupView(@ModelAttribute("groupManage") GroupManage groupManage) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupInsertView.do <<<<<<<<<<<<<<<"); + log.info("<<<<<<<<<<<<<<< /sys/GroupInsertView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/GroupInsert"; + } + + /** + * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupInsert.do") + public String insertGroup( @ModelAttribute("groupManage") GroupManage groupManage + , @ModelAttribute("groupManageVO") GroupManageVO groupManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(groupManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/GroupInsert"; + } + else + { + String strGroupId = commonService.GetIdGen("egovGroupIdGnrService"); + + if(strGroupId==null || strGroupId.equals("")) + { + model.addAttribute("resultMsg", "fail.common.insert"); + return "forward:/sys/GroupList.do"; + } + + groupManage.setGroupId(strGroupId); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + GroupManageVO groupManageOut = ConvertUtils.convertToValueObjectAll(resultMap, GroupManageVO.class); + + model.addAttribute("message" , egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("groupManage", groupManageOut); + + strReturnUrl = "forward:/sys/GroupList.do"; + } + + log.info(">>>>>>>>>>>>>>> /sys/GroupInsert.do <<<<<<<<<<<<<<<"); + + return strReturnUrl; + + } + + /** + * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupUpdate.do") + public String updateGroup( @ModelAttribute("groupManage") GroupManage groupManage + , BindingResult bindingResult + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupUpdate.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(groupManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/GroupUpdate"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupUpdate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + strReturnUrl = "forward:/sys/GroupList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/GroupUpdate.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupDelete.do") + public String deleteGroup( @ModelAttribute("groupManage") GroupManage groupManage + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + strReturnUrl = "forward:/sys/GroupList.do"; + + log.info("<<<<<<<<<<<<<<< /sys/GroupDelete.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + + } + + /** + * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupListDelete.do") + public String deleteGroupList( @RequestParam("groupIds") String groupIds + , @ModelAttribute("groupManage") GroupManage groupManage + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupListDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("groupIds", groupIds); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupListDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/GroupListDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/GroupList.do"; + } + + /** + * 검색조건에 따른 그룹정보를 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/Group.do") + public String selectGroup( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO + , @ModelAttribute("groupManage") GroupManage groupManage + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/Group.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Group.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + GroupManageVO groupManageOut = ConvertUtils.convertToValueObjectAll(resultMap, GroupManageVO.class); + + model.addAttribute("groupManage", groupManageOut); + + log.info("<<<<<<<<<<<<<<< /sys/Group.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/GroupUpdate"; + } + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.17 + */ + @RequestMapping(value="/sys/GroupSearchList.do") + public String selectGroupSearchList( @ModelAttribute("groupManageVO") GroupManageVO groupManageVO + , HttpServletRequest request + , HttpServletResponse response + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/GroupSearchList.do <<<<<<<<<<<<<<<"); + + // 2025.08.17 팝업 결과처리 플래그 추가 + String strResType = CommonUtil.nvl(request.getParameter("resType" )); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (groupManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (groupManageVO.getPageUnit()); + paginationInfo.setPageSize (groupManageVO.getPageSize()); + + groupManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + groupManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + groupManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(groupManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/GroupSearchList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + List groupList = ConvertUtils.convertToValueObjectsAll(resultList, GroupManageVO.class); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resType" , strResType); + model.addAttribute("groupList", groupList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/GroupSearchList.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/sys/GroupSearch"; + } + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuCreateManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuCreateManageController.java index 678c9bb4..d144b988 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuCreateManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuCreateManageController.java @@ -1,261 +1,261 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.urpsys.basefront.common.egov.util.EgovWebUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.sys.domain.MenuCreatVO; -import com.urpsys.itmsfront.sys.domain.MenuSiteMapVO; -import com.urpsys.basefront.domain.ComDefaultVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 View Controll - * @author urp 인프라본부 나혁제 - * @since 2025.01.09 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.09   나혁제        최초 생성
- *
- *  
- */ - -@Slf4j -@Controller -public class MenuCreateManageController -{ - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 메뉴생성목록을 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.09 - */ - @RequestMapping(value = "/sys/MenuCreatManageSelect.do") - public String selectMenuCreatManagList( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuCreatManageSelect.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - - // Body Setting Start --------------------------------- - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatManageSelect.do"); - - List> list_menumanage = (List>)returnMap.get("list_menumanage"); - int totCnt = (int)returnMap.get("totCnt"); - - if ( list_menumanage.size() == 0 ) - resultMsg = egovMessageSource.getMessage("info.nodata.msg"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("list_menumanage" , list_menumanage); - model.addAttribute("searchVO" , searchVO); - model.addAttribute("paginationInfo" , paginationInfo); - - log.info("<<<<<<<<<<<<<<< /sys/MenuCreatManageSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/MenuCreatManage"; - } - - /** - * 메뉴생성 세부조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.09 - */ - @RequestMapping(value = "/sys/MenuCreatSelect.do") - public String selectMenuCreatList( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuCreatSelect.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(menuCreatVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatSelect.do"); - - List> list_menulist = (List>)returnMap.get("list_menulist"); - - model.addAttribute("list_menulist", list_menulist); - model.addAttribute("resultVO", menuCreatVO); - - log.info("<<<<<<<<<<<<<<< /sys/MenuCreatSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/MenuCreat"; - } - - /** - * 메뉴사이트맵 생성조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.09 - */ - @RequestMapping(value = "/sys/MenuCreatSiteMapSelect.do") - public String selectMenuCreatSiteMap( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("menuSiteMapVO") MenuSiteMapVO menuSiteMapVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuCreatSiteMapSelect.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(menuSiteMapVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatSiteMapSelect.do"); - - List> list_menulist = (List>)returnMap.get("list_menulist"); - - model.addAttribute("list_menulist", list_menulist); - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - - menuSiteMapVO.setCreatPersonId(tokenInfo == null ? "" : tokenInfo.getStrMEM_ID() ); - - model.addAttribute("resultVO", menuSiteMapVO); - - log.info("<<<<<<<<<<<<<<< /sys/MenuCreatSiteMapSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/sys/MenuCreatSiteMap"; - - } - - /** - * 메뉴생성처리 및 메뉴생성내역을 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.09 - */ - @RequestMapping("/sys/MenuCreatInsert.do") - public String insertMenuCreatList( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("checkedAuthorForInsert") String checkedAuthorForInsert - , @RequestParam("checkedMenuNoForInsert") String checkedMenuNoForInsert - , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO - , ModelMap model) throws Exception - { - - log.info(">>>>>>>>>>>>>>> /sys/MenuCreatInsert.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - - String[] insertMenuNo = checkedMenuNoForInsert.split(","); - if (insertMenuNo == null || (insertMenuNo.length == 0)) - { - resultMsg = egovMessageSource.getMessage("fail.common.insert"); - } - else - { - // Body Setting Start --------------------------------- - bodyMap.put("checkedAuthorForInsert", checkedAuthorForInsert); - bodyMap.put("checkedMenuNoForInsert", checkedMenuNoForInsert); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatInsert.do"); - // RestApi Call end --------------------------------- - - resultMsg = egovMessageSource.getMessage("success.common.insert"); - } - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/MenuCreatInsert.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/MenuCreatSelect.do"; - } - - /** - * 메뉴 초기화 작업을 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.05.16 - */ - @RequestMapping("/sys/MenuCreatDelete.do") - public String deleteMenuCreatList( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("checkedAuthorForDelete") String checkedAuthorForDelete - , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO - , ModelMap model) throws Exception - { - - log.info(">>>>>>>>>>>>>>> /sys/MenuCreatDelete.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("checkedAuthorForDelete", checkedAuthorForDelete); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatDelete.do"); - // RestApi Call end --------------------------------- - - resultMsg = egovMessageSource.getMessage("success.common.delete"); - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/MenuCreatDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/MenuCreatSelect.do"; - } - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import com.urpsys.basefront.common.egov.util.EgovWebUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.sys.domain.MenuCreatVO; +import com.urpsys.itmsfront.sys.domain.MenuSiteMapVO; +import com.urpsys.basefront.domain.ComDefaultVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 View Controll + * @author urp 인프라본부 나혁제 + * @since 2025.01.09 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.09   나혁제        최초 생성
+ *
+ *  
+ */ + +@Slf4j +@Controller +public class MenuCreateManageController +{ + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 메뉴생성목록을 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.09 + */ + @RequestMapping(value = "/sys/MenuCreatManageSelect.do") + public String selectMenuCreatManagList( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuCreatManageSelect.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + + // Body Setting Start --------------------------------- + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatManageSelect.do"); + + List> list_menumanage = (List>)returnMap.get("list_menumanage"); + int totCnt = (int)returnMap.get("totCnt"); + + if ( list_menumanage.size() == 0 ) + resultMsg = egovMessageSource.getMessage("info.nodata.msg"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("list_menumanage" , list_menumanage); + model.addAttribute("searchVO" , searchVO); + model.addAttribute("paginationInfo" , paginationInfo); + + log.info("<<<<<<<<<<<<<<< /sys/MenuCreatManageSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/MenuCreatManage"; + } + + /** + * 메뉴생성 세부조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.09 + */ + @RequestMapping(value = "/sys/MenuCreatSelect.do") + public String selectMenuCreatList( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuCreatSelect.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(menuCreatVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatSelect.do"); + + List> list_menulist = (List>)returnMap.get("list_menulist"); + + model.addAttribute("list_menulist", list_menulist); + model.addAttribute("resultVO", menuCreatVO); + + log.info("<<<<<<<<<<<<<<< /sys/MenuCreatSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/MenuCreat"; + } + + /** + * 메뉴사이트맵 생성조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.09 + */ + @RequestMapping(value = "/sys/MenuCreatSiteMapSelect.do") + public String selectMenuCreatSiteMap( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("menuSiteMapVO") MenuSiteMapVO menuSiteMapVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuCreatSiteMapSelect.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(menuSiteMapVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatSiteMapSelect.do"); + + List> list_menulist = (List>)returnMap.get("list_menulist"); + + model.addAttribute("list_menulist", list_menulist); + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + + menuSiteMapVO.setCreatPersonId(tokenInfo == null ? "" : tokenInfo.getStrMEM_ID() ); + + model.addAttribute("resultVO", menuSiteMapVO); + + log.info("<<<<<<<<<<<<<<< /sys/MenuCreatSiteMapSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/sys/MenuCreatSiteMap"; + + } + + /** + * 메뉴생성처리 및 메뉴생성내역을 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.09 + */ + @RequestMapping("/sys/MenuCreatInsert.do") + public String insertMenuCreatList( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("checkedAuthorForInsert") String checkedAuthorForInsert + , @RequestParam("checkedMenuNoForInsert") String checkedMenuNoForInsert + , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO + , ModelMap model) throws Exception + { + + log.info(">>>>>>>>>>>>>>> /sys/MenuCreatInsert.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + + String[] insertMenuNo = checkedMenuNoForInsert.split(","); + if (insertMenuNo == null || (insertMenuNo.length == 0)) + { + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + } + else + { + // Body Setting Start --------------------------------- + bodyMap.put("checkedAuthorForInsert", checkedAuthorForInsert); + bodyMap.put("checkedMenuNoForInsert", checkedMenuNoForInsert); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatInsert.do"); + // RestApi Call end --------------------------------- + + resultMsg = egovMessageSource.getMessage("success.common.insert"); + } + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/MenuCreatInsert.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/MenuCreatSelect.do"; + } + + /** + * 메뉴 초기화 작업을 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.05.16 + */ + @RequestMapping("/sys/MenuCreatDelete.do") + public String deleteMenuCreatList( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("checkedAuthorForDelete") String checkedAuthorForDelete + , @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO + , ModelMap model) throws Exception + { + + log.info(">>>>>>>>>>>>>>> /sys/MenuCreatDelete.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("checkedAuthorForDelete", checkedAuthorForDelete); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuCreatDelete.do"); + // RestApi Call end --------------------------------- + + resultMsg = egovMessageSource.getMessage("success.common.delete"); + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/MenuCreatDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/MenuCreatSelect.do"; + } + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuManageController.java index dc188bb2..c0faba16 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/MenuManageController.java @@ -1,467 +1,467 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.itmsfront.sys.domain.MenuManageVO; -import com.urpsys.basefront.domain.ComDefaultVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 View Controll - * @author urp 인프라본부 나혁제 - * @since 2025.01.08 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.08   나혁제        최초 생성
- *
- *  
- */ - -@Slf4j -@Controller -public class MenuManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 메뉴목록 리스트 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuManageSelect.do") - public String selectMenuManageList( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuManageSelect.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageSelect.do"); - - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("list_menumanage", resultList); - model.addAttribute("searchVO", searchVO); - model.addAttribute("paginationInfo", paginationInfo); - - log.info("<<<<<<<<<<<<<<< /sys/MenuManageSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/MenuManage"; - - } - - /** - * 메뉴정보목록을 상세화면 호출 및 상세조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuManageListDetailSelect.do") - public String selectMenuManage( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("req_menuNo") String req_menuNo - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuManageListDetailSelect.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - searchVO.setSearchKeyword(req_menuNo); - - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageListDetailSelect.do"); - // RestApi Call End --------------------------------- - - MenuManageVO resultVO = ConvertUtils.convertToValueObject((Map)returnMap.get("menuManageVO"), MenuManageVO.class ); - - model.addAttribute("menuManageVO", resultVO); - - log.info("<<<<<<<<<<<<<<< /sys/MenuManageListDetailSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/MenuDetailSelectUpdt"; - } - - /** - * 메뉴정보를 등록화면으로 이동 및 등록 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuRegistInsert.do") - public String insertMenuManage( HttpServletRequest request - , HttpServletResponse response - , @RequestParam Map commandMap - , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO - , BindingResult bindingResult - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuRegistInsert.do <<<<<<<<<<<<<<<"); - - String sLocationUrl = null; - String resultMsg = ""; - - String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); - if (sCmd.equals("insert")) - { - beanValidator.validate(menuManageVO, bindingResult); - if (bindingResult.hasErrors()) - { - sLocationUrl = "uritms-tiles2/sys/MenuRegist"; - return sLocationUrl; - } - - ComDefaultVO searchVO = new ComDefaultVO(); - searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); - - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap(); - Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); - Map searchMap = ConvertUtils.convertToMap(searchVO ); - - bodyMap.put("menuManageMap", menuManageMap); - bodyMap.put("searchMap" , searchMap ); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuRegistInsert.do"); - - - int iMenuCnt = (int)returnMap.get("iMenuCnt" ); - int iProgCnt = (int)returnMap.get("iProgCnt" ); - int iIndCnt = (int)returnMap.get("iIndCnt" ); - - if (iMenuCnt != 0) - { - log.info("기존메뉴 존재"); - resultMsg = egovMessageSource.getMessage("common.isExist.msg"); - sLocationUrl = "uritms-tiles2/sys/MenuRegist"; - } - else - { - if(iProgCnt == 0 ) - { - log.info("프로그램 존재하지 않음"); - resultMsg = egovMessageSource.getMessage("fail.common.insert"); - sLocationUrl = "uritms-tiles2/sys/MenuRegist"; - } - else if(iIndCnt>0) - { - log.info("정상처리"); - resultMsg = egovMessageSource.getMessage("success.common.insert"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - - } - else - { - log.info("비정상 오류"); - resultMsg = egovMessageSource.getMessage("fail.common.insert"); - sLocationUrl = "uritms-tiles2/sys/MenuRegist"; - } - } - - model.addAttribute("resultMsg", resultMsg); - } - else - { - sLocationUrl = "uritms-tiles2/sys/MenuRegist"; - } - - log.info("<<<<<<<<<<<<<<< /sys/MenuRegistInsert.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 메뉴정보를 수정 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuDetailSelectUpdt.do") - public String updateMenuManage( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuDetailSelectUpdt.do <<<<<<<<<<<<<<<"); - - String sLocationUrl = null; - String resultMsg = ""; - - - beanValidator.validate(menuManageVO, bindingResult); - - if (bindingResult.hasErrors()) - { - sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; - return sLocationUrl; - } - - ComDefaultVO searchVO = new ComDefaultVO(); - searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); - - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap(); - Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); - Map searchMap = ConvertUtils.convertToMap(searchVO ); - - bodyMap.put("menuManageMap", menuManageMap); - bodyMap.put("searchMap" , searchMap ); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuDetailSelectUpdt.do"); - - int iProgCnt = (int)returnMap.get("iProgCnt" ); - int iIndCnt = (int)returnMap.get("iIndCnt" ); - - if(iProgCnt == 0 ) - { - log.info("프로그램 존재하지 않음"); - resultMsg = egovMessageSource.getMessage("fail.common.update"); - sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; - } - else if(iIndCnt>0) - { - log.info("정상처리"); - resultMsg = egovMessageSource.getMessage("success.common.update"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - - } - else - { - log.info("비정상 오류"); - resultMsg = egovMessageSource.getMessage("fail.common.update"); - sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; - } - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/MenuDetailSelectUpdt.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 메뉴정보를 삭제 한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuManageDelete.do") - public String deleteMenuManage( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuManageDelete.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - String sLocationUrl = null; - - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap(); - Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); - - bodyMap.put("menuManageMap", menuManageMap); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageDelete.do"); - - int iUpMenuCnt = (int)returnMap.get("iUpMenuCnt" ); - int iIndCnt = (int)returnMap.get("iIndCnt" ); - - - if (iUpMenuCnt > 0) - { - resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - else if(iIndCnt>0) - { - log.info("정상처리"); - - String _MenuNm = "%"; - menuManageVO.setMenuNm(_MenuNm); - - resultMsg = egovMessageSource.getMessage("success.common.delete"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - - } - else - { - log.info("비정상 오류"); - resultMsg = egovMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/MenuManageDelete.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 메뉴목록 멀티 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping("/sys/MenuManageListDelete.do") - public String deleteMenuManageList( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("checkedMenuNoForDel") String checkedMenuNoForDel - , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuManageListDelete.do <<<<<<<<<<<<<<<"); - - String sLocationUrl = null; - String resultMsg = ""; - - String[] delMenuNo = checkedMenuNoForDel.split(","); - - // 삭제할 자료가 업음 - if (delMenuNo == null || (delMenuNo.length == 0)) { - resultMsg = egovMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - else - { - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap(); - - bodyMap.put("checkedMenuNoForDel", checkedMenuNoForDel); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageListDelete.do"); - - int iUpMenuCnt = (int)returnMap.get("iUpMenuCnt" ); - int iIndCnt = (int)returnMap.get("iIndCnt" ); - - - if (iUpMenuCnt != 0) - { - resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - else if (iIndCnt < 1) - { - resultMsg = egovMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - else - { - resultMsg = egovMessageSource.getMessage("success.common.delete"); - sLocationUrl = "forward:/sys/MenuManageSelect.do"; - } - } - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/MenuManageListDelete.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - - - - /** - * 메뉴리스트를 조회 - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.08 - */ - @RequestMapping(value = "/sys/MenuListSelectMvmnNew.do") - public String selectMenuListMvmnNew( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/MenuListSelectMvmnNew.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuListSelectMvmnNew.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>)returnMap.get("list_menulist"); - - model.addAttribute("list_menulist", resultList); - - log.info("<<<<<<<<<<<<<<< /sys/MenuListSelectMvmnNew.do >>>>>>>>>>>>>>>"); - - return "itms/sys/MenuMvmnNew"; - } - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.itmsfront.sys.domain.MenuManageVO; +import com.urpsys.basefront.domain.ComDefaultVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 View Controll + * @author urp 인프라본부 나혁제 + * @since 2025.01.08 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.08   나혁제        최초 생성
+ *
+ *  
+ */ + +@Slf4j +@Controller +public class MenuManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 메뉴목록 리스트 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuManageSelect.do") + public String selectMenuManageList( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuManageSelect.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageSelect.do"); + + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("list_menumanage", resultList); + model.addAttribute("searchVO", searchVO); + model.addAttribute("paginationInfo", paginationInfo); + + log.info("<<<<<<<<<<<<<<< /sys/MenuManageSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/MenuManage"; + + } + + /** + * 메뉴정보목록을 상세화면 호출 및 상세조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuManageListDetailSelect.do") + public String selectMenuManage( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("req_menuNo") String req_menuNo + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuManageListDetailSelect.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + searchVO.setSearchKeyword(req_menuNo); + + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageListDetailSelect.do"); + // RestApi Call End --------------------------------- + + MenuManageVO resultVO = ConvertUtils.convertToValueObject((Map)returnMap.get("menuManageVO"), MenuManageVO.class ); + + model.addAttribute("menuManageVO", resultVO); + + log.info("<<<<<<<<<<<<<<< /sys/MenuManageListDetailSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/MenuDetailSelectUpdt"; + } + + /** + * 메뉴정보를 등록화면으로 이동 및 등록 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuRegistInsert.do") + public String insertMenuManage( HttpServletRequest request + , HttpServletResponse response + , @RequestParam Map commandMap + , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO + , BindingResult bindingResult + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuRegistInsert.do <<<<<<<<<<<<<<<"); + + String sLocationUrl = null; + String resultMsg = ""; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if (sCmd.equals("insert")) + { + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) + { + sLocationUrl = "uritms-tiles2/sys/MenuRegist"; + return sLocationUrl; + } + + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap(); + Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); + Map searchMap = ConvertUtils.convertToMap(searchVO ); + + bodyMap.put("menuManageMap", menuManageMap); + bodyMap.put("searchMap" , searchMap ); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuRegistInsert.do"); + + + int iMenuCnt = (int)returnMap.get("iMenuCnt" ); + int iProgCnt = (int)returnMap.get("iProgCnt" ); + int iIndCnt = (int)returnMap.get("iIndCnt" ); + + if (iMenuCnt != 0) + { + log.info("기존메뉴 존재"); + resultMsg = egovMessageSource.getMessage("common.isExist.msg"); + sLocationUrl = "uritms-tiles2/sys/MenuRegist"; + } + else + { + if(iProgCnt == 0 ) + { + log.info("프로그램 존재하지 않음"); + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + sLocationUrl = "uritms-tiles2/sys/MenuRegist"; + } + else if(iIndCnt>0) + { + log.info("정상처리"); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + + } + else + { + log.info("비정상 오류"); + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + sLocationUrl = "uritms-tiles2/sys/MenuRegist"; + } + } + + model.addAttribute("resultMsg", resultMsg); + } + else + { + sLocationUrl = "uritms-tiles2/sys/MenuRegist"; + } + + log.info("<<<<<<<<<<<<<<< /sys/MenuRegistInsert.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 메뉴정보를 수정 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuDetailSelectUpdt.do") + public String updateMenuManage( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuDetailSelectUpdt.do <<<<<<<<<<<<<<<"); + + String sLocationUrl = null; + String resultMsg = ""; + + + beanValidator.validate(menuManageVO, bindingResult); + + if (bindingResult.hasErrors()) + { + sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; + return sLocationUrl; + } + + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap(); + Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); + Map searchMap = ConvertUtils.convertToMap(searchVO ); + + bodyMap.put("menuManageMap", menuManageMap); + bodyMap.put("searchMap" , searchMap ); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuDetailSelectUpdt.do"); + + int iProgCnt = (int)returnMap.get("iProgCnt" ); + int iIndCnt = (int)returnMap.get("iIndCnt" ); + + if(iProgCnt == 0 ) + { + log.info("프로그램 존재하지 않음"); + resultMsg = egovMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; + } + else if(iIndCnt>0) + { + log.info("정상처리"); + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + + } + else + { + log.info("비정상 오류"); + resultMsg = egovMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/sys/MenuManageListDetailSelect.do"; + } + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/MenuDetailSelectUpdt.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 메뉴정보를 삭제 한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuManageDelete.do") + public String deleteMenuManage( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuManageDelete.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + String sLocationUrl = null; + + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap(); + Map menuManageMap = ConvertUtils.convertToMap(menuManageVO); + + bodyMap.put("menuManageMap", menuManageMap); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageDelete.do"); + + int iUpMenuCnt = (int)returnMap.get("iUpMenuCnt" ); + int iIndCnt = (int)returnMap.get("iIndCnt" ); + + + if (iUpMenuCnt > 0) + { + resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + else if(iIndCnt>0) + { + log.info("정상처리"); + + String _MenuNm = "%"; + menuManageVO.setMenuNm(_MenuNm); + + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + + } + else + { + log.info("비정상 오류"); + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/MenuManageDelete.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 메뉴목록 멀티 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping("/sys/MenuManageListDelete.do") + public String deleteMenuManageList( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("checkedMenuNoForDel") String checkedMenuNoForDel + , @ModelAttribute("menuManageVO") MenuManageVO menuManageVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuManageListDelete.do <<<<<<<<<<<<<<<"); + + String sLocationUrl = null; + String resultMsg = ""; + + String[] delMenuNo = checkedMenuNoForDel.split(","); + + // 삭제할 자료가 업음 + if (delMenuNo == null || (delMenuNo.length == 0)) { + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + else + { + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap(); + + bodyMap.put("checkedMenuNoForDel", checkedMenuNoForDel); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuManageListDelete.do"); + + int iUpMenuCnt = (int)returnMap.get("iUpMenuCnt" ); + int iIndCnt = (int)returnMap.get("iIndCnt" ); + + + if (iUpMenuCnt != 0) + { + resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + else if (iIndCnt < 1) + { + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + else + { + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl = "forward:/sys/MenuManageSelect.do"; + } + } + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/MenuManageListDelete.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + + + + /** + * 메뉴리스트를 조회 + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.08 + */ + @RequestMapping(value = "/sys/MenuListSelectMvmnNew.do") + public String selectMenuListMvmnNew( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/MenuListSelectMvmnNew.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/MenuListSelectMvmnNew.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>)returnMap.get("list_menulist"); + + model.addAttribute("list_menulist", resultList); + + log.info("<<<<<<<<<<<<<<< /sys/MenuListSelectMvmnNew.do >>>>>>>>>>>>>>>"); + + return "itms/sys/MenuMvmnNew"; + } + + + + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/ProgrmManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/ProgrmManageController.java index bb0af477..66625f34 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/ProgrmManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/ProgrmManageController.java @@ -1,437 +1,437 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - - -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.basefront.domain.ComDefaultVO; - -import com.urpsys.itmsfront.sys.domain.ProgrmManageVO; - - -import kong.unirest.HttpResponse; -import kong.unirest.JsonNode; -import kong.unirest.Unirest; -import kong.unirest.json.JSONObject; -import lombok.extern.slf4j.Slf4j; - -/** - * 프로그램관리 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자           수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.06   나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class ProgrmManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Value("${custom.api_server}") - private String strApiServer; // 인증서버 - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 프로그램 목록 조회 - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListManageSelect.do") - public String ProgramListManageSelect( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/ProgramListManageSelect.do <<<<<<<<<<<<<<<"); - - // 세션체크 - TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); - - log.info("tokenInfo=>{}", tokenInfo); - - if(tokenInfo == null) return ""; - - // Header Setting Start --------------------------------- - Map headers = new HashMap<>(); - headers.put("Content-Type", "application/json"); - - log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); - log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); - - headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); - // Header Setting End --------------------------------- - - // Body Setting Start --------------------------------- - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - String strUrl = strApiServer+"/sys/ProgramListManageSelect.do"; - - // 전송처리 - /// HttpResponse jsonResponse = Unirest.put("http://localhost:9012/sys/ProgramListManageSelect.do") - HttpResponse jsonResponse = Unirest.put(strUrl) - .headers(headers) - .body(bodyMap) - .asJson(); - - JSONObject returnObj = jsonResponse.getBody().getObject(); - JSONObject returnObjData = returnObj.getJSONObject("data"); - - log.info("returnObjData 값확인 =>{}", returnObjData); - - Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 - - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("list_progrmmanage", resultList); - model.addAttribute("searchVO", searchVO); - model.addAttribute("paginationInfo", paginationInfo); - - - /* - int totCnt = progrmManageService.selectProgrmListTotCnt(searchVO); - paginationInfo.setTotalRecordCount(totCnt); - model.addAttribute("paginationInfo", paginationInfo); - */ - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListManageSelect.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/ProgramListManage"; // 업무화면의 상단메뉴 화면 - - } - - /** - * 프로그램목록을 상세화면 호출 및 상세조회한다. - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListDetailSelect.do") - public String selectProgrm ( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("tmp_progrmNm") String tmp_progrmNm - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model) - throws Exception - { - // 필터링에서 로그인 체크 - log.info(">>>>>>>>>>>>>>> /sys/ProgramListDetailSelect.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - ProgrmManageVO vo = new ProgrmManageVO(); - vo.setProgrmFileNm(tmp_progrmNm); - - Map bodyMap = ConvertUtils.convertToMap(vo); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListDetailSelect.do"); - - log.info("returnMap => {}", returnMap.toString()); - - ProgrmManageVO progrmManageVO = ConvertUtils.convertToValueObject((Map)returnMap.get("progrmManageVO"), ProgrmManageVO.class ); - - model.addAttribute("progrmManageVO", progrmManageVO); - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListDetailSelect.do >>>>>>>>>>>>>>>"); - - - // return "egovframework/com/sym/prm/EgovProgramListDetailSelectUpdt"; - - return "uritms-tiles2/sys/ProgramListDetailSelectUpdt"; - } - - /** - * 프로그램목록을 등록화면으로 이동 및 등록 한다. - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListRegist.do") - public String insertProgrmList( HttpServletRequest request - , HttpServletResponse response - , @RequestParam Map commandMap - , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/ProgramListRegist.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - String sLocationUrl = null; - - String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); - - log.info("sCmd=>{}", sCmd); - - if(sCmd.equals("insert")) - { - beanValidator.validate(progrmManageVO, bindingResult); - - if (bindingResult.hasErrors()) - { - sLocationUrl = "uritms-tiles2/sys/ProgramListRegist"; - return sLocationUrl; - } - - if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")) - { - progrmManageVO.setProgrmDc(" "); - } - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListRegist.do"); - - resultMsg = egovMessageSource.getMessage("success.common.insert"); - sLocationUrl = "forward:/sys/ProgramListManageSelect.do"; - } - else - { - sLocationUrl = "uritms-tiles2/sys/ProgramListRegist"; - } - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListRegist.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - - /** - * 프로그램목록을 수정 한다. - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListDetailSelectUpdt.do") - public String updateProgrmList( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO - , BindingResult bindingResult - , ModelMap model ) throws Exception - { - String resultMsg = ""; - String sLocationUrl = null; - - // 필터링에서 로그인 체크 - log.info(">>>>>>>>>>>>>>> /sys/ProgramListDetailSelectUpdt.do <<<<<<<<<<<<<<<"); - - beanValidator.validate(progrmManageVO, bindingResult); - if (bindingResult.hasErrors()) - { - sLocationUrl = "forward:/sys/ProgramListDetailSelect.do"; - return sLocationUrl; - } - - if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")) - { - progrmManageVO.setProgrmDc(" "); - } - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListDetailSelectUpdt.do"); - - // progrmManageService.updateProgrm(progrmManageVO); - - resultMsg = egovMessageSource.getMessage("success.common.update"); - sLocationUrl = "forward:/sys/ProgramListManageSelect.do"; - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListDetailSelectUpdt.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 프로그램목록을 삭제 한다. - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListManageDelete.do") - public String deleteProgrmList( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("progrmManageVO")ProgrmManageVO progrmManageVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/ProgramListManageDelete.do <<<<<<<<<<<<<<<"); - - String resultMsg = ""; - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListManageDelete.do"); - - resultMsg = egovMessageSource.getMessage("success.common.delete"); - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListManageDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/ProgramListManageSelect.do"; - } - - /** - * 프로그램목록 멀티 삭제한다. - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping("/sys/ProgrmManageListDelete.do") - public String deleteProgrmManageList( HttpServletRequest request - , HttpServletResponse response - , @RequestParam("checkedProgrmFileNmForDel") String checkedProgrmFileNmForDel - , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/ProgrmManageListDelete.do <<<<<<<<<<<<<<<"); - - String sLocationUrl = null; - String resultMsg = ""; - - String [] delProgrmFileNm = checkedProgrmFileNmForDel.split(","); - - log.info("checkedProgrmFileNmForDel => [{}]", checkedProgrmFileNmForDel); - - if (delProgrmFileNm == null || (delProgrmFileNm.length ==0)) - { - resultMsg = egovMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/sys/EgovProgramListManageSelect.do"; - } - else - { - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap<>(); - bodyMap.put("checkedProgrmFileNmForDel", checkedProgrmFileNmForDel ); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgrmManageListDelete.do"); - - resultMsg = egovMessageSource.getMessage("success.common.delete"); - sLocationUrl ="forward:/sys/ProgramListManageSelect.do"; - } - - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/ProgrmManageListDelete.do >>>>>>>>>>>>>>>"); - - return sLocationUrl ; - } - - /** - * 프로그램파일명을 조회 - * @author 정보연구소 나혁제 - * 작성일 : 2025.01.06 - */ - @RequestMapping(value="/sys/ProgramListSearchNew.do") - public String selectProgrmListSearchNew( HttpServletRequest request - , HttpServletResponse response - , @ModelAttribute("searchVO") ComDefaultVO searchVO - , ModelMap model ) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/ProgramListSearchNew.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); - paginationInfo.setPageSize (searchVO.getPageSize()); - - searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); - searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - - Map bodyMap = ConvertUtils.convertToMap(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListSearchNew.do"); - // RestApi Call End --------------------------------- - - List> resultList = (List>)returnMap.get("list_progrmmanage"); - int totCnt = (int)returnMap.get("totCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("list_progrmmanage", resultList); - model.addAttribute("searchVO", searchVO); - model.addAttribute("paginationInfo", paginationInfo); - - log.info("<<<<<<<<<<<<<<< /sys/ProgramListSearchNew.do >>>>>>>>>>>>>>>"); - - return "uritms-popup1/sys/FileNmSearchNew"; // 업무화면의 상단메뉴 화면 - - } - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + + +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.basefront.domain.ComDefaultVO; + +import com.urpsys.itmsfront.sys.domain.ProgrmManageVO; + + +import kong.unirest.HttpResponse; +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import kong.unirest.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + +/** + * 프로그램관리 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.06 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자           수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.06   나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class ProgrmManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Value("${custom.api_server}") + private String strApiServer; // 인증서버 + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 프로그램 목록 조회 + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListManageSelect.do") + public String ProgramListManageSelect( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/ProgramListManageSelect.do <<<<<<<<<<<<<<<"); + + // 세션체크 + TokenInfo tokenInfo = (TokenInfo)request.getSession().getAttribute("tokenInfo"); + + log.info("tokenInfo=>{}", tokenInfo); + + if(tokenInfo == null) return ""; + + // Header Setting Start --------------------------------- + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + + log.info("tokenInfo.getAccess_token()=>{}", tokenInfo.getAccess_token()); + log.info("tokenInfo.getToken_type() =>{}", tokenInfo.getToken_type()); + + headers.put("Authorization", tokenInfo.getToken_type()+" "+tokenInfo.getAccess_token()); + // Header Setting End --------------------------------- + + // Body Setting Start --------------------------------- + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + String strUrl = strApiServer+"/sys/ProgramListManageSelect.do"; + + // 전송처리 + /// HttpResponse jsonResponse = Unirest.put("http://localhost:9012/sys/ProgramListManageSelect.do") + HttpResponse jsonResponse = Unirest.put(strUrl) + .headers(headers) + .body(bodyMap) + .asJson(); + + JSONObject returnObj = jsonResponse.getBody().getObject(); + JSONObject returnObjData = returnObj.getJSONObject("data"); + + log.info("returnObjData 값확인 =>{}", returnObjData); + + Map returnMap = ConvertUtils.getMapFromJSONObject(returnObjData); // Map 변환처리 + + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("list_progrmmanage", resultList); + model.addAttribute("searchVO", searchVO); + model.addAttribute("paginationInfo", paginationInfo); + + + /* + int totCnt = progrmManageService.selectProgrmListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + */ + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListManageSelect.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/ProgramListManage"; // 업무화면의 상단메뉴 화면 + + } + + /** + * 프로그램목록을 상세화면 호출 및 상세조회한다. + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListDetailSelect.do") + public String selectProgrm ( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("tmp_progrmNm") String tmp_progrmNm + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model) + throws Exception + { + // 필터링에서 로그인 체크 + log.info(">>>>>>>>>>>>>>> /sys/ProgramListDetailSelect.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + ProgrmManageVO vo = new ProgrmManageVO(); + vo.setProgrmFileNm(tmp_progrmNm); + + Map bodyMap = ConvertUtils.convertToMap(vo); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListDetailSelect.do"); + + log.info("returnMap => {}", returnMap.toString()); + + ProgrmManageVO progrmManageVO = ConvertUtils.convertToValueObject((Map)returnMap.get("progrmManageVO"), ProgrmManageVO.class ); + + model.addAttribute("progrmManageVO", progrmManageVO); + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListDetailSelect.do >>>>>>>>>>>>>>>"); + + + // return "egovframework/com/sym/prm/EgovProgramListDetailSelectUpdt"; + + return "uritms-tiles2/sys/ProgramListDetailSelectUpdt"; + } + + /** + * 프로그램목록을 등록화면으로 이동 및 등록 한다. + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListRegist.do") + public String insertProgrmList( HttpServletRequest request + , HttpServletResponse response + , @RequestParam Map commandMap + , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/ProgramListRegist.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + String sLocationUrl = null; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + log.info("sCmd=>{}", sCmd); + + if(sCmd.equals("insert")) + { + beanValidator.validate(progrmManageVO, bindingResult); + + if (bindingResult.hasErrors()) + { + sLocationUrl = "uritms-tiles2/sys/ProgramListRegist"; + return sLocationUrl; + } + + if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")) + { + progrmManageVO.setProgrmDc(" "); + } + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListRegist.do"); + + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sys/ProgramListManageSelect.do"; + } + else + { + sLocationUrl = "uritms-tiles2/sys/ProgramListRegist"; + } + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListRegist.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + + /** + * 프로그램목록을 수정 한다. + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListDetailSelectUpdt.do") + public String updateProgrmList( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO + , BindingResult bindingResult + , ModelMap model ) throws Exception + { + String resultMsg = ""; + String sLocationUrl = null; + + // 필터링에서 로그인 체크 + log.info(">>>>>>>>>>>>>>> /sys/ProgramListDetailSelectUpdt.do <<<<<<<<<<<<<<<"); + + beanValidator.validate(progrmManageVO, bindingResult); + if (bindingResult.hasErrors()) + { + sLocationUrl = "forward:/sys/ProgramListDetailSelect.do"; + return sLocationUrl; + } + + if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")) + { + progrmManageVO.setProgrmDc(" "); + } + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListDetailSelectUpdt.do"); + + // progrmManageService.updateProgrm(progrmManageVO); + + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sys/ProgramListManageSelect.do"; + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListDetailSelectUpdt.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 프로그램목록을 삭제 한다. + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListManageDelete.do") + public String deleteProgrmList( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("progrmManageVO")ProgrmManageVO progrmManageVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/ProgramListManageDelete.do <<<<<<<<<<<<<<<"); + + String resultMsg = ""; + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(progrmManageVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListManageDelete.do"); + + resultMsg = egovMessageSource.getMessage("success.common.delete"); + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListManageDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/ProgramListManageSelect.do"; + } + + /** + * 프로그램목록 멀티 삭제한다. + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping("/sys/ProgrmManageListDelete.do") + public String deleteProgrmManageList( HttpServletRequest request + , HttpServletResponse response + , @RequestParam("checkedProgrmFileNmForDel") String checkedProgrmFileNmForDel + , @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/ProgrmManageListDelete.do <<<<<<<<<<<<<<<"); + + String sLocationUrl = null; + String resultMsg = ""; + + String [] delProgrmFileNm = checkedProgrmFileNmForDel.split(","); + + log.info("checkedProgrmFileNmForDel => [{}]", checkedProgrmFileNmForDel); + + if (delProgrmFileNm == null || (delProgrmFileNm.length ==0)) + { + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sys/EgovProgramListManageSelect.do"; + } + else + { + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap<>(); + bodyMap.put("checkedProgrmFileNmForDel", checkedProgrmFileNmForDel ); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgrmManageListDelete.do"); + + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl ="forward:/sys/ProgramListManageSelect.do"; + } + + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/ProgrmManageListDelete.do >>>>>>>>>>>>>>>"); + + return sLocationUrl ; + } + + /** + * 프로그램파일명을 조회 + * @author 정보연구소 나혁제 + * 작성일 : 2025.01.06 + */ + @RequestMapping(value="/sys/ProgramListSearchNew.do") + public String selectProgrmListSearchNew( HttpServletRequest request + , HttpServletResponse response + , @ModelAttribute("searchVO") ComDefaultVO searchVO + , ModelMap model ) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/ProgramListSearchNew.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (searchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (searchVO.getPageUnit()); + paginationInfo.setPageSize (searchVO.getPageSize()); + + searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + searchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + + Map bodyMap = ConvertUtils.convertToMap(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/ProgramListSearchNew.do"); + // RestApi Call End --------------------------------- + + List> resultList = (List>)returnMap.get("list_progrmmanage"); + int totCnt = (int)returnMap.get("totCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("list_progrmmanage", resultList); + model.addAttribute("searchVO", searchVO); + model.addAttribute("paginationInfo", paginationInfo); + + log.info("<<<<<<<<<<<<<<< /sys/ProgramListSearchNew.do >>>>>>>>>>>>>>>"); + + return "uritms-popup1/sys/FileNmSearchNew"; // 업무화면의 상단메뉴 화면 + + } + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletCreateManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletCreateManageController.java index 70f7d06d..b08e400e 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletCreateManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletCreateManageController.java @@ -1,447 +1,447 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 개인화메뉴생성관리 controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.03.10 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.03.10   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class PrsnlPortletCreateManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - - /** - * 개인화메뉴생성관리 목록을 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/selectPortletCreate.do") - public String selectPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/selectPortletCreate.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start ------------------------------- - prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); - - prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/selectPortletCreate.do"); - // RestApi Call End ----------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - int totCnt = (int) returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - model.addAttribute("resultNum" , totCnt); - - - log.info("<<<<<<<<<<<<<<< /sys/selectPortletCreate.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/PrsnlPortletCreateManage"; - } - - /** - * 사용자의 개인화메뉴를 등록한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/insertPrsnlPortletCreate.do") - public String insertPrsnlPortletCreate(@ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , BindingResult bindingResult - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/insertPrsnlPortletCreate.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String sLocationUrl = "uritms-tiles2/sys/PrsnlPortletCreateRegist"; - - String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); - - // 등록처리 - if(sCmd.equals("save")) - { - //서버 validate 체크 - beanValidator.validate(prsnlPortletCreateVO, bindingResult); - if(bindingResult.hasErrors()) - { - return sLocationUrl; - } - - // Body Setting Start --------------------------------- - prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); - - prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - //아이디 설정 - prsnlPortletCreateVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - //prsnlPortletCreateVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - prsnlPortletCreateVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - String insPrnslIds = commandMap.get("insPrnslIds") == null ? "" : (String) commandMap.get("insPrnslIds"); - String delPrnslIds = commandMap.get("delPrnslIds") == null ? "" : (String) commandMap.get("delPrnslIds"); - - Map bodyMap = new LinkedHashMap(); - - bodyMap.put("insPrnslIds", insPrnslIds); - bodyMap.put("delPrnslIds", delPrnslIds); - bodyMap.put("prsnlPortletCreateVO", ConvertUtils.convertToMapAll(prsnlPortletCreateVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/insertPrsnlPortletCreate.do"); - // RestApi Call End ----------------------------------- - - sLocationUrl = "forward:/sys/selectPortletCreate.do"; - } - // 등록페이지 이동 처리 - else - { - // Body Setting Start --------------------------------- - prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); - - prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - //아이디 설정 - prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/selectPortletCreateRegistList.do"); - // RestApi Call End ----------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - int totCnt = (int) returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - } - - - log.info("<<<<<<<<<<<<<<< /sys/insertPrsnlPortletCreate.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 사용자의 개인화메뉴 정보를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/inqirePrsnlPortletCreate.do") - public String inqirePrsnlPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/inqirePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - searchVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortletCreate.do"); - // RestApi Call End --------------------------------- - - PrsnlPortletCreateVO prsnlPortletCreateVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletCreateVO.class); - model.addAttribute("prsnlPortletCreateVO", prsnlPortletCreateVO); - - - log.info("<<<<<<<<<<<<<<< /sys/inqirePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/PrsnlPortletCreateDetail"; - } - - /** - * 사용자의 개인화메뉴 정보를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/updatePrsnlPortletCreate.do") - public String updatePrsnlPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO searchVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //서버 validate 체크 - beanValidator.validate(searchVO, bindingResult); - if(bindingResult.hasErrors()) - { - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortletCreate.do"); - // RestApi Call End --------------------------------- - - PrsnlPortletCreateVO prsnlPortletCreateVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletCreateVO.class); - model.addAttribute("prsnlPortletCreateVO", prsnlPortletCreateVO); - - return "uritms-tiles2/sys/PrsnlPortletCreateDetail"; - } - - // Body Setting Start --------------------------------- - //searchVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - searchVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - searchVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updatePrsnlPortletCreate.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectPortletCreate.do"; - } - - /** - * 사용자의 개인화메뉴 순서를 수정한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/updatePrsnlPortletCreateOrdr.do") - public String updatePrsnlPortletCreateOrdr(@ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortletCreateOrdr.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - boolean changed = false; - - // Body Setting Start --------------------------------- - prsnlPortletCreateVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - prsnlPortletCreateVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); - // Body Setting End --------------------------------- - - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/updatePrsnlPortletCreateOrdr.do"); - // RestApi Call End --------------------------------- - - changed = (boolean) returnMap.get("changed"); - - String checkedPrsnlId = (String) commandMap.get("checkedPrsnlId"); - model.addAttribute("checkedPrsnlId", checkedPrsnlId); - - if(!changed) - { - model.addAttribute("indictOrdrChanged", "false"); - } - - log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortletCreateOrdr.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectPortletCreate.do"; - } - - /** - * 사용자의 개인화메뉴를 삭제한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/deletePrsnlPortletCreate.do") - public String deletePrsnlPortletCreate(@ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); - - prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/deletePrsnlPortletCreate.do"); - // RestApi Call End --------------------------------- - - log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectPortletCreate.do"; - } - - /** - * 개인화메뉴생성관리 목록2를 조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.03.10 - */ - @RequestMapping("/sys/selectPortletCreate2.do") - public String selectPortletCreate2( @ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO - , PrsnlPortletManageVO prsnlPortletManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/selectPortletCreate2.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); - - prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); - - prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMap(prsnlPortletCreateVO); - Map bodyMap2 = ConvertUtils.convertToMap(prsnlPortletManageVO); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/potl/mainPortletPage.do"); - Map returnMap2 = restApiCallUtil.RestApiCall( bodyMap2, "/sys/selectPortletManageList.do"); - - List> resultList = (List>)returnMap.get("resultList"); - List> resultList2 = (List>)returnMap2.get("resultList"); - - int portletCnt = (int)returnMap.get("totCnt" ); - int iMaxSeq = (int)returnMap.get("iMaxSeq"); // 2025.11.11 나혁제 정렬최대순서 - - model.addAttribute("resultList" , resultList ); - model.addAttribute("resultList2", resultList2 ); - model.addAttribute("portletCnt" , portletCnt ); - model.addAttribute("iMaxSeq" , iMaxSeq ); // 2025.11.11 나혁제 정렬최대순서 - - log.info("<<<<<<<<<<<<<<< /sys/selectPortletCreate2.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles3/sys/PrsnlPortletCreateManage2"; - } - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 개인화메뉴생성관리 controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.03.10 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.03.10   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class PrsnlPortletCreateManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + + /** + * 개인화메뉴생성관리 목록을 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/selectPortletCreate.do") + public String selectPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/selectPortletCreate.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start ------------------------------- + prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); + + prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/selectPortletCreate.do"); + // RestApi Call End ----------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + int totCnt = (int) returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + model.addAttribute("resultNum" , totCnt); + + + log.info("<<<<<<<<<<<<<<< /sys/selectPortletCreate.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/PrsnlPortletCreateManage"; + } + + /** + * 사용자의 개인화메뉴를 등록한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/insertPrsnlPortletCreate.do") + public String insertPrsnlPortletCreate(@ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , BindingResult bindingResult + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/insertPrsnlPortletCreate.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String sLocationUrl = "uritms-tiles2/sys/PrsnlPortletCreateRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + // 등록처리 + if(sCmd.equals("save")) + { + //서버 validate 체크 + beanValidator.validate(prsnlPortletCreateVO, bindingResult); + if(bindingResult.hasErrors()) + { + return sLocationUrl; + } + + // Body Setting Start --------------------------------- + prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); + + prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + //아이디 설정 + prsnlPortletCreateVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + //prsnlPortletCreateVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + prsnlPortletCreateVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + String insPrnslIds = commandMap.get("insPrnslIds") == null ? "" : (String) commandMap.get("insPrnslIds"); + String delPrnslIds = commandMap.get("delPrnslIds") == null ? "" : (String) commandMap.get("delPrnslIds"); + + Map bodyMap = new LinkedHashMap(); + + bodyMap.put("insPrnslIds", insPrnslIds); + bodyMap.put("delPrnslIds", delPrnslIds); + bodyMap.put("prsnlPortletCreateVO", ConvertUtils.convertToMapAll(prsnlPortletCreateVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/insertPrsnlPortletCreate.do"); + // RestApi Call End ----------------------------------- + + sLocationUrl = "forward:/sys/selectPortletCreate.do"; + } + // 등록페이지 이동 처리 + else + { + // Body Setting Start --------------------------------- + prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); + + prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + //아이디 설정 + prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/selectPortletCreateRegistList.do"); + // RestApi Call End ----------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + int totCnt = (int) returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + } + + + log.info("<<<<<<<<<<<<<<< /sys/insertPrsnlPortletCreate.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 사용자의 개인화메뉴 정보를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/inqirePrsnlPortletCreate.do") + public String inqirePrsnlPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/inqirePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + searchVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortletCreate.do"); + // RestApi Call End --------------------------------- + + PrsnlPortletCreateVO prsnlPortletCreateVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletCreateVO.class); + model.addAttribute("prsnlPortletCreateVO", prsnlPortletCreateVO); + + + log.info("<<<<<<<<<<<<<<< /sys/inqirePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/PrsnlPortletCreateDetail"; + } + + /** + * 사용자의 개인화메뉴 정보를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/updatePrsnlPortletCreate.do") + public String updatePrsnlPortletCreate(@ModelAttribute("searchVO") PrsnlPortletCreateVO searchVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //서버 validate 체크 + beanValidator.validate(searchVO, bindingResult); + if(bindingResult.hasErrors()) + { + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortletCreate.do"); + // RestApi Call End --------------------------------- + + PrsnlPortletCreateVO prsnlPortletCreateVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletCreateVO.class); + model.addAttribute("prsnlPortletCreateVO", prsnlPortletCreateVO); + + return "uritms-tiles2/sys/PrsnlPortletCreateDetail"; + } + + // Body Setting Start --------------------------------- + //searchVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + searchVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + searchVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updatePrsnlPortletCreate.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectPortletCreate.do"; + } + + /** + * 사용자의 개인화메뉴 순서를 수정한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/updatePrsnlPortletCreateOrdr.do") + public String updatePrsnlPortletCreateOrdr(@ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortletCreateOrdr.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + boolean changed = false; + + // Body Setting Start --------------------------------- + prsnlPortletCreateVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + prsnlPortletCreateVO.setEsntlId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); + // Body Setting End --------------------------------- + + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/updatePrsnlPortletCreateOrdr.do"); + // RestApi Call End --------------------------------- + + changed = (boolean) returnMap.get("changed"); + + String checkedPrsnlId = (String) commandMap.get("checkedPrsnlId"); + model.addAttribute("checkedPrsnlId", checkedPrsnlId); + + if(!changed) + { + model.addAttribute("indictOrdrChanged", "false"); + } + + log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortletCreateOrdr.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectPortletCreate.do"; + } + + /** + * 사용자의 개인화메뉴를 삭제한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/deletePrsnlPortletCreate.do") + public String deletePrsnlPortletCreate(@ModelAttribute("prsnlPortletCreateVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortletCreate.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + prsnlPortletCreateVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletCreateVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletCreateVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletCreateVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletCreateVO.getPageSize()); + + prsnlPortletCreateVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletCreateVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletCreateVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + prsnlPortletCreateVO.setEsntlId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletCreateVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/deletePrsnlPortletCreate.do"); + // RestApi Call End --------------------------------- + + log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortletCreate.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectPortletCreate.do"; + } + + /** + * 개인화메뉴생성관리 목록2를 조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.03.10 + */ + @RequestMapping("/sys/selectPortletCreate2.do") + public String selectPortletCreate2( @ModelAttribute("searchVO") PrsnlPortletCreateVO prsnlPortletCreateVO + , PrsnlPortletManageVO prsnlPortletManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/selectPortletCreate2.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + prsnlPortletCreateVO.setUserId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getStrMEM_ID())); + + prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); + + prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMap(prsnlPortletCreateVO); + Map bodyMap2 = ConvertUtils.convertToMap(prsnlPortletManageVO); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/potl/mainPortletPage.do"); + Map returnMap2 = restApiCallUtil.RestApiCall( bodyMap2, "/sys/selectPortletManageList.do"); + + List> resultList = (List>)returnMap.get("resultList"); + List> resultList2 = (List>)returnMap2.get("resultList"); + + int portletCnt = (int)returnMap.get("totCnt" ); + int iMaxSeq = (int)returnMap.get("iMaxSeq"); // 2025.11.11 나혁제 정렬최대순서 + + model.addAttribute("resultList" , resultList ); + model.addAttribute("resultList2", resultList2 ); + model.addAttribute("portletCnt" , portletCnt ); + model.addAttribute("iMaxSeq" , iMaxSeq ); // 2025.11.11 나혁제 정렬최대순서 + + log.info("<<<<<<<<<<<<<<< /sys/selectPortletCreate2.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles3/sys/PrsnlPortletCreateManage2"; + } + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletManageController.java index aa32407e..c97bf9c2 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/PrsnlPortletManageController.java @@ -1,493 +1,493 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.io.File; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.egov.util.EgovStringUtil; -import com.urpsys.basefront.common.egov.util.EgovWebUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 개인화메뉴관리 controller 클래스 - * @author URP 인프라본부 나혁제 - * @since 2025.03.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일         수정자       수정내용
- *  ----------   --------   ---------------------------
- *  2025.03.06   나혁제       최초 생성
- *
- * 
- * - */ - -@Slf4j -@Controller -public class PrsnlPortletManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertyService; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Value("${custom.path.phy_svy}") - private String storeSvyPathString; // 템플릿 이미지 물리적주소 - - @Value("${custom.path.loc_svy}") - private String storeSvyUriPathString; // 템플릿 이미지 물리적주소 - - @Autowired - CommonService commonService; - - /** - * 개인화메뉴 목록을 조회한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/selectPortletManageList.do") - public String selectPortletManageList(@ModelAttribute("searchVO") PrsnlPortletManageVO prsnlPortletManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/selectPortletManageList.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start ------------------------------- - prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); - prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); - - PaginationInfo paginationInfo = new PaginationInfo(); - - paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); - paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); - - prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/selectPortletManageList.do"); - // RestApi Call End ----------------------------------- - - List> resultList = (List>) returnMap.get("resultList"); - //List resultList = ConvertUtils.convertToValueObjectsAll((List>) returnMap.get("resultList"), PrsnlPortletManageVO.class); - int totCnt = (int) returnMap.get("resultCnt"); - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList" , resultList); - model.addAttribute("resultCnt" , totCnt); - model.addAttribute("paginationInfo" , paginationInfo); - - // 2025.12.08 나혁제 TEST1 만 삭제권한 - if(memberVo.getTokenInfo().getStrMEM_ID().equals("TEST1")) - { - model.addAttribute("delAuthYn" , "Y"); - } - else - { - model.addAttribute("delAuthYn" , "N"); - } - - log.info("<<<<<<<<<<<<<<< /sys/selectPortletManageList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/PrsnlPortletManageList"; - } - - /** - * 개인화메뉴를 등록한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/insertPrsnlPortlet.do") - public String insertPrsnlPortlet(final MultipartHttpServletRequest multiRequest - , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO - , BindingResult bindingResult - , @RequestParam Map commandMap - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/insertPrsnlPortlet.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - String sLocationUrl = "uritms-tiles2/sys/PrsnlPortletManageRegist"; - - String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); - if(sCmd.equals("save")) - { - //서버 validate 체크 - beanValidator.validate(prsnlPortletManageVO, bindingResult); - if(bindingResult.hasErrors()) - { - return sLocationUrl; - } - - // Body Setting Start --------------------------------- - final Map files = multiRequest.getFileMap(); - if (files != null && !files.isEmpty()) - { - for (MultipartFile file : files.values()) - { - log.info("getName => {}", file.getName()); - log.info("getOriginalFilename => {}", file.getOriginalFilename()); - - if ( file.getName() != null - && !file.getName().equals("") - && file.getOriginalFilename() != null - && !file.getOriginalFilename().equals("")) - { - String filePath = storeSvyPathString + file.getOriginalFilename(); - String fileUrlPath = storeSvyUriPathString + file.getOriginalFilename(); - - log.info("filePath => {}", filePath); - log.info("fileUrlPath => {}", storeSvyUriPathString); - log.info("EgovWebUtil => {}", EgovWebUtil.filePathBlackList(filePath)); - - file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); // 파일저장 - prsnlPortletManageVO.setPortletImgPath(fileUrlPath); - - String strImgNm = commonService.GetIdGen("portletImgIdGnrService"); - - // 포틀릿이미지명 추가 - /* - prsnlPortletManageVO.setPortletImgNm(portletImgIdgenService.getNextStringId()); - */ - prsnlPortletManageVO.setPortletImgNm(strImgNm); - prsnlPortletManageVO.setPortletImgOriNm(file.getOriginalFilename()); - } - } - } - - //아이디 설정 - prsnlPortletManageVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - prsnlPortletManageVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - /* - String prsnlId = portletIdgenService.getNextStringId(); - */ - - String prsnlId = commonService.GetIdGen("prsnlPortletIdGnrService"); - prsnlPortletManageVO.setPrsnlId(prsnlId); - - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/insertPrsnlPortlet.do"); - // RestApi Call End ----------------------------------- - - sLocationUrl = "forward:/sys/selectPortletManageList.do"; - } - - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions.Images"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - log.info("<<<<<<<<<<<<<<< /sys/insertPrsnlPortlet.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 개인화메뉴 정보를 조회한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/inqirePrsnlPortlet.do") - public String inqirePrsnlPortlet(@ModelAttribute("searchVO") PrsnlPortletManageVO searchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/inqirePrsnlPortlet.do <<<<<<<<<<<<<<<"); - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortlet.do"); - // RestApi Call End --------------------------------- - - PrsnlPortletManageVO prsnlPortletManageVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletManageVO.class); - model.addAttribute("prsnlPortletManageVO", prsnlPortletManageVO); - - // 파일업로드 제한 - String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions.Images"); - String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); - - model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); - model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); - - // 2025.12.08 나혁제 TEST1 만 삭제권한 - if(memberVo.getTokenInfo().getStrMEM_ID().equals("TEST1")) - { - model.addAttribute("delAuthYn" , "Y"); - } - else - { - model.addAttribute("delAuthYn" , "N"); - } - - - log.info("<<<<<<<<<<<<<<< /sys/inqirePrsnlPortlet.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/PrsnlPortletManageDetail"; - } - - /** - * 개인화메뉴 정보를 수정한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/updatePrsnlPortlet.do") - public String updatePrsnlPortlet(final MultipartHttpServletRequest multiRequest - , @ModelAttribute("searchVO") PrsnlPortletManageVO searchVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortlet.do <<<<<<<<<<<<<<<"); - - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - //서버 validate 체크 - beanValidator.validate(searchVO, bindingResult); - if(bindingResult.hasErrors()) - { - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortlet.do"); - // RestApi Call End --------------------------------- - - PrsnlPortletManageVO prsnlPortletManageVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletManageVO.class); - model.addAttribute("prsnlPortletManageVO", prsnlPortletManageVO); - - return "uritms-tiles2/sys/PrsnlPortletManageDetail"; - } - - // Body Setting Start --------------------------------- - final Map files = multiRequest.getFileMap(); - if (files != null && !files.isEmpty()) - { - for (MultipartFile file : files.values()) - { - log.info("getName => {}", file.getName()); - log.info("getOriginalFilename => {}", file.getOriginalFilename()); - - String filePath = storeSvyPathString + file.getOriginalFilename(); - String fileUrlPath = storeSvyUriPathString + file.getOriginalFilename(); - - // 파일 수정여부 확인 - if (!file.getOriginalFilename().equals("")) - { - if (file.getName().equals("portletImg")) - { - file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); // 파일저장 - searchVO.setPortletImgPath(fileUrlPath); - searchVO.setPortletImgOriNm(file.getOriginalFilename()); - } - } - } - } - - searchVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); - - Map bodyMap = ConvertUtils.convertToMapAll(searchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updatePrsnlPortlet.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortlet.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectPortletManageList.do"; - } - - /** - * 개인화메뉴 정보를 삭제한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/deletePrsnlPortlet.do") - public String deletePrsnlPortlet(@ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortlet.do <<<<<<<<<<<<<<<"); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/deletePrsnlPortlet.do"); - // RestApi Call End --------------------------------- - - - log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortlet.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/selectPortletManageList.do"; - } - - /** - * 개인화메뉴 정보를 멀티 삭제한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.03.06 - */ - @RequestMapping("/sys/deletePrsnlPortletMulti.do") - public String deletePrsnlPortletMulti(HttpServletRequest request - , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO - , @RequestParam("checkedPrsnlIdForDel") String checkedPrsnlIdForDel - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortletMulti.do <<<<<<<<<<<<<<<"); - - - String sLocationUrl = ""; - String resultMsg = ""; - - String [] delPrsnlId = checkedPrsnlIdForDel.split(","); - log.info("checkedPrsnlIdForDel => [{}]", checkedPrsnlIdForDel); - - if ( (delPrsnlId == null ) - || (delPrsnlId.length == 0) ) - { - resultMsg = egovMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/sys/selectPortletManageList.do"; - } - else - { - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap<>(); - bodyMap.put("checkedPrsnlIdForDel", checkedPrsnlIdForDel); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/deletePrsnlPortletMulti.do"); - - resultMsg = egovMessageSource.getMessage("success.common.delete"); - sLocationUrl = "forward:/sys/selectPortletManageList.do"; - } - - - log.info("resultMsg => [{}]", resultMsg); - model.addAttribute("resultMsg", resultMsg); - - - log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortletMulti.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - /** - * 개인화메뉴 정보를 멀티 상태변경 처리한다. - * @author URP 인프라본부 나혁제 - * 작성일 : 2025.12.08 - */ - @RequestMapping("/sys/updateStatusPrsnlPortletMulti.do") - public String updateStatusPrsnlPortletMulti(HttpServletRequest request - , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO - , @RequestParam("checkedPrsnlIdForDel") String checkedPrsnlIdForDel - , @RequestParam("checkUseAts") String checkUseAts - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/updateStatusPrsnlPortletMulti.do <<<<<<<<<<<<<<<"); - - String sLocationUrl = ""; - String resultMsg = ""; - - log.info("checkedPrsnlIdForDel => [{}]", checkedPrsnlIdForDel ); - log.info("checkUseAts => [{}]", checkUseAts ); - - String [] delPrsnlId = checkedPrsnlIdForDel.split(","); - - if ( (delPrsnlId == null ) - || (delPrsnlId.length == 0) ) - { - resultMsg = egovMessageSource.getMessage("fail.common.update"); - sLocationUrl = "forward:/sys/selectPortletManageList.do"; - } - else - { - // Body Setting Start --------------------------------- - Map bodyMap = new HashMap<>(); - bodyMap.put("checkedPrsnlIdForDel", checkedPrsnlIdForDel); - bodyMap.put("checkUseAts" , checkUseAts ); - // Body Setting End --------------------------------- - - Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/updateStatusPrsnlPortletMulti.do"); - - resultMsg = egovMessageSource.getMessage("success.common.update"); - sLocationUrl = "forward:/sys/selectPortletManageList.do"; - } - - - log.info("resultMsg => [{}]", resultMsg); - model.addAttribute("resultMsg", resultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/updateStatusPrsnlPortletMulti.do >>>>>>>>>>>>>>>"); - - return sLocationUrl; - } - - - - - +package com.urpsys.itmsfront.sys.controller; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.common.egov.util.EgovStringUtil; +import com.urpsys.basefront.common.egov.util.EgovWebUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.itmsfront.sys.domain.PrsnlPortletManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 개인화메뉴관리 controller 클래스 + * @author URP 인프라본부 나혁제 + * @since 2025.03.06 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.03.06   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Controller +public class PrsnlPortletManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Value("${custom.path.phy_svy}") + private String storeSvyPathString; // 템플릿 이미지 물리적주소 + + @Value("${custom.path.loc_svy}") + private String storeSvyUriPathString; // 템플릿 이미지 물리적주소 + + @Autowired + CommonService commonService; + + /** + * 개인화메뉴 목록을 조회한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/selectPortletManageList.do") + public String selectPortletManageList(@ModelAttribute("searchVO") PrsnlPortletManageVO prsnlPortletManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/selectPortletManageList.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start ------------------------------- + prsnlPortletManageVO.setPageUnit(propertyService.getInt("pageUnit")); + prsnlPortletManageVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo (prsnlPortletManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(prsnlPortletManageVO.getPageUnit()); + paginationInfo.setPageSize (prsnlPortletManageVO.getPageSize()); + + prsnlPortletManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + prsnlPortletManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + prsnlPortletManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/selectPortletManageList.do"); + // RestApi Call End ----------------------------------- + + List> resultList = (List>) returnMap.get("resultList"); + //List resultList = ConvertUtils.convertToValueObjectsAll((List>) returnMap.get("resultList"), PrsnlPortletManageVO.class); + int totCnt = (int) returnMap.get("resultCnt"); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList" , resultList); + model.addAttribute("resultCnt" , totCnt); + model.addAttribute("paginationInfo" , paginationInfo); + + // 2025.12.08 나혁제 TEST1 만 삭제권한 + if(memberVo.getTokenInfo().getStrMEM_ID().equals("TEST1")) + { + model.addAttribute("delAuthYn" , "Y"); + } + else + { + model.addAttribute("delAuthYn" , "N"); + } + + log.info("<<<<<<<<<<<<<<< /sys/selectPortletManageList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/PrsnlPortletManageList"; + } + + /** + * 개인화메뉴를 등록한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/insertPrsnlPortlet.do") + public String insertPrsnlPortlet(final MultipartHttpServletRequest multiRequest + , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO + , BindingResult bindingResult + , @RequestParam Map commandMap + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/insertPrsnlPortlet.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + String sLocationUrl = "uritms-tiles2/sys/PrsnlPortletManageRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + if(sCmd.equals("save")) + { + //서버 validate 체크 + beanValidator.validate(prsnlPortletManageVO, bindingResult); + if(bindingResult.hasErrors()) + { + return sLocationUrl; + } + + // Body Setting Start --------------------------------- + final Map files = multiRequest.getFileMap(); + if (files != null && !files.isEmpty()) + { + for (MultipartFile file : files.values()) + { + log.info("getName => {}", file.getName()); + log.info("getOriginalFilename => {}", file.getOriginalFilename()); + + if ( file.getName() != null + && !file.getName().equals("") + && file.getOriginalFilename() != null + && !file.getOriginalFilename().equals("")) + { + String filePath = storeSvyPathString + file.getOriginalFilename(); + String fileUrlPath = storeSvyUriPathString + file.getOriginalFilename(); + + log.info("filePath => {}", filePath); + log.info("fileUrlPath => {}", storeSvyUriPathString); + log.info("EgovWebUtil => {}", EgovWebUtil.filePathBlackList(filePath)); + + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); // 파일저장 + prsnlPortletManageVO.setPortletImgPath(fileUrlPath); + + String strImgNm = commonService.GetIdGen("portletImgIdGnrService"); + + // 포틀릿이미지명 추가 + /* + prsnlPortletManageVO.setPortletImgNm(portletImgIdgenService.getNextStringId()); + */ + prsnlPortletManageVO.setPortletImgNm(strImgNm); + prsnlPortletManageVO.setPortletImgOriNm(file.getOriginalFilename()); + } + } + } + + //아이디 설정 + prsnlPortletManageVO.setFrstRegisterId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + prsnlPortletManageVO.setLastUpdusrId (memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + /* + String prsnlId = portletIdgenService.getNextStringId(); + */ + + String prsnlId = commonService.GetIdGen("prsnlPortletIdGnrService"); + prsnlPortletManageVO.setPrsnlId(prsnlId); + + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/insertPrsnlPortlet.do"); + // RestApi Call End ----------------------------------- + + sLocationUrl = "forward:/sys/selectPortletManageList.do"; + } + + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions.Images"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + log.info("<<<<<<<<<<<<<<< /sys/insertPrsnlPortlet.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 개인화메뉴 정보를 조회한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/inqirePrsnlPortlet.do") + public String inqirePrsnlPortlet(@ModelAttribute("searchVO") PrsnlPortletManageVO searchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/inqirePrsnlPortlet.do <<<<<<<<<<<<<<<"); + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortlet.do"); + // RestApi Call End --------------------------------- + + PrsnlPortletManageVO prsnlPortletManageVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletManageVO.class); + model.addAttribute("prsnlPortletManageVO", prsnlPortletManageVO); + + // 파일업로드 제한 + String whiteListFileUploadExtensions = propertyService.getString("Globals.fileUpload.Extensions.Images"); + String fileUploadMaxSize = propertyService.getString("Globals.fileUpload.maxSize"); + + model.addAttribute("fileUploadExtensions", whiteListFileUploadExtensions); + model.addAttribute("fileUploadMaxSize" , fileUploadMaxSize); + + // 2025.12.08 나혁제 TEST1 만 삭제권한 + if(memberVo.getTokenInfo().getStrMEM_ID().equals("TEST1")) + { + model.addAttribute("delAuthYn" , "Y"); + } + else + { + model.addAttribute("delAuthYn" , "N"); + } + + + log.info("<<<<<<<<<<<<<<< /sys/inqirePrsnlPortlet.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/PrsnlPortletManageDetail"; + } + + /** + * 개인화메뉴 정보를 수정한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/updatePrsnlPortlet.do") + public String updatePrsnlPortlet(final MultipartHttpServletRequest multiRequest + , @ModelAttribute("searchVO") PrsnlPortletManageVO searchVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/updatePrsnlPortlet.do <<<<<<<<<<<<<<<"); + + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + //서버 validate 체크 + beanValidator.validate(searchVO, bindingResult); + if(bindingResult.hasErrors()) + { + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall( bodyMap, "/sys/inqirePrsnlPortlet.do"); + // RestApi Call End --------------------------------- + + PrsnlPortletManageVO prsnlPortletManageVO = ConvertUtils.convertToValueObjectAll((Map) returnMap.get("resultMap"), PrsnlPortletManageVO.class); + model.addAttribute("prsnlPortletManageVO", prsnlPortletManageVO); + + return "uritms-tiles2/sys/PrsnlPortletManageDetail"; + } + + // Body Setting Start --------------------------------- + final Map files = multiRequest.getFileMap(); + if (files != null && !files.isEmpty()) + { + for (MultipartFile file : files.values()) + { + log.info("getName => {}", file.getName()); + log.info("getOriginalFilename => {}", file.getOriginalFilename()); + + String filePath = storeSvyPathString + file.getOriginalFilename(); + String fileUrlPath = storeSvyUriPathString + file.getOriginalFilename(); + + // 파일 수정여부 확인 + if (!file.getOriginalFilename().equals("")) + { + if (file.getName().equals("portletImg")) + { + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); // 파일저장 + searchVO.setPortletImgPath(fileUrlPath); + searchVO.setPortletImgOriNm(file.getOriginalFilename()); + } + } + } + } + + searchVO.setLastUpdusrId(memberVo == null ? "" : EgovStringUtil.isNullToString(memberVo.getTokenInfo().getUniqId())); + + Map bodyMap = ConvertUtils.convertToMapAll(searchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/updatePrsnlPortlet.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /sys/updatePrsnlPortlet.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectPortletManageList.do"; + } + + /** + * 개인화메뉴 정보를 삭제한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/deletePrsnlPortlet.do") + public String deletePrsnlPortlet(@ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortlet.do <<<<<<<<<<<<<<<"); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(prsnlPortletManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/deletePrsnlPortlet.do"); + // RestApi Call End --------------------------------- + + + log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortlet.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/selectPortletManageList.do"; + } + + /** + * 개인화메뉴 정보를 멀티 삭제한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.03.06 + */ + @RequestMapping("/sys/deletePrsnlPortletMulti.do") + public String deletePrsnlPortletMulti(HttpServletRequest request + , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO + , @RequestParam("checkedPrsnlIdForDel") String checkedPrsnlIdForDel + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/deletePrsnlPortletMulti.do <<<<<<<<<<<<<<<"); + + + String sLocationUrl = ""; + String resultMsg = ""; + + String [] delPrsnlId = checkedPrsnlIdForDel.split(","); + log.info("checkedPrsnlIdForDel => [{}]", checkedPrsnlIdForDel); + + if ( (delPrsnlId == null ) + || (delPrsnlId.length == 0) ) + { + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sys/selectPortletManageList.do"; + } + else + { + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap<>(); + bodyMap.put("checkedPrsnlIdForDel", checkedPrsnlIdForDel); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/deletePrsnlPortletMulti.do"); + + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl = "forward:/sys/selectPortletManageList.do"; + } + + + log.info("resultMsg => [{}]", resultMsg); + model.addAttribute("resultMsg", resultMsg); + + + log.info("<<<<<<<<<<<<<<< /sys/deletePrsnlPortletMulti.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + /** + * 개인화메뉴 정보를 멀티 상태변경 처리한다. + * @author URP 인프라본부 나혁제 + * 작성일 : 2025.12.08 + */ + @RequestMapping("/sys/updateStatusPrsnlPortletMulti.do") + public String updateStatusPrsnlPortletMulti(HttpServletRequest request + , @ModelAttribute("prsnlPortletManageVO") PrsnlPortletManageVO prsnlPortletManageVO + , @RequestParam("checkedPrsnlIdForDel") String checkedPrsnlIdForDel + , @RequestParam("checkUseAts") String checkUseAts + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/updateStatusPrsnlPortletMulti.do <<<<<<<<<<<<<<<"); + + String sLocationUrl = ""; + String resultMsg = ""; + + log.info("checkedPrsnlIdForDel => [{}]", checkedPrsnlIdForDel ); + log.info("checkUseAts => [{}]", checkUseAts ); + + String [] delPrsnlId = checkedPrsnlIdForDel.split(","); + + if ( (delPrsnlId == null ) + || (delPrsnlId.length == 0) ) + { + resultMsg = egovMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/sys/selectPortletManageList.do"; + } + else + { + // Body Setting Start --------------------------------- + Map bodyMap = new HashMap<>(); + bodyMap.put("checkedPrsnlIdForDel", checkedPrsnlIdForDel); + bodyMap.put("checkUseAts" , checkUseAts ); + // Body Setting End --------------------------------- + + Map returnMap = restApiCallUtil.RestApiCall(request, bodyMap, "/sys/updateStatusPrsnlPortletMulti.do"); + + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sys/selectPortletManageList.do"; + } + + + log.info("resultMsg => [{}]", resultMsg); + model.addAttribute("resultMsg", resultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/updateStatusPrsnlPortletMulti.do >>>>>>>>>>>>>>>"); + + return sLocationUrl; + } + + + + + } \ No newline at end of file diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/RoleManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/RoleManageController.java index 115825e1..1151ab45 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/RoleManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/RoleManageController.java @@ -1,408 +1,408 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; - -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; -import com.urpsys.itmsfront.sys.domain.RoleManage; -import com.urpsys.itmsfront.sys.domain.RoleManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 롤관리플 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.21 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.21    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class RoleManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - @Autowired - CommonService commonService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - /** - * 등록된 롤 정보 목록 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/RoleList.do") - public String selectRoleList( @ModelAttribute("roleManageVO") RoleManageVO roleManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleList.do <<<<<<<<<<<<<<<"); - - /** paging */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (roleManageVO.getPageIndex()); - paginationInfo.setRecordCountPerPage (roleManageVO.getPageUnit()); - paginationInfo.setPageSize (roleManageVO.getPageSize()); - - roleManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - roleManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); - roleManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - Map bodyMap = ConvertUtils.convertToMapAll(roleManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleList.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - List roleList = ConvertUtils.convertToValueObjectsAll(resultList, RoleManageVO.class); - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("roleList", roleList); - model.addAttribute("paginationInfo", paginationInfo); - model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); - - log.info("<<<<<<<<<<<<<<< /sys/RoleList.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/RoleManage"; - } - - /** - * 등록된 롤 정보 조회 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/Role.do") - public String selectRole(@RequestParam("roleCode") String roleCode - , @ModelAttribute("roleManageVO") RoleManageVO roleManageVO - , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/Role.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); - bodyMap.put("roleManageVO" , ConvertUtils.convertToMapAll(roleManageVO )); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Role.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> authorManageListRe = (List>)returnMap.get("authorManageList"); - List> codeOutList = (List>)returnMap.get("codeOutList"); - Map roleManageOutMap = (Map)returnMap.get("roleManageOutMap"); - // Return Data Setting End -------------------------- - - RoleManageVO roleManage = ConvertUtils.convertToValueObjectAll(roleManageOutMap, RoleManageVO.class); - List authorManageList = ConvertUtils.convertToValueObjectsAll(authorManageListRe, AuthorManageVO.class); - List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); - - model.addAttribute("roleManage" , roleManage); - model.addAttribute("authorManageList" , authorManageList); - model.addAttribute("cmmCodeDetailList" , cmmCodeDetailList); - - log.info("<<<<<<<<<<<<<<< /sys/Role.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/RoleUpdate"; - } - - /** - * 롤 등록화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping("/sys/RoleInsertView.do") - public String insertRoleView( @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO - , @ModelAttribute("roleManage") RoleManage roleManage - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleInsertView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleInsertView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> authorManageListRe = (List>)returnMap.get("authorManageList"); - List> codeOutList = (List>)returnMap.get("codeOutList"); - // Return Data Setting End -------------------------- - - List authorManageList = ConvertUtils.convertToValueObjectsAll(authorManageListRe, AuthorManageVO.class); - List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); - - model.addAttribute("authorManageList" , authorManageList); - model.addAttribute("cmmCodeDetailList", cmmCodeDetailList); - - log.info("<<<<<<<<<<<<<<< /sys/RoleInsertView.do >>>>>>>>>>>>>>>"); - - // return "egovframework/com/sec/rmt/EgovRoleInsert"; - return "uritms-tiles2/sys/RoleInsert"; - } - - /** - * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/RoleInsert.do") - public String insertRole( @ModelAttribute("roleManage") RoleManage roleManage - , @ModelAttribute("roleManageVO") RoleManageVO roleManageVO - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(roleManage, bindingResult); //validation 수행 - - if (bindingResult.hasErrors()) - { - strReturnUrl = "egovframework/com/sec/rmt/EgovRoleInsert"; - } - else - { - String roleTyp = roleManage.getRoleTyp(); - if("method".equals(roleTyp)) - { - roleTyp = "mtd"; - } - else if("pointcut".equals(roleTyp)) - { - roleTyp = "pct"; - } - else - { - roleTyp = "web"; - } - - String strRoleId = commonService.GetIdGen("egovRoleIdGnrService"); - - if(strRoleId==null || strRoleId.equals("")) - { - model.addAttribute("resultMsg", "fail.common.insert"); - return "forward:/sys/RoleList.do"; - } - - roleManage.setRoleCode(roleTyp.concat("-").concat(strRoleId)); - roleManageVO.setRoleCode(roleManage.getRoleCode()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(roleManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map roleManageMap = (Map)returnMap.get("roleManage"); - List> codeOutList = (List>)returnMap.get("codeOutList"); - // Return Data Setting End -------------------------- - - List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); - - roleManageVO.setRoleCode((String)roleManageMap.get("roleCode")); - - model.addAttribute("cmmCodeDetailList", cmmCodeDetailList); - model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); - model.addAttribute("roleManage", roleManageVO); - - //return "egovframework/com/sec/rmt/EgovRoleUpdate"; - strReturnUrl = "forward:/sys/RoleList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/RoleInsert.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - - /** - * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/RoleUpdate.do") - public String updateRole( @ModelAttribute("roleManage") RoleManage roleManage - , BindingResult bindingResult - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleUpdate.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(roleManage, bindingResult); //validation 수행 - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/RoleUpdate"; - } - else - { - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(roleManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleUpdate.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); - strReturnUrl = "forward:/sys/RoleList.do"; - } - - log.info("<<<<<<<<<<<<<<< /sys/RoleUpdate.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - - } - - /** - * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/RoleDelete.do") - public String deleteRole( @ModelAttribute("roleManage") RoleManage roleManage - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(roleManage); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/RoleDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/RoleList.do"; - } - - /** - * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.21 - */ - @RequestMapping(value="/sys/RoleListDelete.do") - public String deleteRoleList( @RequestParam("roleCodes") String roleCodes - , @ModelAttribute("roleManage") RoleManage roleManage - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/RoleListDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("roleCodes", roleCodes); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleListDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); - - log.info("<<<<<<<<<<<<<<< /sys/RoleListDelete.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/RoleList.do"; - } - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; + +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; +import com.urpsys.itmsfront.sys.domain.RoleManage; +import com.urpsys.itmsfront.sys.domain.RoleManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 롤관리플 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.21 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.21    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class RoleManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + CommonService commonService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + /** + * 등록된 롤 정보 목록 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/RoleList.do") + public String selectRoleList( @ModelAttribute("roleManageVO") RoleManageVO roleManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleList.do <<<<<<<<<<<<<<<"); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (roleManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage (roleManageVO.getPageUnit()); + paginationInfo.setPageSize (roleManageVO.getPageSize()); + + roleManageVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + roleManageVO.setLastIndex (paginationInfo.getLastRecordIndex()); + roleManageVO.setRecordCountPerPage (paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + Map bodyMap = ConvertUtils.convertToMapAll(roleManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + Map returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleList.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + List roleList = ConvertUtils.convertToValueObjectsAll(resultList, RoleManageVO.class); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("roleList", roleList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + log.info("<<<<<<<<<<<<<<< /sys/RoleList.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/RoleManage"; + } + + /** + * 등록된 롤 정보 조회 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/Role.do") + public String selectRole(@RequestParam("roleCode") String roleCode + , @ModelAttribute("roleManageVO") RoleManageVO roleManageVO + , @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/Role.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); + bodyMap.put("roleManageVO" , ConvertUtils.convertToMapAll(roleManageVO )); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/Role.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> authorManageListRe = (List>)returnMap.get("authorManageList"); + List> codeOutList = (List>)returnMap.get("codeOutList"); + Map roleManageOutMap = (Map)returnMap.get("roleManageOutMap"); + // Return Data Setting End -------------------------- + + RoleManageVO roleManage = ConvertUtils.convertToValueObjectAll(roleManageOutMap, RoleManageVO.class); + List authorManageList = ConvertUtils.convertToValueObjectsAll(authorManageListRe, AuthorManageVO.class); + List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); + + model.addAttribute("roleManage" , roleManage); + model.addAttribute("authorManageList" , authorManageList); + model.addAttribute("cmmCodeDetailList" , cmmCodeDetailList); + + log.info("<<<<<<<<<<<<<<< /sys/Role.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/RoleUpdate"; + } + + /** + * 롤 등록화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping("/sys/RoleInsertView.do") + public String insertRoleView( @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO + , @ModelAttribute("roleManage") RoleManage roleManage + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleInsertView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("authorManageVO", ConvertUtils.convertToMapAll(authorManageVO)); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleInsertView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> authorManageListRe = (List>)returnMap.get("authorManageList"); + List> codeOutList = (List>)returnMap.get("codeOutList"); + // Return Data Setting End -------------------------- + + List authorManageList = ConvertUtils.convertToValueObjectsAll(authorManageListRe, AuthorManageVO.class); + List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); + + model.addAttribute("authorManageList" , authorManageList); + model.addAttribute("cmmCodeDetailList", cmmCodeDetailList); + + log.info("<<<<<<<<<<<<<<< /sys/RoleInsertView.do >>>>>>>>>>>>>>>"); + + // return "egovframework/com/sec/rmt/EgovRoleInsert"; + return "uritms-tiles2/sys/RoleInsert"; + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/RoleInsert.do") + public String insertRole( @ModelAttribute("roleManage") RoleManage roleManage + , @ModelAttribute("roleManageVO") RoleManageVO roleManageVO + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(roleManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) + { + strReturnUrl = "egovframework/com/sec/rmt/EgovRoleInsert"; + } + else + { + String roleTyp = roleManage.getRoleTyp(); + if("method".equals(roleTyp)) + { + roleTyp = "mtd"; + } + else if("pointcut".equals(roleTyp)) + { + roleTyp = "pct"; + } + else + { + roleTyp = "web"; + } + + String strRoleId = commonService.GetIdGen("egovRoleIdGnrService"); + + if(strRoleId==null || strRoleId.equals("")) + { + model.addAttribute("resultMsg", "fail.common.insert"); + return "forward:/sys/RoleList.do"; + } + + roleManage.setRoleCode(roleTyp.concat("-").concat(strRoleId)); + roleManageVO.setRoleCode(roleManage.getRoleCode()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(roleManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map roleManageMap = (Map)returnMap.get("roleManage"); + List> codeOutList = (List>)returnMap.get("codeOutList"); + // Return Data Setting End -------------------------- + + List cmmCodeDetailList = ConvertUtils.convertToValueObjectsAll(codeOutList, ComDefaultCodeVO.class); + + roleManageVO.setRoleCode((String)roleManageMap.get("roleCode")); + + model.addAttribute("cmmCodeDetailList", cmmCodeDetailList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("roleManage", roleManageVO); + + //return "egovframework/com/sec/rmt/EgovRoleUpdate"; + strReturnUrl = "forward:/sys/RoleList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/RoleInsert.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/RoleUpdate.do") + public String updateRole( @ModelAttribute("roleManage") RoleManage roleManage + , BindingResult bindingResult + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleUpdate.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(roleManage, bindingResult); //validation 수행 + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/RoleUpdate"; + } + else + { + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(roleManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleUpdate.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + strReturnUrl = "forward:/sys/RoleList.do"; + } + + log.info("<<<<<<<<<<<<<<< /sys/RoleUpdate.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + + } + + /** + * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/RoleDelete.do") + public String deleteRole( @ModelAttribute("roleManage") RoleManage roleManage + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(roleManage); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/RoleDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/RoleList.do"; + } + + /** + * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.21 + */ + @RequestMapping(value="/sys/RoleListDelete.do") + public String deleteRoleList( @RequestParam("roleCodes") String roleCodes + , @ModelAttribute("roleManage") RoleManage roleManage + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/RoleListDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("roleCodes", roleCodes); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/RoleListDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + + log.info("<<<<<<<<<<<<<<< /sys/RoleListDelete.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/RoleList.do"; + } + + + + + + + + + + + + + + + +} diff --git a/front/src/main/java/com/urpsys/itmsfront/sys/controller/UserManageController.java b/front/src/main/java/com/urpsys/itmsfront/sys/controller/UserManageController.java index eef5c737..36fb64ad 100644 --- a/front/src/main/java/com/urpsys/itmsfront/sys/controller/UserManageController.java +++ b/front/src/main/java/com/urpsys/itmsfront/sys/controller/UserManageController.java @@ -1,806 +1,806 @@ -package com.urpsys.itmsfront.sys.controller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.egovframe.rte.fdl.property.EgovPropertyService; -import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.servlet.ModelAndView; -import org.springmodules.validation.commons.DefaultBeanValidator; - -import com.urpsys.basefront.common.service.CommonService; -import com.urpsys.basefront.common.util.CommonUtil; -import com.urpsys.basefront.common.util.ConvertUtils; -import com.urpsys.basefront.common.util.RestApiCallUtil; -import com.urpsys.basefront.config.EgovMessageSource; -import com.urpsys.basefront.domain.MemberVO; -import com.urpsys.basefront.domain.TokenInfo; -import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; -import com.urpsys.itmsfront.sys.domain.AuthorManageVO; -import com.urpsys.itmsfront.sys.domain.RoleManage; -import com.urpsys.itmsfront.sys.domain.RoleManageVO; -import com.urpsys.itmsfront.sys.domain.UserDefaultVO; -import com.urpsys.itmsfront.sys.domain.UserManageVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * 업무사용자관리을 처리하는 Controller 클래스 - * @author urp 인프라본부 나혁제 - * @since 2025.01.16 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >>
- *
- *  수정일          수정자        수정내용
- *  ----------   --------   ---------------------------
- *  2025.01.16    나혁제        최초 생성
- *
- *  
- */ - - -@Slf4j -@Controller -public class UserManageController -{ - /** Validator */ - @Autowired - private DefaultBeanValidator beanValidator; - - /** EgovMessageSource */ - @Resource(name="egovMessageSource") - EgovMessageSource egovMessageSource; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; - - @Resource(name="RestApiCallUtil") - private RestApiCallUtil restApiCallUtil; - - @Autowired - private CommonService commonService; - - - /** - * 사용자목록을 조회한다. (pageing) - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/UserManage.do") - public String selectUserList( @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO - , ModelMap model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserManage.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - /** EgovPropertyService */ - userSearchVO.setPageUnit(propertiesService.getInt("pageUnit")); - userSearchVO.setPageSize(propertiesService.getInt("pageSize")); - - /** pageing */ - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo (userSearchVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(userSearchVO.getPageUnit()); - paginationInfo.setPageSize (userSearchVO.getPageSize()); - - userSearchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); - userSearchVO.setLastIndex (paginationInfo.getLastRecordIndex()); - userSearchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userSearchVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserManage.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - List> resultList = (List>)returnMap.get("resultList"); - int totCnt = (int)returnMap.get("totCnt"); - // Return Data Setting End -------------------------- - - paginationInfo.setTotalRecordCount(totCnt); - - model.addAttribute("resultList", resultList); - model.addAttribute("paginationInfo", paginationInfo); - - // 공통코드 추출 - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("COM013"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_COM013"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드목록 - - log.info("<<<<<<<<<<<<<<< /sys/UserManage.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/UserManage"; - // return "egovframework/com/uss/umt/EgovUserManage"; - } - - /** - * 사용자정보 수정을 위해 사용자정보를 상세조회한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - // 2025.08.11 나혁제 uniqId key 가 업는경우 빈상태로 설정 - @RequestMapping("/sys/UserSelectUpdtView.do") - // public String updateUserView( @RequestParam("selectedId") String uniqId - public String updateUserView( @RequestParam(value = "selectedId", defaultValue = "") String uniqId - , @ModelAttribute("searchVO") UserDefaultVO userSearchVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserSelectUpdtView.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 공통코드 추출 - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("COM022,COM014,COM013,COM025"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_COM022"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("passwordHint_result", chglistComCode); // 패스워드힌트목록을 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM014"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("sexdstnCode_result", chglistComCode); // 성별구분코드를 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM013"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드를 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM025"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("insttCode_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 - - // 조직정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectOgrnztIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("orgnztId_result", chglistComCode); - - // 조직정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectGroupIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 - - MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - - TokenInfo tokenInfo = memberVo.getTokenInfo(); - - String strTokenUniqId = tokenInfo.getUniqId(); - String strTokenAuthorities = tokenInfo.getAuthorities(); - String strAdminYn = ""; - - log.info(" 한번봅시다 tokenInfo.getUniqId() : {}", tokenInfo.getUniqId()); - log.info(" 한번봅시다 tokenInfo.getAuthorities() : {}", tokenInfo.getAuthorities()); - - // 파라미터가 없는경우 토큰에서 추출 - if(uniqId.equals("")) - { - uniqId = strTokenUniqId; - } - - if(strTokenAuthorities.indexOf("ADMIN")>-1) - { - strAdminYn ="Y"; - } - - // Body Setting Start --------------------------------- - bodyMap = new LinkedHashMap(); - bodyMap.put("uniqId", uniqId); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdtView.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - Map resultMap = (Map)returnMap.get("resultMap"); - // Return Data Setting End -------------------------- - - UserManageVO userManageVO = ConvertUtils.convertToValueObjectAll(resultMap, UserManageVO.class); - - model.addAttribute("userSearchVO", userSearchVO ); - model.addAttribute("userManageVO", userManageVO ); - model.addAttribute("adminYn" , strAdminYn ); - - log.info("<<<<<<<<<<<<<<< /sys/UserSelectUpdtView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/UserSelectUpdt"; - // return "egovframework/com/uss/umt/EgovUserSelectUpdt"; - } - - /** - * 사용자등록화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/UserInsertView.do") - public String insertUserView( @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO - , @ModelAttribute("userManageVO") UserManageVO userManageVO - , Model model) throws Exception - { - log.info(" >>>>>>>>>>>>>>> /sys/UserInsertView.do <<<<<<<<<<<<<<< "); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // 공통코드 추출 - ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); - voComCode = new ComDefaultCodeVO(); - voComCode.setCodeId("COM022,COM014,COM013,COM025"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); - // RestApi Call End --------------------------------- - - List> listComCode = new ArrayList(); - List chglistComCode = new ArrayList(); - - listComCode = (List>)returnMap.get("resultList_COM022"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("passwordHint_result", chglistComCode); // 패스워드힌트목록을 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM014"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("sexdstnCode_result", chglistComCode); // 성별구분코드를 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM013"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드를 코드정보로부터 조회 - - listComCode = (List>)returnMap.get("resultList_COM025"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("insttCode_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 - - // 조직정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectOgrnztIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("orgnztId_result", chglistComCode); - - // 그룹정보 추출 - voComCode = new ComDefaultCodeVO(); - voComCode.setTableNm("COMTNORGNZTINFO"); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMap(voComCode); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectGroupIdDetail.do"); - // RestApi Call End --------------------------------- - - listComCode = (List>)returnMap.get("resultList"); - chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); - model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 - - log.info(" <<<<<<<<<<<<<<< /sys/UserInsertView.do >>>>>>>>>>>>>>> "); - - return "uritms-tiles2/sys/UserInsert"; - } - - - /** - * 업무사용자 암호 수정 화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/UserPasswordUpdtView.do") - public String updatePasswordView( ModelMap model - , @RequestParam Map commandMap - , @RequestParam("adminYn") String strAdminYn - , @ModelAttribute("searchVO") UserDefaultVO userSearchVO - , @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserPasswordUpdtView.do <<<<<<<<<<<<<<<"); - - String userTyForPassword = (String) commandMap.get("userTyForPassword"); - userManageVO.setUserTy(userTyForPassword); - - log.info("strAdminYn=>"+strAdminYn); - - model.addAttribute("userManageVO", userManageVO ); - model.addAttribute("userSearchVO", userSearchVO ); - model.addAttribute("adminYn" , strAdminYn ); - - log.info("<<<<<<<<<<<<<<< /sys/UserPasswordUpdtView.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/UserPasswordUpdt"; - // return "egovframework/com/uss/umt/EgovUserPasswordUpdt"; - } - - /** - * 업무사용자 암호 수정처리 후 화면 이동 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/UserPasswordUpdt.do") - public String updatePassword( ModelMap model - , @RequestParam Map commandMap - , @RequestParam("adminYn") String strAdminYn - , @ModelAttribute("searchVO") UserDefaultVO userSearchVO - , @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserPasswordUpdt.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String oldPassword = (String) commandMap.get("oldPassword"); - String newPassword = (String) commandMap.get("newPassword"); - String newPassword2 = (String) commandMap.get("newPassword2"); - String uniqId = (String) commandMap.get("uniqId"); - - - // Body Setting Start --------------------------------- - bodyMap = new LinkedHashMap(); - bodyMap.put("oldPassword" , oldPassword ); - bodyMap.put("newPassword" , newPassword ); - bodyMap.put("newPassword2" , newPassword2 ); - bodyMap.put("uniqId" , uniqId ); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserPasswordUpdt.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - boolean isCorrectPassword = (boolean)returnMap.get("isCorrectPassword"); - String resultMsg = (String)returnMap.get("resultMsg"); - // Return Data Setting End -------------------------- - - model.addAttribute("userSearchVO", userSearchVO); - model.addAttribute("resultMsg" , resultMsg); - model.addAttribute("adminYn" , strAdminYn ); - - log.info("<<<<<<<<<<<<<<< /sys/UserPasswordUpdt.do >>>>>>>>>>>>>>>"); - - return "uritms-tiles2/sys/UserPasswordUpdt"; - } - - /** - * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping(value = "/sys/IdDplctCnfirmAjax.do") - public ModelAndView checkIdDplctAjax(@RequestParam Map commandMap) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/IdDplctCnfirmAjax.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("jsonView"); - - String checkId = (String) commandMap.get("checkId"); - - // Body Setting Start --------------------------------- - // bodyMap = ConvertUtils.convertToMap(commandMap); - bodyMap.put("checkId", checkId); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/IdDplctCnfirmAjax.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int usedCnt = (int)returnMap.get("usedCnt"); - // Return Data Setting End -------------------------- - - modelAndView.addObject("usedCnt", usedCnt); - modelAndView.addObject("checkId", checkId); - - log.info("<<<<<<<<<<<<<<< /sys/IdDplctCnfirmAjax.do >>>>>>>>>>>>>>>"); - - return modelAndView; - } - - /** - * 사용자등록처리후 목록화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/UserInsert.do") - public String insertUser( @ModelAttribute("userManageVO") UserManageVO userManageVO - , BindingResult bindingResult - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserInsert.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - beanValidator.validate(userManageVO, bindingResult); - - if (bindingResult.hasErrors()) - { - strReturnUrl = "uritms-tiles2/sys/UserInsert"; - } - else - { - /* - // Body Setting Start --------------------------------- - bodyMap.put("IdName", "egovUsrCnfrmIdGnrService"); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/GetIdGen.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String uniqId = (String)returnMap.get("strGenId"); - // Return Data Setting End -------------------------- - */ - - String uniqId = commonService.GetIdGen("egovUsrCnfrmIdGnrService"); - - if(uniqId==null || uniqId.equals("")) - { - model.addAttribute("resultMsg", "fail.common.insert"); - return "forward:/sys/UserManage.do"; - } - - /* - //고유아이디 셋팅 - String uniqId = idgenService.getNextStringId(); - */ - - userManageVO.setUniqId(uniqId); - - // KISA 보안약점 조치 - if ("".equals(userManageVO.getOrgnztId())) - { - userManageVO.setOrgnztId(null); - } - - //KISA 보안약점 조치 - if ("".equals(userManageVO.getGroupId())) - { - userManageVO.setGroupId(null); - } - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserInsert.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - //Exception 없이 진행시 등록성공메시지 - model.addAttribute("resultMsg", "success.common.insert"); - - strReturnUrl = "forward:/sys/UserManage.do"; - } - - log.info(">>>>>>>>>>>>>>> /sys/UserInsert.do <<<<<<<<<<<<<<<"); - - return strReturnUrl; - } - - /** - * 사용자정보 수정후 목록조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/UserSelectUpdt.do") - public String updateUser( @ModelAttribute("userManageVO") UserManageVO userManageVO - , @RequestParam("adminYn") String strAdminYn - , BindingResult bindingResult - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserSelectUpdt.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - String strReturnUrl=""; - - log.info("userManageVO : [{}]", userManageVO.getEmailAdres()); - - // /* 2025.08.22 나혁제 일단 체크하지 않음 - beanValidator.validate(userManageVO, bindingResult); - if (bindingResult.hasErrors()) - { - model.addAttribute("resultMsg", bindingResult.getAllErrors().get(0).getDefaultMessage()); - strReturnUrl = "forward:/sys/UserManage.do"; - } - else - { - if ("".equals(userManageVO.getOrgnztId())) - { - userManageVO.setOrgnztId(null); - } - - if ("".equals(userManageVO.getGroupId())) - { - userManageVO.setGroupId(null); - } - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdt.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - //Exception 없이 진행시 수정성공메시지 - model.addAttribute("resultMsg", "success.common.update"); - - if(strAdminYn.equals("Y")) - { - strReturnUrl = "forward:/sys/UserManage.do"; - } - else - { - strReturnUrl = "redirect:/sys/UserSelectUpdtView.do?selectedId="; - } - } - - /* - String strReturnUrl=""; - - if ("".equals(userManageVO.getOrgnztId())) - { - userManageVO.setOrgnztId(null); - } - - if ("".equals(userManageVO.getGroupId())) - { - userManageVO.setGroupId(null); - } - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdt.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - //Exception 없이 진행시 수정성공메시지 - model.addAttribute("resultMsg", "success.common.update"); - - if(strAdminYn.equals("Y")) - { - strReturnUrl = "forward:/sys/UserManage.do"; - } - else - { - strReturnUrl = "redirect:/sys/UserSelectUpdtView.do?selectedId="; - } - */ - - log.info("strReturnUrl [{}]", strReturnUrl); - log.info("<<<<<<<<<<<<<<< /sys/UserSelectUpdt.do >>>>>>>>>>>>>>>"); - - return strReturnUrl; - } - - /** - * 사용자정보삭제후 목록조회 화면으로 이동한다. - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/UserDelete.do") - public String deleteUser(@RequestParam("checkedIdForDel") String checkedIdForDel - , @ModelAttribute("searchVO") UserDefaultVO userSearchVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserDelete.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap.put("checkedIdForDel", checkedIdForDel); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserDelete.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - //Exception 없이 진행시 등록성공메시지 - model.addAttribute("resultMsg", "success.common.delete"); - - log.info(">>>>>>>>>>>>>>> /sys/UserDelete.do <<<<<<<<<<<<<<<"); - - return "forward:/sys/UserManage.do"; - } - - /** - * 로그인인증제한 해제 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.01.16 - */ - @RequestMapping("/sys/UserLockIncorrect.do") - public String updateLockIncorrect( UserManageVO userManageVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserLockIncorrect.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserLockIncorrect.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - int iResult = (int)returnMap.get("iResult"); - // Return Data Setting End -------------------------- - - log.info("<<<<<<<<<<<<<<< /sys/UserLockIncorrect.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/UserSelectUpdtView.do"; - } - - /** - * 비밀번호 초기화 처리 - * @author urp 인프라본부 나혁제 - * 작성일 : 2025.07.17 - */ - @RequestMapping("/sys/UserPasswordReset.do") - public String UserPasswordReset( UserManageVO userManageVO - , Model model) throws Exception - { - log.info(">>>>>>>>>>>>>>> /sys/UserPasswordReset.do <<<<<<<<<<<<<<<"); - - Map bodyMap = new LinkedHashMap(); - Map returnMap = new LinkedHashMap(); - - // Body Setting Start --------------------------------- - bodyMap = ConvertUtils.convertToMapAll(userManageVO); - // Body Setting End --------------------------------- - - // RestApi Call Start --------------------------------- - returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserPasswordReset.do"); - // RestApi Call End --------------------------------- - - // Return Data Setting Start -------------------------- - String strResultCd = (String)returnMap.get("resultCd" ); - String strResultMsg = (String)returnMap.get("resultMsg"); - // Return Data Setting End -------------------------- - - model.addAttribute("strResultMsg", strResultMsg); - - log.info("<<<<<<<<<<<<<<< /sys/UserPasswordReset.do >>>>>>>>>>>>>>>"); - - return "forward:/sys/UserSelectUpdtView.do"; - } - - - - - - - - - - - - - - - - - - - - - - - - -} +package com.urpsys.itmsfront.sys.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.ModelAndView; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.urpsys.basefront.common.service.CommonService; +import com.urpsys.basefront.common.util.CommonUtil; +import com.urpsys.common.util.ConvertUtils; +import com.urpsys.basefront.common.util.RestApiCallUtil; +import com.urpsys.basefront.config.EgovMessageSource; +import com.urpsys.basefront.domain.MemberVO; +import com.urpsys.basefront.domain.TokenInfo; +import com.urpsys.itmsfront.cmm.domain.ComDefaultCodeVO; +import com.urpsys.itmsfront.sys.domain.AuthorManageVO; +import com.urpsys.itmsfront.sys.domain.RoleManage; +import com.urpsys.itmsfront.sys.domain.RoleManageVO; +import com.urpsys.itmsfront.sys.domain.UserDefaultVO; +import com.urpsys.itmsfront.sys.domain.UserManageVO; + +import lombok.extern.slf4j.Slf4j; + +/** + * 업무사용자관리을 처리하는 Controller 클래스 + * @author urp 인프라본부 나혁제 + * @since 2025.01.16 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일          수정자        수정내용
+ *  ----------   --------   ---------------------------
+ *  2025.01.16    나혁제        최초 생성
+ *
+ *  
+ */ + + +@Slf4j +@Controller +public class UserManageController +{ + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Resource(name="RestApiCallUtil") + private RestApiCallUtil restApiCallUtil; + + @Autowired + private CommonService commonService; + + + /** + * 사용자목록을 조회한다. (pageing) + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/UserManage.do") + public String selectUserList( @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO + , ModelMap model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserManage.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + /** EgovPropertyService */ + userSearchVO.setPageUnit(propertiesService.getInt("pageUnit")); + userSearchVO.setPageSize(propertiesService.getInt("pageSize")); + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo (userSearchVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(userSearchVO.getPageUnit()); + paginationInfo.setPageSize (userSearchVO.getPageSize()); + + userSearchVO.setFirstIndex (paginationInfo.getFirstRecordIndex()); + userSearchVO.setLastIndex (paginationInfo.getLastRecordIndex()); + userSearchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userSearchVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserManage.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + List> resultList = (List>)returnMap.get("resultList"); + int totCnt = (int)returnMap.get("totCnt"); + // Return Data Setting End -------------------------- + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", resultList); + model.addAttribute("paginationInfo", paginationInfo); + + // 공통코드 추출 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM013"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_COM013"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드목록 + + log.info("<<<<<<<<<<<<<<< /sys/UserManage.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/UserManage"; + // return "egovframework/com/uss/umt/EgovUserManage"; + } + + /** + * 사용자정보 수정을 위해 사용자정보를 상세조회한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + // 2025.08.11 나혁제 uniqId key 가 업는경우 빈상태로 설정 + @RequestMapping("/sys/UserSelectUpdtView.do") + // public String updateUserView( @RequestParam("selectedId") String uniqId + public String updateUserView( @RequestParam(value = "selectedId", defaultValue = "") String uniqId + , @ModelAttribute("searchVO") UserDefaultVO userSearchVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserSelectUpdtView.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 공통코드 추출 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM022,COM014,COM013,COM025"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_COM022"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("passwordHint_result", chglistComCode); // 패스워드힌트목록을 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM014"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("sexdstnCode_result", chglistComCode); // 성별구분코드를 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM013"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드를 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM025"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("insttCode_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 + + // 조직정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectOgrnztIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("orgnztId_result", chglistComCode); + + // 조직정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectGroupIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 + + MemberVO memberVo = (MemberVO)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + + TokenInfo tokenInfo = memberVo.getTokenInfo(); + + String strTokenUniqId = tokenInfo.getUniqId(); + String strTokenAuthorities = tokenInfo.getAuthorities(); + String strAdminYn = ""; + + log.info(" 한번봅시다 tokenInfo.getUniqId() : {}", tokenInfo.getUniqId()); + log.info(" 한번봅시다 tokenInfo.getAuthorities() : {}", tokenInfo.getAuthorities()); + + // 파라미터가 없는경우 토큰에서 추출 + if(uniqId.equals("")) + { + uniqId = strTokenUniqId; + } + + if(strTokenAuthorities.indexOf("ADMIN")>-1) + { + strAdminYn ="Y"; + } + + // Body Setting Start --------------------------------- + bodyMap = new LinkedHashMap(); + bodyMap.put("uniqId", uniqId); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdtView.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + Map resultMap = (Map)returnMap.get("resultMap"); + // Return Data Setting End -------------------------- + + UserManageVO userManageVO = ConvertUtils.convertToValueObjectAll(resultMap, UserManageVO.class); + + model.addAttribute("userSearchVO", userSearchVO ); + model.addAttribute("userManageVO", userManageVO ); + model.addAttribute("adminYn" , strAdminYn ); + + log.info("<<<<<<<<<<<<<<< /sys/UserSelectUpdtView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/UserSelectUpdt"; + // return "egovframework/com/uss/umt/EgovUserSelectUpdt"; + } + + /** + * 사용자등록화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/UserInsertView.do") + public String insertUserView( @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO + , @ModelAttribute("userManageVO") UserManageVO userManageVO + , Model model) throws Exception + { + log.info(" >>>>>>>>>>>>>>> /sys/UserInsertView.do <<<<<<<<<<<<<<< "); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // 공통코드 추출 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM022,COM014,COM013,COM025"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectCmmCodeDetail.do"); + // RestApi Call End --------------------------------- + + List> listComCode = new ArrayList(); + List chglistComCode = new ArrayList(); + + listComCode = (List>)returnMap.get("resultList_COM022"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("passwordHint_result", chglistComCode); // 패스워드힌트목록을 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM014"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("sexdstnCode_result", chglistComCode); // 성별구분코드를 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM013"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("emplyrSttusCode_result", chglistComCode); // 사용자상태코드를 코드정보로부터 조회 + + listComCode = (List>)returnMap.get("resultList_COM025"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("insttCode_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 + + // 조직정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectOgrnztIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("orgnztId_result", chglistComCode); + + // 그룹정보 추출 + voComCode = new ComDefaultCodeVO(); + voComCode.setTableNm("COMTNORGNZTINFO"); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMap(voComCode); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/selectGroupIdDetail.do"); + // RestApi Call End --------------------------------- + + listComCode = (List>)returnMap.get("resultList"); + chglistComCode = ConvertUtils.convertToValueObjects(listComCode, ComDefaultCodeVO.class); + model.addAttribute("groupId_result", chglistComCode); // 소속기관코드를 코드정보로부터 조회 - COM025 + + log.info(" <<<<<<<<<<<<<<< /sys/UserInsertView.do >>>>>>>>>>>>>>> "); + + return "uritms-tiles2/sys/UserInsert"; + } + + + /** + * 업무사용자 암호 수정 화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/UserPasswordUpdtView.do") + public String updatePasswordView( ModelMap model + , @RequestParam Map commandMap + , @RequestParam("adminYn") String strAdminYn + , @ModelAttribute("searchVO") UserDefaultVO userSearchVO + , @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserPasswordUpdtView.do <<<<<<<<<<<<<<<"); + + String userTyForPassword = (String) commandMap.get("userTyForPassword"); + userManageVO.setUserTy(userTyForPassword); + + log.info("strAdminYn=>"+strAdminYn); + + model.addAttribute("userManageVO", userManageVO ); + model.addAttribute("userSearchVO", userSearchVO ); + model.addAttribute("adminYn" , strAdminYn ); + + log.info("<<<<<<<<<<<<<<< /sys/UserPasswordUpdtView.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/UserPasswordUpdt"; + // return "egovframework/com/uss/umt/EgovUserPasswordUpdt"; + } + + /** + * 업무사용자 암호 수정처리 후 화면 이동 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/UserPasswordUpdt.do") + public String updatePassword( ModelMap model + , @RequestParam Map commandMap + , @RequestParam("adminYn") String strAdminYn + , @ModelAttribute("searchVO") UserDefaultVO userSearchVO + , @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserPasswordUpdt.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String oldPassword = (String) commandMap.get("oldPassword"); + String newPassword = (String) commandMap.get("newPassword"); + String newPassword2 = (String) commandMap.get("newPassword2"); + String uniqId = (String) commandMap.get("uniqId"); + + + // Body Setting Start --------------------------------- + bodyMap = new LinkedHashMap(); + bodyMap.put("oldPassword" , oldPassword ); + bodyMap.put("newPassword" , newPassword ); + bodyMap.put("newPassword2" , newPassword2 ); + bodyMap.put("uniqId" , uniqId ); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserPasswordUpdt.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + boolean isCorrectPassword = (boolean)returnMap.get("isCorrectPassword"); + String resultMsg = (String)returnMap.get("resultMsg"); + // Return Data Setting End -------------------------- + + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("resultMsg" , resultMsg); + model.addAttribute("adminYn" , strAdminYn ); + + log.info("<<<<<<<<<<<<<<< /sys/UserPasswordUpdt.do >>>>>>>>>>>>>>>"); + + return "uritms-tiles2/sys/UserPasswordUpdt"; + } + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping(value = "/sys/IdDplctCnfirmAjax.do") + public ModelAndView checkIdDplctAjax(@RequestParam Map commandMap) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/IdDplctCnfirmAjax.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + String checkId = (String) commandMap.get("checkId"); + + // Body Setting Start --------------------------------- + // bodyMap = ConvertUtils.convertToMap(commandMap); + bodyMap.put("checkId", checkId); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/IdDplctCnfirmAjax.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int usedCnt = (int)returnMap.get("usedCnt"); + // Return Data Setting End -------------------------- + + modelAndView.addObject("usedCnt", usedCnt); + modelAndView.addObject("checkId", checkId); + + log.info("<<<<<<<<<<<<<<< /sys/IdDplctCnfirmAjax.do >>>>>>>>>>>>>>>"); + + return modelAndView; + } + + /** + * 사용자등록처리후 목록화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/UserInsert.do") + public String insertUser( @ModelAttribute("userManageVO") UserManageVO userManageVO + , BindingResult bindingResult + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserInsert.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + beanValidator.validate(userManageVO, bindingResult); + + if (bindingResult.hasErrors()) + { + strReturnUrl = "uritms-tiles2/sys/UserInsert"; + } + else + { + /* + // Body Setting Start --------------------------------- + bodyMap.put("IdName", "egovUsrCnfrmIdGnrService"); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/cmm/GetIdGen.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String uniqId = (String)returnMap.get("strGenId"); + // Return Data Setting End -------------------------- + */ + + String uniqId = commonService.GetIdGen("egovUsrCnfrmIdGnrService"); + + if(uniqId==null || uniqId.equals("")) + { + model.addAttribute("resultMsg", "fail.common.insert"); + return "forward:/sys/UserManage.do"; + } + + /* + //고유아이디 셋팅 + String uniqId = idgenService.getNextStringId(); + */ + + userManageVO.setUniqId(uniqId); + + // KISA 보안약점 조치 + if ("".equals(userManageVO.getOrgnztId())) + { + userManageVO.setOrgnztId(null); + } + + //KISA 보안약점 조치 + if ("".equals(userManageVO.getGroupId())) + { + userManageVO.setGroupId(null); + } + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserInsert.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + //Exception 없이 진행시 등록성공메시지 + model.addAttribute("resultMsg", "success.common.insert"); + + strReturnUrl = "forward:/sys/UserManage.do"; + } + + log.info(">>>>>>>>>>>>>>> /sys/UserInsert.do <<<<<<<<<<<<<<<"); + + return strReturnUrl; + } + + /** + * 사용자정보 수정후 목록조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/UserSelectUpdt.do") + public String updateUser( @ModelAttribute("userManageVO") UserManageVO userManageVO + , @RequestParam("adminYn") String strAdminYn + , BindingResult bindingResult + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserSelectUpdt.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + String strReturnUrl=""; + + log.info("userManageVO : [{}]", userManageVO.getEmailAdres()); + + // /* 2025.08.22 나혁제 일단 체크하지 않음 + beanValidator.validate(userManageVO, bindingResult); + if (bindingResult.hasErrors()) + { + model.addAttribute("resultMsg", bindingResult.getAllErrors().get(0).getDefaultMessage()); + strReturnUrl = "forward:/sys/UserManage.do"; + } + else + { + if ("".equals(userManageVO.getOrgnztId())) + { + userManageVO.setOrgnztId(null); + } + + if ("".equals(userManageVO.getGroupId())) + { + userManageVO.setGroupId(null); + } + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdt.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + //Exception 없이 진행시 수정성공메시지 + model.addAttribute("resultMsg", "success.common.update"); + + if(strAdminYn.equals("Y")) + { + strReturnUrl = "forward:/sys/UserManage.do"; + } + else + { + strReturnUrl = "redirect:/sys/UserSelectUpdtView.do?selectedId="; + } + } + + /* + String strReturnUrl=""; + + if ("".equals(userManageVO.getOrgnztId())) + { + userManageVO.setOrgnztId(null); + } + + if ("".equals(userManageVO.getGroupId())) + { + userManageVO.setGroupId(null); + } + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserSelectUpdt.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + //Exception 없이 진행시 수정성공메시지 + model.addAttribute("resultMsg", "success.common.update"); + + if(strAdminYn.equals("Y")) + { + strReturnUrl = "forward:/sys/UserManage.do"; + } + else + { + strReturnUrl = "redirect:/sys/UserSelectUpdtView.do?selectedId="; + } + */ + + log.info("strReturnUrl [{}]", strReturnUrl); + log.info("<<<<<<<<<<<<<<< /sys/UserSelectUpdt.do >>>>>>>>>>>>>>>"); + + return strReturnUrl; + } + + /** + * 사용자정보삭제후 목록조회 화면으로 이동한다. + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/UserDelete.do") + public String deleteUser(@RequestParam("checkedIdForDel") String checkedIdForDel + , @ModelAttribute("searchVO") UserDefaultVO userSearchVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserDelete.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap.put("checkedIdForDel", checkedIdForDel); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserDelete.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + //Exception 없이 진행시 등록성공메시지 + model.addAttribute("resultMsg", "success.common.delete"); + + log.info(">>>>>>>>>>>>>>> /sys/UserDelete.do <<<<<<<<<<<<<<<"); + + return "forward:/sys/UserManage.do"; + } + + /** + * 로그인인증제한 해제 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.01.16 + */ + @RequestMapping("/sys/UserLockIncorrect.do") + public String updateLockIncorrect( UserManageVO userManageVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserLockIncorrect.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserLockIncorrect.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + int iResult = (int)returnMap.get("iResult"); + // Return Data Setting End -------------------------- + + log.info("<<<<<<<<<<<<<<< /sys/UserLockIncorrect.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/UserSelectUpdtView.do"; + } + + /** + * 비밀번호 초기화 처리 + * @author urp 인프라본부 나혁제 + * 작성일 : 2025.07.17 + */ + @RequestMapping("/sys/UserPasswordReset.do") + public String UserPasswordReset( UserManageVO userManageVO + , Model model) throws Exception + { + log.info(">>>>>>>>>>>>>>> /sys/UserPasswordReset.do <<<<<<<<<<<<<<<"); + + Map bodyMap = new LinkedHashMap(); + Map returnMap = new LinkedHashMap(); + + // Body Setting Start --------------------------------- + bodyMap = ConvertUtils.convertToMapAll(userManageVO); + // Body Setting End --------------------------------- + + // RestApi Call Start --------------------------------- + returnMap = restApiCallUtil.RestApiCall(bodyMap, "/sys/UserPasswordReset.do"); + // RestApi Call End --------------------------------- + + // Return Data Setting Start -------------------------- + String strResultCd = (String)returnMap.get("resultCd" ); + String strResultMsg = (String)returnMap.get("resultMsg"); + // Return Data Setting End -------------------------- + + model.addAttribute("strResultMsg", strResultMsg); + + log.info("<<<<<<<<<<<<<<< /sys/UserPasswordReset.do >>>>>>>>>>>>>>>"); + + return "forward:/sys/UserSelectUpdtView.do"; + } + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/settings.gradle b/settings.gradle index 76707166..a341d377 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,8 @@ rootProject.name = 'itms' // ITMS 통합 멀티모듈 (INTEGRATION_DESIGN.md §2) -// common 모듈은 refactor 단계에서 추가 예정. legacy/nlib(Maven·Java 8)은 Gradle 컴포짓 제외. +// common: 공통 클래스 단일화 모듈. legacy/nlib(Maven·Java 8)은 Gradle 컴포짓 제외. +include 'common' include 'auth' include 'api' include 'front'